[wplug] I'm a Linux whimp (need kernel help)
Chester R. Hosey
Chester.Hosey at gianteagle.com
Mon Aug 15 12:08:27 EDT 2005
On Mon, 2005-08-15 at 11:58 -0400, Poyner, Brandon wrote:
> > Even very simple things like /usr/bin/yes
> > have increased nearly 50% since RHEL 8.0. Don't get me started on how
> > little disk space you could install earlier versions on.
> >
> > RH8.0 -rwxr-xr-x 1 root root 10488 Aug 29 2002 /usr/bin/yes
> > RH9 -rwxr-xr-x 1 root root 11100 Oct 29 2003 /usr/bin/yes
> > FC2 -rwxr-xr-x 1 root root 14532 May 4 2004 /usr/bin/yes
> > FC3 -rwxr-xr-x 1 root root 15216 Oct 5 2004 /usr/bin/yes
> > RHEL 4 -rwxr-xr-x 1 root root 15216 Feb 22 11:18 /usr/bin/yes
>
> In case anybody is wondering why I'm picking on /usr/bin/yes, here's the
> (minus useless header info) BSD source code to /usr/bin/yes. I'm not
> sure what the GNU version looks like but I'd be shocked if it was much
> bigger.
>
> #include <stdio.h>
>
> int
> main(argc, argv)
> int argc;
> char **argv;
> {
> if (argc > 1)
> for(;;)
> puts(argv[1]);
> else for (;;)
> puts("y");
> }
>
Just for kicks...
Being GNU it supports --help, behaves pedantically correct if you set
POSIXLY_CORRECT, and supports internationalization. The preprocessed
version looks cleaner, and I'm pretty sure the internationalization part
makes me want to cry a little.
>From pristine coreutils 5.2.1 sources:
/* yes - output a string repeatedly until killed
Copyright (C) 1991-1997, 1999-2004 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 2, 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, write to the Free Software
Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* David MacKenzie <djm at gnu.ai.mit.edu> */
#include <config.h>
#include <stdio.h>
#include <sys/types.h>
#include <getopt.h>
#include "system.h"
#include "error.h"
#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "yes"
#define AUTHORS "David MacKenzie"
/* The name this program was run with. */
char *program_name;
void
usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
else
{
printf (_("\
Usage: %s [STRING]...\n\
or: %s OPTION\n\
"),
program_name, program_name);
fputs (_("\
Repeatedly output a line with all specified STRING(s), or `y'.\n\
\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
}
exit (status);
}
int
main (int argc, char **argv)
{
initialize_main (&argc, &argv);
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
atexit (close_stdout);
/* Don't recognize --help or --version if POSIXLY_CORRECT is set. */
if (getenv ("POSIXLY_CORRECT") == NULL)
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
usage, AUTHORS, (char const *) NULL);
if (argc == 1)
{
argv[1] = "y";
argc = 2;
}
for (;;)
{
int i;
for (i = 1; i < argc; i++)
if (fputs (argv[i], stdout) == EOF
|| putchar (i == argc - 1 ? '\n' : ' ') == EOF)
{
error (0, errno, _("standard output"));
exit (EXIT_FAILURE);
}
}
}
More information about the wplug
mailing list