diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2000-12-07 23:16:19 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2000-12-07 23:16:19 +0000 |
commit | 0c0b00ab8086c07600680d41e2f8feefe0f8f150 (patch) | |
tree | 0da2100a6944b5efed0aa02d950d98a071bec0cc /mdk-stage1/log.c | |
parent | 71d6a65fa155d25fc325d6a9b83a746f5845922e (diff) | |
download | drakx-0c0b00ab8086c07600680d41e2f8feefe0f8f150.tar drakx-0c0b00ab8086c07600680d41e2f8feefe0f8f150.tar.gz drakx-0c0b00ab8086c07600680d41e2f8feefe0f8f150.tar.bz2 drakx-0c0b00ab8086c07600680d41e2f8feefe0f8f150.tar.xz drakx-0c0b00ab8086c07600680d41e2f8feefe0f8f150.zip |
first draft can detect your cdrom drives
soon will launch the stage2
Diffstat (limited to 'mdk-stage1/log.c')
-rw-r--r-- | mdk-stage1/log.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/mdk-stage1/log.c b/mdk-stage1/log.c index 27e77bf02..7536d0a08 100644 --- a/mdk-stage1/log.c +++ b/mdk-stage1/log.c @@ -19,26 +19,29 @@ * */ - +#include <stdlib.h> +#include <unistd.h> #include <fcntl.h> #include <stdarg.h> #include <stdio.h> -#include <stdlib.h> -#include <unistd.h> +#include <string.h> +#include <time.h> +#include <errno.h> #include "log.h" static FILE * logfile = NULL; - -void do_log_message(const char * s, va_list args) +void vlog_message_nobs(const char * s, va_list args) { - if (!logfile) return; - fprintf(logfile, "* "); vfprintf(logfile, s, args); +} + +void vlog_message(const char * s, va_list args) +{ + vlog_message_nobs(s, args); fprintf(logfile, "\n"); - fflush(logfile); } @@ -46,25 +49,34 @@ void do_log_message(const char * s, va_list args) void log_message(const char * s, ...) { va_list args; - + + if (!logfile) { + fprintf(stderr, "Log is not open!\n"); + return; + } + va_start(args, s); - do_log_message(s, args); + vlog_message(s, args); va_end(args); return; } +void log_perror(char *msg) +{ + log_message("%s %s", strerror(errno), msg); +} + void open_log(int testing) { - if (!testing) - { - logfile = fopen("/dev/tty3", "w"); - if (!logfile) - logfile = fopen("/tmp/install.log", "a"); - } - else - logfile = fopen("debug.log", "w"); + if (!testing) { + logfile = fopen("/dev/tty3", "w"); + if (!logfile) + logfile = fopen("/tmp/install.log", "a"); + } + else + logfile = fopen("debug.log", "w"); } void close_log(void) |