[BACK]Return to apropos.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/Attic/apropos.c between version 1.18 and 1.19

version 1.18, 2011/11/23 09:50:40 version 1.19, 2011/11/26 22:38:11
Line 20 
Line 20 
 #endif  #endif
   
 #include <assert.h>  #include <assert.h>
 #include <ctype.h>  
 #include <getopt.h>  #include <getopt.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
Line 61  main(int argc, char *argv[])
Line 60  main(int argc, char *argv[])
         e = NULL;          e = NULL;
         rc = 0;          rc = 0;
   
         while (-1 != (ch = getopt(argc, argv, "M:m:S:s:")))          while (-1 != (ch = getopt(argc, argv, "M:m:S:s:")))
                 switch (ch) {                  switch (ch) {
                 case ('M'):                  case ('M'):
                         defpaths = optarg;                          defpaths = optarg;
Line 96  main(int argc, char *argv[])
Line 95  main(int argc, char *argv[])
         }          }
   
         rc = apropos_search          rc = apropos_search
                 (paths.sz, paths.paths,                  (paths.sz, paths.paths,
                  &opts, e, terms, NULL, list);                   &opts, e, terms, NULL, list);
   
         if (0 == rc)          if (0 == rc)
                 fprintf(stderr, "%s: Error reading "                  fprintf(stderr, "%s: Error reading "
                                 "manual database\n", progname);                                  "manual database\n", progname);
   
Line 119  list(struct res *res, size_t sz, void *arg)
Line 118  list(struct res *res, size_t sz, void *arg)
         qsort(res, sz, sizeof(struct res), cmp);          qsort(res, sz, sizeof(struct res), cmp);
   
         for (i = 0; i < (int)sz; i++)          for (i = 0; i < (int)sz; i++)
                 printf("%s(%s%s%s) - %s\n", res[i].title,                  printf("%s(%s%s%s) - %s\n", res[i].title,
                                 res[i].cat,                                  res[i].cat,
                                 *res[i].arch ? "/" : "",                                  *res[i].arch ? "/" : "",
                                 *res[i].arch ? res[i].arch : "",                                  *res[i].arch ? res[i].arch : "",
                                 res[i].desc);                                  res[i].desc);
Line 139  usage(void)
Line 138  usage(void)
 {  {
   
         fprintf(stderr, "usage: %s "          fprintf(stderr, "usage: %s "
                         "[-M dirs] "                          "[-M path] "
                         "[-m dirs] "                          "[-m path] "
                         "[-S arch] "                          "[-S arch] "
                         "[-s section] "                          "[-s section] "
                         "expression...\n", progname);                          "expression...\n",
                           progname);
 }  }

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

CVSweb