/[pdpsoft]/trunk/grid-mw-security/ees/src/eef/eef_log.c
ViewVC logotype

Contents of /trunk/grid-mw-security/ees/src/eef/eef_log.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 881 - (show annotations) (download) (as text)
Wed Oct 7 11:46:12 2009 UTC (12 years, 3 months ago) by aramv
File MIME type: text/x-chdr
File size: 1500 byte(s)
Rearranged some declarations to satisfy lex/yacc warnings
1 #include "eef_log.h"
2
3 EES_RC eef_log(int priority, char* format, ...){
4 va_list args;
5 /*time_t _time;*/
6 /*struct tm * _time_s;*/
7 /*char _strf_fmt[MAX_TIME_STRING_SIZE];*/
8
9 /*_time = time(NULL);*/
10 /*_time_s = localtime(&_time);*/
11 /*strftime(_strf_fmt, MAX_TIME_STRING_SIZE, "%G", _time_s);*/
12 char *_format = append_newline(format);
13
14 va_start(args, format);
15 if(priority == LOG_ERR){
16 vfprintf(stderr, _format, args);
17 }
18 va_end(args);
19 #if ENABLE_DEBUG
20 va_start(args, format);
21 if(priority == LOG_DEBUG){
22 vfprintf(stdout, _format, args);
23 }
24 va_end(args);
25 #endif
26
27 /* if the format string changed by appending, it needs to be free'd */
28 if(format != _format){
29 free(_format);
30 }
31
32 _format = strip_newline(format);
33
34 va_start(args, format);
35 vsyslog(priority, _format, args);
36 va_end(args);
37
38 /* if the format string changed by stripping, it needs to be free'd */
39 if(format != _format){
40 free(_format);
41 }
42 return 0;
43 }
44
45 char* append_newline(char* string){
46 char* mutable_string = NULL;
47 size_t string_length = strlen(string);
48
49 if(string[strlen(string)-1] != '\n'){
50 if((mutable_string = calloc((string_length+2),sizeof(char)))){
51 strncpy(mutable_string, string, string_length);
52 strncat(mutable_string, "\n", 1);
53 return mutable_string;
54 }
55 }
56 return string;
57 }
58
59 char* strip_newline(char* string){
60 /*char* mutable_string = NULL;*/
61 /*size_t string_length = strlen(string);*/
62
63 /* TODO */
64
65 return string;
66 }

Properties

Name Value
svn:mergeinfo

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28