aruu

[MIRROR] Actual replacement for Busybox | suckless
git clone https://git.daat.foo/aruu.git
Log | Files | Refs | README | LICENSE

unlink.c (476B)


      1 /* see LICENSE file for copyright and license details */
      2 
      3 #include <unistd.h>
      4 
      5 #include "util.h"
      6 
      7 static void
      8 usage(void)
      9 {
     10   eprintf("usage: %s file\n", argv0);
     11 }
     12 
     13 // ?man unlink: remove a file
     14 // ?man arguments: file
     15 // ?man call the unlink system call to remove a file
     16 int
     17 main(int argc, char *argv[])
     18 {
     19   ARGBEGIN
     20   {
     21     default:
     22       usage();
     23   }
     24   ARGEND
     25 
     26   if (argc != 1)
     27     usage();
     28 
     29   if (unlink(argv[0]) < 0)
     30     eprintf("unlink: '%s':", argv[0]);
     31 
     32   return 0;
     33 }