~ubuntu-core-dev/module-init-tools/ubuntu

« back to all changes in this revision

Viewing changes to modindex.c

  • Committer: Scott James Remnant
  • Date: 2009-07-16 15:24:17 UTC
  • mfrom: (152.1.38)
  • Revision ID: scott@netsplit.com-20090716152417-7ak1sklxb59cs4fz
MergeĀ 3.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
                "Usage: %s [MODE] [FILE] ...\n"
99
99
                " -o, --output <outfile>\n"
100
100
                " -d, --dump <infile>\n"
101
 
                " -s, --search <infile> <key>\n"
102
 
                " -w, --searchwild <infile> <key>\n"
 
101
                " -s, --search <key> <infile>\n"
 
102
                " -w, --searchwild <key> <infile>\n"
103
103
                ,progname);
104
104
        exit(1);
105
105
}
107
107
static struct option options[] = {
108
108
        { "output", 0, NULL, 'o' },
109
109
        { "dump", 0, NULL, 'd' },
110
 
        { "search", 0, NULL, 's' },
111
 
        { "searchwild", 0, NULL, 'w' },
 
110
        { "search", 1, NULL, 's' },
 
111
        { "searchwild", 1, NULL, 'w' },
112
112
};
113
113
 
114
114
int main(int argc, char *argv[])
115
115
{
116
 
        char opt;
 
116
        int opt;
117
117
        char mode = 0;
118
118
        char *filename = NULL;
119
119
        char *key = NULL;
120
120
        
121
 
        while ((opt = getopt_long(argc, argv, "odsw", options, NULL))
 
121
        while ((opt = getopt_long(argc, argv, "ods:w:", options, NULL))
122
122
                       != -1) {
123
123
                switch (opt) {
124
124
                        case 'o':
129
129
                                break;
130
130
                        case 's':
131
131
                                mode = 's';
 
132
                                key = optarg;
132
133
                                break;
133
134
                        case 'w':
134
135
                                mode = 'w';
 
136
                                key = optarg;
135
137
                                break;
136
138
                        default:
137
139
                                print_usage(argv[0]);
144
146
                print_usage(argv[0]);
145
147
        filename = argv[optind];
146
148
        
147
 
        if (mode == 's' || mode == 'w') {
148
 
                if (optind+1 >= argc)
149
 
                        print_usage(argv[0]);
150
 
                key = argv[optind+1];
151
 
        }
152
 
        
153
149
        switch(mode) {
154
150
                case 'o':
155
151
                        write_index(filename);