You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
329 B
19 lines
329 B
#include <litc.h>
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
if (argc != 2)
|
|
errx(-1, "usage: %s <file>\n", argv[0]);
|
|
|
|
char *p = argv[1];
|
|
struct stat st;
|
|
if (stat(p, &st) == -1)
|
|
err(-1, "stat");
|
|
if (S_ISDIR(st.st_mode)) {
|
|
if (rmdir(p) == -1)
|
|
err(-1, "rmdir");
|
|
} else if (unlink(p) == -1)
|
|
err(-1, "unlink");
|
|
return 0;
|
|
}
|