From b3f090b9c4e6a70edb59c562aff3580b7d7ef05e Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 9 Sep 1997 13:17:15 +0000 Subject: [PATCH] Pre-release! --- lib/lib.h | 5 ++++- lib/log.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/lib.h b/lib/lib.h index d13b696c..e7264671 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -55,6 +55,7 @@ void cf_read(byte *, struct cfitem *); void log(byte *, ...); void die(byte *, ...) NONRET; void initlog(byte *); +void open_log_file(byte *); /* Allocation */ @@ -96,10 +97,12 @@ void obj_dump(struct odes *); struct odes *obj_fload(FILE *); struct odes *obj_new(void); struct odes *obj_load(byte *); -void obj_fwrite(FILE *, struct odes *); /* Closes the file afterwards... */ +void obj_fwrite(FILE *, struct odes *); +void obj_write(byte *, struct odes *); void obj_free(struct odes *); struct oattr *find_attr(struct odes *, uns); struct oattr *find_attr_last(struct odes *, uns); +uns del_attr(struct odes *, struct oattr *); byte *find_aval(struct odes *, uns); struct oattr *set_attr(struct odes *, uns, byte *); struct oattr *set_attr_num(struct odes *, uns, uns); diff --git a/lib/log.c b/lib/log.c index 213987a8..f17b8d9b 100644 --- a/lib/log.c +++ b/lib/log.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -76,3 +77,17 @@ initlog(byte *argv0) progname = basename(argv0); pid = getpid(); } + +void +open_log_file(byte *name) +{ + if (name) + { + int fd = open(name, O_WRONLY | O_CREAT | O_APPEND, 0666); + if (fd < 0) + die("Unable to open log file"); + close(2); + dup(fd); + close(fd); + } +} -- 2.39.2