/* unlink utility for GNU.                                                      This is the unlink utility
   Copyright (C) 2001-2018 Free Software Foundation, Inc.                       
                                                                                
   This program is free software: you can redistribute it and/or modify         
   it under the terms of the GNU General Public License as published by         
   the Free Software Foundation, either version 3 of the License, or            
   (at your option) any later version.                                          
                                                                                
   This program is distributed in the hope that it will be useful,              
   but WITHOUT ANY WARRANTY; without even the implied warranty of               
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                
   GNU General Public License for more details.                                 
                                                                                
   You should have received a copy of the GNU General Public License            
   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */   The GNUv3 license
                                                                                
/* Written by Michael Stone */                                                  
                                                                                
/* Implementation overview:                                                     
                                                                                
   Simply call the system 'unlink' function */                                  
                                                                                
#include <config.h>                                                             Provides system specific information
#include <stdio.h>                                                              Provides standard I/O capability
#include <getopt.h>                                                             ...!includes auto-comment...
#include <sys/types.h>                                                          Provides system data types
                                                                                
#include "system.h"                                                             ...!includes auto-comment...
#include "die.h"                                                                ...!includes auto-comment...
#include "error.h"                                                              ...!includes auto-comment...
#include "long-options.h"                                                       ...!includes auto-comment...
#include "quote.h"                                                              ...!includes auto-comment...
                                                                                
/* The official name of this program (e.g., no 'g' prefix).  */                 
#define PROGRAM_NAME "unlink"                                                   Line 35
                                                                                
#define AUTHORS proper_name ("Michael Stone")                                   Line 37
                                                                                
static struct option const long_options[] =                                     Line 39
{                                                                               
  {NULL, 0, NULL, 0}                                                            Line 41
};                                                                              Block 1
                                                                                
void                                                                            Line 44
usage (int status)                                                              Line 45
{                                                                               
  if (status != EXIT_SUCCESS)                                                   Line 47
    emit_try_help ();                                                           ...!common auto-comment...
  else                                                                          Line 49
    {                                                                           
      printf (_("\                                                              Line 51
Usage: %s FILE\n\                                                               Line 52
  or:  %s OPTION\n"), program_name, program_name);                              Line 53
      fputs (_("Call the unlink function to remove the specified FILE.\n\n"),   Line 54
             stdout);                                                           Line 55
      fputs (HELP_OPTION_DESCRIPTION, stdout);                                  Line 56
      fputs (VERSION_OPTION_DESCRIPTION, stdout);                               Line 57
      emit_ancillary_info (PROGRAM_NAME);                                       Line 58
    }                                                                           
  exit (status);                                                                Line 60
}                                                                               Block 2
                                                                                
int                                                                             
main (int argc, char **argv)                                                    Line 64
{                                                                               
  initialize_main (&argc, &argv);                                               VMS-specific entry point handling wildcard expansion
  set_program_name (argv[0]);                                                   Retains program name and discards path
  setlocale (LC_ALL, "");                                                       Sets up internationalization (i18n)
  bindtextdomain (PACKAGE, LOCALEDIR);                                          Assigns i18n directorySets text domain for _() [gettext()] function
  textdomain (PACKAGE);                                                         Sets text domain for _() [gettext()] function
                                                                                
  atexit (close_stdout);                                                        Close stdout on exit (see gnulib)
                                                                                
  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,          ...!common auto-comment...
                      usage, AUTHORS, (char const *) NULL);                     Line 75
  if (getopt_long (argc, argv, "", long_options, NULL) != -1)                   Line 76
    usage (EXIT_FAILURE);                                                       Line 77
                                                                                
  if (argc < optind + 1)                                                        Line 79
    {                                                                           
      error (0, 0, _("missing operand"));                                       Line 81
      usage (EXIT_FAILURE);                                                     Line 82
    }                                                                           
                                                                                
  if (optind + 1 < argc)                                                        Line 85
    {                                                                           
      error (0, 0, _("extra operand %s"), quote (argv[optind + 1]));            Line 87
      usage (EXIT_FAILURE);                                                     Line 88
    }                                                                           
                                                                                
  if (unlink (argv[optind]) != 0)                                               Line 91...!syscalls auto-comment......!syscalls auto-comment...
    die (EXIT_FAILURE, errno, _("cannot unlink %s"), quoteaf (argv[optind]));   Line 92
                                                                                
  return EXIT_SUCCESS;                                                          Line 94
}