xref: /original-bsd/usr.bin/f77/libU77/unlink_.c (revision 4b2c5e10)
1 /*
2 char id_unlink[] = "@(#)unlink_.c	1.2";
3  *
4  * unlink (remove) a file
5  *
6  * calling sequence:
7  *	integer unlink
8  *	ierror = unlink(filename)
9  * where:
10  *	ierror will be a returned status (0 == OK)
11  *	filename is the file to be unlinked
12  */
13 
14 #include "../libI77/f_errno.h"
15 #include <sys/param.h>
16 #ifndef	MAXPATHLEN
17 #define MAXPATHLEN	128
18 #endif
19 
20 long
21 unlink_(fname, namlen)
22 char *fname;
23 long namlen;
24 {
25 	char buf[MAXPATHLEN];
26 
27 	if (namlen >= sizeof buf)
28 		return((long)(errno=F_ERARG));
29 	g_char(fname, namlen, buf);
30 	if (unlink(buf) != 0)
31 		return((long)errno);
32 	return(0L);
33 }
34