xref: /original-bsd/usr.bin/f77/libU77/unlink_.c (revision 0fc6f013)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)unlink_.c	5.1	06/07/85
7  */
8 
9 /*
10  * unlink (remove) a file
11  *
12  * calling sequence:
13  *	integer unlink
14  *	ierror = unlink(filename)
15  * where:
16  *	ierror will be a returned status (0 == OK)
17  *	filename is the file to be unlinked
18  */
19 
20 #include "../libI77/f_errno.h"
21 #include <sys/param.h>
22 #ifndef	MAXPATHLEN
23 #define MAXPATHLEN	128
24 #endif
25 
26 long
27 unlink_(fname, namlen)
28 char *fname;
29 long namlen;
30 {
31 	char buf[MAXPATHLEN];
32 
33 	if (namlen >= sizeof buf)
34 		return((long)(errno=F_ERARG));
35 	g_char(fname, namlen, buf);
36 	if (unlink(buf) != 0)
37 		return((long)errno);
38 	return(0L);
39 }
40