[comp.sources.x] v10i074: Info Widget, Part01/02

jkh@meepmeep.pcs.com (Jordan K. Hubbard) (11/16/90)

Submitted-by: jkh@meepmeep.pcs.com (Jordan K. Hubbard)
Posting-number: Volume 10, Issue 74
Archive-name: infow/part01

Well, here it is in its entirety one last time. The patch files were larger
than a new release, so I'm just releasing it all again. This is also
the first "production" release; the two previous releases were beta.

I'm always interested to hear what uses are made of this, so drop me
a line if you work it into an actual application.

		Jordan
		jkh@meepmeep.pcs.com (Jordan K. Hubbard)

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 2)."
# Contents:  COPYING Imakefile Info.h InfoP.h NOTES README XInfo.ad
#   xinfo.bm xinfo.c
# Wrapped by jkh@meepmeep on Mon Nov 12 18:08:32 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'COPYING' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'COPYING'\"
else
echo shar: Extracting \"'COPYING'\" \(12488 characters\)
sed "s/^X//" >'COPYING' <<'END_OF_FILE'
X
X		    GNU GENERAL PUBLIC LICENSE
X		     Version 1, February 1989
X
X Copyright (C) 1989 Free Software Foundation, Inc.
X                    675 Mass Ave, Cambridge, MA 02139, USA
X Everyone is permitted to copy and distribute verbatim copies
X of this license document, but changing it is not allowed.
X
X			    Preamble
X
X  The license agreements of most software companies try to keep users
at the mercy of those companies.  By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.
X
X  When we speak of free software, we are referring to freedom, not
price.  Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.
X
X  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
X
X  For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must tell them their rights.
X
X  We protect your rights with two steps: (1) copyright the software, and
X(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
X
X  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
X
X  The precise terms and conditions for copying, distribution and
modification follow.
X
X		    GNU GENERAL PUBLIC LICENSE
X   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
X
X  0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License.  The
X"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications.  Each
licensee is addressed as "you".
X
X  1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program.  You may charge a fee for the physical act of
transferring a copy.
X
X  2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
X1 above, provided that you also do the following:
X
X    a) cause the modified files to carry prominent notices stating that
X    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, that
X    in whole or in part contains the Program or any part thereof, either
X    with or without modifications, to be licensed at no charge to all
X    third parties under the terms of this General Public License (except
X    that you may choose to grant warranty protection to some or all
X    third parties, at your option).
X
X    c) If the modified program normally reads commands interactively when
X    run, you must cause it, when started running for such interactive use
X    in the simplest and most usual way, to print or display an
X    announcement including an appropriate copyright notice and a notice
X    that there is no warranty (or else, saying that you provide a
X    warranty) and that users may redistribute the program under these
X    conditions, and telling the user how to view a copy of this General
X    Public License.
X
X    d) You may charge a fee for the physical act of transferring a
X    copy, and you may at your option offer warranty protection in
X    exchange for a fee.
X
Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.
X
X  3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:
X
X    a) accompany it with the complete corresponding machine-readable
X    source code, which must be distributed under the terms of
X    Paragraphs 1 and 2 above; or,
X
X    b) accompany it with a written offer, valid for at least three
X    years, to give any third party free (except for a nominal charge
X    for the cost of distribution) a complete machine-readable copy of the
X    corresponding source code, to be distributed under the terms of
X    Paragraphs 1 and 2 above; or,
X
X    c) accompany it with the information you received as to where the
X    corresponding source code may be obtained.  (This alternative is
X    allowed only for noncommercial distribution and only if you
X    received the program in object code or executable form alone.)
X
Source code for a work means the preferred form of the work for making
modifications to it.  For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.
X
X  4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License.  However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.
X
X  5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.
X
X  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions.  You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.
X
X  7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
X
XEach version is given a distinguishing version number.  If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
XFoundation.
X
X  8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
X
X			    NO WARRANTY
X
X  9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
XFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
X
X  10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
X
X		     END OF TERMS AND CONDITIONS
X
X	Appendix: How to Apply These Terms to Your New Programs
X
X  If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
X
X  To do so, attach the following notices to the program.  It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
X"copyright" line and a pointer to where the full notice is found.
X
X    <one line to give the program's name and a brief idea of what it does.>
X    Copyright (C) 19yy  <name of author>
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
Also add information on how to contact you by electronic and paper mail.
X
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
X
X    Gnomovision version 69, Copyright (C) 19xx name of author
X    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
X    This is free software, and you are welcome to redistribute it
X    under certain conditions; type `show c' for details.
X
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License.  Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
X
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here a sample; alter the names:
X
X  Yoyodyne, Inc., hereby disclaims all copyright interest in the
X  program `Gnomovision' (a program to direct compilers to make passes
X  at assemblers) written by James Hacker.
X
X  <signature of Ty Coon>, 1 April 1989
X  Ty Coon, President of Vice
X
That's all there is to it!
END_OF_FILE
if test 12488 -ne `wc -c <'COPYING'`; then
    echo shar: \"'COPYING'\" unpacked with wrong size!
fi
# end of 'COPYING'
fi
if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Imakefile'\"
else
echo shar: Extracting \"'Imakefile'\" \(319 characters\)
sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
X   INSTALLFLAGS = $(INSTBINFLAGS)
X       INCLUDES = -I$(TOP) -I$(TOP)/X11 -I/usr/include/bsd
X  SYS_LIBRARIES = -lm
LOCAL_LIBRARIES = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
X
CDEBUGFLAGS = -g
X
SRCS=  xinfo.c Info.c
OBJS=  xinfo.o Info.o
X
ComplexProgramTarget(xinfo)
X
install::
X	cp xinfo.ad XAppLoadDir/XInfo
END_OF_FILE
if test 319 -ne `wc -c <'Imakefile'`; then
    echo shar: \"'Imakefile'\" unpacked with wrong size!
fi
# end of 'Imakefile'
fi
if test -f 'Info.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Info.h'\"
else
echo shar: Extracting \"'Info.h'\" \(2827 characters\)
sed "s/^X//" >'Info.h' <<'END_OF_FILE'
X#ifndef _Info_h
X#define _Info_h
X
X/* $Header: /usr3/xinfo/RCS/Info.h,v 1.4 90/11/12 13:49:47 jkh Exp $ */
X
X/*
X *
X *                   Copyright 1989, 1990
X *                    Jordan K. Hubbard
X *
X *                PCS Computer Systeme, GmbH.
X *                   Munich, West Germany
X *
X *
X * This file is part of GNU Info widget.
X *
X * The GNU Info widget is free software; you can redistribute it and/or
X * modify it under the terms of the GNU General Public License as published
X * by the Free Software Foundation; either version 1, or (at your option)
X * any later version.
X *
X * This software 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 software; see the file COPYING.  If not, write to
X * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
X *
X *
X */
X
X/*
X * $Log:	Info.h,v $
X * Revision 1.4  90/11/12  13:49:47  jkh
X * Fixed bell_volume misspecification.
X * 
X * Revision 1.3  90/11/11  22:25:14  jkh
X * Added retainArg stuff.
X * 
X * Revision 1.2  90/11/11  21:19:53  jkh
X * Release 1.01
X * 
X * Revision 1.1  90/11/06  22:51:15  jkh
X * Initial revision.
X * 
X */
X
X/*
X * Resources:
X *
X * Name			Class		RepType		Default Value
X * ----			-----		-------		-------------
X * bellVolume		BellVolume	Int		XpDefaultBellVolume
X * callback             Callback        XtCallbackList  NULL
X * infoFile		InfoFile	String		XpDefaultInfoFile
X * infoNode		InfoNode	String		XpDefaultInfoNode
X * infoPath		InfoPath	String		XpDefaultInfoPath
X * printCommand		PrintCommand	String		XpDefaultPrintCommand
X * retainArg		RetainArg	Boolean		FALSE
X *
X */
X
X/* resource types */
X#define XpDefaultBellVolume	50
X#define XpDefaultInfoFile	"dir"
X#define XpDefaultInfoNode	"Top"
X#define XpDefaultInfoPath	"/usr/gnu/lib/emacs/info:/usr/local/lib/emacs/info:/usr/gnu/lib/info"
X#define XpDefaultPrintCommand	"lpr -p"
X
X#define XpNbellVolume		"bellVolume"
X#define XpNinfoFile		"infoFile"
X#define XpNinfoHelp		"infoHelp"
X#define XpNinfoNode		"infoNode"
X#define XpNinfoPath		"infoPath"
X#define XpNprintCommand		"printCommand"
X#define XpNretainArg		"retainArg"
X
X#define XpCBellVolume		"BellVolume"
X#define XpCInfoFile		"InfoFile"
X#define XpCInfoHelp		"InfoHelp"
X#define XpCInfoNode		"InfoNode"
X#define XpCInfoPath		"InfoPath"
X#define XpCPrintCommand		"PrintCommand"
X#define XpCRetainArg		"RetainArg"
X
X#define XpInfoVersion		1.01
X
X/* declare specific InfoWidget class and instance datatypes */
typedef struct _InfoClassRec*		InfoWidgetClass;
typedef struct _InfoRec*		InfoWidget;
X
X/* declare the class constant */
extern WidgetClass infoWidgetClass;
X
X#endif /* _Info_h */
END_OF_FILE
if test 2827 -ne `wc -c <'Info.h'`; then
    echo shar: \"'Info.h'\" unpacked with wrong size!
fi
# end of 'Info.h'
fi
if test -f 'InfoP.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'InfoP.h'\"
else
echo shar: Extracting \"'InfoP.h'\" \(9059 characters\)
sed "s/^X//" >'InfoP.h' <<'END_OF_FILE'
X#ifndef _InfoP_h
X#define _InfoP_h
X
X/* $Header: /usr3/xinfo/RCS/InfoP.h,v 1.3 90/11/12 18:07:21 jkh Exp $ */
X
X/*
X *
X *                   Copyright 1989, 1990
X *                    Jordan K. Hubbard
X *
X *                PCS Computer Systeme, GmbH.
X *                   Munich, West Germany
X *
X *
X * This file is part of GNU Info widget.
X *
X * The GNU Info widget is free software; you can redistribute it and/or
X * modify it under the terms of the GNU General Public License as published
X * by the Free Software Foundation; either version 1, or (at your option)
X * any later version.
X *
X * This software 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 software; see the file COPYING.  If not, write to
X * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
X *
X *
X */
X
X/*
X * $Log:	InfoP.h,v $
X * Revision 1.3  90/11/12  18:07:21  jkh
X * Added SET_BLOCK method for initializing text blocks.
X * 
X * Revision 1.2  90/11/11  22:24:27  jkh
X * Added retain_arg
X * 
X * Revision 1.1  90/11/11  21:20:02  jkh
X * Initial revision
X * 
X */
X
X#include <X11/IntrinsicP.h>
X#include <X11/CoreP.h>
X
X#include "Info.h"
X
X/* max length of argument string */
X#define ARGLEN		128
X
X/* max generic string size */
X#define MAXSTR		128
X
X/* if no max pathlen, define arbitrarily */
X#ifndef MAXPATHLEN
X#define MAXPATHLEN	512
X#endif
X
X/* More explanatory macro names */
X#define Export
X#define Import	extern
X#define Local	static
X#ifdef __GNUC__
X#define Inline inline
X#else
X#define Inline
X#endif
X
X/* If we couldn't find it anywhere, make it up */
X#ifndef R_OK
X#define R_OK	04
X#endif
X
X/* Convenience macro for setting text blocks */
X#define SET_BLOCK(blk, start, end, string) \
X	(blk).firstPos = (start), (blk).length = (end), \
X	(blk).ptr = (string), (blk).format = FMT8BIT
X
X/* number of inits to bump tables up by during allocation */
X#define TABLE_INC	50
X
X/* special INFO separator character */
X#define INFO_CHAR(ch)	((ch) == '\000' || (ch) == '\037')
X
X/* Delete char */
X#define DEL_CHAR	'\177'
X
X/* Indirect start token */
X#define INDIRECT_TOKEN	"\037\nIndirect:\n"
X
X/* Tag table start token */
X#define TAGTABLE_TOKEN	"\nTag Table:\n"
X
X/* Indirect tag table token */
X#define ITAGTABLE_TOKEN	"(Indirect)\n"
X
X/* Tag table end token */
X#define TAGEND_TOKEN	"\037\nEnd tag table\n"
X
X/* Node header tokens */
X#define NODE_TOKEN	"Node: "
X#define PREV_TOKEN	"Prev: "
X#define NEXT_TOKEN	"Next: "
X#define UP_TOKEN	"Up: "
X
X/* Menu start token */
X#define MENU_TOKEN	"\n* Menu:"
X
X/* Menu seperator token */
X#define MENU_SEP_TOKEN	"\n* "
X
X/* Footnote start token */
X#define NOTE_TOKEN	"*note"
X
X/* End of a name */
X#define NAME_END_TOKEN	"\t\n,."
X
X/* white space */
X#define WHITE		"\t\n\f "
X
X/* delimiting characters that designate a node name */
X#define NAME		"\t\n,."
X
X/* Table manipulation macros */
X
X#define ZERO_TABLE(tab)		\
X     (tab).size = (tab).idx = 0;\
X     (tab).table = (ID_P)NULL
X
X#define FREE_TABLE(tab)		\
X     XtFree((tab).table);	\
X     (tab).table = NULL
X
X#define ALLOC_TABLE(tab)	\
X     FREE_TABLE(tab);		\
X     (tab).size = TABLE_INC;	\
X     (tab).idx = 0;		\
X     (tab).table = (ID_P)XtMalloc(sizeof(ID) * TABLE_INC)
X
X#define MAYBE_BUMP_TABLE(tab)	\
X     if ((tab).idx == (tab).size) {	\
X         (tab).size += TABLE_INC;	\
X	 (tab).table = (ID_P)XtRealloc((tab).table, (tab).size * sizeof(ID)); \
X     }
X
X#define ROUND_TABLE(tab)	\
X     if ((tab).idx + 1 != (tab).size) { \
X	 (tab).size = (tab).idx + 1;\
X	 (tab).table = (ID_P)XtRealloc((tab).table, (tab).size * sizeof(ID)); \
X     }				\
X     (tab).table[(tab).idx].tag.name = NULL; \
X     (tab).table[(tab).idx].offset.length = 0
X
X#define ZERO_LIST(lst)		\
X     ZERO_TABLE((lst).t);	\
X     XtFree((lst).l);		\
X     (lst).l = (Strings)NULL
X
X#define FREE_LIST(lst)		\
X     FREE_TABLE((lst).t);	\
X     XtFree((lst).l);		\
X     (lst).l = (Strings)NULL
X
X#define ALLOC_LIST(lst)		\
X     ALLOC_TABLE((lst).t);	\
X     (lst).l = (Strings)XtMalloc(sizeof(String) * TABLE_INC)
X
X#define FREE_TAG_TABLE(tab)	\
X     {				\
X     int i;			\
X     for (i = 0; i < IDX((tab)); i++) \
X          XtFree(I_NAME((tab).table[i])); \
X     XtFree((tab).table);	\
X     (tab).table = NULL;	\
X     }
X
X#define MAYBE_BUMP_LIST(lst)	\
X     if ((lst).t.idx == (lst).t.size) {	\
X         (lst).t.size += TABLE_INC;	\
X	 (lst).t.table = (ID_P)XtRealloc((lst).t.table, (lst).t.size * \
X					 sizeof(ID)); \
X	 (lst).l = (Strings)XtRealloc((lst).l, (lst).t.size * \
X				      sizeof(String)); \
X     }
X
X#define ROUND_LIST(lst)		\
X     if ((lst).t.idx + 1 != (lst).t.size) {	\
X	 (lst).t.size = (lst).t.idx + 1;\
X	 (lst).t.table = (ID_P)XtRealloc((lst).t.table, (lst).t.size * \
X					 sizeof(ID)); \
X	 (lst).l = (Strings)XtRealloc((lst).l, (lst).t.size * \
X				      sizeof(String)); \
X     }				\
X     (lst).t.table[(lst).t.idx].tag.name = NULL; \
X     (lst).t.table[(lst).t.idx].offset.length = 0; \
X     (lst).l[(lst).t.idx] = NULL
X
X#define IDX(tab)	((tab).idx)
X#define TPOS(tab)	((tab).table[IDX(tab)])
X#define LPOS(lst)	((lst).l[IDX((lst).t)])
X#define INCP(tab)	(IDX(tab)++)
X
X/* Turn address s into ptr relative index */
X#define INTOFF(ptr, s)		((int)((s) - (ptr)))
X
typedef String *Strings;
X     
typedef struct {
X     int nichts;
X} InfoClassPart;
X
typedef struct _InfoClassRec {
X     CoreClassPart		core_class;
X     CompositeClassPart		composite_class;
X     InfoClassPart		info_class;
X} InfoClassRec;
X
extern InfoClassRec infoClassRec;
X
X/* A generic ID (tag/offset). */
typedef union _id {
X     struct {				/* if it's a tag		*/
X	  String name;
X	  int offset;
X     } tag;
X     struct {				/* if it's an offset		*/
X	  int start;
X	  int length;
X     } offset;
X} ID, *ID_P;
X
X/* An array of ID's */
typedef struct _table {
X     int idx;				/* where we are in the table	*/
X     int size;
X     ID_P table;
X} Table;
X
X/* a special string/ID associative table */
typedef struct _idlist {
X     Table t;				/* ID array representation	*/
X     Strings l;				/* string array representation	*/
X} IDList;
X
X/* everything we'd like to know about a node */
typedef struct _nodeinfo {
X     String file;			/* node's file name		*/
X     String node;			/* node's nodename		*/
X     int start;				/* starting position		*/
X     int length;			/* length of node		*/
X     ID name;				/* location of nodename		*/
X     ID prev, up, next;			/* locations of prev, up, next	*/
X     ID text;				/* location of text		*/
X     IDList menu;			/* menu information		*/
X     IDList xref;			/* cross references		*/
X     struct _nodeinfo *nextNode;	/* for history list		*/
X} NodeInfo;
X
typedef struct {
X     /* resources */
X     String path;			/* search path			*/
X     String file;			/* current info file		*/
X     String node;			/* current node name		*/
X     String printCmd;			/* lpr command			*/
X     int bell_volume;			/* bell volume for error feeps	*/
X     Boolean retain_arg;		/* whether or not to save arg	*/
X     XtCallbackList callback;		/* quit callback		*/
X
X     /* private state */
X     String subFile;			/* current split file (if any)	*/
X     NodeInfo *history;			/* the history list		*/
X     Table indirect;			/* indirect files		*/
X     Table tags;			/* indirect tags		*/
X     String data;			/* pointer to file contents	*/
X     int size;				/* size of file contents	*/
X     int hdrSize;			/* size of file header		*/
X     char arg[ARGLEN];			/* command argument string	*/
X     Widget fileLabel, nodeLabel;	/* file and node labels		*/
X     Widget prevCmd, upCmd, nextCmd;	/* prev, up and next commands	*/
X     Widget menuList;			/* menu list			*/
X     Widget xrefList;			/* xref list			*/
X     Widget nodeText;			/* node text			*/
X     Widget statusLabel;		/* status area			*/
X     Widget messageLabel;		/* message area			*/
X     Widget xrefCmd, gotoCmd, searchCmd;/* xref, goto and search cmds	*/
X     Widget argText;			/* xref/goto/search arg text	*/
X     Widget helpPopup;			/* help popup			*/
X     Widget argPopup;			/* argument popup		*/
X     void (*requester)();		/* routine asking for argument	*/
X} InfoPart;
X
typedef struct _InfoRec {
X     CorePart		core;
X     CompositePart	composite;
X     InfoPart		info;
X} InfoRec;
X
X/* special accessors for info widget */
X#define DATA(iw)		((iw)->info.data)
X#define DATASIZE(iw)		((iw)->info.size)
X#define HDRSIZE(iw)		((iw)->info.hdrSize)
X#define INDIRECT(iw)		((iw)->info.indirect)
X#define TAGTABLE(iw)		((iw)->info.tags)
X#define HISTORY(iw)		((iw)->info.history)
X
X/* misc */
X#define CURNODE(iw)		HISTORY(iw)
X
X/* for search */
X#define START(iw)		(DATA(iw))
X#define END(iw)			(START(iw) + DATASIZE(iw))
X#define NSTART(iw, n)		(START(iw) + (n)->start)
X#define NEND(iw, n)		(NSTART(iw, n) + (n)->length)
X#define NSEARCH(iw, n, str)	(search(iw,NSTART(iw,n),NEND(iw,n),str,False))
X
X/* for id's */
X#define I_NAME(i)		((i).tag.name)
X#define I_OFFSET(i)		((i).tag.offset)
X#define I_START(i)		((i).offset.start)
X#define I_LEN(i)		((i).offset.length)
X
X#endif /* _InfoP_h */
END_OF_FILE
if test 9059 -ne `wc -c <'InfoP.h'`; then
    echo shar: \"'InfoP.h'\" unpacked with wrong size!
fi
# end of 'InfoP.h'
fi
if test -f 'NOTES' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'NOTES'\"
else
echo shar: Extracting \"'NOTES'\" \(1259 characters\)
sed "s/^X//" >'NOTES' <<'END_OF_FILE'
Note (reference) handling can get a little screwy when dealing with
notes that span lines or have lots of strange punctuation in them.
I still don't know whether "Note" is as valid as "note" so I accept
either case at the moment. The only other info driver I have also
breaks on these so it's hard to say what the correct thing to do is.
X
The R4 Athena List widget seems to do a better job of packing menu items
in the space available, though it doesn't always seem inform to inform
the Paned widget correctly when it needs more space. All in all, however,
this works a good deal better than it used to in R3.
X
Memory utilization should be correct now, though it's hard to tell since
I haven't got a malloc that gives memory back to the system (I'm still
more-or-less apalled that few, if any, mallocs tend to do so). Let me
know if you find any leaks.
X
The long awaited Motif conversion is still undone. The info widget is now
subclassed to composite and the code has been cleaned up in preparation, but
I still haven't got round to it. If anyone wants to do it, please contact me.
It's not hard to do, just tedious.
X
If you use this widget in a larger application, let me know; I'm curious
to know if anyone will use it in any other manner but stand-alone.
END_OF_FILE
if test 1259 -ne `wc -c <'NOTES'`; then
    echo shar: \"'NOTES'\" unpacked with wrong size!
fi
# end of 'NOTES'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(4190 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
This is the latest, and hopefully last, major release of the Info widget
posted on two other occasions to comp.sources.x. I will continute to
provide fixes and small functionality updates as necessary, of course,
but feel that this is now as featureful as it needs to be, given its
intended use.
X
The following changes have been made since the last release:
X
o	More bugs fixed; memory no longer leaks like water through a sieve.
X	Whoops. Code was also cleaned up a bit more.
X
o	Widget now subclassed from composite, not paned, making it more
X	portable to other widget sets. Also handles geometry management
X	much more effectively.
X
o	Mouse selections in the text now supported. If something looks
X	interesting and you click on it, regardless of where it is,
X	something will happen. Maybe even what you wanted.
X
o	Any resource that could be user specified without changing the basic
X	functionality of the widget has been put into the resource database.
X	Resources in general are now used much more effectively. This doesn't
X	mean that you actually need to know how to set them (keine angst, RMS),
X	since a reasonable set of defaults are available (and will be
X	automatically installed).
X
o	The HELPFILE is gone; the help text is now a resource string. This
X	means you can now give your users xinfo help in Pashto or Finnish,
X	if you want, simply by editing the database.
X
o	Better support for color. I.E. I thought up some reasonable defaults
X	that you can enable if you've got a color system.
X
o	Various accelerators for making life easier have been added.
X
o	A popup dialog for getting required arguments. XInfo no longer just
X	beeps at you and gives you a whiny message about what you should have
X	done, it jumps up and asks you for it.
X
o	The following text was added (finally):
X
When creating the info widget, the following resources are retrieved from
the resource database:
X
X-------------------------------------------------------------------------------
Name		Class		Type		Notes	Default
X-------------------------------------------------------------------------------
bellVolume	BellVolume	Int		CSG	50%
callback	Callback	XtCallbackList	CSG	NULL
infoFile	InfoFile	String		CSG	XpDefaultInfoFile
infoNode	InfoNode	String		CSG	XpDefaultInfoNode
infoPath	InfoPath	String		CSG	XpDefaultInfoPath
printCommand	PrintCommand	String		CSG	XpDefaultPrintCommand
retainArg	RetainArg	Boolean		CSG	FALSE
X-------------------------------------------------------------------------------
X
bellVolume	Determines how loud to ring the bell when something wants
X		to complain.
X
callback	If specified, is called when the info widget wants to "quit"
X		it is left up to the caller to decide what "quitting" means.
X
infoFile	Which info file to read from. Generally defaults to "dir".
X
infoNode	Which info node to try and find. Generally defaults to "top".
X
infoPath	Colon separated path to follow when looking for info files.
X
printCommand	Which unix command to run when the user asks to print the
X		current node. This command will be run on a temporary file
X		containing the node's text and header information.
X
retainArg	Determine whether or not to leave text (if any) in the
X		argument area around after selecting a node.
X
X
CONTENTS
X-------------------------------------------------------
X
This directory contains the sources for an "Emacs Info" browsing widget,
subclassed from the Composite widget.
X
The following files are important:
X
Info.c, Info.h, InfoP.h  - Comprise the Info widget (as is normal)
X
xinfo.c	- A simple application of the info widget (also demonstrates
X	  usage of the quit callback).
X
XXInfo.ad - Application defaults.
X
Compiling should be fairly straigtforward. You may want to edit some
of the defaults in Info.h to match the configuration at your site, though
this really should be changed in the resource database if at all possible.
X
Those wishing for an more elaborate view of the twisty mechanations
of my mind (regarding this code, at least) should read the NOTES file.
X
Questions, suggestions, bug fixes or large anonymous cash donations
X(all currencies accepted) should be sent to:
X
X				Jordan Hubbard
X
X			ARPA:	jkh@meepmeep.pcs.com
X			(OR):	jkh@meepmeep.pcs.de   (europe)
X			
END_OF_FILE
if test 4190 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'XInfo.ad' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'XInfo.ad'\"
else
echo shar: Extracting \"'XInfo.ad'\" \(7517 characters\)
sed "s/^X//" >'XInfo.ad' <<'END_OF_FILE'
X# $Header: /usr3/xinfo/RCS/XInfo.ad,v 1.2 90/11/11 21:20:12 jkh Exp $
X#
X# 
X#                    Copyright 1989, 1990
X#                     Jordan K. Hubbard
X# 
X#                 PCS Computer Systeme, GmbH.
X#                    Munich, West Germany
X# 
X# 
X#  This file is part of GNU Info widget.
X# 
X#  The GNU Info widget is free software; you can redistribute it and/or
X#  modify it under the terms of the GNU General Public License as published
X#  by the Free Software Foundation; either version 1, or (at your option)
X#  any later version.
X# 
X#  This software 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 software; see the file COPYING.  If not, write to
X#  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
X#
X#
X# Here lie the general resource settings for the XInfo widget. Everything
X# here should be customizable (within reason) without changing basic
X# functionality too much, so feel free to adjust accelerator keys and/or
X# appearances to suit your personal taste. Look in the README file for a
X# description of what each action does before changing accelerators.
X#
X# $Log:	XInfo.ad,v $
X# Revision 1.2  90/11/11  21:20:12  jkh
X# Release 1.01
X# 
X# Revision 1.1  90/11/06  15:43:18  jkh
X# Initial revision
X# 
X
X
X#
X# General xinfo client defaults:
X
XXInfo*Accelerators: #override \n\
X	<Key>1:		info_menusel(1)\n\
X	<Key>2:		info_menusel(2)\n\
X	<Key>3:		info_menusel(3)\n\
X	<Key>4:		info_menusel(4)\n\
X	<Key>5:		info_menusel(5)\n\
X	<Key>6:		info_menusel(6)\n\
X	<Key>7:		info_menusel(7)\n\
X	<Key>8:		info_menusel(8)\n\
X	<Key>9:		info_menusel(9)\n\
X	<Key>Help:	info_popupHelp()\n\
X	<Key>question:	info_popupHelp()\n\
X	Meta<Key>P:	info_print()\n\
X	None<Key>d:	info_dir()\n\
X	None<Key>f:	info_xref()\n\
X	None<Key>g:	info_goto()\n\
X	None<Key>h:	info_tutorial()\n\
X	None<Key>l:	info_last()\n\
X	None<Key>m:	info_menusel(0)\n\
X	None<Key>n:	info_next()\n\
X	None<Key>p:	info_prev()\n\
X	None<Key>q:	info_quit()\n\
X	None<Key>s:	info_nodeSearch()\n\
X	None<Key>t:	info_top()\n\
X	None<Key>u:	info_up()\n
X
XXInfo.geometry:					600x600
XXInfo*IconPixmap:				xinfo.bm
X
X# These look nice on color systems; enable if you want a flashier interface.
X#
X#XInfo*Background:				MidNightBlue
X#XInfo*Foreground:				Azure
X#XInfo*BorderColor:				LightCyan1
X#XInfo*info.pane1*Command.Foreground:		Gold
X#XInfo*info.pane1*Command.Background:		RoyalBlue3
X#XInfo*info.pane1*Label.Foreground:		Yellow
X#XInfo*info.pane1*Label.Background:		RoyalBlue4
X#XInfo*info.help*Background:			DarkGoldenRod
X#XInfo*info.need_argument*Background:		Brown
X
X#
X# More specific xinfo widget defaults:
X
XXInfo*ShapeStyle:				Oval
XXInfo*Font:					7x13
XXInfo*info.pane1*Command.borderWidth:		2
XXInfo*info.pane1.box1*Command.Font:		6x13
XXInfo*info.pane1.box1*Command.Justify:		JustifyLeft
XXInfo*info.pane1.*.vertical.Translations:	#override \n\
X  <Key>space:  StartScroll(Forward)  NotifyScroll(FullLength) EndScroll() \n\
X  <Key>Delete: StartScroll(Backward) NotifyScroll(FullLength) EndScroll() \n
X
XXInfo*info.pane1.vport1.height:			60
XXInfo*info.pane1.vport1.min:			60
XXInfo*info.pane1.vport1.max:			9999
X
XXInfo*info.pane1.vport1.menu.pasteBuffer:	True
XXInfo*info.pane1.vport1.menu.height:		150
XXInfo*info.pane1.vport1.menu.columnSpacing:	8
X
XXInfo*info.pane1.nodeText.height:		500
XXInfo*info.pane1.nodeText.wrap:			Word
XXInfo*info.pane1.nodeText.autoFill:		True
XXInfo*info.pane1.nodeText.scrollVertical:	WhenNeeded
XXInfo*info.pane1.nodeText.Translations:	#override \n\
X	None<Key>b:	beginning-of-file() \n\
X	<Key>Home:	beginning-of-file() \n\
X	<Key>Delete:	previous-page() \n\
X	<Key>Prior:	previous-page() \n\
X	<Key>Next:	next-page() \n\
X	<Key>space:	next-page() \n\
X	None<Btn1Down>: select-end() info_click() \n
X
XXInfo*info.pane1.vport2.height:			30
XXInfo*info.pane1.vport2.min:			20
XXInfo*info.pane1.vport2.max:			9999
X
XXInfo*info.pane1.vport2.xref.pasteBuffer:	True
XXInfo*info.pane1.vport2.xref.defaultColumns:	6
XXInfo*info.pane1.vport2.xref.columnSpacing:	8
X
XXInfo*info.pane1.box2.height:			30
XXInfo*info.pane1.box2.min:			30
XXInfo*info.pane1.box1*Command.Justify:		JustifyCenter
X
XXInfo*info.pane1.box2.arg.width:		200
XXInfo*info.pane1.box2.arg.allowResize:		True
XXInfo*info.pane1.box2.arg.resize:		True
XXInfo*info.pane1.box2.arg.borderWidth:		2
XXInfo*info.pane1.box2.arg.translations:		#override \n\
X 	<Key>Return: confirm() \n\
X 	Ctrl<Key>G:  abort() \n
X
XXInfo*info.pane1.status.height:			20
XXInfo*info.pane1.status.min:			20
XXInfo*info.pane1.status.max:			20
X
XXInfo*info.pane1.message.height:		20
XXInfo*info.pane1.message.min:			20
XXInfo*info.pane1.message.max:			20
X
X#
X# Help popup resources
X
XXInfo*info.help.height:				300
XXInfo*info.help.width:				400
XXInfo*info.help.pane.text.scrollVertical:	WhenNeeded
XXInfo*info.help.pane.text.wrap:			Word
XXInfo*info.help.pane.text.translations:		#override \n\
None<Key>q:	MenuPopdown(help) \n\
None<Key>b:	beginning-of-file() \n\
X<Key>Home:	beginning-of-file() \n\
X<Key>Delete:	previous-page() \n\
X<Key>Prior:	previous-page() \n\
X<Key>Next:	next-page() \n\
X<Key>space:	next-page() \n
XXInfo*info.help.pane.text.textSource.string: \
The following keys are recognized by the Info Widget: \n\n\
Key		Action \n\
X----		------ \n\
B		Beginning of Node \n\
Home		Same as above* \n\
D		Goto Directory \n\
XF		Follow reference \n\
G		Goto node \n\
H		Info tutorial \n\
L		Last node selected \n\
M		Select menu by name \n\
N		Next node \n\
P		Previous node \n\
S		Search for node \n\
T		Top node \n\
U		Up node \n\
X0-9		Select menu by number \n\
X<DEL>		Back page \n\
Prev Page	Same as above* \n\
X<SPACE>		Forward page \n\
Next Page	Same as above* \n\
Meta-P		Send current node to printer. \n\
X?		Print this help \n\
Help		Same as above* \n\n\
X* If supported on your keyboard.\n\n\
The info widget command set attempts to emulate that of Emacs Info as closely as possible, but there are a few notable exceptions. Like Emacs Info, the current file, node name and possible values for Up, Previous and Next are displayed in the first pane. Clicking on the Up, Prev or Next buttons will also cause the corresponding node (if any) to be selected. Possible menu items are displayed in the second pane as a multiple-choice list. If more menu items exist than will fit in the space allotted for them, 










a scrollbar is added.\n\n\
The third pane contains the node text. It can be scrolled with the accompanying scrollbar or the paging keys (see above).\n\n\
The fourth pane contains a multiple choice list of any cross references in this node.\n\n\
The fifth pane contains buttons for more direct navigation within the info tree. All take their argument(s) from the text area to the right of the search button. This area is also used by the F, G, M and S keys. The use of an argument area, rather than interactive prompting, is the main difference between this widget and Emacs Info. This should be kept in mind when using the Emacs Info tutorial.\n\n\
The sixth and seventh panes are the status and message areas, respectively.\n
X
X#
X# Argument dialog popup resources
X
XXInfo*info.need_argument.dialog.value.translations:	#override \n\
X 	<Key>Return: confirm() \n\
X 	Ctrl<Key>G:  abort() \n
XXInfo*info.need_argument.dialog.confirm.horizDistance:	20
XXInfo*info.need_argument.dialog.confirm.Label:		Confirm
XXInfo*info.need_argument.dialog.abort.Label:		Abort
END_OF_FILE
if test 7517 -ne `wc -c <'XInfo.ad'`; then
    echo shar: \"'XInfo.ad'\" unpacked with wrong size!
fi
# end of 'XInfo.ad'
fi
if test -f 'xinfo.bm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xinfo.bm'\"
else
echo shar: Extracting \"'xinfo.bm'\" \(872 characters\)
sed "s/^X//" >'xinfo.bm' <<'END_OF_FILE'
X#define foo_width 32
X#define foo_height 32
static char foo_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0xfa, 0x7f, 0xfe, 0x5f,
X   0x0a, 0xc0, 0x03, 0x50, 0xea, 0x5f, 0xfa, 0x57, 0x0a, 0x40, 0x02, 0x50,
X   0xea, 0xdf, 0xfb, 0x57, 0x0a, 0x40, 0x02, 0x50, 0xea, 0x5f, 0xfa, 0x57,
X   0x0a, 0xc0, 0x03, 0x50, 0xea, 0x5f, 0xfa, 0x57, 0x0a, 0x40, 0x02, 0x50,
X   0xea, 0xdf, 0xfb, 0x57, 0x0a, 0x40, 0x02, 0x50, 0xfa, 0x7f, 0xfe, 0x5f,
X   0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x10, 0x00,
X   0x00, 0x70, 0x08, 0x00, 0x00, 0xe0, 0x04, 0x00, 0x00, 0xc0, 0x02, 0x00,
X   0x00, 0x40, 0x03, 0x00, 0x00, 0x20, 0x07, 0x00, 0x00, 0x10, 0x0e, 0x00,
X   0x00, 0x08, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x2e, 0x7a, 0x1f,
X   0x50, 0x64, 0x0a, 0x11, 0x20, 0xa4, 0x3a, 0x11, 0x50, 0x24, 0x0b, 0x11,
X   0x88, 0x2e, 0x0a, 0x1f, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 872 -ne `wc -c <'xinfo.bm'`; then
    echo shar: \"'xinfo.bm'\" unpacked with wrong size!
fi
# end of 'xinfo.bm'
fi
if test -f 'xinfo.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xinfo.c'\"
else
echo shar: Extracting \"'xinfo.c'\" \(2800 characters\)
sed "s/^X//" >'xinfo.c' <<'END_OF_FILE'
X#ifndef lint
static char *rcsid = "$Header: /usr3/xinfo/RCS/xinfo.c,v 1.3 90/11/12 18:07:52 jkh Exp $";
X#endif
X
X/*
X *
X *                   Copyright 1989, 1990
X *                    Jordan K. Hubbard
X *
X *                PCS Computer Systeme, GmbH.
X *                   Munich, West Germany
X *
X *
X * This file is part of GNU Info widget.
X *
X * The GNU Info widget is free software; you can redistribute it and/or
X * modify it under the terms of the GNU General Public License as published
X * by the Free Software Foundation; either version 1, or (at your option)
X * any later version.
X *
X * This software 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 software; see the file COPYING.  If not, write to
X * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
X *
X *
X */
X
X/*
X * $Log:	xinfo.c,v $
X * Revision 1.3  90/11/12  18:07:52  jkh
X * Changed startup string to be more palatable to weird CPP's.
X * 
X * Revision 1.2  90/11/11  21:37:15  jkh
X * Release 1.01.
X * 
X * Revision 1.1  90/11/06  22:52:39  jkh
X * Initial revision.
X * 
X */
X
X#include <X11/Intrinsic.h>
X#include <X11/StringDefs.h>
X#include <X11/Shell.h>
X#include <stdio.h>
X#include "Info.h"
X
static char info_msg[] = "\
XXInfo %2.2f, Copyright (C) 1990 Jordan K. Hubbard.\
XXInfo is free software and you are welcome to distribute copies of it\
under certain conditions; you should have received a copy of these\
conditions (see file 'COPYING') with this software. Type '?' for\
a list of commands.\
X";
X
int main(argc, argv)
int argc;
char **argv;
X{
X     Arg args[5];
X     Cardinal i;
X     Widget top;
X     static void quit();
X     static XtCallbackRec call[] = {
X	  { quit, NULL },
X	  { NULL, NULL },
X     };
X     static XrmOptionDescRec options[] = {
X	  {"-node",	"*info.infoNode",	XrmoptionSepArg,	NULL},
X	  {"-file",	"*info.infoFile",	XrmoptionSepArg,	NULL},
X	  {"-path",	"*info.infoPath",	XrmoptionSepArg,	NULL},
X	  {"-lpr",	"*info.printCommand",	XrmoptionSepArg,	NULL},
X     };
X
X
X     top = XtInitialize("xinfo", "XInfo", options, XtNumber(options),
X			&argc, argv);
X     i = 0;
X     XtSetArg(args[i], XtNcallback, call);		i++;
X     XtCreateManagedWidget("info", infoWidgetClass, top, args, i);
X
X     XtRealizeWidget(top);
X
X     /* Tell the user who we are */
X     fprintf(stderr, info_msg, XpInfoVersion);
X
X     /* Spin until we get sick */
X     XtMainLoop();
X
X     return(0); /* hope not, but lint likes this */
X}
X
static void quit(w, client_data, call_data)
Widget w;
caddr_t client_data, call_data;
X{
X     extern void exit();
X
X     exit(0);
X}
END_OF_FILE
if test 2800 -ne `wc -c <'xinfo.c'`; then
    echo shar: \"'xinfo.c'\" unpacked with wrong size!
fi
# end of 'xinfo.c'
fi
echo shar: End of archive 1 \(of 2\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked both archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0

dan
----------------------------------------------------
O'Reilly && Associates   argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.
--
dan
----------------------------------------------------
O'Reilly && Associates   argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.