k9core

Coreutils for *nix operating systems [fork]
git clone git://bvnf.space/k9core.git
Log | Files | Refs | LICENSE

rm.c (326B)


      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
#include <errno.h>
#include <stdio.h>
#include <string.h>
int
main(int argc, char *argv[])
{
	if(argc == 1) {
		printf("Specify files to remove.\n");
		return 1;
	}

	for(int i = 1; i < argc; i++) {
		int fd = remove(argv[i]);
		if(fd == -1) {
			fprintf(stderr, "rm: %s: %s\n", argv[i], strerror(errno));
		}
	}
	return 0;
}