/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1992-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* rmdir
*/
static const char usage[] =
"[-?\n@(#)$Id: rmdir (AT&T Research) 2006-08-24 $\n]"
"[+NAME?rmdir - remove empty directories]"
"[+DESCRIPTION?\brmdir\b deletes each given directory. The directory "
"must be empty; containing no entries other than \b.\b or \b..\b. "
"If a directory and a subdirectory of that directory are specified "
"as operands, the subdirectory must be specified before the parent "
"so that the parent directory will be empty when \brmdir\b attempts "
"to remove it.]"
"[e:ignore-fail-on-non-empty?Ignore each non-empty directory failure.]"
"[p:parents?Remove each explicit \adirectory\a argument directory that "
"becomes empty after its child directories are removed.]"
"[s:suppress?Suppress the message printed on the standard error when "
"\b-p\b is in effect.]"
"\n"
"\ndirectory ...\n"
"\n"
"[+EXIT STATUS?]{"
"[+0?All directories deleted successfully.]"
"[+>0?One or more directories could not be deleted.]"
"}"
"[+SEE ALSO?\bmkdir\b(1), \brm\b(1), \brmdir\b(2), \bunlink\b(2)]"
;
#include <cmd.h>
int
{
register char* dir;
register char* end;
register int n;
int eflag = 0;
int pflag = 0;
int sflag = 0;
for (;;)
{
{
case 'e':
eflag = 1;
continue;
case 'p':
pflag = 1;
continue;
case 's':
sflag = 1;
continue;
case ':':
break;
case '?':
break;
}
break;
}
if (!pflag)
sflag = 0;
{
n = 0;
for (;;)
{
{
#ifdef ENOTEMPTY
#endif
)
{
if (sflag)
error_info.errors++;
else
}
break;
}
if (n) *end = '/';
else n = 1;
*end = 0;
}
next: ;
}
return(error_info.errors != 0);
}