/* logname -- print user's login name                                           This is the logname utility
   Copyright (C) 1990-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
                                                                                
#include <config.h>                                                             Provides system specific information
#include <stdio.h>                                                              Provides standard I/O capability
#include <sys/types.h>                                                          Provides system data types
#include <getopt.h>                                                             ...!includes auto-comment...
                                                                                
#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 "logname"                                                  Line 29
                                                                                
#define AUTHORS proper_name ("FIXME: unknown")                                  Line 31
                                                                                
static struct option const long_options[] =                                     Line 33
{                                                                               
  {NULL, 0, NULL, 0}                                                            Line 35
};                                                                              Block 1
                                                                                
void                                                                            Line 38
usage (int status)                                                              Line 39
{                                                                               
  if (status != EXIT_SUCCESS)                                                   Line 41
    emit_try_help ();                                                           ...!common auto-comment...
  else                                                                          Line 43
    {                                                                           
      printf (_("Usage: %s [OPTION]\n"), program_name);                         Line 45
      fputs (_("\                                                               Line 46
Print the name of the current user.\n\                                          Line 47
\n\                                                                             
"), stdout);                                                                    Line 49
      fputs (HELP_OPTION_DESCRIPTION, stdout);                                  Line 50
      fputs (VERSION_OPTION_DESCRIPTION, stdout);                               Line 51
      emit_ancillary_info (PROGRAM_NAME);                                       Line 52
    }                                                                           
  exit (status);                                                                Line 54
}                                                                               Block 2
                                                                                
int                                                                             
main (int argc, char **argv)                                                    Line 58
{                                                                               
  char *cp;                                                                     Line 60
                                                                                
  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 71
  if (getopt_long (argc, argv, "", long_options, NULL) != -1)                   Line 72
    usage (EXIT_FAILURE);                                                       Line 73
                                                                                
  if (optind < argc)                                                            Line 75
    {                                                                           
      error (0, 0, _("extra operand %s"), quote (argv[optind]));                Line 77
      usage (EXIT_FAILURE);                                                     Line 78
    }                                                                           
                                                                                
  /* POSIX requires using getlogin (or equivalent code) and prohibits           
     using a fallback technique.  */                                            
  cp = getlogin ();                                                             Line 83
  if (! cp)                                                                     Line 84
    die (EXIT_FAILURE, 0, _("no login name"));                                  Line 85
                                                                                
  puts (cp);                                                                    Line 87
  return EXIT_SUCCESS;                                                          Line 88
}                                                                               Block 3