Mercurial > hg > Applications > mh
comparison sbr/remdir.c @ 0:bce86c4163a3
Initial revision
author | kono |
---|---|
date | Mon, 18 Apr 2005 23:46:02 +0900 |
parents | |
children | 441a2190cfae |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:bce86c4163a3 |
---|---|
1 /* remdir.c - remove a directory */ | |
2 #ifndef lint | |
3 static char ident[] = "@(#)$Id$"; | |
4 #endif /* lint */ | |
5 | |
6 #include "../h/mh.h" | |
7 #include <stdio.h> | |
8 #ifdef UNISTD | |
9 #include <unistd.h> | |
10 #endif | |
11 | |
12 | |
13 remdir (dir) | |
14 char *dir; | |
15 { | |
16 #if !defined (BSD42) && !defined (SYS5DIR) | |
17 int pid; | |
18 #endif /* not BSD42 and not SYS5DIR */ | |
19 | |
20 m_update (); | |
21 (void) fflush (stdout); | |
22 | |
23 #if !defined (BSD42) && !defined (SYS5DIR) | |
24 switch (pid = vfork ()) { | |
25 case NOTOK: | |
26 advise ("fork", "unable to"); | |
27 return 0; | |
28 | |
29 case OK: | |
30 execl ("/bin/rmdir", "rmdir", dir, NULLCP); | |
31 execl ("/usr/bin/rmdir", "rmdir", dir, NULLCP); | |
32 fprintf (stderr, "unable to exec "); | |
33 perror ("rmdir"); | |
34 _exit (-1); | |
35 | |
36 default: | |
37 if (pidXwait (pid, "rmdir")) | |
38 return 0; | |
39 break; | |
40 } | |
41 #else /* BSD42 or SYS5DIR */ | |
42 if (rmdir (dir) == NOTOK) { | |
43 admonish (dir, "unable to remove directory"); | |
44 return 0; | |
45 } | |
46 #endif /* BSD42 or SYS5DIR */ | |
47 | |
48 return 1; | |
49 } |