version 1.6, 1997/09/10 04:16:30 |
version 1.7, 1998/03/09 23:20:13 |
|
|
glob_t pg; |
glob_t pg; |
size_t len; |
size_t len; |
int ch, f_cat, f_how, found; |
int ch, f_cat, f_how, found; |
char **ap, *cmd, *machine, *p, *p_add, *p_path, *pager, *slashp; |
char **ap, *cmd, *machine, *p, *p_add, *p_path, *pager, *sflag, *slashp; |
char *conffile, buf[MAXPATHLEN * 2]; |
char *conffile, buf[MAXPATHLEN * 2]; |
|
|
|
machine = sflag = NULL; |
f_cat = f_how = 0; |
f_cat = f_how = 0; |
conffile = p_add = p_path = NULL; |
conffile = p_add = p_path = NULL; |
while ((ch = getopt(argc, argv, "-aC:cfhkM:m:P:w")) != -1) |
while ((ch = getopt(argc, argv, "-aC:cfhkM:m:P:s:S:w")) != -1) |
switch (ch) { |
switch (ch) { |
case 'a': |
case 'a': |
f_all = 1; |
f_all = 1; |
|
|
case 'P': /* Backward compatibility. */ |
case 'P': /* Backward compatibility. */ |
p_path = optarg; |
p_path = optarg; |
break; |
break; |
|
case 's': /* SVR4 compatibility. */ |
|
sflag = optarg; |
|
break; |
|
case 'S': |
|
machine = optarg; |
|
break; |
/* |
/* |
* The -f and -k options are backward compatible, |
* The -f and -k options are backward compatible, |
* undocumented ways of calling whatis(1) and apropos(1). |
* undocumented ways of calling whatis(1) and apropos(1). |
|
|
/* Read the configuration file. */ |
/* Read the configuration file. */ |
config(conffile); |
config(conffile); |
|
|
/* Get the machine type. */ |
/* Get the machine type unless specified by -S. */ |
if ((machine = getenv("MACHINE")) == NULL) |
if (machine == NULL && (machine = getenv("MACHINE")) == NULL) |
machine = MACHINE; |
machine = MACHINE; |
|
|
/* If there's no _default list, create an empty one. */ |
/* If there's no _default list, create an empty one. */ |
|
|
* 2: If the user did not specify MANPATH, -M or a section, rewrite |
* 2: If the user did not specify MANPATH, -M or a section, rewrite |
* the _default list to include the _subdir list and the machine. |
* the _default list to include the _subdir list and the machine. |
*/ |
*/ |
if (argv[1] == NULL) |
if (sflag == NULL && argv[1] == NULL) |
section = NULL; |
section = NULL; |
else if ((section = getlist(*argv)) != NULL) |
else { |
++argv; |
if (sflag != NULL && (section = getlist(sflag)) == NULL) |
|
errx(1, "unknown manual section `%s'", sflag); |
|
else if (sflag == NULL && (section = getlist(*argv)) != NULL) |
|
++argv; |
|
} |
if (p_path == NULL && section == NULL) { |
if (p_path == NULL && section == NULL) { |
defnewp = addlist("_default_new"); |
defnewp = addlist("_default_new"); |
e_defp = |
e_defp = |