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