~canonical-scott/grepmap/trunk

« back to all changes in this revision

Viewing changes to src/grepmap.c

  • Committer: Scott James Remnant
  • Date: 2005-09-29 03:32:13 UTC
  • Revision ID: scott@netsplit.com-20050929033213-79c27d88cb6c53b7
* src/grepmap.c (main): Return 2 in case of error.
* src/ieee1394map.c (ieee1394map_modules): Return 2 if arguments
weren't in the right format.
* src/inputmap.c (inputmap_modules): Return 2 also.
* src/pcimap.c (pcimap_modules): Also return 2.
* src/usbmap.c (usbmap_modules): And here 2 ;-)

Show diffs side-by-side

added added

removed removed

Lines of Context:
207
207
                                fprintf (stderr, "%s: %s\n", program_name,
208
208
                                         _("only one map type may be specified"));
209
209
                                suggest_help ();
210
 
                                return 1;
 
210
                                return 2;
211
211
                        }
212
212
 
213
213
                        for (; file_type < LAST_MAP; file_type++) {
224
224
                        return 0;
225
225
                case '?':
226
226
                        suggest_help ();
227
 
                        return 1;
 
227
                        return 2;
228
228
                default:
229
229
                        /* Not reached */
230
230
                        abort();
235
235
                fprintf (stderr, "%s: %s\n", program_name,
236
236
                         _("you must specify a map type"));
237
237
                suggest_help ();
238
 
                return 1;
 
238
                return 2;
239
239
        }
240
240
 
241
241
        if ((argc - optind) < map_info[file_type].nargs) {
242
242
                fprintf (stderr, "%s: %s\n", program_name,
243
243
                         _("insufficient arguments"));
244
244
                suggest_help ();
245
 
                return 1;
 
245
                return 2;
246
246
        } else if ((argc - optind) > map_info[file_type].nargs) {
247
247
                fprintf (stderr, "%s: %s\n", program_name,
248
248
                         _("some arguments ignored"));
251
251
        if (! file) {
252
252
                file = _map_filename (kernel, file_type);
253
253
                if (! file)
254
 
                        return 1;
 
254
                        return 2;
255
255
        }
256
256
 
257
257
        if (! strcmp (file, "-")) {
261
261
                if (! mapf) {
262
262
                        fprintf (stderr, "%s: %s: %s\n", program_name, file,
263
263
                                 strerror (errno));
264
 
                        return 1;
 
264
                        return 2;
265
265
                }
266
266
        }
267
267
 
270
270
        if (fclose (mapf)) {
271
271
                fprintf (stderr, "%s: %s: %s\n", program_name, file,
272
272
                         strerror (errno));
273
 
                return 1;
 
273
                return 2;
274
274
        }
275
275
        free (file);
276
276