void log(byte *, ...);
void die(byte *, ...) NONRET;
void initlog(byte *);
+void open_log_file(byte *);
/* Allocation */
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);
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <fcntl.h>
#include <unistd.h>
#include <sys/time.h>
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);
+ }
+}