Changeset 1064 in MondoRescue
- Timestamp:
- Jan 23, 2007, 1:09:32 AM (18 years ago)
- Location:
- branches/stable/mondo
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/configure.in
r1051 r1064 74 74 AC_CHECK_LIB(pthread, pthread_create, true, [echo "*** Cannot find -lpthread."; echo "*** Please make sure you have the linuxthreads glibc add-on installed."; exit 1]) 75 75 PTHREAD="-lpthread" 76 CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ REENTRANT"76 CFLAGS="$CFLAGS -Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_REENTRANT -Wshadow -funsigned-char -Wstrict-prototypes -Wunused -Winit-self -Wcast-align" 77 77 ;; 78 78 *) -
branches/stable/mondo/src/include/mr_conf.h
r1054 r1064 19 19 /*initialization and closing*/ 20 20 extern int mr_conf_open(const char *filename); 21 extern void mr_conf_close( );21 extern void mr_conf_close(void); 22 22 23 23 /*read integer number after string str in the current file*/ -
branches/stable/mondo/src/include/mr_err.h
r1054 r1064 11 11 /* functions (public methods) */ 12 12 13 extern void mr_exit(int errorcode, const char *message);14 extern void mr_log_exit(int errorcode, const char *message);13 extern inline void mr_exit(int errorcode, const char *message); 14 extern inline void mr_log_exit(int errorcode, const char *message); 15 15 16 16 #endif /* MR_ERR_H */ -
branches/stable/mondo/src/include/mr_mem.h
r1061 r1064 16 16 /* functions (public methods) */ 17 17 18 extern void mr_free(char *allocated);19 extern void mr_allocstr(char *alloc, const char *orig);20 extern void mr_asprintf(char **alloc, const char *fmt, va_list args);21 extern void mr_getline(char **lineptr, size_t *n, FILE *stream);22 extern void *mr_malloc(size_t size);18 extern inline void mr_free(char *allocated); 19 extern inline void mr_allocstr(char *alloc, const char *orig); 20 extern inline void mr_asprintf(char **alloc, const char *fmt, ...); 21 extern inline void mr_getline(char **lineptr, size_t *n, FILE *stream); 22 extern inline void *mr_malloc(size_t size); 23 23 24 24 #endif /* MR_MEM_H */ -
branches/stable/mondo/src/include/mr_msg.h
r1061 r1064 16 16 /* functions (public methods) */ 17 17 18 extern void mr_msg(int debug, const char *fmt, va_list args); 18 extern inline void mr_msg(int debug, const char *fmt, ...); 19 extern void mr_msg_init(const char *configfile, int loglevel); 20 extern void mr_msg_close(void); 19 21 20 22 #endif /* MR_MSG_H */ -
branches/stable/mondo/src/include/mr_str.h
r1054 r1064 11 11 /* functions (public methods) */ 12 12 13 extern char *mr_strtok(char *instr, const char *delims, int *lastpos);14 extern char *mr_stresc(char *instr, char *toesc, const char escchr);13 extern inline char *mr_strtok(char *instr, const char *delims, int *lastpos); 14 extern inline char *mr_stresc(char *instr, char *toesc, const char escchr); 15 15 16 16 #endif /* MR_STR_H */ -
branches/stable/mondo/src/lib/mr_conf.c
r1054 r1064 68 68 static size_t mr_conf_filesize(const char *name); 69 69 static void mr_conf_error_msg(int error_code, const char *add_line); 70 static void mr_conf_remove_comments( );70 static void mr_conf_remove_comments(void); 71 71 static int mr_conf_check_int_flag(const int flag); 72 72 static void mr_conf_set_int_flag(const int flag); … … 141 141 142 142 /*release all memory and prepare to the next possiable config file*/ 143 void mr_conf_close( ) {143 void mr_conf_close(void) { 144 144 /* if not opened => error */ 145 145 if (!mr_conf_check_int_flag(MRCONF_INTFLAG_OPEN)) { -
branches/stable/mondo/src/lib/mr_err.c
r1061 r1064 9 9 * Provided under the GPLv2 10 10 */ 11 12 #ifndef _GNU_SOURCE 13 #define _GNU_SOURCE 14 #endif 11 15 12 16 #include <stdio.h> -
branches/stable/mondo/src/lib/mr_mem.c
r1061 r1064 9 9 * Provided under the GPLv2 10 10 */ 11 12 #ifndef _GNU_SOURCE 13 #define _GNU_SOURCE 14 #endif 11 15 12 16 #include <stdio.h> … … 52 56 53 57 /* encapsulation function for asprintf */ 54 void mr_asprintf(char **strp, const char *fmt, va_list args) {58 void mr_asprintf(char **strp, const char *fmt, ...) { 55 59 56 60 int res = 0; 61 va_list args; 57 62 63 va_start(args,fmt); 58 64 res = vasprintf(strp, fmt, args); 59 65 if (res == -1) { 60 66 mr_log_exit(-1,"Unable to alloc memory in mr_asprintf\nExiting..."); 61 67 } 68 va_end(args); 62 69 } 63 70 -
branches/stable/mondo/src/lib/mr_msg.c
r1061 r1064 10 10 */ 11 11 12 #ifndef _GNU_SOURCE 13 #define _GNU_SOURCE 14 #endif 12 15 #include <stdio.h> 13 16 #include <stdarg.h> 17 #include <stdlib.h> 14 18 15 19 static int mr_loglevel = 0; … … 43 47 * but through other functions 44 48 */ 45 void _mr_msg(int debug, const char *file, const char *function, int line, const char *fmt, va_list args) {49 void _mr_msg(int debug, const char *file, const char *function, int line, const char *fmt, ...) { 46 50 47 51 int i = 0; 48 52 int res = 0; 49 53 FILE *fout = NULL; 54 va_list args; 50 55 51 56 if (mr_logfile == NULL) { … … 58 63 return; 59 64 } 65 va_start(args,fmt); 60 66 61 67 // add 2 spaces to distinguish log levels … … 67 73 if (vfprintf(fout, fmt, args) < 0) { 68 74 fprintf(stderr,"Unable to print to %s\n",mr_logfile); 69 return;70 75 } 71 76 … … 74 79 fprintf(stderr,"Unable to close %s\n",mr_logfile); 75 80 } 81 va_end(args); 76 82 } 77 83 } 78 84 79 void mr_msg(int level, const char *fmt, va_list args) {85 void mr_msg(int level, const char *fmt, ...) { 80 86 87 va_list args; 88 89 va_start(args,fmt); 81 90 _mr_msg(level, __FILE__, __FUNCTION__, __LINE__, fmt, args); 91 va_end(args); 82 92 } -
branches/stable/mondo/src/test/mktest
r1054 r1064 7 7 8 8 lib="../lib/mr_conf.c ../lib/mr_msg.c ../lib/mr_err.c ../lib/mr_mem.c" 9 OPT="-Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_REENTRANT -Wstrict-prototypes -Wshadow -funsigned-char -Wunused -Winit-self -Wcast-align -O2 -g -I../common -I../include" 9 10 10 11 echo "Generating test-msg" 11 gcc -O2 -g -I../common -I../includetest-msg.c $lib -o test-msg12 gcc $OPT test-msg.c $lib -o test-msg 12 13 echo "Generating test-string" 13 gcc -O2 -g -I../common -I../includetest-string.c ../lib/mr_str.c $lib -o test-string14 gcc $OPT test-string.c ../lib/mr_str.c $lib -o test-string 14 15 echo "Generating test-conf" 15 gcc -O2 -g -I../common -I../includetest-conf.c $lib -o test-conf16 gcc $OPT test-conf.c $lib -o test-conf 16 17 17 18 for f in test-conf test-string test-msg; do -
branches/stable/mondo/src/test/test-conf.c
r1054 r1064 15 15 int g_buffer_pid = 0; 16 16 17 main() {17 int main(void) { 18 18 int ret = 0; 19 19 int i = 0; -
branches/stable/mondo/src/test/test-string.c
r1054 r1064 6 6 */ 7 7 8 #define _GNU_SOURCE9 8 #include <string.h> 10 9 #include <stdlib.h> … … 14 13 #include "mr_mem.h" 15 14 16 main() {15 int main(void) { 17 16 const char delims[3] = ": \n"; 18 17
Note:
See TracChangeset
for help on using the changeset viewer.