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

Diff for /mandoc/mandoc_msg.c between version 1.5 and 1.12

version 1.5, 2019/01/10 06:29:00 version 1.12, 2020/09/01 18:25:27
Line 1 
Line 1 
 /*      $Id$ */  /* $OpenBSD$ */
 /*  /*
    * Copyright (c) 2014-2020 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2014,2015,2016,2017,2018 Ingo Schwarze <schwarze@openbsd.org>  
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
Line 14 
Line 14 
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN   * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    *
    * Implementation of warning and error messages for mandoc(1).
  */   */
   #include "config.h"
   
 #include <stdarg.h>  #include <stdarg.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
Line 27  static const enum mandocerr lowest_type[MANDOCLEVEL_MA
Line 31  static const enum mandocerr lowest_type[MANDOCLEVEL_MA
         MANDOCERR_WARNING,          MANDOCERR_WARNING,
         MANDOCERR_ERROR,          MANDOCERR_ERROR,
         MANDOCERR_UNSUPP,          MANDOCERR_UNSUPP,
         MANDOCERR_MAX,          MANDOCERR_BADARG,
         MANDOCERR_MAX          MANDOCERR_SYSERR
 };  };
   
 static  const char *const level_name[MANDOCLEVEL_MAX] = {  static  const char *const level_name[MANDOCLEVEL_MAX] = {
Line 81  static const char *const type_message[MANDOCERR_MAX] =
Line 85  static const char *const type_message[MANDOCERR_MAX] =
         "missing manual title, using \"\"",          "missing manual title, using \"\"",
         "missing manual section, using \"\"",          "missing manual section, using \"\"",
         "unknown manual section",          "unknown manual section",
         "missing date, using today's date",          "filename/section mismatch",
           "missing date, using \"\"",
         "cannot parse date, using it verbatim",          "cannot parse date, using it verbatim",
         "date in the future, using it anyway",          "date in the future, using it anyway",
         "missing Os macro, using \"\"",          "missing Os macro, using \"\"",
Line 185  static const char *const type_message[MANDOCERR_MAX] =
Line 190  static const char *const type_message[MANDOCERR_MAX] =
         "empty tbl layout",          "empty tbl layout",
         "invalid character in tbl layout",          "invalid character in tbl layout",
         "unmatched parenthesis in tbl layout",          "unmatched parenthesis in tbl layout",
           "ignoring excessive spacing in tbl layout",
         "tbl without any data cells",          "tbl without any data cells",
         "ignoring data in spanned tbl cell",          "ignoring data in spanned tbl cell",
         "ignoring extra tbl data cells",          "ignoring extra tbl data cells",
         "data block open at end of tbl",          "data block open at end of tbl",
   
         /* related to document structure and macros */          /* related to document structure and macros */
         NULL,  
         "duplicate prologue macro",          "duplicate prologue macro",
         "skipping late title macro",          "skipping late title macro",
         "input stack limit exceeded, infinite loop?",          "input stack limit exceeded, infinite loop?",
Line 222  static const char *const type_message[MANDOCERR_MAX] =
Line 227  static const char *const type_message[MANDOCERR_MAX] =
         "excessive shift",          "excessive shift",
         "NOT IMPLEMENTED: .so with absolute path or \"..\"",          "NOT IMPLEMENTED: .so with absolute path or \"..\"",
         ".so request failed",          ".so request failed",
           "skipping tag containing whitespace",
         "skipping all arguments",          "skipping all arguments",
         "skipping excess arguments",          "skipping excess arguments",
         "divide by zero",          "divide by zero",
Line 238  static const char *const type_message[MANDOCERR_MAX] =
Line 244  static const char *const type_message[MANDOCERR_MAX] =
         "eqn delim option in tbl",          "eqn delim option in tbl",
         "unsupported tbl layout modifier",          "unsupported tbl layout modifier",
         "ignoring macro in table",          "ignoring macro in table",
   
           /* bad command line arguments */
           NULL,
           "bad command line argument",
           "duplicate command line argument",
           "option has a superfluous value",
           "missing option value",
           "bad option value",
           "duplicate option value",
           "no such tag",
   
           /* system errors */
           NULL,
           "dup",
           "exec",
           "fdopen",
           "fflush",
           "fork",
           "fstat",
           "getline",
           "glob",
           "gzclose",
           "gzdopen",
           "mkstemp",
           "open",
           "pledge",
           "read",
           "wait",
           "write",
 };  };
   
 static  FILE            *fileptr = NULL;  static  FILE            *fileptr = NULL;
 static  const char      *filename = NULL;  static  const char      *filename = NULL;
 static  enum mandocerr   min_type = MANDOCERR_MAX;  static  enum mandocerr   min_type = MANDOCERR_BADARG;
 static  enum mandoclevel rc = MANDOCLEVEL_OK;  static  enum mandoclevel rc = MANDOCLEVEL_OK;
   
   
Line 295  mandoc_msg(enum mandocerr t, int line, int col, const 
Line 330  mandoc_msg(enum mandocerr t, int line, int col, const 
         va_list                  ap;          va_list                  ap;
         enum mandoclevel         level;          enum mandoclevel         level;
   
         if (t < min_type && t != MANDOCERR_FILE)          if (t < min_type)
                 return;                  return;
   
         level = MANDOCLEVEL_UNSUPP;          level = MANDOCLEVEL_SYSERR;
         while (t < lowest_type[level])          while (t < lowest_type[level])
                 level--;                  level--;
         mandoc_msg_setrc(level);          mandoc_msg_setrc(level);
Line 324  mandoc_msg(enum mandocerr t, int line, int col, const 
Line 359  mandoc_msg(enum mandocerr t, int line, int col, const 
                 va_end(ap);                  va_end(ap);
         }          }
         fputc('\n', fileptr);          fputc('\n', fileptr);
   }
   
   void
   mandoc_msg_summary(void)
   {
           if (fileptr != NULL && rc != MANDOCLEVEL_OK)
                   fprintf(fileptr,
                       "%s: see above the output for %s messages\n",
                       getprogname(), level_name[rc]);
 }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.12

CVSweb