25 lines
410 B
C
25 lines
410 B
C
|
#include <errno.h>
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
int main(int argc, char** argv) {
|
||
|
if (argc < 2) {
|
||
|
fprintf(stderr, "Not enough arguments.");
|
||
|
exit(1);
|
||
|
}
|
||
|
|
||
|
for (int i = 1; i < argc; i++) {
|
||
|
int code = unlink(argv[i]);
|
||
|
if (code == -1) {
|
||
|
perror(argv[0]);
|
||
|
exit(1);
|
||
|
}
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
// Compilation: cc unlink.c -o unlink
|
||
|
// Usage: ./unlink FILES ...
|
||
|
// License: CC-0
|