9 #define FATAL "setmaillist: fatal: "
13 strerr_die1x(100,"setmaillist: usage: setmaillist list.bin list.tmp");
27 strerr_die4sys(111,FATAL,"unable to write to ",fntmp,": ");
34 if (substdio_put(&ss,s,len) == -1) writeerr();
43 fnbin = argv[1]; if (!fnbin) usage();
44 fntmp = argv[2]; if (!fntmp) usage();
46 fd = open_trunc(fntmp);
48 strerr_die4sys(111,FATAL,"unable to create ",fntmp,": ");
50 substdio_fdbuf(&ss,write,fd,buf,sizeof buf);
53 if (getln(subfdinsmall,&line,&match,'\n') == -1)
54 strerr_die2sys(111,FATAL,"unable to read input: ");
57 if (line.s[line.len - 1] != '\n')
58 if (line.s[line.len - 1] != ' ')
59 if (line.s[line.len - 1] != '\t')
64 if (byte_chr(line.s,line.len,'\0') != line.len)
65 strerr_die2x(111,FATAL,"NUL in input");
68 if (line.s[0] != '#') {
69 if ((line.s[0] == '.') || (line.s[0] == '/')) {
75 strerr_die2x(111,FATAL,"addresses must be under 800 bytes");
86 if (substdio_flush(&ss) == -1) writeerr();
87 if (fsync(fd) == -1) writeerr();
88 if (close(fd) == -1) writeerr(); /* NFS stupidity */
90 if (rename(fntmp,fnbin) == -1)
91 strerr_die6sys(111,FATAL,"unable to move ",fntmp," to ",fnbin,": ");