]> diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/sbr/remdir.c
Always check that mktemp()/mktemp2() succeeds before trying to
[nmh] / docs / historical / mh-6.8.5 / sbr / remdir.c
1 /* remdir.c - remove a directory */
2 #ifndef lint
3 static char ident[] = "@(#)$Id: remdir.c,v 1.5 1992/12/15 00:20:22 jromine Exp $";
4 #endif lint
5
6 #include "../h/mh.h"
7 #include <stdio.h>
8
9
10 remdir (dir)
11 char *dir;
12 {
13 #if !defined (BSD42) && !defined (SYS5DIR)
14 int pid;
15 #endif /* not BSD42 and not SYS5DIR */
16
17 m_update ();
18 (void) fflush (stdout);
19
20 #if !defined (BSD42) && !defined (SYS5DIR)
21 switch (pid = vfork ()) {
22 case NOTOK:
23 advise ("fork", "unable to");
24 return 0;
25
26 case OK:
27 execl ("/bin/rmdir", "rmdir", dir, NULLCP);
28 execl ("/usr/bin/rmdir", "rmdir", dir, NULLCP);
29 fprintf (stderr, "unable to exec ");
30 perror ("rmdir");
31 _exit (-1);
32
33 default:
34 if (pidXwait (pid, "rmdir"))
35 return 0;
36 break;
37 }
38 #else /* BSD42 or SYS5DIR */
39 if (rmdir (dir) == NOTOK) {
40 admonish (dir, "unable to remove directory");
41 return 0;
42 }
43 #endif /* BSD42 or SYS5DIR */
44
45 return 1;
46 }