Changeset 1061 in MondoRescue for branches/stable/mondo/src
- Timestamp:
- Jan 18, 2007, 1:47:59 PM (18 years ago)
- Location:
- branches/stable/mondo/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-tools.c
r1044 r1061 343 343 344 344 /** 345 * Locate mondoarchive's home directory. Searches in /usr/ local/mondo, /usr/share/mondo,345 * Locate mondoarchive's home directory. Searches in /usr/share/mondo, 346 346 * /usr/local/share/mondo, /opt, or if all else fails, search /usr. 347 347 * -
branches/stable/mondo/src/include/mr_mem.h
r1054 r1061 9 9 #define MR_MEM_H 10 10 11 #ifndef _GNU_SOURCE 12 #define _GNU_SOURCE 13 #endif 14 #include <stdarg.h> 15 11 16 /* functions (public methods) */ 12 17 13 18 extern void mr_free(char *allocated); 14 19 extern void mr_allocstr(char *alloc, const char *orig); 15 extern void mr_asprintf(char **alloc, const char *fmt, ...); 16 /* 17 extern void mr_vasprintf(char **alloc, const char *fmt, va_list ap); 18 */ 20 extern void mr_asprintf(char **alloc, const char *fmt, va_list args); 19 21 extern void mr_getline(char **lineptr, size_t *n, FILE *stream); 20 22 extern void *mr_malloc(size_t size); -
branches/stable/mondo/src/include/mr_msg.h
r1054 r1061 9 9 #define MR_MSG_H 10 10 11 #ifndef _GNU_SOURCE 12 #define _GNU_SOURCE 13 #endif 14 #include <stdarg.h> 15 11 16 /* functions (public methods) */ 12 17 13 #include <stdarg.h> 14 15 extern void mr_msg(int debug, const char *fmt, ...); 18 extern void mr_msg(int debug, const char *fmt, va_list args); 16 19 17 20 #endif /* MR_MSG_H */ -
branches/stable/mondo/src/lib/mr_err.c
r1054 r1061 36 36 37 37 void mr_log_exit(int errorcode, const char *message) { 38 mr_msg(0, message);38 mr_msg(0, message); 39 39 mr_exit(errorcode, message); 40 40 } -
branches/stable/mondo/src/lib/mr_mem.c
r1054 r1061 12 12 #include <stdio.h> 13 13 #include <stdlib.h> 14 #include <stdarg.h>15 14 16 15 #include "mr_err.h" … … 53 52 54 53 /* encapsulation function for asprintf */ 55 void mr_asprintf(char **strp, const char *fmt, ...) {54 void mr_asprintf(char **strp, const char *fmt, va_list args) { 56 55 57 va_list args;58 56 int res = 0; 59 57 60 va_start(args, fmt);61 58 res = vasprintf(strp, fmt, args); 62 59 if (res == -1) { 63 60 mr_log_exit(-1,"Unable to alloc memory in mr_asprintf\nExiting..."); 64 61 } 65 va_end(args);66 62 } 67 63 -
branches/stable/mondo/src/lib/mr_msg.c
r1054 r1061 30 30 if ((fout = fopen(mr_logfile, "w")) == NULL) { 31 31 fprintf(stderr,"Unable to write to %s\n",mr_logfile); 32 fprintf(stderr,"Logging desactivated\n" ,mr_logfile);32 fprintf(stderr,"Logging desactivated\n"); 33 33 mr_msg_close(); 34 34 } … … 41 41 /* 42 42 * Function that log a message. Not called directly 43 * but through macros in mr_msg.h43 * but through other functions 44 44 */ 45 void _mr_msg(int debug, const char *file, const char *function, int line, const char *fmt, ...) {45 void _mr_msg(int debug, const char *file, const char *function, int line, const char *fmt, va_list args) { 46 46 47 47 int i = 0; 48 48 int res = 0; 49 49 FILE *fout = NULL; 50 va_list args;51 50 52 51 if (mr_logfile == NULL) { … … 66 65 fprintf(fout, "%s->%s#%d: ", file, function, line); 67 66 } 68 va_start(args, fmt);69 67 if (vfprintf(fout, fmt, args) < 0) { 70 68 fprintf(stderr,"Unable to print to %s\n",mr_logfile); 69 return; 71 70 } 72 va_end(args);73 71 74 72 fprintf(fout, "\n"); … … 79 77 } 80 78 81 void mr_msg(int level, const char *f ormat, ...) {79 void mr_msg(int level, const char *fmt, va_list args) { 82 80 83 va_list args; 84 va_start(args, format); 85 _mr_msg(level, __FILE__, __FUNCTION__, __LINE__, format, args); 86 va_end(args); 81 _mr_msg(level, __FILE__, __FUNCTION__, __LINE__, fmt, args); 87 82 }
Note:
See TracChangeset
for help on using the changeset viewer.