163 |
static void usage (int status) |
static void usage (int status) |
164 |
{ |
{ |
165 |
printf (_("usage: %s [-dhV] [-r|-w] [-m systems] [-M manpath] [-C file] keyword ...\n"), program_name); |
printf (_("usage: %s [-dhV] [-r|-w] [-m systems] [-M manpath] [-C file] keyword ...\n"), program_name); |
166 |
printf(_( |
printf (_( |
167 |
"-d, --debug produce debugging info.\n" |
"-d, --debug produce debugging info.\n" |
168 |
"-v, --verbose print verbose warning messages.\n" |
"-v, --verbose print verbose warning messages.\n" |
169 |
"-r, --regex interpret each keyword as a regex.\n" |
"-r, --regex interpret each keyword as a regex.\n" |
393 |
char *left = p - 1; |
char *left = p - 1; |
394 |
char *right = p + len; |
char *right = p + len; |
395 |
|
|
396 |
if ((p == begin || (!islower(*left) && *left != '_')) && |
if ((p == begin || (!islower (*left) && *left != '_')) && |
397 |
(!*right || (!islower(*right) && *right != '_')) ) { |
(!*right || (!islower (*right) && *right != '_')) ) { |
398 |
free (begin); |
free (begin); |
399 |
return 1; |
return 1; |
400 |
} |
} |
401 |
lowwhatis = p + 1; |
lowwhatis = p + 1; |
402 |
} |
} |
403 |
|
|
404 |
free(begin); |
free (begin); |
405 |
return 0; |
return 0; |
406 |
} |
} |
407 |
|
|
481 |
end = btree_nextkeydata (dbf, &key, &cont); |
end = btree_nextkeydata (dbf, &key, &cont); |
482 |
while (!end) { |
while (!end) { |
483 |
#endif /* !BTREE */ |
#endif /* !BTREE */ |
484 |
|
char *tab; |
485 |
|
int match; |
486 |
|
#ifdef APROPOS |
487 |
|
char *whatis; |
488 |
|
#endif |
489 |
|
|
490 |
/* bug#4372, NULL pointer dereference in cont.dptr, fix |
/* bug#4372, NULL pointer dereference in cont.dptr, fix |
491 |
* by dassen@wi.leidenuniv.nl (J.H.M.Dassen), thanx Ray. |
* by dassen@wi.leidenuniv.nl (J.H.M.Dassen), thanx Ray. |
492 |
* cjwatson: In that case, complain and exit, otherwise we |
* cjwatson: In that case, complain and exit, otherwise we |
502 |
database); |
database); |
503 |
} |
} |
504 |
|
|
505 |
if (*key.dptr != '$') { |
if (*key.dptr == '$') |
506 |
if (*cont.dptr != '\t') /* a real page */ |
goto nextpage; |
507 |
{ |
|
508 |
char *tab; |
if (*cont.dptr == '\t') |
509 |
int match; |
goto nextpage; |
|
#ifdef APROPOS |
|
|
char *whatis; |
|
|
#endif |
|
510 |
|
|
511 |
tab = strrchr(key.dptr, '\t'); |
/* a real page */ |
512 |
if (tab) |
|
513 |
*tab = '\0'; |
tab = strrchr (key.dptr, '\t'); |
514 |
|
if (tab) |
515 |
|
*tab = '\0'; |
516 |
|
|
517 |
#ifdef APROPOS |
#ifdef APROPOS |
518 |
match = parse_name (lowpage, key.dptr); |
match = parse_name (lowpage, key.dptr); |
519 |
whatis = strrchr (cont.dptr, '\t'); |
whatis = strrchr (cont.dptr, '\t'); |
520 |
if (!(whatis && *++whatis)) |
if (!(whatis && *++whatis)) |
521 |
whatis = NULL; |
whatis = NULL; |
522 |
|
|
523 |
if (!match && whatis) |
if (!match && whatis) |
524 |
match = parse_whatis (page, lowpage, |
match = parse_whatis (page, lowpage, whatis); |
|
whatis); |
|
525 |
#else /* WHATIS */ |
#else /* WHATIS */ |
526 |
match = parse_name (page, key.dptr); |
match = parse_name (page, key.dptr); |
527 |
#endif /* APROPOS */ |
#endif /* APROPOS */ |
528 |
if (match) { |
if (match) { |
529 |
struct mandata info; |
struct mandata info; |
530 |
split_content (cont.dptr, &info); |
split_content (cont.dptr, &info); |
531 |
display (&info, key.dptr); |
display (&info, key.dptr); |
532 |
found++; |
found++; |
533 |
cont.dptr = info.addr; |
cont.dptr = info.addr; |
|
} |
|
|
|
|
|
found += match; |
|
|
if (tab) |
|
|
*tab = '\t'; |
|
|
} |
|
534 |
} |
} |
535 |
|
|
536 |
|
found += match; |
537 |
|
if (tab) |
538 |
|
*tab = '\t'; |
539 |
|
|
540 |
|
nextpage: |
541 |
#ifndef BTREE |
#ifndef BTREE |
542 |
nextkey = MYDBM_NEXTKEY (dbf, key); |
nextkey = MYDBM_NEXTKEY (dbf, key); |
543 |
MYDBM_FREE (cont.dptr); |
MYDBM_FREE (cont.dptr); |
600 |
MYDBM_CLOSE (dbf); |
MYDBM_CLOSE (dbf); |
601 |
} |
} |
602 |
|
|
603 |
chkr_garbage_detector(); |
chkr_garbage_detector (); |
604 |
|
|
605 |
if (!found) { |
if (!found) { |
606 |
printf (_("%s: nothing appropriate.\n"), page); |
printf (_("%s: nothing appropriate.\n"), page); |
691 |
free (locale); |
free (locale); |
692 |
locale = xstrdup (llocale); |
locale = xstrdup (llocale); |
693 |
if (debug) |
if (debug) |
694 |
fprintf(stderr, |
fprintf (stderr, |
695 |
"main(): locale = %s, internal_locale = %s\n", |
"main(): locale = %s, internal_locale = %s\n", |
696 |
llocale, locale); |
llocale, locale); |
697 |
if (locale) { |
if (locale) { |
698 |
extern int _nl_msg_cat_cntr; |
extern int _nl_msg_cat_cntr; |
699 |
if (locale[2] == '_' ) |
if (locale[2] == '_' ) |
705 |
|
|
706 |
#if defined(REGEX) && defined(APROPOS) |
#if defined(REGEX) && defined(APROPOS) |
707 |
/* Become it even if it's null - GNU standards */ |
/* Become it even if it's null - GNU standards */ |
708 |
/* if (getenv("POSIXLY_CORRECT")) */ |
/* if (getenv ("POSIXLY_CORRECT")) */ |
709 |
if (!exact && !wildcard) |
if (!exact && !wildcard) |
710 |
regex = 1; |
regex = 1; |
711 |
#endif |
#endif |
748 |
argv[optind], error_string); |
argv[optind], error_string); |
749 |
} |
} |
750 |
#endif /* REGEX */ |
#endif /* REGEX */ |
751 |
search(argv[optind++]); |
search (argv[optind++]); |
752 |
} |
} |
753 |
|
|
754 |
exit (status); |
exit (status); |