Newsgroups: comp.sources.misc From: heitkoet@gorbi.informatik.uni-dortmund.de (Joerg Heitkoetter) Subject: v26i115: c++2latex - a C++ to LaTeX converter, Part03/03 Message-ID: <1991Dec15.033520.23840@sparky.imd.sterling.com> X-Md4-Signature: 6e412fa8ce4800b1da4909a72b7e89f6 Date: Sun, 15 Dec 1991 03:35:20 GMT Approved: kent@sparky.imd.sterling.com Submitted-by: heitkoet@gorbi.informatik.uni-dortmund.de (Joerg Heitkoetter) Posting-number: Volume 26, Issue 115 Archive-name: c++2latex/part03 Environment: C++, LaTeX #!/bin/sh # do not concatenate these parts, unpack them in order with /bin/sh # file demo.c continued # if test ! -r _shar_seq_.tmp; then echo 'Please unpack part 1 first!' exit 1 fi (read Scheck if test "$Scheck" != 3; then echo Please unpack part "$Scheck" next! exit 1 else exit 0 fi ) < _shar_seq_.tmp || exit 1 if test ! -f _shar_wnt_.tmp; then echo 'x - still skipping demo.c' else echo 'x - continuing file demo.c' sed 's/^X//' << 'SHAR_EOF' >> 'demo.c' && // the suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. // // UNIDO DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. // IN NO EVENT SHALL UNIDO BE LIABLE FOR ANY SPECIAL, INDIRECT OR // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING // FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF // CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // X /* X * this is a comment X */ X /* NOARGS */ main (argc, argv) int argc; char **argv; { X int a; // this is a variable X int b; /* another variable */ X X // busy doing nothing... X int c; X X /* no more */ X int d; X X switch (something) { X case THISCASE: X something = 99; // who knows why? X break; X case default: X somethingelse = 100; // completetly arbitrary X break; X } // end of switch X X for (i=0; i _shar_wnt_.tmp echo 'x - extracting fancyheadings.doc (Text)' sed 's/^X//' << 'SHAR_EOF' > 'fancyheadings.doc' && Return-Path: piet@cs.ruu.nl Received: from unido.informatik.uni-dortmund.de X by gorbi.informatik.uni-dortmund.de id AA04891; Mon, 7 Oct 91 11:35:20 +0100 Received: from ruuinf.cs.ruu.nl X by unido.informatik.uni-dortmund.de with SMTP (5.65+/UNIDO-2.0.4.d) X via EUnet for gorbi.informatik.uni-dortmund.de X id AA12353; Mon, 7 Oct 91 11:31:05 +0100 Received: from gnu.cs.ruu.nl by ruuinf.cs.ruu.nl with SMTP X (5.61+/IDA-1.2.8) id AA25657; Mon, 7 Oct 91 12:15:53 +0100 Received: by alchemy.cs.ruu.nl X (15.11/15.6) id AA20318; Mon, 7 Oct 91 11:34:15 -0100 Date: Mon, 7 Oct 91 11:34:15 -0100 XFrom: Piet van Oostrum Message-Id: <9110071034.AA20318@alchemy.cs.ruu.nl> To: heitkoet (Joerg Heitkoetter) Subject: Re: Fancy Latex Headers - Please Help Newsgroups: comp.text.tex In-Reply-To: <3853@laura.UUCP> Organization: Dept of Computer Science, Utrecht University, The Netherlands Cc: X Here is the (new) doc file for fancyheadings.sty: X Here is a documentstylestyle option that allows you to customize your page headers and footers in an easy way. It combines features that were separately available in other pagestyles, without introducing much complexity. You can define: X - three-part headers and footers X - rules in header and footer X - headers and footers wider than \textwidth X - multiline headers and footers X - separate headers and footers for even and odd pages X - separate headers and footers for chapter pages X To use this pagestyle, you must include the ``fancyheadings'' style option in your \documentstyle, and issue the \pagestyle{fancy} command. The \pagestyle{fancy} command should be issued after any changes made to \textwidth. X The page layout will be as follows: X X LHEAD CHEAD RHEAD X ----------------------------------- (rule) X X page body X X X ----------------------------------- (rule) X LFOOT CFOOT RFOOT X The L-fields will be leftadjusted, the C-fields centered and the R-fields rightadjusted. Each of the six fields and the two rules can be defined separately. X Simple use: X The header and footer fields can be defined by commands \lhead{LHEAD} and so on for the other fields. If the field depends on something in the document (e.g. section titles) you must in general use the \markboth and \markright commands, otherwise a title may end on the wrong page. You can do this e.g. by redefining the commands \chaptermark, \sectionmark and so on (see example below). The defaults for these marks are as in the standard pagestyles. The marks can be put into a header or footer field by referencing \leftmark and \rightmark. X Rules in header and footer X The thickness of the rules below the header and above the footer can be changed by redefining the length parameters \headrulewidth (default 0.4pt) and \footrulewidth (default 0). These may be redefined by the \setlength command. A thickness of 0pt makes the rule invisible. If you want to make more complicated changes, you have to redefine the commands \headrule and/or \footrule. X Headers and footers wider than \textwidth X The headers and footers are set in a box of width \headwidth. The default for this is the value of \textwidth. You can make it wider (or smaller) by redefining \headwidth with the \setlength or \addtolength command. The headers and footers will stick out the page on the same side as the marginal notes. For example to include the marginal notes, add both \marginparsep and \marginparwidth to \headwidth (see also the example below). X Multiline headers and footers X Each of the six fields is set in an appropriate parbox, so you can put a multiline part in it with the \\ command. It is also possible to put extra space in it with the \vspace command. Note that if you do this you will probably have to increase the \headheight or \footskip lengths. X Separate headers and footers for even and odd pages X If you want the headers and footers to be different on even- and odd-numbered pages in the ``twoside'' style, the field-defining macros can be given an optional argument, to be used on the even-numbered pages, like \lhead[EVEN-LHEAD]{ODD-LHEAD}. X Separate headers and footers for chapter pages X LaTeX gives a \thispagestyle{plain} command for the first page of the document, the first page of each chapter and a couple of other pages. It might be incompatible with your pagestyle. In this case you can use a slightly different version of the pagestyle, called \pagestyle{fancyplain}. This pagestyle redefines the pagestyle ``plain'' to also use pagestyle ``fancy'' with the following modifications: X - the thicknesses of the rules is defined by \plainheadrulewidth and X \plainfootrulewidth (both default 0). X - the 6 fields may be defined separately for the plain pages by X giving them the value \fancyplain{PLAIN-VALUE}{NORMAL-VALUE}. This X construct may be used in both the optional argument and the normal X argument. Thus \lhead[\fancyplain{F1}{F2}]{\fancyplain{F3}{F4}} X specifies the LHEAD value in a two-sided document: X F1 on an even-numbered ``plain'' page X F2 on an even-numbered normal page X F3 on an odd-numbered ``plain'' page X F4 on an odd-numbered normal page. X Defaults: X \headrulewidth 0.4pt \footrulewidth 0pt \plainheadrulewidth 0pt \plainfootrulewidth 0pt X \lhead[\fancyplain{}{\sl\rightmark}]{\fancyplain{}{\sl\leftmark}} % i.e. empty on ``plain'' pages \rightmark on even, \leftmark on odd pages \chead{} \rhead[\fancyplain{}{\sl\leftmark}]{\fancyplain{}{\sl\rightmark}} % i.e. empty on ``plain'' pages \leftmark on even, \rightmark on odd pages \lfoot{} \cfoot{\rm\thepage} % page number \rfoot{} X Examples: X To put two lines containing the section title and the subsection title in the righthandside corner, use: X \documentstyle[fancyheadings]{article} \pagestyle{fancy} \renewcommand{\sectionmark}[1]{\markboth{#1}{}} \renewcommand{\subsectionmark}[1]{\markright{#1}} \rfoot{\leftmark\\\rightmark} X The following definitions give an approximation of the style used in the LaTeX book: X \documentstyle[fancyheadings]{book} \pagestyle{fancyplain} \addtolength{\headwidth}{\marginparsep} \addtolength{\headwidth}{\marginparwidth} \renewcommand{\chaptermark}[1]{\markboth{#1}{#1}} % remember chapter title \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} X % section number and title \lhead[\fancyplain{}{\bf\thepage}]{\fancyplain{}{\bf\rightmark}} \rhead[\fancyplain{}{\bf\leftmark}]{\fancyplain{}{\bf\thepage}} \cfoot{} X Using section titles etc. in the headers and/or footers: X You can't just change the header and/or footer fields in the middle of some text (e.g. after a section header). This is because TeX may have processed a bit more text before deciding to make up the page. It may have passed a section beginning, causing the wrong title on the page. TeX has a mechanism called 'marks' to solve this problem. There is in LaTeX a \leftmark and a \rightmark. Usually \leftmark is a chapter title and \rightmark is a section title. To set the marks there are two commands: \markboth{L}{R} sets the \leftmark to L and the rightmark to R, and \rightmark{R} sets only the rightmark to R. The default definitions of \section etc. do this already for you. X An example follows: X X left page right page X --------- ---------- X 2 CHAPTER 1. Introduction | 1.2 Some section 3 ------------------------------------ | ----------------------------------------- X | Text | more text Text | more text Text | more text X | X | X | X This can be easily done with fancyheadings as follows: X \pagestyle{fancy} \setlength{\headrulewidth}{1pt} \lhead[\rm\thepage]{\sl\rightmark} \rhead[\sl\leftmark]{\rm\thepage} X This specifies that on even pages (the [] parts) the leftheadpart is page number and rightheadpart is \leftmark, which is the chapter title (because that is given as the left argument of \markboth (see page 162 of the LaTeX book) X On odd pages (the parts between {}) the leftheadpart is \rightmark (which is the last section title because that is given as argument to \markright (see the same page), and the rightheadpart is the page no. X Now suppose you don't want the section number and you want the section title in upper case: You add the following to your preamble: X \renewcommand{\sectionmark}[1]{\markright{\uppercase{#1}}} X Or if you don't want the chapter number but only the chapter title (not in uppercase): X \renewcommand{\chaptermark}[1]{\markboth{#1}{ }} X Note: the parameter in both cases is the (section|chapter) title. X KNOWN PROBLEMS: X Sometimes you will get a warning message from LaTeX concerning ``overfull vbox during output''. In this case you have to increase the \headheight or \footskip lengths or both (with \addtolength or \setlength). -- Piet* van Oostrum, Dept of Computer Science, Utrecht University, Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands. Telephone: +31 30 531806 Uucp: uunet!mcsun!ruuinf!piet Telefax: +31 30 513791 Internet: piet@cs.ruu.nl (*`Pete') SHAR_EOF chmod 0600 fancyheadings.doc || echo 'restore of fancyheadings.doc failed' Wc_c="`wc -c < 'fancyheadings.doc'`" test 9284 -eq "$Wc_c" || echo 'fancyheadings.doc: original size 9284, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= fancyheadings.sty ============== if test -f 'fancyheadings.sty' -a X"$1" != X"-c"; then echo 'x - skipping fancyheadings.sty (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting fancyheadings.sty (Text)' sed 's/^X//' << 'SHAR_EOF' > 'fancyheadings.sty' && % fancyheadings.sty version 1.0 % Fancy headers and footers. % Piet van Oostrum, Dept of Computer Science, University of Utrecht % Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands % Telephone: +31-30-531806. piet@cs.ruu.nl (mcvax!hp4nl!ruuinf!piet) % March, 1989. X \def\lhead{\@ifnextchar[{\@xlhead}{\@ylhead}} \def\@xlhead[#1]#2{\gdef\@elhead{#1}\gdef\@olhead{#2}} \def\@ylhead#1{\gdef\@elhead{#1}\gdef\@olhead{#1}} X \def\chead{\@ifnextchar[{\@xchead}{\@ychead}} \def\@xchead[#1]#2{\gdef\@echead{#1}\gdef\@ochead{#2}} \def\@ychead#1{\gdef\@echead{#1}\gdef\@ochead{#1}} X \def\rhead{\@ifnextchar[{\@xrhead}{\@yrhead}} \def\@xrhead[#1]#2{\gdef\@erhead{#1}\gdef\@orhead{#2}} \def\@yrhead#1{\gdef\@erhead{#1}\gdef\@orhead{#1}} X \def\lfoot{\@ifnextchar[{\@xlfoot}{\@ylfoot}} \def\@xlfoot[#1]#2{\gdef\@elfoot{#1}\gdef\@olfoot{#2}} \def\@ylfoot#1{\gdef\@elfoot{#1}\gdef\@olfoot{#1}} X \def\cfoot{\@ifnextchar[{\@xcfoot}{\@ycfoot}} \def\@xcfoot[#1]#2{\gdef\@ecfoot{#1}\gdef\@ocfoot{#2}} \def\@ycfoot#1{\gdef\@ecfoot{#1}\gdef\@ocfoot{#1}} X \def\rfoot{\@ifnextchar[{\@xrfoot}{\@yrfoot}} \def\@xrfoot[#1]#2{\gdef\@erfoot{#1}\gdef\@orfoot{#2}} \def\@yrfoot#1{\gdef\@erfoot{#1}\gdef\@orfoot{#1}} X \newdimen\headrulewidth \newdimen\footrulewidth \newdimen\plainheadrulewidth \newdimen\plainfootrulewidth \newdimen\headwidth \newif\if@fancyplain \@fancyplainfalse \def\fancyplain#1#2{\if@fancyplain#1\else#2\fi} X % Initialization of the head and foot text. X \headrulewidth 0.4pt \footrulewidth\z@ \plainheadrulewidth\z@ \plainfootrulewidth\z@ X \lhead[\fancyplain{}{\sl\rightmark}]{\fancyplain{}{\sl\leftmark}} % i.e. empty on ``plain'' pages \rightmark on even, \leftmark on odd pages \chead{} \rhead[\fancyplain{}{\sl\leftmark}]{\fancyplain{}{\sl\rightmark}} % i.e. empty on ``plain'' pages \leftmark on even, \rightmark on odd pages \lfoot{} \cfoot{\rm\thepage} % page number \rfoot{} X % Put together a header or footer given the left, center and % right text, fillers at left and right and a rule. % The \lap commands put the text into an hbox of zero size, % so overlapping text does not generate an errormessage. X \def\@fancyhead#1#2#3#4#5{#1\hbox to\headwidth{\vbox{\hbox {\rlap{\parbox[b]{\headwidth}{\raggedright#2\strut}}\hfill \parbox[b]{\headwidth}{\centering#3\strut}\hfill \llap{\parbox[b]{\headwidth}{\raggedleft#4\strut}}}\headrule}}#5} X X \def\@fancyfoot#1#2#3#4#5{#1\hbox to\headwidth{\vbox{\footrule \hbox{\rlap{\parbox[t]{\headwidth}{\raggedright#2\strut}}\hfill \parbox[t]{\headwidth}{\centering#3\strut}\hfill \llap{\parbox[t]{\headwidth}{\raggedleft#4\strut}}}}}#5} X \def\headrule{{\if@fancyplain\headrulewidth\plainheadrulewidth\fi \hrule\@height\headrulewidth\@width\headwidth \vskip-\headrulewidth}} X \def\footrule{{\if@fancyplain\footrulewidth\plainfootrulewidth\fi \vskip-0.3\normalbaselineskip\vskip-\footrulewidth \hrule\@width\headwidth\@height\footrulewidth\vskip0.3\normalbaselineskip}} X \def\ps@fancy{ \let\@mkboth\markboth \@ifundefined{chapter}{\def\sectionmark##1{\markboth {\uppercase{\ifnum \c@secnumdepth>\z@ X \thesection\hskip 1em\relax \fi ##1}}{}} \def\subsectionmark##1{\markright {\ifnum \c@secnumdepth >\@ne X \thesubsection\hskip 1em\relax \fi ##1}}} {\def\chaptermark##1{\markboth {\uppercase{\ifnum \c@secnumdepth>\m@ne X \@chapapp\ \thechapter. \ \fi ##1}}{}} \def\sectionmark##1{\markright{\uppercase{\ifnum \c@secnumdepth >\z@ X \thesection. \ \fi ##1}}}} \def\@oddhead{\@fancyhead\relax\@olhead\@ochead\@orhead\hss} \def\@oddfoot{\@fancyfoot\relax\@olfoot\@ocfoot\@orfoot\hss} \def\@evenhead{\@fancyhead\hss\@elhead\@echead\@erhead\relax} \def\@evenfoot{\@fancyfoot\hss\@elfoot\@ecfoot\@erfoot\relax} \headwidth\textwidth} \def\ps@fancyplain{\ps@fancy \let\ps@plain\ps@plain@fancy} \def\ps@plain@fancy{\@fancyplaintrue\ps@fancy} SHAR_EOF chmod 0640 fancyheadings.sty || echo 'restore of fancyheadings.sty failed' Wc_c="`wc -c < 'fancyheadings.sty'`" test 3778 -eq "$Wc_c" || echo 'fancyheadings.sty: original size 3778, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= getopt.c ============== if test -f 'getopt.c' -a X"$1" != X"-c"; then echo 'x - skipping getopt.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting getopt.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'getopt.c' && /* Getopt for GNU. X Copyright (C) 1987, 1989 Free Software Foundation, Inc. X X This program is free software; you can redistribute it and/or modify X it under the terms of the GNU General Public License as published by X the Free Software Foundation; either version 1, or (at your option) X any later version. X X This program is distributed in the hope that it will be useful, X but WITHOUT ANY WARRANTY; without even the implied warranty of X MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X GNU General Public License for more details. X X You should have received a copy of the GNU General Public License X along with this program; if not, write to the Free Software X Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ X /* This version of `getopt' appears to the caller like standard Unix `getopt' X but it behaves differently for the user, since it allows the user X to intersperse the options with the other arguments. X X As `getopt' works, it permutes the elements of `argv' so that, X when it is done, all the options precede everything else. Thus X all application programs are extended to handle flexible argument order. X X Setting the environment variable _POSIX_OPTION_ORDER disables permutation. X Then the behavior is completely standard. X X GNU application programs can use a third alternative mode in which X they can distinguish the relative order of options and other arguments. */ X #include X /* If compiled with GNU C, use the built-in alloca */ #ifdef __GNUC__ #define alloca __builtin_alloca #else /* not __GNUC__ */ #ifdef sparc #include #else char *alloca (); #endif #endif /* not __GNUC__ */ X #ifdef USG #define bcopy(s, d, l) memcpy((d), (s), (l)) #define index strchr #endif X char *getenv (); char *index (); char *malloc (); X /* For communication from `getopt' to the caller. X When `getopt' finds an option that takes an argument, X the argument value is returned here. X Also, when `ordering' is RETURN_IN_ORDER, X each non-option ARGV-element is returned here. */ X char *optarg = 0; X /* Index in ARGV of the next element to be scanned. X This is used for communication to and from the caller X and for communication between successive calls to `getopt'. X X On entry to `getopt', zero means this is the first call; initialize. X X When `getopt' returns EOF, this is the index of the first of the X non-option elements that the caller should itself scan. X X Otherwise, `optind' communicates from one call to the next X how much of ARGV has been scanned so far. */ X int optind = 0; X /* The next char to be scanned in the option-element X in which the last option character we returned was found. X This allows us to pick up the scan where we left off. X X If this is zero, or a null string, it means resume the scan X by advancing to the next ARGV-element. */ X static char *nextchar; X /* Callers store zero here to inhibit the error message X for unrecognized options. */ X int opterr = 1; X /* Describe how to deal with options that follow non-option ARGV-elements. X X If the caller did not specify anything, X the default is REQUIRE_ORDER if the environment variable X _POSIX_OPTION_ORDER is defined, PERMUTE otherwise. X X REQUIRE_ORDER means don't recognize them as options. X Stop option processing when the first non-option is seen. X This is what Unix does. X X PERMUTE is the default. We permute the contents of ARGV as we scan, X so that eventually all the options are at the end. This allows options X to be given in any order, even with programs that were not written to X expect this. X X RETURN_IN_ORDER is an option available to programs that were written X to expect options and other ARGV-elements in any order and that care about X the ordering of the two. We describe each non-option ARGV-element X as if it were the argument of an option with character code one. X Using `-' as the first character of the list of option characters X requests this mode of operation. X X The special argument `--' forces an end of option-scanning regardless X of the value of `ordering'. In the case of RETURN_IN_ORDER, only X `--' can cause `getopt' to return EOF with `optind' != ARGC. */ X static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; X /* Describe the long-named options requested by the application. X _GETOPT_LONG_OPTIONS is a vector of `struct option' terminated by an X element containing a name which is zero. X The field `has_arg' is 1 if the option takes an argument, X 2 if it takes an optional argument. */ X struct option { X char *name; X int has_arg; X int *flag; X int val; }; X struct option *_getopt_long_options; X int _getopt_long_only = 0; X #if 0 /* This is an ugly kludge. Programs should use the opt_index argument X to getopt_long instead. */ /* Name of long-named option actually found. */ X char *_getopt_option_name; #endif X /* Index in _GETOPT_LONG_OPTIONS of the long-named option actually found. X Only valid when a long-named option was found. */ X int option_index; X /* Handle permutation of arguments. */ X /* Describe the part of ARGV that contains non-options that have X been skipped. `first_nonopt' is the index in ARGV of the first of them; X `last_nonopt' is the index after the last of them. */ X static int first_nonopt; static int last_nonopt; X /* Exchange two adjacent subsequences of ARGV. X One subsequence is elements [first_nonopt,last_nonopt) X which contains all the non-options that have been skipped so far. X The other is elements [last_nonopt,optind), which contains all X the options processed since those non-options were skipped. X X `first_nonopt' and `last_nonopt' are relocated so that they describe X the new indices of the non-options in ARGV after they are moved. */ X static void exchange (argv) X char **argv; { X int nonopts_size X = (last_nonopt - first_nonopt) * sizeof (char *); X char **temp = (char **) alloca (nonopts_size); X X /* Interchange the two blocks of data in argv. */ X X bcopy (&argv[first_nonopt], temp, nonopts_size); X bcopy (&argv[last_nonopt], &argv[first_nonopt], X (optind - last_nonopt) * sizeof (char *)); X bcopy (temp, &argv[first_nonopt + optind - last_nonopt], X nonopts_size); X X /* Update records for the slots the non-options now occupy. */ X X first_nonopt += (optind - last_nonopt); X last_nonopt = optind; } X /* Scan elements of ARGV (whose length is ARGC) for option characters X given in OPTSTRING. X X If an element of ARGV starts with '-', and is not exactly "-" or "--", X then it is an option element. The characters of this element X (aside from the initial '-') are option characters. If `getopt' X is called repeatedly, it returns successively each of the option characters X from each of the option elements. X X If `getopt' finds another option character, it returns that character, X updating `optind' and `nextchar' so that the next call to `getopt' can X resume the scan with the following option character or ARGV-element. X X If there are no more option characters, `getopt' returns `EOF'. X Then `optind' is the index in ARGV of the first ARGV-element X that is not an option. (The ARGV-elements have been permuted X so that those that are not options now come last.) X X OPTSTRING is a string containing the legitimate option characters. X If an option character is seen that is not listed in OPTSTRING, X return '?' after printing an error message. If you set `opterr' to X zero, the error message is suppressed but we still return '?'. X X If a char in OPTSTRING is followed by a colon, that means it wants an arg, X so the following text in the same ARGV-element, or the text of the following X ARGV-element, is returned in `optarg'. Two colons mean an option that X wants an optional arg; if there is text in the current ARGV-element, X it is returned in `optarg', otherwise `optarg' is set to zero. X X If OPTSTRING starts with `-', it requests a different method of handling the X non-option ARGV-elements. See the comments about RETURN_IN_ORDER, above. X X Long-named options begin with `+' instead of `-'. X Their names may be abbreviated as long as the abbreviation is unique X or is an exact match for some defined option. If they have an X argument, it follows the option name in the same ARGV-element, separated X from the option name by a `=', or else the in next ARGV-element. X `getopt' returns 0 when it finds a long-named option. */ X int getopt (argc, argv, optstring) X int argc; X char **argv; X char *optstring; { X optarg = 0; X X /* Initialize the internal data when the first call is made. X Start processing options with ARGV-element 1 (since ARGV-element 0 X is the program name); the sequence of previously skipped X non-option ARGV-elements is empty. */ X X if (optind == 0) X { X first_nonopt = last_nonopt = optind = 1; X X nextchar = 0; X X /* Determine how to handle the ordering of options and nonoptions. */ X X if (optstring[0] == '-') X ordering = RETURN_IN_ORDER; X else if (getenv ("_POSIX_OPTION_ORDER") != 0) X ordering = REQUIRE_ORDER; X else X ordering = PERMUTE; X } X X if (nextchar == 0 || *nextchar == 0) X { X if (ordering == PERMUTE) X { X /* If we have just processed some options following some non-options, X exchange them so that the options come first. */ X X if (first_nonopt != last_nonopt && last_nonopt != optind) X exchange (argv); X else if (last_nonopt != optind) X first_nonopt = optind; X X /* Now skip any additional non-options X and extend the range of non-options previously skipped. */ X X while (optind < argc X && (argv[optind][0] != '-' X || argv[optind][1] == 0) X && (_getopt_long_options == 0 X || argv[optind][0] != '+' X || argv[optind][1] == 0)) X optind++; X last_nonopt = optind; X } X X /* Special ARGV-element `--' means premature end of options. X Skip it like a null option, X then exchange with previous non-options as if it were an option, X then skip everything else like a non-option. */ X X if (optind != argc && !strcmp (argv[optind], "--")) X { X optind++; X X if (first_nonopt != last_nonopt && last_nonopt != optind) X exchange (argv); X else if (first_nonopt == last_nonopt) X first_nonopt = optind; X last_nonopt = argc; X X optind = argc; X } X X /* If we have done all the ARGV-elements, stop the scan X and back over any non-options that we skipped and permuted. */ X X if (optind == argc) X { X /* Set the next-arg-index to point at the non-options X that we previously skipped, so the caller will digest them. */ X if (first_nonopt != last_nonopt) X optind = first_nonopt; X return EOF; X } X X /* If we have come to a non-option and did not permute it, X either stop the scan or describe it to the caller and pass it by. */ X X if ((argv[optind][0] != '-' || argv[optind][1] == 0) X && (_getopt_long_options == 0 X || argv[optind][0] != '+' || argv[optind][1] == 0)) X { X if (ordering == REQUIRE_ORDER) X return EOF; X optarg = argv[optind++]; #if 0 X _getopt_option_name = 0; #endif X return 1; X } X X /* We have found another option-ARGV-element. X Start decoding its characters. */ X X nextchar = argv[optind] + 1; X } X X if (_getopt_long_options != 0 X && (argv[optind][0] == '+' X || (_getopt_long_only && argv[optind][0] == '-')) X ) X { X struct option *p; X char *s = nextchar; X int exact = 0; X int ambig = 0; X struct option *pfound = 0; X int indfound; X X while (*s && *s != '=') s++; X X /* Test all options for either exact match or abbreviated matches. */ X for (p = _getopt_long_options, option_index = 0; p->name; X p++, option_index++) X if (!strncmp (p->name, nextchar, s - nextchar)) X { X if (s - nextchar == strlen (p->name)) X { X /* Exact match found. */ X pfound = p; X indfound = option_index; X exact = 1; X break; X } X else if (pfound == 0) X { X /* First nonexact match found. */ X pfound = p; X indfound = option_index; X } X else X /* Second nonexact match found. */ X ambig = 1; X } X X if (ambig && !exact) X { X fprintf (stderr, "%s: option `%s' is ambiguous\n", X argv[0], argv[optind]); X nextchar += strlen (nextchar); X return '?'; X } X X if (pfound != 0) X { X option_index = indfound; X optind++; X if (*s) X { X if (pfound->has_arg > 0) X optarg = s + 1; X else X { X fprintf (stderr, X "%s: option `%c%s' doesn't allow an argument\n", X argv[0], argv[optind - 1][0], pfound->name); X nextchar += strlen (nextchar); X return '?'; X } X } X else if (pfound->has_arg) X { X if (optind < argc) X optarg = argv[optind++]; X else if (pfound->has_arg != 2) X { X fprintf (stderr, "%s: option `%s' requires an argument\n", X argv[0], argv[optind - 1]); X nextchar += strlen (nextchar); X return '?'; X } X } #if 0 X _getopt_option_name = pfound->name; #endif X nextchar += strlen (nextchar); X if (pfound->flag) X *(pfound->flag) = pfound->val; X return 0; X } X /* Can't find it as a long option. If this is getopt_long_only, X and the option starts with '-' and is a valid short X option, then interpret it as a short option. Otherwise it's X an error. */ X if (_getopt_long_only == 0 || argv[optind][0] == '+' || X index (optstring, *nextchar) == 0) X { X if (opterr != 0) X fprintf (stderr, "%s: unrecognized option `%c%s'\n", X argv[0], argv[optind][0], nextchar); X nextchar += strlen (nextchar); X return '?'; X } X } X X /* Look at and handle the next option-character. */ X X { X char c = *nextchar++; X char *temp = index (optstring, c); X X /* Increment `optind' when we start to process its last character. */ X if (*nextchar == 0) X optind++; X X if (temp == 0 || c == ':') X { X if (opterr != 0) X { X if (c < 040 || c >= 0177) X fprintf (stderr, "%s: unrecognized option, character code 0%o\n", X argv[0], c); X else X fprintf (stderr, "%s: unrecognized option `-%c'\n", X argv[0], c); X } X return '?'; X } X if (temp[1] == ':') X { X if (temp[2] == ':') X { X /* This is an option that accepts an argument optionally. */ X if (*nextchar != 0) X { X optarg = nextchar; X optind++; X } X else X optarg = 0; X nextchar = 0; X } X else X { X /* This is an option that requires an argument. */ X if (*nextchar != 0) X { X optarg = nextchar; X /* If we end this ARGV-element by taking the rest as an arg, X we must advance to the next element now. */ X optind++; X } X else if (optind == argc) X { X if (opterr != 0) X fprintf (stderr, "%s: option `-%c' requires an argument\n", X argv[0], c); X c = '?'; X } X else X /* We already incremented `optind' once; X increment it again when taking next ARGV-elt as argument. */ X optarg = argv[optind++]; X nextchar = 0; X } X } X return c; X } } X #ifdef TEST X /* Compile with -DTEST to make an executable for use in testing X the above definition of `getopt'. */ X int main (argc, argv) X int argc; X char **argv; { X char c; X int digit_optind = 0; X X while (1) X { X int this_option_optind = optind; X if ((c = getopt (argc, argv, "abc:d:0123456789")) == EOF) X break; X X switch (c) X { X case '0': X case '1': X case '2': X case '3': X case '4': X case '5': X case '6': X case '7': X case '8': X case '9': X if (digit_optind != 0 && digit_optind != this_option_optind) X printf ("digits occur in two different argv-elements.\n"); X digit_optind = this_option_optind; X printf ("option %c\n", c); X break; X X case 'a': X printf ("option a\n"); X break; X X case 'b': X printf ("option b\n"); X break; X X case 'c': X printf ("option c with value `%s'\n", optarg); X break; X X case '?': X break; X X default: X printf ("?? getopt returned character code 0%o ??\n", c); X } X } X X if (optind < argc) X { X printf ("non-option ARGV-elements: "); X while (optind < argc) X printf ("%s ", argv[optind++]); X printf ("\n"); X } X X return 0; } X #endif /* TEST */ SHAR_EOF chmod 0640 getopt.c || echo 'restore of getopt.c failed' Wc_c="`wc -c < 'getopt.c'`" test 16224 -eq "$Wc_c" || echo 'getopt.c: original size 16224, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= getopt.h ============== if test -f 'getopt.h' -a X"$1" != X"-c"; then echo 'x - skipping getopt.h (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting getopt.h (Text)' sed 's/^X//' << 'SHAR_EOF' > 'getopt.h' && /* declarations for getopt X Copyright (C) 1989 Free Software Foundation, Inc. X X This program is free software; you can redistribute it and/or modify X it under the terms of the GNU General Public License as published by X the Free Software Foundation; either version 1, or (at your option) X any later version. X X This program is distributed in the hope that it will be useful, X but WITHOUT ANY WARRANTY; without even the implied warranty of X MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X GNU General Public License for more details. X X You should have received a copy of the GNU General Public License X along with this program; if not, write to the Free Software X Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ X /* For communication from `getopt' to the caller. X When `getopt' finds an option that takes an argument, X the argument value is returned here. X Also, when `ordering' is RETURN_IN_ORDER, X each non-option ARGV-element is returned here. */ X extern char *optarg; X /* Index in ARGV of the next element to be scanned. X This is used for communication to and from the caller X and for communication between successive calls to `getopt'. X X On entry to `getopt', zero means this is the first call; initialize. X X When `getopt' returns EOF, this is the index of the first of the X non-option elements that the caller should itself scan. X X Otherwise, `optind' communicates from one call to the next X how much of ARGV has been scanned so far. */ X extern int optind; X /* Callers store zero here to inhibit the error message `getopt' prints X for unrecognized options. */ X extern int opterr; X /* Describe the long-named options requested by the application. X _GETOPT_LONG_OPTIONS is a vector of `struct option' terminated by an X element containing a name which is zero. X The field `has_arg' is: X 0 if the option does not take an argument, X 1 if the option requires an argument, X 2 if the option takes an optional argument. X If the field `flag' is nonzero, it points to a variable that is set to X the value given in the field `val' when the option is found, but X left unchanged if the option is not found. */ X struct option { X char *name; X int has_arg; X int *flag; X int val; }; X extern struct option *_getopt_long_options; X /* If nonzero, tell getopt that '-' means a long option. X Set by getopt_long_only. */ extern int _getopt_long_only; X #if 0 /* Name of long-named option actually found. X Only changed when a long-named option is found. X Set to zero when returning a non-option arg in `optarg'. */ X extern char *_getopt_option_name; #endif X /* The index in GETOPT_LONG_OPTIONS of the long-named option found. X Only valid when a long-named option has been found by the most X recent call to `getopt'. */ X extern int option_index; X #ifdef __STDC__ int getopt (int, char **, char *); int getopt_long (int, char **, char *, struct option *, int *); int getopt_long_only (int, char **, char *, struct option *, int *); #else int getopt (); int getopt_long (); int getopt_long_only (); #endif SHAR_EOF chmod 0640 getopt.h || echo 'restore of getopt.h failed' Wc_c="`wc -c < 'getopt.h'`" test 3097 -eq "$Wc_c" || echo 'getopt.h: original size 3097, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= getopt1.c ============== if test -f 'getopt1.c' -a X"$1" != X"-c"; then echo 'x - skipping getopt1.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting getopt1.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'getopt1.c' && /* Getopt for GNU. X Copyright (C) 1987, 1989 Free Software Foundation, Inc. X X This program is free software; you can redistribute it and/or modify X it under the terms of the GNU General Public License as published by X the Free Software Foundation; either version 1, or (at your option) X any later version. X X This program is distributed in the hope that it will be useful, X but WITHOUT ANY WARRANTY; without even the implied warranty of X MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X GNU General Public License for more details. X X You should have received a copy of the GNU General Public License X along with this program; if not, write to the Free Software X Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ X X X #include "getopt.h" X int getopt_long (argc, argv, options, long_options, opt_index) X int argc; X char **argv; X char *options; X struct option *long_options; X int *opt_index; { X int val; X _getopt_long_options = long_options; X val = getopt (argc, argv, options); X if (val == 0) X *opt_index = option_index; X return val; } X /* Like getopt_long, but there are no short options. That is, X '-' as well as '+' indicates a long option. Of course, long_options X can contain single character options but '-ab' is not the same as X '-a -b'. */ int getopt_long_only (argc, argv, options, long_options, opt_index) X int argc; X char **argv; X char *options; X struct option *long_options; X int *opt_index; { X int val; X _getopt_long_options = long_options; X _getopt_long_only = 1; X val = getopt (argc, argv, options); X if (val == 0) X *opt_index = option_index; X return val; } X X #ifdef TEST X #include X int main (argc, argv) X int argc; X char **argv; { X char c; X int digit_optind = 0; X X while (1) X { X int this_option_optind = optind; X char *name = '\0'; X int option_index = 0; X static struct option long_options[] X = {{ "add", 1, 0, 0 }, X { "append", 0, 0, 0 }, X { "delete", 1, 0, 0 }, X { "verbose", 0, 0, 0 }, X { "create", 0, 0, 0 }, X { "file", 1, 0, 0 }, X { 0, 0, 0, 0}}; X X c = getopt_long (argc, argv, "abc:d:0123456789", X long_options, &option_index); X if (c == EOF) X break; X switch (c) X { X case 0: X printf ("option %s", (long_options[option_index]).name); X if (optarg) X printf (" with arg %s", optarg); X printf ("\n"); X break; X X case '0': X case '1': X case '2': X case '3': X case '4': X case '5': X case '6': X case '7': X case '8': X case '9': X if (digit_optind != 0 && digit_optind != this_option_optind) X printf ("digits occur in two different argv-elements.\n"); X digit_optind = this_option_optind; X printf ("option %c\n", c); X break; X X case 'a': X printf ("option a\n"); X break; X X case 'b': X printf ("option b\n"); X break; X X case 'c': X printf ("option c with value `%s'\n", optarg); X break; X X case '?': X break; X X default: X printf ("?? getopt returned character code 0%o ??\n", c); X } X } X X if (optind < argc) X { X printf ("non-option ARGV-elements: "); X while (optind < argc) X printf ("%s ", argv[optind++]); X printf ("\n"); X } X X return 0; } X #endif /* TEST */ SHAR_EOF chmod 0640 getopt1.c || echo 'restore of getopt1.c failed' Wc_c="`wc -c < 'getopt1.c'`" test 3291 -eq "$Wc_c" || echo 'getopt1.c: original size 3291, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= main.c ============== if test -f 'main.c' -a X"$1" != X"-c"; then echo 'x - skipping main.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting main.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'main.c' && /* X * This is a flex input file but should be edited in -*-C-*- mode X * X * C++2LaTeX: Produce prettyprinted LaTeX files from C++ or C sources. X * Copyright (C) 1990 Norbert Kiesel X * X * This program is free software; you can redistribute it and/or modify X * it under the terms of the GNU General Public License as published by X * the Free Software Foundation; either version 1, or (at your option) X * any later version. X * X * This program is distributed in the hope that it will be useful, X * but WITHOUT ANY WARRANTY; without even the implied warranty of X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X * GNU General Public License for more details. X * X * You should have received a copy of the GNU General Public License X * along with this program; if not, write to the Free Software X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X * X * Norbert Kiesel X * RWTH Aachen / Institut f. Informatik III X * Ahornstr. 55 X * D-5100 Aachen X * West Germany X * X * Phone: +49 241 80-7266 X * EUNET: norbert@rwthi3.uucp X * USENET: ...!mcvax!unido!rwthi3!norbert X * X.400: norbert@rwthi3.informatik.rwth-aachen.de X * X * Please contact me for any bugs you find in this code or any X * improvements! I'd also be very happy to get feedback where and X * how frequently this program is used (just drop a little mail :-). X * X * --------------------------------------------------------------------------------- X * X * C++2LaTeX 2.0: Produce even more prettyprinted LaTeX files from C++ or C sources. X * X * Copyright (C) 1991 Joerg Heitkoetter X * Systems Analysis Research Group, University of Dortmund X * (heitkoet@gorbi.informatik.uni-dortmund.de). X * X */ X void substitute (input) char *input; { X while (*input) { X switch (*input) { X case '_': X case '&': X case '#': X case '$': X case '%': X case '{': X case '}': X printf ("\\%c", *input); X break; X case '+': X case '=': X case '<': X case '>': X printf ("$%c$", *input); X break; X case '*': X printf ("$\\ast$"); X break; X case '|': X printf ("$\\mid$"); X break; X case '\\': X printf ("$\\backslash$"); X break; X case '^': X printf ("$\\wedge$"); X break; X case '~': X printf ("$\\sim$"); X break; X default: X printf ("%c", *input); X break; X } X input++; X } } X void indent (blanks) char *blanks; { X int i; X X i = 0; X while (*blanks) { X if (*blanks == ' ') { X i++; X } else { /* *blanks == '\t' */ X while (++i % tabtotab); X } X blanks++; X } X printf ("\\hspace*{%d\\indentation}", i); } X #include "getopt.h" #include #include #include #include X extern char *version_string; X static struct option opts[] = { X {"ansi-c", 0, 0, 'a'}, X {"complete-file", 0, 0, 'c'}, X {"font-size", 1, 0, 's'}, X {"indentation", 1, 0, 'i'}, X {"header", 0, 0, 'h'}, X {"piped", 0, 0, 'p'}, X {"alignment", 0, 0, 'n'}, /* turn off comment alignment -joke */ X {"output", 1, 0, 'o'}, X {"tabstop", 1, 0, 'T'}, X {"brace-tab", 1, 0, 'b'}, /* added new tabtobrace -joke */ X {"comment-font", 1, 0, 'C'}, X {"string-font", 1, 0, 'S'}, X {"keyword-font", 1, 0, 'K'}, X {"header-font", 1, 0, 'H'}, X {"cpp-font", 1, 0, 'P'}, X {"version", 0, 0, 'V'}, X {0, 0, 0, 0} }; X X main (argc, argv) int argc; char **argv; { X int c; X int index; X int i; X int has_filename; X char *input_name; X char *output_name; X char *program_name; X long now; X char *today; X char *malloc (); X X input_name = "Standard Input"; X output_name = 0; X X now = time (0); X today = ctime (&now); X X program_name = strrchr (argv[0], '/'); X if (program_name == NULL) { /* no pathname */ X program_name = argv[0]; X } else { X program_name++; X } X X /* simple heuristic: '+' in name means C++ */ X cplusplus_mode = (strchr (program_name, '+') != 0); X X if (argc == 1) X usage (program_name); /* added exit with usage -joke */ X X while ((c = getopt_long (argc, argv, X "acpno:s:i:b:hT:C:H:S:K:P:V", opts, &index)) X != EOF) { X if (c == 0) { /* Long option */ X c = opts[index].val; X } X switch (c) { X case 'a': X cplusplus_mode = 0; X break; X case 'c': X complete_file = 1; X break; X case 'o': X if (piped) { X fprintf (stderr, X "%s: Can't use {-p,+pipe} and {-o,+output} together\n", X program_name); X exit (5); X } X output_name = optarg; X break; X case 'n': X aligntoright = 0; X break; X case 's': X font_size = optarg; X break; X case 'i': X indentation = optarg; X break; X case 'b': X tabtobrace = atoi (optarg); X break; X case 'T': X tabtotab = atoi (optarg); X break; X case 'p': X if (output_name != 0) { X fprintf (stderr, X "%s: Can't use {-p,+pipe} and {-o,+output} together\n", X program_name); X exit (5); X } X piped = 1; X break; X case 'h': X header = 1; X complete_file = 1; /* header implies X * complete-file */ X break; X case 'C': X comment_font = optarg; X break; X case 'H': X header_font = optarg; X break; X case 'P': X cpp_font = optarg; X break; X case 'S': X string_font = optarg; X break; X case 'K': X keyword_font = optarg; X break; X case 'V': X fprintf (stderr, "%s\n", version_string); X break; X default: X usage (program_name); X } X } X has_filename = (argc - optind == 1); X if (has_filename) { /* last argument is input file name */ X input_name = argv[optind]; X if (freopen (input_name, "r", stdin) == NULL) { X fprintf (stderr, "%s: Can't open `%s' for reading\n", X program_name, input_name); X exit (2); X } X } X if ((output_name == 0) && !piped) { X char *tmp; X if (has_filename) { X tmp = strrchr (input_name, '/'); X if (tmp == 0) { /* plain filename */ X tmp = input_name; X } else { X tmp++; X } X } else { X tmp = program_name; X } X output_name = malloc (strlen (tmp) + 4); X if (output_name == 0) { X fprintf (stderr, "%s: Virtual memory exhausted\n", program_name); X exit (3); X } X strcpy (output_name, tmp); X strcat (output_name, ".tex"); X } X if (!piped) { X if (freopen (output_name, "w", stdout) == NULL) { X fprintf (stderr, "%s: Can't open `%s' for writing\n", X program_name, output_name); X exit (3); X } X } X printf ("\ %%\n\ %% This file was automatically produced at %.24s by\n\ %% %s", today, program_name); X for (i = 1; i < argc; i++) { X printf (" %s", argv[i]); X } X if (!has_filename) { X printf (" (from Standard Input)"); X } X printf ("\n%%\n"); X if (complete_file) { X if (header) { X if (strcmp (font_size, "10") == 0) { X printf ("\\documentstyle[fancyheadings]{article}\n"); X } else { X printf ("\\documentstyle[%spt,fancyheadings]{article}\n", X font_size); X } X } else { X if (strcmp (font_size, "10") == 0) { X printf ("\\documentstyle{article}\n"); X } else { X printf ("\\documentstyle[%spt]{article}\n", font_size); X } X } X printf ("\\setlength{\\textwidth}{16cm}\n"); X printf ("\\setlength{\\textheight}{23cm}\n"); X printf ("\\setlength{\\hoffset}{-2cm}\n"); X printf ("\\setlength{\\voffset}{-2cm}\n"); X if (header) { X printf ("\\lhead{\\%s ", header_font); X substitute (input_name); X printf ("}"); X printf ("\\rhead{\\rm\\thepage}\n"); X printf ("\\cfoot{}\n"); X printf ("\\addtolength{\\headheight}{14pt}\n"); X printf ("\\pagestyle{fancy}\n"); X } X printf ("\\begin{document}\n"); X } X printf ("\\expandafter\\ifx\\csname indentation\\endcsname\\relax%\n"); X printf ("\\newlength{\\indentation}\\fi\n"); X printf ("\\setlength{\\indentation}{%s}\n", indentation); X printf ("\\begin{flushleft}\n"); X yylex (); X printf ("\\end{flushleft}\n"); X if (complete_file) { X printf ("\\end{document}\n"); X } X exit (0); } X void usage (name) char *name; { X fprintf (stderr, "%s\n", version_string); X fprintf (stderr, "\ Usage: %s [options] file\n\n\ Options:\n\ X [-a] [-b]\n\ X [-c] [-h]\n\ X [-i length] [-n]\n\ X [-o file] [-p]\n\ X [-s fontsize] [-C font]\n\ X [-H font] [-K font]\n\ X [-P font] [-S font]\n\ X [-T tabulatorwidth] [-V]\n\ X \n\ X [+ansi-c] [+brace-tab indentation]\n\ X [+complete-file] [+header]\n\ X [+indentation length] [+no-alignment]\n\ X [+output file] [+pipe]\n\ X [+font-size size] [+comment-font font]\n\ X [+keyword-font font] [+cpp-font font]\n\ X [+header-font font] [+string-font font]\n\ X [+tabstop width] [+version]\n", name); X exit (1); } SHAR_EOF chmod 0640 main.c || echo 'restore of main.c failed' Wc_c="`wc -c < 'main.c'`" test 8338 -eq "$Wc_c" || echo 'main.c: original size 8338, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= version.c ============== if test -f 'version.c' -a X"$1" != X"-c"; then echo 'x - skipping version.c (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting version.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'version.c' && char * version_string = "c++2latex Version 2.0, Patchlevel 0"; /* used to be Version 1.1 Patchlevel 4 */ SHAR_EOF chmod 0640 version.c || echo 'restore of version.c failed' Wc_c="`wc -c < 'version.c'`" test 105 -eq "$Wc_c" || echo 'version.c: original size 105, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi rm -f _shar_seq_.tmp echo You have unpacked the last part exit 0 exit 0 # Just in case... -- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM Sterling Software, IMD UUCP: uunet!sparky!kent Phone: (402) 291-8300 FAX: (402) 291-4362 Please send comp.sources.misc-related mail to kent@uunet.uu.net.