This is hello.info, produced by makeinfo version 4.8 from hello.texi.
- This manual is for GNU Hello (version 2.9.90, 19 September 2005),
-which prints a friendly greeting (and serves as an example GNU package).
+ This manual is for GNU Hello (version 2.9.90, 3 May 2006), which
+prints a friendly greeting (and serves as an example GNU package).
- Copyright (C) 1992, 1993, 1996, 2002, 2005 Free Software Foundation,
-Inc.
+ Copyright (C) 1992, 1993, 1996, 2002, 2005, 2006 Free Software
+Foundation, Inc.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
END-INFO-DIR-ENTRY
-File: hello.info, Node: Top, Next: Instructions, Up: (dir)
+File: hello.info, Node: Top, Next: Overview, Up: (dir)
GNU Hello
*********
-This manual is for GNU Hello (version 2.9.90, 19 September 2005).
+This manual is for GNU Hello (version 2.9.90, 3 May 2006).
* Menu:
-* Instructions:: How to read this manual.
-* Overview:: Preliminary information.
+* Overview:: General purpose and information.
* Sample:: Sample output from `hello'.
* Invoking hello:: How to run `hello'.
* Problems:: Reporting bugs.
* Concept Index:: Index of concepts.
-File: hello.info, Node: Instructions, Next: Overview, Prev: Top, Up: Top
+File: hello.info, Node: Overview, Next: Sample, Prev: Top, Up: Top
-1 How to Read This Manual
-*************************
-
-To read this manual, begin at the beginning, reading from left to right
-and top to bottom, until you get to the end. Then stop. You may pause
-anywhere in the middle as well, if you wish.
-
-
-File: hello.info, Node: Overview, Next: Sample, Prev: Instructions, Up: Top
-
-2 Overview
+1 Overview
**********
The GNU `hello' program produces a familiar, friendly greeting. It
allows nonprogrammers to use a classic computer science tool which
would otherwise be unavailable to them. Because it is protected by the
-GNU General Public License, users are free to share and change it.
+GNU General Public License, users are free (in perpetuity) to share and
+change it.
+
+ Not to spoil the joke, but of course the practical purpose of GNU
+Hello is to serve as a minimal example of a GNU package. It follows
+the GNU coding standards (*note Preface: (standards)Top.) and GNU
+maintainance standards (*note Preface: (maintain)Top.). So although
+most manuals don't need to discuss the implementation, that is part of
+the goal here.
+
+ The Hello package also follows additional recommended development
+practices not embodied in the standards. It uses Automake (*note
+Introduction: (Automake)Top.) and hence also Autoconf (*note
+Introduction: (Autoconf)Top.) for configuration, and Gnulib (*note
+Gnulib: (gnulib)Top.) to avoid duplication of common sources.
+
+ Internally, Hello uses the GNU `getopt_long' function to parse
+options, support GNU-style long options such as `--help'. GNU Gettext
+(*note Introduction: (gettext)Top.) is used for internationalization
+support (Hello's greeting has been translated into many languages).
+Man pages are generated with GNU `help2man' (*note Overview:
+(help2man.GNU `help2man')Top.). Finally, Texinfo (*note Introduction:
+(texinfo)Top.) is the documentation format for this manual.
GNU `hello' was written by Mike Haertel, David MacKenzie, Jan
Brittenson, Charles Hannum, Roland McGrath, Noah Friedman, Karl
File: hello.info, Node: Sample, Next: Invoking hello, Prev: Overview, Up: Top
-3 Sample Output
+2 Sample Output
***************
Here are some realistic examples of running GNU `hello'.
-h, --help display this help and exit
-v, --version display version information and exit
-t, --traditional use traditional greeting format
- -m, --mail print your mail
- Report bugs to bug-gnu-hello@gnu.org.
+ Report bugs to bug-hello@gnu.org.
This is the output of the command `hello --traditional':
File: hello.info, Node: Invoking hello, Next: Problems, Prev: Sample, Up: Top
-4 Invoking `hello'
+3 Invoking `hello'
******************
The format for running the `hello' program is:
Use the traditional greeting message `hello, world' rather than
the more modern `Hello, world!'.
-`--mail'
-`-m'
- Print your mail on the standard output.
File: hello.info, Node: Problems, Next: Copying This Manual, Prev: Invoking hello, Up: Top
-5 Reporting Bugs
+4 Reporting Bugs
****************
To report bugs or suggest enhancements for GNU `hello', please send
electronic mail to <bug-hello@gnu.org>.
- Include the version number, which you can find by running
-`hello --version'. Also include in your message the output that the
-program produced and the output you expected.
+ For bug reports, please include enough information for the
+maintainers to reproduce the problem. Generally speaking, that means:
+
+ * the version number of Hello (which you can find by running
+ `hello --version') and any other program(s) or manual(s)
+ involved.
+
+ * hardware and operating system names and versions.
+
+ * the contents of any input files necessary to reproduce the bug.
+
+ * a description of the problem and samples of any erroneous output.
+
+ * any unusual options you gave to `configure'.
+
+ * anything else that you think would be helpful.
+
+ When in doubt whether something is needed or not, include it. It's
+better to include too much than to leave out something important.
+
+ Patches are most welcome; if possible, please make them with
+`diff -c' (*note Overview: (diff)Top.) and include `ChangeLog' entries
+(*note Change Log: (emacs)Change Log.), and follow the existing coding
+style.
File: hello.info, Node: Copying This Manual, Next: Concept Index, Prev: Problems, Up: Top
[index ]
* Menu:
-* bugs: Problems. (line 6)
-* creature, feeping: Invoking hello. (line 29)
-* creeping feature: Invoking hello. (line 29)
+* --help: Invoking hello. (line 14)
+* --traditional: Invoking hello. (line 24)
+* --version: Invoking hello. (line 19)
+* -h: Invoking hello. (line 14)
+* -t: Invoking hello. (line 24)
+* -v: Invoking hello. (line 19)
+* authors: Overview. (line 33)
+* Autoconf: Overview. (line 19)
+* Automake: Overview. (line 19)
+* Brittenson, Jan: Overview. (line 33)
+* bug reporting: Problems. (line 6)
+* checklist for bug reports: Problems. (line 9)
+* Eichwalder, Karl: Overview. (line 33)
+* examples: Sample. (line 6)
* FDL, GNU Free Documentation License: GNU Free Documentation License.
(line 6)
-* feature, creeping: Invoking hello. (line 29)
-* feeping creature: Invoking hello. (line 29)
+* Friedman, Noah: Overview. (line 33)
+* getopt_long: Overview. (line 25)
* getting help: Invoking hello. (line 6)
+* GNU coding standards: Overview. (line 12)
+* GNU maintenance standards: Overview. (line 12)
+* Gnulib: Overview. (line 19)
* greetings: Overview. (line 6)
+* Haertel, Mike: Overview. (line 33)
+* Hannum, Charles: Overview. (line 33)
* help: Invoking hello. (line 6)
-* how to read: Instructions. (line 6)
* invoking: Invoking hello. (line 6)
-* mail: Invoking hello. (line 29)
-* manual, how to read: Instructions. (line 6)
+* joke, not: Overview. (line 12)
+* King, The: Overview. (line 33)
+* MacKenzie, David: Overview. (line 33)
+* McGrath, Roland: Overview. (line 33)
* modern: Invoking hello. (line 24)
* options: Invoking hello. (line 6)
* overview: Overview. (line 6)
+* patches, contributing: Problems. (line 29)
* problems: Problems. (line 6)
-* reading: Instructions. (line 6)
+* reporting bugs: Problems. (line 6)
* sample: Sample. (line 6)
+* standards, GNU coding: Overview. (line 12)
+* standards, GNU maintenance: Overview. (line 12)
* tail recursion: Concept Index. (line 6)
* traditional: Invoking hello. (line 24)
* usage: Invoking hello. (line 6)
Tag Table:
-Node: Top1068
-Node: Instructions1522
-Node: Overview1845
-Node: Sample2382
-Node: Invoking hello3106
-Node: Problems3739
-Node: Copying This Manual4158
-Node: GNU Free Documentation License4397
-Node: Concept Index26806
+Node: Top1067
+Node: Overview1476
+Node: Sample3173
+Node: Invoking hello3850
+Node: Problems4424
+Node: Copying This Manual5602
+Node: GNU Free Documentation License5841
+Node: Concept Index28250
End Tag Table
This manual is for GNU Hello (version @value{VERSION}, @value{UPDATED}),
which prints a friendly greeting (and serves as an example GNU package).
-Copyright (C) 1992, 1993, 1996, 2002, 2005 Free Software Foundation,
+Copyright (C) 1992, 1993, 1996, 2002, 2005, 2006 Free Software Foundation,
Inc.
@quotation
@end quotation
@end copying
+@c Define a new index for options.
+@defcodeindex op
+@c Combine everything into one index (arbitrarily chosen to be the
+@c concept index).
+@syncodeindex op cp
+@syncodeindex fn cp
+
@dircategory Basics
@direntry
* Hello: (hello). Hello, GNU world.
@titlepage
@title GNU Hello
@subtitle for version @value{VERSION}, @value{UPDATED}
-@author GNU Hello Development Team (@email{bug-texinfo@@gnu.org})
+@author GNU Hello Developers (@email{bug-hello@@gnu.org})
@page
@vskip 0pt plus 1filll
@insertcopying
@contents
+
@ifnottex
@node Top
@top GNU Hello
@end ifnottex
@menu
-* Instructions:: How to read this manual.
-* Overview:: Preliminary information.
+* Overview:: General purpose and information.
* Sample:: Sample output from @code{hello}.
* Invoking hello:: How to run @code{hello}.
* Problems:: Reporting bugs.
* Concept Index:: Index of concepts.
@end menu
-@node Instructions
-@chapter How to Read This Manual
-
-@cindex reading
-@cindex manual, how to read
-@cindex how to read
-To read this manual, begin at the beginning, reading from left to right
-and top to bottom, until you get to the end. Then stop. You may pause
-anywhere in the middle as well, if you wish.
@node Overview
@chapter Overview
+
@cindex greetings
@cindex overview
The GNU @code{hello} program produces a familiar, friendly greeting.
It allows nonprogrammers to use a classic computer science tool which
-would otherwise be unavailable to them. Because it is protected by the
-GNU General Public License, users are free to share and change it.
-
+would otherwise be unavailable to them. Because it is protected by
+the GNU General Public License, users are free (in perpetuity) to
+share and change it.
+
+@cindex GNU coding standards
+@cindex GNU maintenance standards
+@cindex standards, GNU coding
+@cindex standards, GNU maintenance
+@cindex joke, not
+Not to spoil the joke, but of course the practical purpose of GNU
+Hello is to serve as a minimal example of a GNU package. It follows
+the GNU coding standards (@pxref{Top,,Preface,standards, GNU Coding
+Standards}) and GNU maintainance standards
+(@pxref{Top,,Preface,maintain, Information for GNU Maintainers}). So
+although most manuals don't need to discuss the implementation, that
+is part of the goal here.
+
+@cindex Automake
+@cindex Autoconf
+@cindex Gnulib
+The Hello package also follows additional recommended development
+practices not embodied in the standards. It uses Automake
+(@pxref{Top,,Introduction,Automake,GNU Automake}) and hence also
+Autoconf (@pxref{Top,,Introduction,Autoconf,GNU Autoconf}) for
+configuration, and Gnulib (@pxref{Top,,Gnulib,gnulib,GNU gnulib}) to
+avoid duplication of common sources.
+
+@findex getopt_long
+Internally, Hello uses the GNU @code{getopt_long} function to parse
+options, support GNU-style long options such as @samp{--help}. GNU
+Gettext (@pxref{Top,,Introduction,gettext,GNU Gettext}) is used for
+internationalization support (Hello's greeting has been translated
+into many languages). Man pages are generated with GNU
+@code{help2man} (@pxref{Top,,Overview,help2man.GNU @code{help2man}}).
+Finally, Texinfo (@pxref{Top,,Introduction,texinfo,Texinfo}) is the
+documentation format for this manual.
+
+@cindex authors
+@cindex Haertel, Mike
+@cindex MacKenzie, David
+@cindex Brittenson, Jan
+@cindex Hannum, Charles
+@cindex McGrath, Roland
+@cindex Friedman, Noah
+@cindex Eichwalder, Karl
+@cindex King, The
GNU @code{hello} was written by Mike Haertel, David MacKenzie, Jan
Brittenson, Charles Hannum, Roland McGrath, Noah Friedman, Karl
Eichwalder, and @w{The King}.
+
@node Sample
@chapter Sample Output
+
@cindex sample
+@cindex examples
Here are some realistic examples of running GNU @code{hello}.
-h, --help display this help and exit
-v, --version display version information and exit
-t, --traditional use traditional greeting format
- -m, --mail print your mail
-Report bugs to bug-gnu-hello@@gnu.org.
+Report bugs to bug-hello@@gnu.org.
@end example
This is the output of the command @samp{hello --traditional}:
hello, world
@end example
-@node Invoking hello, Problems, Sample, Top
+
+@node Invoking hello
@chapter Invoking @code{hello}
+
@cindex invoking
@cindex version
@cindex options
@table @samp
@item --help
@itemx -h
+@opindex --help
+@opindex -h
Print an informative help message describing the options and then exit.
@item --version
@itemx -v
+@opindex --version
+@opindex -v
Print the version number of @code{hello} on the standard error output
and then exit.
@item --traditional
@itemx -t
+@opindex --traditional
+@opindex -t
@cindex traditional
@cindex modern
Use the traditional greeting message @samp{hello, world} rather
than the more modern @samp{Hello, world!}.
-@item --mail
-@itemx -m
-@cindex mail
-@cindex creeping feature
-@cindex feature, creeping
-@cindex feeping creature
-@cindex creature, feeping
-Print your mail on the standard output.
@end table
+
@node Problems
@chapter Reporting Bugs
-@cindex bugs
+
+@cindex bug reporting
@cindex problems
+@cindex reporting bugs
To report bugs or suggest enhancements for GNU @code{hello}, please
send electronic mail to @email{bug-hello@@gnu.org}.
-Include the version number, which you can find by running
-@w{@samp{hello --version}}. Also include in your message the output
-that the program produced and the output you expected.
+@cindex checklist for bug reports
+For bug reports, please include enough information for the maintainers
+to reproduce the problem. Generally speaking, that means:
+
+@itemize @bullet
+@item the version number of Hello (which you can find by running
+ @w{@samp{hello --version}}) and any other program(s) or
+ manual(s) involved.
+@item hardware and operating system names and versions.
+@item the contents of any input files necessary to reproduce the bug.
+@item a description of the problem and samples of any erroneous output.
+@item any unusual options you gave to @command{configure}.
+@item anything else that you think would be helpful.
+@end itemize
+
+When in doubt whether something is needed or not, include it. It's
+better to include too much than to leave out something important.
+
+@cindex patches, contributing
+Patches are most welcome; if possible, please make them with
+@samp{@w{diff -c}} (@pxref{Top,, Overview, diff, Comparing and Merging
+Files}) and include @file{ChangeLog} entries (@pxref{Change Log,,,
+emacs, The GNU Emacs Manual}), and follow the existing coding style.
@node Copying This Manual
-@set UPDATED 19 September 2005
-@set UPDATED-MONTH September 2005
+@set UPDATED 3 May 2006
+@set UPDATED-MONTH May 2006
@set EDITION 2.9.90
@set VERSION 2.9.90
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = ${SHELL} /u/karl/gnu/src/hello/build-aux/missing --run aclocal-1.9
-ALLOCA =
AMDEP_FALSE = #
AMDEP_TRUE =
AMTAR = ${SHELL} /u/karl/gnu/src/hello/build-aux/missing --run tar
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
+2006-05-03 Karl Berry <karl@gnu.org>
+
+ * Makefile.am (hello.1): no, can't use $(srcdir)/help2man, because
+ it ends up being "./bin/sh help2man".
+
+2006-04-22 Karl Berry <karl@gnu.org>
+
+ * Makefile.am (hello.1): find help2man in $(srcdir), for when
+ srcdir!=builddir.
+
2004-05-14 Karl Eichwalder <ke@gnu.franken.de>
* Makefile.am (hello.1): Missing Perl at installation time is not
# Depend on the source, not the binary; we don't need to regenerate the
# binary when any source file changes, only the main one.
hello.1: $(top_srcdir)/src/hello.c $(common_mandeps)
- $(PERL) $(srcdir)/$(HELP2MAN) --name="Friendly Greeting Program" ../src/hello >$@
+ $(HELP2MAN) --name="Friendly Greeting Program" ../src/hello >$@
+2006-05-03 Karl Berry <karl@gnu.org>
+
+ * Makefile.am (noinst_HEADERS): remove, gettext.h comes from gnulib.
+ (hello_LDADD): remove @ALLOCA@.
+ * hello.c: remove mail reading stuff, and hence alloca stuff.
+
+ * getopt*.c, gettext.h: remove these files, they come from gnulib.
+
+2005-08-19 Karl Berry <karl@gnu.org>
+
+ * src/hello.c (main): version message formatting.
+
2002-07-20 Karl Eichwalder <ke@gnu.franken.de>
* Makefile.am (noinst_HEADERS): New variable. add gettext.h
## Process this file with automake to produce Makefile.in.
## Makefile.am for hello/src.
##
-## Copyright (C) 1996, 1997, 2001, 2005 Free Software Foundation, Inc.
+## Copyright (C) 1996, 1997, 2001, 2005, 2006 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
bin_PROGRAMS = hello
hello_SOURCES = hello.c version.c system.h
-noinst_HEADERS = gettext.h
-hello_LDADD = @LIBINTL@ @ALLOCA@ ../gnulib/lib/libgnulib.a
+hello_LDADD = @LIBINTL@ ../gnulib/lib/libgnulib.a
localedir = $(datadir)/locale
-/* alloca.c -- allocate automatically reclaimed memory
- (Mostly) portable public-domain implementation -- D A Gwyn
-
- This implementation of the PWB library alloca function,
- which is used to allocate space off the run-time stack so
- that it is automatically reclaimed upon procedure exit,
- was inspired by discussions with J. Q. Johnson of Cornell.
- J.Otto Tennant <jot@cray.com> contributed the Cray support.
-
- There are some preprocessor constants that can
- be defined when compiling for your specific system, for
- improved efficiency; however, the defaults should be okay.
-
- The general concept of this implementation is to keep
- track of all alloca-allocated blocks, and reclaim any
- that are found to be deeper in the stack than the current
- invocation. This heuristic does not reclaim storage as
- soon as it becomes invalid, but it will do so eventually.
-
- As a special case, alloca(0) reclaims storage without
- allocating any. It is a good idea to use alloca(0) in
- your main control loop, etc. to force garbage collection. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#ifdef emacs
-# include "blockinput.h"
-#endif
-
-/* If compiling with GCC 2, this file's not needed. */
-#if !defined (__GNUC__) || __GNUC__ < 2
-
-/* If someone has defined alloca as a macro,
- there must be some other way alloca is supposed to work. */
-# ifndef alloca
-
-# ifdef emacs
-# ifdef static
-/* actually, only want this if static is defined as ""
- -- this is for usg, in which emacs must undefine static
- in order to make unexec workable
- */
-# ifndef STACK_DIRECTION
-you
-lose
--- must know STACK_DIRECTION at compile-time
-# endif /* STACK_DIRECTION undefined */
-# endif /* static */
-# endif /* emacs */
-
-/* If your stack is a linked list of frames, you have to
- provide an "address metric" ADDRESS_FUNCTION macro. */
-
-# if defined (CRAY) && defined (CRAY_STACKSEG_END)
-long i00afunc ();
-# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
-# else
-# define ADDRESS_FUNCTION(arg) &(arg)
-# endif
-
-# if __STDC__
-typedef void *pointer;
-# else
-typedef char *pointer;
-# endif
-
-# ifndef NULL
-# define NULL 0
-# endif
-
-/* Different portions of Emacs need to call different versions of
- malloc. The Emacs executable needs alloca to call xmalloc, because
- ordinary malloc isn't protected from input signals. On the other
- hand, the utilities in lib-src need alloca to call malloc; some of
- them are very simple, and don't have an xmalloc routine.
-
- Non-Emacs programs expect this to call xmalloc.
-
- Callers below should use malloc. */
-
-# ifndef emacs
-# undef malloc
-# define malloc xmalloc
-# endif
-extern pointer malloc ();
-
-/* Define STACK_DIRECTION if you know the direction of stack
- growth for your system; otherwise it will be automatically
- deduced at run-time.
-
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-
-# ifndef STACK_DIRECTION
-# define STACK_DIRECTION 0 /* Direction unknown. */
-# endif
-
-# if STACK_DIRECTION != 0
-
-# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
-
-# else /* STACK_DIRECTION == 0; need run-time code. */
-
-static int stack_dir; /* 1 or -1 once known. */
-# define STACK_DIR stack_dir
-
-static void
-find_stack_direction ()
-{
- static char *addr = NULL; /* Address of first `dummy', once known. */
- auto char dummy; /* To get stack address. */
-
- if (addr == NULL)
- { /* Initial entry. */
- addr = ADDRESS_FUNCTION (dummy);
-
- find_stack_direction (); /* Recurse once. */
- }
- else
- {
- /* Second entry. */
- if (ADDRESS_FUNCTION (dummy) > addr)
- stack_dir = 1; /* Stack grew upward. */
- else
- stack_dir = -1; /* Stack grew downward. */
- }
-}
-
-# endif /* STACK_DIRECTION == 0 */
-
-/* An "alloca header" is used to:
- (a) chain together all alloca'ed blocks;
- (b) keep track of stack depth.
-
- It is very important that sizeof(header) agree with malloc
- alignment chunk size. The following default should work okay. */
-
-# ifndef ALIGN_SIZE
-# define ALIGN_SIZE sizeof(double)
-# endif
-
-typedef union hdr
-{
- char align[ALIGN_SIZE]; /* To force sizeof(header). */
- struct
- {
- union hdr *next; /* For chaining headers. */
- char *deep; /* For stack depth measure. */
- } h;
-} header;
-
-static header *last_alloca_header = NULL; /* -> last alloca header. */
-
-/* Return a pointer to at least SIZE bytes of storage,
- which will be automatically reclaimed upon exit from
- the procedure that called alloca. Originally, this space
- was supposed to be taken from the current stack frame of the
- caller, but that method cannot be made to work for some
- implementations of C, for example under Gould's UTX/32. */
-
-pointer
-alloca (size_t size)
-{
- auto char probe; /* Probes stack depth: */
- register char *depth = ADDRESS_FUNCTION (probe);
-
-# if STACK_DIRECTION == 0
- if (STACK_DIR == 0) /* Unknown growth direction. */
- find_stack_direction ();
-# endif
-
- /* Reclaim garbage, defined as all alloca'd storage that
- was allocated from deeper in the stack than currently. */
-
- {
- register header *hp; /* Traverses linked list. */
-
-# ifdef emacs
- BLOCK_INPUT;
-# endif
-
- for (hp = last_alloca_header; hp != NULL;)
- if ((STACK_DIR > 0 && hp->h.deep > depth)
- || (STACK_DIR < 0 && hp->h.deep < depth))
- {
- register header *np = hp->h.next;
-
- free ((pointer) hp); /* Collect garbage. */
-
- hp = np; /* -> next header. */
- }
- else
- break; /* Rest are not deeper. */
-
- last_alloca_header = hp; /* -> last valid storage. */
-
-# ifdef emacs
- UNBLOCK_INPUT;
-# endif
- }
-
- if (size == 0)
- return NULL; /* No allocation required. */
-
- /* Allocate combined header + user data storage. */
-
- {
- register pointer new = malloc (sizeof (header) + size);
- /* Address of header. */
-
- if (new == 0)
- abort();
-
- ((header *) new)->h.next = last_alloca_header;
- ((header *) new)->h.deep = depth;
-
- last_alloca_header = (header *) new;
-
- /* User storage begins just after header. */
-
- return (pointer) ((char *) new + sizeof (header));
- }
-}
-
-# if defined (CRAY) && defined (CRAY_STACKSEG_END)
-
-# ifdef DEBUG_I00AFUNC
-# include <stdio.h>
-# endif
-
-# ifndef CRAY_STACK
-# define CRAY_STACK
-# ifndef CRAY2
-/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
-struct stack_control_header
- {
- long shgrow:32; /* Number of times stack has grown. */
- long shaseg:32; /* Size of increments to stack. */
- long shhwm:32; /* High water mark of stack. */
- long shsize:32; /* Current size of stack (all segments). */
- };
-
-/* The stack segment linkage control information occurs at
- the high-address end of a stack segment. (The stack
- grows from low addresses to high addresses.) The initial
- part of the stack segment linkage control information is
- 0200 (octal) words. This provides for register storage
- for the routine which overflows the stack. */
-
-struct stack_segment_linkage
- {
- long ss[0200]; /* 0200 overflow words. */
- long sssize:32; /* Number of words in this segment. */
- long ssbase:32; /* Offset to stack base. */
- long:32;
- long sspseg:32; /* Offset to linkage control of previous
- segment of stack. */
- long:32;
- long sstcpt:32; /* Pointer to task common address block. */
- long sscsnm; /* Private control structure number for
- microtasking. */
- long ssusr1; /* Reserved for user. */
- long ssusr2; /* Reserved for user. */
- long sstpid; /* Process ID for pid based multi-tasking. */
- long ssgvup; /* Pointer to multitasking thread giveup. */
- long sscray[7]; /* Reserved for Cray Research. */
- long ssa0;
- long ssa1;
- long ssa2;
- long ssa3;
- long ssa4;
- long ssa5;
- long ssa6;
- long ssa7;
- long sss0;
- long sss1;
- long sss2;
- long sss3;
- long sss4;
- long sss5;
- long sss6;
- long sss7;
- };
-
-# else /* CRAY2 */
-/* The following structure defines the vector of words
- returned by the STKSTAT library routine. */
-struct stk_stat
- {
- long now; /* Current total stack size. */
- long maxc; /* Amount of contiguous space which would
- be required to satisfy the maximum
- stack demand to date. */
- long high_water; /* Stack high-water mark. */
- long overflows; /* Number of stack overflow ($STKOFEN) calls. */
- long hits; /* Number of internal buffer hits. */
- long extends; /* Number of block extensions. */
- long stko_mallocs; /* Block allocations by $STKOFEN. */
- long underflows; /* Number of stack underflow calls ($STKRETN). */
- long stko_free; /* Number of deallocations by $STKRETN. */
- long stkm_free; /* Number of deallocations by $STKMRET. */
- long segments; /* Current number of stack segments. */
- long maxs; /* Maximum number of stack segments so far. */
- long pad_size; /* Stack pad size. */
- long current_address; /* Current stack segment address. */
- long current_size; /* Current stack segment size. This
- number is actually corrupted by STKSTAT to
- include the fifteen word trailer area. */
- long initial_address; /* Address of initial segment. */
- long initial_size; /* Size of initial segment. */
- };
-
-/* The following structure describes the data structure which trails
- any stack segment. I think that the description in 'asdef' is
- out of date. I only describe the parts that I am sure about. */
-
-struct stk_trailer
- {
- long this_address; /* Address of this block. */
- long this_size; /* Size of this block (does not include
- this trailer). */
- long unknown2;
- long unknown3;
- long link; /* Address of trailer block of previous
- segment. */
- long unknown5;
- long unknown6;
- long unknown7;
- long unknown8;
- long unknown9;
- long unknown10;
- long unknown11;
- long unknown12;
- long unknown13;
- long unknown14;
- };
-
-# endif /* CRAY2 */
-# endif /* not CRAY_STACK */
-
-# ifdef CRAY2
-/* Determine a "stack measure" for an arbitrary ADDRESS.
- I doubt that "lint" will like this much. */
-
-static long
-i00afunc (long *address)
-{
- struct stk_stat status;
- struct stk_trailer *trailer;
- long *block, size;
- long result = 0;
-
- /* We want to iterate through all of the segments. The first
- step is to get the stack status structure. We could do this
- more quickly and more directly, perhaps, by referencing the
- $LM00 common block, but I know that this works. */
-
- STKSTAT (&status);
-
- /* Set up the iteration. */
-
- trailer = (struct stk_trailer *) (status.current_address
- + status.current_size
- - 15);
-
- /* There must be at least one stack segment. Therefore it is
- a fatal error if "trailer" is null. */
-
- if (trailer == 0)
- abort ();
-
- /* Discard segments that do not contain our argument address. */
-
- while (trailer != 0)
- {
- block = (long *) trailer->this_address;
- size = trailer->this_size;
- if (block == 0 || size == 0)
- abort ();
- trailer = (struct stk_trailer *) trailer->link;
- if ((block <= address) && (address < (block + size)))
- break;
- }
-
- /* Set the result to the offset in this segment and add the sizes
- of all predecessor segments. */
-
- result = address - block;
-
- if (trailer == 0)
- {
- return result;
- }
-
- do
- {
- if (trailer->this_size <= 0)
- abort ();
- result += trailer->this_size;
- trailer = (struct stk_trailer *) trailer->link;
- }
- while (trailer != 0);
-
- /* We are done. Note that if you present a bogus address (one
- not in any segment), you will get a different number back, formed
- from subtracting the address of the first block. This is probably
- not what you want. */
-
- return (result);
-}
-
-# else /* not CRAY2 */
-/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
- Determine the number of the cell within the stack,
- given the address of the cell. The purpose of this
- routine is to linearize, in some sense, stack addresses
- for alloca. */
-
-static long
-i00afunc (long address)
-{
- long stkl = 0;
-
- long size, pseg, this_segment, stack;
- long result = 0;
-
- struct stack_segment_linkage *ssptr;
-
- /* Register B67 contains the address of the end of the
- current stack segment. If you (as a subprogram) store
- your registers on the stack and find that you are past
- the contents of B67, you have overflowed the segment.
-
- B67 also points to the stack segment linkage control
- area, which is what we are really interested in. */
-
- stkl = CRAY_STACKSEG_END ();
- ssptr = (struct stack_segment_linkage *) stkl;
-
- /* If one subtracts 'size' from the end of the segment,
- one has the address of the first word of the segment.
-
- If this is not the first segment, 'pseg' will be
- nonzero. */
-
- pseg = ssptr->sspseg;
- size = ssptr->sssize;
-
- this_segment = stkl - size;
-
- /* It is possible that calling this routine itself caused
- a stack overflow. Discard stack segments which do not
- contain the target address. */
-
- while (!(this_segment <= address && address <= stkl))
- {
-# ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
-# endif
- if (pseg == 0)
- break;
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- this_segment = stkl - size;
- }
-
- result = address - this_segment;
-
- /* If you subtract pseg from the current end of the stack,
- you get the address of the previous stack segment's end.
- This seems a little convoluted to me, but I'll bet you save
- a cycle somewhere. */
-
- while (pseg != 0)
- {
-# ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o\n", pseg, size);
-# endif
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- result += size;
- }
- return (result);
-}
-
-# endif /* not CRAY2 */
-# endif /* CRAY */
-
-# endif /* no alloca */
-#endif /* not GCC version 2 */
/* hello.c -- print a greeting message and exit.
- Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2005
- Free Software Foundation, Inc.
+ Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2005, 2006 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
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-/* AIX requires this to be the first thing in the file. */
-#if defined (_AIX) && !defined (__GNUC__)
- #pragma alloca
-#endif
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <sys/file.h>
#endif
-#ifdef __GNUC__
-#undef alloca
-#define alloca(n) __builtin_alloca (n)
-#else /* Not GCC. */
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#else /* Not HAVE_ALLOCA_H. */
-#ifndef _AIX
-extern char *alloca ();
-#endif /* Not _AIX. */
-#endif /* HAVE_ALLOCA_H. */
-#endif /* GCC. */
-
#ifdef HAVE_SYS_PARAM_H
/* To possibly get the definition of DEV_BSIZE. */
#include <sys/param.h>
{
{ "greeting", required_argument, NULL, 'g' },
{ "help", no_argument, NULL, 'h' },
- { "mail", no_argument, NULL, 'm' },
{ "next-generation", no_argument, NULL, 'n' },
{ "traditional", no_argument, NULL, 't' },
{ "version", no_argument, NULL, 'v' },
char *argv[];
{
int optc;
- int h = 0, v = 0, t = 0, m = 0, n = 0, lose = 0, z = 0;
+ int h = 0, v = 0, t = 0, n = 0, lose = 0, z = 0;
char *greeting = NULL;
progname = argv[0];
textdomain (PACKAGE);
#endif
- while ((optc = getopt_long (argc, argv, "g:hmntv", longopts, (int *) 0))
+ while ((optc = getopt_long (argc, argv, "g:hntv", longopts, (int *) 0))
!= EOF)
switch (optc)
{
case 'h':
h = 1;
break;
- case 'm':
- m = 1;
- break;
case 'n':
n = 1;
break;
fputs (_("\
-t, --traditional use traditional greeting format\n\
-n, --next-generation use next-generation greeting format\n\
- -g, --greeting=TEXT use TEXT as the greeting message\n\
- -m, --mail print your mail\n"), stdout);
+ -g, --greeting=TEXT use TEXT as the greeting message\n"), stdout);
printf ("\n");
/* TRANSLATORS: --help output 5 (end)
"2005", PACKAGE);
exit (0);
}
- if (m && t)
- {
- fprintf (stderr, _("%s: Incompatible flags: -m and -t\n"), progname);
- exit (1);
- }
-
- if (m)
- {
- /* Try to read mail. */
- char *mailname, *buf, *getenv ();
- int mailfd, cc;
- struct stat st;
-
- mailname = getenv ("MAIL");
- if (!mailname)
- {
- static char *dirs[] =
- {
- "/var/spool/mail",
- "/usr/spool/mail",
- "/var/mail",
- "/usr/mail",
- 0
- };
- char **d;
- unsigned int dirlen, userlen;
-
- char *user = getenv ("USER");
-
- if (! user)
- {
- struct passwd *pwd = getpwuid (getuid ());
- if (! pwd)
- {
- fprintf (stderr, _("%s: Who are you?\n"), progname);
- exit (1);
- }
- user = pwd->pw_name;
- }
-
- dirlen = 0;
- for (d = dirs; *d != 0; ++d)
- {
- unsigned int len = strlen (*d);
- if (len > dirlen)
- dirlen = len;
- }
-
- userlen = strlen (user);
-
- mailname = (char *) alloca (dirlen + 1 + userlen + 1);
-
- d = dirs;
- do
- {
- if (*d == 0) {
- fprintf (stderr, _("%s: Cannot find your mail spool file.\n"),
- progname);
- exit(1);
- }
- sprintf (mailname, "%s/%s", *d, user);
- mailfd = open (mailname, O_RDONLY);
- ++d;
- } while (mailfd == -1 && (errno == ENOENT || errno == ENOTDIR));
- }
- else
- mailfd = open (mailname, O_RDONLY);
-
- if (mailfd == -1)
- {
- perror (mailname);
- exit (1);
- }
- if (fstat (mailfd, &st) == -1)
- {
- perror (mailname);
- exit (1);
- }
- buf = (char *) alloca (ST_BLKSIZE(st));
- for (;;)
- {
- cc = read (mailfd, buf, ST_BLKSIZE(st));
-
- if (cc == -1)
- {
- perror (mailname);
- exit (1);
- }
- if (cc == 0)
- break;
-
- cc = write (1, buf, cc);
- if (cc == -1)
- {
- perror (mailname);
- exit (1);
- }
- }
- }
else if (z)
puts (_("Nothing happens here."));
exit (0);
}
-
-#ifdef C_ALLOCA /* xmalloc() is only used by alloca.c. */
-
-char *
-xmalloc (size)
- unsigned int size;
-{
- char *ptr = malloc (size);
- if (! ptr)
- {
- fprintf (stderr, _("%s: Virtual memory exhausted\n"), progname);
- exit (1);
- }
- return ptr;
-}
-#endif /* C_ALLOCA */
-
-/* hello.c ends here */
This website is licensed under AGPL-3.0. Feel free to copy!