diff options
Diffstat (limited to 'examples/rm.c')
| -rw-r--r-- | examples/rm.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/rm.c b/examples/rm.c new file mode 100644 index 0000000..0db7f7b --- /dev/null +++ b/examples/rm.c | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* rm.c | ||
| 2 | |||
| 3 | Removes files specified on command line. */ | ||
| 4 | |||
| 5 | #include <stdio.h> | ||
| 6 | #include <syscall.h> | ||
| 7 | |||
| 8 | int | ||
| 9 | main (int argc, char *argv[]) | ||
| 10 | { | ||
| 11 | bool success = true; | ||
| 12 | int i; | ||
| 13 | |||
| 14 | for (i = 1; i < argc; i++) | ||
| 15 | if (!remove (argv[i])) | ||
| 16 | { | ||
| 17 | printf ("%s: remove failed\n", argv[i]); | ||
| 18 | success = false; | ||
| 19 | } | ||
| 20 | return success ? EXIT_SUCCESS : EXIT_FAILURE; | ||
| 21 | } | ||
