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

Diff for /mandoc/main.c between version 1.253 and 1.254

version 1.253, 2015/10/22 21:54:23 version 1.254, 2015/11/06 16:30:33
Line 101  static int    toptions(struct curparse *, char *);
Line 101  static int    toptions(struct curparse *, char *);
 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 116  main(int argc, char *argv[])
Line 114  main(int argc, char *argv[])
         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 132  main(int argc, char *argv[])
Line 131  main(int argc, char *argv[])
         int              use_pager;          int              use_pager;
         int              c;          int              c;
   
 #if !HAVE_PROGNAME  #if HAVE_PROGNAME
           progname = getprogname();
   #else
         if (argc < 1)          if (argc < 1)
                 __progname = mandoc_strdup("mandoc");                  progname = mandoc_strdup("mandoc");
         else if ((__progname = strrchr(argv[0], '/')) == NULL)          else if ((progname = strrchr(argv[0], '/')) == NULL)
                 __progname = argv[0];                  progname = argv[0];
         else          else
                 ++__progname;                  ++progname;
           setprogname(progname);
 #endif  #endif
   
 #if HAVE_SQLITE3  #if HAVE_SQLITE3
         if (strcmp(__progname, BINM_MAKEWHATIS) == 0)          if (strncmp(progname, "mandocdb", 8) == 0 ||
               strcmp(progname, BINM_MAKEWHATIS) == 0)
                 return mandocdb(argc, argv);                  return mandocdb(argc, argv);
 #endif  #endif
   
Line 155  main(int argc, char *argv[])
Line 158  main(int argc, char *argv[])
         memset(&search, 0, sizeof(struct mansearch));          memset(&search, 0, sizeof(struct mansearch));
         search.outkey = "Nd";          search.outkey = "Nd";
   
         if (strcmp(__progname, BINM_MAN) == 0)          if (strcmp(progname, BINM_MAN) == 0)
                 search.argmode = ARG_NAME;                  search.argmode = ARG_NAME;
         else if (strcmp(__progname, BINM_APROPOS) == 0)          else if (strcmp(progname, BINM_APROPOS) == 0)
                 search.argmode = ARG_EXPR;                  search.argmode = ARG_EXPR;
         else if (strcmp(__progname, BINM_WHATIS) == 0)          else if (strcmp(progname, BINM_WHATIS) == 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 299  main(int argc, char *argv[])
Line 302  main(int argc, char *argv[])
          */           */
   
         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 591  fs_lookup(const struct manpaths *paths, size_t ipath,
Line 594  fs_lookup(const struct manpaths *paths, size_t ipath,
   
 found:  found:
 #if HAVE_SQLITE3  #if HAVE_SQLITE3
         warnx("outdated mandoc.db lacks %s(%s) entry, run makewhatis %s\n",          warnx("outdated mandoc.db lacks %s(%s) entry, run makewhatis %s",
             name, sec, paths->paths[ipath]);              name, sec, paths->paths[ipath]);
 #endif  #endif
         *res = mandoc_reallocarray(*res, ++*ressz, sizeof(struct manpage));          *res = mandoc_reallocarray(*res, ++*ressz, sizeof(struct manpage));
Line 931  mmsg(enum mandocerr t, enum mandoclevel lvl,
Line 934  mmsg(enum mandocerr t, enum mandoclevel lvl,
 {  {
         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.253  
changed lines
  Added in v.1.254

CVSweb