Changeset 481 for trunk/src/sh_error.c


Ignore:
Timestamp:
Jul 18, 2015, 5:06:52 PM (6 years ago)
Author:
katerina
Message:

Enhancements and fixes for tickets #374, #375, #376, #377, #378, and #379.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_error.c

    r476 r481  
    6060#include "sh_tiger.h"
    6161#include "sh_nmail.h"
    62 #include "sh_forward.h"
     62#include "sh_xfer.h"
    6363#include "sh_prelude.h"
    6464#include "sh_pthread.h"
     
    7777extern int clt_class;
    7878
    79 int flag_err_debug = SL_FALSE;
    80 int flag_err_info  = SL_FALSE;
     79int flag_err_debug = S_FALSE;
     80int flag_err_info  = S_FALSE;
    8181
    8282int  ShDFLevel[SH_ERR_T_END];
     
    100100static int  sh_error_init (void);
    101101
    102 /*@owned@*//*@null@*/inline
    103 static char * get_format(unsigned long msg_id, /*@out@*/int * priority,
    104                          /*@out@*/unsigned int * class);
     102inline
     103static const char * get_format(unsigned long msg_id, int * priority,
     104                               unsigned int * class);
    105105
    106106static int sh_error_string (struct _log_t * lmsg, va_list vl);
     
    177177{
    178178  if ((errFlags.loglevel & SH_ERR_ALL) != 0)
    179     flag_err_debug = SL_TRUE;
     179    flag_err_debug = S_TRUE;
    180180  else if ((errFlags.printlevel & SH_ERR_ALL) != 0)
    181     flag_err_debug = SL_TRUE;
     181    flag_err_debug = S_TRUE;
    182182  else if ((errFlags.maillevel & SH_ERR_ALL) != 0)
    183     flag_err_debug = SL_TRUE;
     183    flag_err_debug = S_TRUE;
    184184  else if ((errFlags.exportlevel & SH_ERR_ALL) != 0)
    185     flag_err_debug = SL_TRUE;
     185    flag_err_debug = S_TRUE;
    186186  else if ((errFlags.sysloglevel & SH_ERR_ALL) != 0)
    187     flag_err_debug = SL_TRUE;
     187    flag_err_debug = S_TRUE;
    188188  else if ((errFlags.externallevel & SH_ERR_ALL) != 0)
    189     flag_err_debug = SL_TRUE;
     189    flag_err_debug = S_TRUE;
    190190  else if ((errFlags.databaselevel & SH_ERR_ALL) != 0)
    191     flag_err_debug = SL_TRUE;
     191    flag_err_debug = S_TRUE;
    192192  else if ((errFlags.preludelevel & SH_ERR_ALL) != 0)
    193     flag_err_debug = SL_TRUE;
     193    flag_err_debug = S_TRUE;
    194194  else
    195     flag_err_debug = SL_FALSE;
     195    flag_err_debug = S_FALSE;
    196196  return;
    197197}
     
    201201{
    202202  if ((errFlags.loglevel & SH_ERR_INFO) != 0)
    203     flag_err_info = SL_TRUE;
     203    flag_err_info = S_TRUE;
    204204  else if ((errFlags.printlevel & SH_ERR_INFO) != 0)
    205     flag_err_info = SL_TRUE;
     205    flag_err_info = S_TRUE;
    206206  else if ((errFlags.maillevel & SH_ERR_INFO) != 0)
    207     flag_err_info = SL_TRUE;
     207    flag_err_info = S_TRUE;
    208208  else if ((errFlags.exportlevel & SH_ERR_INFO) != 0)
    209     flag_err_info = SL_TRUE;
     209    flag_err_info = S_TRUE;
    210210  else if ((errFlags.sysloglevel & SH_ERR_INFO) != 0)
    211     flag_err_info = SL_TRUE;
     211    flag_err_info = S_TRUE;
    212212  else if ((errFlags.externallevel & SH_ERR_INFO) != 0)
    213     flag_err_info = SL_TRUE;
     213    flag_err_info = S_TRUE;
    214214  else if ((errFlags.databaselevel & SH_ERR_INFO) != 0)
    215     flag_err_info = SL_TRUE;
     215    flag_err_info = S_TRUE;
    216216  else if ((errFlags.preludelevel & SH_ERR_INFO) != 0)
    217     flag_err_info = SL_TRUE;
     217    flag_err_info = S_TRUE;
    218218  else
    219     flag_err_info = SL_FALSE;
     219    flag_err_info = S_FALSE;
    220220  return;
    221221}
     
    230230                             SH_ERR_SEVERE | SH_ERR_FATAL);
    231231      dbg_flag  = 1;
    232       flag_err_debug = SL_TRUE;
     232      flag_err_debug = S_TRUE;
    233233    }
    234234  else {
     
    935935  int    severity;
    936936  unsigned int class;
    937   char * fmt;
     937  const char * fmt;
    938938  volatile int sev = sev1;            /* Avoids the 'clobbered by longjmp' warning. */
    939939
     
    12861286              sl_snprintf(ex_msg, ex_len, _("%d?%u?%s"),
    12871287                      severity, class, lmsg->msg);
    1288               retval = sh_forward (ex_msg);
     1288              retval = sh_xfer_report (ex_msg);
    12891289              SH_FREE(ex_msg);
    12901290              export_block = 0;
     
    14381438  int    severity;
    14391439  unsigned int class;
    1440   char * fmt;
     1440  const char * fmt;
    14411441  int retval;
    14421442
     
    15171517 */
    15181518/*@owned@*/ /*@null@*/inline
    1519 static char * get_format(unsigned long msg_id, /*@out@*/ int * priority,
     1519static const char * get_format(unsigned long msg_id, /*@out@*/ int * priority,
    15201520                         /*@out@*/unsigned int * class)
    15211521{
     
    15321532          *priority = (int) msg_cat[i].priority;
    15331533          *class    = (unsigned int) msg_cat[i].class;
    1534           SL_RETURN (((char *) _(msg_cat[i].format)), _("get_format"));
     1534          SL_RETURN (((const char *) _(msg_cat[i].format)), _("get_format"));
    15351535        }
    15361536      ++i;
     
    15731573  SL_RETURN( 0, _("sh_error_ehead"));
    15741574}
     1575
     1576#if !defined(VA_COPY)
     1577#if defined(__GNUC__) && defined(__PPC__) && (defined(_CALL_SYSV) || defined(_WIN32))
     1578#define VA_COPY(ap1, ap2)     (*(ap1) = *(ap2))
     1579#elif defined(VA_COPY_AS_ARRAY)
     1580#define VA_COPY(ap1, ap2)     memmove ((ap1), (ap2), sizeof (va_list))
     1581#else /* va_list is a pointer */
     1582#define VA_COPY(ap1, ap2)     ((ap1) = (ap2))
     1583#endif
     1584#endif
    15751585
    15761586
     
    17071717  else
    17081718    {
    1709       /* use va_copy */
    1710       /*@i@*/va_copy(vl2, vl);
     1719      /* use VA_COPY */
     1720      /*@i@*/VA_COPY(vl2, vl);
    17111721      len      = sl_strlen(lmsg->msg);
    17121722      /*@i@*/required = sl_vsnprintf(&(lmsg->msg[len]),
     
    17691779                             SH_ERR_STAMP | SH_ERR_ERR    | SH_ERR_SEVERE |
    17701780                             SH_ERR_FATAL);
    1771   flag_err_info           = SL_TRUE;
     1781  flag_err_info           = S_TRUE;
    17721782#endif
    17731783
Note: See TracChangeset for help on using the changeset viewer.