};
extern char *mailbox(char *buf, natid cn);
+extern int mailbox_create(char *);
extern int tel_read_header(FILE *, char *, struct telstr *);
extern int tel_read_body(FILE *, char *, struct telstr *,
int (*sink)(char *, size_t, void *),
#include <config.h>
#include <stdio.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
#include "optlist.h"
#include "tel.h"
#include "prototypes.h"
return buf;
}
+/*
+ * Create an empty telegram file named MBOX.
+ */
+int
+mailbox_create(char *mbox)
+{
+ close(creat(mbox, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP));
+ return 0;
+}
+
/*
* Read telegram header from FP into TEL.
* MBOX is the file name, it is used for logging errors.
#include <config.h>
-#include <fcntl.h>
#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
#include "file.h"
#include "misc.h"
#include "nat.h"
ef_blank(EF_REALM, i + cnum * MAXNOR, &newrealm);
putrealm(&newrealm);
}
- close(creat(mailbox(buf, cnum),
- S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP));
+ mailbox_create(mailbox(buf, cnum));
/* FIXME natp->nat_ann = #annos */
natp->nat_level[NAT_HLEV] = start_happiness;
natp->nat_level[NAT_RLEV] = start_research;
#include <config.h>
#include <errno.h>
-#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include "file.h"
main(int argc, char *argv[])
{
char buf[255];
- char *filename;
struct natstr nat;
int i;
int opt;
exit(1);
}
for (i = 0; i < MAXNOC; i++) {
- filename = mailbox(buf, i);
- close(creat(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP));
+ mailbox_create(mailbox(buf, i));
}
- close(creat(annfil, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP));
+ mailbox_create(annfil);
nat_reset(&nat, 0, "POGO", "peter", STAT_GOD);
putnat(&nat);