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

Diff for /src/usr.bin/mandoc/cgi.c between version 1.113 and 1.114

version 1.113, 2021/05/01 16:11:17 version 1.114, 2021/08/19 15:21:32
Line 1 
Line 1 
 /* $OpenBSD$ */  /* $OpenBSD$ */
 /*  /*
  * 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 366 
Line 366 
 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 381 
Line 382 
                "  <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"

Legend:
Removed from v.1.113  
changed lines
  Added in v.1.114