master xplshn/aruu / cmd / posix / unlink.c
 1/* See LICENSE file for copyright and license details. */
 2
 3#include <unistd.h>
 4
 5#include "util.h"
 6
 7static void
 8usage(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
16int
17main(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}