1 /* `unlink` utility for GNU.
2 Copyright (C) 2001, 2002 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /* Written by Michael Stone */
20 /* Implementation overview:
22 Simply calls the system 'unlink' function */
27 #include <sys/types.h>
34 /* The official name of this program (e.g., no `g' prefix). */
35 #define PROGRAM_NAME "unlink"
37 #define AUTHORS "Michael Stone"
39 /* Name this program was run with. */
42 static struct option const long_opts[] =
44 {GETOPT_HELP_OPTION_DECL},
45 {GETOPT_VERSION_OPTION_DECL},
53 fprintf (stderr, _("Try `%s --help' for more information.\n"),
57 printf (_("Usage: %s [OPTION]... FILE\n"), program_name);
61 --help display this help and exit\n\
62 --version output version information and exit\n\
65 program_name, program_name);
66 puts (_("\nReport bugs to <bug-fileutils@gnu.org>."));
72 main (int argc, char **argv)
77 program_name = argv[0];
78 setlocale (LC_ALL, "");
79 bindtextdomain (PACKAGE, LOCALEDIR);
82 atexit (close_stdout);
84 while ((c = getopt_long (argc, argv, "", long_opts, NULL)) != -1)
88 case 0: /* Long option. */
90 case_GETOPT_HELP_CHAR;
91 case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
99 error (0, 0, _("too few arguments"));
105 error (0, 0, _("too many arguments"));
109 if (unlink(argv[optind]) != 0)
112 error (0, errno, _("unlinking %s"), quote(argv[optind]));