]>
diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/mts/mh/netmail.c
1 /* netmail.c - queue mail for the network server */
5 #include "../h/strings.h"
7 #include "../zotnet/mts.h"
18 static char hex
[] = "0123456789ABCDEF";
30 static char quefil
[BUFSIZ
];
31 static char wrkfil
[BUFSIZ
];
36 char *cdate (), *ctime ();
40 int nm_init (user
, clock
)
44 quefile (quefil
, wrkfil
);
46 (void) unlink (wrkfil
);
47 if ((fp
= fopen (wrkfil
, "w")) == NULL
)
49 (void) chmod (wrkfil
, 0600);
51 fprintf (fp
, "%s %s\n", user
, cdate (clock
));
57 int nm_wadr (mbox
, host
)
61 fprintf (fp
, "/%s %s\n", host
, mbox
);
74 int nm_wtxt (buffer
, cnt
)
75 register char *buffer
;
78 if (fwrite (buffer
, sizeof *buffer
, cnt
, fp
) != cnt
)
87 if (link (wrkfil
, quefil
) == NOTOK
|| unlink (wrkfil
) == NOTOK
)
95 static quefile (que
, lnk
)
103 template.stamp
.pid
= getpid ();
104 template.stamp
.id
= files
++;
109 (void) time (&template.stamp
.clock
);
112 for (q
= template.nbytes
; q
< &template.nbytes
[NBYTES
]; q
++) {
113 *p
++ = hex
[(*q
>> 4) & 0xf];
114 *p
++ = hex
[(*q
) & 0xf];
118 (void) sprintf (que
, "%s/%s", Mailqdir
, buffer
);
119 (void) sprintf (lnk
, "%s/%s", TMailqdir
, buffer
);
124 static char *cdate (clock
)
125 register long *clock
;