view sbr/remdir.c @ 12:441a2190cfae

Lion fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 21 Apr 2012 13:10:49 +0900
parents bce86c4163a3
children
line wrap: on
line source

/* remdir.c - remove a directory */
#ifndef	lint
static char ident[] = "@(#)$Id: remdir.c,v 1.1.1.1 2005/04/18 14:46:06 kono Exp $";
#endif /* lint */

#include "../h/mh.h"
#include <stdio.h>
#ifdef	UNISTD
#include <unistd.h>
#endif


remdir (dir)
char *dir;
{
#if	!defined (BSD42) && !defined (SYS5DIR)
    int     pid;
#endif	/* not BSD42 and not SYS5DIR */

    m_update ();
    (void) fflush (stdout);

#if	!defined (BSD42) && !defined (SYS5DIR)
    switch (pid = vfork ()) {
	case NOTOK: 
	    advise ("fork", "unable to");
	    return 0;

	case OK: 
	    execl ("/bin/rmdir", "rmdir", dir, NULLCP);
	    execl ("/usr/bin/rmdir", "rmdir", dir, NULLCP);
	    fprintf (stderr, "unable to exec ");
	    perror ("rmdir");
	    _exit (-1);

	default: 
	    if (pidXwait (pid, "rmdir"))
		return 0;
	    break;
    }
#else	/* BSD42 or SYS5DIR */
    if (rmdir (dir) == NOTOK) {
	admonish (dir, "unable to remove directory");
	return 0;
    }
#endif	/* BSD42 or SYS5DIR */

    return 1;
}