sortix-mirror/utils/rm.cpp

24 lines
382 B
C++
Raw Normal View History

2011-11-21 17:49:55 +00:00
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <error.h>
2011-11-21 17:49:55 +00:00
int main(int argc, char* argv[])
{
if ( argc < 2 ) { printf("usage: %s <file> ...\n", argv[0]); return 0; }
2011-11-21 17:49:55 +00:00
int result = 0;
for ( int i = 1; i < argc; i++ )
{
if ( unlink(argv[i]) )
{
error(0, errno, "cannot remove %s", argv[i]);
2011-11-21 17:49:55 +00:00
result = 1;
}
}
return result;
}