[BACK]Return to main.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mandoc

Diff for /src/usr.bin/mandoc/main.c between version 1.161 and 1.162

version 1.161, 2015/10/22 21:53:49 version 1.162, 2015/11/06 16:27:13
Line 92 
Line 92 
 static  void              usage(enum argmode) __attribute__((noreturn));  static  void              usage(enum argmode) __attribute__((noreturn));
 static  int               woptions(struct curparse *, char *);  static  int               woptions(struct curparse *, char *);
   
 extern  char             *__progname;  
   
 static  const int sec_prios[] = {1, 4, 5, 8, 6, 3, 7, 2, 9};  static  const int sec_prios[] = {1, 4, 5, 8, 6, 3, 7, 2, 9};
 static  char              help_arg[] = "help";  static  char              help_arg[] = "help";
 static  char             *help_argv[] = {help_arg, NULL};  static  char             *help_argv[] = {help_arg, NULL};
Line 107 
Line 105 
         struct curparse  curp;          struct curparse  curp;
         struct mansearch search;          struct mansearch search;
         struct tag_files *tag_files;          struct tag_files *tag_files;
           const char      *progname;
         char            *auxpaths;          char            *auxpaths;
         char            *defos;          char            *defos;
         unsigned char   *uc;          unsigned char   *uc;
Line 123 
Line 122 
         int              use_pager;          int              use_pager;
         int              c;          int              c;
   
         if (0 == strncmp(__progname, "mandocdb", 8) ||          progname = getprogname();
             0 == strncmp(__progname, "makewhatis", 10))          if (strncmp(progname, "mandocdb", 8) == 0 ||
               strncmp(progname, "makewhatis", 10) == 0)
                 return mandocdb(argc, argv);                  return mandocdb(argc, argv);
   
         if (pledge("stdio rpath tmppath proc exec flock", NULL) == -1)          if (pledge("stdio rpath tmppath proc exec flock", NULL) == -1)
Line 139 
Line 139 
         memset(&search, 0, sizeof(struct mansearch));          memset(&search, 0, sizeof(struct mansearch));
         search.outkey = "Nd";          search.outkey = "Nd";
   
         if (strcmp(__progname, "man") == 0)          if (strcmp(progname, "man") == 0)
                 search.argmode = ARG_NAME;                  search.argmode = ARG_NAME;
         else if (strncmp(__progname, "apropos", 7) == 0)          else if (strncmp(progname, "apropos", 7) == 0)
                 search.argmode = ARG_EXPR;                  search.argmode = ARG_EXPR;
         else if (strncmp(__progname, "whatis", 6) == 0)          else if (strncmp(progname, "whatis", 6) == 0)
                 search.argmode = ARG_WORD;                  search.argmode = ARG_WORD;
         else if (strncmp(__progname, "help", 4) == 0)          else if (strncmp(progname, "help", 4) == 0)
                 search.argmode = ARG_NAME;                  search.argmode = ARG_NAME;
         else          else
                 search.argmode = ARG_FILE;                  search.argmode = ARG_FILE;
Line 286 
Line 286 
          */           */
   
         if (search.argmode == ARG_NAME) {          if (search.argmode == ARG_NAME) {
                 if (*__progname == 'h') {                  if (*progname == 'h') {
                         if (argc == 0) {                          if (argc == 0) {
                                 argv = help_argv;                                  argv = help_argv;
                                 argc = 1;                                  argc = 1;
Line 907 
Line 907 
 {  {
         const char      *mparse_msg;          const char      *mparse_msg;
   
         fprintf(stderr, "%s: %s:", __progname, file);          fprintf(stderr, "%s: %s:", getprogname(), file);
   
         if (line)          if (line)
                 fprintf(stderr, "%d:%d:", line, col + 1);                  fprintf(stderr, "%d:%d:", line, col + 1);

Legend:
Removed from v.1.161  
changed lines
  Added in v.1.162