|
|
1.1 root 1: /* Copyright (c) 1979 Regents of the University of California */
2:
3: static char sccsid[] = "@(#)REMOVE.c 1.1 10/29/80";
4:
5: #include "h00vars.h"
6: #include "h01errs.h"
7:
8: REMOVE(name, maxnamlen)
9:
10: char *name;
11: int maxnamlen;
12: {
13: register int cnt;
14: char namebuf[NAMSIZ];
15:
16: /*
17: * trim trailing blanks, and insure that the name
18: * will fit into the file structure
19: */
20: for (cnt = 0; cnt < maxnamlen; )
21: if (name[cnt] == '\0' || name[cnt++] == ' ')
22: break;
23: if (cnt >= NAMSIZ) {
24: ERROR(ENAMESIZE, name);
25: return;
26: }
27: maxnamlen = cnt;
28: /*
29: * put the name into the buffer with null termination
30: */
31: for (cnt = 0; cnt < maxnamlen; cnt++)
32: namebuf[cnt] = name[cnt];
33: namebuf[cnt] = '\0';
34: /*
35: * unlink the file
36: */
37: if (unlink(namebuf)) {
38: ERROR(EREMOVE, namebuf);
39: return;
40: }
41: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.