Switch to unified view

a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp
...
...
932
#include "rclinit.h"
932
#include "rclinit.h"
933
#include "rclconfig.h"
933
#include "rclconfig.h"
934
934
935
static char *thisprog;
935
static char *thisprog;
936
936
937
static char usage [] =
937
static char usage [] = "\n"
938
"  \n\n"
938
"-c: check a few things in the configuration files\n"
939
"[-s subkey] -q param : query parameter value\n"
940
"  : default: print parameters\n"
939
;
941
;
940
static void
942
static void
941
Usage(void)
943
Usage(void)
942
{
944
{
943
    fprintf(stderr, "%s: usage:\n%s [-s subkey] [-q param]", thisprog, usage);
945
    fprintf(stderr, "%s: usage: %s\n", thisprog, usage);
944
    exit(1);
946
    exit(1);
945
}
947
}
946
948
947
static int     op_flags;
949
static int     op_flags;
948
#define OPT_MOINS 0x1
950
#define OPT_MOINS 0x1
949
#define OPT_s     0x2 
951
#define OPT_s     0x2 
950
#define OPT_q     0x4 
952
#define OPT_q     0x4 
951
953
#define OPT_c     0x8
952
int main(int argc, char **argv)
954
int main(int argc, char **argv)
953
{
955
{
954
    string pname, skey;
956
    string pname, skey;
955
    
957
    
956
    thisprog = argv[0];
958
    thisprog = argv[0];
...
...
961
    if (!(**argv))
963
    if (!(**argv))
962
        /* Cas du "adb - core" */
964
        /* Cas du "adb - core" */
963
        Usage();
965
        Usage();
964
    while (**argv)
966
    while (**argv)
965
        switch (*(*argv)++) {
967
        switch (*(*argv)++) {
968
      case 'c':   op_flags |= OPT_c; break;
966
        case 's':   op_flags |= OPT_s; if (argc < 2)  Usage();
969
        case 's':   op_flags |= OPT_s; if (argc < 2)  Usage();
967
        skey = *(++argv);
970
        skey = *(++argv);
968
        argc--; 
971
        argc--; 
969
        goto b1;
972
        goto b1;
970
        case 'q':   op_flags |= OPT_q; if (argc < 2)  Usage();
973
        case 'q':   op_flags |= OPT_q; if (argc < 2)  Usage();
...
...
992
    if (!config->getConfParam(pname, value)) {
995
    if (!config->getConfParam(pname, value)) {
993
        fprintf(stderr, "getConfParam failed for [%s]\n", pname.c_str());
996
        fprintf(stderr, "getConfParam failed for [%s]\n", pname.c_str());
994
        exit(1);
997
        exit(1);
995
    }
998
    }
996
    printf("[%s] -> [%s]\n", pname.c_str(), value.c_str());
999
    printf("[%s] -> [%s]\n", pname.c_str(), value.c_str());
1000
    } else if (op_flags & OPT_c) {
1001
        // Check that all known mime types have an icon and belong to
1002
        // some category
1003
        list<string> catnames;
1004
        config->getMimeCategories(catnames);
1005
        cout << "Categories: ";
1006
        set<string> allmtsfromcats;
1007
        for (list<string>::const_iterator it = catnames.begin(); 
1008
             it != catnames.end(); it++) {
1009
            cout << *it << " ";
1010
        }
1011
        cout << endl;
1012
        for (list<string>::const_iterator it = catnames.begin(); 
1013
             it != catnames.end(); it++) {
1014
            list<string> cts;
1015
            config->getMimeCatTypes(*it, cts);
1016
            for (list<string>::const_iterator it1 = cts.begin(); 
1017
                 it1 != cts.end(); it1++) {
1018
                // Already in map -> duplicate
1019
                if (allmtsfromcats.find(*it1) != allmtsfromcats.end()) {
1020
                    cout << "Duplicate: [" << *it1 << "]" << endl;
1021
                }
1022
                allmtsfromcats.insert(*it1);
1023
            }
1024
        }
1025
1026
        list<string> mtypes = config->getAllMimeTypes();
1027
        for (list<string>::const_iterator it = mtypes.begin();
1028
             it != mtypes.end(); it++) {
1029
            if (allmtsfromcats.find(*it) == allmtsfromcats.end()) {
1030
                cout << "Not found in catgs: [" << *it << "]" << endl;
1031
            }
1032
        }
997
    } else {
1033
    } else {
1034
        config->setKeyDir("");
998
    list<string> names = config->getConfNames("");
1035
    list<string> names = config->getConfNames();
999
    names.sort();
1036
    names.sort();
1000
    names.unique();
1037
    names.unique();
1001
    for (list<string>::iterator it = names.begin(); 
1038
    for (list<string>::iterator it = names.begin(); 
1002
         it != names.end();it++) {
1039
         it != names.end();it++) {
1003
        string value;
1040
        string value;