From: johnl@informix.com (Jonathan Leffler) Newsgroups: comp.databases.informix Subject: Re: Using Informix-4gl compiled help messages Date: 4 Dec 1995 14:53:04 -0500 Christmas is coming, the goose is getting fat. Etc. Some source code and a makefile follows. The source code builds a program, listiem, and a library file, msgtext.o. The original request, below, is for the code in msgtext.c, but it only handles the old style, short message numbers. 6.0x I4GL has to be able to handle modern long error message numbers too. The code for listiem does that -- not necessarily very elegantly, but it works for me. Strictly, therefore, some similar set of changes needs to be hacked into the msgtext.c code. If someone does it, I'd appreciate a copy of the hacked code. I also note that msgtext.c should include to obtain a prototype for bsearch(), and you also really need to find prototypes for ldint(), ldlong(), popstring(), retint() and retquote(). The popX and retX functions should be declared in $INFORMIXDIR/incl/tools/fglsys.h. The ldX functions are more problematic; there are declarations in isam.h, or you can write your own. Sorry it's not cleaner. Yours, Jonathan Leffler (johnl@informix.com) #include PS: Prototypes for missing functions: extern void popint(int *ip); extern void popquote(char *str, int len); extern void retint(int i); extern void retquote(char *s); extern int ldint(char *s); extern /*unsigned*/ long ldlong(char *s); PPS: This code is completely independent of the Informix official code. It therefore uses an extra file descriptor. I do not recall how memory clean the msgtext.c code is -- it probably isn't therefore. PPPS: Supplied without manual page or support -- if it works for you, great. If not, fix it and let me have the results, and I'll be grateful. If you can't manage to fix it, I'm sorry for wasting your time. >Date: Sun, 3 Dec 1995 14:11:51 -0500 >From: Melvin Perez Cedano >Subject: Using Informix-4gl compiled help messages >X-Informix-List-Id: > >Hello Informixers! > >This message is similar to a previous one I wrote. Anybody knows how works >the MKMESSAGE utility? I guess that it create a file "indexed" by the help >number. But, how can I access this file in a good way without call the >SHOWHELP function? > >I trying to put my error messages in a file, as Informix products does, and >then use a function that access that file in a efficiently way. > >--************************************************************************** >NOTE TO INFORMIX: WHY WE CANNOT MANAGE THE ERROR MESSAGES AS THE HELP MESSAGES? > FOR EXAMPLE: > WE NEED ONE MORE CLAUSE IN THE "OPTIONS" STATATEMENT: >ERROR FILE, AND > A FUNCTION FOR ACCESS THE FILE: SHOWERROR. > THAT'S ALL!! >--************************************************************************** >TIA > > ////// >+------------------------------ooo-O-O-ooo--------------------------------+ >| U | >| Melvin Perez Cedano Santo Domingo, Dom. Rep.| >| Vice-President m.mejia@codetel.net.do | >| Systems Development Phone (809) 686-5574 | >| CAM Informatica, S. A. Fax (809) 686-5467 | >+-------------------------------------------------------------------------+ : "@(#)shar.sh 1.9" #! /bin/sh # # This is a shell archive. # Remove everything above this line and run sh on the resulting file. # If this archive is complete, you will see this message at the end: # "All files extracted" # # Created: Mon Dec 4 10:23:55 PST 1995 by johnl at Informix Software Ltd. # Files archived in this archive: # ffilter.c # filter.h # getopt.c # getopt.h # ldint.c # ldlong.c # listiem.c # makefile # msgtext.c # stderr.c # stderr.h # #-------------------- if [ -f ffilter.c -a "$1" != "-c" ] then echo shar: ffilter.c already exists else echo 'x - ffilter.c (4096 characters)' sed -e 's/^X//' >ffilter.c <<'SHAR-EOF' X/* X@(#) File: ffilter.c X@(#) Version: 3.3 X@(#) Last changed: 93/06/29 X@(#) Purpose: Standard File Filter X@(#) Author: J Leffler X@(#)Product: :PRODUCT: X*/ X X/*TABSTOP=4*/ X/*LINTLIBRARY*/ X X#include X#include X X#include "stderr.h" X#include "filter.h" X X#ifndef lint Xstatic char sccs[] = "@(#)ffilter.c 3.3 93/06/29"; X#endif X X#ifdef __STDC__ Xvoid filter(int argc, char **argv, int optind, Filter function) X#else Xvoid filter(argc, argv, optind, function) Xint argc; /* In: Number of arguments */ Xchar **argv; /* In: Argument list of program */ Xint optind; /* In: Offset in list to start at */ XFilter function; /* In: Function to process file */ X#endif /* __STDC__ */ X X/* X Purpose: Standard File Filter X X Maintenance Log X --------------- X 09/03/87 JL Original version stabilised X 18/04/88 JL Now pass fp and file name to function X 15/12/91 JL Upgrade for ANSI C X 29/06/93 JL Rename to filter and accept optind argument X X Comments X -------- X 1. For every non-flag option in the argument list, or standard input X if there are no non-flag arguments, run 'function' on file. X 2. If a file name is '-', use standard input. X 3. The optind argument should normally be the value of optind as X supplied by getopt(3). But it should be the index of the first X non-flag argument. X X*/ X{ X int i; X FILE *fp; X char *file; X X if (argc <= optind) X { X /* Assumes argv[argc] == NIL(char *) and can be assigned to */ X argv[argc] = "-"; X argc++; X } X X for (i = optind; i < argc; i++) X { X if (strcmp(argv[i], "-") == 0) X { X file = "(standard input)"; X (*function)(stdin, file); X } X else if ((fp = fopen(argv[i], "r")) != NULL) X { X file = argv[i]; X (*function)(fp, file); X fclose(fp); X } X else X error2("failed to open file", argv[i]); X } X} X X#ifdef __STDC__ Xvoid ffilter(int argc, char **argv, Filter function) X#else Xvoid ffilter(argc, argv, function) Xint argc; /* In: Number of arguments */ Xchar **argv; /* In: Argument list of program */ XFilter function; /* In: Function to process file */ X#endif /* __STDC__ */ X X/* X Purpose: Compatability function X X Maintenance Log X --------------- X 29/06/93 JL Original version stabilised X X Comments X -------- X 1. The standard calling sequence for ffilter is: X argc -= optind - 1; X argv += optind - 1; X argv[0] = arg0; X ffilter(argc, argv, function); X 2. Using filter simplifies this sequence to: X filter(argc, argv, optind, function); X X*/ X{ X filter(argc, argv, 1, function); X} X X#ifdef TEST X X#include X#include "getopt.h" X X#ifdef __STDC__ Xvoid fcopy(FILE * f1, FILE * f2) X#else Xvoid fcopy(f1, f2) XFILE *f1; XFILE *f2; X#endif /* __STDC__ */ X{ X char buffer[BUFSIZ]; X int n; X X while ((n = fread(buffer, sizeof(char), sizeof(buffer), f1)) > 0) X { X if (fwrite(buffer, sizeof(char), n, f2) != n) X error("write failed"); X } X} X X#ifdef __STDC__ Xvoid vis(FILE * fp, char *fn) X#else Xvoid vis(fp, fn) XFILE *fp; Xchar *fn; X#endif /* __STDC__ */ X{ X int c; X X fprintf(stdout, "%s:\n", fn); X while ((c = getc(fp)) != EOF) X { X if (!isascii(c) || !isprint(c)) X printf("\\%03o", c); X else X putchar(c); X } X} X X#ifdef __STDC__ Xvoid cat(FILE * fp, char *fn) X#else Xvoid cat(fp, fn) XFILE *fp; Xchar *fn; X#endif /* __STDC__ */ X{ X fprintf(stdout, "%s:\n", fn); X fcopy(fp, stdout); X} X Xint main(argc, argv) Xint argc; Xchar **argv; X{ X int opt; X Filter f = cat; X X setarg0(argv[0]); X opterr = 0; X while ((opt = getopt(argc, argv, "v")) != EOF) X { X if (opt == 'v') X f = vis; X else X usage("[-v] [file ...]"); X } X filter(argc, argv, optind, f); X return(0); X} X X#endif /* TEST */ SHAR-EOF chmod 444 ffilter.c if [ `wc -c filter.h <<'SHAR-EOF' X/* X@(#)File: filter.h X@(#)Version: 1.2 X@(#)Last changed: 95/07/18 X@(#)Purpose: Header for filter functions X@(#)Author: J Leffler X@(#)Copyright: (C) JLSS 1993 X@(#)Product: :PRODUCT: X*/ X X/*TABSTOP=4*/ X X#ifndef FILTER_H X#define FILTER_H X X#ifdef MAIN_PROGRAM X#ifndef lint Xstatic char filter_h[] = "@(#)filter.h 1.2 95/07/18"; X#endif /* lint */ X#endif /* MAIN_PROGRAM */ X X#include X X#ifdef __STDC__ Xtypedef void (*Filter)(FILE *fp, char *fn); X#else Xtypedef void (*Filter)(); X#endif /* __STDC__ */ X X/* Use of ffilter is deprecated. */ X X#ifdef __STDC__ Xextern void filter(int argc, char **argv, int optnum, Filter function); Xextern void ffilter(int argc, char **argv, Filter function); X#else Xextern void filter(); Xextern void ffilter(); X#endif /* __STDC__ */ X X#endif /* FILTER_H */ SHAR-EOF chmod 444 filter.h if [ `wc -c getopt.c <<'SHAR-EOF' X/* X@(#)File: getopt.c X@(#)Version: 2.7 X@(#)Last changed: 92/06/28 X@(#)Purpose: GNU version of GETOPT(3) X@(#)Copyright: (C) 1987 Free Software Foundation, Inc. X@(#)Amendments: J Leffler, JLSS X@(#)Product: :PRODUCT: X*/ X X/*TABSTOP=4*/ X/*LINTLIBRARY*/ X X#ifndef lint Xstatic char sccs[] = "@(#)getopt.c 2.7 92/06/28"; X#endif X X/* X** Initialize optopt to avoid a loading problem on Pyramids X** X** J Leffler, JLSS, 28th June 1992. X*/ X X/* X** Function xmalloc removed -- inline code used instead. X** Changed error message to "out of memory". X** Use stdlib.h to declare malloc(). Use memmove() instead of memcpy(). X** Remove BSD bcopy and index stuff -- not POSIX compatible. X** X** J Leffler, JLSS, 15th December 1991. X*/ X X/* X** Global variable optopt added to conform with System V Release 4. X** This contains the function return value unless the return value is the X** error return '?', in which case, optopt contains the value of the option X** which caused the error return. Also use isprint() (from ctype.h) to X** determine whether character is printable (instead of the non-portable X** and not always helpful (c < 040 || c >= 0177)). X** X** J Leffler, Informix Software Ltd, 17th December 1990. X*/ X X/* X** Format of code and comments revised to suit local conventions. X** Function completely unaltered, though appended memcpy() removed. X** Default compilation changed to SYSV mode -- unless BSD is defined, X** it will be compiled using strchr and memcpy. X** X** NB: this version of getopt(3) allows for flags which take optional X** arguments. This is done by using "f::" in place of "f:" in the X** option string. The optional argument must be attached to flag. X** X** J Leffler, Sphinx Ltd, 3rd April 1990. X*/ X X/* X Getopt for GNU. X Modified by David MacKenzie to use malloc and free instead of alloca, X and memcpy instead of bcopy under System V. X Copyright (C) 1987 Free Software Foundation, Inc. X X NO WARRANTY X XBECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY XNO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT XWHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, XRICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS" XWITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, XBUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND XFITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY XAND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE XDEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR XCORRECTION. X XIN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M. XSTALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY XWHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE XLIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR XOTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE XUSE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR XDATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR XA FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS XPROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH XDAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. X X GENERAL PUBLIC LICENSE TO COPY X X 1. You may copy and distribute verbatim copies of this source file Xas you receive it, in any medium, provided that you conspicuously and Xappropriately publish on each copy a valid copyright notice "Copyright X (C) 1987 Free Software Foundation, Inc."; and include following the Xcopyright notice a verbatim copy of the above disclaimer of warranty Xand of this License. You may charge a distribution fee for the Xphysical act of transferring a copy. X X 2. You may modify your copy or copies of this source file or Xany portion of it, and copy and distribute such modifications under Xthe terms of Paragraph 1 above, provided that you also do the following: X X a) cause the modified files to carry prominent notices stating X that you changed the files and the date of any change; and X X b) cause the whole of any work that you distribute or publish, X that in whole or in part contains or is a derivative of this X program or any part thereof, to be licensed at no charge to all X third parties on terms identical to those contained in this X License Agreement (except that you may choose to grant more X extensive warranty protection to third parties, at your option). X X c) You may charge a distribution fee for the physical act of X transferring a copy, and you may at your option offer warranty X protection in exchange for a fee. X X 3. You may copy and distribute this program or any portion of it in Xcompiled, executable or object code form under the terms of Paragraphs X1 and 2 above provided that you do the following: X X a) cause each such copy to be accompanied by the X corresponding machine-readable source code, which must X be distributed under the terms of Paragraphs 1 and 2 above; or, X X b) cause each such copy to be accompanied by a X written offer, with no time limit, to give any third party X free (except for a nominal shipping charge) a machine readable X copy of the corresponding source code, to be distributed X under the terms of Paragraphs 1 and 2 above; or, X X c) in the case of a recipient of this program in compiled, executable X or object code form (without the corresponding source code) you X shall cause copies you distribute to be accompanied by a copy X of the written offer of source code which you received along X with the copy you received. X X 4. You may not copy, sublicense, distribute or transfer this program Xexcept as expressly provided under this License Agreement. Any attempt Xotherwise to copy, sublicense, distribute or transfer this program is void and Xyour rights to use the program under this License agreement shall be Xautomatically terminated. However, parties who have received computer Xsoftware programs from you with this License Agreement will not have Xtheir licenses terminated so long as such parties remain in full compliance. X X 5. If you wish to incorporate parts of this program into other free Xprograms whose distribution conditions are different, write to the Free XSoftware Foundation at 675 Mass Ave, Cambridge, MA 02139. We have not yet Xworked out a simple rule that can be stated here, but we will often permit Xthis. We will be guided by the two goals of preserving the free status of Xall derivatives of our free software and of promoting the sharing and reuse of Xsoftware. X XIn other words, you are welcome to use, share and improve this program. XYou are forbidden to forbid anyone else to use, share and improve Xwhat you give them. Help stamp out software-hoarding! X*/ X X/* 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*/ X X#include X#include X#include X#include X X/* X** optarg -- 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*/ Xchar *optarg = 0; X X/* X** optind -- 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*/ Xint optind = 0; X X/* X** nextchar -- 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*/ Xstatic char *nextchar; X X/* X** opterr -- callers store zero here to inhibit the error message X** for unrecognized options. X*/ Xint opterr = 1; X X/* X** optopt -- copy of option which was detected. It is the same as the X** function return value unless the function returns '?' (for an invalid X** option) when optopt contains the actual flag which caused the error. X** Added in conformity with UNIX System V Release 4. X*/ Xint optopt = '0'; X X/* X** Describe how to deal with options that follow non-option ARGV-elements. X** X** UNSPECIFIED means the caller did not specify anything; X** the default is then 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 zero. 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*/ Xstatic enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; X X/* Handle permutation of arguments. */ X X/* 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*/ Xstatic int first_nonopt; Xstatic int last_nonopt; X X/* 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** `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*/ X Xstatic void exchange(argv) Xchar **argv; X{ X int nonopts_size = (last_nonopt - first_nonopt) * sizeof(char *); X char **temp; X X if ((temp = (char **)malloc(nonopts_size)) == (char **)0) X { X fprintf(stderr, "out of memory\n"); X exit(1); X } X X /* Interchange the two blocks of data in argv. */ X memmove(temp, &argv[first_nonopt], nonopts_size); X memmove(&argv[first_nonopt], &argv[last_nonopt], X (optind - last_nonopt) * sizeof(char *)); X memmove(&argv[first_nonopt + optind - last_nonopt], temp, nonopts_size); X X free(temp); X X /* Update records for the slots the non-options now occupy. */ X first_nonopt += (optind - last_nonopt); X last_nonopt = optind; X} X X/* 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** A colon in OPTSTRING means that the previous character is an option X** that wants an argument. The argument is taken from the rest of the X** current ARGV-element, or from the following ARGV-element, X** and returned in `optarg'. X** 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'. 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 Xint getopt(argc, argv, optstring) Xint argc; Xchar **argv; Xchar *optstring; X{ X X if (optind == 0) X { 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 first_nonopt = last_nonopt = optind = 1; X nextchar = 0; X X /* Determine how to handle the ordering of options and nonoptions. */ 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 /* X ** If we have just processed some options following some X ** non-options, 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 /* X ** Now skip any additional non-options and extend X ** the range of non-options previously skipped. X */ X while (optind < argc && X (argv[optind][0] != '-' || argv[optind][1] == 0)) X optind++; X last_nonopt = optind; X } X X /* X ** Special ARGV-element `--' means premature end of options. X ** Skip it like a null option, then exchange with previous X ** non-options as if it were an option, then skip everything else X ** 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 /* 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 /* X ** Set the next-arg-index to point at the non-options X ** that we previously skipped, so the caller will digest them. X */ X if (first_nonopt != last_nonopt) X optind = first_nonopt; X return EOF; X } 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 { X if (ordering == REQUIRE_ORDER) X return EOF; X optarg = argv[optind++]; X return 0; X } X X /* X ** We have found another option-ARGV-element. X ** Start decoding its characters. X */ X nextchar = argv[optind] + 1; X } X X /* Look at and handle the next option-character. */ X { X char c = *nextchar++; X char *temp = strchr(optstring, c); X X /* Set optopt */ X optopt = 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 (!isprint(c)) 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 /* X ** If we end this ARGV-element by taking the rest as X ** an arg, we must advance to the next element now. X */ X optind++; X } X else if (optind == argc) X { X if (opterr != 0) X fprintf(stderr, "%s: no argument for `-%c' option\n", X argv[0], c); X c = '?'; X } X else X { X /* X ** We already incremented `optind' once; increment it X ** again when taking next ARGV-elt as argument. X */ X optarg = argv[optind++]; X } X nextchar = 0; X } X } X return c; X } X} SHAR-EOF chmod 444 getopt.c if [ `wc -c getopt.h <<'SHAR-EOF' X/* X@(#)File: getopt.h X@(#)Version: 1.4 X@(#)Last changed: 93/06/29 X@(#)Purpose: Definitions for GETOPT(3) and GETSUBOPT(3) (SVR4 compatible) X@(#)Author: J Leffler X@(#)Copyright: JLSS (C) 1992 X@(#)Product: :PRODUCT: X*/ X X#ifndef GETOPT_H X#define GETOPT_H X Xextern int optopt; Xextern int opterr; Xextern int optind; Xextern char *optarg; X X#ifdef NO_PROTOTYPES Xextern int getopt(); Xextern int getsubopt(); X#else Xextern int getopt(int argc, char **argv, char *opts); Xextern int getsubopt(char **opt, char **names, char **value); X#endif /* NO_PROTOTYPES */ X X#endif /* GETOPT_H */ SHAR-EOF chmod 444 getopt.h if [ `wc -c ldint.c <<'SHAR-EOF' X/* X@(#)File: ldint.c X@(#)Version: 1.4 X@(#)Last changed: 91/12/22 X@(#)Purpose: C-ISAM style LDINT(3) X@(#)Author: J Leffler X@(#)Product: :PRODUCT: X*/ X X/*TABSTOP=4*/ X/*LINTLIBRARY*/ X X#ifndef lint Xstatic char sccs[] = "@(#)ldint.c 1.4 91/12/22"; X#endif X Xtypedef unsigned short ushort; X X/* X** Convert 2-byte character array into real short integer X** Works on both 680x0 and 80x86 type machines. X** Slows 680x0 type machines up as it is then a no-op. X*/ Xint ldint(s) Xregister char *s; X{ X register int i; X register ushort j; X X for (i = j = 0; i < 2; i++) X { X j = (j << 8) | (*s++ & 0xFF); X } X return(j); X} X X#ifdef TEST X X#include X X#define DIM(x) (sizeof(x)/sizeof(*(x))) X Xchar values[][2] = X{ X "\002\003", X "\017\017" X}; X Xmain() X{ X int i; X X for (i = 0; i < DIM(values); i++) X printf("0x%02X%02X => 0x%04X\n", X (unsigned char)values[i][0], (unsigned char)values[i][1], X ldint(values[i])); X return(0); X} X X#endif /* TEST */ SHAR-EOF chmod 444 ldint.c if [ `wc -c ldlong.c <<'SHAR-EOF' X/* X@(#)File: ldlong.c X@(#)Version: 1.2 X@(#)Last changed: 91/12/22 X@(#)Purpose: C-ISAM style LDLONG(3) X@(#)Author: J Leffler X@(#)Product: :PRODUCT: X*/ X X/*TABSTOP=4*/ X/*LINTLIBRARY*/ X X#ifndef lint Xstatic char sccs[] = "@(#)ldlong.c 1.2 91/12/22"; X#endif X Xtypedef unsigned long ulong; X X/* X** Convert 4-byte character array into real long integer. X** Works on both 680x0 and 80x86 type machines. X** Slows 680x0 type machines up as it is then a no-op. X*/ Xulong ldlong(s) Xregister char *s; X{ X register int i; X register ulong j; X X for (i = j = 0; i < 4; i++) X { X j = (j << 8) | (*s++ & 0xFF); X } X return(j); X} X X#ifdef TEST X X#include X X#define DIM(x) (sizeof(x)/sizeof(*(x))) X Xchar values[][4] = X{ X "\001\002\003\004", X "\127\147\167\377" X}; X Xmain() X{ X int i; X X for (i = 0; i < DIM(values); i++) X printf("0x%02X%02X%02X%02X => 0x%08X\n", X (unsigned char)values[i][0], (unsigned char)values[i][1], X (unsigned char)values[i][2], (unsigned char)values[i][3], X ldlong(values[i])); X return(0); X} X X#endif /* TEST */ SHAR-EOF chmod 444 ldlong.c if [ `wc -c listiem.c <<'SHAR-EOF' X/* X@(#)File: listiem.c X@(#)Version: 2.1 X@(#)Last changed: 95/06/20 X@(#)Purpose: Print contents of Informix Error Message File X@(#)Author: J Leffler X*/ X X/*TABSTOP=4*/ X X/* Untested on 64-bit machines, but it stands some chance of working. */ X X/* -- Include Files */ X X#include X#include X#include X#include "stderr.h" X#include "getopt.h" X#include "filter.h" X X/* -- Constant Definitions */ X X#define MAGIC1 (0xFE68) /* Short error numbers (Pre-5.00) */ X#define MAGIC2 (0xFE69) /* Long error numbers (Post-5.00) */ X#define SIZEOF_INT2 2 X#define SIZEOF_INT4 4 X#define M1_ENTSIZE (2 * SIZEOF_INT2 + 1 * SIZEOF_INT4) X#define M2_ENTSIZE (1 * SIZEOF_INT2 + 2 * SIZEOF_INT4) X#define MAXBUFF 4096 X X/* -- Type Definitions */ X Xtypedef unsigned short Ushort; Xtypedef unsigned long Ulong; X X/* Unified description of error entry */ Xstruct Entry X{ X long err_number; X Ushort err_length; X Ulong err_seek; X}; Xtypedef struct Entry Entry; X X/* -- Declarations */ X Xstatic int oneline = 0; Xstatic int debug = 0; X X#if !defined(lint) Xstatic char sccs[] = "@(#)listiem.c 2.1 95/06/20"; X#endif X X/* X** For 80386 (and 80x86) chips; the numbers are stored on disc X** in a funny (non-natural) order. X** The data is stored in this order: X** If a 2-byte number is read into a character array c, X** c[0] = MSB c[1] = LSB X** If a 4-byte number is read into a character array c, X** c[0] = MSB c[1] = NMSB c[2] = NLSB c[3] = LSB X** The routines int2() and int4() are used to unpack numbers stored in the X** database and work on both 80x86 and 680x0 chips (and others too). X*/ X X/* Unpack long integer */ Xstatic Ulong int4(char *s) X{ X int i; X Ulong j; X X for (i = j = 0; i < SIZEOF_INT4; i++) X { X j = (j << 8) | (*s++ & 0xFF); X } X return(j); X} X X/* Unpack short integer */ Xstatic Ushort int2(char *s) X{ X int i; X Ushort j; X X for (i = j = 0; i < SIZEOF_INT2; i++) X { X j = (j << 8) | (*s++ & 0xFF); X } X return(j); X} X X/* Convert the MAGIC1 header to MAGIC2; the cast is necessary */ Xstatic void read_0xFE68(char *buffer, Entry *ent) X{ X Ushort s; X X s = int2(&buffer[0]); X ent->err_number = (short)s; X ent->err_length = int2(&buffer[SIZEOF_INT2]); X ent->err_seek = int4(&buffer[2 * SIZEOF_INT2]); X} X Xstatic void read_0xFE69(char *buffer, Entry *ent) X{ X ent->err_number = (long)int4(&buffer[0]); X ent->err_length = int2(&buffer[SIZEOF_INT4]); X ent->err_seek = int4(&buffer[SIZEOF_INT4 + SIZEOF_INT2]); X} X X/* Expand '\n' into "\\n" */ Xstatic Ulong massage(char *buff, int len) X{ X char *src; X char *dst; X char *end; X char *s; X X end = buff + len; X s = buff; X while (*s) X { X if (*s == '\n') X { /* Grotesquely inefficient if many newlines */ X src = end; X dst = end + 1; X while (src > s) X *dst-- = *src--; X end++; X *s++ = '\\'; X *s = 'n'; X } X s++; X } X return(end - buff); X} X Xstatic void process_file(FILE *fp, char *fname, Ulong ent_size, X void (*function)(char *buffer, Entry *ent)) X{ X Ulong i; X Entry ent; X Ulong n_entries; X char buffer[MAXBUFF]; X X if (fread(buffer, SIZEOF_INT2, 1, fp) == EOF) X error2(fname, "not a .iem file"); X n_entries = int2(&buffer[0]); X X printf("# Error file: %s\n", fname); X if (debug) X printf("# Number of messages: %ld\n", n_entries); X fflush(stdout); X for (i = 0; i < n_entries; i++) X { X errno = 0; X fseek(fp, (long)(2 * SIZEOF_INT2 + i * ent_size), SEEK_SET); X if (errno == ESPIPE) X { X remark2("cannot seek on file", fname); X return; /* Seek on a pipe? */ X } X fread(buffer, ent_size, 1, fp); X (*function)(buffer, &ent); X X if (debug) X printf("# Entry %4ld: MsgNum %6ld: Length %4d Offset 0x%08lX\n", X i, ent.err_number, ent.err_length, ent.err_seek); X fseek(fp, ent.err_seek, SEEK_SET); X if (ent.err_length > MAXBUFF) X ent.err_length = MAXBUFF; X fread(buffer, ent.err_length, 1, fp); X buffer[ent.err_length] = '\0'; X if (oneline) X ent.err_length = massage(buffer, ent.err_length); X if (buffer[ent.err_length - 1] != '\n') X { X buffer[ent.err_length] = '\n'; X buffer[++ent.err_length] = '\0'; X } X if (oneline) X printf("%ld: %s", ent.err_number, buffer); X else X printf(".%ld\n%s", ent.err_number, buffer); X } X} X X/* Process one error file -- possibly standard input */ Xstatic void iem_to_msg(fp, fname) XFILE *fp; Xchar *fname; X{ X Ushort magic; X char header[SIZEOF_INT2]; X X if (fread(header, sizeof(header), 1, fp) == EOF) X error2(fname, "not a .iem file"); X magic = int2(&header[0]); X if (magic != MAGIC1 && magic != MAGIC2) X error2(fname, "not a .iem file"); X X if (magic == MAGIC1) X process_file(fp, fname, M1_ENTSIZE, read_0xFE68); X else X { X assert(magic == MAGIC2); X process_file(fp, fname, M2_ENTSIZE, read_0xFE69); X } X} X Xint main(int argc, char **argv) X{ X int opt; X X /* Test machine assumptions -- not ANSI C if assertions fire */ X assert(SIZEOF_INT2 <= sizeof(Ushort)); X assert(SIZEOF_INT4 <= sizeof(Ulong)); X X setarg0(argv[0]); X X /* Process optional arguments */ X opterr = 0; X while ((opt = getopt(argc, argv, "ld")) != EOF) X { X switch (opt) X { X case 'l': X oneline = 1; X break; X case 'd': X debug = 1; X break; X default: X usage("[-ld] [messagefile ...]"); X break; X } X } X X if (debug && oneline) X { X fprintf(stderr, "Option -d overrides option -l\n"); X oneline = 0; X } X X /* Process the files -- standard input must be seekable */ X filter(argc, argv, optind, iem_to_msg); X X return(0); X} SHAR-EOF chmod 444 listiem.c if [ `wc -c makefile <<'SHAR-EOF' XLISTIEM.c = ffilter.c getopt.c listiem.c stderr.c XLISTIEM.o = ${LISTIEM.c:.c=.o} XAUXLIB.c = ldint.c ldlong.c XAUXLIB.o = ${AUXLIB.c:.c=.o} XMSGTEXT.c = msgtext.c XMSGTEXT.o = ${MSGTEXT.c:.c=.o} XDEPFILES.c = ${LISTIEM.c} ${MSGTEXT.c} X XLIBRARIES = XCFLAGS = -O #-Xc -v X Xall: listiem msgtext.o X Xlistiem: ${LISTIEM.o} X ${CC} -o $@ ${LDFLAGS} ${LISTIEM.o} ${LIBRARIES} X Xdepend: ${DEPFILES.c} X mkdep ${DEPFILES.c} X X# DO NOT DELETE THIS LINE.... X Xffilter.o: ffilter.c filter.h stderr.h Xgetopt.o: getopt.c Xlistiem.o: filter.h getopt.h listiem.c stderr.h Xmsgtext.o: msgtext.c Xstderr.o: stderr.c stderr.h SHAR-EOF chmod 664 makefile if [ `wc -c msgtext.c <<'SHAR-EOF' X/* X@(#)File: msgtext.c X@(#)Version: 2.4 X@(#)Last changed: 91/11/02 X@(#)Purpose: Open, Read, Close Informix Error Message Files X@(#)Author: J Leffler X*/ X X/* -- Include Files */ X X#include X#include X X/* -- Constant Definitions */ X X#define I4GL_C int /* C callable from I4GL */ X#define MAGIC1 ((ushort)0xFE68) X#define MAXBUFF 4096 X#define NIL(x) ((x)0) X X/* -- Type Definitions */ X Xtypedef unsigned short ushort; Xtypedef unsigned long ulong; X Xtypedef struct X{ X ushort magic; X short n_entries; X} Header; X Xtypedef struct X{ X short err_number; X short err_length; X long err_seek; X} Entry; X X/* -- Declarations */ X Xstatic char buff[MAXBUFF]; Xstatic char header[sizeof(Header)]; Xstatic char entry[sizeof(Entry)]; Xstatic Header hdr; Xstatic FILE *fp; Xstatic Entry *elist; X Xextern char *malloc(); Xextern void free(); X X#if !defined(lint) Xstatic char sccs[] = "@(#)msgtext.c 2.4 91/11/02"; X#endif X X/* Close an already open error message file */ X/* Does not fail if no file open */ Xvoid iem_close() X{ X if (fp != NIL(FILE *)) X { X fclose(fp); X if (elist != NIL(Entry *)) X free(elist); X elist = NIL(Entry *); X fp = NIL(FILE *); X } X} X Xint iem_open(fname) Xchar *fname; X{ X iem_close(); X if ((fp = fopen(fname, "r")) == NIL(FILE *)) X return (-1); X if (fread(header, sizeof(header), 1, fp) == EOF) X return (-1); X hdr.magic = ldint(&header[0]); X hdr.n_entries = ldint(&header[2]); X#ifdef DEBUG X fprintf(stderr, "Magic: %04X; entries = %d\n", hdr.magic, hdr.n_entries); X#endif /* DEBUG */ X if (hdr.magic != MAGIC1) X return (-1); X return (0); X} X X/* Compare two error message entries */ Xstatic int iem_comp(cp1, cp2) Xchar *cp1; Xchar *cp2; X{ X register Entry *ep1 = (Entry *) cp1; X register Entry *ep2 = (Entry *) cp2; X X return (ep1->err_number - ep2->err_number); X} X Xchar *iem_read(msg) Xint msg; X{ X Entry hunt; X Entry *ent; X char *entry; X long org_seek; X int i; X int n; X X if (elist == NIL(Entry *)) X { X /* Read array of message headers into memory */ X n = hdr.n_entries; X if ((elist = (Entry *) malloc(n * sizeof(Entry))) == NIL(Entry *)) X return(NIL(char *)); X if (fread((char *) elist, sizeof(Entry), n, fp) != n) X { X /* Failed to read header records */ X free(elist); X elist = NIL(Entry *); X return (NIL(char *)); X } X /* Convert numbers from canonical form to host form */ X for (i = 0; i < n; i++) X { X ent = &elist[i]; X entry = (char *) ent; X ent->err_number = ldint(&entry[0]); X ent->err_length = ldint(&entry[2]); X ent->err_seek = ldlong(&entry[4]); X } X } X X hunt.err_number = msg; X ent = (Entry *) bsearch((char *) &hunt, (char *) elist, hdr.n_entries, X sizeof(Entry), iem_comp); X X if (ent == NIL(Entry *)) X return (NIL(char *)); X else X { X#ifdef DEBUG X fprintf(stderr, "%4d: %6d: %4d @ 0x%08X\n", msg, ent->err_number, X ent->err_length, ent->err_seek); X#endif /* DEBUG */ X fseek(fp, ent->err_seek, 0); X if (ent->err_length > MAXBUFF) X ent->err_length = MAXBUFF - 1; X if (fread(buff, ent->err_length, 1, fp) != 1) X return (NIL(char *)); X buff[ent->err_length] = '\0'; X if (buff[ent->err_length - 1] == '\n') X buff[ent->err_length - 1] = '\0'; X } X return (buff); X} X X/* I4GL calling sequence: LET i = fgl_msgopen(msgfile) */ X/* (i = 0 => OK; i = -1 => fail) */ X/* I4GL calling sequence: LET s = fgl_msgread(msgnum) */ X/* I4GL calling sequence: CALL fgl_msgclose() */ X XI4GL_C fgl_msgopen(n) Xint n; X{ X char msgfile[512]; X int r; X X if (n != 1) X r = -1; X else X { X popstring(msgfile, sizeof(msgfile)); X r = iem_open(msgfile); X } X retint(r); X return (1); X} X XI4GL_C fgl_msgread(n) Xint n; X{ X char *s; X int msgnum; X char buffer[50]; X X if (n != 1) X s = ""; X else X { X popint(&msgnum); X if ((s = iem_read(msgnum)) == NIL(char *)) X { X sprintf(buffer, "<>", msgnum); X s = buffer; X } X } X retquote(s); X return (1); X} X X/* ARGSUSED */ XI4GL_C fgl_msgclose(n) Xint n; X{ X iem_close(); X return (0); X} X X#ifdef TEST X Xmain(argc, argv) Xint argc; Xchar **argv; X{ X int i; X int n; X char *s; X X if (argc <= 2) X { X fprintf(stderr, "Usage: %s iemfile msg [...]\n", argv[0]); X exit(1); X } X X if (iem_open(argv[1]) != 0) X { X fprintf(stderr, "%s: failed to open message file %s\n", argv[0], argv[1]); X exit(1); X } X X for (i = 2; i < argc; i++) X { X n = atoi(argv[i]); X s = iem_read(n); X if (s != NIL(char *)) X printf("%d: %s\n", n, s); X else X printf("%d: \n", n); X } X X iem_close(); X return (0); X} X X#endif /* TEST */ SHAR-EOF chmod 444 msgtext.c if [ `wc -c stderr.c <<'SHAR-EOF' X/* X@(#)File: stderr.c X@(#)Version: 6.2 X@(#)Last changed: 91/12/22 X@(#)Purpose: Error reporting routines -- using stdio X@(#)Author: J Leffler X@(#)Copyright: (C) JLSS 1991 X@(#)Product: :PRODUCT: X*/ X X/*TABSTOP=4*/ X/*LINTLIBRARY*/ X X#include X#include X#include X X#include "stderr.h" X X#ifdef __STDC__ X#include X#else X#include X#endif /* __STDC__ */ X X#define global /* Defined here -- accessible elsewhere */ X#define NIL(x) ((x)0) X#define MAX_CLEANUPS 32 /* Same as Standard C for atexit */ X Xstatic void (*cleanuplist[MAX_CLEANUPS])(); Xstatic int n_cleanups = 0; Xstatic char _arg0[15] = "**undefined**"; /* Actual string */ Xglobal char *arg0 = _arg0; /* Name of command */ X X#ifndef lint Xstatic char sccs[] = "@(#)stderr.c 6.2 91/12/22"; X#endif /* lint */ X Xvoid err_setcleanup(p) Xvoid (*p)(); X{ X if (n_cleanups < MAX_CLEANUPS) X cleanuplist[n_cleanups++] = p; X} X Xvoid remark2(s1, s2) Xchar *s1; /* In: First error message string */ Xchar *s2; /* In: Second error message string */ X{ X err_report(ERR_REM, ERR_STAT, "%s %s\n", (s1), (s2)); X} X Xvoid remark(s1) Xchar *s1; /* In: Error message */ X{ X err_report(ERR_REM, ERR_STAT, "%s\n", (s1)); X} X Xvoid error2(s1, s2) Xchar *s1; /* In: First error message string */ Xchar *s2; /* In: Second error message string */ X{ X err_report(ERR_ERR, ERR_STAT, "%s %s\n", (s1), (s2)); X} X Xvoid error(s1) Xchar *s1; /* In: Error message */ X{ X err_report(ERR_ERR, ERR_STAT, "%s\n", (s1)); X} X Xvoid stop(s1) Xchar *s1; /* In: Error message */ X{ X err_report(ERR_ABT, ERR_STAT, "%s\n", (s1)); X} X Xvoid usage(s1) Xchar *s1; /* In: Usage message */ X{ X err_report(ERR_USE, ERR_STAT, (s1)); X} X Xvoid setarg0(s) Xchar *s; /* In: argv[0] */ X{ X char *cp; X X while ((cp = strrchr(s, '/')) != NIL(char *) &&*(cp + 1) == '\0') X *cp = '\0'; X (void)strncpy(_arg0, ((cp == NIL(char *)) ? s : cp + 1), 14); X} X X/* VARARGS */ X#ifdef __STDC__ Xvoid err_report(int flags, int estat, char *string,...) X#else Xvoid err_report(va_alist) Xva_dcl X#endif /* __STDC__ */ X{ X int i; X va_list args; X X#ifndef __STDC__ X int flags; X int estat; X char *string; X X va_start(args); X flags = va_arg(args, int); X estat = va_arg(args, int); X string = va_arg(args, char *); X#else X va_start(args, string); X#endif /* __STDC__ */ X X if (flags & ERR_FLUSH) X (void)fflush(stdout); X if (flags & ERR_USAGE) X (void)fprintf(stderr, "Usage: %s %s\n", arg0, string); X else if (flags & ERR_COMM) X { X (void)fprintf(stderr, "%s: ", arg0); X (void)vfprintf(stderr, string, args); X } X if (flags & ERR_ABORT) X abort(); X if (flags & ERR_EXIT) X { X for (i = 0; i < n_cleanups; i++) X (*cleanuplist[i])(); X exit(estat); X } X} SHAR-EOF chmod 444 stderr.c if [ `wc -c stderr.h <<'SHAR-EOF' X/* X@(#)File: stderr.h X@(#)Version: 6.3 X@(#)Last changed: 93/06/29 X@(#)Purpose: Header file for standard error functions X@(#)Author: J Leffler X@(#)Copyright: (C) JLSS 1989-92 X@(#)Product: :PRODUCT: X*/ X X#ifndef STDERR_H X#define STDERR_H X X#ifdef MAIN_PROGRAM X#ifndef lint Xstatic char stderr_h[] = "@(#)stderr.h 6.3 93/06/29"; X#endif X#endif X X/* -- Definitions for error handling */ X X#define ERR_STAT (1) /* Default exit status */ X X#define ERR_COMM (0x01) /* Print message on stderr */ X#define ERR_USAGE (0x02) /* Print usage on stderr */ X#define ERR_EXIT (0x04) /* Exit -- do not return */ X#define ERR_ABORT (0x08) /* Abort -- do not return */ X#define ERR_FLUSH (0x10) /* Flush stdout */ X X/* -- Standard combinations of flags */ X X#define ERR_USE (ERR_USAGE|ERR_EXIT|ERR_FLUSH) X#define ERR_REM (ERR_COMM|ERR_FLUSH) X#define ERR_ERR (ERR_COMM|ERR_EXIT|ERR_FLUSH) X#define ERR_ABT (ERR_COMM|ERR_ABORT|ERR_FLUSH) X X/* -- Global definitions */ X Xextern char *arg0; X X#ifdef __STDC__ X Xextern void err_report(int flags, int estat, char *string, ...); Xextern void err_setcleanup(void (*func)()); Xextern void error(char *s1); Xextern void error2(char *s1, char *s2); Xextern void remark(char *s1); Xextern void remark2(char *s1, char *s2); Xextern void setarg0(char *argv0); Xextern void stop(char *s1); Xextern void usage(char *s1); X X#else X X/* VARARGS */ Xextern void err_report(); Xextern void err_setcleanup(); Xextern void error(); Xextern void error2(); Xextern void remark(); Xextern void remark2(); Xextern void setarg0(); Xextern void stop(); Xextern void usage(); X X#endif /* __STDC__ */ X X#endif /* STDERR_H */ SHAR-EOF chmod 444 stderr.h if [ `wc -c