Browse code

- rls excluded from the compile by default list (depends on external libs) - added DEBUG(), ERR(), WARN(), INFO(), BUG() which can be used instead of LOG(L_*, ). The new macros will add "DEBUG:", "ERROR:" a.s.o in front of the message and also the filename and line number from where they were called ( DEBUG("x") in foo.c:23 is equiv. with DBG("DEBUG: foo.c:23: x"))

Andrei Pelinescu-Onciul authored on 05/12/2005 17:01:08
Showing 6 changed files
... ...
@@ -52,7 +52,7 @@ exclude_modules?= 			cpl ext extcmd \
52 52
 							jabber mysql \
53 53
 							cpl-c \
54 54
 							auth_radius group_radius uri_radius avp_radius \
55
-							pa
55
+							pa rls
56 56
 # always exclude the CVS dir
57 57
 override exclude_modules+= CVS $(skip_modules)
58 58
 
... ...
@@ -61,7 +61,7 @@ MAIN_NAME=ser
61 61
 VERSION = 0
62 62
 PATCHLEVEL = 10
63 63
 SUBLEVEL =   99
64
-EXTRAVERSION = -dev23-tcp
64
+EXTRAVERSION = -dev24
65 65
 
66 66
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
67 67
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
... ...
@@ -371,7 +371,7 @@ EAT_ABLE	[\ \t\b\r]
371 371
 <INITIAL>{AF}	{ count(); yylval.strval=yytext; return AF; }
372 372
 <INITIAL>{MYSELF}	{ count(); yylval.strval=yytext; return MYSELF; }
373 373
 
374
-<INITIAL>{DEBUG}	{ count(); yylval.strval=yytext; return DEBUG; }
374
+<INITIAL>{DEBUG}	{ count(); yylval.strval=yytext; return DEBUG_V; }
375 375
 <INITIAL>{FORK}		{ count(); yylval.strval=yytext; return FORK; }
376 376
 <INITIAL>{LOGSTDERROR}	{ yylval.strval=yytext; return LOGSTDERROR; }
377 377
 <INITIAL>{LOGFACILITY}	{ yylval.strval=yytext; return LOGFACILITY; }
... ...
@@ -193,7 +193,7 @@ static struct socket_id* mk_listen_id(char*, int, int);
193 193
 %token TLS
194 194
 
195 195
 /* config vars. */
196
-%token DEBUG
196
+%token DEBUG_V
197 197
 %token FORK
198 198
 %token LOGSTDERROR
199 199
 %token LOGFACILITY
... ...
@@ -406,8 +406,8 @@ id_lst:		phostport		{  $$=$1 ; }
406 406
 		;
407 407
 
408 408
 
409
-assign_stm:	DEBUG EQUAL NUMBER { debug=$3; }
410
-		| DEBUG EQUAL error  { yyerror("number  expected"); }
409
+assign_stm:	DEBUG_V EQUAL NUMBER { debug=$3; }
410
+		| DEBUG_V EQUAL error  { yyerror("number  expected"); }
411 411
 		| FORK  EQUAL NUMBER { dont_fork= ! $3; }
412 412
 		| FORK  EQUAL error  { yyerror("boolean value expected"); }
413 413
 		| LOGSTDERROR EQUAL NUMBER { if (!config_check) log_stderr=$3; }
... ...
@@ -57,6 +57,24 @@ void dprint (char* format, ...);
57 57
 
58 58
 int str2facility(char *s);
59 59
 
60
+/* C >= 99 has __func__, older gcc versions have __FUNCTION__ */
61
+#if __STDC_VERSION__ < 199901L
62
+# if __GNUC__ >= 2
63
+#  define _FUNC_NAME_ __FUNCTION__
64
+# else
65
+#  define _FUNC_NAME_ ""
66
+# endif
67
+#else
68
+# define _FUNC_NAME_ __func__
69
+#endif
70
+
71
+
72
+#define XCT2STR(i) #i
73
+#define CT2STR(l) XCT2STR(l)
74
+
75
+#define LOC_INFO	__FILE__ ":" CT2STR(__LINE__) ": "
76
+
77
+
60 78
 
61 79
 #ifdef NO_DEBUG
62 80
 	#ifdef __SUNPRO_C
... ...
@@ -142,25 +160,25 @@ int str2facility(char *s);
142 142
 					else { \
143 143
 						switch(lev){ \
144 144
 							case L_CRIT: \
145
-								syslog(LOG_CRIT|log_facility, "CRIT: " fmt, ##args); \
145
+								syslog(LOG_CRIT|log_facility, fmt, ##args); \
146 146
 								break; \
147 147
 							case L_ALERT: \
148
-								syslog(LOG_ALERT|log_facility, "ALERT: " fmt, ##args); \
148
+								syslog(LOG_ALERT|log_facility, fmt, ##args); \
149 149
 								break; \
150 150
 							case L_ERR: \
151
-								syslog(LOG_ERR|log_facility, "ERROR: " fmt, ##args); \
151
+								syslog(LOG_ERR|log_facility, fmt, ##args); \
152 152
 								break; \
153 153
 							case L_WARN: \
154
-								syslog(LOG_WARNING|log_facility, "WARNING: " fmt, ##args);\
154
+								syslog(LOG_WARNING|log_facility, fmt, ##args);\
155 155
 								break; \
156 156
 							case L_NOTICE: \
157
-								syslog(LOG_NOTICE|log_facility, "NOTICE: " fmt, ##args); \
157
+								syslog(LOG_NOTICE|log_facility, fmt, ##args); \
158 158
 								break; \
159 159
 							case L_INFO: \
160
-								syslog(LOG_INFO|log_facility, "INFO: " fmt, ##args); \
160
+								syslog(LOG_INFO|log_facility, fmt, ##args); \
161 161
 								break; \
162 162
 							case L_DBG: \
163
-								syslog(LOG_DEBUG|log_facility, "DEBUG: " fmt, ##args); \
163
+								syslog(LOG_DEBUG|log_facility, fmt, ##args); \
164 164
 								break; \
165 165
 						} \
166 166
 					} \
... ...
@@ -184,4 +202,19 @@ int str2facility(char *s);
184 184
 	#endif
185 185
 #endif
186 186
 
187
+#ifdef __SUNPRO_C
188
+		#define DEBUG(...) DBG("DEBUG"            LOC_INFO __VA_ARGS__)
189
+		#define ERR(...)  LOG(L_ERR, "ERROR: "    LOC_INFO __VA_ARGS__)
190
+		#define WARN(...) LOG(L_WARN, "WARNING: " LOC_INFO __VA_ARGS__)
191
+		#define INFO(...) LOG(L_INFO, "INFO: "    LOC_INFO __VA_ARGS__)
192
+		#define BUG(...) LOG(L_CRIT, "BUG: "      LOC_INFO __VA_ARGS__)
193
+#else
194
+		#define DEBUG(fmt, args...) DBG("DEBUG "        LOC_INFO fmt, ## args)
195
+		#define ERR(fmt, args...) LOG(L_ERR, "ERROR: "  LOC_INFO fmt, ## args)
196
+		#define WARN(fmt, args...) LOG(L_WARN, "WARN: " LOC_INFO fmt, ## args)
197
+		#define INFO(fmt, args...) LOG(L_INFO, "INFO: " LOC_INFO fmt, ## args)
198
+		#define BUG(fmt, args...) LOG(L_CRIT, "BUG: "   LOC_INFO fmt, ## args)
199
+#endif
200
+
201
+
187 202
 #endif /* ifndef dprint_h */
... ...
@@ -15,4 +15,5 @@ gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
15 15
 gcc-3.4 (GCC) 3.4.4 20041218 (prerelease) (Debian 3.4.3-7)
16 16
 powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 20041026 (Apple Computer, Inc. build 4061)
17 17
 gcc-4.0 (GCC) 4.0.2 20050821 (prerelease) (Debian 4.0.1-6)
18
+gcc-4.0.1 (GCC) 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)
18 19