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" |
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 |
|
|
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; |
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 |
|
|
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 |
|
|