version 1.16, 2012/04/15 11:54:47 |
version 1.17, 2013/07/12 11:01:42 |
|
|
struct expr *e; |
struct expr *e; |
char *defpaths, *auxpaths; |
char *defpaths, *auxpaths; |
char *conf_file; |
char *conf_file; |
extern int optind; |
|
extern char *optarg; |
extern char *optarg; |
|
extern int optind; |
|
|
progname = strrchr(argv[0], '/'); |
progname = strrchr(argv[0], '/'); |
if (progname == NULL) |
if (progname == NULL) |
|
|
else |
else |
++progname; |
++progname; |
|
|
whatis = 0 == strncmp(progname, "whatis", 6); |
whatis = (0 == strncmp(progname, "whatis", 6)); |
|
|
memset(&paths, 0, sizeof(struct manpaths)); |
memset(&paths, 0, sizeof(struct manpaths)); |
memset(&opts, 0, sizeof(struct opts)); |
memset(&opts, 0, sizeof(struct opts)); |
|
|
opts.cat = optarg; |
opts.cat = optarg; |
break; |
break; |
default: |
default: |
fprintf(stderr, |
goto usage; |
"usage: %s [-C file] [-M path] [-m path]" |
|
" [-S arch] [-s section]%s ...\n", |
|
progname, |
|
whatis ? " name" : |
|
"\n expression"); |
|
return(EXIT_FAILURE); |
|
} |
} |
|
|
argc -= optind; |
argc -= optind; |
argv += optind; |
argv += optind; |
|
|
if (0 == argc) |
if (0 == argc) |
return(EXIT_SUCCESS); |
goto usage; |
|
|
rc = 0; |
rc = 0; |
|
|
|
|
fprintf(stderr, "%s: Bad database\n", progname); |
fprintf(stderr, "%s: Bad database\n", progname); |
goto out; |
goto out; |
} |
} |
|
|
out: |
out: |
manpath_free(&paths); |
manpath_free(&paths); |
resfree(res, ressz); |
resfree(res, ressz); |
exprfree(e); |
exprfree(e); |
return(rc ? EXIT_SUCCESS : EXIT_FAILURE); |
return(rc ? EXIT_SUCCESS : EXIT_FAILURE); |
|
|
|
usage: |
|
fprintf(stderr, "usage: %s [-C file] [-M path] [-m path] " |
|
"[-S arch] [-s section]%s ...\n", progname, |
|
whatis ? " name" : "\n expression"); |
|
return(EXIT_FAILURE); |
} |
} |
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |