/[pengfork]/pengfork/src/log.c
ViewVC logotype

Diff of /pengfork/src/log.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by chupa, Sat Nov 30 13:24:43 2002 UTC revision 1.13 by chupa, Sun Dec 1 01:19:07 2002 UTC
# Line 20  Line 20 
20   *                   *                
21   */   */
22    
23    #include "config.h"
24    
25  #include <sys/types.h>  #include <sys/types.h>
26  #include <stdio.h>  #include <stdio.h>
27  #include <stdarg.h>  #include <stdarg.h>
28  #include <locale.h>  #include <locale.h>
29    #include "gettext.h"
30    
31  #include "log.h"  #include "log.h"
32  #include "options.h"  #include "options.h"
# Line 31  Line 34 
34  int  int
35  init_log (void)  init_log (void)
36  {  {
37    setlocale(LC_ALL, NULL);    setlocale (LC_ALL, "");
38      bindtextdomain (PACKAGE, LOCALEDIR);
39      textdomain (PACKAGE);
40    
41    if (PARAM_DAEMON)    if (PARAM_DAEMON)
42      openlog ("pengfork", 0, LOG_DAEMON);      openlog ("pengfork", 0, LOG_DAEMON);
43    
44    return 1;    return 1;
45  }  }
46    
# Line 60  log (int level, char *format, ...) Line 67  log (int level, char *format, ...)
67    
68    else    else
69      {      {
70        vsnprintf(line, sizeof(line), format, ap);        vsnprintf (line, sizeof (line), format, ap);
71        syslog (level, line, ap);        syslog (level, line, ap);
72      }      }
73    return 1;    return 1;
# Line 89  dump_raw (text, data, size) Line 96  dump_raw (text, data, size)
96  {  {
97    int i, j;    int i, j;
98    unsigned char *p = data;    unsigned char *p = data;
99      
100    if(PARAM_DEBUG_LEVEL < DEBUG_MAX) return;    if (PARAM_DEBUG_LEVEL < DEBUG_MAX)
101    debug (DEBUG_MAX, "%s raw dump: \n",text);      return;
102      debug (DEBUG_MAX, gettext ("%s raw dump: \n"), text);
103    for (i = 0; i < size; i += 16)    for (i = 0; i < size; i += 16)
104      {      {
105        debug (DEBUG_MAX, "  %04x: ", i);        debug (DEBUG_MAX, "  %04x: ", i);
106        for (j = 0; j < 8; j++)        for (j = 0; j < 8; j++)
107          if (i + j < size)          if (i + j < size)
108            debug (DEBUG_MAX, "%c", (p[i + j] > 32 && p[i + j] < 127) ? p[i + j] : '.');            debug (DEBUG_MAX, "%c",
109                     (p[i + j] > 32 && p[i + j] < 127) ? p[i + j] : '.');
110          else          else
111            debug (DEBUG_MAX, " ");            debug (DEBUG_MAX, " ");
112    
# Line 105  dump_raw (text, data, size) Line 114  dump_raw (text, data, size)
114    
115        for (j = 8; j < 16; j++)        for (j = 8; j < 16; j++)
116          if (i + j < size)          if (i + j < size)
117            debug (DEBUG_MAX, "%c", (p[i + j] > 32 && p[i + j] < 127) ? p[i + j] : '.');            debug (DEBUG_MAX, "%c",
118                     (p[i + j] > 32 && p[i + j] < 127) ? p[i + j] : '.');
119          else          else
120            debug (DEBUG_MAX, " ");            debug (DEBUG_MAX, " ");
121    

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

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26