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

Diff for /mandoc/cgi.c between version 1.173 and 1.176

version 1.173, 2020/06/29 19:22:09 version 1.176, 2021/11/05 17:04:10
Line 1 
Line 1 
 /* $Id$ */  /* $Id$ */
 /*  /*
  * Copyright (c) 2014-2019 Ingo Schwarze <schwarze@usta.de>   * Copyright (c) 2014-2019, 2021 Ingo Schwarze <schwarze@usta.de>
  * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
Line 125  static const char *const arch_names[] = {
Line 125  static const char *const arch_names[] = {
     "amd64",       "alpha",       "armv7",       "arm64",      "amd64",       "alpha",       "armv7",       "arm64",
     "hppa",        "i386",        "landisk",     "loongson",      "hppa",        "i386",        "landisk",     "loongson",
     "luna88k",     "macppc",      "mips64",      "octeon",      "luna88k",     "macppc",      "mips64",      "octeon",
     "powerpc64",   "sgi",         "socppc",      "sparc64",      "powerpc64",   "riscv64",     "sparc64",
   
     "amiga",       "arc",         "armish",      "arm32",      "amiga",       "arc",         "armish",      "arm32",
     "atari",       "aviion",      "beagle",      "cats",      "atari",       "aviion",      "beagle",      "cats",
     "hppa64",      "hp300",      "hppa64",      "hp300",
     "ia64",        "mac68k",      "mvme68k",     "mvme88k",      "ia64",        "mac68k",      "mvme68k",     "mvme88k",
     "mvmeppc",     "palm",        "pc532",       "pegasos",      "mvmeppc",     "palm",        "pc532",       "pegasos",
     "pmax",        "powerpc",     "solbourne",   "sparc",      "pmax",        "powerpc",     "sgi",         "socppc",
       "solbourne",   "sparc",
     "sun3",        "vax",         "wgrisc",      "x68k",      "sun3",        "vax",         "wgrisc",      "x68k",
     "zaurus"      "zaurus"
 };  };
Line 369  resp_copy(const char *filename)
Line 370  resp_copy(const char *filename)
 static void  static void
 resp_begin_html(int code, const char *msg, const char *file)  resp_begin_html(int code, const char *msg, const char *file)
 {  {
         char    *cp;          const char      *name, *sec, *cp;
           int              namesz, secsz;
   
         resp_begin_http(code, msg);          resp_begin_http(code, msg);
   
Line 384  resp_begin_html(int code, const char *msg, const char 
Line 386  resp_begin_html(int code, const char *msg, const char 
                "  <title>",                 "  <title>",
                CSS_DIR);                 CSS_DIR);
         if (file != NULL) {          if (file != NULL) {
                 if ((cp = strrchr(file, '/')) != NULL)                  cp = strrchr(file, '/');
                         file = cp + 1;                  name = cp == NULL ? file : cp + 1;
                 if ((cp = strrchr(file, '.')) != NULL) {                  cp = strrchr(name, '.');
                         printf("%.*s(%s) - ", (int)(cp - file), file, cp + 1);                  namesz = cp == NULL ? strlen(name) : cp - name;
                 } else                  sec = NULL;
                         printf("%s - ", file);                  if (cp != NULL && cp[1] != '0') {
                           sec = cp + 1;
                           secsz = strlen(sec);
                   } else if (name - file > 1) {
                           for (cp = name - 2; cp >= file; cp--) {
                                   if (*cp < '1' || *cp > '9')
                                           continue;
                                   sec = cp;
                                   secsz = name - cp - 1;
                                   break;
                           }
                   }
                   printf("%.*s", namesz, name);
                   if (sec != NULL)
                           printf("(%.*s)", secsz, sec);
                   fputs(" - ", stdout);
         }          }
         printf("%s</title>\n"          printf("%s</title>\n"
                "</head>\n"                 "</head>\n"
Line 862  resp_format(const struct req *req, const char *file)
Line 879  resp_format(const struct req *req, const char *file)
         int              fd;          int              fd;
         int              usepath;          int              usepath;
   
         if (-1 == (fd = open(file, O_RDONLY, 0))) {          if (-1 == (fd = open(file, O_RDONLY))) {
                 puts("<p>You specified an invalid manual file.</p>");                  puts("<p>You specified an invalid manual file.</p>");
                 return;                  return;
         }          }

Legend:
Removed from v.1.173  
changed lines
  Added in v.1.176

CVSweb