[alt.sources] X Desktop Manager

eddyg@syma.sussex.ac.uk (Edward J. Groenendaal) (04/18/91)

---- Cut Here and unpack ----
#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#	Packed Wed Apr 17 21:39:53 BST 1991 by tsuna!eddyg
#	from directory /tsuna/home/ug/cs88/eddyg/usr/xdtm
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
#	Run the following text with /bin/sh to create:
#	  code/appman.c
#	  code/buttons.c
#	  code/dialogs.c
#	  code/dirman.c
#	  code/display.c
#	  code/fileman.c
#	  code/info.c
#	  code/lexical.l
#	  code/listoption.c
#	  code/main.c
#	  code/map.c
#	  code/menus.c
#	  code/menus.h
#	  code/newfile.c
#	  code/parse.c
#	  code/parse.h
#	  code/parser.y
#	  code/patchlevel.h
#	  code/quit.c
#	  code/scroll_hack.c
#	  code/strstr.c
#	  code/xdtm.h
#	  code/README
#	  code/Imakefile
#	  code/Makefile
#	  code/help
#	  code/Xdtm
#	  icons/eddy/ccode.icon
#	  icons/eddy/core.icon
#	  icons/eddy/dotdot.icon
#	  icons/eddy/elisp.icon
#	  icons/eddy/elispc.icon
#	  icons/eddy/file.icon
#	  icons/eddy/folder.icon
#	  icons/eddy/hcode.icon
#	  icons/eddy/icon.icon
#	  icons/eddy/lcode.icon
#	  icons/eddy/lib.icon
#	  icons/eddy/make.icon
#	  icons/eddy/makefile.icon
#	  icons/eddy/manpage.icon
#	  icons/eddy/ocode.icon
#	  icons/eddy/prog.icon
#	  icons/eddy/text.icon
#	  icons/eddy/x.icon
#	  icons/eddy/xdtm.icon
#	  icons/eddy/ycode.icon
#	  icons/eddy/z.icon
#	  icons/alix/airballoon.icon
#	  icons/alix/alien.icon
#	  icons/alix/bat.icon
#	  icons/alix/candle.icon
#	  icons/alix/clock.icon
#	  icons/alix/cup.icon
#	  icons/alix/dragon.icon
#	  icons/alix/drawingA.icon
#	  icons/alix/drawingB.icon
#	  icons/alix/emacs.icon
#	  icons/alix/fish.icon
#	  icons/alix/flower.icon
#	  icons/alix/ghost.icon
#	  icons/alix/gun.icon
#	  icons/alix/hat.icon
#	  icons/alix/hedgehog.icon
#	  icons/alix/mermaid.icon
#	  icons/alix/monster.icon
#	  icons/alix/piccy.icon
#	  icons/alix/snail.icon
#	  icons/alix/wordc.icon
#	  xdtmrc
#	  code/bitmaps/Copy.Button
#	  code/bitmaps/Copy.Cursor
#	  code/bitmaps/Copy.Mask
#	  code/bitmaps/EmptyTick
#	  code/bitmaps/Grey.Mask
#	  code/bitmaps/Move.Button
#	  code/bitmaps/Move.Cursor
#	  code/bitmaps/Move.Mask
#	  code/bitmaps/Tick
#	  code/bitmaps/Trash.Button
#	  code/bitmaps/file.icon
#	  code/bitmaps/folder.icon
#	  code/Xedw/DefIcon.icon
#	  code/Xedw/Imakefile
#	  code/Xedw/Makefile
#	  code/Xedw/XedwForm.c
#	  code/Xedw/XedwForm.h
#	  code/Xedw/XedwFormP.h
#	  code/Xedw/XedwList.c
#	  code/Xedw/XedwList.h
#	  code/Xedw/XedwListP.h
#	  code/Xedw/XedwTree.c
#	  code/Xedw/XedwTree.h
#	  code/Xedw/XedwTreeP.h
#
if test -r s2_seq_.tmp
then echo "Must unpack archives in sequence!"
     next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
     exit 1; fi
echo "creating directories"
mkdir code
mkdir code/bitmaps
mkdir code/Xedw
mkdir icons
mkdir icons/eddy
mkdir icons/alix
echo "x - extracting code/appman.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/appman.c &&
X/*****************************************************************************
X ** File          : appman.c                                                **
X ** Purpose       : Application Manager                                     **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : 19th Feb 1991                                           **
X ** Documentation : Xedw Design Folder                                      **
X ** Related Files : menus.c                                                 **
X *****************************************************************************/
X
X#include "xdtm.h"
X
X#include <X11/Xaw/MenuButton.h> /* Needed for selection menu */
X#include <X11/Xaw/SimpleMenu.h>
X#include <X11/Xaw/Viewport.h>
X#include <X11/Xaw/Command.h>
X#include <X11/Xaw/Label.h>
X#include <sys/types.h>		/* For opening and closing file descriptors */
X#include <sys/stat.h>		/* For opening and closing file descriptors */
X/* #include <fcntl.h>		For opening and closing file descriptors */
X#include <sys/file.h>		/* For access(2) */
X#include <string.h>
X#include "menus.h"		/* For the use of Trash, Copy, and Move */
X#include "parse.h"              /* For access to AppSelection */
X#include "Xedw/XedwList.h"
X#include "Xedw/XedwForm.h"
X
X/* Include button bitmaps */
X#include "bitmaps/Trash.Button"
X#include "bitmaps/Copy.Button"
X#include "bitmaps/Move.Button"
X
X/* Include Cursor bitmaps */
X#include "bitmaps/Copy.Cursor"
X#include "bitmaps/Copy.Mask"
X#include "bitmaps/Move.Cursor"
X#include "bitmaps/Move.Mask"
X
Xpublic  Mode     mode;
Xpublic  Boolean  buttonSensitive;
Xpublic  Widget   trashButton, copyButton, moveButton;
Xprivate XedwListReturnStruct *return_list;
Xpublic  Widget   appManager;
Xpublic  Widget   selectionMenu;
Xprivate Widget   appManagerView;
Xprivate Widget   appManagerButton;
Xprivate Widget   buttonForm;
Xprivate Cursor   copyCursor, moveCursor;
Xpublic  Cardinal appman_selection;
Xprivate String   srcdir, dstdir;
Xprivate String  *patharray;
Xprivate String   path;
Xprivate Cardinal pathsize; 
X
X#ifdef SYSV
Xextern char *strstr(char *, char *);
X#endif
X
X
Xvoid createAppManagerWidgets(Widget topForm)
X{
X  private void button_selected(Widget, Cardinal, caddr_t);
X  private void program_selected(Widget, caddr_t, caddr_t);
X  Arg arglist[8], *newlist;
X  Pixmap trash, copy, move;
X  Cardinal i, t;
X  XtTranslations appManTranslations;
X
X  static char defaultTranslations[] =
X    		"<Btn1Down>:    Set()\n\
X		 <Btn1Up>:      Unset()\n\
X	         <Btn1Up>(2):   Notify() Unset()";
X  
X  /* Application Manager Selector */
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert,         menuBar); i++;
X  XtSetArg(arglist[i], XtNrubberWidth,        False); i++;
X  XtSetArg(arglist[i], XtNrubberHeight,       False); i++;
X  XtSetArg(arglist[i], XtNmenuName, "selectionMenu"); i++;
X  newlist = XtMergeArgLists(arglist, i, chain_position, chain_size);
X  appManagerButton  =   XtCreateManagedWidget("appManagerButton",
X					      menuButtonWidgetClass,
X					      topForm,
X					      newlist, i + chain_size);
X  XtFree(newlist);
X
X
X  selectionMenu    =   XtCreatePopupShell("selectionMenu",
X					  simpleMenuWidgetClass,
X					  appManagerButton,
X					  NULL, 0);
X
X
X  /* Application Manager */
X  
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert,      appManagerButton);   i++;
X  XtSetArg(arglist[i], XtNforceBars,                 True);   i++;
X  XtSetArg(arglist[i], XtNallowVert,                 True);   i++;
X  XtSetArg(arglist[i], XtNrubberWidth,              False);   i++;
X  XtSetArg(arglist[i], XtNwidthLinked,   appManagerButton);   i++;
X  newlist = XtMergeArgLists(arglist, i, chain_position, chain_size);
X  appManagerView      =   XtCreateManagedWidget("appManagerView",
X						viewportWidgetClass,
X						topForm,
X						newlist, i + chain_size);
X  XtFree(newlist);
X  
X  i = 0;
X  XtSetArg(arglist[i], XtNdefaultColumns,  1); i++;
X  XtSetArg(arglist[i], XtNforceColumns, True); i++;
X  XtSetArg(arglist[i], XtNshowIcons,    True); i++;
X  appManager          =   XtCreateManagedWidget("appManager",
X						xedwListWidgetClass,
X						appManagerView,
X						arglist, i);
X
X  /* Action Buttons */
X
X  buttonSensitive = False;
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert,    appManagerView);   i++;
X  XtSetArg(arglist[i], XtNrubberWidth,          False);   i++;
X  XtSetArg(arglist[i], XtNrubberHeight,         False);   i++;
X  XtSetArg(arglist[i], XtNtop,          XtChainBottom);   i++;
X  XtSetArg(arglist[i], XtNwidthLinked, appManagerView);   i++;
X  XtSetArg(arglist[i], XtNborderWidth,              0);   i++;
X  XtSetArg(arglist[i], XtNdefaultDistance,          0);   i++;
X  buttonForm          =   XtCreateManagedWidget("buttonForm",
X						xedwFormWidgetClass,
X						topForm,
X						arglist, i);
X
X  trash = XCreateBitmapFromData(XtDisplay(topForm),
X				RootWindowOfScreen(XtScreen(topForm)),
X				trash_bits,
X				trash_width, trash_height);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNhighlightThickness,       1);   i++;  
X  XtSetArg(arglist[i], XtNsensitive,            False);   i++;
X  XtSetArg(arglist[i], XtNbitmap,               trash);   i++;
X  trashButton	      =	  XtCreateManagedWidget("trashButton",
X						commandWidgetClass,
X						buttonForm,
X						arglist, i);
X
X
X  move = XCreateBitmapFromData(XtDisplay(topForm),
X				RootWindowOfScreen(XtScreen(topForm)),
X				move_bits,
X				move_width, move_height);
X
X  i = t = i-1;
X  XtSetArg(arglist[i], XtNfromHoriz,      trashButton);   i++;
X  XtSetArg(arglist[i], XtNhorizDistance,            6);   i++;
X  XtSetArg(arglist[i], XtNbitmap,                move);   i++;
X  moveButton	      =   XtCreateManagedWidget("moveButton",
X						commandWidgetClass,
X						buttonForm,
X						arglist, i);
X
X  copy = XCreateBitmapFromData(XtDisplay(topForm),
X				RootWindowOfScreen(XtScreen(topForm)),
X				copy_bits,
X				copy_width, copy_height);
X
X  i = t;
X  XtSetArg(arglist[i], XtNfromHoriz,        moveButton);   i++;
X  XtSetArg(arglist[i], XtNhorizDistance,             6);   i++;
X  XtSetArg(arglist[i], XtNbitmap,                 copy);   i++;
X  copyButton          =   XtCreateManagedWidget("copyButton",
X						commandWidgetClass,
X						buttonForm,
X						arglist, i);
X
X
X  XtAddCallback(trashButton, XtNcallback, button_selected, Trash);
X  XtAddCallback(copyButton, XtNcallback, button_selected, Copy);
X  XtAddCallback(moveButton, XtNcallback, button_selected, Move);
X  
X  XtAddCallback(appManager, XtNcallback, program_selected, 0);
X  appManTranslations = XtParseTranslationTable(defaultTranslations);
X  XtUninstallTranslations(appManager);
X  XtOverrideTranslations(appManager, appManTranslations);
X}
X
Xpublic void initAppManager(Widget w)
X{
X  extern int count_chr(String, char);
X  public void selectionChange(Widget, Cardinal, caddr_t);
X  Pixmap cursor, mask;
X  XColor foreground, background;
X  Colormap def_cmap;
X  String pathptr;
X  Cardinal n;
X
X  /* set selection in label */
X  selectionChange(w, 0, NULL);
X
X  /* get the copy and move cursors */
X
X  def_cmap = DefaultColormapOfScreen(XtScreen(w));
X
X  XParseColor(XtDisplay(w), def_cmap, "Black", &foreground);
X  XParseColor(XtDisplay(w), def_cmap, "White", &background);
X  XAllocColor(XtDisplay(w), def_cmap, &foreground);
X  XAllocColor(XtDisplay(w), def_cmap, &background);
X
X  cursor = XCreateBitmapFromData(XtDisplay(w),
X				 RootWindowOfScreen(XtScreen(w)),
X				 CopyC_bits,
X				 CopyC_width, CopyC_height);
X
X  mask   = XCreateBitmapFromData(XtDisplay(w),
X				 RootWindowOfScreen(XtScreen(w)),
X				 CopyM_bits,
X				 CopyM_width, CopyM_height);
X
X  copyCursor = XCreatePixmapCursor(XtDisplay(w), 
X				   cursor, mask,
X				   &foreground, &background,
X				   CopyC_x_hot, CopyC_y_hot);
X
X  XFreePixmap(XtDisplay(w), cursor);
X  XFreePixmap(XtDisplay(w), mask);
X
X
X  cursor = XCreateBitmapFromData(XtDisplay(w),
X				       RootWindowOfScreen(XtScreen(w)),
X				       MoveC_bits,
X				       MoveC_width, MoveC_height);
X
X  mask   = XCreateBitmapFromData(XtDisplay(w),
X				       RootWindowOfScreen(XtScreen(w)),
X				       MoveM_bits,
X				       MoveM_width, MoveM_height);
X
X  moveCursor = XCreatePixmapCursor(XtDisplay(w), 
X				   cursor, mask,
X				   &foreground, &background,
X				   MoveC_x_hot, MoveC_y_hot);
X
X  XFreePixmap(XtDisplay(w), cursor);
X  XFreePixmap(XtDisplay(w), mask);
X
X  mode = NormalMode;
X
X  /* Get path and put it into patharray */
X  if ((path = (String) getenv("PATH")) == NULL) {
X    fprintf(stderr, "Warning: PATH environment variable not set\n");
X  } else path = XtNewString(path);
X  
X  patharray = (String*) XtMalloc ((count_chr(path, ':')+1) * sizeof(String));
X
X  /* Extract the directories from the path into the path array */
X  
X  n = 0;
X
X  pathptr = strtok(path, ":");
X  while (pathptr != NULL) {
X    if (*pathptr == '/')
X      patharray[n++] = pathptr;
X    else 
X      fprintf(stderr, "Warning: Directory '%s' in PATH not fully qualified\n",
X	      pathptr);
X    pathptr = strtok(NULL, ":");
X  }
X  
X  pathsize = n;
X}
X
Xpublic void button_selected(Widget w, Cardinal type, caddr_t call_data)
X{
X  extern void button_dialog(Cardinal, XedwListReturnStruct *);
X  extern void changestate(Boolean);
X  extern void setCursor(Cursor);
X  extern String getfilename(String);
X  extern String cwd;
X  extern Cursor left_ptr;
X  extern Widget directoryManager;
X  extern Boolean buttonSensitive;
X  static Boolean copyfirst = True;
X  static Boolean movefirst = True;
X  XedwListReturnStruct *tmp;
X
X  /* Get list of currently highlighted items */
X  if (movefirst == True && copyfirst == True) {
X    return_list = XedwListShowCurrent(directoryManager);
X    /* extract filenames from rest of data */
X    tmp = return_list;
X    while (tmp != NULL) {
X      tmp->string = getfilename(tmp->string);
X      tmp = tmp->next;
X    }
X  }
X  
X  /* if non empty call dialog */
X  if (!(return_list->xedwList_index == XDTM_LIST_NONE &&
X      movefirst == True && copyfirst == True)) {
X    switch(type) {
X    case Trash:
X      changestate(False);
X      button_dialog(type, return_list);
X      break;
X    case Copy:
X      if (copyfirst == True) {
X	/* deselect all */
X	XedwListUnhighlight(directoryManager, XedwAll);
X	setCursor(copyCursor);
X	mode = CopyMode;
X	changestate(False);
X	srcdir = XtNewString(cwd);
X	copyfirst = False;
X      } else {
X	setCursor(left_ptr);
X	mode = NormalMode;
X	buttonSensitive = True; /* hack to force buttons insensitive */
X	changestate(False);
X	dstdir = XtNewString(cwd);
X	button_dialog(type, return_list);
X	copyfirst = True;
X      }
X      break;
X    case Move:
X      if (movefirst == True) {
X	/* deselect all */
X	XedwListUnhighlight(directoryManager, XedwAll);
X	setCursor(moveCursor);
X	mode = MoveMode;
X	changestate(False);
X	srcdir = XtNewString(cwd);
X	movefirst = False;
X      } else {
X	setCursor(left_ptr);
X	mode = NormalMode;
X	buttonSensitive = True; /* hack to force buttons insensitive */
X	changestate(False);
X	dstdir = XtNewString(cwd);
X	button_dialog(type, return_list);
X	movefirst = True;
X      }
X      break;
X    }
X  }
X  else
X    XBell(XtDisplay(w), 100);
X
X}
X
Xpublic void trashQueryResult(Widget w, Boolean delete, caddr_t call_data)
X{
X  public int  execute(String, String, String, Boolean);
X  extern void destroy_button_dialog(void);
X  extern void changestate(Boolean);
X  extern void setCursor(Cursor);
X  extern Boolean directoryManagerNewDirectory(String);
X  extern void query_dialog(String, Boolean);
X  extern Cursor busy, left_ptr;
X  extern String cwd;
X  private void freeReturnStruct(void);
X  String rmstring;
X  int status;
X  XedwListReturnStruct *tmp;
X
X  setCursor(busy);
X
X  /* destroy dialog */
X  destroy_button_dialog();
X
X  if (delete == True) {
X    /* delete files */
X
X    /* I can't be bothered writing my own remove routine so I'll call
X     * 'rm(1)' via execute instead.
X     */
X    rmstring = XtNewString("rm -fr");
X    tmp = return_list;
X    while (tmp != NULL) {
X      rmstring = (String) XtRealloc (rmstring, sizeof(char) * 
X				     (strlen(rmstring) +
X				      strlen(tmp->string) + 4));
X      sprintf(rmstring, "%s '%s'", rmstring, tmp->string);
X      tmp = tmp->next;
X    }
X    if ((status = execute(NULL, "rm", rmstring, True)) != 0) {
X      XBell(XtDisplay(w), 100);
X      query_dialog("Can't remove file", False);
X    }
X    XtFree(rmstring);
X    /* refresh directory (clear highlights as a side effect) */
X    directoryManagerNewDirectory(cwd);
X  } else {
X    /* leave list highlighted, make buttons sensitive again */
X    changestate(True);
X  }
X
X  /* free memory for list */
X  setCursor(left_ptr);
X  freeReturnStruct();
X
X}
X
Xpublic void copyQueryResult(Widget w, Boolean copy, caddr_t call_data)
X{
X  extern void destroy_button_dialog(void);
X  extern void changestate(Boolean);
X  extern void setCursor(Cursor);
X  extern void query_dialog(String, Boolean);
X  extern Boolean directoryManagerNewDirectory(String);
X  extern Cursor busy, left_ptr;
X  private void freeReturnStruct(void);
X  public int execute(String, String, String, Boolean);
X  extern String cwd;
X  String copystring;
X  int status;
X  Cardinal srclen, dstlen;
X  XedwListReturnStruct *tmp;
X
X  destroy_button_dialog();
X
X  setCursor(busy);
X
X  if (copy == True) {
X    /* copy files */
X    
X    /* I can't be bothered writing my own copy routine so I'll call
X     * 'cp(1)' via execute instead.
X     */
X    srclen = strlen(srcdir);
X    dstlen = strlen(dstdir);
X    copystring = XtNewString("cp -r");
X    tmp = return_list;
X    while (tmp != NULL) {
X      copystring = (String) XtRealloc (copystring, sizeof(char) * 
X				       (strlen(copystring) +
X					strlen(tmp->string) +
X					srclen + 4));
X      sprintf(copystring, "%s '%s/%s'", copystring, srcdir, tmp->string);
X      tmp = tmp->next;
X    }
X    copystring = (String) XtRealloc (copystring, sizeof(char) *
X				     (strlen(copystring) +
X				      dstlen + 4));
X
X    sprintf(copystring, "%s '%s'", copystring, dstdir);
X    if ((status = execute(NULL, "cp", copystring, True)) != 0) {
X      XBell(XtDisplay(w), 100);
X      query_dialog("Can't copy file!", False);
X    }
X    XtFree(copystring);
X    /* refresh directory (clear highlights as a side effect) */
X    directoryManagerNewDirectory(cwd);
X  } else {
X    changestate(True);
X  }
X
X    
X  XtFree(srcdir);
X  XtFree(dstdir);
X  setCursor(left_ptr);
X  freeReturnStruct();
X}
X
Xpublic void moveQueryResult(Widget w, Boolean move, caddr_t call_data)
X{
X  extern void destroy_button_dialog(void);
X  extern void changestate(Boolean);
X  extern void setCursor(Cursor);
X  extern Boolean directoryManagerNewDirectory(String);
X  extern void query_dialog(String, Boolean);
X  extern Cursor busy, left_ptr;
X  private void freeReturnStruct(void);
X  public int execute(String, String, String, Boolean);
X  extern String cwd;
X  String movestring;
X  Cardinal srclen, dstlen;
X  int status;
X  XedwListReturnStruct *tmp;
X
X  destroy_button_dialog();
X
X  setCursor(busy);
X
X  if (move == True) {
X    /* move files */
X    
X    /* I can't be bothered writing my own move routine so I'll call
X     * 'mv(1)' via execute instead.
X     */
X    srclen = strlen(srcdir);
X    dstlen = strlen(dstdir);
X    movestring = XtNewString("mv -f - ");
X    tmp = return_list;
X    while (tmp != NULL) {
X      movestring = (String) XtRealloc (movestring, sizeof(char) * 
X				       (strlen(movestring) +
X					strlen(tmp->string) +
X					srclen + 4));
X      sprintf(movestring, "%s '%s/%s'", movestring, srcdir, tmp->string);
X      tmp = tmp->next;
X    }
X    movestring = (String) XtRealloc (movestring, sizeof(char) *
X				     (strlen(movestring) +
X				      dstlen + 4));
X
X    sprintf(movestring, "%s '%s'", movestring, dstdir);
X    if ((status = execute(NULL, "mv", movestring, True)) != 0) {
X      XBell(XtDisplay(w), 100);
X      query_dialog("Can't move file!", False);
X    }
X    XtFree(movestring);
X    /* refresh directory (clear highlights as a side effect) */
X    directoryManagerNewDirectory(cwd);
X  } else {
X    changestate(True);
X  }
X    
X  XtFree(srcdir);
X  XtFree(dstdir);
X  setCursor(left_ptr);
X  freeReturnStruct();
X}
X
Xprivate void freeReturnStruct(void)
X{
X  /* Deallocate memory for the current list return structure.
X   */
X
X  XedwListReturnStruct *tmp;
X
X  while(return_list != NULL) {
X    tmp = return_list;
X    return_list = return_list->next;
X    XtFree(tmp->string);
X    XtFree(tmp);
X  }
X}
X  
Xpublic void selectionChange(Widget w, Cardinal selection, caddr_t crap)
X{
X  extern AppSelection **appselections;
X  extern Cardinal selectionindex;
X  XedwList **list;
X  Arg arglist[1];
X  Cardinal i;
X
X  appman_selection = selection;
X  i = 0;
X  XtSetArg(arglist[i], XtNlabel, appselections[appman_selection]->name); i++;
X  XtSetValues(appManagerButton, arglist, i);
X
X  /* Change contents of AppManager to that of the new selection */
X  list = (XedwList**) appselections[appman_selection]->list;
X
X  XedwListChange(appManager, list, appselections[appman_selection]->number,
X		 0, True);
X
X  /* Reset scrollbar to top */
X  setscroll(appManagerView, 0.0);
X}
X
Xprivate void program_selected(Widget w, caddr_t client, caddr_t call)
X{
X  public int execute(String, String, String, Boolean);
X  public String build_arguments(String, SelOptions);
X  extern void setCursor(Cursor);
X  extern Cursor busy;
X  extern AppSelection **appselections;
X  XedwListReturnStruct *list;
X  AppProgram *node;
X  String program, filename;
X  Cardinal index;
X
X  setCursor(busy);
X  /* Get the index of the program double clicked */
X  list = XedwListShowCurrent(w);
X  index = list->xedwList_index;
X  node = appselections[appman_selection]->list[index];
X  program = XtNewString(node->program);
X  
X  /* extract filename from program */
X  filename = XtNewString(program);
X  filename = strtok(filename, " ");
X  
X  XtFree(list);
X  
X  /* check to see if there are any highlighted files to add as arguments, 
X   * if so check to see where the insertion point is, if no insertion 
X   * point then append arguments.
X   */
X
X  program = build_arguments(program, node->options);
X
X  
X  /* execute program */
X
X  execute(NULL, filename, program, False);
X  setCursor(NULL);
X
X}
X
Xpublic int execute(String fullname, String filename, 
X		    String args, Boolean cwait)
X{
X  typedef enum {ready, quote, normal, quoteready} QModes;
X
X  QModes mode;
X  Cardinal i, n, arglen;
X  int result, pid, fd;
X  int status = 0;
X  String newargs[MAXARGS], strptr;
X  
X  if (fullname == NULL) {
X    /* Find program */
X    result = -1;
X    for (i = 0; i < pathsize && result != 0; i++) {
X      /* append filename to path */
X      fullname = (String) XtRealloc (fullname, ((strlen(patharray[i])+
X						 strlen(filename) + 3)
X						* sizeof(char)));
X      strcpy(fullname, patharray[i]);
X      strcat(fullname, "/");
X      strcat(fullname, filename);
X
X      result = access(fullname, X_OK); /* Does file exist, Is file executable ? */
X    }
X    
X    if (result != 0) {
X      fprintf(stderr, "Warning: Command '%s' not found in PATH\n", filename);
X      return;
X    }
X  } 
X
X  /* split the args string into a NULL terminated array of strings .
X   * If a string of characters is enclosed within quotes, it is counted
X   * as a single argument.
X   */
X
X  n = 0;
X  mode = ready;
X  arglen = strlen(args);
X  for (i = 0; i < arglen; i++) {
X    switch (*(args+i)) {
X    case '\'':
X      if (mode == normal || mode == ready) {
X	/* start a new arg on the next normal chr */
X	mode = quoteready;
X      } else if (mode == quote || mode == quoteready) {
X	/* close current quote */
X	*(args+i) = '\0';
X	mode = ready;
X      }
X      break;
X    case ' ':
X    case '\t':
X      if (mode == normal) {
X	/* terminate current arg */
X	*(args+i) = '\0';
X	mode = ready;
X      }
X      break;
X    default:
X      if (mode == ready || mode == quoteready) {
X	/* start a new arg */
X	if (n == MAXARGS-1) {
X	  fprintf(stderr, "Error: Only %d arguments allowed"
X		  " to a command.\n", MAXARGS);
X	} else {
X	  newargs[n++] = args+i;
X	  if (mode == ready)
X	    mode = normal;
X	  else
X	    mode = quote;
X	}
X      }
X      break;
X    }
X  }
X	
X  newargs[n] = NULL;
X
X  if ((pid = fork()) == -1) 
X    fprintf(stderr, "Warning: unable to fork\n");
X  else 
X    if (pid == 0) {
X      /* Child */
X
X      /* Take standard input from /dev/null. This presents any child process
X       * with an immediate end-of-file when read.
X       * Also redirect standard output to /dev/null, but leave standard error
X       * associated with xdtm so we can see error messages on the console.
X       * (unless cwait is set, in whiich case stderr is redirected as well)
X       */
X      
X      if (close(0) == -1) 
X	fprintf(stderr, "Warning: can't close childs file descriptors\n");
X      else 
X	if (open("/dev/null", O_RDONLY, 0) == -1)
X	  fprintf(stderr, "Warning: can't open /dev/null as new input"
X		  " for child\n");
X      
X      if (close(1) == -1) 
X	fprintf(stderr, "Warning: can't close childs file descriptors\n");
X      else 
X	if (open("/dev/null", O_WRONLY, 0) == -1)
X	  fprintf(stderr, "Warning: can't open /dev/null as new output"
X		  " for child\n");
X
X      if (cwait) 
X	if (close(2) == -1) 
X	  fprintf(stderr, "Warning: can't close childs file descriptors\n");
X	else 
X	  if (open("/dev/null", O_WRONLY, 0) == -1)
X	    fprintf(stderr, "Warning: can't open /dev/null as new error output"
X		    " for child\n");
X
X      /* close all opened file descriptors (except stdin, stderr, stdout) */
X      for (fd = 3; fd < 20; fd++)
X	(void) close(fd); 
X
X      execv(fullname, newargs);
X
X      fprintf(stderr, "Warning: Exec on '%s' failed.\n", fullname);
X      exit(0);
X    } else {
X      /* Parent */
X      
X      /* If cwait is True then wait for the child to finish, then
X       * set status to it's return value.
X       */
X      if (cwait) {
X	wait(&status);
X	status = (status >> 8);
X      }
X    }
X
X  return(status);
X}
X
Xpublic String build_arguments(String program, SelOptions options)
X{
X  extern void changestate(Boolean);
X  extern String getfilename(String);
X  extern Widget directoryManager;
X  XedwListReturnStruct *list, *tmplist;
X  String ptr, tmpptr, arguments;
X
X  list = XedwListShowCurrent(directoryManager);
X
X  arguments = NULL;
X  if (options != N_SEL) {
X    while (list != NULL) {
X      arguments = XtRealloc (arguments, sizeof(char) * 
X			     (((arguments == NULL) ? 0 : strlen(arguments)) + 
X			      strlen(getfilename(list->string)) + 4));
X      strcat(arguments, " ");
X      strcat(arguments, getfilename(list->string));
X      tmplist = list;
X      list = list->next;
X      XtFree(tmplist);
X    }
X    /* insert the arguments into the program string */
X    program = XtRealloc (program, sizeof(char) * (strlen(program) + 
X						  strlen(arguments) + 4));
X    
X    if ((ptr = strstr(program, "!@")) != NULL) {
X      /* replace !@ with arguments */
X      tmpptr = XtNewString(ptr+2);
X      *ptr = '\0';
X      strcat(program, arguments);
X      strcat(program, tmpptr);
X      XtFree(tmpptr);
X    } else {
X      /* append arguments to program */
X      strcat(program, arguments);
X    }
X    XtFree(arguments);
X  } 
X
X  XedwListUnhighlight(directoryManager, XedwAll);
X  changestate(False); 
X
X  return(program);
X}
SHAR_EOF
chmod 0644 code/appman.c || echo "restore of code/appman.c fails"
echo "x - extracting code/buttons.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/buttons.c &&
X/*****************************************************************************
X ** File          : buttons.c                                               **
X ** Purpose       : Initialise and Realise button dialogs                   **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : April 1991                                              **
X ** Documentation : Xdtm Design Folder                                      **
X ** Related Files :                                                         **
X *****************************************************************************/
X
X#include "xdtm.h"
X#include "menus.h"
X
X#include <X11/Shell.h>
X#include <X11/Xaw/Label.h>
X#include <X11/Xaw/Command.h>
X#include <X11/Xaw/Viewport.h>
X#include "Xedw/XedwForm.h"
X#include "Xedw/XedwList.h"
X
Xextern void realize_dialog(Widget);
X
X/* Widgets */
X
Xprivate Widget buttonpopup; 	/* For conformation of move/copy/trash buttons */
Xprivate Widget buttonform;
Xprivate Widget buttonlabel1;
Xprivate Widget buttonlabel2;
Xprivate Widget buttonyes;
Xprivate Widget buttonno;
Xprivate Widget fileview;
Xprivate Widget filelist;
X
Xpublic void init_button(Widget top)
X{
X  Arg arglist[5];
X  Cardinal i;
X  XtTranslations translations;
X  Dimension height, space;
X  XFontStruct *font;
X
X  buttonpopup  =   XtCreatePopupShell("buttonpopup",
X				      transientShellWidgetClass,
X				      top,
X				      NULL, 0);
X
X
X  buttonform    =   XtCreateManagedWidget("buttonform",
X				      xedwFormWidgetClass,
X				      buttonpopup,
X				      NULL, 0);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter);  i++;
X  XtSetArg(arglist[i], XtNfullWidth,          True);  i++;
X  XtSetArg(arglist[i], XtNborderWidth,           0); i++;
X  buttonlabel1  =   XtCreateManagedWidget("buttonlabel1",
X					  labelWidgetClass,
X					  buttonform,
X					  arglist, i);
X
X  i = 3;
X  XtSetArg(arglist[i], XtNfromVert,   buttonlabel1);  i++; 
X  buttonlabel2  =   XtCreateManagedWidget("buttonlabel2",
X					  labelWidgetClass,
X					  buttonform,
X					  arglist, i);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert, buttonlabel2);  i++; 
X  XtSetArg(arglist[i], XtNfullWidth,        True);  i++;
X  XtSetArg(arglist[i], XtNforceBars,        True);  i++;
X  XtSetArg(arglist[i], XtNallowVert,        True);  i++;
X  fileview = XtCreateManagedWidget("fileview",
X				   viewportWidgetClass,
X				   buttonform,
X				   arglist, i);
X
X  translations = XtParseTranslationTable("");
X  i = 0;
X  XtSetArg(arglist[i], XtNdefaultColumns,  1); i++;
X  XtSetArg(arglist[i], XtNforceColumns, True); i++;
X  XtSetArg(arglist[i], XtNrowSpacing,      4); i++;
X  XtSetArg(arglist[i], XtNtranslations, translations); i++;
X  filelist = XtCreateManagedWidget("filelist",
X				   xedwListWidgetClass,
X				   fileview,
X				   arglist, i);
X
X
X  /* Get font height from filelist, then set fileview to be 5 times that
X   * size.
X   */
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfont, &font); i++;
X  XtSetArg(arglist[i], XtNrowSpacing, &space); i++;
X  XtGetValues(filelist, arglist, i);
X
X  height = (font->max_bounds.ascent +
X           font->max_bounds.descent +
X	   space) * 5;
X
X  i = 0;
X  XtSetArg(arglist[i], XtNheight, height); i++;
X  XtSetValues(fileview, arglist, i);
X
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert,       fileview);  i++; 
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter);  i++;
X  buttonno   =   XtCreateManagedWidget("buttonyes",
X				       commandWidgetClass,
X				       buttonform,
X				       arglist, i);
X 
X  i = 2;
X  XtSetArg(arglist[i], XtNfromHoriz,   buttonno);  i++;
X  XtSetArg(arglist[i], XtNwidthLinked, buttonno);  i++;
X  buttonyes  =   XtCreateManagedWidget("buttonyes",
X				       commandWidgetClass,
X				       buttonform,
X				       arglist, i);
X
X}
X
X
Xpublic void button_dialog(Cardinal type, XedwListReturnStruct *list)
X{
X  private int buttoniconcmp(XedwList **, XedwList **);
X  extern String getfilename(String);
X  extern void setscroll(Widget, float);
X
X  XedwListReturnStruct *tmp;
X  XedwList **buttonlist;
X  Arg arglist[5];
X  Cardinal i, n;
X  private String CancelButtonLabel = "Cancel";
X
X  /* Count items in linked list */
X  n = 0;
X  tmp = list;
X  while (tmp != NULL) {
X    tmp = tmp->next;
X    n++;
X  }
X
X  /* Allocate an array of XedwList* of that size */
X  buttonlist = (XedwList**) XtMalloc (sizeof(XedwList*) * (n+1));
X
X  /* Put Strings from linked list into array, using NULL icons */
X  for (i = 0; i < n; i++) {
X    buttonlist[i] = XtNew(XedwList);
X    buttonlist[i]->string = list->string;
X    list = list->next;
X  }
X  buttonlist[i] = NULL;
X
X  /* Sort the list */
X  qsort((char*)buttonlist, n, sizeof(buttonlist[0]), buttoniconcmp);
X
X  /* Reset view to top */
X
X  setscroll(fileview, 0.0);
X
X  switch (type) {
X  case Trash:
X    {
X      extern void trashQueryResult(Widget, Boolean, caddr_t);
X      private String TrashLabel1       = "Delete these files";
X      private String TrashLabel2       = "from current directory?";
X      private String TrashButtonLabel  = "Delete";
X
X      /* label */
X      i = 0;
X      XtSetArg(arglist[i], XtNlabel, TrashLabel1);  i++;
X      XtSetValues(buttonlabel1, arglist, i);
X    
X      /* label2 */
X      i = 0;
X      XtSetArg(arglist[i], XtNlabel,       TrashLabel2);  i++; 
X      XtSetValues(buttonlabel2, arglist, i);
X      
X      /* file list */
X      i = 0;
X      XtSetArg(arglist[i], XtNlongest,           0); i++;
X      XtSetArg(arglist[i], XtNnumberStrings,     0); i++;
X      XtSetArg(arglist[i], XtNxedwList, buttonlist); i++;
X      XtSetValues(filelist, arglist, i);
X
X      /* button1 */
X      i = 0;
X      XtSetArg(arglist[i], XtNlabel, CancelButtonLabel);  i++;
X      XtSetValues(buttonno, arglist, i);
X      
X      /* button2 */
X      i = 0;
X      XtSetArg(arglist[i], XtNlabel,   TrashButtonLabel);  i++;
X      XtSetValues(buttonyes, arglist, i);
X      
X      XtAddCallback(buttonno, XtNcallback, trashQueryResult, False);
X      XtAddCallback(buttonyes, XtNcallback, trashQueryResult, True);
X      realize_dialog(buttonpopup);
X      break;
X    }
X  case Copy:
X    {
X      extern void copyQueryResult(Widget, Boolean, caddr_t);
X      private String CopyLabel1       = "Copy these files";
X      private String CopyLabel2       = "to current directory?";
X      private String CopyButtonLabel  = "Copy";
X
X      /* label */
X      i = 0;
X      XtSetArg(arglist[i], XtNlabel, CopyLabel1);  i++;
X      XtSetValues(buttonlabel1, arglist, i);
X    
X      /* label2 */
X      i = 0;
X      XtSetArg(arglist[i], XtNlabel, CopyLabel2);  i++; 
X      XtSetValues(buttonlabel2, arglist, i);
X      
X      /* file list */
X      i = 0;
X      XtSetArg(arglist[i], XtNlongest,           0); i++;
X      XtSetArg(arglist[i], XtNnumberStrings,     0); i++;
X      XtSetArg(arglist[i], XtNxedwList, buttonlist); i++;
X      XtSetValues(filelist, arglist, i);
X
X      /* button1 */
X      i = 0;
X      XtSetArg(arglist[i], XtNlabel, CancelButtonLabel);  i++;
X      XtSetValues(buttonno, arglist, i);
X      
X      /* button2 */
X      i = 0;
X      XtSetArg(arglist[i], XtNlabel, CopyButtonLabel);  i++;
X      XtSetValues(buttonyes, arglist, i);
X      
X      XtAddCallback(buttonno, XtNcallback,  copyQueryResult, False);
X      XtAddCallback(buttonyes, XtNcallback, copyQueryResult, True);
X      realize_dialog(buttonpopup);
X      break;
X    }
X  case Move:
X    {
X      extern void moveQueryResult(Widget, Boolean, caddr_t);
X      private String MoveLabel1       = "Move these files";
X      private String MoveLabel2       = "to current directory?";
X      private String MoveButtonLabel  = "Move";
X
X      /* label */
X      i = 0;
X      XtSetArg(arglist[i], XtNlabel, MoveLabel1);  i++;
X      XtSetValues(buttonlabel1, arglist, i);
X    
X      /* label2 */
X      i = 0;
X      XtSetArg(arglist[i], XtNlabel, MoveLabel2);  i++; 
X      XtSetValues(buttonlabel2, arglist, i);
X      
X      /* file list */
X      i = 0;
X      XtSetArg(arglist[i], XtNlongest,           0); i++;
X      XtSetArg(arglist[i], XtNnumberStrings,     0); i++;
X      XtSetArg(arglist[i], XtNxedwList, buttonlist); i++;
X      XtSetValues(filelist, arglist, i);
X
X      /* button1 */
X      i = 0;
X      XtSetArg(arglist[i], XtNlabel, CancelButtonLabel);  i++;
X      XtSetValues(buttonno, arglist, i);
X      
X      /* button2 */
X      i = 0;
X      XtSetArg(arglist[i], XtNlabel, MoveButtonLabel);  i++;
X      XtSetValues(buttonyes, arglist, i);
X      
X      XtAddCallback(buttonno, XtNcallback,  moveQueryResult, False);
X      XtAddCallback(buttonyes, XtNcallback, moveQueryResult, True);
X      realize_dialog(buttonpopup);
X      break;
X    }
X
X  default:
X    fprintf(stderr, "Unrecognised button dialog request\n");
X    break;
X  }
X
X  /* deallocate memory for newlist */
X
X}
X
Xpublic void destroy_button_dialog(void)
X{
X  XtPopdown(buttonpopup);
X  
X  XtRemoveAllCallbacks(buttonyes, XtNcallback);
X  XtRemoveAllCallbacks(buttonno, XtNcallback);
X
X}
X
Xprivate int buttoniconcmp(XedwList **ip1, XedwList **ip2)
X{
X  /* compare the strings of 2 XedwList's */
X
X  return (strcmp((*ip1)->string, 
X		 (*ip2)->string));
X}
SHAR_EOF
chmod 0644 code/buttons.c || echo "restore of code/buttons.c fails"
echo "x - extracting code/dialogs.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/dialogs.c &&
X/* v0.2 */
X/***********************************************************************************
X ** File          : dialogs.c                                                     **
X ** Purpose       : Initialise and Realise dialogs                                **
X ** Author        : Edward Groenendaal                                            **
X ** Date          : 18th Feb 1991                                                 **
X ** Documentation : Xdtm Design Folder                                            **
X ** Related Files : quit.c buttons.c listoption.c map.c select.c display.c        **
X **                 newfile.c							  **
X ***********************************************************************************/
X
X/* dialog box's provided: Quit    - Quit (yes/no)
X *			  Button  - Do action to these files (yes/no)
X *                        Longl   - Select options on Long Listing
X *                        Map     - Map program x over selected files OR
X *                        Select  - Select files using RE x.
X *			  Query   - Display file?
X * 			  Display - Display a file.
X *           		  Newfile - Ask for filename, create empty file. 
X *			  Info    - Give info about a file.
X *
X * Create instances of popup shells and forms, plus one of each of the 'core' dialog
X */
X
X#include "xdtm.h"
X
Xpublic void createDialogWidgets(Widget top)
X{
X
X  extern void init_quit(Widget);
X  extern void init_button(Widget);
X  extern void init_listoption(Widget);
X  extern void init_map(Widget);
X  extern void init_query(Widget);
X  extern void init_display(Widget);
X  extern void init_newfile(Widget);
X  extern void init_info(Widget);
X
X  init_quit(top);
X  init_button(top);
X  init_listoption(top);
X  init_map(top);
X  init_query(top);
X  init_display(top);
X  init_newfile(top);
X  init_info(top);
X 				 
X}
X
Xpublic void realize_dialog(Widget popup)
X{
X  extern Widget topLevel;
X  Position x,y;
X  Dimension appWidth, appHeight, qWidth, qHeight;
X  XtGeometryResult result;
X  XtWidgetGeometry answer, question;
X  Arg arglist[2];
X  Cardinal i;
X  
X  /* You dont know the dimensions of a widget for certain until it is
X   * realized, therefore realize the dialog.
X   * NOTE: XtRealizeWidget returns without an error if widget is already
X   *       realized, hence no check via XtIsRealized.
X   */
X
X  XtRealizeWidget(popup);
X
X  /* Get dimensions of application */
X  i = 0;
X  XtSetArg(arglist[i], XtNwidth,  &appWidth);    i++;
X  XtSetArg(arglist[i], XtNheight, &appHeight);   i++;
X  XtGetValues(topLevel, arglist, i);
X
X  /* Get dimensions of quit popup */
X  i = 0;
X  XtSetArg(arglist[i], XtNwidth,  &qWidth);    i++;
X  XtSetArg(arglist[i], XtNheight, &qHeight);   i++;
X  XtGetValues(popup, arglist, i);
X
X  /* Translate application coordinates to screen coordinates */
X  XtTranslateCoords(topLevel,
X		    (Position) ((appWidth/2)-(qWidth/2)),
X		    (Position) ((appHeight/2)-(qHeight/2)),
X		    &x, &y);
X
X  /* move popup shell to that position */
X  i = 0;
X  XtSetArg(arglist[i], XtNx, x);  i++;
X  XtSetArg(arglist[i], XtNy, y);  i++;
X  XtSetValues(popup, arglist, i);
X
X  XtPopup(popup, XtGrabNonexclusive);
X  
X}
SHAR_EOF
chmod 0644 code/dialogs.c || echo "restore of code/dialogs.c fails"
echo "x - extracting code/dirman.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/dirman.c &&
X/* v0.3 */
X/*****************************************************************************
X ** File          : dirman.c                                                **
X ** Purpose       : Directory Manager                                       **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : 18th Feb 1990                                           **
X ** Documentation : Xedw Design Folder                                      **
X ** Related Files :                                                         **
X *****************************************************************************/
X
X/* Include the application header file */
X#include "xdtm.h"
X
X/* Include the local header files */
X#include <sys/types.h>
X#include <dirent.h>
X#include <sys/stat.h>
X#include <sys/param.h>
X#include <X11/Xaw/AsciiText.h>
X
X#include "menus.h"
X#include "Xedw/XedwList.h"
X#include "Xedw/XedwForm.h"
X
X#define LISTSIZE    128
X#define LISTINCR    64
X
Xpublic void   changestate(Boolean);        /* Change sensitivity */
Xpublic String getfilename(String);	   /* extract filename */
X
Xpublic Widget directoryManager;
Xpublic String cwd;			 /* current working directory */
Xpublic Cardinal icon_list_size = 0;
Xpublic Cardinal icon_list_max_size = LISTSIZE;
Xpublic XedwList **icon_list;
X
X/* local copies of the menu panes which are to be made insensitive when
X * no there is no current selection.
X */
Xprivate Widget duplicatemenu, getinfomenu, trashmenu, 
X               copymenu, movemenu, mapmenu;
X
Xpublic void createDirectoryManagerWidgets(Widget view)
X{
X  public  void selection_made(Widget, caddr_t, caddr_t);
X  private void DoubleClick(Widget, XButtonEvent*);
X  private void GoUp(Widget, XButtonEvent*);
X  private void SelectAll(Widget, XButtonEvent*);
X  private void Refresh(Widget, XButtonEvent*);
X
X  extern AppData app_data;
X  extern Icon_mode current_mode;
X  Cardinal i;
X  Arg arglist[6];
X  XtTranslations dirManTranslations;
X
X  static XtActionsRec actions[] = {
X    {"DoubleClick", DoubleClick},
X    {"GoUp",        GoUp},
X    {"SelectAll",   SelectAll},
X    {"Refresh",     Refresh},
X    {NULL, NULL}
X  };
X
X  static char defaultTranslations[] =
X             "<Btn1Up>(2):     DoubleClick()\n\
X              <Key>u:          GoUp()\n\
X              <Key>a:          SelectAll()\n\
X	      Ctrl<Key>L:      Refresh()";
X  
X  i = 0;
X  switch (current_mode.mode) {
X  case Icons:
X    XtSetArg(arglist[i], XtNshowIcons, True); i++;
X    break;
X  case Short:
X    XtSetArg(arglist[i], XtNshowIcons,   False); i++;
X    XtSetArg(arglist[i], XtNrowSpacing, 5); i++;
X    break;
X  case Long:
X    XtSetArg(arglist[i], XtNshowIcons,   False); i++;
X    XtSetArg(arglist[i], XtNrowSpacing,      5); i++;
X    XtSetArg(arglist[i], XtNforceColumns, True); i++;
X    XtSetArg(arglist[i], XtNdefaultColumns,  1); i++;    
X  }
X  XtSetArg(arglist[i], XtNfont, app_data.dm_font); i++;    
X  XtSetArg(arglist[i], XtNmSelections,      True); i++;
X  directoryManager    =   XtCreateManagedWidget("directoryManager",
X						xedwListWidgetClass,
X						view,
X						arglist, i);
X
X  XtAddCallback(directoryManager, XtNcallback, selection_made, 0);
X  XtAddActions(actions, XtNumber(actions));
X  dirManTranslations = XtParseTranslationTable(defaultTranslations);
X  XtAugmentTranslations(directoryManager, dirManTranslations);
X}
X
Xpublic Boolean directoryManagerNewDirectory(String newpath)
X{
X  extern Boolean getIconType(String, String, XedwList*);
X  extern void setCursor(Cursor);
X  extern void setscroll(Widget, float);
X  private int iconcmp(XedwList*, XedwList*);
X
X  extern Icon_mode current_mode;
X  extern Cursor busy;
X  extern Widget dirSelector;
X  extern Widget directoryManagerView;
X  Arg args[1];
X  XedwList temp;
X  DIR *dirp;
X  struct dirent *dp;
X  Cardinal i = 0, n;
X  Boolean result = False;
X
X  /* create a new one */
X  if ((dirp = opendir(newpath)) != NULL && chdir(newpath) == 0) {
X
X    /* set cursor to busy */
X    setCursor(busy);
X
X    /* Trash old list */
X    for(i=0; i < icon_list_size; i++) {
X      XtFree(icon_list[i]->string);
X      XtFree(icon_list[i]);
X    }
X
X    i = 0;
X    while ((dp = readdir(dirp)) != NULL) {
X      if (i == icon_list_max_size) {
X	icon_list_max_size += LISTINCR;
X	icon_list = (XedwList**) XtRealloc(icon_list,
X					   sizeof(XedwList*) * 
X					   icon_list_max_size);
X      } else 
X	if (getIconType(dp->d_name, newpath, &temp)) {
X	  icon_list[i] = XtNew(XedwList);
X	  icon_list[i]->string = temp.string;
X	  icon_list[i]->icon   = temp.icon;
X	  i++;
X	}
X    }
X    icon_list[i] = NULL;
X    icon_list_size = i;
X    qsort((char*)icon_list, icon_list_size, sizeof(icon_list[0]), iconcmp);
X    XedwListChange(directoryManager, icon_list, icon_list_size, 0, True);
X    setscroll(directoryManagerView, 0.0);
X    closedir(dirp);
X    result = True;
X    /* Change entry in the directory selector */
X    XtSetArg(args[0], XtNstring, newpath); 
X    XtSetValues(dirSelector, args, 1);
X    /* reset cursor */
X    setCursor(NULL);
X  } else XBell(XtDisplay(directoryManager), 100);
X  return(result);
X}
X
X
Xprivate int iconcmp(XedwList **ip1, XedwList **ip2)
X{
X  /* compare the strings of 2 XedwList's */
X
X  return (strcmp(getfilename((*ip1)->string), 
X		 getfilename((*ip2)->string)));
X}
X
Xpublic void initDirectoryManager(void)
X{
X  extern Boolean buttonSensitive;
X  extern Widget menuBar;
X  char tmpcwd[MAXPATHLEN];
X
X  /* Initialise the icon list */
X  icon_list = (XedwList**) XtMalloc(sizeof(XedwList*) * LISTSIZE);
X
X  /* Set the starting directory */
X  if (getwd(tmpcwd) != NULL) 
X    cwd = XtNewString(tmpcwd);
X  else
X    if ((cwd = (char*) getenv("HOME")) == NULL) 
X      cwd = XtNewString("/");
X    else
X      cwd = XtNewString(cwd);
X
X  /* Get the id's of the menu widgets which are to be toggled with the
X   * buttons. Note: This relies on the menus being created first, which
X   * they are.
X   */
X  if ((duplicatemenu = 
X       XtNameToWidget(menuBar, "fileMenuButton.fileMenu.duplicate")) == NULL) {
X    fprintf(stderr, "Directorymanager: Can't find duplicate menu widget\n");
X    exit(2);
X  }
X  if ((getinfomenu = 
X       XtNameToWidget(menuBar, "fileMenuButton.fileMenu.getinfo")) == NULL) {
X    fprintf(stderr, "Directorymanager: Can't find getinfo menu widget\n");
X    exit(2);
X  }
X  if ((trashmenu   = 
X       XtNameToWidget(menuBar, "fileMenuButton.fileMenu.trash")) == NULL) {
X    fprintf(stderr, "Directorymanager: Can't find trash menu widget\n");
X    exit(2);
X  }
X  if ((copymenu    = 
X       XtNameToWidget(menuBar, "fileMenuButton.fileMenu.copy")) == NULL) {
X    fprintf(stderr, "Directorymanager: Can't find copy menu widget\n");
X    exit(2);
X  }
X  if ((movemenu    = 
X       XtNameToWidget(menuBar, "fileMenuButton.fileMenu.move")) == NULL) {
X    fprintf(stderr, "Directorymanager: Can't find move menu widget\n");
X    exit(2);
X  }
X  if ((mapmenu     = 
X       XtNameToWidget(menuBar, "optionMenuButton.optionMenu.map")) == NULL) {
X    fprintf(stderr, "Directorymanager: Can't find map menu widget\n");
X    exit(2);
X  }
X  (void) directoryManagerNewDirectory(cwd);
X  buttonSensitive = True;
X  changestate(False); 	   /* Insure that menus are insensitive */
X}
X
Xpublic void selection_made(Widget w, caddr_t client_data, caddr_t call_data)
X{
X  /* Someone has either selected or deselected an item.
X   * If there's nothing selected then buttons are changed to 
X   * not sensitive.
X   */
X
X  extern Boolean buttonSensitive;
X  extern Widget trashButton, copyButton, moveButton;
X  Arg arglist[1];
X  Cardinal i;
X
X
X  if (XedwListSelection(w) != buttonSensitive)
X    if (buttonSensitive == False) {
X      changestate(True);
X    } else {
X      changestate(False);
X    }
X}
X
Xprivate void DoubleClick(Widget w, XButtonEvent *event)
X{
X  /* Either Start a program, View a file or change directory.
X   * executable = try to exec it.
X   * directory  = try to enter it.
X   * otherwise offer to view it.
X   */
X  extern void query_dialog(String, Boolean);
X  extern int execute(String, String, String, Boolean);
X
X  extern Boolean buttonSensitive;
X  extern Widget trashButton, moveButton, copyButton;
X
X  struct stat filestatus;
X  String fullname, filename, temp;
X  XedwListReturnStruct *highlighted;
X  Arg arglist[1];
X  Cardinal i;
X
X  selection_made(w, (caddr_t)0, (caddr_t)0);
X  highlighted = XedwListShowCurrent(w);
X
X  if (highlighted->xedwList_index != XDTM_LIST_NONE) {
X    filename = getfilename(highlighted->string);
X    fullname=(String) XtMalloc((strlen(filename)+strlen(cwd)+1) * sizeof(char));
X    strcpy(fullname, cwd);
X    if (strcmp(cwd, "/") != 0)
X      strcat(fullname, "/");
X    strcat(fullname, filename);
X    if (stat(fullname, &filestatus) == -1) {
X      fprintf(stderr,"xdtm: ARRRGGHHH stat error\n");
X    } else {
X      if ((filestatus.st_mode & S_IFMT) == S_IFDIR) {
X	if (strcmp(filename, "..") == 0) {
X	  strcpy(fullname, cwd);
X	  if ((temp = (char*) strrchr(fullname, '/')) == NULL) 
X	    fprintf(stderr, "xdtm: impossible error\n");
X	  if (temp == fullname)
X	    *(temp+1) = '\0';
X	  else
X	    *temp = '\0';
X	}  
X	if (strcmp(filename, ".") == 0) {
X	  XtFree(fullname);
X	  fullname=XtNewString(cwd);
X	}
X	if (directoryManagerNewDirectory(fullname) == True) {
X	  XtFree(cwd);
X	  cwd=fullname;
X	  changestate(False);
X	} else XBell(XtDisplay(w), 100);
X      } else {
X	/* Not a directory, is it executable */
X	if ((filestatus.st_mode & S_IXUSR) != 0 ||
X	    (filestatus.st_mode & S_IXGRP) != 0 ||
X	    (filestatus.st_mode & S_IXOTH) != 0) {
X	  extern void setCursor(Cursor);
X	  extern Cursor busy;
X
X	  setCursor(busy);
X	  execute(fullname, filename, filename, False);
X	  setCursor(NULL);
X	} else
X	  if ((filestatus.st_mode & S_IFMT) == S_IFREG) {
X	    /* Display dialog box to ask whether to display file */
X	    query_dialog(fullname, True);
X	  } else XBell(XtDisplay(w), 100);
X	XtFree(fullname);
X      }
X    }
X    XtFree(highlighted);
X  }
X}
X
Xprivate void GoUp(Widget w, XButtonEvent *event)
X{
X  Cardinal i;
X  /* Find entry with .. */
X  for (i=0; i < icon_list_size && 
X       (strcmp(getfilename(icon_list[i]->string), "..") != 0); i++); 
X
X  XedwListUnhighlight(w, XedwAll);
X  /* Call XedwListHighlight with item number */
X  XedwListHighlight(w, i);
X
X  /* Call double click */
X
X  DoubleClick(w, (XButtonEvent*) NULL);
X
X}
X
Xprivate void SelectAll(Widget w, XButtonEvent *event)
SHAR_EOF
echo "End of part 1"
echo "File code/dirman.c is continued in part 2"
echo "2" > s2_seq_.tmp
exit 0

eddyg@syma.sussex.ac.uk (Edward J. Groenendaal) (04/18/91)

---- Cut Here and unpack ----
#!/bin/sh
# this is part 2 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file code/dirman.c continued
#
CurArch=2
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file code/dirman.c"
sed 's/^X//' << 'SHAR_EOF' >> code/dirman.c
X{
X  extern Boolean buttonSensitive;
X  extern Widget trashButton, moveButton, copyButton;
X  public void changestate(Boolean);
X  extern void setCursor(Cursor);
X  extern Mode mode;
X  extern Cursor busy;
X
X  Arg arglist[1];
X  Cardinal i;
X
X  if (mode == NormalMode) {
X    setCursor(busy);
X    XedwListHighlight(w, XedwAll);
X    
X    /* unhighlight . and .. */
X    for (i=0; i < icon_list_size && 
X	 (strcmp(getfilename(icon_list[i]->string), ".") != 0); i++); 
X    XedwListUnhighlight(w, i);
X    for (i=i; i < icon_list_size && 
X	 (strcmp(getfilename(icon_list[i]->string), "..") != 0); i++); 
X    XedwListUnhighlight(w, i);
X    setCursor(NULL);
X  } else
X    XBell(XtDisplay(w), 100);
X  
X  /* do buttons */
X  if (icon_list_size > 2) {
X    changestate(True);
X  }
X}
X
Xprivate void Refresh(Widget w, XButtonEvent *event)
X{
X  directoryManagerNewDirectory(cwd);
X}
X
Xpublic void changestate(Boolean new)
X{
X  extern Boolean buttonSensitive;
X  extern Widget trashButton, copyButton, moveButton;
X  extern Mode mode;
X
X  if (buttonSensitive == True) {
X    if (mode == MoveMode) {
X      /* Turn off Trash and Copy */
X      XtSetSensitive(copyButton,    False);
X      XtSetSensitive(trashButton,   False);
X      XtSetSensitive(copymenu,      False);
X      XtSetSensitive(trashmenu,     False);
X      XtSetSensitive(mapmenu,       False);
X      XtSetSensitive(getinfomenu,   False);
X      XtSetSensitive(duplicatemenu, False);
X      buttonSensitive = False;
X    } else if (mode == CopyMode) {
X      /* Turn off Trash and Move */
X      XtSetSensitive(moveButton,    False);
X      XtSetSensitive(trashButton,   False);
X      XtSetSensitive(movemenu,      False);
X      XtSetSensitive(trashmenu,     False);
X      XtSetSensitive(mapmenu,       False);
X      XtSetSensitive(getinfomenu,   False);
X      XtSetSensitive(duplicatemenu, False);
X      buttonSensitive = False;
X    } else if (new == False) {
X      /* Turn off All */
X      XtSetSensitive(moveButton,    False);
X      XtSetSensitive(copyButton,    False);
X      XtSetSensitive(trashButton,   False);
X      XtSetSensitive(copymenu,      False);
X      XtSetSensitive(movemenu,      False);
X      XtSetSensitive(trashmenu,     False);
X      XtSetSensitive(mapmenu,       False);
X      XtSetSensitive(getinfomenu,   False);
X      XtSetSensitive(duplicatemenu, False);
X      buttonSensitive = False;
X    }
X  } else {
X    /* buttonSensitive == False */
X
X    /* If in MoveMode or CopyMode, then everything is set anyway */
X    if (mode == NormalMode && new == True) {
X      /* Set all to True */
X      XtSetSensitive(trashButton,   True);
X      XtSetSensitive(moveButton,    True);
X      XtSetSensitive(copyButton,    True);
X      XtSetSensitive(trashmenu,     True);
X      XtSetSensitive(movemenu,      True);
X      XtSetSensitive(copymenu,      True);
X      XtSetSensitive(getinfomenu,   True);
X      XtSetSensitive(duplicatemenu, True);
X      XtSetSensitive(mapmenu,       True);
X      buttonSensitive = True;
X    }
X  }
X}
X      
Xpublic String getfilename(String s)
X{
X  extern Icon_mode current_mode;
X
X  if (current_mode.mode == Long && (strlen(s) > current_mode.length))
X    return (s+current_mode.length);
X  else
X    return (s);
X}
SHAR_EOF
echo "File code/dirman.c is complete"
chmod 0644 code/dirman.c || echo "restore of code/dirman.c fails"
echo "x - extracting code/display.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/display.c &&
X/*****************************************************************************
X ** File          : display.c                                               **
X ** Purpose       : Initialise and Realise display and query dialogs        **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : April 1991                                              **
X ** Documentation : Xdtm Design Folder                                      **
X ** Related Files :                                                         **
X *****************************************************************************/
X
X#include "xdtm.h"
X
X#include <sys/file.h>    /* For access(2) */
X#include <sys/signal.h>  /* For longjmp */
X#include <setjmp.h>      /* For longjmp */
X
X#include <X11/Shell.h>
X#include <X11/Xaw/Label.h>
X#include <X11/Xaw/Command.h>
X#include <X11/Xaw/AsciiText.h>
X#include "Xedw/XedwForm.h"
X
Xextern void realize_dialog(Widget);
X
X
Xtypedef enum {ViewReturn, CancelReturn} queryReturn;
X
Xpublic String viewfile;
Xprivate jmp_buf env;
X
X/* Widgets */
Xprivate Widget querypopup;      /* For asking whether to display a file */
Xprivate Widget displaypopup;    /* For displaying a file */
Xprivate Widget queryform;
Xprivate Widget displayform;
Xprivate Widget querylabel;
Xprivate Widget displaylabel;
Xprivate Widget queryyes;
Xprivate Widget queryno;
Xprivate Widget displayquit;
Xprivate Widget displaytext;
X
Xpublic void init_query(Widget top)
X{
X  Arg arglist[5];
X  Cardinal i;
X
X  querypopup = XtCreatePopupShell("querypopup",
X				  transientShellWidgetClass,
X				  top,
X				  NULL, 0);
X
X  queryform  = XtCreateManagedWidget("queryform",
X				     xedwFormWidgetClass,
X				     querypopup,
X				     NULL, 0);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNborderWidth,           0); i++;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
X  XtSetArg(arglist[i], XtNfullWidth,          True); i++;
X  querylabel = XtCreateManagedWidget("querylabel",
X				     labelWidgetClass,
X				     queryform,
X				     arglist, i);
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert,     querylabel); i++;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
X  queryno    = XtCreateManagedWidget("queryno",
X				     commandWidgetClass,
X				     queryform,
X				     arglist, i);  
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert,     querylabel); i++;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
X  XtSetArg(arglist[i], XtNfromHoriz,      queryno); i++;
X  XtSetArg(arglist[i], XtNwidthLinked,    queryno); i++;
X  queryyes   = XtCreateManagedWidget("queryyes",
X				     commandWidgetClass,
X				     queryform,
X				     arglist, i);
X				     
X}
X
Xpublic void init_display(Widget top)
X{
X  private void destroy_display_dialog(Boolean);
X
X  extern AppData app_data;
X  XFontStruct *font;
X  Arg arglist[8];
X  Cardinal i, width, height;
X
X  private String DisplayQuit = "Quit";
X
X  /* Create popup */
X  displaypopup  = XtCreatePopupShell("displaypopup",
X				     transientShellWidgetClass,
X				     top,
X				     NULL, 0);
X  
X  displayform   = XtCreateManagedWidget("displayform",
X					xedwFormWidgetClass,
X					displaypopup,
X					NULL, 0);
X  i = 0;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
X  XtSetArg(arglist[i], XtNfullWidth,          True); i++;
X  displaylabel  = XtCreateManagedWidget("displaylabel",
X					labelWidgetClass,
X					displayform,
X					arglist, i);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfont,            app_data.view_font); i++;
X  XtSetArg(arglist[i], XtNfullWidth,                     True); i++;
X  XtSetArg(arglist[i], XtNfromVert,              displaylabel); i++;
X  XtSetArg(arglist[i], XtNscrollVertical, XawtextScrollAlways); i++; 
X  XtSetArg(arglist[i], XtNtype,                  XawAsciiFile); i++;
X  XtSetArg(arglist[i], XtNstring,                 "/dev/null"); i++;
X  XtSetArg(arglist[i], XtNdataCompression,              False); i++;
X  displaytext   = XtCreateManagedWidget("displaytext",
X					asciiTextWidgetClass,
X					displayform,
X					arglist, i);
X
X  /* Get font from text widget, set the width of the widget to the
X   * maximum width of any character in that font multiplied by 85,
X   * set the height of the widget to (ascent + descent) * 24.
X   * 
X   * This gives a default viewing area of 85x25 characters if using a fixed 
X   * width font, wider if using a variable width font.
X   *
X   * Note: The user may override these sizes view the application resources.
X   */
X
X  XtSetArg(arglist[0], XtNfont, &font);
X  XtGetValues(displaytext, arglist, 1);
X
X  width =  (font->max_bounds.width * app_data.view_width);
X  height = ((font->max_bounds.ascent +
X           font->max_bounds.descent) * app_data.view_height);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNwidth,   width); i++;
X  XtSetArg(arglist[i], XtNheight, height); i++;
X  XtSetValues(displaytext, arglist, i);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNlabel,       DisplayQuit); i++;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
X  XtSetArg(arglist[i], XtNfromVert,    displaytext); i++;
X  displayquit   = XtCreateManagedWidget("displayquit",
X					commandWidgetClass,
X					displayform,
X					arglist, i);
X				       
X  XtAddCallback(displayquit, XtNcallback, destroy_display_dialog, True);
X
X}
X
X
Xpublic void query_dialog(String fullname, Boolean Query)
X{    
X  private void queryQueryResult(Widget, queryReturn, caddr_t);
X
X  Arg arglist[2];
X  Cardinal i;
X
X  if (Query == True) {
X    /* display query dialog */
X
X    private String QueryLabel = "View selected file?";
X    private String QueryNo    = " Cancel ";
X    private String QueryYes   = "View";
X
X    i = 0;
X    XtSetArg(arglist[i], XtNlabel, QueryLabel); i++;
X    XtSetValues(querylabel, arglist, i);
X
X    i = 0;
X    XtSetArg(arglist[i], XtNsensitive, True); i++;
X    XtSetArg(arglist[i], XtNlabel,  QueryNo); i++;
X    XtSetValues(queryno, arglist, i);
X
X    i = 0;
X    XtSetArg(arglist[i], XtNlabel, QueryYes); i++;
X    XtSetValues(queryyes, arglist, i);
X
X    XtAddCallback(queryyes, XtNcallback, queryQueryResult, ViewReturn);
X    XtAddCallback(queryno,  XtNcallback, queryQueryResult, CancelReturn);
X
X    viewfile = XtNewString(fullname);
X
X  } else {
X    /* display view error dialog */
X
X    private String QueryNo    = " Cancel ";
X    private String QueryYes   = "OK";
X
X    i = 0;
X    XtSetArg(arglist[i], XtNlabel, fullname); i++;
X    XtSetValues(querylabel, arglist, i);
X
X    i = 0;
X    XtSetArg(arglist[i], XtNsensitive, False); i++;
X    XtSetArg(arglist[i], XtNlabel,   QueryNo); i++;
X    XtSetValues(queryno, arglist, i);
X
X    i = 0;
X    XtSetArg(arglist[i], XtNlabel, QueryYes); i++;
X    XtSetValues(queryyes, arglist, i);
X
X    XtAddCallback(queryyes, XtNcallback, queryQueryResult, CancelReturn);
X    XtAddCallback(queryno,  XtNcallback, queryQueryResult, CancelReturn);
X
X    XBell(XtDisplay(displaypopup), 100);
X  }
X  
X  realize_dialog(querypopup);
X
X}
X
Xprivate void destroy_query_dialog(void)
X{
X  XtPopdown(querypopup);
X  
X  XtRemoveAllCallbacks(queryyes, XtNcallback);
X  XtRemoveAllCallbacks(queryno,  XtNcallback);
X
X}
X
X/* display */
X
Xpublic void displayfile(String fullname)
X{
X  extern void setCursor(Cursor);
X  extern Cursor busy;
X  private void seggie(int);
X  Arg arglist[5];
X  Cardinal i;
X
X  setCursor(busy);
X  signal(SIGSEGV, seggie);
X  if (setjmp(env) == 0) {
X    i = 0;
X    XtSetArg(arglist[i], XtNstring, fullname); i++;
X    XtSetValues(displaytext, arglist, i);
X    i = 0;
X    XtSetArg(arglist[i], XtNlabel,  fullname); i++;
X    XtSetValues(displaylabel, arglist, i);
X
X    setCursor(NULL);
X    realize_dialog(displaypopup);
X  } else {
X    setCursor(NULL);
X    query_dialog("Not a text file!", False);
X  }
X  signal(SIGSEGV, SIG_DFL);
X}
X
Xprivate void seggie(int value)
X{
X  longjmp(env, value);
X}
X
X
Xprivate void destroy_display_dialog(Boolean destroy)
X{
X  XtPopdown(displaypopup);
X}
X
X
Xprivate void queryQueryResult(Widget w, queryReturn result, caddr_t dummy)
X{
X  destroy_query_dialog();
X
X  if (result == ViewReturn) {
X    /* Call display */
X    if (access(viewfile, R_OK) == 0)
X      displayfile(viewfile);
X    else
X      query_dialog("File not readable!", False);
X  } 
X}
X
SHAR_EOF
chmod 0644 code/display.c || echo "restore of code/display.c fails"
echo "x - extracting code/fileman.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/fileman.c &&
X/* v0.1 */
X/*****************************************************************************
X ** File          : fileman.c                                               **
X ** Purpose       : Receive and distribute directory changes                **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : 18th Feb 1990                                           **
X ** Documentation : Xdtm Design Folder                                      **
X ** Related Files : treeman.c, dirman.c, pathman.c, main.c                  **
X *****************************************************************************/
X
X#include "xdtm.h"
X
X#include <X11/Xaw/AsciiText.h>
X#include <X11/Xaw/Command.h>
X#include <X11/Xaw/Paned.h>
X#include <X11/Xaw/Viewport.h>
X#include <X11/cursorfont.h>
X
X#include "Xedw/XedwForm.h"
X
Xpublic Widget vert_bar;
Xpublic Widget dirSelector;
Xpublic Cursor busy, left_ptr;
Xpublic Widget directoryManagerView;
X
Xpublic void setCursor(Cursor);
X
Xpublic void createFileManagerWidgets(Widget w)
X{
X  private void GotoDir(Widget, XButtonEvent*);
X  private void ClearSel(Widget, XButtonEvent*);
X  private void goto_dir(Widget, caddr_t, caddr_t);
X
X  Widget fileManagerPane, treeManagerView;
X  Widget dirSelectorForm, dirButton, dirLabel;
X  extern Widget menuBar;
X  Arg arglist[6], *newlist;
X  Cardinal i;
X  XtTranslations dirSelTranslations;
X
X  static XtActionsRec actions[] = {
X    {"GotoDir",  GotoDir},
X    {NULL, NULL}
X  };
X
X
X  static char defaultTranslations[] = 
X    "Ctrl<Key>A:        beginning-of-line() \n\
X     Ctrl<Key>E:        end-of-line() \n\
X     <Key>Return:       GotoDir() \n\
X     <Key>Escape:       beginning-of-line() kill-to-end-of-line() \n\
X     <Key>Right: 	forward-character() \n\
X     <Key>Left:         backward-character() \n\
X     <Key>Delete:       delete-previous-character() \n\
X     <Key>BackSpace:    delete-previous-character() \n\
X     <Key>:             insert-char() \n\
X     <FocusIn>:         focus-in() \n\
X     <FocusOut>:        focus-out() \n\
X     <BtnDown>:         select-start()";
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert,                               menuBar); i++;
X  XtSetArg(arglist[i], XtNfullHeight,                                True); i++;
X  XtSetArg(arglist[i], XtNfullWidth,                                 True); i++;
X  XtSetArg(arglist[i], XtNfromHoriz, XtNameToWidget(w, "appManagerButton"));i++;
X  newlist = XtMergeArgLists(arglist, i, chain_position, chain_size);
X  fileManagerPane         =   XtCreateManagedWidget("fileManagerPane",
X						    panedWidgetClass,
X						    w,
X						    newlist, i + chain_size);
X  
X  XtFree(newlist);
X
X/* Here is the hook onto which the tree manager will fit.
X *  
X *  i = 0;
X *  XtSetArg(arglist[i], XtNforceBars, True); i++;
X *  XtSetArg(arglist[i], XtNallowVert, True); i++;
X *  XtSetArg(arglist[i], XtNallowHoriz, True); i++;
X *  treeManagerView         =   XtCreateManagedWidget("treeManagerView",
X * 						    viewportWidgetClass,
X * 						    fileManagerPane,
X * 						    arglist, i);
X */
X
X  i = 0;
X  XtSetArg(arglist[i], XtNforceBars, True); i++;
X  XtSetArg(arglist[i], XtNallowVert, True); i++;
X  directoryManagerView    =   XtCreateManagedWidget("directoryManagerView",
X						    viewportWidgetClass,
X						    fileManagerPane,
X						    arglist, i);
X  
X  createDirectoryManagerWidgets(directoryManagerView);
X  /* createTreeManagerWidgets(treeManagerView); */
X
X  /* Create text widget */
X
X  i = 0;
X  XtSetArg(arglist[i], XtNrubberHeight,   False); i++;
X  XtSetArg(arglist[i], XtNrubberWidth,    False); i++;
X  XtSetArg(arglist[i], XtNfromHoriz,    menuBar); i++; 
X  XtSetArg(arglist[i], XtNborderWidth,        0); i++;
X  XtSetArg(arglist[i], XtNlabel,        "Goto:"); i++;
X  newlist = XtMergeArgLists(arglist, i, chain_position, chain_size);
X  dirButton               =   XtCreateManagedWidget("dirButton",
X                                                    commandWidgetClass,
X						    w,
X						    newlist, i + chain_size);
X                                              
X  XtFree(newlist);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNrubberHeight,    False); i++;
X  XtSetArg(arglist[i], XtNfullWidth,        True); i++;
X  XtSetArg(arglist[i], XtNfromHoriz,   dirButton); i++;
X  XtSetArg(arglist[i], XtNeditType,  XawtextEdit); i++;
X  XtSetArg(arglist[i], XtNborderWidth,         0); i++;
X  XtSetArg(arglist[i], XtNvertDistance,        6); i++;
X  newlist = XtMergeArgLists(arglist, i, chain_position, chain_size);
X  dirSelector            =   XtCreateManagedWidget("dirSelector",
X						    asciiTextWidgetClass,
X						    w,
X						    newlist, i + chain_size);
X  XtFree(newlist);
X  XtAddCallback(dirButton, XtNcallback, goto_dir, 0);
X  XtAddActions(actions, XtNumber(actions));
X  XtUninstallTranslations(dirSelector);
X  dirSelTranslations = XtParseTranslationTable(defaultTranslations);
X  XtOverrideTranslations(dirSelector, dirSelTranslations); 
X  
X }
X
Xpublic void initFileManager(Widget w)
X{
X  extern void initDirectoryManager(void);         /* dirman.c */
X  /* extern void initTreeManager(void); */
X  busy     = XCreateFontCursor(XtDisplay(w), XC_watch);
X  left_ptr = XCreateFontCursor(XtDisplay(w), XC_left_ptr);
X
X  /* Check what should be mapped, unmapping those that shouldn't */
X
X  initDirectoryManager();
X  /* initTreeManager(); */
X}
X
Xprivate void GotoDir(Widget w, XButtonEvent *event)
X{
X  private goto_dir(Widget, caddr_t, caddr_t);
X
X  goto_dir(w, 0, 0);
X}
X
Xprivate void goto_dir(Widget w, caddr_t client_data, caddr_t call_data)
X{
X  /* Called when the goto directory button is pressed, Or when return is
X   * pressed in the directory selector.
X   */
X  extern Boolean directoryManagerNewDirectory(String);
X
X  extern String home;
X  extern String cwd;
X  Arg args[1];
X  String value, tmp;
X
X  /* Get the contents of the dirselector */
X  XtSetArg(args[0], XtNstring, &value);
X  XtGetValues(dirSelector, args, 1);
X
X  /* expand ~ to HOME */
X  if (*value == '~') {
X    tmp = (String) XtMalloc ((strlen(home) + strlen(value)) * sizeof(char));
X    strcpy(tmp, home);
X    if (*(value+1) != '\0')
X      strcat(tmp, value+1);
X    value = tmp;
X  }
X
X  /* change to the directory specified */
X  if (directoryManagerNewDirectory(value) == False) {
X    XBell(XtDisplay(w), 100);
X  } else {
X    XtFree(cwd);
X    cwd = XtNewString(value);
X  }
X
X}
X
Xprivate void ClearSel(Widget w, XButtonEvent *event)
X{
X  Arg args[1];
X
X  XtSetArg(args[0], XtNstring, "");
X  XtSetValues(dirSelector, args, 1);
X}
X  
Xpublic void setCursor(Cursor newcursor)
X{
X
X  /* This should be called with a cursor to change to, or NULL to
X   * go back to saved values. 
X   * If the cursor is NULL then reset cursors to their defaults in
X   * widgets.
X   * Otherwise..
X   * Set the cursor to newcursor in the following widgets:
X   *   directoryManager
X   *   dirSelector
X   *   
X   */
X
X  extern Widget directoryManager, appManager;
X  
X  static Cursor dirManCursor, appManCursor;
X  Arg arglist[1];
X  Cardinal i;
X
X  if (newcursor == NULL) {
X    /* Go back to saved values */
X    XtSetArg(arglist[0], XtNcursor, dirManCursor);
X    XtSetValues(directoryManager, arglist, 1);
X    /* XtSetArg(arglist[0], XtNcursor, treeManCursor);
X     * XtSetValues(treeManager, arglist, 1); */
X    XtSetArg(arglist[0], XtNcursor, appManCursor);
X    XtSetValues(appManager, arglist, 1);
X  } else {
X    /* Get old values */
X    XtSetArg(arglist[0], XtNcursor, &dirManCursor);
X    XtGetValues(directoryManager, arglist, 1);
X    /* XtSetArg(arglist[0], XtNcursor, &treeManCursor);
X     * XtGetValues(treeManager, arglist, 1); */
X    XtSetArg(arglist[0], XtNcursor, &appManCursor);
X    XtGetValues(appManager, arglist, 1);
X
X    XtSetArg(arglist[0], XtNcursor, newcursor);
X    XtSetValues(directoryManager, arglist, 1);
X    /* XtSetValues(treeManager,      arglist, 1); */
X    XtSetValues(appManager,       arglist, 1);
X  }
X
X  XFlush(XtDisplay(directoryManager)); /* Change cursors immediately */
X}
X
SHAR_EOF
chmod 0644 code/fileman.c || echo "restore of code/fileman.c fails"
echo "x - extracting code/info.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/info.c &&
X/***********************************************************************************
X ** File          : info.c                                                        **
X ** Purpose       : Initialise and Realise info dialog                            **
X ** Author        : Edward Groenendaal                                            **
X ** Date          : April 1991                                                    **
X ** Documentation : Xdtm Design Folder                                            **
X ** Related Files : 								  **
X ***********************************************************************************/
X
X#include "xdtm.h"
X
X
Xpublic void init_info(Widget top)
X{
X
X}
SHAR_EOF
chmod 0644 code/info.c || echo "restore of code/info.c fails"
echo "x - extracting code/lexical.l (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/lexical.l &&
X%{ /*-*- Mode: C -*-*/
X/**************************************************************************
X * Filename :       lexical.l
X * Author   :       Edward Groenendaal
X **************************************************************************/
X
X#ifdef YYLMAX                   
X#  if (YYLMAX<1024)              /* Allow 1024 characters of look-ahead     */
X#    undef YYLMAX                /* therefore allowing 1024 characters in a */
X#    define YYLMAX      1024     /* comment. (default on my machine is 200  */
X#  endif
X#endif
X
X#include "xdtm.h"
X
X/* I shall use the macro RETURN whenever returning a token. If DEBUG_LEX has
X * been defined then the token will be printed out, otherwise it will
X * be returned.
X */
X
X#ifdef DEBUG_LEX
X
X/* define the RETURN macro to print the token to be returned */
X# define RETURN(token)    fprintf(stdout,"Token: " #token "\tReturned.\n")
X
X  /* define the tokens to be returned. ONLY in DEBUG mode, when in normal
X   * operation the tokens are defined by yacc.
X   */
X  enum tokens { IF_T,
X	        SET_T,
X	        ICON_T,
X	        NAME_T,
X	        PATH_T,
X	        ASSIGN_T,
X	        EQUAL_T,
X		NEQUAL_T,
X	        STRING_T,
X	        SEMIC_T,
X	        O_PAR_T,
X	        C_PAR_T,
X	        O_BRACE_T,
X	        C_BRACE_T,
X		DEFICON_T,
X		CHECKPATH_T,
X		TRUE_T,
X		FALSE_T,
X		TYPE_T,
X                DIR_T,
X		FILE_T,
X		READ_T,
X		WRITE_T,
X		EXE_T,
X		PROG_T,
X		OPTIONS_T,
X		COMMA_T,
X		MSEL_T,
X		OSEL_T,
X		NSEL_T,
X		DEFINE_T,
X		IGNORE_T,
X		ERRORTOKEN
X	      };
X
X#else           /* No DEBUG */
X
X#include "parser.h"         /* get the tokens from yacc */
X
X/* define the RETURN token to set the return value to the token to be
X * returned, then return that token.
X */
X# define RETURN(token)    yylval.number=token;return(token)
X#endif
X
X#include <sys/types.h>
X#include <stdio.h>
X#include <stdarg.h>
X
X#define MAXERR      20      /* Maximum number of errors before the parser */
X                            /* quits. */
X
Xvoid yyerror(char*, ...);
X
Xtypedef struct {                    /* structure for keyword table */
X    String name;
X    int token;
X} keyword;
X
Xstatic keyword keywordtable[] = {   /* table of keywords */
X  {"False",   FALSE_T},
X  {"MSEL",    MSEL_T},
X  {"NSEL",    NSEL_T},
X  {"OSEL",    OSEL_T},
X  {"True",    TRUE_T},
X  {"checkpath", CHECKPATH_T},
X  {"deficon", DEFICON_T},
X  {"define",  DEFINE_T},
X  {"dir",     DIR_T},
X  {"exe",     EXE_T},
X  {"false",   FALSE_T},
X  {"file",    FILE_T},
X  {"icon",    ICON_T},
X  {"if",      IF_T},
X  {"ignore",  IGNORE_T},
X  {"name",    NAME_T},
X  {"options", OPTIONS_T},
X  {"path",    PATH_T},
X  {"prog",    PROG_T},
X  {"read",    READ_T},
X  {"set",     SET_T},
X  {"true",    TRUE_T},
X  {"type",    TYPE_T},
X  {"write",   WRITE_T}
X};
X/* number of entries in the keyword table */
Xstatic int numkeywords = (sizeof(keywordtable)/sizeof(keywordtable[0]));
X
Xint parseerror=0;                   /* Number of parse errors */
X
X%}
X%%
X[\t ]*"#".*     { /* Remove Comments from beginning of line */ }
X"="             { RETURN(ASSIGN_T);     }
X"=="            { RETURN(EQUAL_T);      }
X"{"             { RETURN(O_BRACE_T);    }
X"}"             { RETURN(C_BRACE_T);    }
X"("             { RETURN(O_PAR_T);      }
X")"             { RETURN(C_PAR_T);      }
X";"             { RETURN(SEMIC_T);      }
X","             { RETURN(COMMA_T);      }
X[A-Za-z]+       { int token = parse_keyword(yytext);
X#ifndef DEBUG_LEX
X		  yylval.number = token;
X                  return(token);
X#endif
X		}
X[\n\t ]         { /* Ignore White space */ }
X\"[^\"]*\"      {
X#ifdef DEBUG_LEX
X                  fprintf(stdout, "Token STRING_T %s returned", yytext);
X#else
X		  yylval.string = yytext;
X                  return(STRING_T);
X#endif
X                }
X.               { yyerror("illegal character \'%c\'.", yytext[0]);
X                }
X%%
X
X
X/*****************************************************************************
X *                                yywrap                                     *
X *****************************************************************************/
Xint yywrap(void)
X{
X    /* function called when EOF encounterd.
X     *
X     * - Takes nothing
X     * + returns EOF token, not actually used other than to indicate an error
X     *   to the parser. Useful in DEBUG mode to see that EOF has been detected.
X     */
X
X    RETURN(EOFTOKEN);
X}
X
X
X/*****************************************************************************
X *                            parse_keyword                                  *
X *****************************************************************************/
Xint parse_keyword(String str)
X{
X    /* Function to determine whether a string is a reserved keyword or an
X     * identifier. A table of keywords is searched via a binary search to check
X     * to see if the string is a keyword,if it is found the associated
X     * token is returned, otherwise the IDENT_T token is returned and
X     * the value of the string is assigned to a global structure for
X     * use in yacc. The effect of debugging is to prevent the assignment
X     * to the yacc structure, and to print out the keyword if found.
X     *
X     * - Takes a string to check
X     * + Returns a token (int)
X     */
X
X    register int lower = 0, upper = numkeywords-1;
X
X    while (lower <= upper) {
X        int middle = (lower + upper) /2;
X        keyword *p = &keywordtable[middle];
X        int res = strcmp(p->name, str);
X
X        if (res < 0) {
X            lower = middle +1;
X        } else if (res == 0) {
X#ifdef DEBUG_LEX
X            fprintf(stdout, "Token: %s\tReturned.\n", p->name);
X#endif
X            return(p->token);
X        } else {
X            upper = middle -1;
X        }
X    }
X    yyerror("unknown keyword \'%s\'.", yytext);
X    RETURN(ERRORTOKEN);
X}
X
X/*********************************************************************************
X *                                     yyerror                                   *
X *********************************************************************************/
Xvoid yyerror(char *fmt, ...)
X{
X    /* Error printing procedure. This procedure takes a variable argument list
X     * in the same format as printf(3s), and outputs it on the stderr stream
X     * prepended by the line-number currently being processed.
X     * parserrror is incremented to indicate that an error has occurred, if
X     * more than MAXERR errors occur the parser exits.
X     *
X     * - Takes a formatted string + parameters to print.
X     * + Returns noting.
X     */
X
X    va_list args;
X    extern int yylineno;
X
X    if (!parseerror) {
X    }
X    if (parseerror < MAXERR) {
X        va_start(args, fmt);
X        fprintf(stderr, "(E) line :%2d: ", yylineno);
X        vfprintf(stderr, fmt, args);
X        fprintf(stderr, "\n");
X        va_end(args);
X        parseerror++;
X    } else {
X        fprintf(stderr, "Fatal error: over %d errors, exiting\n", MAXERR);
X        exit(2);
X    }
X}
SHAR_EOF
chmod 0644 code/lexical.l || echo "restore of code/lexical.l fails"
echo "x - extracting code/listoption.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/listoption.c &&
X/****************************************************************************
X ** File          : listoption.c                                           **
X ** Purpose       : Initialise and Realise long listing dialog options     **
X ** Author        : Edward Groenendaal                                     **
X ** Date          : April 1991                                             **
X ** Documentation : Xdtm Design Folder                                     **
X ** Related Files :                                                        **
X ****************************************************************************/
X
X#include "xdtm.h"
X#include "menus.h"
X#include <X11/Shell.h>
X#include <X11/Xaw/Label.h>
X#include <X11/Xaw/Command.h>
X#include "Xedw/XedwForm.h"
X
X/* Note ListOption *same* order as listoptions */
X
Xtypedef enum {perms, nlinks, owner, group, size, modtm, acctm} ListOption;
X
Xstatic String listoptions[] = {
X  "rwxrwxrwx ",
X  "1 ",
X  "owner ",
X  "group ",
X  "size ",
X  "modtm ",
X  "acctm "
X};
X
X/* Widgets */
X
Xprivate Widget listoptionpopup;      
Xprivate Widget listoptionform1;
Xprivate Widget listoptionform2;
Xprivate Widget listoptionform3;
Xprivate Widget listoptionlabel;
Xprivate Widget listoptionsettings;
Xprivate Widget listoptionpermsButton;
Xprivate Widget listoptionpermsLabel;
Xprivate Widget listoptionlinksButton;
Xprivate Widget listoptionlinksLabel;
Xprivate Widget listoptionownerButton;
Xprivate Widget listoptionownerLabel;
Xprivate Widget listoptiongroupButton;
Xprivate Widget listoptiongroupLabel;
Xprivate Widget listoptionsizeButton;
Xprivate Widget listoptionsizeLabel;
Xprivate Widget listoptionacctmButton;
Xprivate Widget listoptionacctmLabel;
Xprivate Widget listoptionmodtmButton;
Xprivate Widget listoptionmodtmLabel;
Xprivate Widget listoptionquitButton;
X
X#define ToggleButton(b, w)  \
X{ \
X  Arg arglist[1]; \
X  XtSetArg(arglist[0], XtNbitmap, \
X	   (current_mode.options & b) ? tick : emptytick); \
X  XtSetValues(w, arglist, 1); \
X}
X	     
X
Xpublic void init_listoption(Widget top)
X{
X  private void destroy_listoption_dialog(Widget, caddr_t, caddr_t);
X  private void optionbutton_toggled(Widget, ListOption, caddr_t);
X  Arg arglist[7];
X  Cardinal i;
X  XFontStruct *font;
X  String settings;
X  int width;
X
X  static String Label = "Long Listing Options";
X
X  /* constuct settings label */
X  settings = (String) XtMalloc (sizeof(char) * 55);
X
X  sprintf(settings, "%s%s%s%s%s%s%sfilename", 
X	  listoptions[perms], 
X	  listoptions[nlinks],
X	  listoptions[owner],
X	  listoptions[group],
X	  listoptions[size],
X	  listoptions[modtm],
X	  listoptions[acctm]);
X
X  listoptionpopup = XtCreatePopupShell("listoptionpopup",
X				       transientShellWidgetClass,
X				       top,
X				       NULL, 0);
X  
X  listoptionform1 = XtCreateManagedWidget("listoptionform1",
X					  xedwFormWidgetClass,
X					  listoptionpopup,
X					  NULL, 0);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfullWidth,          True); i++;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
X  XtSetArg(arglist[i], XtNlabel,             Label); i++;
X  XtSetArg(arglist[i], XtNborderWidth,           0); i++;
X  listoptionlabel = XtCreateManagedWidget("listoptionlabel",
X					  labelWidgetClass,
X					  listoptionform1,
X					  arglist, i);
X
X  i = 1;
X  XtSetArg(arglist[i], XtNfromVert, listoptionlabel); i++;
X  XtSetArg(arglist[i], XtNjustify,    XtJustifyLeft); i++;
X  listoptionsettings = XtCreateManagedWidget("listoptionsettings",
X					     labelWidgetClass,
X					     listoptionform1,
X					     arglist, i);
X
X  /* Get font from widget, then use XTextWidth to find width of string,
X   * then set the width of the label to this width + 10.
X   */
X
X  XtSetArg(arglist[0], XtNfont, &font);
X  XtGetValues(listoptionsettings, arglist, 1);
X
X  width = XTextWidth(font, settings, strlen(settings));
X
X  XtSetArg(arglist[0], XtNwidth, width + 20);
X  XtSetValues(listoptionlabel, arglist, 1);
X
X  XtFree(settings);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNborderWidth,               0); i++;
X  XtSetArg(arglist[i], XtNfromVert, listoptionsettings); i++;
X  listoptionform2 = XtCreateManagedWidget("listoptionform2",
X					  xedwFormWidgetClass,
X					  listoptionform1,
X					  arglist, i);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNborderWidth,               0); i++;
X  XtSetArg(arglist[i], XtNfromVert, listoptionsettings); i++;
X  XtSetArg(arglist[i], XtNfromHoriz,   listoptionform2); i++; 
X  listoptionform3 = XtCreateManagedWidget("listoptionform3",
X					  xedwFormWidgetClass,
X					  listoptionform1,
X					  arglist, i);
X
X  /* First bank of buttons */
X
X  /* Permissions */
X  i = 0;
X  listoptionpermsButton = XtCreateManagedWidget("listoptionpermsButton",
X						commandWidgetClass,
X						listoptionform2,
X						arglist, i);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNborderWidth,                   0); i++;
X  XtSetArg(arglist[i], XtNfromHoriz,  listoptionpermsButton); i++;
X  XtSetArg(arglist[i], XtNlabel,              "Permissions"); i++;
X  listoptionpermsLabel  = XtCreateManagedWidget("listoptionpermsLabel",
X						labelWidgetClass,
X						listoptionform2,
X						arglist, i);
X
X  XtAddCallback(listoptionpermsButton, XtNcallback, optionbutton_toggled, perms);
X
X  /* Nlinks */
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert,    listoptionpermsButton); i++;
X  listoptionlinksButton = XtCreateManagedWidget("listoptionlinksButton",
X						commandWidgetClass,
X						listoptionform2,
X						arglist, i);
X  
X  i = 1;
X  XtSetArg(arglist[i], XtNborderWidth,                   0); i++;
X  XtSetArg(arglist[i], XtNfromHoriz, listoptionlinksButton); i++;
X  XtSetArg(arglist[i], XtNlabel,         "Number of links"); i++;
X  listoptionlinksLabel  = XtCreateManagedWidget("listoptionlinksLabel",
X						labelWidgetClass,
X						listoptionform2,
X						arglist, i);
X
X  XtAddCallback(listoptionlinksButton, XtNcallback, optionbutton_toggled, nlinks);
X
X  /* Owner */
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert, listoptionlinksButton); i++; 
X  listoptionownerButton = XtCreateManagedWidget("listoptionownerButton",
X						commandWidgetClass,
X						listoptionform2,
X						arglist, i);
X
X  i = 1;
X  XtSetArg(arglist[i], XtNborderWidth,                   0); i++;
X  XtSetArg(arglist[i], XtNfromHoriz, listoptionownerButton); i++;
X  XtSetArg(arglist[i], XtNlabel,           "Owner of file"); i++;
X  listoptionownerLabel  = XtCreateManagedWidget("listoptionownerLabel",
X						labelWidgetClass,
X						listoptionform2,
X						arglist, i);
X
X  XtAddCallback(listoptionownerButton, XtNcallback, optionbutton_toggled, owner);
X
X  /* Second bank of buttons */
X
X  /* Group */
X
X  i = 0;
X  listoptiongroupButton = XtCreateManagedWidget("listoptiongroupButton",
X						commandWidgetClass,
X						listoptionform3,
X						arglist, i);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNborderWidth,                   0); i++;
X  XtSetArg(arglist[i], XtNfromHoriz, listoptiongroupButton); i++;
X  XtSetArg(arglist[i], XtNlabel,           "Group of file"); i++;
X  listoptiongroupLabel = XtCreateManagedWidget("listoptiongroupLabel",
X					       labelWidgetClass,
X					       listoptionform3,
X					       arglist, i);
X
X  XtAddCallback(listoptiongroupButton, XtNcallback, optionbutton_toggled, group);
X
X  /* Size */
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert, listoptiongroupButton); i++;
X  listoptionsizeButton = XtCreateManagedWidget("listoptionsizeButton",
X					       commandWidgetClass,
X					       listoptionform3,
X					       arglist, i);
X
X  i = 1;
X  XtSetArg(arglist[i], XtNborderWidth,                   0); i++;
X  XtSetArg(arglist[i], XtNfromHoriz, listoptionsizeButton); i++;
X  XtSetArg(arglist[i], XtNlabel,           "Size of file"); i++;
X  listoptionsizeLabel = XtCreateManagedWidget("listoptionsizeLabel",
X					     labelWidgetClass,
X					     listoptionform3,
X					     arglist, i);
X
X  XtAddCallback(listoptionsizeButton, XtNcallback, optionbutton_toggled, size);
X
X  /* Modification Time */
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert, listoptionsizeButton); i++;
X  listoptionmodtmButton = XtCreateManagedWidget("listoptionmodtmButton",
X						commandWidgetClass,
X						listoptionform3,
X						arglist, i);
X
X  i = 1;
X  XtSetArg(arglist[i], XtNborderWidth,                   0); i++;
X  XtSetArg(arglist[i], XtNfromHoriz, listoptionmodtmButton); i++;
X  XtSetArg(arglist[i], XtNlabel,       "Modification time"); i++;
X  listoptionmodtmLabel = XtCreateManagedWidget("listoptionmodtmLabel",
X					      labelWidgetClass,
X					      listoptionform3,
X					      arglist, i);
X
X  XtAddCallback(listoptionmodtmButton, XtNcallback, optionbutton_toggled, modtm);
X
X  /* Access Time */  
X
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert, listoptionmodtmButton); i++;
X  listoptionacctmButton = XtCreateManagedWidget("listoptionacctmButton",
X						commandWidgetClass,
X						listoptionform3,
X						arglist, i);
X
X  i = 1;
X  XtSetArg(arglist[i], XtNborderWidth,                   0); i++;
X  XtSetArg(arglist[i], XtNfromHoriz, listoptionacctmButton); i++;
X  XtSetArg(arglist[i], XtNlabel,             "Access time"); i++;
X  listoptionacctmLabel = XtCreateManagedWidget("listoptionacctmLabel",
X					       labelWidgetClass,
X					       listoptionform3,
X					       arglist, i);
X  
X  XtAddCallback(listoptionacctmButton, XtNcallback, optionbutton_toggled, acctm);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert, listoptionform2); i++;
X  XtSetArg(arglist[i], XtNlabel,               "OK"); i++;
X  listoptionquitButton = XtCreateManagedWidget("listoptionquitButton",
X					       commandWidgetClass,
X					       listoptionform1,
X					       arglist, i);
X
X  XtAddCallback(listoptionquitButton, XtNcallback, destroy_listoption_dialog, 0);
X}
X
Xpublic void listoption_dialog(void)
X{
X  private String makeoptionstring(void);
X  String settings;
X  Arg arglist[1];
X
X  /* set up initial button settings */
X  ToggleButton(PERMS,  listoptionpermsButton);
X  ToggleButton(NLINKS, listoptionlinksButton);
X  ToggleButton(OWNER,  listoptionownerButton);
X  ToggleButton(GROUP,  listoptiongroupButton);
X  ToggleButton(SIZE,   listoptionsizeButton);
X  ToggleButton(MODTM,  listoptionmodtmButton);
X  ToggleButton(ACCTM,  listoptionacctmButton);
X
X  settings = makeoptionstring();
X
X  XtSetArg(arglist[0], XtNlabel, settings);
X  XtSetValues(listoptionsettings, arglist, 1);
X  
X  XtFree(settings);
X
X  realize_dialog(listoptionpopup);
X}
X
Xprivate void destroy_listoption_dialog(Widget w, caddr_t client_data,
X				       caddr_t call_data)
X{
X  extern directoryManagerNewDirectory(String);
X  extern String cwd;
X
X  XtPopdown(listoptionpopup);
X  if (current_mode.mode == Long)
X    directoryManagerNewDirectory(cwd);
X}
X
Xprivate void optionbutton_toggled(Widget w, ListOption button, caddr_t call_data)
X{
X  private String makeoptionstring(void);
X  Arg arglist[1];
X  String settings;
X
X  switch (button) {
X  case perms:
X    if (current_mode.options & PERMS) {
X      current_mode.options &= ~PERMS;
X    } else {
X      current_mode.options |= PERMS;
X    }
X    ToggleButton(PERMS, listoptionpermsButton);
X    break;
X  case nlinks:
X    if (current_mode.options & NLINKS) {
X      current_mode.options &= ~NLINKS;
X    } else {
X      current_mode.options |= NLINKS;
X    }
X    ToggleButton(NLINKS, listoptionlinksButton);
X    break;
X  case owner:
X    if (current_mode.options & OWNER) {
X      current_mode.options &= ~OWNER;
X    } else {
X      current_mode.options |= OWNER;
X    }
X    ToggleButton(OWNER, listoptionownerButton);
X    break;
X  case group:
X    if (current_mode.options & GROUP) {
X      current_mode.options &= ~GROUP;
X    } else {
X      current_mode.options |= GROUP;
X    }
X    ToggleButton(GROUP, listoptiongroupButton);
X    break;
X  case size:
X    if (current_mode.options & SIZE) {
X      current_mode.options &= ~SIZE;
X    } else {
X      current_mode.options |= SIZE;
X    }
X    ToggleButton(SIZE, listoptionsizeButton);
X    break;
X  case modtm:
X    if (current_mode.options & MODTM) {
X      current_mode.options &= ~MODTM;
X    } else {
X      current_mode.options |= MODTM;
X    }
X    ToggleButton(MODTM, listoptionmodtmButton);
X    break;
X  case acctm:
X    if (current_mode.options & ACCTM) {
X      current_mode.options &= ~ACCTM;
X    } else {
X      current_mode.options |= ACCTM;
X    }
X    ToggleButton(ACCTM, listoptionacctmButton);
X    break;
X  default:
X    fprintf(stderr, "Error: Listoptions programmer error, option out"
X	    " of range\n");
X    break;
X  }
X
X  /* Put current options in settings string */
X
X  settings = makeoptionstring();
X
X  /* Put new settings string in the settings label */
X
X  XtSetArg(arglist[0], XtNlabel, settings);
X  XtSetValues(listoptionsettings, arglist, 1);
X
X  XtFree(settings);
X}
X
Xprivate String makeoptionstring(void)
X{
X  /* construct a string representing the current options,
X   * the user is responsible for free'ing it.
X   */
X  String permstring, nlinkstring, ownerstring, groupstring, sizestring;
X  String modtmstring, acctmstring, settings;
X
X  static String empty = "";
X 
X  settings = (String) XtMalloc (sizeof(char) * 55);
X
X  if (current_mode.options & PERMS)
X    permstring = listoptions[perms];
X  else
X    permstring = empty;
X  if (current_mode.options & NLINKS)
X    nlinkstring = listoptions[nlinks];
X  else
X    nlinkstring = empty;
X  if (current_mode.options & OWNER)
X    ownerstring = listoptions[owner];
X  else
X    ownerstring = empty;
X  if (current_mode.options & GROUP)
X    groupstring = listoptions[group];
X  else
X    groupstring = empty;
X  if (current_mode.options & SIZE)
X    sizestring = listoptions[size];
X  else
X    sizestring = empty;
X  if (current_mode.options & MODTM)
X    modtmstring = listoptions[modtm];
X  else
X    modtmstring = empty;
X  if (current_mode.options & ACCTM)
X    acctmstring = listoptions[acctm];
X  else
X    acctmstring = empty;
X  
X  sprintf(settings, "%s%s%s%s%s%s%sfilename", 
X	  permstring, 
X	  nlinkstring,
X	  ownerstring,
X	  groupstring,
X	  sizestring,
X	  modtmstring,
X	  acctmstring);
X
X  return(settings);
X}
SHAR_EOF
chmod 0644 code/listoption.c || echo "restore of code/listoption.c fails"
echo "x - extracting code/main.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/main.c &&
X/* v0.1 */
X/***********************************************************************************
X ** File          : main.c                                                        **
X ** Purpose       : Initialise and Realise xdtm                                   **
X ** Author        : Edward Groenendaal                                            **
X ** Date          : 18th Feb 1990                                                 **
X ** Documentation : Xdtm Design Folder                                            **
X ** Related Files : All other xdtm files                                          **
X ***********************************************************************************/
X
X#include "xdtm.h"
X#include "menus.h"
X
X/* local headers */
X
X#include <X11/Shell.h>
X#include "Xedw/XedwForm.h"
X
X/* topLevel is global because it is needed by the quit popup to determine the centre
X * of the application.
X */
Xpublic Widget topLevel;
Xpublic String home;
Xpublic AppData app_data;
X
Xstatic XtResource resources[] = {
X  {   
X    XtNviewWidth, 
X    XtCViewWidth,
X    XtRInt,
X    sizeof(int),
X    XtOffset(AppDataPtr, view_width),
X    XtRImmediate,
X    (caddr_t) 85,
X  },
X  { 
X    XtNviewHeight,
X    XtCViewHeight,
X    XtRInt,
X    sizeof(int),
X    XtOffset(AppDataPtr, view_height),
X    XtRImmediate,
X    (caddr_t) 25,
X  },
X  {
X    XtNmode,
X    XtCMode,
X    XtRString,
X    sizeof(String),
X    XtOffset(AppDataPtr, mode),
X    XtRImmediate,
X    (caddr_t) "icons",
X  },
X  {
X    XtNviewFont,
X    XtCFont,
X    XtRFontStruct,
X    sizeof(XFontStruct*),
X    XtOffset(AppDataPtr, view_font),
X    XtRString,
X    (caddr_t) "6x10",
X  },
X  {
X    XtNdmFont,
X    XtCFont,
X    XtRFontStruct,
X    sizeof(XFontStruct*),
X    XtOffset(AppDataPtr, dm_font),
X    XtRString,
X    (caddr_t) "*-courier-bold-r-*-120-*",
X  },
X};
X      
X
Xpublic void main(int argc, char *argv[])
X{
X  private void initialiseXdtm(void);
X  extern void createMenuWidgets(Widget);          /* menus.c */
X  extern void createAppManagerWidgets(Widget);    /* appman.c */
X  extern void createFileManagerWidgets(Widget);   /* fileman.c */
X  extern void createDialogWidgets(Widget);        /* dialogs.c */
X
X  extern Icon_mode current_mode;
X  Widget topForm;
X  Arg arglist[6];
X  Cardinal i;
X  static String Title = "X DeskTop Manager";
X
X  /* Command Line Arguments */
X
X  static XrmOptionDescRec options[] = {
X    {"-dmfont",    "*directoryManager.font", XrmoptionSepArg, NULL}
X  };
X
X  /* Initialise Program */
X  if ((home = (String) getenv("HOME")) == NULL) {
X    fprintf(stderr, "can\'t get environment variable HOME\n");
X    home = XtNewString("/");
X  } else 
X    home = XtNewString(home);
X
X  /* Initialise the user interface */
X
X  topLevel = XtInitialize(argv[0], 
X			  "Xdtm", 
X			  options, 
X			  XtNumber(options),
X			  &argc, argv);
X
X  /* Check left over command line arguments */
X  if (argc > 1) {
X    /* incorrect command line arguments */
X    int i;
X    static int errs = False;
X    
X    for (i = 1; i < argc; i++) {
X      if (!errs++)
X	fprintf(stderr, "%s: command line option unknown:\n", argv[0]);
X      fprintf(stderr, "option: %s\n\n", argv[i]);
X    }
X    fprintf(stderr, "%s understands all standard Xt "
X	    "command-line options.\n", argv[0]);
X    fprintf(stderr, "Additional options are as follows:\n");
X    fprintf(stderr, "Option              Valid Range\n");
X    fprintf(stderr, "-dmfont             Any font, should be fixed width\n");
X    exit(2);
X  }
X    
X  /* get application resources */
X  XtGetApplicationResources(topLevel,
X			    &app_data,
X			    resources,
X			    XtNumber(resources),
X			    NULL, 0);
X
X  /* check values of application resources */
X  if (app_data.view_width < 1 || app_data.view_height < 1) {
X    fprintf(stderr, "%s: error in resource settings:\n"
X	    "view window must be greater than 1x1 characters\n",
X	    argv[0]);
X    exit(2);
X  }
X  
X  if (strcmp(app_data.mode, "icons") == 0) 
X    current_mode.mode = Icons;
X  else if (strcmp(app_data.mode, "short") == 0)
X    current_mode.mode = Short;
X  else if (strcmp(app_data.mode,  "long") == 0)
X    current_mode.mode = Long;
X  else {
X    fprintf(stderr, "%s: error in resource settings:\n"
X	    "mode must be one of either:\n"
X	    "'icons'     Show icons\n"
X	    "'short'     Just display file names\n"
X	    "'long'      Display file names with additional data.\n",
X	    argv[0]);
X    exit(2);
X  }
X
X  i = 0;
X  XtSetArg(arglist[i], XtNbottom, XtChainBottom); i++;
X  XtSetArg(arglist[i], XtNtop,       XtChainTop); i++;
X  XtSetArg(arglist[i], XtNleft,     XtChainLeft); i++;
X  XtSetArg(arglist[i], XtNright,   XtChainRight); i++;
X  XtSetArg(arglist[i], XtNhorizDistance,      5); i++;
X  XtSetArg(arglist[i], XtNvertDistance,       5); i++;
X  topForm = XtCreateManagedWidget("topForm",
X				  xedwFormWidgetClass,
X				  topLevel,
X				  arglist, i);
X
X  /* These must be called in this order, top left -> bottom right */
X  createMenuWidgets        (topForm);
X  createAppManagerWidgets  (topForm);
X  createFileManagerWidgets (topForm);
X  createDialogWidgets      (topForm);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNtitle,   Title); i++;
X  XtSetArg(arglist[i], XtNminWidth,  400); i++;
X  XtSetArg(arglist[i], XtNminHeight, 200); i++;
X  XtSetValues(topLevel, arglist, i);
X
X  tzset();
X
X  /* Realize the widgets, (display program) then loop waiting for events */
X
X  XtRealizeWidget(topLevel);
X
X  initialiseXdtm();
X
X  XtMainLoop();
X
X}
X
Xpublic void quitQueryResult(Widget w, Boolean quit, caddr_t call_data)
X{
X  extern void destroy_quit_dialog(void);
X  /* Quit selected */
X  if (quit == True)
X    exit(0);
X
X  /* Cancel selected */
X  destroy_quit_dialog();
X}
X
Xprivate void initialiseXdtm(void)
X{
X
X  extern void initAppManager(Widget);               /* appman.c */
X  extern void initFileManager(Widget);              /* fileman.c */
X  extern void parsePreferences(Widget);           /* parse.c */
X
X  parsePreferences(topLevel);
X  initAppManager(topLevel);
X  initFileManager(topLevel);
X}
SHAR_EOF
chmod 0644 code/main.c || echo "restore of code/main.c fails"
echo "x - extracting code/map.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/map.c &&
X/*****************************************************************************
X ** File          : map.c                                                   **
X ** Purpose       : Initialise and Realise map dialog                       **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : April 1991                                              **
X ** Documentation : Xdtm Design Folder                                      **
X ** Related Files :                                                         **
X *****************************************************************************/
X
X#include "xdtm.h"
X#include "parse.h"		/* For SelOptions, ESIZE */
SHAR_EOF
echo "End of part 2"
echo "File code/map.c is continued in part 3"
echo "3" > s2_seq_.tmp
exit 0

eddyg@syma.sussex.ac.uk (Edward J. Groenendaal) (04/18/91)

---- Cut Here and unpack ----
#!/bin/sh
# this is part 3 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file code/map.c continued
#
CurArch=3
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file code/map.c"
sed 's/^X//' << 'SHAR_EOF' >> code/map.c
X#include <X11/Shell.h>
X#include <X11/Xaw/Label.h>
X#include <X11/Xaw/Command.h>
X#include <X11/Xaw/AsciiText.h>
X#include "Xedw/XedwForm.h"
X#include "Xedw/XedwList.h"
X
Xextern void realize_dialog(Widget);
X
X/* Widgets */
X
Xprivate Widget mappopup;        /* For mapping prog over files */
Xprivate Widget mapform;
Xprivate Widget maplabel;
Xprivate Widget mappromptlabel;
Xprivate Widget maptext;
Xprivate Widget mapCancel;
Xprivate Widget mapOK;
X
Xpublic void init_map(Widget top)
X{
X  Arg arglist[5];
X  Cardinal i;
X  XtTranslations mapTranslations;
X
X  static char defaultTranslations[] = 
X    "Ctrl<Key>A:        beginning-of-line() \n\
X     Ctrl<Key>E:        end-of-line() \n\
X     <Key>Escape:       beginning-of-line() kill-to-end-of-line() \n\
X     <Key>Right: 	forward-character() \n\
X     <Key>Left:         backward-character() \n\
X     <Key>Delete:       delete-previous-character() \n\
X     <Key>BackSpace:    delete-previous-character() \n\
X     <Key>:             insert-char() \n\
X     <FocusIn>:         focus-in() \n\
X     <FocusOut>:        focus-out() \n\
X     <BtnDown>:         select-start()";
X
X
X  mappopup       = XtCreatePopupShell("mappopup",
X				      transientShellWidgetClass,
X				      top,
X				      NULL, 0);
X
X  mapform        = XtCreateManagedWidget("mapform",
X					 xedwFormWidgetClass,
X					 mappopup,
X					 NULL, 0);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNborderWidth,           0); i++;
X  XtSetArg(arglist[i], XtNfullWidth,          True); i++;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
X  maplabel       = XtCreateManagedWidget("maplabel",
X					 labelWidgetClass,
X					 mapform,
X					 arglist, i);
X
X  i = 1;
X  XtSetArg(arglist[i], XtNfromVert, maplabel); i++;
X  mappromptlabel = XtCreateManagedWidget("mappromptlabel",
X					 labelWidgetClass,
X					 mapform,
X					 arglist, i);
X  
X  i = 2;
X  XtSetArg(arglist[i], XtNfromHoriz, mappromptlabel); i++;
X  XtSetArg(arglist[i], XtNfullWidth,           True); i++;
X  XtSetArg(arglist[i], XtNeditType,     XawtextEdit); i++;
X  maptext        = XtCreateManagedWidget("maptext",
X					 asciiTextWidgetClass,
X					 mapform,
X					 arglist, i);
X  
X  i = 0;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
X  XtSetArg(arglist[i], XtNfromVert,        maptext); i++;
X  XtSetArg(arglist[i], XtNlabel,          "Cancel"); i++;
X  mapCancel      = XtCreateManagedWidget("mapCancel",
X					 commandWidgetClass,
X					 mapform,
X					 arglist, i);
X
X  i = 2;
X  XtSetArg(arglist[i], XtNfromHoriz,   mapCancel); i++;
X  XtSetArg(arglist[i], XtNwidthLinked, mapCancel); i++;
X  XtSetArg(arglist[i], XtNlabel,            "OK"); i++;
X  mapOK          = XtCreateManagedWidget("mapOK",
X					 commandWidgetClass,
X					 mapform,
X					 arglist, i);
X
X
X  XtUninstallTranslations(maptext);
X  mapTranslations = XtParseTranslationTable(defaultTranslations);
X  XtOverrideTranslations(maptext, mapTranslations);
X
X}
X
Xpublic void map_dialog(Boolean map)
X{
X  /* if map is true then put map dialog up, otherwise use the 
X   * select dialog.
X   */
X  private void mapQueryResult(Widget, Boolean, caddr_t);
X  private void selectQueryResult(Widget, Boolean, caddr_t);
X  Arg arglist[1];
X
X  XtSetArg(arglist[0], XtNstring, "");
X  XtSetValues(maptext, arglist, 1);
X
X  if (map == True) {
X    XtSetArg(arglist[0], XtNlabel, " Map Program over Selected Files ");
X    XtSetValues(maplabel, arglist, 1);
X
X    XtSetArg(arglist[0], XtNlabel, "Program:");
X    XtSetValues(mappromptlabel, arglist, 1);
X
X    XtAddCallback(mapCancel, XtNcallback, mapQueryResult, False);
X    XtAddCallback(mapOK,     XtNcallback, mapQueryResult, True);
X  } else {
X    XtSetArg(arglist[0], XtNlabel, "Select Files by Regular Expression"); 
X    XtSetValues(maplabel, arglist, 1);
X
X    XtSetArg(arglist[0], XtNlabel, "RegExp: ");
X    XtSetValues(mappromptlabel, arglist, 1);
X
X    XtAddCallback(mapCancel, XtNcallback, selectQueryResult, False);
X    XtAddCallback(mapOK,     XtNcallback, selectQueryResult, True);
X  }
X
X  realize_dialog(mappopup);
X}
X
Xprivate void destroy_map_dialog(void)
X{
X  Arg arglist[1];
X
X  XtPopdown(mappopup);
X
X  XtRemoveAllCallbacks(mapCancel, XtNcallback);
X  XtRemoveAllCallbacks(mapOK,     XtNcallback);
X}
X
Xprivate void mapQueryResult(Widget w, Boolean ok, caddr_t call_data)
X{
X  extern String build_arguments(String, SelOptions);
X  extern int execute(String, String, String, Boolean);
X  extern void setCursor(Cursor);
X  extern Cursor busy;
X  String mapprogram, program, filename;
X  Arg arglist[1];
X
X  destroy_map_dialog();
X
X  if (ok == True) {
X    setCursor(busy);
X    /* get program name from text widget */
X    XtSetArg(arglist[0], XtNstring, &mapprogram);
X    XtGetValues(maptext, arglist, 1);
X
X    program = XtNewString(mapprogram);
X
X    /* extract filename from program */
X    filename = XtNewString(program);
X    filename = strtok(filename, " ");
X    
X    /* Get list of files */
X    program = build_arguments(program, M_SEL);
X
X    execute(NULL, filename, program, False);
X    setCursor(NULL);
X  }
X}
X
Xprivate void selectQueryResult(Widget w, Boolean ok, caddr_t call_data)
X{
X  extern void highlight_by_re(String);
X  extern void setCursor(Cursor);
X  extern Cursor busy;
X  String re;
X  Arg arglist[1];
X
X  destroy_map_dialog();
X
X  if (ok == True) {
X    /* Get regular expression */
X    setCursor(busy);
X    XtSetArg(arglist[0], XtNstring, &re);
X    XtGetValues(maptext, arglist, 1);
X    
X    highlight_by_re(re);
X
X    setCursor(NULL);
X  }
X}
SHAR_EOF
echo "File code/map.c is complete"
chmod 0644 code/map.c || echo "restore of code/map.c fails"
echo "x - extracting code/menus.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/menus.c &&
X/*****************************************************************************
X ** File          : menus.c                                                 **
X ** Purpose       : Create, and handle the pull down menus                  **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : 18th Feb 1991                                           **
X ** Documentation : Xdtm Design Folder                                      **
X ** Related Files :                                                         **
X *****************************************************************************/
X
X#include "xdtm.h"
X#include "menus.h"
X#include <sys/stat.h>
X#include <X11/Xaw/MenuButton.h>
X#include <X11/Xaw/SimpleMenu.h>
X#include <X11/Xaw/SmeBSB.h>
X#include <X11/Xaw/SmeLine.h>
X
X#include "Xedw/XedwList.c"
X#include "Xedw/XedwForm.h"
X#include "bitmaps/Tick"
X#include "bitmaps/EmptyTick"
X
Xstatic MenuContents fileMenuStrings[] = {
X  { "about",     "About Xdtm...",  About,     noflag },
X  { "help",      "Help",           Help,      noflag },
X  {  LINE,        NULL,            0,         noflag },
X  { "new",       "New File",       New,       noflag },
X  { "duplicate", "Duplicate File", Duplicate, noflag },
X  {  LINE,        NULL,            0,         noflag },
X  { "getinfo",   "Get Info",       Getinfo,   noflag }, 
X  { "copy",      "Copy files",     Copy,      noflag },
X  { "move",      "Move files",     Move,      noflag },
X  { "trash",     "Delete files",   Trash,     noflag },
X  {  LINE,        NULL,            0,         noflag },
X  { "quit",      "Quit Program",   Quit,      noflag },
X};
X
Xstatic MenuContents optionMenuStrings[] = {
X  { "map",      "Map Program over Files",     Map,    noflag },
X  { "select",   "Select Files by Template",   Select, noflag },
X};
X
Xstatic MenuContents viewMenuStrings[] = {
X  { "icons",    "Show Icons",     Icons,   flagged },
X  { "short",    "No Icons",       Short,   flagged },
X  {  LINE,       NULL,            0,       flagged },
X  { "long",     "Long Listing",   Long,    flagged },
X  { "options",  "Options",        Options, flagged },
X};
X
XCardinal fileMenuSize   = sizeof(fileMenuStrings)   /
X                                sizeof(fileMenuStrings[0]);
XCardinal optionMenuSize = sizeof(optionMenuStrings) /
X                                sizeof(optionMenuStrings[0]);
XCardinal viewMenuSize   = sizeof(viewMenuStrings)   /
X                                sizeof(viewMenuStrings[0]);
X
Xpublic Arg chain_position[] = {  XtNtop,     XtChainTop,
X				 XtNbottom,  XtChainBottom,
X				 XtNleft,    XtChainLeft,
X				 XtNright,   XtChainRight,
X				 NULL,       NULL
X			      };
X
XCardinal chain_size = sizeof(chain_position)/sizeof(chain_position[0]);
X
Xpublic Pixmap tick, emptytick;
Xpublic Widget menuBar;
X
Xpublic Icon_mode current_mode;
X
X
Xpublic void createMenuWidgets(Widget w)
X{
X  private void menuSelect(Widget, Cardinal, caddr_t);
X  public  void createMenu(Widget, MenuContents[], Cardinal, 
X			  void (*)(Widget, Cardinal, caddr_t) );
X
X  Widget fileMenuButton, optionMenuButton, viewMenuButton, selectionMenuButton;
X  Widget fileMenu, optionMenu, viewMenu;
X  Arg arglist[5], *newlist;
X  Cardinal i;
X
X  i = 0;
X  XtSetArg(arglist[i], XtNrubberWidth,  False);    i++;
X  XtSetArg(arglist[i], XtNrubberHeight, False);    i++;
X  XtSetArg(arglist[i], XtNborderWidth,      0);    i++;
X  newlist = XtMergeArgLists(arglist, i, chain_position, chain_size);
X  menuBar          =   XtCreateManagedWidget("menuBar",
X					     xedwFormWidgetClass,
X					     w,
X					     newlist, i + chain_size);
X  XtFree(newlist);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNhighlightThickness, 0); i++;
X  XtSetArg(arglist[i], XtNborderWidth,        0); i++;
X  XtSetArg(arglist[i], XtNmenuName,  "fileMenu"); i++;
X  XtSetArg(arglist[i], XtNlabel,         "File"); i++;
X  XtSetArg(arglist[i], XtNvertDistance,       0); i++;
X  fileMenuButton   =   XtCreateManagedWidget("fileMenuButton",
X					     menuButtonWidgetClass,
X					     menuBar,
X					     arglist, i);
X
X  i = 2;
X  XtSetArg(arglist[i], XtNmenuName,         "optionMenu"); i++;
X  XtSetArg(arglist[i], XtNlabel,               "Options"); i++;
X  XtSetArg(arglist[i], XtNfromHoriz,      fileMenuButton); i++;
X  XtSetArg(arglist[i], XtNvertDistance,                0); i++;
X  optionMenuButton =   XtCreateManagedWidget("optionMenuButton",
X					     menuButtonWidgetClass,
X					     menuBar,
X					     arglist, i);
X
X  i = 2;
X  XtSetArg(arglist[i], XtNmenuName,        "viewMenu"); i++;
X  XtSetArg(arglist[i], XtNlabel,               "View"); i++;
X  XtSetArg(arglist[i], XtNfromHoriz, optionMenuButton); i++;
X  XtSetArg(arglist[i], XtNvertDistance,       0); i++;
X  viewMenuButton   =   XtCreateManagedWidget("viewMenuButton",
X					     menuButtonWidgetClass,
X					     menuBar,
X					     arglist, i);
X
X  fileMenu         =   XtCreatePopupShell("fileMenu",
X					  simpleMenuWidgetClass,
X					  fileMenuButton,
X					  NULL, 0);
X  
X  optionMenu       =   XtCreatePopupShell("optionMenu",
X					  simpleMenuWidgetClass,
X					  optionMenuButton,
X					  NULL, 0);
X  
X  viewMenu         =   XtCreatePopupShell("viewMenu",
X					  simpleMenuWidgetClass,
X					  viewMenuButton,
X					  NULL, 0);
X
X  tick             =   XCreateBitmapFromData(XtDisplay(w), 
X					     RootWindowOfScreen(XtScreen(w)),
X					     tick_bits, tick_width, 
X					     tick_height);
X
X  emptytick        =   XCreateBitmapFromData(XtDisplay(w), 
X					     RootWindowOfScreen(XtScreen(w)),
X					     EmptyTick_bits, 
X					     EmptyTick_width, 
X					     EmptyTick_height);
X  
X  createMenu(fileMenu, fileMenuStrings, fileMenuSize, menuSelect);
X  
X  createMenu(optionMenu, optionMenuStrings, optionMenuSize, menuSelect);
X  
X  createMenu(viewMenu, viewMenuStrings, viewMenuSize, menuSelect);
X
X  current_mode.options = (PERMS | NLINKS | OWNER | GROUP | SIZE);
X  
X}
X
X
X
Xpublic void createMenu(Widget menu, MenuContents menuStrings[], 
X		       Cardinal menuSize, void (*function)())
X{
X  Widget menuEntry;
X  Cardinal i, n;
X  Arg arglist[3];
X
X  for(n=0; n < menuSize; n++) {
X    MenuContents entry = menuStrings[n];
X    String widgetname = entry.paneName;
X    if (!strcmp(LINE, widgetname))
X      menuEntry = XtCreateManagedWidget(widgetname, smeLineObjectClass,
X					menu, NULL, 0);
X    else {
X      i = 0;
X      XtSetArg(arglist[i], XtNlabel, entry.paneLabel); i++;
X      if (entry.set == flagged) {
X	XtSetArg(arglist[i], XtNleftMargin, (tick_width*1.5)); i++;
X	if (entry.paneNumber == current_mode.mode) {
X	  XtSetArg(arglist[i], XtNleftBitmap, tick); i++; 
X	} else {
X	  XtSetArg(arglist[i], XtNleftBitmap,           None); i++; 
X	}
X      }
X	  
X      menuEntry = XtCreateManagedWidget(widgetname, smeBSBObjectClass,
X					menu, arglist, i);
X      if (entry.paneNumber == current_mode.mode && entry.set == flagged) 
X	current_mode.w = menuEntry;
X
X      XtAddCallback(menuEntry, XtNcallback, function,
X		    (caddr_t) entry.paneNumber);
X    }
X  }
X}
X
X
Xprivate void menuSelect(Widget w, Cardinal paneNumber, caddr_t rubbish)
X{
X  extern void map_dialog(Boolean);
X  extern void quit_dialog(void);
X  extern void query_dialog(String, Boolean);
X  extern void displayfile(String);
X  extern void newfile_dialog(Boolean, String, Boolean);
X  extern void button_selected(Widget, Cardinal, caddr_t);
X  extern void listoption_dialog(void);
X  extern Boolean directoryManagerNewDirectory(String);
X  extern String getfilename(String);
X  extern void setCursor(Cursor);
X  extern Cursor busy;
X  extern String cwd;
X  extern Widget directoryManager;
X  XedwListReturnStruct *highlighted;
X  String filename, fullname, level;
X  struct stat filestatus;
X  Arg arglist[6];
X  Cardinal i;
X
X  switch (paneNumber) {
X  case About:
X    level = XtMalloc (sizeof(char) * 25);
X    sprintf(level, "   Xdtm v%d.%d   ", RELEASE, PATCHLEVEL);
X    query_dialog(level, False);
X    break;
X  case Help:
X    if (access(SYSTEM_HELP, R_OK) == 0) 
X      displayfile(SYSTEM_HELP);
X    else
X      query_dialog("Help not found!", False);
X    break;
X
X  case New:
X    newfile_dialog(False, NULL, False);
X    break;
X
X  case Duplicate:
X    /* Find out whether highlighted file is a regular file or a directory */
X    highlighted = XedwListShowCurrent(directoryManager);
X    if (highlighted->xedwList_index != XDTM_LIST_NONE) {
X      if (highlighted->next != NULL) 
X	query_dialog("Only one file!", False);
X      else {
X	filename = getfilename(highlighted->string);
X	fullname=(String) XtMalloc((strlen(filename)+strlen(cwd)+1) * sizeof(char));
X	strcpy(fullname, cwd);
X	if (strcmp(cwd, "/") != 0)
X	  strcat(fullname, "/");
X	strcat(fullname, filename);
X	if (stat(fullname, &filestatus) == -1) {
X	  fprintf(stderr,"xdtm: ARRRGGHHH stat error\n");
X	} else {
X	  if ((filestatus.st_mode & S_IFMT) == S_IFDIR) 
X	    /* Is a directory */
X	    newfile_dialog(True, filename, True);
X	  else if ((filestatus.st_mode & S_IFMT) == S_IFREG) 
X	    newfile_dialog(True, filename, False);
X	  else 
X	    query_dialog("Wrong file type!", False);
X	}
X	XtFree(fullname);
X      }
X    } else
X      fprintf(stderr, "Error: Duplicate selected when should have been"
X	      " disabled\n");
X    break;
X
X  case Getinfo:
X    query_dialog("Not implemented!", False);
X    break;
X
X  case Copy:
X  case Move:
X  case Trash:
X    /* Call button press with it */
X    button_selected(w, paneNumber, 0);
X    break;
X
X  case Quit:
X    quit_dialog();
X    break;
X
X  case Map:
X    map_dialog(True);
X    break;
X
X  case Select:
X    map_dialog(False);
X    break;
X
X  case Icons:
X    if (current_mode.mode != Icons) {
X      i = 0;
X      XtSetArg(arglist[i], XtNleftBitmap, None); i++;
X      XtSetValues(current_mode.w, arglist, i);
X      i = 0;
X      XtSetArg(arglist[i], XtNleftBitmap, tick); i++;
X      XtSetValues(w, arglist, i);
X      current_mode.w = w;
X      current_mode.mode = Icons;
X      XtSetArg(arglist[i], XtNshowIcons,     True); i++;
X      XtSetArg(arglist[i], XtNrowSpacing,      10); i++;
X      XtSetArg(arglist[i], XtNforceColumns, False); i++;
X      XtSetArg(arglist[i], XtNdefaultColumns,   2); i++;
X      XtSetValues(directoryManager, arglist, i);
X      directoryManagerNewDirectory(cwd);
X    } 
X    break;
X
X  case Short:
X    if (current_mode.mode != Short) {
X      i = 0;
X      XtSetArg(arglist[i], XtNleftBitmap, None); i++;
X      XtSetValues(current_mode.w, arglist, i);
X      i = 0;
X      XtSetArg(arglist[i], XtNleftBitmap, tick); i++;
X      XtSetValues(w, arglist, i);
X      current_mode.w = w;
X      current_mode.mode = Short;
X      i = 0;
X      XtSetArg(arglist[i], XtNshowIcons,    False); i++;
X      XtSetArg(arglist[i], XtNrowSpacing,       5); i++;
X      XtSetArg(arglist[i], XtNforceColumns, False); i++;
X      XtSetArg(arglist[i], XtNdefaultColumns,   2); i++;
X      XtSetValues(directoryManager, arglist, i);
X      directoryManagerNewDirectory(cwd);	/* To be consistent */
X    } 
X    break;
X
X  case Long:
X    if (current_mode.mode != Long) {
X      i = 0;
X      XtSetArg(arglist[i], XtNleftBitmap, None); i++;
X      XtSetValues(current_mode.w, arglist, i);
X      i = 0;
X      XtSetArg(arglist[i], XtNleftBitmap, tick); i++;
X      XtSetValues(w, arglist, i);
X      current_mode.w = w;
X      current_mode.mode = Long;
X      i = 0;
X      XtSetArg(arglist[i], XtNshowIcons,   False); i++;
X      XtSetArg(arglist[i], XtNrowSpacing,      5); i++;
X      XtSetArg(arglist[i], XtNforceColumns, True); i++;
X      XtSetArg(arglist[i], XtNdefaultColumns,  1); i++;
X      XtSetValues(directoryManager, arglist, i);
X      directoryManagerNewDirectory(cwd);	   /* To be consistent */
X    }
X    break;
X
X  case Options:
X    listoption_dialog();
X    break;
X
X  default:
X    fprintf(stderr, "Menu option number %d not supported\n", paneNumber);
X    break;
X  }
X    
X  
X}
X
SHAR_EOF
chmod 0644 code/menus.c || echo "restore of code/menus.c fails"
echo "x - extracting code/menus.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/menus.h &&
X/***********************************************************************************
X ** File          : menus.h                                                       **
X ** Purpose       :                                                               **
X ** Author        : Edward Groenendaal                                            **
X ** Date          : 18th Feb 1990                                                 **
X ** Documentation : Xedw Design Folder                                            **
X ** Related Files : menus.c                                                       **
X ***********************************************************************************/
X
X#ifndef _EG_menus_h
X#define _EG_menus_h
X
X#include <X11/Intrinsic.h>
X
X#define LINE    "line"
X
X#define PERMS   (1 << 1)
X#define NLINKS  (1 << 2)
X#define OWNER   (1 << 3)
X#define GROUP   (1 << 4)
X#define SIZE    (1 << 5)
X#define MODTM   (1 << 6)
X#define ACCTM   (1 << 7)
X
Xtypedef enum {flagged, noflag} Flags;
X
Xtypedef enum {
X  About,
X  Help,
X  New,
X  Duplicate,
X  Getinfo,
X  Copy,
X  Move,
X  Trash,
X  Quit,
X  Map,
X  Select,
X  Icons,
X  Short,
X  Long,
X  Options
X} MenuValue;
X
Xtypedef struct {
X  String paneName;
X  String paneLabel;
X  MenuValue paneNumber;
X  Flags set;
X} MenuContents;
X
Xtypedef struct {
X  Widget w;
X  MenuValue mode;
X  /* long listing options */
X  Cardinal length;
X  char options;
X} Icon_mode;
X
Xextern Widget menuBar;
Xextern Icon_mode current_mode;
Xextern Pixmap tick;
Xextern Pixmap emptytick;
X
X#endif /* _EG_menus_h */
SHAR_EOF
chmod 0644 code/menus.h || echo "restore of code/menus.h fails"
echo "x - extracting code/newfile.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/newfile.c &&
X/*****************************************************************************
X ** File          : newfile.c                                               **
X ** Purpose       : Initialise and Realise newfile dialog                   **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : April 1991                                              **
X ** Documentation : Xdtm Design Folder                                      **
X ** Related Files :                                                         **
X *****************************************************************************/
X
X#include "xdtm.h"
X
X#include <X11/Shell.h>
X#include <X11/Xaw/Label.h>
X#include <X11/Xaw/Command.h>
X#include <X11/Xaw/AsciiText.h>
X#include "Xedw/XedwForm.h"
X
Xextern void realize_dialog(Widget);
X
X/* Widgets */
X
Xprivate Widget newfilepopup;
Xprivate Widget newfileform;
Xprivate Widget newfilelabel;
Xprivate Widget newfiletext;
Xprivate Widget newfilefile;
Xprivate Widget newfiledir;
Xprivate Widget newfilecancel;
X
Xtypedef struct {
X  String filename;
X  Boolean isdir;
X} Filetype;
X
Xpublic void init_newfile(Widget top)
X{
X  /* Create Widgets for newfile dialog */
X  private void destroy_newfile_dialog(Widget, caddr_t, caddr_t);
X
X  Arg arglist[5];
X  Cardinal i;
X  XtTranslations newfileTranslations;
X
X  static char defaultTranslations[] = 
X    "Ctrl<Key>A:        beginning-of-line() \n\
X     Ctrl<Key>E:        end-of-line() \n\
X     <Key>Escape:       beginning-of-line() kill-to-end-of-line() \n\
X     <Key>Right: 	forward-character() \n\
X     <Key>Left:         backward-character() \n\
X     <Key>Delete:       delete-previous-character() \n\
X     <Key>BackSpace:    delete-previous-character() \n\
X     <Key>:             insert-char() \n\
X     <FocusIn>:         focus-in() \n\
X     <FocusOut>:        focus-out() \n\
X     <BtnDown>:         select-start()";
X	
X
X  newfilepopup  = XtCreatePopupShell("newfilepopup",
X				     transientShellWidgetClass,
X				     top,
X				     NULL, 0);
X
X  newfileform   = XtCreateManagedWidget("newfileform",
X					xedwFormWidgetClass,
X					newfilepopup,
X					NULL, 0);
X
X  /* label widget to prompt for new filename */
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfullWidth,          True); i++;
X  XtSetArg(arglist[i], XtNborderWidth,           0); i++;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter); i++;
X  newfilelabel  = XtCreateManagedWidget("newfilelabel",
X					labelWidgetClass,
X					newfileform,
X					arglist, i);
X  
X  /* new filename text input widget */
X
X  i = 1;
X  XtSetArg(arglist[i], XtNfromVert, newfilelabel); i++;
X  XtSetArg(arglist[i], XtNeditType, XawtextEdit); i++;
X  newfiletext   = XtCreateManagedWidget("newfiletext",
X					asciiTextWidgetClass,
X					newfileform,
X					arglist, i);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNfromVert, newfiletext); i++;
X  XtSetArg(arglist[i], XtNlabel,    "Directory"); i++;
X  newfiledir    = XtCreateManagedWidget("newfiledir",
X					commandWidgetClass,
X					newfileform,
X					arglist, i);
X  i = 1;
X  XtSetArg(arglist[i], XtNfromHoriz,   newfiledir); i++;
X  XtSetArg(arglist[i], XtNwidthLinked, newfiledir); i++;
X  XtSetArg(arglist[i], XtNlabel,           "File"); i++;
X  newfilefile   = XtCreateManagedWidget("newfilefile",
X					commandWidgetClass,
X					newfileform,
X					arglist, i);
X
X  i = 1;
X  XtSetArg(arglist[i], XtNfromHoriz,   newfilefile); i++;
X  XtSetArg(arglist[i], XtNwidthLinked, newfilefile); i++;
X  XtSetArg(arglist[i], XtNlabel,          "Cancel"); i++;
X  newfilecancel = XtCreateManagedWidget("newfilecancel",
X					commandWidgetClass,
X					newfileform,
X					arglist, i);
X
X  /* Add callbacks for buttons */
X  XtAddCallback(newfilecancel, XtNcallback,  destroy_newfile_dialog, 0); 
X
X  /* Do the translations on the text widget */
X  XtUninstallTranslations(newfiletext);
X  newfileTranslations = XtParseTranslationTable(defaultTranslations);
X  XtOverrideTranslations(newfiletext, newfileTranslations);
X}
X
Xpublic void newfile_dialog(Boolean rename, String newname, Boolean isdir)
X{
X  /* Popup the newfile dialog on screen with the correct data */
X  private void newfileQueryReturn(Widget, Boolean, caddr_t);
X  private void duplicateQueryReturn(Widget, Filetype*, caddr_t);
X  Arg arglist[1];
X  String filename;
X  Filetype *filetype;
X
X  static String defaultfilename = "untitled";
X
X  filetype = (Filetype*) XtMalloc (sizeof(Filetype));
X
X  if (newname == NULL) 
X    filename = defaultfilename;
X  else
X    filename = newname;
X
X  if (rename == False) {
X    /* Create a new file */
X
X    XtSetArg(arglist[0], XtNlabel, "Create a new file"); 
X    XtSetValues(newfilelabel, arglist, 1);
X
X    XtSetArg(arglist[0], XtNstring, filename);
X    XtSetValues(newfiletext, arglist, 1);
X
X    /* Add callbacks for buttons */
X    XtAddCallback(newfiledir,    XtNcallback,  newfileQueryReturn,  True);
X    XtAddCallback(newfilefile,   XtNcallback,  newfileQueryReturn, False);
X  } else {
X    /* rename an existing file */
X    filetype->filename = filename;
X    filetype->isdir    = isdir;
X
X    XtSetArg(arglist[0], XtNlabel, "Duplicate file"); 
X    XtSetValues(newfilelabel, arglist, 1);
X
X    XtSetArg(arglist[0], XtNstring, filename);
X    XtSetValues(newfiletext, arglist, 1);
X
X    if (isdir == True) 
X      XtSetSensitive(newfilefile, False);
X    else
X      XtSetSensitive(newfiledir, False);
X    XtAddCallback(newfiledir,    XtNcallback,  duplicateQueryReturn,  filetype);
X    XtAddCallback(newfilefile,   XtNcallback,  duplicateQueryReturn,  filetype);
X  }
X
X  realize_dialog(newfilepopup);
X
X}
X
Xprivate void destroy_newfile_dialog(Widget w, caddr_t dummy1, caddr_t dummy2)
X{
X
X  XtPopdown(newfilepopup);
X  
X  XtSetSensitive(newfilefile, True);
X  XtSetSensitive(newfiledir,  True);
X  XtRemoveAllCallbacks(newfilefile, XtNcallback);
X  XtRemoveAllCallbacks(newfiledir,  XtNcallback);
X}
X
Xprivate void newfileQueryReturn(Widget w, Boolean isdir, caddr_t dummy)
X{
X  extern void query_dialog(String, Boolean);
X  extern String cwd;
X  String filename, fullname;
X  Arg arglist[1];
X  int fd;
X  
X  destroy_newfile_dialog(w, 0, 0);
X  
X  XtSetArg(arglist[0], XtNstring, &filename);
X  XtGetValues(newfiletext, arglist, 1);
X
X  fullname = (String) XtMalloc (sizeof(char) * (strlen(cwd) + 
X						strlen(filename) + 2));
X  sprintf(fullname, "%s/%s", cwd, filename);
X
X  if (isdir == True) {
X    /* Create a directory with the name 'filename' */
X    if ((fd = mkdir(fullname, 0777)) == -1) 
X      query_dialog("Can't create dir", False);
X    else
X      directoryManagerNewDirectory(cwd);
X  } else {
X    /* Create a file with the name 'filename' */
X    if ((fd = creat(fullname, 0666)) == -1) {
X      /* Can't create fullname, maybe should look in errno to see why? */
X      query_dialog("Can't create file", False);
X    } else {
X      close(fd);
X      directoryManagerNewDirectory(cwd);
X    }
X  }
X
X  XtFree(fullname);
X}
X
X
Xprivate void duplicateQueryReturn(Widget w, Filetype *filetype, caddr_t dummy)
X{
X  extern void query_dialog(String, Boolean);
X  extern String cwd;
X  String filename, command;
X  Arg arglist[1];
X  int fd;
X  
X  destroy_newfile_dialog(w, 0, 0);
X  
X  XtSetArg(arglist[0], XtNstring, &filename);
X  XtGetValues(newfiletext, arglist, 1);
X
X  command = XtMalloc (sizeof(char) * (strlen(filetype->filename) + 
X				      strlen(filename) + 20));
X
X  if (filetype->isdir == True) {
X    /* make new directory, copy contents of old one into it */
X    if ((fd = mkdir(filename, 0777)) == -1) 
X      query_dialog("Can't create dir", False);
X    sprintf(command, "sh -c 'cp -r \"%s\"/ \"%s\"'", filetype->filename, 
X	    filename);
X
X    if (execute(NULL, "sh", command, True) != 0) 
X      query_dialog("Can't copy files!", False);
X    else
X      directoryManagerNewDirectory(cwd);
X  } else {
X    sprintf(command, "cp '%s' '%s'", filetype->filename, filename);
X
X    if (execute(NULL, "cp", command, True) != 0) 
X      query_dialog("Can't create file!", False);
X    else
X      directoryManagerNewDirectory(cwd);
X  }
X
X  XtFree(command);
X}
SHAR_EOF
chmod 0644 code/newfile.c || echo "restore of code/newfile.c fails"
echo "x - extracting code/parse.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/parse.c &&
X/*****************************************************************************
X ** File          : parse.c                                                 **
X ** Purpose       : Parse setup file, select icon to be used.               **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : 19th Feb 1990                                           **
X ** Documentation : Xdtm Design Folder                                      **
X ** Related Files :                                                         **
X *****************************************************************************/
X
X#include "xdtm.h"
X
X#include <sys/types.h>
X#include <sys/stat.h>
X#include <sys/param.h>
X#include <sys/file.h>
X#include <pwd.h>
X#include <grp.h>
X#include "parse.h"
X#include "menus.h"
X
X#include "Xedw/XedwList.h"
X
X#include "bitmaps/Grey.Mask"
X#include "bitmaps/folder.icon"
X#include "bitmaps/file.icon"
X
Xtypedef struct _BTree {
X  Pixmap icon;
X  Pixmap grey;
X  struct _BTree *left;
X  struct _BTree *right;
X} BTree;
X
Xextern FILE *yyin;
Xextern int step(char*, char*);
Xextern int circf;
Xextern typePrefs *prefs ;
X
Xpublic uid_t user;
Xpublic uid_t group;
Xprivate BTree *grey_tree;
X
Xprivate Pixmap applyprefs(typePrefs*, String, String, struct stat*);
Xprivate Pixmap do_iconprefs(iconPrefs*, String, String, struct stat*);
X
Xpublic GC xdtmgc;
Xpublic Pixmap foldericon, fileicon, grey_mask; /* default icons */
X
Xpublic Boolean getIconType(String filename, String path, XedwList *element)
X{
X  /* Return True if file should be displayed, otherwise False.
X   * If long listing is on, element should be DUMMY, and this
X   * routine should fill the entries into the icon_list.
X   */
X
X  private Pixmap grey_icon(Pixmap);
X
X  extern Icon_mode current_mode;
X  struct stat *filestatus;
X  typePrefs *myprefs = prefs;
X  String fullname;
X  Pixmap icon;
X  
X  element->string = XtNewString(filename);
X
X  if (current_mode.mode != Short) {
X    filestatus = (struct stat*) XtMalloc (sizeof(struct stat));
X    fullname=(String) XtMalloc((strlen(filename)+strlen(path)+1) * sizeof(char));
X    strcpy(fullname, path);
X    strcat(fullname, "/");
X    strcat(fullname, filename);
X    if (lstat(fullname, filestatus) == -1) {
X      /* maybe a link to a nonexistent file? */
X      return(False);
X    } else {
X      if (current_mode.mode == Icons) {
X	element->icon = fileicon;
X	if ((filestatus->st_mode & S_IFMT) == S_IFDIR) /* stat(5) for details */
X	  element->icon = foldericon;
X      
X	/* try all rules in prefs */
X	if ((icon = applyprefs(myprefs, fullname, filename, filestatus)) != NULL) {
X	
X	  /* If the file is a directory but is not readable AND executable by the user
X	   * then grey it. If the file is not readable then grey it.
X	   */
X	
X	  /* if not readable then grey it */
X	  if (icon != DUMMY) 
X	    if (!(((filestatus->st_mode & S_IRUSR) != 0 &&
X		   user == filestatus->st_uid)           ||
X		  ((filestatus->st_mode & S_IRGRP) != 0 &&
X		   group == filestatus->st_gid)          ||
X		  ((filestatus->st_mode & S_IROTH) != 0))) {
X	      icon = grey_icon(icon);
X	    } else {
X	      if ((filestatus->st_mode & S_IFMT) == S_IFDIR) 
X		if (!(((filestatus->st_mode & S_IXUSR) != 0 &&
X		       user == filestatus->st_uid)           ||
X		      ((filestatus->st_mode & S_IXGRP) != 0 &&
X		       group == filestatus->st_gid)          ||
X		      ((filestatus->st_mode & S_IXOTH) != 0))) {
X		  icon = grey_icon(icon);
X		} 
X	    }
X	  element->icon = icon;
X	}
X      } else {
X	/* Long Listing */
X	Cardinal length;
X	char cm = current_mode.options;
X	String output_line = "";
X
X	element->icon = NULL;
X	length = 0;
X	if (cm & PERMS) {
X	  char type;
X	  char xusr, xgrp, xoth;
X	  unsigned short mode = (filestatus->st_mode);
X
X	  output_line = (String) XtMalloc (sizeof(char) * 12);
X
X	  /* I could use the S_IS* macros here but I prefer to see what's
X	   * going on.
X	   */
X	  if ((mode & S_IFMT) == S_IFDIR) type = 'd';      /* Directory */
X	  else if ((mode & S_IFMT) == S_IFBLK) type = 'b'; /* Block device */
X	  else if ((mode & S_IFMT) == S_IFCHR) type = 'c'; /* Character device */
X	  else if ((mode & S_IFMT) == S_IFREG) type = ' '; /* Plain file */
X	  else if ((mode & S_IFMT) == S_IFIFO) type = 'f'; /* Fifo */
X	  else if ((mode & S_IFMT) == S_IFLNK) type = 'l'; /* Symbolic link */
X	  else if ((mode & S_IFMT) == S_IFSOCK) type = 's'; /* Socket */
X	  else type = '?';
X	  
X	  if (mode & S_ISUID) 	/* Set User Id */
X	    xusr = 's';
X	  else if (mode & S_IXUSR)
X	    xusr = 'x';
X	  else 
X	    xusr = '-';
X
X	  if (mode & S_ISGID)	/* Set Group Id */
X	    xgrp = 's';
X	  else if (mode & S_IXGRP)
X	    xgrp = 'x';
X	  else
X	    xgrp = '-';
X
X	  if (mode & S_ISVTX)	/* Save Text */
X	    xoth = 't';
X	  else if (mode & S_IXOTH)
X	    xoth = 'x';
X	  else 
X	    xoth = '-';
X
X	  sprintf(output_line, 
X		  "%c%c%c%c%c%c%c%c%c%c ",
X		  type,
X		  (mode & S_IRUSR) ? 'r' : '-',
X		  (mode & S_IWUSR) ? 'w' : '-',
X		  xusr,
X		  (mode & S_IRGRP) ? 'r' : '-',
X		  (mode & S_IWGRP) ? 'w' : '-',
X		  xgrp,
X		  (mode & S_IROTH) ? 'r' : '-',
X		  (mode & S_IWOTH) ? 'w' : '-',
X		  xoth);
X	}
X
X	if (cm & NLINKS) {
X	  output_line = XtRealloc (output_line, 
X				   sizeof(char) *
X				   (strlen(output_line) + 3 + 2));
X	  
X	  sprintf(output_line, "%s%3d ", output_line, 
X		  filestatus->st_nlink);
X	}
X	if (cm & OWNER) {
X	  struct passwd *pw;
X
X	  output_line = XtRealloc (output_line,
X				   sizeof(char) *
X				  (strlen(output_line) + 8 + 2));
X	  
X	  if ((pw = getpwuid(filestatus->st_uid)) == NULL)
X	    sprintf(output_line, "%s%-8d ", output_line, filestatus->st_uid);
X	  else
X	    sprintf(output_line, "%s%-8s ", output_line, pw->pw_name);
X
X	}
X	if (cm & GROUP) {
X	  struct group *gr;
X	  
X	  output_line = XtRealloc (output_line,
X				   sizeof(char) *
X				  (strlen(output_line) + 8 + 2));
X	  
X	  if ((gr = getgrgid(filestatus->st_gid)) == NULL)
X	    sprintf(output_line, "%s%-8d ", output_line, filestatus->st_gid);
X	  else
X	    sprintf(output_line, "%s%-8s ", output_line, gr->gr_name);
X
X	}
X	if (cm & SIZE)  {
X	  unsigned short mode = (filestatus->st_mode);
X
X	  output_line = XtRealloc (output_line, 
X				   sizeof(char) *
X				  (strlen(output_line) + 9 + 2));
X	  if ((mode & S_IFMT) == S_IFBLK || (mode & S_IFMT) == S_IFCHR)
X	    sprintf(output_line, "%s%5d,%3d ", output_line, 
X		    (filestatus->st_rdev >> 8) & 0377,
X		    (filestatus->st_rdev) & 0377);
X	  else
X	    sprintf(output_line, "%s%9d ", output_line, filestatus->st_size);
X	}
X	if (cm & MODTM) {
X	  String time;
X	  output_line = XtRealloc (output_line,
X				   sizeof(char) *
X				   (strlen(output_line) + 35 + 2));
X
X	  time = ctime(&(filestatus->st_mtime));
X	  *(time + (strlen(time) - 1)) = '\0';
X	  sprintf(output_line, "%s%s ", output_line, time);
X	}
X	if (cm & ACCTM) {
X	  String time;
X	  output_line = XtRealloc (output_line,
X				   sizeof(char) *
X				   (strlen(output_line) + 35 + 2));
X
X	  time = ctime(&(filestatus->st_atime));
X	  *(time + (strlen(time) - 1)) = '\0';
X	  sprintf(output_line, "%s%s ", output_line, time);
X	}
X	current_mode.length = strlen(output_line); /* length of data */
X	output_line = XtRealloc (output_line,
X				 sizeof(char) * 
X				(strlen(output_line) + strlen(filename) + 2));
X	sprintf(output_line, "%s%s", output_line, filename);
X	element->string = output_line;
X      }
X    }
X    XtFree(filestatus);
X    XtFree(fullname);
X  }
X
X  if (element->icon == DUMMY)
X    return(False);
X  else
X    return(True);
X}
X
Xprivate Pixmap applyprefs(typePrefs *tp, String fullname, String filename, 
X			  struct stat *filestatus)
X{
X  /* Recursively traverse the prefs structure until a match is found.
X   * Jump out as soon as a match is found, try special files first */
X
X  Pixmap icon = NULL;
X  
X  /* Try directories */
X  if (icon == NULL && 
X      tp->dir != NULL &&
X      (filestatus->st_mode & S_IFMT) == S_IFDIR) {
X    icon = applyprefs(tp->dir, fullname, filename, filestatus);
X  }
X
X  /* Try plain files */
X  if (icon == NULL &&
X      tp->file != NULL &&
X      (filestatus->st_mode & S_IFMT) == S_IFREG) {
X    icon = applyprefs(tp->file, fullname, filename, filestatus);
X  }
X
X  /* Try executable files */
X  if (icon == NULL &&
X      tp->exe != NULL &&
X      (filestatus->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0) {
X    icon = applyprefs(tp->exe, fullname, filename, filestatus);
X  }
X  /* Try Readable files */
X  if (icon == NULL && 
X      tp->read != NULL &&
X      (filestatus->st_mode & (S_IRUSR | S_IRGRP | S_IROTH)) != 0) {
X    icon = applyprefs(tp->read, fullname, filename, filestatus);
X  }
X  
X  /* Try Writable files */
X  if (icon == NULL && 
X      tp->write != NULL &&
X      (filestatus->st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)) != 0) {
X    icon = applyprefs(tp->write, fullname, filename, filestatus);
X  }
X
X  /* defaults */
X  if (icon == NULL && tp->iconprefs != NULL) {
X    icon = do_iconprefs(tp->iconprefs, fullname, filename, filestatus);
X  }
X
X  return(icon);
X}
X
Xprivate Pixmap grey_icon(Pixmap icon)
X{
X  private BTree *grey_search(Pixmap, Pixmap*, BTree*);
X  Pixmap result;
X  
X  grey_tree = grey_search(icon, &result, grey_tree);
X  
X  return(result);
X}
X
Xprivate BTree *grey_search(Pixmap icon, Pixmap *new, BTree *tree)
X{
X  Pixmap newpixmap;
X  Widget w;
X  BTree *result;
X  extern Widget topLevel;
X
X  if (tree == NULL) {
X    /* Create Pixmap */
X    result = (BTree*) XtMalloc (sizeof(BTree));
X    result->icon = icon;
X    result->left = NULL;
X    result->right = NULL;
X    newpixmap = XCreatePixmap(XtDisplay(topLevel),
X			      RootWindowOfScreen(XtScreen(topLevel)), 
X			      32, 32, DefaultDepthOfScreen(XtScreen(topLevel)));
X    XSetFunction(XtDisplay(topLevel), xdtmgc, GXcopy);
X    XCopyPlane(XtDisplay(topLevel),
X	       icon, newpixmap, xdtmgc, 0, 0, 32, 32, 0, 0, 1);  
X    XSetFunction(XtDisplay(topLevel), xdtmgc, GXand);
X    XCopyPlane(XtDisplay(topLevel),
X	       grey_mask, newpixmap, xdtmgc, 0, 0, 32, 32, 0, 0, 1); 
X    result->grey = newpixmap; 
X    *new = newpixmap;
X  } else 
X    if (tree->icon == icon) {
X      *new = tree->grey;
X      result = tree;
X    } else
X      if (tree->icon < icon) 
X	result = grey_search(icon, new, tree->left);
X      else
X	result = grey_search(icon, new, tree->right);
X
X  return(result);
X}
X
Xprivate Pixmap do_iconprefs(iconPrefs *ip, String fullname, String filename, 
X			    struct stat *filestatus)
X{
X  /* traverse linked list trying to match regular expressions against 
X   * the current filename 
X   */
X  Pixmap icon = NULL;
X  String string;
X
X  if (ip != NULL) 
X    if (ip->expbuf == NULL) {
X      /* default value */
X      icon = ip->icon;
X    } else {
X      /* try to match regular expression,
X       * Add stuff here to check for whether to use fullname or filename.
X       */
X      if (ip->checkpath == True) 
X	string = fullname;
X      else
X	string = filename;
X      circf = ip->circf;
X      if (step(string, ip->expbuf) != 0) {
X	if (ip->extra != NULL) {
X	  icon = applyprefs((typePrefs*)ip->extra, fullname, filename, filestatus);
X	}
X	if (icon == NULL) 
X	  icon = ip->icon;
X      } else {
X	icon = do_iconprefs(ip->next, fullname, filename, filestatus);
X      }
X    }
X  return(icon);
X}
X
Xpublic Boolean parsePreferences(Widget w)
X{
X  private void initBitmaps(Widget);
X  extern int yyparse(void);
X  extern void selectionChange(Widget, Cardinal, caddr_t);
X  extern typePrefs *newTypePref(void);
X  extern AppSelection **appselections;
X  extern Cardinal selectionindex;
X  extern String home;
X  extern Widget selectionMenu;
X  MenuContents *selectionmenu;
X  String setupfile;
X  Cardinal i;
X  int n;
X  
X  initBitmaps(w);
X
X  /* check to see it there is an .xdtmrc in the users home directory. 
X   * If not use the system one.. or the command line argument one.
X   */
X  
X  setupfile = (String) XtMalloc ((strlen(home) + 8) * sizeof(char));
X
X  user = geteuid();
X  group = getegid();
X
X  strcpy(setupfile, home);
X  strcat(setupfile, "/.xdtmrc");
X  if (((yyin = fopen(setupfile, "r")) == NULL) &&
X      ((yyin = fopen(SYSTEM_XDTMRC, "r")) == NULL)) {
X    fprintf(stderr, "Warning: No user or system xdtmrc found\n");
X    prefs = newTypePref();
X  } else {
X    /* parse the file */
X    (void) yyparse();
X  }
X  XtFree(setupfile);
X  
X  /* Create selection menu */
X  selectionmenu = (MenuContents*) XtMalloc (sizeof(MenuContents) * selectionindex);
X  for(i = 0; i < selectionindex; i++) {
X    selectionmenu[i].paneName   = appselections[i]->name;
X    selectionmenu[i].paneLabel  = appselections[i]->name;
X    selectionmenu[i].paneNumber = i;
X    selectionmenu[i].set        = noflag;
X  }
X  
X  createMenu(selectionMenu, selectionmenu, i, selectionChange);
X
X}
X
Xprivate void initBitmaps(Widget w)
X{
X  XGCValues values;
X
X  foldericon  = XCreateBitmapFromData(	XtDisplay(w),
X				      	RootWindowOfScreen(XtScreen(w)),
X				      	folder_bits,
X				     	IconBitmapWidth, IconBitmapHeight);
X  fileicon    = XCreateBitmapFromData(  XtDisplay(w),
X                                      	RootWindowOfScreen(XtScreen(w)),
X				      	file_bits,
X				      	IconBitmapWidth, IconBitmapHeight);
X  grey_mask   = XCreateBitmapFromData(  XtDisplay(w),
X                                      	RootWindowOfScreen(XtScreen(w)),
X				      	Grey_bits,
X				      	IconBitmapWidth, IconBitmapHeight);
X  
X  if ((BlackPixelOfScreen(XtScreen(w))) == 1) {
X    values.background = WhitePixelOfScreen(XtScreen(w));
X    values.foreground = BlackPixelOfScreen(XtScreen(w));
X  } else {
X    values.background = BlackPixelOfScreen(XtScreen(w));
X    values.foreground = WhitePixelOfScreen(XtScreen(w));
X  }
X
X  xdtmgc = XtGetGC(w, (unsigned) GCBackground | GCForeground, &values);
X		 
X  grey_tree = NULL;
X}
X
X
Xpublic void highlight_by_re(String re)
X{
X  /* This procedure is called by selectQueryResult in map.c, it should be in
X   * map.c but can't because <regexp.h> can only be accessable from within
X   * one file.
X   */
X  extern void selection_made(Widget, caddr_t, caddr_t);
X  extern XedwList **icon_list;
X  extern Cardinal icon_list_size;
X  extern Widget directoryManager;
X  String buffer;
X  Cardinal i;
X
X  buffer = (char*) XtMalloc (sizeof(char) * ESIZE);
X  compile(re, buffer, &(buffer[ESIZE]), '\0');
X
X  /* traverse icon_list calling XedwListHighlight on every filename
X   * matched.
X   */
X  for (i = 0; i < icon_list_size; i++) {
X    if (step(icon_list[i]->string, buffer) != 0) 
X      XedwListHighlight(directoryManager, i);
X  }
X
X  selection_made(directoryManager, 0, 0);
X
X  XtFree(buffer);
X
X}
X
X
X
X
X
X
X
X
X
X
X
X
X
SHAR_EOF
chmod 0644 code/parse.c || echo "restore of code/parse.c fails"
echo "x - extracting code/parse.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/parse.h &&
X/*****************************************************************************
X ** File          : parse.h                                                 **
X ** Purpose       :                                                         **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : 18th Feb 1990                                           **
X ** Documentation : Xdtm Design Folder                                      **
X ** Related Files : parse.c, lexical.h, parser.y                            **
X *****************************************************************************/
X
X#ifndef _parse_h
X#define _parse_h
X
X/* Directory Manager Structures */
X
Xtypedef struct _iconPrefs {
X  char *expbuf;
X  int circf; 
X  Boolean checkpath;
X  XtPointer extra;
X  Pixmap icon;
X  struct _iconPrefs *next;
X} iconPrefs;
X
Xtypedef struct _typePrefs {
X  iconPrefs *iconprefs;
X  struct _typePrefs *dir;
X  struct _typePrefs *file;
X  struct _typePrefs *exe;
X  struct _typePrefs *read;
X  struct _typePrefs *write;
X} typePrefs;
X
X/* Application Manager Structure */
X
X#define APPPSIZE 10 /* Initial size of an AppProgram Array */
X#define APPPINC  5  /* Increment by which to increase AppProgram Array on overflow */
X
Xtypedef enum {M_SEL, O_SEL, N_SEL} SelOptions;
X
Xtypedef struct {
X  String string;
X  Pixmap icon;
X  String program;
X  SelOptions options;
X} AppProgram;
X
Xtypedef struct {
X  String name;
X  Cardinal number;
X  AppProgram **list;
X} AppSelection;
X
X/* Regular Expression macros */
X
X#define ESIZE 1024            /* maximum size of an expression */
X
X#define INIT register String sp = instring;
X#define GETC() (*sp++)
X#define PEEKC() (*sp)
X#define UNGETC(c) (--sp)
X#define RETURN(c) return;
X#define ERROR(c)  {fprintf(stderr,"regexp error %d\n", c); exit(1);};
X
X#endif /* _parse_h */
SHAR_EOF
chmod 0644 code/parse.h || echo "restore of code/parse.h fails"
echo "x - extracting code/parser.y (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/parser.y &&
X%{ /*-*- Mode: C -*-*/
X/**************************************************************************
X * Filename :       parser.y
X * Author   :       Edward Groenendaal
X * Date     :       31/1/91
X * Purpose  :       
X *                  
X **************************************************************************/
X
X#define YYDEBUG     1
X#include "xdtm.h"
X#include "parse.h"
X#include <regexp.h>
X
Xtypedef struct _iconTree {
X  String fullname;       /* index on this */
X  Pixmap icon;
X  struct _iconTree *left;
X  struct _iconTree *right;
X} iconTree;
X
Xtypedef struct _varStack {
X  String *defpath;
X  Cardinal dirinpath;
X  Boolean checkpath;
X  iconPrefs *iconpref;
X  typePrefs *current;
X  struct _varStack *next;
X} varStack;
X
Xpublic  typePrefs *newTypePref(void);
Xprivate void       start_block(typePrefs*,iconPrefs*);
Xprivate void       end_block(void);
Xprivate String    *stringtopath(String, Cardinal*);
Xprivate Pixmap     lookupicon(String);
Xprivate iconPrefs *getlast(iconPrefs*);
Xprivate iconPrefs *inserticonpref(iconPrefs*, iconPrefs*);
Xprivate String     strip_quotes(String);
Xprivate iconTree  *get_pixmap(iconTree*,iconTree*);
Xprivate void       set_path(String);
Xprivate void       set_icon(String, Boolean);
Xprivate void       set_deficon(String);
Xprivate void       set_ignore(void);
Xprivate void       newselection(String);
Xprivate void       setapp(int, String);
X
X/* imported variables/procedures */
Xextern int parseerror;            /* quantity of parse errors so far */
Xextern int yylineno;              /* line number being parsed */
Xextern void yyerror(char *, ...); /* normal error printing routine */
X
X#ifndef DEBUG_YACC
Xextern Widget topLevel;
X#endif
X
Xpublic  AppSelection **appselections;
Xpublic  typePrefs     *prefs;          /* preferneces */
Xprivate varStack      *varframe;       /* stack frames */
Xprivate iconTree      *icontable;      /* table of pixmaps */
Xprivate char          *ptr;            /* general use pointer */
Xprivate AppSelection  *current_selection;
Xprivate Cardinal       listindex;      /* index into current appprogram list */
Xprivate Cardinal       currentlistmax; /* current list appprogram size */
Xpublic  Cardinal       selectionindex; /* index into appselections */
X
X%} /* Start of YACC declarations */
X
X%start xdtmrc
X
X%union                              /* valid types */
X{
X    int  number;                     /* number */
X    char *string;                    /* string */
X}
X
X/* declare terminals with their types */
X
X%token <string> STRING_T
X%token <number> IF_T SET_T ICON_T NAME_T PATH_T DEFICON_T TYPE_T CHECKPATH_T
X%token <number> TRUE_T FALSE_T IGNORE_T
X%token <number> DIR_T FILE_T READ_T WRITE_T EXE_T PROG_T OPTIONS_T
X%token <number> MSEL_T OSEL_T NSEL_T DEFINE_T
X%token <number> ASSIGN_T EQUAL_T SEMIC_T COMMA_T
X%token <number> O_PAR_T C_PAR_T O_BRACE_T C_BRACE_T
X%token <value>  EOFTOKEN ERRORTOKEN
X
X%type <string> identifier
X%type <number> block type var option
X
X%%    /* Beginning of rule section */
X
Xxdtmrc       :   { init_structs(); } 
X                 statements 
X                 { free_structs(); }
X             ;
Xstatements   :   /* Empty */
X             |   statements statement 
X             ;
Xstatement    :   ifstatement
X             |   setstatement SEMIC_T
X             |   define
X             ;
Xifstatement  :   IF_T O_PAR_T expression C_PAR_T block
X             ;
Xsetstatement :   SET_T var ASSIGN_T identifier { switch ($2) {
X                                                 case PATH_T:
X                                                   set_path($4);
X						   break;
X						 case ICON_T:
X						   set_icon($4, False);
X						   break;
X						 case DEFICON_T:
X						   set_deficon($4);
X						   break;
X						 }
X					       }
X             |   SET_T CHECKPATH_T ASSIGN_T TRUE_T 
X                       { varframe->checkpath = True; }
X             |   SET_T CHECKPATH_T ASSIGN_T FALSE_T 
X                       { varframe->checkpath = False; }
X             |   SET_T IGNORE_T
X                       { set_icon("", True);}
X             ;
Xdefine       :   DEFINE_T identifier {newselection($2);} ASSIGN_T defineblock
X             ;
Xblock        :   O_BRACE_T
X                 statements {end_block();} 
X                 C_BRACE_T
X             ;
Xdefineblock  :   O_BRACE_T descriptions C_BRACE_T 
X                 {current_selection->number = listindex;}
X             ;
Xdescriptions :   /* Empty */
X             |   descriptions description 
X             ;
Xdescription  :   O_BRACE_T 
X
X                 { /* Allocate a new AppProgram */
SHAR_EOF
echo "End of part 3"
echo "File code/parser.y is continued in part 4"
echo "4" > s2_seq_.tmp
exit 0

eddyg@syma.sussex.ac.uk (Edward J. Groenendaal) (04/18/91)

---- Cut Here and unpack ----
#!/bin/sh
# this is part 4 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file code/parser.y continued
#
CurArch=4
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file code/parser.y"
sed 's/^X//' << 'SHAR_EOF' >> code/parser.y
X		   
X		   current_selection->list[listindex] = 
X		     (AppProgram*) XtMalloc (sizeof(AppProgram));
X		 }
X
X                 NAME_T ASSIGN_T identifier SEMIC_T {setapp($3, $5);}
X		 ICON_T ASSIGN_T identifier SEMIC_T {setapp($8, $10);}
X                 PROG_T ASSIGN_T identifier SEMIC_T {setapp($13, $15);}
X                 OPTIONS_T ASSIGN_T option SEMIC_T  
X                 {
X		   setapp($18, (String)$20);
X
X                  /* Increment listindex */
X		   if (++listindex == currentlistmax) {
X		     currentlistmax += APPPINC;
X		     current_selection->list = 
X		       (AppProgram**) XtMalloc (current_selection->list,
X						sizeof(AppProgram*) *
X						currentlistmax);
X		   }
X		 }
X
X                 C_BRACE_T
X             ;
Xoption       :   MSEL_T | OSEL_T | NSEL_T
X             ;
Xexpression   :   NAME_T EQUAL_T identifier { new_re($3); }
X             |   TYPE_T EQUAL_T type       { new_type($3); }
X             ;
Xidentifier   :   STRING_T      {  $$=strip_quotes($1);
X			       }
X             ;
Xtype         :   DIR_T | READ_T | WRITE_T | EXE_T | FILE_T
X             ;
Xvar          :   PATH_T | ICON_T | DEFICON_T
X             ;
X%%  
X
Xprivate void init_structs(void)
X{
X  Cardinal n;
X
X  prefs = newTypePref();
X  icontable = NULL;
X  varframe = (varStack*) XtMalloc (sizeof(varStack));
X  varframe->defpath = stringtopath("/usr/lib/X11/bitmaps", &n);
X  varframe->dirinpath = n;
X  varframe->current = prefs;
X  varframe->checkpath = False;
X  varframe->iconpref = NULL;
X  varframe->next = NULL;
X
X  listindex = 0;
X  selectionindex = -1;
X  appselections = (AppSelection**) XtMalloc (sizeof(AppSelection*) * MAXSELS);
X}
X
Xprivate void free_structs(void)
X{
X  /* Free varstack (Should be only one level left) */
X  XtFree(varframe);
X
X  selectionindex++;
X}
X
Xpublic typePrefs *newTypePref(void)
X{
X  typePrefs *tp;
X
X  tp = (typePrefs*) XtMalloc (sizeof(typePrefs));
X  tp->iconprefs = NULL;
X  tp->dir = NULL;
X  tp->file = NULL;
X  tp->exe = NULL;
X  tp->read = NULL;
X  tp->write = NULL;
X  
X  return(tp);
X}
X  
Xprivate void start_block(typePrefs *newpref, iconPrefs *iconpref)
X{
X  /* Push new stack frame */
X  varStack *newframe;
X  
X  newframe = (varStack*) XtMalloc (sizeof(varStack));
X  newframe->defpath = varframe->defpath;
X  newframe->dirinpath = varframe->dirinpath;
X  newframe->current = newpref;
X  newframe->checkpath = varframe->checkpath;
X  newframe->iconpref = iconpref;
X  newframe->next = varframe;
X  varframe = newframe;
X}
X
Xprivate void end_block(void)
X{
X  /* If current frame has an empty typePref, free it. 
X   * Pop last stack frame. 
X   */
X  iconPrefs *tmpIconPref;
X  typePrefs *tmp = varframe->current;
X  varStack *tmpframe = varframe->next;
X
X  if (tmp->iconprefs == NULL && tmp->dir == NULL &&
X      tmp->file == NULL      && tmp->exe == NULL &&
X      tmp->read == NULL      && tmp->write == NULL) {
X    XtFree(tmp);
X    tmp = NULL;
X    tmpIconPref = varframe->iconpref;
X    tmpIconPref->extra = NULL;
X  }
X  /* Should free contents first!! TODO */
X  XtFree(varframe);
X  varframe = tmpframe;
X}
X
Xprivate void new_re(String re)
X{
X  iconPrefs *new, *tmp = varframe->current->iconprefs;
X
X  new = (iconPrefs*) XtMalloc (sizeof(iconPrefs));
X  new->next = NULL;
X  new->expbuf = (char*) XtMalloc (sizeof(char) * ESIZE);
X  new->extra = (XtPointer) newTypePref();
X  compile(re, new->expbuf, &(new->expbuf[ESIZE]), '\0');
X  new->circf = circf;
X  new->checkpath = varframe->checkpath;
X  new->icon = NULL;
X  varframe->current->iconprefs = inserticonpref(tmp, new);
X  start_block((typePrefs*)new->extra, (iconPrefs*)new);
X}
X
Xprivate void new_type(int n)
X{
X  /* Allocate a typePref on dir, write etc. if neadbe, otherwise ignore */
X  typePrefs *typeprefs = varframe->current;
X  typePrefs *newpref;
X
X  switch(n) {
X  case DIR_T:
X    if (typeprefs->dir == NULL) 
X      typeprefs->dir = newTypePref();
X    newpref = typeprefs->dir;
X    break;
X  case FILE_T:
X    if (typeprefs->file == NULL) 
X      typeprefs->file = newTypePref();
X    newpref = typeprefs->file;
X    break;
X  case EXE_T:
X    if (typeprefs->exe == NULL) 
X      typeprefs->exe = newTypePref();
X    newpref = typeprefs->exe;
X    break;
X  case READ_T:
X    if (typeprefs->read == NULL) 
X      typeprefs->read = newTypePref();
X    newpref = typeprefs->read;
X    break;
X  case WRITE_T:
X    if (typeprefs->write == NULL) 
X      typeprefs->write = newTypePref();
X    newpref = typeprefs->write;
X    break;
X  }
X  start_block(newpref, NULL);
X}
X
Xpublic Cardinal count_chr(String s, char c)
X{
X  Cardinal count=0;
X
X  while(*s != '\0') {
X    if (*s == c) count++;
X    s++;
X  }
X  return count;
X}
X
Xprivate String *stringtopath(String s, Cardinal *n)
X{
X  /* Split a path into directories, put these into a linked list */
X  String *result;
X  String p, tmp;
X#ifdef DEBUG_YACC
X  String home;
X#else
X  extern String home;
X#endif
X
X  *n = 0;
X
X#ifdef DEBUG_YACC
X    if ((home = (String) getenv("HOME")) == NULL) {
X    fprintf(stderr, "can\'t get environment variable HOME\n");
X    home = XtNewString("/");
X  } else 
X    home = XtNewString(home);
X#endif
X
X  result = (String*) XtMalloc ((count_chr(s, ':')+1) * sizeof(String));
X  s = XtNewString(s);
X
X  /* extract the directories from path 's' */
X
X  p = strtok(s, ":");
X  while ( p != NULL) {
X    if (*p == '/')
X      result[(*n)++] = p;
X    else 
X      if (*p == '~' && *(p+1) == '/') {
X	tmp = (String) XtMalloc ((strlen(home) + strlen(p)) * sizeof(char));
X	strcpy(tmp, home);
X	strcat(tmp, p+1);
X	result[(*n)++] = tmp;
X      } else 
X	fprintf(stderr, "Warning: Directory \'%s\' not fully qualified,"
X		" ignoring.\n", p);
X    p = strtok(NULL, ":");
X  }
X#ifdef DEBUG_YACC
X  XtFree(home);
X#endif
X  return(result);
X}
X
Xprivate iconPrefs *inserticonpref(iconPrefs *head, iconPrefs *item)
X{
X  /* Insert item into list starting with head, insert into the last 
X   * position before the default.
X   */
X
X  iconPrefs *sec = NULL, *tmp = head;
X
X  if (head == NULL) {
X    /* first element */
X    head=item;
X    head->next=NULL;
X  } else {
X    while (tmp->next != NULL) {
X      sec = tmp;
X      tmp = tmp->next;
X    }
X    if (tmp->expbuf == NULL) {
X      /* Already got a default */
X      if (item->expbuf != NULL) {
X	/* Item is not a new default */
X	item->next = tmp;
X	if (sec != NULL)
X	  sec->next = item;
X	else 
X	  head = item;
X      } else 
X	XtFree(item);
X    } else {
X      /* No default */
X      tmp->next = item;
X      item->next = NULL;
X    }
X  }
X  return(head);
X}
X
Xprivate iconPrefs *getlast(iconPrefs *head)
X{
X  /* return the last non-default iconpref in the frame */
X  iconPrefs *tmp = head;
X  
X  if (tmp != NULL)
X    while (tmp->next != NULL || tmp->next->expbuf == NULL) 
X      tmp = tmp->next;
X
X  return(tmp);
X}
X
Xprivate String strip_quotes(String s)
X{
X  String new;
X  
X  *(s + (strlen(s)-1)) = '\0';
X  s=s+1;
X  new = XtNewString(s);
X
X  return(new);
X}
X
Xprivate void set_path(String s)
X{
X  Cardinal n;
X
X  varframe->defpath = stringtopath(s, &n);
X  varframe->dirinpath = n;
X}
X
Xprivate void set_icon(String s, Boolean ignore)
X{
X  /* varframe->iconpref points to the iconpref into which this
X   * icon should be inserted. If it is NULL, then create a new
X   * one at varframe->current->iconprefs.
X   */
X
X  typePrefs *frame = varframe->current;
X  iconPrefs *iconpref = varframe->iconpref, 
X            *head = frame->iconprefs,
X            *new =  NULL;
X
X  if (iconpref == NULL) {
X    new = (iconPrefs*) XtMalloc (sizeof(iconPrefs));
X    new->expbuf = NULL;  /* default icon */
X    new->extra = NULL;
X    if (ignore==True) {
X      new->icon = DUMMY;
X    } else {
X      new->icon = lookupicon(s);
X    }
X    new->next = NULL;
X    frame->iconprefs = inserticonpref(head, new);
X  } else 
X    if (ignore==True)
X      iconpref->icon = DUMMY;
X    else
X      iconpref->icon = lookupicon(s);
X
X}
X
Xprivate void set_deficon(String s)
X{
X  typePrefs *frame = varframe->current;
X  iconPrefs *iconpref, *head = frame->iconprefs;
X
X  iconpref = (iconPrefs*) XtMalloc (sizeof(iconPrefs));
X  iconpref->expbuf = NULL;  /* default icon */
X  iconpref->extra = NULL;
X  iconpref->icon = lookupicon(s);
X  iconpref->next = NULL;
X  frame->iconprefs = inserticonpref(head, iconpref);
X
X}
X
Xprivate Pixmap lookupicon(String icon)
X{
X  /* Return the pixmap associated with the name 'icon' if none 
X   * found NULL is returned.
X   */
X  typePrefs *frame = varframe->current;
X  String *path = varframe->defpath;
X  Cardinal pathsize = varframe->dirinpath;
X  Cardinal n;
X  iconTree *item;
X  Pixmap pixmap = NULL;
X  String fullname = NULL;
X  String tmp;
X  FILE *result;
X
X  /* Append 'icon' to each filename in current path, and check to see 
X   * whether that file exists.
X   */
X  
X  n = 0;
X  do {
X    tmp = (String) XtMalloc ((strlen(icon) + strlen(path[n]) +1) * sizeof(char));
X    tmp = strcpy(tmp, path[n]);
X    tmp = strcat(tmp, "/");
X    tmp = strcat(tmp, icon);
X    if ((result = fopen(tmp, "r")) != NULL) {
X      fullname = XtNewString(tmp);
X      fclose(result);
X    } 
X    XtFree(tmp);
X  } while (++n < pathsize && fullname == NULL);
X
X  if (fullname == NULL) 
X    fprintf(stderr, "Warning: could not find icon %s\n", icon);
X  else {
X    item = (iconTree*) XtMalloc (sizeof(iconTree));
X    item->fullname = fullname;
X    item->icon = NULL;
X    icontable = get_pixmap(item, icontable);
X    pixmap = item->icon;
X  }
X  return(pixmap);
X}
X
X
Xprivate iconTree *get_pixmap(iconTree *item, iconTree *tree)
X{
X  /* If the item is found in the tree, then item's contents are filled 
X   * with that items, otherwise the Pixmap is created and the item is 
X   * inserted into the tree.
X   */
X
X  int cmp, value;
X  unsigned int width, height;
X  int x_hot, y_hot;
X
X  if (tree == NULL) {
X    /* At a leaf, insert item */
X#ifndef DEBUG_YACC
X    value = XReadBitmapFile(XtDisplay(topLevel), 
X			    RootWindowOfScreen(XtScreen(topLevel)),
X			    item->fullname,
X			    &width, &height,
X			    &item->icon,
X			    &x_hot, &y_hot);
X    if (value == BitmapFileInvalid)
X      fprintf(stderr, "Filename \'%s\' contains invalid bitmap data\n", 
X	      item->fullname);
X    else if (value == BitmapOpenFailed)
X      fprintf(stderr, "Filename \'%s\' could not be opened\n", 
X	      item->fullname);
X    else if (value == BitmapNoMemory)
X      fprintf(stderr, "Not enough memory to allocate pixmap\n");
X#else
X    item->icon = (Pixmap) DUMMY;
X    printf("DEBUG: Loaded bitmap for %s\n", item->fullname);
X#endif
X    item->left = NULL;
X    item->right = NULL;
X    tree = item;
X  } else {
X    if ((cmp = strcmp(tree->fullname, item->fullname)) == 0) {
X      /* Found it !!! */
X      item->icon = tree->icon;
X    } else 
X      if (cmp < 0)
X	tree->left = get_pixmap(item, tree->left);
X      else 
X	tree->right = get_pixmap(item, tree->right);
X  }
X  return(tree);
X}
X
Xprivate void newselection(String selection)
X{
X  /* increment selectionindex, put selection string into next 
X   * appselection, (if less than MAXSELS)
X   */
X  
X  if (++selectionindex == MAXSELS) {
X    fprintf(stderr, "Application Selection Overflow, only %d selections allowed",
X	    MAXSELS);
X    exit(2);
X  }
X
X#ifdef DEBUG_YACC
X  printf("DEBUG: New selection %s\n", selection);
X#endif
X  
X  listindex = 0;
X  current_selection = appselections[selectionindex] =
X    (AppSelection*) XtMalloc (sizeof(AppSelection));
X  current_selection->name = XtNewString(selection);
X  current_selection->number = listindex;
X  current_selection->list = (AppProgram**) XtMalloc (sizeof(AppProgram*) * APPPSIZE);
X  currentlistmax = APPPSIZE;
X}
X
Xprivate void setapp(int type, String argument)
X{
X  /* Insert program data into current AppProgram, then extend
X   * the AppProgram array.
X   */
X  AppProgram **proglist = current_selection->list;
X  AppProgram *node = proglist[listindex];
X  
X  switch(type) {
X  case NAME_T:
X    node->string = XtNewString(argument);
X#ifdef DEBUG_YACC
X    printf("String: %s\n", argument);
X#endif
X    break;
X  case ICON_T:
X    node->icon = lookupicon(argument);
X    break;
X  case PROG_T:
X    node->program = XtNewString(argument);
X#ifdef DEBUG_YACC
X    printf("Program: %s\n", argument);
X#endif
X    break;
X  case OPTIONS_T:
X    switch((int)argument) {
X    case MSEL_T:
X      node->options = M_SEL;
X#ifdef DEBUG_YACC
X      printf("MSEL\n");
X#endif
X      break;
X    case OSEL_T:
X      node->options = O_SEL;
X#ifdef DEBUG_YACC
X      printf("OSEL\n");
X#endif      
X      break;
X    case NSEL_T:
X      node->options = N_SEL;
X#ifdef DEBUG_YACC
X      printf("NSEL\n");
X#endif
X      break;
X    default:
X      fprintf(stderr, "Programmer Error: Bad argument to setapp.\n");
X      break;
X    }
X    break;
X  default:
X    fprintf(stderr, "Programmer Error: Bad argument to setapp.\n");
X    break;
X  }
X}
X
X#ifdef DEBUG_YACC
Xmain()
X{
X  yyparse();
X  return(0);
X}
X#endif
X
X
X
X
SHAR_EOF
echo "File code/parser.y is complete"
chmod 0644 code/parser.y || echo "restore of code/parser.y fails"
echo "x - extracting code/patchlevel.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/patchlevel.h &&
X#define PATCHLEVEL 0
SHAR_EOF
chmod 0644 code/patchlevel.h || echo "restore of code/patchlevel.h fails"
echo "x - extracting code/quit.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/quit.c &&
X/***********************************************************************************
X ** File          : quit.c                                                        **
X ** Purpose       : Initialise and Realise quit dialogs                           **
X ** Author        : Edward Groenendaal                                            **
X ** Date          : April 1991                                                    **
X ** Documentation : Xdtm Design Folder                                            **
X ** Related Files :                                                               **
X ***********************************************************************************/
X
X#include "xdtm.h"
X#include <X11/Shell.h>
X#include <X11/Xaw/Label.h>
X#include <X11/Xaw/Command.h>
X#include "Xedw/XedwForm.h"
X
Xextern void realize_dialog(Widget);
X
X/* Widgets */
Xprivate Widget quitpopup;	/* For Quit Message */
Xprivate Widget quitform;        /* The form */
Xprivate Widget quitlabel;  	/* Label at top of dialog */
Xprivate Widget quitquit;       	/* yes button */
Xprivate Widget quitcancel;    	/* no button */ 
X
Xpublic void init_quit(Widget top)
X{
X  extern void quitQueryResult(Widget, Boolean, caddr_t);
X
X  Arg arglist[5];
X  Cardinal i;
X
X  private String QuitLabel          = "Really quit?";
X  private String QuitButtonLabel    = "Quit";
X  private String CancelButtonLabel  = "Cancel";
X
X  quitpopup    =   XtCreatePopupShell("quitpopup",
X				      transientShellWidgetClass,
X				      top,
X				      NULL, 0);
X
X  quitform      =   XtCreateManagedWidget("quitform",
X				      xedwFormWidgetClass,
X				      quitpopup,
X				      NULL, 0);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNlabel,         QuitLabel);  i++;
X  XtSetArg(arglist[i], XtNborderWidth,           0);  i++;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter);  i++;
X  XtSetArg(arglist[i], XtNfullWidth,          True);  i++;
X  quitlabel    =   XtCreateManagedWidget("quitlabel",
X					  labelWidgetClass,
X					  quitform,
X					  arglist, i);
X
X  i = 0;
X  XtSetArg(arglist[i], XtNlabel, CancelButtonLabel);  i++;
X  XtSetArg(arglist[i], XtNfromVert,      quitlabel);  i++;
X  XtSetArg(arglist[i], XtNjustify, XtJustifyCenter);  i++;
X  quitcancel  =   XtCreateManagedWidget("quitcancel",
X					commandWidgetClass,
X					quitform,
X					arglist, i);
X
X  i = 1;
X  XtSetArg(arglist[i], XtNlabel,   QuitButtonLabel);  i++;
X  XtSetArg(arglist[i], XtNfromVert,     quitlabel);  i++;
X  XtSetArg(arglist[i], XtNwidthLinked, quitcancel);  i++;
X  XtSetArg(arglist[i], XtNfromHoriz,   quitcancel);  i++;
X  quitquit    =   XtCreateManagedWidget("quitquit",
X					commandWidgetClass,
X					quitform,
X					arglist, i);
X
X  XtAddCallback(quitcancel, XtNcallback, quitQueryResult, False);
X  XtAddCallback(quitquit,   XtNcallback, quitQueryResult, True);
X 
X}
X
X
Xpublic void quit_dialog(void)
X{
X  realize_dialog(quitpopup);
X}
X
Xpublic void destroy_quit_dialog(void)
X{
X  XtPopdown(quitpopup);
X}
SHAR_EOF
chmod 0644 code/quit.c || echo "restore of code/quit.c fails"
echo "x - extracting code/scroll_hack.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/scroll_hack.c &&
X/*****************************************************************************
X ** File          : scroll_hack.c                                           **
X ** Purpose       : Reset the scrollbar in a viewport widget to the top     **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : 25th Feb 1990                                           **
X ** Documentation : Xdtm Design Folder                                      **
X ** Related Files :                                                         **
X *****************************************************************************/
X
X#include "xdtm.h"
X#include <X11/IntrinsicP.h>
X#include <X11/StringDefs.h>
X#include <X11/Xaw/XawInit.h>
X#include <X11/Xaw/Viewport.h>
X#include <X11/Xaw/ViewportP.h>
X#include <X11/Xaw/Scrollbar.h>
X#include <X11/Xaw/ScrollbarP.h>
X
X
Xpublic void setscroll(Widget w, float pos)
X{
X  ViewportWidget  vw = (ViewportWidget) w;
X  ScrollbarWidget sw = (ScrollbarWidget) vw->viewport.vert_bar;
X  Arg arglist[1];
X
X
X  XtSetArg(arglist[0], XtNtopOfThumb, pos);
X  XtSetValues(sw, arglist, 1);
X  XtCallCallbacks(sw, XtNthumbProc, sw->scrollbar.top);
X  XtCallCallbacks(sw, XtNjumpProc, &sw->scrollbar.top);
X
X}
SHAR_EOF
chmod 0644 code/scroll_hack.c || echo "restore of code/scroll_hack.c fails"
echo "x - extracting code/strstr.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/strstr.c &&
X/*****************************************************************************
X ** File          : strstr.c                                                **
X ** Purpose       : Return pointer to first occurence of second string in   **
X **                 first string, else NULL                                 **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : 11th April 1991                                         **
X ** Documentation : Xdtm Design Folder                                      **
X ** Related Files : appman.c                                                **
X *****************************************************************************/
X
X#ifdef SYSV
X
X#include <stdio.h>  /* For NULL */
X
Xchar *strstr(char *cs, char *ct)
X{
X  char *csi, *cti, *result;
X  
X  result = NULL;
X  cti = ct;
X  csi = cs;
X  
X  /* search for first letter, on finding it set result to that point */
X
X  while (*csi != '\0' && *cti != '\0') {
X    if (result == NULL) {
X      /* searching for start of substring */
X      if (*csi == *cti) {
X	result = csi;
X	cti++;
X      }
X    } else 
X      /* trying to match rest */
X      if (*csi == *cti) 
X	cti++;
X      else {
X	cti = ct;
X	csi = result;
X	result = NULL;
X      }
X    csi++;
X  }
X
X  if (*cti == '\0')
X    return(result);
X  else 
X    return((char*) NULL);
X}
X
X#endif
SHAR_EOF
chmod 0644 code/strstr.c || echo "restore of code/strstr.c fails"
echo "x - extracting code/xdtm.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/xdtm.h &&
X/*****************************************************************************
X ** File          : xdtm.h                                                  **
X ** Purpose       :                                                         **
X ** Author        : Edward Groenendaal                                      **
X ** Date          : 18th Feb 1991                                           **
X ** Documentation : Xdtm Design Folder                                      **
X ** Related Files : menus.c                                                 **
X *****************************************************************************/
X
X#ifndef _xdtm_h
X#define _xdtm_h
X
X#define RELEASE       1
X#define SYSTEM_HELP   "/usr/lib/X11/xdtm/help"
X#define SYSTEM_XDTMRC "/usr/lib/X11/xdtm/xdtmrc"
X#define MAXSELS 10
X#define MAXARGS 20
X#define DUMMY ~NULL
X
X#include "patchlevel.h"
X
X/* UNIX include files */
X#include <stdio.h>
X#include <errno.h>
X#include <string.h>
X
X/* Standard X11 include files */
X#include <X11/Intrinsic.h>
X#include <X11/StringDefs.h>
X
X#define private     	static
X#define public      	/* global */
X
Xextern Arg chain_position[];
Xextern Cardinal chain_size;
X
Xtypedef enum {NormalMode, CopyMode, MoveMode} Mode;
X
Xtypedef struct {
X  int view_width;
X  int view_height;
X  XFontStruct *view_font;
X  String mode;
X  XFontStruct *dm_font;
X} AppData, *AppDataPtr;
X
X/* Application Resources */
X
X#define XtNviewWidth "viewWidth"
X#define XtNviewHeight "viewHeight"
X#define XtNviewFont "viewFont"
X#define XtNmode "mode"
X#define XtNdmFont "dmFont"
X
X#define XtCViewWidth "ViewWidth"
X#define XtCViewHeight "ViewHeight"
X#define XtCMode "Mode"
X
X#endif /* _xdtm_h */
SHAR_EOF
chmod 0644 code/xdtm.h || echo "restore of code/xdtm.h fails"
echo "x - extracting code/README (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/README &&
XX Desktop Manager README
X========================
X
XThis is release 1 of the X desktop manager. It was written for my final
Xyear project, and as usual in such things left to the last minute 
Xwhich explains why there are a couple of areas in which the program 
Xcould have been better, namely support for colour displays, full 
Xhelp facilities.
X
XWhat is the X Desktop Manager?
X------------------------------
X
XX Desktop Manager (xdtm) is a graphical shell for UNIX and the X Window
XSystem. It supports the following features:
X
X1)  Graphical representation of files and directories as 
X	i)   icons.
X	ii)  filenames.
X	iii) long listing (ls -l style).
X 
X2)  Allow files to be selected by matching a regular expression to their
X    file names.
X
X3)  Allow a program to be mapped over the selected files.
X
X4)  Allow the user (via a setup file) to define the icons to be given 
X    filenames matching a particular regular expression.
X
X5)  Allow files or directories to be deleted, moved, and copied to
X    other directories.
X
X6)  Allow predifined programs to be executed (with optional parameters
X    of the selected files) when it's associated icon is double clicked.
X
X7)  A comprehensive set of predefined icons. 
X
X8) Probably loads more things..
X
XSee the file help for more details.
X
XWhat's it for?
X--------------
X
XXdtm is designed to simplify and thus speed of the process of file management,
Xtext editing, and program development.
X
XFor example.
X
XIn the example xdtm setup file (xdtmrc) is my setup which includes the following
Xaids in the 'programming' selection, 
X
XMake All    - recompile program in current directory (via Makefile)
XMake Clean  
XMake Tags
XEmacs       - Start the Emacs editor with any selected files as argument.
X
XI would click on the file I wish to edit (Or double click if I only wish
Xto view it) then double click on the Emacs icon, which would start emacs
Xwith that file preloaded, I could then edit that file, and double click 
Xon Make All to recompile the program, at which point the binary will show
Xup in the directory, and it may be executed by double clicking on it.
X
XThe best way to find out how it works is to play with the program and to
Xlook at the setup file. I hope to produce proper full documentation in 
Xthe next week, (ending 26th April 1991) if you wish to receive a copy
Xof this (in Macintosh Word 4 Format only I'm afraid!) email me a message 
Xsome time after that, but before July, 'cos that's when I leave!!
X
X(I will probably do a manual page as well)
X
XWhat does it work on?
X---------------------
X
XThe program is designed to work on monochrome systems BUT does also work 
Xon colour systems except that the highlighting is slightly buggered.
X
XIt uses <regexp.h> for doing regular expression matching, this file
Xis only included on SYSV machines and hybreds.
XIt may be possible on a network to use this file copied from a SYSV
Xmachine but is probably very naughty!
X
XIt is written in ANSI C and should be compiled using the Gnu C compiler
X
XIt has been tested and works on the following systems:
X
XMachine       	OS     		Display   	X Version
X
XMacintosh IIcx	A/UX 2.01  	Monochrome	MacX and X11R4
XSun 3/60	SunOS 4.1.1	Colour		X11R4 (highlighting broken)
XSun 3/50	SunOs 4.1.1	Monochrome	X11R4
XHP9000/370	HP-UX 7.0	Monochrome	X11R4
XHP9000/370 	HP-UX 7.0	Colour		X11R4 (highlighting broken)
X
XIf you manage to get it working on any other system (before July) please
Xemail me.
X
XHow to compile it
X-----------------
X
X1) unshar archives
X2) cd code
X3) edit Imakefile and xdtm.h for your site
X4) xmkmf
X5) make
X6) copy 'xdtmrc' to your system xdtm directory
X7) copy 'help'   to your system xdtm directory 
X
XBugs
X----
X
Xplease mail any bug reports - patches - wishes to me 
Xpreferably BEFORE 26th of April (deadline).
X
XEdward Groenendaal.
X
XUniversity of Sussex,
XBrighton,
XEngland.
X
XEmail: eddyg@cogs.sussex.ac.uk
SHAR_EOF
chmod 0644 code/README || echo "restore of code/README fails"
echo "x - extracting code/Imakefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Imakefile &&
X              CC = gcc
X            SRCS = main.c menus.c appman.c dirman.c \
X                   fileman.c parse.c info.c \
X		   Xedw/XedwList.c Xedw/XedwForm.c lexical.l parser.y \
X		   dialogs.c scroll_hack.c strstr.c buttons.c \
X		   display.c listoption.c map.c newfile.c \
X		   quit.c 
X            OBJS = main.o menus.o appman.o dirman.o \
X                   fileman.o parse.o parser.o lexical.o \
X	 	   dialogs.o scroll_hack.o strstr.o buttons.o \
X		   display.o listoption.o map.o newfile.o \
X		   quit.o info.o
X          LDLIBS = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) -ll -ly
XEXTRA_LOAD_FLAGS = -LXedw  -L/usr/local/X11R4/lib
X		DEFINES = -I/usr/local/lib/gcc-include
X          CFLAGS = StandardDefines -I/usr/local/X11R4/include -I/usr/local/lib/gcc-include
X          YFLAGS = -d 
X
X#define PassCDebugFlags 'CFLAGS=$(CFLAGS)' 
X
XAllTarget(xdtm)
X
XNormalProgramTarget(lexical, lexical.c,,-ll,-DDEBUG_LEX $(CFLAGS))
X
XNormalProgramTarget(parser, lexical.c parser.c,,-ll -ly,-DDEBUG_YACC $(CFLAGS))
X
XNormalProgramTarget(xdtm, $(OBJS), Xedw, -lXedw,)
X
XNamedMakeSubdirs(Xedw, Xedw)
X
XDependTarget()
X
Xetags:
X	etags -t *.h $(SRCS)  
X
Xclean::
X	$(RM) lexical.c parser.c parser.h
X	@(cd Xedw; echo "Making clean in ./Xedw"; \
X	$(MAKE) clean;)
X
Xparser.h parser.c: parser.y         
X	$(YACC) $(YFLAGS) parser.y      
X	$(MV) y.tab.c parser.c          
X	$(MV) y.tab.h parser.h      
X
Xlexical.o: parser.h
X
SHAR_EOF
chmod 0644 code/Imakefile || echo "restore of code/Imakefile fails"
echo "x - extracting code/Makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Makefile &&
X# Makefile generated by imake - do not edit!
X# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $
X#
X# The cpp used on this machine replaces all newlines and multiple tabs and
X# spaces in a macro expansion with a single space.  Imake tries to compensate
X# for this, but is not always successful.
X#
X
X###########################################################################
X# Makefile generated from "Imake.tmpl" and <Imakefile>
X# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $
X#
X# Platform-specific parameters may be set in the appropriate .cf
X# configuration files.  Site-wide parameters may be set in the file
X# site.def.  Full rebuilds are recommended if any parameters are changed.
X#
X# If your C preprocessor doesn't define any unique symbols, you'll need
X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
X# "make Makefile", "make Makefiles", or "make World").
X#
X# If you absolutely can't get imake to work, you'll need to set the
X# variables at the top of each Makefile as well as the dependencies at the
X# bottom (makedepend will do this automatically).
X#
X
X###########################################################################
X# platform-specific configuration parameters - edit sun.cf to change
X
X# platform:  $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $
X# operating system:  SunOS 4.1
X
X###########################################################################
X# site-specific configuration parameters - edit site.def to change
X
X# site:  $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $
X
X            SHELL = /bin/sh
X
X              TOP = .
X      CURRENT_DIR = .
X
X               AR = ar cq
X  BOOTSTRAPCFLAGS =
X               CC = cc
X
X         COMPRESS = compress
X              CPP = /lib/cpp $(STD_CPP_DEFINES)
X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
X          INSTALL = install
X               LD = ld
X             LINT = lint
X      LINTLIBFLAG = -C
X         LINTOPTS = -axz
X               LN = ln -s
X             MAKE = make
X               MV = mv
X               CP = cp
X           RANLIB = ranlib
X  RANLIBINSTFLAGS =
X               RM = rm -f
X     STD_INCLUDES =
X  STD_CPP_DEFINES =
X      STD_DEFINES =
X EXTRA_LOAD_FLAGS =
X  EXTRA_LIBRARIES =
X             TAGS = ctags
X
X    SHAREDCODEDEF = -DSHAREDCODE
X         SHLIBDEF = -DSUNSHLIB
X
X    PROTO_DEFINES =
X
X     INSTPGMFLAGS =
X
X     INSTBINFLAGS = -m 0755
X     INSTUIDFLAGS = -m 4755
X     INSTLIBFLAGS = -m 0664
X     INSTINCFLAGS = -m 0444
X     INSTMANFLAGS = -m 0444
X     INSTDATFLAGS = -m 0444
X    INSTKMEMFLAGS = -m 4755
X
X          DESTDIR = /usr/local/X11R4
X
X     TOP_INCLUDES = -I$(INCROOT)
X
X      CDEBUGFLAGS = -O
X        CCOPTIONS = -fswitch
X      COMPATFLAGS =
X
X      ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES)
X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS)
X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)
X   LDCOMBINEFLAGS = -X -r
X
X        MACROFILE = sun.cf
X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
X
X    IMAKE_DEFINES =
X
X         IRULESRC = $(CONFIGDIR)
X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
X
X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
X			$(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
X			$(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
X
X###########################################################################
X# X Window System Build Parameters
X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X###########################################################################
X# X Window System make variables; this need to be coordinated with rules
X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X          PATHSEP = /
X        USRLIBDIR = $(DESTDIR)/lib
X           BINDIR = $(DESTDIR)/bin/X11
X          INCROOT = $(DESTDIR)/include
X     BUILDINCROOT = $(TOP)
X      BUILDINCDIR = $(BUILDINCROOT)/X11
X      BUILDINCTOP = ..
X           INCDIR = $(INCROOT)/X11
X           ADMDIR = $(DESTDIR)/adm
X           LIBDIR = $(USRLIBDIR)/X11
X        CONFIGDIR = $(LIBDIR)/config
X       LINTLIBDIR = $(USRLIBDIR)/lint
X
X          FONTDIR = $(LIBDIR)/fonts
X         XINITDIR = $(LIBDIR)/xinit
X           XDMDIR = $(LIBDIR)/xdm
X           AWMDIR = $(LIBDIR)/awm
X           TWMDIR = $(LIBDIR)/twm
X           GWMDIR = $(LIBDIR)/gwm
X          MANPATH = $(DESTDIR)/man
X    MANSOURCEPATH = $(MANPATH)/man
X           MANDIR = $(MANSOURCEPATH)1
X        LIBMANDIR = $(MANSOURCEPATH)3
X      XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X        SOXLIBREV = 4.2
X          SOXTREV = 4.0
X         SOXAWREV = 4.0
X        SOOLDXREV = 4.0
X         SOXMUREV = 4.0
X        SOXEXTREV = 4.0
X
X       FONTCFLAGS = -t
X
X     INSTAPPFLAGS = $(INSTDATFLAGS)
X
X            IMAKE = imake
X           DEPEND = makedepend
X              RGB = rgb
X            FONTC = bdftosnf
X        MKFONTDIR = mkfontdir
X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh
X
X        CONFIGSRC = $(TOP)/config
X        CLIENTSRC = $(TOP)/clients
X          DEMOSRC = $(TOP)/demos
X           LIBSRC = $(TOP)/lib
X          FONTSRC = $(TOP)/fonts
X       INCLUDESRC = $(TOP)/X11
X        SERVERSRC = $(TOP)/server
X          UTILSRC = $(TOP)/util
X        SCRIPTSRC = $(UTILSRC)/scripts
X       EXAMPLESRC = $(TOP)/examples
X       CONTRIBSRC = $(TOP)/../contrib
X           DOCSRC = $(TOP)/doc
X           RGBSRC = $(TOP)/rgb
X        DEPENDSRC = $(UTILSRC)/makedepend
X         IMAKESRC = $(CONFIGSRC)
X         XAUTHSRC = $(LIBSRC)/Xau
X          XLIBSRC = $(LIBSRC)/X
X           XMUSRC = $(LIBSRC)/Xmu
X       TOOLKITSRC = $(LIBSRC)/Xt
X       AWIDGETSRC = $(LIBSRC)/Xaw
X       OLDXLIBSRC = $(LIBSRC)/oldX
X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
X     MKFONTDIRSRC = $(FONTSRC)/mkfontdir
X     EXTENSIONSRC = $(TOP)/extensions
X
X  DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a
X     EXTENSIONLIB =  -lXext
X
X          DEPXLIB = $(DEPEXTENSIONLIB)
X             XLIB = $(EXTENSIONLIB) -lX11
X
X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
X         XAUTHLIB =  -lXau
X
X        DEPXMULIB =
X           XMULIB = -lXmu
X
X       DEPOLDXLIB =
X          OLDXLIB = -loldX
X
X      DEPXTOOLLIB =
X         XTOOLLIB = -lXt
X
X        DEPXAWLIB =
X           XAWLIB = -lXaw
X
X LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln
X         LINTXLIB = $(USRLIBDIR)/llib-lX11.ln
X          LINTXMU = $(USRLIBDIR)/llib-lXmu.ln
X        LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln
X          LINTXAW = $(USRLIBDIR)/llib-lXaw.ln
X
X        XWLIBSRC = $(CONTRIBSRC)/toolkits/Xw
X        DEPXWLIB = $(USRLIBDIR)/libXw.a
X        XWLIB =  -lXw
X
X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
X
X         DEPLIBS1 = $(DEPLIBS)
X         DEPLIBS2 = $(DEPLIBS)
X         DEPLIBS3 = $(DEPLIBS)
X
X###########################################################################
X# Imake rules for building libraries, programs, scripts, and data files
X# rules:  $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $
X
X###########################################################################
X# start of Imakefile
X
X              CC = gcc
X            SRCS = main.c menus.c appman.c dirman.c \
X                   fileman.c parse.c info.c \
X		   Xedw/XedwList.c Xedw/XedwForm.c lexical.l parser.y \
X		   dialogs.c scroll_hack.c strstr.c buttons.c \
X		   display.c listoption.c map.c newfile.c \
X		   quit.c
X            OBJS = main.o menus.o appman.o dirman.o \
X                   fileman.o parse.o parser.o lexical.o \
X	 	   dialogs.o scroll_hack.o strstr.o buttons.o \
X		   display.o listoption.o map.o newfile.o \
X		   quit.o info.o
X          LDLIBS = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) -ll -ly
XEXTRA_LOAD_FLAGS = -LXedw  -L/usr/local/X11R4/lib
X		DEFINES = -I/usr/local/lib/gcc-include
X          CFLAGS =  -g  -I/usr/local/X11R4/include -I/usr/local/lib/gcc-include
X          YFLAGS = -d
X
Xall:: xdtm
X
Xlexical:  lexical.c
X	$(RM) $@
X	$(CC) -o $@  lexical.c $(LDOPTIONS) -ll $(LDLIBS) -DDEBUG_LEX $(CFLAGS) $(EXTRA_LOAD_FLAGS)
X
Xclean::
X	$(RM) lexical
X
Xparser:  lexical.c parser.c
X	$(RM) $@
X	$(CC) -o $@  lexical.c parser.c $(LDOPTIONS) -ll -ly $(LDLIBS) -DDEBUG_YACC $(CFLAGS) $(EXTRA_LOAD_FLAGS)
X
Xclean::
X	$(RM) parser
X
Xxdtm:  $(OBJS)  Xedw
X	$(RM) $@
X	$(CC) -o $@  $(OBJS) $(LDOPTIONS)  -lXedw $(LDLIBS)  $(EXTRA_LOAD_FLAGS)
X
Xclean::
X	$(RM) xdtm
X
XXedw::
X	@case '${MFLAGS}' in *[ik]*) set +e;; esac; \
X	for i in  Xedw ;\
X	do \
X	(cd $$i ; echo "making" Xedw "in $(CURRENT_DIR)/$$i..."; \
X	$(MAKE) $(MFLAGS) 'CFLAGS=$(CFLAGS)' all); \
X	done
X
Xdepend::
X	$(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
X
Xetags:
X	etags -t *.h $(SRCS)
X
Xclean::
X	$(RM) lexical.c parser.c parser.h
X	@(cd Xedw; echo "Making clean in ./Xedw"; \
X	$(MAKE) clean;)
X
Xparser.h parser.c: parser.y
X	$(YACC) $(YFLAGS) parser.y
X	$(MV) y.tab.c parser.c
X	$(MV) y.tab.h parser.h
X
Xlexical.o: parser.h
X
X###########################################################################
X# common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X	$(RM_CMD) \#*
X
XMakefile::
X	-@if [ -f Makefile ]; then \
X	echo "	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X	else exit 0; fi
X	$(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
X
Xtags::
X	$(TAGS) -w *.[ch]
X	$(TAGS) -xw *.[ch] > TAGS
X
X###########################################################################
X# empty rules for directories that do not have SUBDIRS - do not edit
X
Xinstall::
X	@echo "install in $(CURRENT_DIR) done"
X
Xinstall.man::
X	@echo "install.man in $(CURRENT_DIR) done"
X
XMakefiles::
X
Xincludes::
X
X###########################################################################
X# dependencies generated by makedepend
X
SHAR_EOF
chmod 0644 code/Makefile || echo "restore of code/Makefile fails"
echo "x - extracting code/help (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/help &&
XThis is the X Desktop Manager Help file.
X
X<None as yet, email eddyg@cogs.sussex.ac.uk for the finished version
X of this file after the 26th April 1991>
X
SHAR_EOF
chmod 0644 code/help || echo "restore of code/help fails"
echo "x - extracting code/Xdtm (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xdtm &&
X! menus
X*font: helvB14
X*pathManager*cursor: left_ptr
X*menuBar*cursor: left_ptr
X*buttonForm*cursor: left_ptr
X*listoptionsettings.font: courB12
XXdtm.mode: icons
XXdtm.viewHeight: 30
SHAR_EOF
chmod 0644 code/Xdtm || echo "restore of code/Xdtm fails"
echo "x - extracting icons/eddy/ccode.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/ccode.icon &&
X#define ccode_width 32
X#define ccode_height 32
Xstatic char ccode_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x10, 0xe0, 0x41, 0x01,
X   0x10, 0xf8, 0x43, 0x02, 0x10, 0x3c, 0x47, 0x04, 0x10, 0x1c, 0xc6, 0x0f,
X   0x10, 0x1e, 0x00, 0x08, 0x10, 0x0e, 0x00, 0x08, 0x10, 0x0e, 0x00, 0x08,
X   0x10, 0x0e, 0x00, 0x08, 0x10, 0x0e, 0x00, 0x08, 0x10, 0x1e, 0x00, 0x08,
X   0x10, 0x1c, 0x06, 0x08, 0x10, 0x3c, 0x07, 0x08, 0x10, 0xf8, 0x03, 0x08,
X   0xd0, 0xe0, 0x01, 0x08, 0x10, 0x00, 0x00, 0x08, 0x90, 0x05, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x90, 0xdf, 0x0a, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0xb7, 0x03, 0x08, 0x10, 0x00, 0x00, 0x08, 0x90, 0xbd, 0xb7, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x6c, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x90, 0xdd, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0xd0, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/eddy/ccode.icon || echo "restore of icons/eddy/ccode.icon fails"
echo "x - extracting icons/eddy/core.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/core.icon &&
X#define core_width 32
X#define core_height 32
Xstatic char core_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x10, 0x00, 0x40, 0x01,
X   0x10, 0x00, 0x40, 0x02, 0x10, 0x10, 0x40, 0x04, 0x10, 0x30, 0xc2, 0x0f,
X   0x10, 0x50, 0x03, 0x08, 0x10, 0xb7, 0x02, 0x08, 0x10, 0x9a, 0x02, 0x08,
X   0x10, 0x44, 0x7a, 0x08, 0x10, 0x68, 0x46, 0x08, 0x10, 0x50, 0x21, 0x08,
X   0x10, 0x08, 0x16, 0x08, 0x10, 0xb4, 0x09, 0x08, 0x10, 0x2c, 0x04, 0x08,
X   0x10, 0x90, 0x08, 0x08, 0x10, 0x50, 0x09, 0x08, 0x10, 0x28, 0x16, 0x08,
X   0x10, 0x18, 0x38, 0x08, 0x10, 0x08, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x53, 0x5d, 0x09,
X   0x90, 0x54, 0x49, 0x09, 0x10, 0x71, 0x49, 0x09, 0x10, 0x52, 0x49, 0x09,
X   0x90, 0x54, 0x09, 0x08, 0x10, 0x53, 0x49, 0x09, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/eddy/core.icon || echo "restore of icons/eddy/core.icon fails"
echo "x - extracting icons/eddy/dotdot.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/dotdot.icon &&
X#define dotdot_width 32
X#define dotdot_height 32
Xstatic char dotdot_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x02, 0x08,
X   0xfe, 0xff, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0x02, 0x80, 0x00, 0x40, 0x02, 0xc0, 0x01, 0x40, 0x02, 0xe0, 0x03, 0x40,
X   0x02, 0xf0, 0x07, 0x40, 0x02, 0xf8, 0x0f, 0x40, 0x02, 0xfc, 0x1f, 0x40,
X   0x02, 0xc0, 0x01, 0x40, 0x02, 0xc0, 0x01, 0x40, 0x02, 0xc0, 0x01, 0x40,
X   0x02, 0xc0, 0x01, 0x40, 0x02, 0xc0, 0x01, 0x40, 0x02, 0xc0, 0x01, 0x40,
X   0x02, 0xc0, 0x01, 0x40, 0x02, 0xc0, 0x01, 0x40, 0x02, 0xc0, 0x01, 0x40,
X   0x02, 0xc0, 0x01, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/eddy/dotdot.icon || echo "restore of icons/eddy/dotdot.icon fails"
echo "x - extracting icons/eddy/elisp.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/elisp.icon &&
X#define elisp_width 32
X#define elisp_height 32
Xstatic char elisp_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x50, 0x64, 0x46, 0x01,
X   0x50, 0x94, 0x4a, 0x02, 0x50, 0x24, 0x4a, 0x04, 0x50, 0x44, 0xc6, 0x0f,
X   0x50, 0x94, 0x02, 0x08, 0xd0, 0x65, 0x02, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xd0, 0x17, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0xd0, 0x0f, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0xbb, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0xb6, 0x01, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x37, 0x03, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0xde, 0x02, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0xdc, 0x04, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0xef, 0x06, 0x08, 0x10, 0x00, 0x00, 0x08, 0x90, 0x07, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xd0, 0x7b, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/eddy/elisp.icon || echo "restore of icons/eddy/elisp.icon fails"
echo "x - extracting icons/eddy/elispc.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/elispc.icon &&
X#define elisp_width 32
X#define elisp_height 32
Xstatic char elisp_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x50, 0x64, 0x46, 0x01,
X   0x50, 0x94, 0x4a, 0x02, 0x50, 0x24, 0x4a, 0x04, 0x50, 0x44, 0xc6, 0x0f,
X   0x50, 0x94, 0x02, 0x08, 0xd0, 0x65, 0x02, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xd0, 0x17, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0xd0, 0x0f, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0xbb, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0xb6, 0x01, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x37, 0x03, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0xde, 0x02, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0xdc, 0x04, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0xef, 0x06, 0x08, 0x10, 0x00, 0x00, 0x08, 0x90, 0x07, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xd0, 0x7b, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/eddy/elispc.icon || echo "restore of icons/eddy/elispc.icon fails"
echo "x - extracting icons/eddy/file.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/file.icon &&
X#define file_width 32
X#define file_height 32
Xstatic char file_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x10, 0x00, 0x40, 0x01,
X   0x10, 0x00, 0x40, 0x02, 0x10, 0x00, 0x40, 0x04, 0x10, 0x00, 0xc0, 0x0f,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/eddy/file.icon || echo "restore of icons/eddy/file.icon fails"
echo "x - extracting icons/eddy/folder.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/folder.icon &&
X#define folder_width 32
X#define folder_height 32
Xstatic char folder_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x02, 0x08,
X   0xfe, 0xff, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/eddy/folder.icon || echo "restore of icons/eddy/folder.icon fails"
echo "x - extracting icons/eddy/hcode.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/hcode.icon &&
X#define hcode_width 32
X#define hcode_height 32
Xstatic char hcode_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x10, 0x0f, 0x40, 0x01,
X   0x10, 0x0e, 0x40, 0x02, 0x10, 0x0e, 0x40, 0x04, 0x10, 0x0e, 0xc0, 0x0f,
X   0x10, 0xee, 0x01, 0x08, 0x10, 0xfe, 0x07, 0x08, 0x10, 0x1e, 0x07, 0x08,
X   0x10, 0x0e, 0x0e, 0x08, 0x10, 0x0e, 0x0e, 0x08, 0x10, 0x0e, 0x0e, 0x08,
X   0x10, 0x0e, 0x0e, 0x08, 0x10, 0x0e, 0x0e, 0x08, 0x10, 0x1f, 0x1f, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0xd0, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x90, 0xdf, 0x0a, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0xb7, 0x03, 0x08, 0x10, 0x00, 0x00, 0x08, 0x90, 0xbd, 0xb7, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x6c, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x90, 0xdd, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0xd0, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/eddy/hcode.icon || echo "restore of icons/eddy/hcode.icon fails"
echo "x - extracting icons/eddy/icon.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/icon.icon &&
X#define icon_width 32
X#define icon_height 32
Xstatic char icon_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x10, 0x00, 0x40, 0x01,
X   0x10, 0x00, 0x40, 0x02, 0x10, 0x00, 0x40, 0x04, 0x10, 0x00, 0xc0, 0x0f,
X   0x10, 0xfe, 0x0f, 0x08, 0x10, 0x02, 0x18, 0x08, 0x10, 0xc2, 0x29, 0x08,
X   0x10, 0x82, 0x78, 0x08, 0x10, 0x82, 0x40, 0x08, 0x10, 0xc2, 0x41, 0x08,
X   0x10, 0x02, 0x40, 0x08, 0x10, 0xc2, 0x41, 0x08, 0x10, 0x42, 0x40, 0x08,
X   0x10, 0x42, 0x40, 0x08, 0x10, 0xc2, 0x41, 0x08, 0x10, 0x02, 0x40, 0x08,
X   0x10, 0xc2, 0x41, 0x08, 0x10, 0x42, 0x41, 0x08, 0x10, 0x42, 0x41, 0x08,
X   0x10, 0xc2, 0x41, 0x08, 0x10, 0x02, 0x40, 0x08, 0x10, 0x42, 0x41, 0x08,
X   0x10, 0xc2, 0x41, 0x08, 0x10, 0xc2, 0x41, 0x08, 0x10, 0x42, 0x41, 0x08,
X   0x10, 0x02, 0x40, 0x08, 0x10, 0xfe, 0x7f, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/eddy/icon.icon || echo "restore of icons/eddy/icon.icon fails"
echo "x - extracting icons/eddy/lcode.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/lcode.icon &&
X#define lcode_width 32
X#define lcode_height 32
Xstatic char lcode_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x10, 0xf0, 0x40, 0x01,
X   0x10, 0xe0, 0x40, 0x02, 0x10, 0xe0, 0x40, 0x04, 0x10, 0xe0, 0xc0, 0x0f,
X   0x10, 0xe0, 0x00, 0x08, 0x10, 0xe0, 0x00, 0x08, 0x10, 0xe0, 0x00, 0x08,
X   0x10, 0xe0, 0x00, 0x08, 0x10, 0xe0, 0x00, 0x08, 0x10, 0xe0, 0x00, 0x08,
X   0x10, 0xe0, 0x00, 0x08, 0x10, 0xe0, 0x00, 0x08, 0x10, 0xf0, 0x01, 0x08,
X   0xd0, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x90, 0x05, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x90, 0xdf, 0x0a, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0xb7, 0x03, 0x08, 0x10, 0x00, 0x00, 0x08, 0x90, 0xbd, 0xb7, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x6c, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x90, 0xdd, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0xd0, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/eddy/lcode.icon || echo "restore of icons/eddy/lcode.icon fails"
echo "x - extracting icons/eddy/lib.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/lib.icon &&
X#define lib_width 32
X#define lib_height 32
Xstatic char lib_bits[] = {
X   0xfe, 0xff, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x40, 0x22, 0xb3, 0xaa, 0x46,
X   0x52, 0x95, 0xab, 0x46, 0x72, 0x93, 0xaa, 0x42, 0x52, 0xb5, 0x4a, 0x46,
X   0x02, 0x00, 0x00, 0x40, 0xf2, 0x7d, 0xdf, 0x47, 0x12, 0x45, 0x51, 0x44,
X   0x12, 0x45, 0x51, 0x44, 0x12, 0x45, 0x51, 0x44, 0x12, 0x45, 0x51, 0x44,
X   0x12, 0x45, 0x51, 0x44, 0xf2, 0x7d, 0xdf, 0x47, 0x02, 0x00, 0x00, 0x40,
X   0xf2, 0x7d, 0xdf, 0x47, 0x12, 0x45, 0x51, 0x44, 0x12, 0x45, 0x51, 0x44,
X   0x12, 0x45, 0x51, 0x44, 0x12, 0x45, 0x51, 0x44, 0x12, 0x45, 0x51, 0x44,
X   0xf2, 0x7d, 0xdf, 0x47, 0x02, 0x00, 0x00, 0x40, 0xf2, 0x7d, 0xdf, 0x47,
SHAR_EOF
echo "End of part 4"
echo "File icons/eddy/lib.icon is continued in part 5"
echo "5" > s2_seq_.tmp
exit 0

eddyg@syma.sussex.ac.uk (Edward J. Groenendaal) (04/18/91)

---- Cut Here and unpack ----
#!/bin/sh
# this is part 5 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file icons/eddy/lib.icon continued
#
CurArch=5
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file icons/eddy/lib.icon"
sed 's/^X//' << 'SHAR_EOF' >> icons/eddy/lib.icon
X   0x12, 0x45, 0x51, 0x44, 0x12, 0x45, 0x51, 0x44, 0x12, 0x45, 0x51, 0x44,
X   0x12, 0x45, 0x51, 0x44, 0x12, 0x45, 0x51, 0x44, 0xf2, 0x7d, 0xdf, 0x47,
X   0x02, 0x00, 0x00, 0x40, 0xfe, 0xff, 0xff, 0x7f};
SHAR_EOF
echo "File icons/eddy/lib.icon is complete"
chmod 0644 icons/eddy/lib.icon || echo "restore of icons/eddy/lib.icon fails"
echo "x - extracting icons/eddy/make.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/make.icon &&
X#define prog_width 32
X#define prog_height 32
Xstatic char prog_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x03,
X   0x04, 0x00, 0x00, 0x06, 0xf4, 0xff, 0xff, 0x1a, 0x14, 0x20, 0x90, 0x22,
X   0xd4, 0xa6, 0x95, 0x22, 0x14, 0x20, 0xf0, 0x22, 0x54, 0xad, 0x93, 0x22,
X   0x14, 0x20, 0xf0, 0x22, 0xf4, 0xbf, 0x95, 0x22, 0x14, 0x20, 0xf0, 0x22,
X   0x54, 0xa5, 0x95, 0x22, 0x14, 0x20, 0xf0, 0x22, 0x54, 0xa0, 0xf6, 0x22,
X   0x14, 0x20, 0xf0, 0x22, 0xf4, 0xff, 0xff, 0x22, 0x14, 0x00, 0xe0, 0x22,
X   0xf4, 0xff, 0xff, 0x22, 0x04, 0x00, 0x00, 0x1a, 0xfc, 0xff, 0xff, 0x7f,
X   0xc0, 0x01, 0xe0, 0x71, 0x30, 0xff, 0x7f, 0x4c, 0x0c, 0x00, 0x00, 0x43,
X   0xfe, 0xff, 0xff, 0x40, 0x02, 0x00, 0x80, 0x30, 0x1a, 0x00, 0x80, 0x0c,
X   0x02, 0x00, 0x80, 0x03, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/eddy/make.icon || echo "restore of icons/eddy/make.icon fails"
echo "x - extracting icons/eddy/makefile.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/makefile.icon &&
X#define makefile_width 32
X#define makefile_height 32
Xstatic char makefile_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x90, 0xe3, 0x40, 0x01,
X   0x90, 0xa6, 0x41, 0x02, 0x90, 0x24, 0x41, 0x04, 0x90, 0x24, 0xc1, 0x0f,
X   0x90, 0x24, 0x01, 0x08, 0x90, 0xe7, 0x01, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x90, 0xe3, 0x38, 0x08, 0x90, 0xa6, 0x69, 0x08, 0x90, 0x24, 0x49, 0x08,
X   0x90, 0x24, 0x49, 0x08, 0x90, 0x24, 0x49, 0x08, 0x90, 0xe7, 0x79, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0xc0, 0x00, 0x08, 0x10, 0xc0, 0x00, 0x08,
X   0x10, 0xc0, 0x00, 0x08, 0x10, 0xc0, 0x00, 0x08, 0x10, 0xf0, 0x03, 0x08,
X   0x10, 0xe0, 0x01, 0x08, 0x10, 0xc0, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0xe0, 0x01, 0x08, 0x10, 0x20, 0x01, 0x08, 0x10, 0x20, 0x01, 0x08,
X   0x10, 0x20, 0x01, 0x08, 0x10, 0x20, 0x01, 0x08, 0x10, 0xe0, 0x01, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/eddy/makefile.icon || echo "restore of icons/eddy/makefile.icon fails"
echo "x - extracting icons/eddy/manpage.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/manpage.icon &&
X#define manpage_width 32
X#define manpage_height 32
Xstatic char manpage_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x10, 0x00, 0x40, 0x01,
X   0xd0, 0x81, 0x43, 0x02, 0x10, 0x00, 0x40, 0x04, 0x90, 0x0f, 0xc0, 0x0f,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x76, 0x4f, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x90, 0x07, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0xae, 0xdb, 0x09,
X   0x10, 0xda, 0xd6, 0x09, 0x10, 0xbe, 0xb6, 0x08, 0x10, 0xb6, 0xb5, 0x09,
X   0x10, 0xbe, 0xb6, 0x09, 0x10, 0x00, 0x00, 0x08, 0x90, 0x0f, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x76, 0x77, 0x09, 0x10, 0xda, 0xfd, 0x09,
X   0x10, 0x6e, 0xb7, 0x09, 0x10, 0x76, 0xff, 0x09, 0x10, 0xb6, 0xdb, 0x08,
X   0x10, 0xee, 0xdd, 0x09, 0x10, 0xba, 0xdd, 0x09, 0x10, 0xee, 0xb6, 0x08,
X   0x10, 0xf6, 0xed, 0x09, 0x10, 0xee, 0x76, 0x09, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/eddy/manpage.icon || echo "restore of icons/eddy/manpage.icon fails"
echo "x - extracting icons/eddy/ocode.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/ocode.icon &&
X#define ocode_width 32
X#define ocode_height 32
Xstatic char ocode_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x10, 0xe0, 0x41, 0x01,
X   0xd0, 0xf9, 0x47, 0x02, 0x10, 0x3c, 0x4f, 0x04, 0x50, 0x1c, 0xce, 0x0f,
X   0x10, 0x1e, 0x1e, 0x08, 0xd0, 0x0e, 0xdc, 0x09, 0x10, 0x0e, 0x1c, 0x08,
X   0xd0, 0x0e, 0x5c, 0x0b, 0x10, 0x0e, 0x1c, 0x08, 0xd0, 0x1e, 0xde, 0x0a,
X   0x10, 0x1c, 0x0e, 0x08, 0xd0, 0x3c, 0xaf, 0x0b, 0x10, 0xf8, 0x07, 0x08,
X   0xd0, 0xe3, 0xd1, 0x0b, 0x10, 0x00, 0x00, 0x08, 0xd0, 0xdf, 0xbd, 0x0b,
X   0x10, 0x00, 0x00, 0x08, 0xd0, 0xff, 0x6f, 0x0b, 0x10, 0x00, 0x00, 0x08,
X   0xd0, 0xb7, 0x77, 0x0b, 0x10, 0x00, 0x00, 0x08, 0xd0, 0xbd, 0xb7, 0x0a,
X   0x10, 0x00, 0x00, 0x08, 0xd0, 0x6c, 0x77, 0x0b, 0x10, 0x00, 0x00, 0x08,
X   0xd0, 0xdd, 0x6e, 0x0b, 0x10, 0x00, 0x00, 0x08, 0xd0, 0xdf, 0xb6, 0x0b,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/eddy/ocode.icon || echo "restore of icons/eddy/ocode.icon fails"
echo "x - extracting icons/eddy/prog.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/prog.icon &&
X#define prog_width 32
X#define prog_height 32
Xstatic char prog_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x03,
X   0x04, 0x00, 0x00, 0x06, 0xf4, 0xff, 0xff, 0x1a, 0x14, 0x20, 0x90, 0x22,
X   0xd4, 0xa6, 0x95, 0x22, 0x14, 0x20, 0xf0, 0x22, 0x54, 0xad, 0x93, 0x22,
X   0x14, 0x20, 0xf0, 0x22, 0xf4, 0xbf, 0x95, 0x22, 0x14, 0x20, 0xf0, 0x22,
X   0x54, 0xa5, 0x95, 0x22, 0x14, 0x20, 0xf0, 0x22, 0x54, 0xa0, 0xf6, 0x22,
X   0x14, 0x20, 0xf0, 0x22, 0xf4, 0xff, 0xff, 0x22, 0x14, 0x00, 0xe0, 0x22,
X   0xf4, 0xff, 0xff, 0x22, 0x04, 0x00, 0x00, 0x1a, 0xfc, 0xff, 0xff, 0x7f,
X   0xc0, 0x01, 0xe0, 0x71, 0x30, 0xff, 0x7f, 0x4c, 0x0c, 0x00, 0x00, 0x43,
X   0xfe, 0xff, 0xff, 0x40, 0x02, 0x00, 0x80, 0x30, 0x1a, 0x00, 0x80, 0x0c,
X   0x02, 0x00, 0x80, 0x03, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/eddy/prog.icon || echo "restore of icons/eddy/prog.icon fails"
echo "x - extracting icons/eddy/text.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/text.icon &&
X#define text_width 32
X#define text_height 32
Xstatic char text_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x10, 0x00, 0x40, 0x01,
X   0x90, 0xb7, 0x4d, 0x02, 0x10, 0x00, 0x40, 0x04, 0x10, 0x00, 0xc0, 0x0f,
X   0x10, 0x00, 0x00, 0x08, 0x90, 0xdd, 0x3d, 0x09, 0x10, 0x00, 0x00, 0x08,
X   0x90, 0xae, 0x6d, 0x0b, 0x10, 0x00, 0x00, 0x08, 0x90, 0xdd, 0xde, 0x0b,
X   0x10, 0x00, 0x00, 0x08, 0x90, 0xdd, 0xa6, 0x0b, 0x10, 0x00, 0x00, 0x08,
X   0x90, 0x5b, 0xaf, 0x0a, 0x10, 0x00, 0x00, 0x08, 0x90, 0xcd, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x90, 0x5d, 0xbb, 0x0b, 0x10, 0x00, 0x00, 0x08,
X   0x90, 0xdb, 0xda, 0x0a, 0x10, 0x00, 0x00, 0x08, 0x90, 0xed, 0x56, 0x0b,
X   0x10, 0x00, 0x00, 0x08, 0x90, 0xed, 0xb6, 0x0b, 0x10, 0x00, 0x00, 0x08,
X   0x90, 0xdb, 0xed, 0x0a, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/eddy/text.icon || echo "restore of icons/eddy/text.icon fails"
echo "x - extracting icons/eddy/x.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/x.icon &&
X#define x_width 32
X#define x_height 32
Xstatic char x_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x02, 0x08,
X   0xfe, 0xff, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x40, 0x02, 0x1e, 0x60, 0x40,
X   0x02, 0x1e, 0x60, 0x40, 0x02, 0x3c, 0x30, 0x40, 0x02, 0x78, 0x18, 0x40,
X   0x02, 0x78, 0x18, 0x40, 0x02, 0xf0, 0x0c, 0x40, 0x02, 0xe0, 0x07, 0x40,
X   0x02, 0xe0, 0x07, 0x40, 0x02, 0xc0, 0x03, 0x40, 0x02, 0xc0, 0x07, 0x40,
X   0x02, 0xe0, 0x07, 0x40, 0x02, 0x60, 0x0f, 0x40, 0x02, 0x30, 0x1e, 0x40,
X   0x02, 0x18, 0x1e, 0x40, 0x02, 0x18, 0x3c, 0x40, 0x02, 0x0c, 0x78, 0x40,
X   0x02, 0x06, 0x78, 0x40, 0x02, 0x06, 0xf0, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/eddy/x.icon || echo "restore of icons/eddy/x.icon fails"
echo "x - extracting icons/eddy/xdtm.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/xdtm.icon &&
X#define xdtm_width 32
X#define xdtm_height 32
Xstatic char xdtm_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0x4a, 0x06, 0x00, 0x58,
X   0xfe, 0xff, 0xff, 0x7f, 0x02, 0x08, 0x10, 0x40, 0x02, 0x88, 0xff, 0x43,
X   0x02, 0x88, 0x10, 0x42, 0xfe, 0xcf, 0x39, 0x47, 0x02, 0x48, 0x29, 0x45,
X   0xe2, 0xc8, 0x39, 0x47, 0xa2, 0x88, 0x00, 0x42, 0xa2, 0xf8, 0x07, 0x42,
X   0xe2, 0x88, 0x04, 0x42, 0x02, 0xf8, 0xff, 0x7f, 0xfa, 0x0b, 0x00, 0x40,
X   0x02, 0xe8, 0x9c, 0x43, 0xe2, 0xa8, 0x94, 0x42, 0xa2, 0xa8, 0x94, 0x42,
X   0xa2, 0xe8, 0x9c, 0x43, 0xe2, 0x08, 0x00, 0x40, 0x02, 0xe8, 0xb6, 0x43,
X   0x7a, 0x0b, 0x00, 0x40, 0x02, 0xe8, 0x9c, 0x43, 0x02, 0xa8, 0x94, 0x42,
X   0x02, 0xa8, 0x94, 0x42, 0x02, 0xe8, 0x9c, 0x43, 0xfe, 0x0f, 0x00, 0x40,
X   0x92, 0xec, 0x9c, 0x43, 0x92, 0x0c, 0x00, 0x40, 0x92, 0x0c, 0x00, 0x40,
X   0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/eddy/xdtm.icon || echo "restore of icons/eddy/xdtm.icon fails"
echo "x - extracting icons/eddy/ycode.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/ycode.icon &&
X#define ycode_width 32
X#define ycode_height 32
Xstatic char ycode_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x90, 0x8f, 0x4f, 0x01,
X   0x10, 0x07, 0x47, 0x02, 0x10, 0x8e, 0x43, 0x04, 0x10, 0x8e, 0xc3, 0x0f,
X   0x10, 0xdc, 0x01, 0x08, 0x10, 0xdc, 0x01, 0x08, 0x10, 0xf8, 0x00, 0x08,
X   0x10, 0xf8, 0x00, 0x08, 0x10, 0x70, 0x00, 0x08, 0x10, 0x70, 0x00, 0x08,
X   0x10, 0x70, 0x00, 0x08, 0x10, 0x70, 0x00, 0x08, 0x10, 0xf8, 0x00, 0x08,
X   0xd0, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x90, 0x05, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x90, 0xdf, 0x0a, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0xb7, 0x03, 0x08, 0x10, 0x00, 0x00, 0x08, 0x90, 0xbd, 0xb7, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x6c, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x90, 0xdd, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0xd0, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/eddy/ycode.icon || echo "restore of icons/eddy/ycode.icon fails"
echo "x - extracting icons/eddy/z.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/eddy/z.icon &&
X#define z_width 32
X#define z_height 32
X#define z_x_hot 16
X#define z_y_hot 13
Xstatic char z_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0xf0, 0x3f, 0x00,
X   0x00, 0xf8, 0xff, 0x00, 0x00, 0x3c, 0xf8, 0x01, 0x00, 0x1c, 0xc0, 0x03,
X   0x00, 0x1c, 0x80, 0x03, 0xc0, 0xff, 0x03, 0x07, 0x20, 0x00, 0x01, 0x07,
X   0x50, 0xd5, 0x00, 0x07, 0x20, 0x00, 0x01, 0x0e, 0x40, 0x55, 0x03, 0x0e,
X   0x20, 0x00, 0x01, 0x0e, 0x50, 0xd5, 0x00, 0x0e, 0x20, 0x00, 0x01, 0x0e,
X   0x40, 0x00, 0x02, 0x0e, 0xc0, 0xff, 0x03, 0x0e, 0x00, 0x7e, 0x00, 0x07,
X   0x00, 0x18, 0x00, 0x07, 0x00, 0x18, 0x00, 0x07, 0x00, 0x18, 0x80, 0x03,
X   0x00, 0x3c, 0xc0, 0x03, 0x00, 0x7c, 0xf0, 0x01, 0x00, 0xfc, 0xff, 0x00,
X   0x00, 0xf8, 0x7f, 0x00, 0x00, 0xd8, 0x1f, 0x00, 0x00, 0x18, 0x00, 0x00,
X   0x80, 0xdb, 0x01, 0x00, 0xc0, 0xff, 0x03, 0x00, 0xc0, 0xff, 0x03, 0x00,
X   0x80, 0xc3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/eddy/z.icon || echo "restore of icons/eddy/z.icon fails"
echo "x - extracting icons/alix/airballoon.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/airballoon.icon &&
X#define drawing3_width 32
X#define drawing3_height 32
Xstatic char drawing3_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x05,
X   0x00, 0x18, 0x8c, 0x0a, 0x00, 0x04, 0x10, 0x00, 0x00, 0x02, 0x20, 0x00,
X   0x00, 0x02, 0x20, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x07, 0x70, 0x14,
X   0x00, 0xf9, 0x4f, 0x2a, 0x00, 0x81, 0x40, 0x00, 0x00, 0x81, 0x40, 0x00,
X   0x00, 0x82, 0x20, 0x00, 0x00, 0x82, 0x20, 0x00, 0x00, 0x84, 0x10, 0x00,
X   0x00, 0x9c, 0x1c, 0x00, 0x00, 0xe4, 0x13, 0x00, 0x00, 0x88, 0x08, 0x00,
X   0x00, 0x88, 0x28, 0x00, 0x00, 0x90, 0x34, 0x00, 0x00, 0x90, 0x0c, 0x00,
X   0x00, 0x90, 0x3e, 0x00, 0x14, 0xf0, 0x47, 0x00, 0x2a, 0x90, 0x04, 0x00,
X   0x00, 0x90, 0x04, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x10, 0x04, 0x01,
X   0x00, 0xf0, 0x87, 0x02, 0x00, 0x00, 0x40, 0x04, 0x40, 0x00, 0x20, 0x08,
X   0xa0, 0x00, 0x70, 0x1f, 0xf0, 0x01, 0xf8, 0x3f};
SHAR_EOF
chmod 0644 icons/alix/airballoon.icon || echo "restore of icons/alix/airballoon.icon fails"
echo "x - extracting icons/alix/alien.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/alien.icon &&
X#define pic_width 32
X#define pic_height 32
Xstatic char pic_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10, 0x1c, 0x60, 0x00, 0x1c,
X   0x0e, 0xd0, 0x0c, 0x38, 0x1c, 0x90, 0x1a, 0x1c, 0x04, 0x70, 0x12, 0x10,
X   0x00, 0x60, 0x0c, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0x68, 0x1c, 0x00,
X   0x40, 0x44, 0x28, 0x00, 0x70, 0x04, 0x40, 0x30, 0xe0, 0x04, 0x44, 0x4b,
X   0x70, 0x44, 0x42, 0x45, 0x40, 0x8c, 0x21, 0x41, 0x00, 0x30, 0x3c, 0x42,
X   0x00, 0xc8, 0x23, 0x22, 0x00, 0x04, 0x60, 0x11, 0x00, 0x04, 0xc0, 0x11,
X   0x00, 0x02, 0x00, 0x08, 0x00, 0x09, 0x00, 0x08, 0x00, 0x05, 0x60, 0x04,
X   0x80, 0x04, 0x80, 0x03, 0x80, 0x04, 0x80, 0x00, 0x80, 0x04, 0x80, 0x00,
X   0x60, 0x04, 0x80, 0x00, 0x10, 0x08, 0x40, 0x00, 0xd0, 0x09, 0xc0, 0x01,
X   0x20, 0x06, 0x20, 0x06, 0x10, 0x00, 0x10, 0x08, 0x10, 0x00, 0x10, 0x08,
X   0x10, 0x30, 0x10, 0x08, 0xe0, 0xef, 0xef, 0x07};
SHAR_EOF
chmod 0644 icons/alix/alien.icon || echo "restore of icons/alix/alien.icon fails"
echo "x - extracting icons/alix/bat.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/bat.icon &&
X#define bat_width 32
X#define bat_height 32
Xstatic char bat_bits[] = {
X   0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x0a, 0x39, 0x00,
X   0x00, 0x94, 0x4a, 0x00, 0x00, 0x64, 0x92, 0x00, 0x00, 0x54, 0x22, 0x01,
X   0x60, 0x54, 0x22, 0x02, 0x50, 0x04, 0x41, 0x04, 0x48, 0x68, 0x41, 0x08,
X   0x48, 0x08, 0x21, 0x10, 0x44, 0x08, 0x11, 0x20, 0x82, 0x04, 0x0e, 0x20,
X   0x02, 0x07, 0x04, 0x40, 0x01, 0x04, 0x0c, 0x40, 0x01, 0x02, 0x10, 0x40,
X   0x01, 0x02, 0x10, 0x80, 0x01, 0x02, 0x00, 0x80, 0x01, 0x02, 0x00, 0xb0,
X   0x01, 0x02, 0x00, 0x48, 0x01, 0x02, 0x00, 0x44, 0x01, 0x04, 0xc0, 0x45,
X   0x01, 0x08, 0x20, 0x06, 0x01, 0x10, 0x20, 0x04, 0x01, 0x20, 0x20, 0x00,
X   0x01, 0x40, 0x2e, 0x00, 0x01, 0x78, 0xb1, 0x03, 0xc2, 0x84, 0xc1, 0x00,
X   0x26, 0x03, 0x41, 0x03, 0x2c, 0xc2, 0x47, 0x00, 0x28, 0x40, 0xc1, 0x00,
X   0x30, 0x00, 0x03, 0x00, 0x60, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/alix/bat.icon || echo "restore of icons/alix/bat.icon fails"
echo "x - extracting icons/alix/candle.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/candle.icon &&
X#define lady_width 32
X#define lady_height 32
Xstatic char lady_bits[] = {
X   0x00, 0xf0, 0x00, 0x00, 0x00, 0x8f, 0x01, 0x00, 0x80, 0x40, 0x00, 0x00,
X   0x40, 0x22, 0x00, 0x00, 0x40, 0x11, 0x00, 0x00, 0xc0, 0x09, 0xfc, 0x0f,
X   0x98, 0x06, 0x03, 0x30, 0xb8, 0x00, 0x0f, 0x3c, 0xc8, 0x07, 0xf3, 0x33,
X   0x08, 0x08, 0x02, 0x10, 0x10, 0x09, 0x06, 0x18, 0x10, 0x09, 0x04, 0x08,
X   0x10, 0x09, 0x0c, 0x0c, 0x10, 0x09, 0xf8, 0x07, 0x90, 0x05, 0x18, 0x06,
X   0x90, 0x04, 0x10, 0x02, 0x90, 0x04, 0x30, 0x03, 0x90, 0x04, 0xe0, 0x01,
X   0x90, 0x04, 0xc0, 0x00, 0x90, 0x04, 0xc0, 0x00, 0x10, 0x05, 0xc0, 0x00,
X   0x10, 0x05, 0xc0, 0x00, 0x10, 0x05, 0xc0, 0x00, 0x10, 0x05, 0xc0, 0x00,
X   0x10, 0x05, 0xc0, 0x00, 0x90, 0x0d, 0xc0, 0x00, 0x90, 0x10, 0xc0, 0x00,
X   0x90, 0x11, 0xc0, 0x00, 0x18, 0x13, 0xc3, 0x00, 0x0c, 0xe2, 0xe6, 0x01,
X   0x06, 0x0e, 0xf8, 0x07, 0xfe, 0xfb, 0xff, 0x0f};
SHAR_EOF
chmod 0644 icons/alix/candle.icon || echo "restore of icons/alix/candle.icon fails"
echo "x - extracting icons/alix/clock.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/clock.icon &&
X#define clock_width 32
X#define clock_height 32
Xstatic char clock_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1f, 0x00, 0x80, 0x08, 0x04, 0x02,
X   0x40, 0x10, 0x14, 0x06, 0x20, 0x27, 0xc4, 0x02, 0x90, 0x4a, 0x54, 0x06,
X   0x50, 0x52, 0xd4, 0x0a, 0xd0, 0x53, 0x00, 0x00, 0x50, 0x50, 0x7c, 0x00,
X   0x98, 0xc8, 0x10, 0x20, 0x34, 0x67, 0x11, 0x60, 0x54, 0x50, 0xd1, 0x2d,
X   0x94, 0x4f, 0x51, 0x65, 0xd4, 0x5f, 0xd1, 0xad, 0x54, 0x52, 0x01, 0x00,
X   0x54, 0x52, 0x01, 0x00, 0x54, 0x52, 0x01, 0x00, 0x54, 0x52, 0x01, 0x00,
X   0x54, 0x52, 0x01, 0x00, 0x54, 0x52, 0x01, 0x00, 0x54, 0x52, 0x01, 0x00,
X   0x54, 0x57, 0x01, 0x00, 0x54, 0x57, 0x01, 0x00, 0x54, 0x57, 0x01, 0x00,
X   0x54, 0x50, 0x01, 0x00, 0x54, 0x50, 0x01, 0x00, 0xd4, 0x5f, 0x41, 0x03,
X   0x14, 0x20, 0xc1, 0x03, 0xa4, 0x1f, 0xc1, 0x61, 0x48, 0x95, 0x80, 0x27,
X   0xa8, 0xad, 0xc0, 0x27, 0x38, 0xe0, 0x00, 0x3f};
SHAR_EOF
chmod 0644 icons/alix/clock.icon || echo "restore of icons/alix/clock.icon fails"
echo "x - extracting icons/alix/cup.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/cup.icon &&
X#define drawing1_width 32
X#define drawing1_height 32
Xstatic char drawing1_bits[] = {
X   0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xc1, 0x01, 0x00,
X   0x00, 0x01, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x84, 0x01, 0x00,
X   0x00, 0x58, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0xff, 0x07, 0x00,
X   0xc0, 0x90, 0x18, 0x00, 0x20, 0x6e, 0x23, 0x00, 0x60, 0xef, 0x37, 0x00,
X   0xa0, 0xdf, 0xef, 0x03, 0x20, 0xfc, 0x23, 0x04, 0x20, 0x00, 0xe0, 0x09,
X   0x20, 0x00, 0x20, 0x12, 0x20, 0x00, 0x20, 0x14, 0x20, 0x00, 0x20, 0x14,
X   0x20, 0x00, 0x20, 0x14, 0x20, 0x00, 0x20, 0x14, 0x20, 0x00, 0x20, 0x14,
X   0x20, 0x00, 0x20, 0x14, 0x20, 0x00, 0x20, 0x12, 0x20, 0x00, 0x20, 0x09,
X   0x20, 0x00, 0xe0, 0x04, 0x20, 0x00, 0x20, 0x02, 0x20, 0x00, 0xe0, 0x01,
X   0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x40, 0x00, 0x10, 0x00,
X   0x80, 0x01, 0x0c, 0x00, 0x00, 0xfe, 0x03, 0x00};
SHAR_EOF
chmod 0644 icons/alix/cup.icon || echo "restore of icons/alix/cup.icon fails"
echo "x - extracting icons/alix/dragon.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/dragon.icon &&
X#define pic2_width 32
X#define pic2_height 32
Xstatic char pic2_bits[] = {
X   0x00, 0x40, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x40, 0x21, 0x00,
X   0x00, 0xf0, 0x3d, 0x00, 0x1c, 0x18, 0x22, 0x00, 0x24, 0x28, 0x11, 0x3c,
X   0x54, 0x3c, 0x88, 0x63, 0x84, 0x23, 0x6c, 0x50, 0x0c, 0x00, 0x1c, 0x08,
X   0x78, 0x80, 0x06, 0x04, 0xc0, 0x81, 0x02, 0x08, 0x00, 0xc6, 0x06, 0x0f,
X   0x04, 0x38, 0x0c, 0x09, 0xe4, 0x10, 0x0a, 0x02, 0x16, 0x0b, 0xe9, 0x03,
X   0x0e, 0x86, 0x24, 0x02, 0x1f, 0x4c, 0x14, 0x00, 0x00, 0xda, 0x1a, 0x0f,
X   0x00, 0x31, 0xcb, 0x10, 0x80, 0x60, 0x3e, 0x20, 0x40, 0xc8, 0x00, 0x40,
X   0x2e, 0xc9, 0x00, 0x40, 0xff, 0x89, 0x71, 0x40, 0x1d, 0x88, 0x0a, 0x40,
X   0x75, 0x04, 0x05, 0x20, 0x95, 0x03, 0x7a, 0xf0, 0x10, 0x00, 0x84, 0x8f,
X   0x10, 0x60, 0x38, 0x80, 0x38, 0x90, 0xcf, 0x80, 0x44, 0x28, 0x00, 0x47,
X   0xda, 0xa9, 0x02, 0x38, 0x7f, 0xfe, 0xfd, 0x1f};
SHAR_EOF
chmod 0644 icons/alix/dragon.icon || echo "restore of icons/alix/dragon.icon fails"
echo "x - extracting icons/alix/drawingA.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/drawingA.icon &&
X#define drawingA_width 32
X#define drawingA_height 32
Xstatic char drawingA_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00,
X   0x00, 0x11, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0xd8, 0x0b, 0x00, 0x00,
X   0x6c, 0x30, 0x00, 0x00, 0x04, 0x44, 0x00, 0x00, 0x2c, 0x80, 0x00, 0x00,
X   0x38, 0x89, 0x00, 0x00, 0x20, 0x8c, 0x39, 0x00, 0x60, 0x80, 0x4f, 0x00,
X   0x40, 0xc0, 0x88, 0x00, 0xc0, 0x60, 0x90, 0x00, 0x80, 0x1f, 0xe0, 0x00,
X   0xc0, 0x00, 0x80, 0x01, 0x60, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x02,
X   0x08, 0x00, 0x00, 0x3c, 0x04, 0x00, 0x00, 0x64, 0x04, 0x04, 0x00, 0x44,
X   0x04, 0x0b, 0x00, 0x44, 0x84, 0xc8, 0x07, 0x46, 0x78, 0x50, 0x08, 0x62,
X   0x00, 0x30, 0x10, 0x3f, 0x00, 0x30, 0xd0, 0x00, 0x00, 0x20, 0x70, 0x00,
X   0x00, 0x20, 0x10, 0x00, 0x00, 0x60, 0x18, 0x00, 0x00, 0xc0, 0x07, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/alix/drawingA.icon || echo "restore of icons/alix/drawingA.icon fails"
echo "x - extracting icons/alix/drawingB.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/drawingB.icon &&
X#define drawingB_width 32
X#define drawingB_height 32
Xstatic char drawingB_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x01,
X   0x00, 0x80, 0xe1, 0x01, 0x00, 0x60, 0xe3, 0x00, 0x00, 0x30, 0x76, 0x00,
X   0x00, 0x98, 0x38, 0x00, 0x00, 0x0c, 0x38, 0x00, 0x00, 0x66, 0x38, 0x00,
X   0x00, 0x42, 0x44, 0x00, 0x00, 0xc2, 0x80, 0x00, 0x00, 0x03, 0x80, 0x00,
X   0x00, 0x83, 0x83, 0x00, 0x00, 0xfc, 0xde, 0x00, 0x00, 0x28, 0x74, 0x00,
X   0x00, 0x68, 0x26, 0x00, 0x00, 0x90, 0x98, 0x00, 0x00, 0x90, 0x11, 0x01,
X   0x00, 0x20, 0x0a, 0x03, 0x00, 0xe0, 0x0e, 0x03, 0x00, 0x20, 0x08, 0x00,
X   0x00, 0xc0, 0x05, 0x00, 0x00, 0x40, 0x05, 0x00, 0x00, 0x40, 0x07, 0x00,
X   0x00, 0x80, 0x02, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00,
X   0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/alix/drawingB.icon || echo "restore of icons/alix/drawingB.icon fails"
echo "x - extracting icons/alix/emacs.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/emacs.icon &&
X#define emacs_width 32
X#define emacs_height 32
Xstatic char emacs_bits[] = {
X   0x00, 0x00, 0x7c, 0x00, 0x30, 0x00, 0x82, 0x00, 0x48, 0x00, 0x03, 0x01,
X   0x84, 0x00, 0x05, 0x02, 0x44, 0x01, 0x14, 0x04, 0x68, 0x02, 0x2a, 0x08,
X   0x90, 0x04, 0x11, 0x10, 0x20, 0x89, 0xa4, 0x20, 0x40, 0x52, 0x09, 0x41,
X   0x80, 0xa4, 0x92, 0x40, 0x00, 0x49, 0x01, 0x45, 0x00, 0x92, 0x48, 0x40,
X   0x00, 0x24, 0x95, 0x20, 0x00, 0x4c, 0x23, 0x10, 0x00, 0x92, 0x12, 0x08,
X   0x00, 0x61, 0xa6, 0x04, 0x80, 0xc0, 0x0b, 0x02, 0x40, 0x00, 0x00, 0x01,
X   0x20, 0x00, 0xa0, 0x00, 0x10, 0x00, 0x40, 0x00, 0x08, 0x00, 0x20, 0x00,
X   0x04, 0x00, 0x10, 0x00, 0x02, 0x00, 0x08, 0x00, 0x02, 0x00, 0x04, 0x00,
X   0x02, 0x00, 0x02, 0x00, 0x24, 0x00, 0x01, 0x00, 0x48, 0x80, 0x00, 0x00,
X   0x10, 0x40, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x40, 0x10, 0x00, 0x00,
X   0x80, 0x90, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/alix/emacs.icon || echo "restore of icons/alix/emacs.icon fails"
echo "x - extracting icons/alix/fish.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/fish.icon &&
X#define picA_width 32
X#define picA_height 32
Xstatic char picA_bits[] = {
X   0x00, 0x70, 0x80, 0x00, 0x00, 0x88, 0x80, 0x00, 0x00, 0x04, 0x91, 0x00,
X   0x00, 0x04, 0x21, 0x1e, 0x00, 0x04, 0x41, 0x00, 0x18, 0x88, 0x00, 0x00,
X   0x24, 0x70, 0x40, 0x02, 0x24, 0x00, 0x30, 0x04, 0x24, 0x00, 0x00, 0x08,
X   0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x1f,
X   0x80, 0x01, 0x82, 0x20, 0x40, 0x00, 0x44, 0x40, 0x20, 0x00, 0x28, 0x88,
X   0xd0, 0xe1, 0x11, 0x50, 0xa8, 0x13, 0x06, 0x32, 0xe4, 0x0b, 0x38, 0x14,
X   0xe4, 0x0b, 0x10, 0x08, 0xc2, 0x01, 0x0a, 0x07, 0x02, 0x00, 0x0e, 0x02,
X   0x02, 0x40, 0x04, 0x0c, 0x32, 0x80, 0x03, 0x14, 0x34, 0x00, 0x00, 0x32,
X   0x08, 0x00, 0x08, 0x50, 0x30, 0x00, 0x14, 0xc8, 0xc0, 0x00, 0x22, 0x30,
X   0x00, 0x03, 0x41, 0x08, 0x00, 0xfc, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/alix/fish.icon || echo "restore of icons/alix/fish.icon fails"
echo "x - extracting icons/alix/flower.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/flower.icon &&
X#define pic_width 32
X#define pic_height 32
Xstatic char pic_bits[] = {
X   0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x78, 0x00, 0xc0, 0x01, 0x46,
X   0x00, 0x20, 0x02, 0x51, 0x00, 0x10, 0x84, 0x4e, 0x80, 0x13, 0x48, 0x40,
X   0x40, 0x14, 0xc8, 0x33, 0x20, 0x18, 0x08, 0x0c, 0x10, 0x10, 0xf8, 0x00,
X   0x10, 0x00, 0x0c, 0x01, 0x10, 0xc0, 0x04, 0x02, 0x20, 0xe0, 0x01, 0x02,
X   0xc0, 0xf0, 0x01, 0x02, 0x00, 0xf3, 0x01, 0x02, 0xc0, 0xe0, 0x01, 0x01,
X   0x20, 0xc0, 0x80, 0x00, 0x10, 0x00, 0x60, 0x00, 0x10, 0x40, 0xa0, 0x07,
X   0x10, 0x60, 0x40, 0x0b, 0x20, 0x50, 0x40, 0x15, 0x40, 0x90, 0x40, 0x25,
X   0x80, 0x88, 0x20, 0x25, 0x00, 0x27, 0x1f, 0x25, 0x00, 0x30, 0x00, 0x25,
X   0x00, 0x68, 0x00, 0x25, 0x00, 0x94, 0x00, 0x29, 0x00, 0x8a, 0x00, 0x29,
X   0x00, 0x8a, 0x00, 0x42, 0x00, 0x8a, 0x00, 0x44, 0x00, 0x4a, 0x00, 0x48,
X   0x00, 0x24, 0x00, 0xf0, 0x00, 0x18, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/alix/flower.icon || echo "restore of icons/alix/flower.icon fails"
echo "x - extracting icons/alix/ghost.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/ghost.icon &&
X#define pic_width 32
X#define pic_height 32
Xstatic char pic_bits[] = {
X   0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x80, 0x23, 0x00,
X   0x00, 0x40, 0x10, 0x00, 0x00, 0x20, 0x13, 0x00, 0x00, 0xa0, 0x09, 0x00,
X   0x00, 0x9c, 0x09, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x02, 0x20, 0x00,
X   0x00, 0x84, 0x40, 0x00, 0x00, 0xe4, 0x40, 0x00, 0x3e, 0x88, 0x40, 0x04,
X   0xc2, 0x10, 0x20, 0x06, 0x02, 0x21, 0x10, 0x1f, 0x01, 0x5f, 0xf2, 0x21,
X   0x01, 0x80, 0x01, 0x20, 0x3e, 0x00, 0x00, 0x20, 0x40, 0x01, 0x00, 0x10,
X   0x80, 0xc0, 0x81, 0x09, 0x80, 0x60, 0x43, 0x06, 0x40, 0x20, 0x42, 0x00,
X   0x40, 0x20, 0x40, 0x00, 0x40, 0xc0, 0x41, 0x0e, 0x40, 0x00, 0x82, 0x33,
X   0x40, 0x00, 0x04, 0x40, 0x80, 0x10, 0x04, 0x78, 0x80, 0x30, 0x06, 0x44,
X   0x00, 0xe1, 0x03, 0x02, 0x00, 0x81, 0x00, 0x01, 0x00, 0x02, 0x80, 0x00,
X   0x00, 0x0c, 0x40, 0x00, 0x00, 0xf0, 0x3f, 0x00};
SHAR_EOF
chmod 0644 icons/alix/ghost.icon || echo "restore of icons/alix/ghost.icon fails"
echo "x - extracting icons/alix/gun.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/gun.icon &&
X#define drawing6_width 32
X#define drawing6_height 32
Xstatic char drawing6_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00,
X   0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x44, 0x00,
X   0x00, 0x80, 0x6f, 0x00, 0x00, 0x40, 0xe0, 0x00, 0x00, 0x20, 0x80, 0x03,
X   0x00, 0x90, 0x00, 0x06, 0x00, 0x48, 0x06, 0x1c, 0x00, 0x24, 0x0f, 0x30,
X   0x00, 0x92, 0x17, 0x60, 0x00, 0xc9, 0x2f, 0xc0, 0x80, 0xe4, 0x5f, 0xc0,
X   0x40, 0xf2, 0x96, 0xd0, 0x20, 0x79, 0x25, 0xd1, 0x90, 0x3c, 0x45, 0xd2,
X   0x48, 0x1e, 0xc6, 0xcc, 0x24, 0x07, 0x83, 0xe1, 0x92, 0x03, 0x81, 0xf7,
X   0xc9, 0x01, 0x00, 0x7f, 0xe3, 0x00, 0x00, 0x3e, 0x76, 0x00, 0x00, 0x00,
X   0x3c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/alix/gun.icon || echo "restore of icons/alix/gun.icon fails"
echo "x - extracting icons/alix/hat.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/hat.icon &&
X#define pic999_width 32
X#define pic999_height 32
Xstatic char pic999_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x22, 0x00,
X   0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x80, 0xc0, 0x00,
X   0x00, 0xc0, 0xb8, 0x00, 0x00, 0x40, 0xe0, 0x00, 0x00, 0x20, 0x60, 0x00,
X   0x00, 0x20, 0x22, 0x00, 0x00, 0x30, 0x36, 0x00, 0x00, 0x18, 0x33, 0x00,
X   0x00, 0x08, 0x36, 0x00, 0xf8, 0x04, 0x32, 0x00, 0x84, 0x67, 0x10, 0x00,
X   0x04, 0x33, 0x10, 0x00, 0x04, 0x31, 0x10, 0x00, 0x84, 0x31, 0x10, 0x00,
X   0x84, 0xf1, 0x10, 0x00, 0x04, 0x42, 0x18, 0x00, 0x18, 0x06, 0x18, 0x00,
X   0x30, 0x18, 0x30, 0x00, 0x60, 0x00, 0x68, 0x00, 0xe0, 0x01, 0xc8, 0x00,
X   0x80, 0x03, 0x80, 0x00, 0x00, 0x1e, 0x80, 0x01, 0x00, 0xf8, 0x80, 0x01,
X   0x00, 0xc0, 0x87, 0x01, 0x00, 0x00, 0xfc, 0x00};
SHAR_EOF
chmod 0644 icons/alix/hat.icon || echo "restore of icons/alix/hat.icon fails"
echo "x - extracting icons/alix/hedgehog.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/hedgehog.icon &&
X#define hedgehog_width 32
X#define hedgehog_height 32
Xstatic char hedgehog_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
X   0x00, 0x00, 0xa3, 0x00, 0x00, 0xba, 0xd0, 0x00, 0x80, 0x0a, 0xaa, 0x0d,
X   0x00, 0x64, 0x20, 0x10, 0x00, 0x11, 0x1b, 0x0c, 0x80, 0xec, 0xa7, 0x67,
X   0x00, 0x17, 0x9e, 0x34, 0x00, 0x61, 0xa2, 0x01, 0x00, 0x01, 0x3d, 0x77,
X   0x00, 0xc1, 0x40, 0xd8, 0x00, 0x59, 0xf3, 0x07, 0x07, 0x1d, 0x13, 0x42,
X   0x87, 0x35, 0xc2, 0x56, 0xc7, 0x3c, 0x13, 0x46, 0x7f, 0x18, 0x15, 0x44,
X   0x04, 0x00, 0x5f, 0x51, 0x04, 0x00, 0x38, 0x1c, 0x08, 0x00, 0x68, 0x40,
X   0x18, 0x10, 0xd8, 0x64, 0x30, 0x10, 0x88, 0x04, 0xe0, 0x18, 0xa8, 0x5b,
X   0xc0, 0x0f, 0x7c, 0x60, 0x80, 0x81, 0xca, 0x29, 0x00, 0x87, 0x78, 0x34,
X   0x00, 0x1c, 0xb7, 0x18, 0x00, 0xf0, 0xe0, 0x06, 0x00, 0x80, 0xff, 0x07,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/alix/hedgehog.icon || echo "restore of icons/alix/hedgehog.icon fails"
echo "x - extracting icons/alix/mermaid.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/mermaid.icon &&
X#define drawing5_width 32
X#define drawing5_height 32
Xstatic char drawing5_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00,
X   0x00, 0x29, 0x00, 0x00, 0x87, 0x24, 0x06, 0x00, 0xca, 0x22, 0x63, 0x38,
X   0x52, 0xb5, 0xc4, 0x94, 0x71, 0xe1, 0x48, 0x75, 0x98, 0x28, 0x30, 0x06,
X   0x04, 0x13, 0x06, 0x00, 0x84, 0x0c, 0x09, 0x18, 0x64, 0x18, 0x11, 0x2c,
X   0x54, 0x70, 0x20, 0x8a, 0x84, 0x90, 0x40, 0x49, 0x08, 0x20, 0x81, 0x38,
X   0x10, 0xc7, 0x02, 0x02, 0xf0, 0x0d, 0x3d, 0x05, 0x80, 0x19, 0x2b, 0x48,
X   0x80, 0xe0, 0x1f, 0x30, 0x80, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0, 0x1c,
X   0xf0, 0x00, 0x80, 0x23, 0xf8, 0x00, 0x00, 0x42, 0xfc, 0x01, 0x7c, 0x40,
X   0xfc, 0x03, 0xfe, 0x40, 0xfe, 0xcf, 0xff, 0x70, 0xff, 0xff, 0x7f, 0x5c,
X   0xff, 0xff, 0x7f, 0x18, 0xff, 0xff, 0x7f, 0x38, 0xff, 0xff, 0xff, 0xfb,
X   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
SHAR_EOF
chmod 0644 icons/alix/mermaid.icon || echo "restore of icons/alix/mermaid.icon fails"
echo "x - extracting icons/alix/monster.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/monster.icon &&
X#define drawing4_width 32
X#define drawing4_height 32
Xstatic char drawing4_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00,
X   0xc4, 0x23, 0x00, 0x00, 0x38, 0x1e, 0x00, 0x02, 0x10, 0x04, 0xe0, 0x02,
X   0xb0, 0x04, 0x10, 0x07, 0x10, 0xf4, 0x10, 0x0e, 0x50, 0x9c, 0x11, 0x01,
X   0x10, 0x0b, 0x21, 0x00, 0xe0, 0x09, 0x41, 0x00, 0x00, 0x88, 0x81, 0x00,
X   0x00, 0xcc, 0x01, 0x01, 0x00, 0x67, 0x01, 0x02, 0xc0, 0x30, 0x01, 0x04,
X   0x40, 0x1c, 0x03, 0x08, 0xc0, 0x17, 0x1e, 0x08, 0x40, 0x15, 0x30, 0x08,
X   0x00, 0x11, 0x40, 0x08, 0x00, 0x09, 0xc0, 0x08, 0x00, 0x88, 0x40, 0x09,
X   0x00, 0x48, 0x40, 0x06, 0x00, 0x48, 0xc0, 0x01, 0x00, 0x54, 0x40, 0x00,
X   0x00, 0xa6, 0x60, 0x00, 0x00, 0xc2, 0x20, 0x00, 0x00, 0xa2, 0x10, 0x00,
X   0x00, 0x12, 0x19, 0x00, 0x00, 0x1a, 0x0d, 0x00, 0x80, 0x09, 0x05, 0x00,
X   0x60, 0xc8, 0x0d, 0x00, 0xf0, 0xef, 0x1f, 0x00};
SHAR_EOF
chmod 0644 icons/alix/monster.icon || echo "restore of icons/alix/monster.icon fails"
echo "x - extracting icons/alix/piccy.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/piccy.icon &&
X#define emacs_width 32
X#define emacs_height 32
Xstatic char emacs_bits[] = {
X   0x00, 0x00, 0x7c, 0x00, 0x30, 0x00, 0x82, 0x00, 0x48, 0x00, 0x03, 0x01,
X   0x84, 0x00, 0x15, 0x02, 0x44, 0x01, 0x14, 0x04, 0x68, 0x02, 0x12, 0x08,
X   0x90, 0x04, 0x59, 0x10, 0x20, 0x89, 0x4c, 0x20, 0x40, 0x52, 0x7e, 0x41,
X   0x80, 0x24, 0x32, 0x45, 0x00, 0x49, 0x18, 0x44, 0x00, 0x92, 0xc8, 0x44,
X   0x00, 0x24, 0x61, 0x26, 0x00, 0x4c, 0x23, 0x13, 0x00, 0x92, 0x02, 0x08,
X   0x00, 0x61, 0xc2, 0x04, 0x80, 0xc0, 0x03, 0x02, 0x40, 0x08, 0x06, 0x01,
X   0x20, 0x0c, 0x84, 0x00, 0x10, 0x40, 0x46, 0x00, 0x08, 0x66, 0x23, 0x00,
X   0xc4, 0x0e, 0x13, 0x00, 0x42, 0x0e, 0x09, 0x00, 0x42, 0xc0, 0x05, 0x00,
X   0x42, 0x40, 0x02, 0x00, 0x84, 0x08, 0x01, 0x00, 0x08, 0x87, 0x00, 0x00,
X   0x10, 0x42, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x40, 0x10, 0x00, 0x00,
X   0x80, 0x90, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/alix/piccy.icon || echo "restore of icons/alix/piccy.icon fails"
echo "x - extracting icons/alix/snail.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/snail.icon &&
X#define newpic_width 32
X#define newpic_height 32
Xstatic char newpic_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x08, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x04, 0x00, 0x00,
X   0x08, 0x0a, 0x00, 0x00, 0x10, 0x0e, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00,
X   0x20, 0x01, 0x00, 0x00, 0xf0, 0x01, 0x1f, 0x00, 0xa8, 0xc2, 0x71, 0x00,
X   0xa8, 0x64, 0xc0, 0x00, 0x08, 0x34, 0x80, 0x00, 0x48, 0x15, 0x06, 0x01,
X   0xd0, 0x14, 0x0d, 0x01, 0x20, 0x92, 0x18, 0x01, 0xc0, 0x93, 0x12, 0x02,
X   0x20, 0xbc, 0x13, 0x02, 0x20, 0x30, 0x18, 0x02, 0x10, 0xd0, 0x0c, 0x03,
X   0x10, 0x10, 0x03, 0x01, 0x10, 0x10, 0x80, 0x00, 0x20, 0x10, 0xc0, 0x07,
X   0x20, 0x10, 0x40, 0x08, 0x40, 0x10, 0x30, 0x10, 0x80, 0xef, 0xff, 0x1f,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 icons/alix/snail.icon || echo "restore of icons/alix/snail.icon fails"
echo "x - extracting icons/alix/wordc.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > icons/alix/wordc.icon &&
X#define pic998_width 32
X#define pic998_height 32
Xstatic char pic998_bits[] = {
X   0x00, 0x00, 0x20, 0x00, 0x82, 0x00, 0x20, 0x00, 0x82, 0x00, 0x20, 0x00,
X   0x82, 0x8c, 0x39, 0x00, 0x82, 0x52, 0x24, 0x00, 0x54, 0x52, 0x24, 0x00,
X   0x6c, 0x52, 0x24, 0x00, 0x44, 0x4c, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x06, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00,
X   0x00, 0x84, 0x07, 0x00, 0x00, 0x03, 0x18, 0x00, 0x80, 0x00, 0x30, 0x00,
X   0x40, 0x00, 0xc0, 0x01, 0x30, 0xc0, 0x00, 0x0e, 0x08, 0x20, 0x01, 0x10,
X   0x04, 0x00, 0x01, 0x20, 0x22, 0x80, 0x00, 0x20, 0x61, 0x40, 0x80, 0x41,
X   0x61, 0xe0, 0x41, 0x82, 0xa1, 0x00, 0x00, 0x82, 0x81, 0x00, 0x80, 0x81,
X   0x01, 0x01, 0x00, 0x82, 0x01, 0x05, 0x02, 0xc2, 0x01, 0x03, 0x06, 0x42,
X   0x82, 0x00, 0x0c, 0x21, 0x06, 0x00, 0xf8, 0x18, 0x3c, 0x00, 0x00, 0x0e,
X   0xe0, 0x01, 0x80, 0x03, 0x00, 0xff, 0x7f, 0x00};
SHAR_EOF
chmod 0644 icons/alix/wordc.icon || echo "restore of icons/alix/wordc.icon fails"
echo "x - extracting xdtmrc (Text)"
sed 's/^X//' << 'SHAR_EOF' > xdtmrc &&
X# -*- Mode: C -*-
X# This is an example .xdtmrc file.
X#
X# Edward Groenendaal.
X#
X
Xset path = "~/usr/xdtm/icons/eddy:~/usr/xdtm/icons/alix";
X
Xset checkpath=False;
X
Xset deficon="file.icon";
X
Xif (type==dir) {
X  set deficon="folder.icon";
X  #if (name=="^\.$") {
X  #  set icon="dot.icon";
X  #}
X  if (name=="^\.\.$") {
X    set icon="dotdot.icon";
X  }
X  if (name=="^\.$") {
X    set icon="folder.icon";
X  }
X  if (name=="^\..*") {
X    set ignore;
X  }
X  if (name=="^X11$") {
X    set icon="x.icon";
X  }
X}
X
Xif (type==file) {
X  set deficon="file.icon";
X  if (name=="^\..*") {
X    set ignore;
X  }
X  if (name=="^%.*") {
X    set ignore;
X  }
X  if (name=="^#.*#$") {
X    set ignore;
X  }
X if (type==exe) { 
X    set deficon="prog.icon";
X  if (name=="^\..*") {
X    set ignore;
X  }
X  if (name=="^%.*") {
X    set ignore;
X  }
X  if (name=="^#.*#$") {
X    set ignore;
X  }
X    if (name=="^xdtm$") {
X      set icon="xdtm.icon";
X    }
X  }
X# c source files
X  if (name==".*\.c[~]*$") {
X    set icon="ccode.icon";
X  }
X# object files
X  if (name==".*\.o[~]*$") {
X    set icon="ocode.icon";
X  }
X# c header files
X  if (name==".*\.h[~]*$") {
X    set icon="hcode.icon";
X  }
X# yacc source files
X  if (name==".*\.y[~]*$") {
X    set icon="ycode.icon";
X  }
X# lex source files
X  if (name==".*\.l[~]*$") {
X    set icon="lcode.icon";
X  }
X# emacs lisp files
X  if (name==".*\.el[~]*$") {
X    set icon="elisp.icon";
X  }
X  if (name=="^.emacs$") {
X    set icon="elisp.icon";
X  }
X  if (name==".*\.elc$") {
X    set icon="elispc.icon";
X  }
X# libraries
X  if (name==".*\.a$") {
X    set icon="lib.icon";
X  }
X# manual pages
X  set checkpath = True;
X  if (name==".*/man[1-8l]/.*") {
X    set deficon = "manpage.icon";
X  }
X  set checkpath = False;
X# compressed files
X  if (name==".*\.[ZF]$") {
X    set icon="z.icon";
X  }
X# Misc icons
X  if (name=="^[Mm]ake[fF]ile[~]*$") {
X      set icon="makefile.icon";
X  }
X  if (name=="^[iI][Mm]ake[Ff]ile[~]*$") {
X      set icon="makefile.icon";
X  }
X  if (name==".*\.icon[~]*$") {
X    set icon="icon.icon";
X  }
X  if (name=="^core$") {
X    set icon="core.icon";
X  }
X# application icons
X  if (name=="^xdtm$") {
X    set icon="xdtm.icon";
X  }
X  set checkpath = True;
X  if (name==".*/man[1-8l]/.*") {
X    set deficon = "manpage.icon";
X  }
X  set checkpath = False;
X}
X
X# application manager defaults
X
Xdefine "programming" = {
X  { name = "emacs";
X    icon = "emacs.icon";
X    prog = "xterm -T Emacs -e emacs !@";
X    options = MSEL;
X  }
X  {
X    name = "C Debugger";
X    icon = "prog.icon";
X    prog = "xterm -T 'Gnu C Debugger' -e gdb !@";
X    options = OSEL;
X  }
X  {
X    name = "Make All";
X    icon = "make.icon";
X    prog = "xterm -T 'Make All' -e sh -c 'make | less'";
X    options = NSEL;
X  }
X  {
X    name = "Make etags";
X    icon = "make.icon";
X    prog = "make etags";
X    options = NSEL;
X  }
X  {
X    name = "Make Clean";
X    icon = "make.icon";
X    prog = "make clean";
X    options = NSEL;
X  }
X}
Xdefine "misc" = {
X  { 
X    name = "X Clock";
X    icon = "clock.icon";
X    prog = "xclock";
X    options = NSEL;
X  }
X  {
X    name = "X Bitmap";
X    icon = "piccy.icon";
X    prog = "bitmap !@ -nodashed";
X    options = OSEL;
X  }
X}
X
Xdefine "games" = {
X  {
X    name = "Nethack";
X    icon = "ghost.icon";
X    prog = "xterm -T 'Nethack' -e nethack";
X    options = NSEL;
X  }
X}
X
Xdefine "editing" = {
X  {
X    name = "X Terminal";
X    icon = "prog.icon";
X    prog = "xterm -T 'X Terminal'";
X    options = NSEL;
X  }
X  {
X    name = "Spell Check";
X    icon = "prog.icon";
X    prog = "xterm -T 'Spell Check' -e ispell !@";
X    options = MSEL;
X  }
X  {
X    name = "Edit : vi";
X    icon = "dragon.icon";
X    prog = "xterm -T 'Vi' -e vi !@";
X    options = OSEL;
X  }
X  {
X    name = "Edit : Emacs";
X    icon = "emacs.icon";
X    prog = "xterm -T 'Emacs' -e emacs !@";
X    options = MSEL;
X  }
X  {
X    name = "Edit : Ved";
X    icon = "alien.icon";
X    prog = "xved !@";
X    options = OSEL;
X  }
X  {
X    name = "Word Count";
X    icon = "candle.icon";
X    prog = "xterm -T 'Word Count' -e sh -c 'wc !@ | less'";
X    options = MSEL;
X  }
X}
X
Xdefine "rlogins" = {
X  {
X    name = "TSUNA";
X    icon = "fish.icon";
X    prog = "xterm -e xrlogin tsuna";
X    options = NSEL;
X  }
X  {
X    name = "CSTE";
X    icon = "snail.icon";
X    prog = "xterm -e xrlogin cste";
X    options = NSEL;
X  }
X  {
X    name = "LUCRETIA";
X    icon = "mermaid.icon";
X    prog = "xterm -e rlogin lucretia";
X    options = NSEL;
X  }
X}
SHAR_EOF
chmod 0644 xdtmrc || echo "restore of xdtmrc fails"
echo "x - extracting code/bitmaps/Copy.Button (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/bitmaps/Copy.Button &&
X#define copy_width 30
X#define copy_height 40
Xstatic char copy_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0xfe, 0x01, 0xfe, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x05, 0x02, 0x05,
X   0x02, 0x09, 0x02, 0x09, 0x02, 0x1f, 0x02, 0x1f, 0x02, 0x10, 0x02, 0x10,
X   0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x50, 0x02, 0x10,
X   0x02, 0xd0, 0x02, 0x10, 0x02, 0xf0, 0x03, 0x10, 0x02, 0xd0, 0x02, 0x10,
X   0x02, 0x50, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10,
X   0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10,
X   0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10,
X   0x02, 0x10, 0x02, 0x10, 0xfe, 0x1f, 0xfe, 0x1f, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x70, 0x9c, 0x67, 0x03, 0xf8, 0xbe, 0x6f, 0x03, 0xd8, 0xb6, 0x6d, 0x03,
X   0x18, 0xb6, 0x6d, 0x03, 0x18, 0xb6, 0xef, 0x03, 0x18, 0xb6, 0xc7, 0x03,
X   0xd8, 0xb6, 0x01, 0x03, 0xf8, 0xbe, 0xe1, 0x03, 0x70, 0x9c, 0xe1, 0x01,
X   0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 code/bitmaps/Copy.Button || echo "restore of code/bitmaps/Copy.Button fails"
echo "x - extracting code/bitmaps/Copy.Cursor (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/bitmaps/Copy.Cursor &&
X#define CopyC_width 20
X#define CopyC_height 20
X#define CopyC_x_hot 9
X#define CopyC_y_hot 6
Xstatic char CopyC_bits[] = {
X   0x00, 0x00, 0x00, 0x3e, 0xf0, 0x01, 0x62, 0x10, 0x03, 0xe2, 0x10, 0x07,
X   0x82, 0x12, 0x04, 0x82, 0x16, 0x04, 0x82, 0x1f, 0x04, 0x82, 0x16, 0x04,
X   0x82, 0x12, 0x04, 0x82, 0x10, 0x04, 0x82, 0x10, 0x04, 0xfe, 0xf0, 0x07,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x39, 0x05, 0x52, 0x4a, 0x05,
X   0x42, 0x3a, 0x02, 0x52, 0x0a, 0x02, 0x8c, 0x09, 0x02, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 code/bitmaps/Copy.Cursor || echo "restore of code/bitmaps/Copy.Cursor fails"
echo "x - extracting code/bitmaps/Copy.Mask (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/bitmaps/Copy.Mask &&
X#define CopyM_width 20
X#define CopyM_height 20
Xstatic char CopyM_bits[] = {
X   0x3f, 0xf8, 0x01, 0x7f, 0xf8, 0x03, 0xff, 0xf8, 0x07, 0xff, 0xfb, 0x0f,
X   0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f,
X   0xff, 0xff, 0x0f, 0xff, 0xfb, 0x0f, 0xff, 0xf9, 0x0f, 0xff, 0xf9, 0x0f,
X   0xff, 0xf9, 0x0f, 0xde, 0xff, 0x0f, 0xfe, 0xff, 0x0f, 0xff, 0xff, 0x0f,
X   0xff, 0x7f, 0x07, 0xff, 0x7f, 0x07, 0xfe, 0x1f, 0x07, 0xde, 0x1f, 0x07};
SHAR_EOF
chmod 0644 code/bitmaps/Copy.Mask || echo "restore of code/bitmaps/Copy.Mask fails"
echo "x - extracting code/bitmaps/EmptyTick (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/bitmaps/EmptyTick &&
X#define EmptyTick_width 14
X#define EmptyTick_height 14
Xstatic char EmptyTick_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 code/bitmaps/EmptyTick || echo "restore of code/bitmaps/EmptyTick fails"
echo "x - extracting code/bitmaps/Grey.Mask (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/bitmaps/Grey.Mask &&
X#define Grey_width 32
X#define Grey_height 32
Xstatic char Grey_bits[] = {
X   0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
X   0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa,
X   0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
X   0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa,
X   0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
X   0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa,
X   0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
X   0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa,
X   0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
X   0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa,
X   0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa};
SHAR_EOF
chmod 0644 code/bitmaps/Grey.Mask || echo "restore of code/bitmaps/Grey.Mask fails"
echo "x - extracting code/bitmaps/Move.Button (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/bitmaps/Move.Button &&
X#define move_width 30
X#define move_height 40
Xstatic char move_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0xaa, 0x00, 0xfe, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x04, 0x02, 0x05,
X   0x00, 0x01, 0x02, 0x09, 0x02, 0x0a, 0x02, 0x1f, 0x00, 0x10, 0x02, 0x10,
X   0x02, 0x00, 0x02, 0x10, 0x00, 0x10, 0x02, 0x10, 0x02, 0x40, 0x02, 0x10,
X   0x00, 0xd0, 0x02, 0x10, 0x02, 0xe0, 0x03, 0x10, 0x00, 0xd0, 0x02, 0x10,
X   0x02, 0x40, 0x02, 0x10, 0x00, 0x10, 0x02, 0x10, 0x02, 0x00, 0x02, 0x10,
X   0x00, 0x10, 0x02, 0x10, 0x02, 0x00, 0x02, 0x10, 0x00, 0x10, 0x02, 0x10,
X   0x02, 0x00, 0x02, 0x10, 0x00, 0x10, 0x02, 0x10, 0x02, 0x00, 0x02, 0x10,
X   0x00, 0x10, 0x02, 0x10, 0xaa, 0x0a, 0xfe, 0x1f, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x18, 0x73, 0xb6, 0x0f, 0xb8, 0xfb, 0xb6, 0x0f, 0xf8, 0xdb, 0xb6, 0x01,
X   0x58, 0xdb, 0xb6, 0x07, 0x18, 0xdb, 0xb6, 0x07, 0x18, 0xdb, 0xb6, 0x01,
X   0x18, 0xdb, 0xbe, 0x01, 0x18, 0xfb, 0x9c, 0x0f, 0x18, 0x73, 0x88, 0x0f,
X   0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 code/bitmaps/Move.Button || echo "restore of code/bitmaps/Move.Button fails"
echo "x - extracting code/bitmaps/Move.Cursor (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/bitmaps/Move.Cursor &&
X#define MoveC_width 20
X#define MoveC_height 20
X#define MoveC_x_hot 9
X#define MoveC_y_hot 6
Xstatic char MoveC_bits[] = {
X   0x00, 0x00, 0x00, 0x2a, 0xf0, 0x01, 0x40, 0x10, 0x03, 0xa2, 0x10, 0x07,
X   0x00, 0x12, 0x04, 0x82, 0x16, 0x04, 0x00, 0x1f, 0x04, 0x82, 0x16, 0x04,
X   0x00, 0x12, 0x04, 0x82, 0x10, 0x04, 0x00, 0x10, 0x04, 0xaa, 0xf0, 0x07,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x53, 0x07, 0xb6, 0x54, 0x01,
X   0xaa, 0x54, 0x03, 0xa2, 0x54, 0x01, 0x22, 0x23, 0x07, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 code/bitmaps/Move.Cursor || echo "restore of code/bitmaps/Move.Cursor fails"
echo "x - extracting code/bitmaps/Move.Mask (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/bitmaps/Move.Mask &&
X#define MoveM_width 20
X#define MoveM_height 20
Xstatic char MoveM_bits[] = {
X   0x3f, 0xf8, 0x01, 0x7f, 0xf8, 0x03, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0x0f,
X   0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f,
X   0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xf9, 0x0f, 0xff, 0xf9, 0x0f,
X   0xff, 0xf9, 0x0f, 0x77, 0xfb, 0x0f, 0xf7, 0xff, 0x0f, 0xff, 0xff, 0x0f,
X   0xff, 0xff, 0x07, 0xff, 0xff, 0x0f, 0xf7, 0xff, 0x0f, 0xf7, 0x77, 0x0f};
SHAR_EOF
chmod 0644 code/bitmaps/Move.Mask || echo "restore of code/bitmaps/Move.Mask fails"
echo "x - extracting code/bitmaps/Tick (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/bitmaps/Tick &&
X#define tick_width 14
X#define tick_height 14
Xstatic char tick_bits[] = {
X   0x00, 0x00, 0x00, 0x20, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x03,
X   0x8c, 0x03, 0xde, 0x01, 0xff, 0x01, 0xfe, 0x00, 0xfc, 0x00, 0x78, 0x00,
X   0x70, 0x00, 0x20, 0x00};
SHAR_EOF
chmod 0644 code/bitmaps/Tick || echo "restore of code/bitmaps/Tick fails"
echo "x - extracting code/bitmaps/Trash.Button (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/bitmaps/Trash.Button &&
X#define trash_width 30
X#define trash_height 40
Xstatic char trash_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x10, 0x02, 0x00,
X   0xf0, 0xff, 0xff, 0x01, 0x10, 0x00, 0x00, 0x01, 0xf0, 0xff, 0xff, 0x01,
X   0x20, 0x00, 0x80, 0x00, 0xa0, 0x44, 0xa4, 0x00, 0xa0, 0x44, 0xa4, 0x00,
X   0xa0, 0x44, 0xa4, 0x00, 0xa0, 0x44, 0xa4, 0x00, 0xa0, 0x44, 0xa4, 0x00,
X   0xa0, 0x44, 0xa4, 0x00, 0xa0, 0x44, 0xa4, 0x00, 0xa0, 0x44, 0xa4, 0x00,
X   0xa0, 0x44, 0xa4, 0x00, 0xa0, 0x44, 0xa4, 0x00, 0xa0, 0x44, 0xa4, 0x00,
X   0xa0, 0x44, 0xa4, 0x00, 0xa0, 0x44, 0xa4, 0x00, 0xa0, 0x44, 0xa4, 0x00,
X   0xa0, 0x44, 0xa4, 0x00, 0xa0, 0x44, 0xa4, 0x00, 0xa0, 0x44, 0xa4, 0x00,
X   0xa0, 0x44, 0xa4, 0x00, 0xa0, 0x44, 0xa4, 0x00, 0xa0, 0x44, 0xa4, 0x00,
X   0x20, 0x00, 0x80, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0xde, 0xe3, 0x38, 0x1b, 0xde, 0xf7, 0x7d, 0x1b, 0xcc, 0xb6, 0x6d, 0x1b,
X   0xcc, 0xb6, 0x1d, 0x1f, 0xcc, 0xf3, 0x39, 0x1f, 0xcc, 0xf7, 0x71, 0x1b,
X   0xcc, 0xb6, 0x6d, 0x1b, 0xcc, 0xb6, 0x7d, 0x1b, 0xcc, 0xb6, 0x39, 0x1b,
X   0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 code/bitmaps/Trash.Button || echo "restore of code/bitmaps/Trash.Button fails"
echo "x - extracting code/bitmaps/file.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/bitmaps/file.icon &&
X#define file_width 32
X#define file_height 32
Xstatic char file_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x10, 0x00, 0x40, 0x01,
X   0x10, 0x00, 0x40, 0x02, 0x10, 0x00, 0x40, 0x04, 0x10, 0x00, 0xc0, 0x0f,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
chmod 0644 code/bitmaps/file.icon || echo "restore of code/bitmaps/file.icon fails"
echo "x - extracting code/bitmaps/folder.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/bitmaps/folder.icon &&
X#define folder_width 32
X#define folder_height 32
Xstatic char folder_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x02, 0x08,
X   0xfe, 0xff, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
X   0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00};
SHAR_EOF
chmod 0644 code/bitmaps/folder.icon || echo "restore of code/bitmaps/folder.icon fails"
echo "x - extracting code/Xedw/DefIcon.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/DefIcon.icon &&
X/* Mode identifier for Emacs -*- Mode: C -*- */
SHAR_EOF
echo "End of part 5"
echo "File code/Xedw/DefIcon.icon is continued in part 6"
echo "6" > s2_seq_.tmp
exit 0

eddyg@syma.sussex.ac.uk (Edward J. Groenendaal) (04/18/91)

---- Cut Here and unpack ----
#!/bin/sh
# this is part 6 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file code/Xedw/DefIcon.icon continued
#
CurArch=6
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file code/Xedw/DefIcon.icon"
sed 's/^X//' << 'SHAR_EOF' >> code/Xedw/DefIcon.icon
X
X#define default_width 32
X#define default_height 32
Xstatic char default_bits[] = {
X   0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x10, 0x00, 0x40, 0x01,
X   0x10, 0x00, 0x40, 0x02, 0x10, 0x00, 0x40, 0x04, 0x10, 0x00, 0xc0, 0x0f,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
SHAR_EOF
echo "File code/Xedw/DefIcon.icon is complete"
chmod 0644 code/Xedw/DefIcon.icon || echo "restore of code/Xedw/DefIcon.icon fails"
echo "x - extracting code/Xedw/Imakefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/Imakefile &&
XCC=gcc
XCFLAGS=-g
XSRCS=XedwForm.c XedwList.c
XOBJS=XedwForm.o XedwList.o
X
XNormalLibraryTarget(Xedw, $(OBJS))
SHAR_EOF
chmod 0644 code/Xedw/Imakefile || echo "restore of code/Xedw/Imakefile fails"
echo "x - extracting code/Xedw/Makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/Makefile &&
X# Makefile generated by imake - do not edit!
X# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $
X#
X# The cpp used on this machine replaces all newlines and multiple tabs and
X# spaces in a macro expansion with a single space.  Imake tries to compensate
X# for this, but is not always successful.
X#
X
X###########################################################################
X# Makefile generated from "Imake.tmpl" and <Imakefile>
X# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $
X#
X# Platform-specific parameters may be set in the appropriate .cf
X# configuration files.  Site-wide parameters may be set in the file
X# site.def.  Full rebuilds are recommended if any parameters are changed.
X#
X# If your C preprocessor doesn't define any unique symbols, you'll need
X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
X# "make Makefile", "make Makefiles", or "make World").
X#
X# If you absolutely can't get imake to work, you'll need to set the
X# variables at the top of each Makefile as well as the dependencies at the
X# bottom (makedepend will do this automatically).
X#
X
X###########################################################################
X# platform-specific configuration parameters - edit macII.cf to change
X
X# platform:  $XConsortium: macII.cf,v 1.16 89/12/22 15:50:50 rws Exp $
X# operating system:  A/UX 2.0
X
X###########################################################################
X# site-specific configuration parameters - edit site.def to change
X
X# site:  $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $
X
X            SHELL = /bin/sh
X
X              TOP = .
X      CURRENT_DIR = .
X
X               AR = ar cq
X  BOOTSTRAPCFLAGS = -DmacII
X               CC = gcc -DNOSTDHDRS
X
X         COMPRESS = compress
X              CPP = /lib/cpp $(STD_CPP_DEFINES)
X    PREPROCESSCMD = gcc -DNOSTDHDRS -E $(STD_CPP_DEFINES)
X          INSTALL = install
X               LD = ld
X             LINT = lint
X      LINTLIBFLAG = -o
X         LINTOPTS = -ax
X               LN = ln -s
X             MAKE = make
X               MV = mv
X               CP = cp
X           RANLIB = /bin/true
X  RANLIBINSTFLAGS =
X               RM = rm -f
X     STD_INCLUDES = -I/usr/local/Gnu/lib/gcc-include
X  STD_CPP_DEFINES = -DmacII -DSYSV
X      STD_DEFINES = -DmacII -DSYSV -D_SYSV_SOURCE -D_BSD_SOURCE
X            STRIP = strip
X EXTRA_LOAD_FLAGS =
X  EXTRA_LIBRARIES =
X             TAGS = ctags
X
X           MFLAGS = -$(MAKEFLAGS)
X
X   SIGNAL_DEFINES = -DSIGNALRETURNSINT
X
X    PROTO_DEFINES =
X
X     INSTPGMFLAGS = -u bin -g sysprog -m 0775
X
X     INSTBINFLAGS = -u bin -g sysprog -m 0775
X     INSTUIDFLAGS = -u bin -g sysprog -m 4775
X     INSTLIBFLAGS = -u bin -g sysprog -m 0664
X     INSTINCFLAGS = -u bin -g sysprog -m 0444
X     INSTMANFLAGS = -u bin -g sysprog -m 0444
X     INSTDATFLAGS = -u bin -g sysprog -m 0444
X    INSTKMEMFLAGS = -u bin -g sysprog -m 4775
X
X          DESTDIR = /usr
X
X     TOP_INCLUDES = -I$(INCROOT)
X
X      CDEBUGFLAGS = -O
X        CCOPTIONS =
X      COMPATFLAGS =
X
X      ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES)
X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS)
X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)
X   LDCOMBINEFLAGS = -X -r
X
X        MACROFILE = macII.cf
X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut *-
X
X    IMAKE_DEFINES =
X
X         IRULESRC = $(CONFIGDIR)
X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
X
X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
X			$(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
X			$(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
X
X###########################################################################
X# X Window System Build Parameters
X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X###########################################################################
X# X Window System make variables; this need to be coordinated with rules
X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X          PATHSEP = /
X        USRLIBDIR = $(DESTDIR)/lib
X           BINDIR = /usr/local/bin/X11
X          INCROOT = $(DESTDIR)/include
X     BUILDINCROOT = $(TOP)
X      BUILDINCDIR = $(BUILDINCROOT)/X11
X      BUILDINCTOP = ..
X           INCDIR = $(INCROOT)/X11
X           ADMDIR = $(DESTDIR)/adm
X           LIBDIR = $(USRLIBDIR)/X11
X        CONFIGDIR = $(LIBDIR)/config
X       LINTLIBDIR = $(USRLIBDIR)/lint
X
X          FONTDIR = $(LIBDIR)/fonts
X         XINITDIR = $(LIBDIR)/xinit
X           XDMDIR = $(LIBDIR)/xdm
X           AWMDIR = $(LIBDIR)/awm
X           TWMDIR = $(LIBDIR)/twm
X           GWMDIR = $(LIBDIR)/gwm
X          MANPATH = /usr/local/catman/x_man
X    MANSOURCEPATH = $(MANPATH)/man
X           MANDIR = $(MANSOURCEPATH)1
X        LIBMANDIR = $(MANSOURCEPATH)3
X      XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X       FONTCFLAGS = -t
X
X     INSTAPPFLAGS = $(INSTDATFLAGS)
X
X            IMAKE = imake
X           DEPEND = makedepend
X              RGB = rgb
X            FONTC = bdftosnf
X        MKFONTDIR = mkfontdir
X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh
X
X        CONFIGSRC = $(TOP)/config
X        CLIENTSRC = $(TOP)/clients
X          DEMOSRC = $(TOP)/demos
X           LIBSRC = $(TOP)/lib
X          FONTSRC = $(TOP)/fonts
X       INCLUDESRC = $(TOP)/X11
X        SERVERSRC = $(TOP)/server
X          UTILSRC = $(TOP)/util
X        SCRIPTSRC = $(UTILSRC)/scripts
X       EXAMPLESRC = $(TOP)/examples
X       CONTRIBSRC = $(TOP)/../contrib
X           DOCSRC = $(TOP)/doc
X           RGBSRC = $(TOP)/rgb
X        DEPENDSRC = $(UTILSRC)/makedepend
X         IMAKESRC = $(CONFIGSRC)
X         XAUTHSRC = $(LIBSRC)/Xau
X          XLIBSRC = $(LIBSRC)/X
X           XMUSRC = $(LIBSRC)/Xmu
X       TOOLKITSRC = $(LIBSRC)/Xt
X       AWIDGETSRC = $(LIBSRC)/Xaw
X       OLDXLIBSRC = $(LIBSRC)/oldX
X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
X     MKFONTDIRSRC = $(FONTSRC)/mkfontdir
X     EXTENSIONSRC = $(TOP)/extensions
X
X  DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a
X     EXTENSIONLIB =  -lXext
X
X          DEPXLIB = $(DEPEXTENSIONLIB) $(USRLIBDIR)/libX11.a
X             XLIB = $(EXTENSIONLIB)  -lX11
X
X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
X         XAUTHLIB =  -lXau
X
X        DEPXMULIB = $(USRLIBDIR)/libXmu.a
X           XMULIB =  -lXmu
X
X       DEPOLDXLIB = $(USRLIBDIR)/liboldX.a
X          OLDXLIB =  -loldX
X
X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.a
X         XTOOLLIB =  -lXt
X
X        DEPXAWLIB = $(USRLIBDIR)/libXaw.a
X           XAWLIB =  -lXaw
X
X LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln
X         LINTXLIB = $(USRLIBDIR)/llib-lX11.ln
X          LINTXMU = $(USRLIBDIR)/llib-lXmu.ln
X        LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln
X          LINTXAW = $(USRLIBDIR)/llib-lXaw.ln
X
X        XWLIBSRC = $(CONTRIBSRC)/toolkits/Xw
X        DEPXWLIB = $(USRLIBDIR)/libXw.a
X        XWLIB =  -lXw
X
X          DEPLIBS = $(LOCAL_LIBRARIES)
X
X         DEPLIBS1 = $(DEPLIBS)
X         DEPLIBS2 = $(DEPLIBS)
X         DEPLIBS3 = $(DEPLIBS)
X
X###########################################################################
X# Imake rules for building libraries, programs, scripts, and data files
X# rules:  $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $
X
X###########################################################################
X# start of Imakefile
X
XCFLAGS=-s -O
XSRCS=XedwForm.c XedwList.c
XOBJS=XedwForm.o XedwList.o
X
Xall:: libXedw.a
X
XlibXedw.a:  $(OBJS)
X	$(RM) $@
X	$(AR) $@  $(OBJS)
X	$(RANLIB) $@
X
X###########################################################################
X# common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X	$(RM_CMD) \#*
X
XMakefile::
X	-@if [ -f Makefile ]; then \
X	echo "	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X	else exit 0; fi
X	$(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
X
Xtags::
X	$(TAGS) -w *.[ch]
X	$(TAGS) -xw *.[ch] > TAGS
X
X###########################################################################
X# empty rules for directories that do not have SUBDIRS - do not edit
X
Xinstall::
X	@echo "install in $(CURRENT_DIR) done"
X
Xinstall.man::
X	@echo "install.man in $(CURRENT_DIR) done"
X
XMakefiles::
X
Xincludes::
X
X###########################################################################
X# dependencies generated by makedepend
X
SHAR_EOF
chmod 0644 code/Xedw/Makefile || echo "restore of code/Xedw/Makefile fails"
echo "x - extracting code/Xedw/XedwForm.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/XedwForm.c &&
X#include <X11/copyright.h>
X
X/*****************************************************************************
X * XedwForm is a modified version of the Athena Widget Form.
X * Added capabilities :
X *  1) Children may chose not to be resized in any particular plane.
X *  2) Children may chose to extend their widths to the edge of the application.
X *  3) Children may have linked widths and heights.
X * The default is that these capabilities are turned off.
X * See XedwForm.h for resource list.
X *
X * Edward Groenendaal, 20th Feb 1991.
X *
X * Changes to the original source :
X *      1) Changed all references of Form to XedwForm and form to xedwForm.
X *      2) Added resources
X *      3) Rewrote Resize(), Layout() and LayoutChild().
X *****************************************************************************/
X
X#include <X11/IntrinsicP.h>
X#include <X11/StringDefs.h>
X#include <X11/Xmu/Converters.h>
X#include <X11/Xmu/CharSet.h>
X#include <X11/Xaw/XawInit.h>
X#include "XedwFormP.h"
X
X/* Private Definitions */
X
Xstatic int default_value = -99999;
X
X#define Offset(field) XtOffset(XedwFormWidget, xedwForm.field)
Xstatic XtResource resources[] = {
X    {XtNdefaultDistance, XtCThickness, XtRInt, sizeof(int),
X        Offset(default_spacing), XtRImmediate, (caddr_t)4}
X};
X#undef Offset
X
Xstatic XtEdgeType defEdge = XtRubber;
X
X#define Offset(field) XtOffset(XedwFormConstraints, xedwForm.field)
Xstatic XtResource xedwFormConstraintResources[] = {
X  {XtNtop, XtCEdge, XtREdgeType, sizeof(XtEdgeType),
X     Offset(top), XtREdgeType, (XtPointer)&defEdge},
X  {XtNbottom, XtCEdge, XtREdgeType, sizeof(XtEdgeType),
X     Offset(bottom), XtREdgeType, (XtPointer)&defEdge},
X  {XtNleft, XtCEdge, XtREdgeType, sizeof(XtEdgeType),
X     Offset(left), XtREdgeType, (XtPointer)&defEdge},
X  {XtNright, XtCEdge, XtREdgeType, sizeof(XtEdgeType),
X     Offset(right), XtREdgeType, (XtPointer)&defEdge},
X  {XtNhorizDistance, XtCThickness, XtRInt, sizeof(int),
X     Offset(dx), XtRInt, (XtPointer) &default_value},
X  {XtNfromHoriz, XtCWidget, XtRWidget, sizeof(Widget),
X     Offset(horiz_base), XtRWidget, (XtPointer)NULL},
X  {XtNvertDistance, XtCThickness, XtRInt, sizeof(int),
X     Offset(dy), XtRInt, (XtPointer) &default_value},
X  {XtNfromVert, XtCWidget, XtRWidget, sizeof(Widget),
X     Offset(vert_base), XtRWidget, (XtPointer)NULL},
X  {XtNrubberWidth, XtCBoolean, XtRBoolean, sizeof(Boolean),    /* new */
X     Offset(rubber_width), XtRImmediate, (XtPointer) True},
X  {XtNrubberHeight, XtCBoolean, XtRBoolean, sizeof(Boolean),   /* new */
X     Offset(rubber_height), XtRImmediate, (XtPointer) True},
X  {XtNfullWidth, XtCBoolean, XtRBoolean, sizeof(Boolean),      /* new */
X     Offset(full_width), XtRImmediate, (XtPointer) False},
X  {XtNfullHeight, XtCBoolean, XtRBoolean, sizeof(Boolean),     /* new */
X     Offset(full_height), XtRImmediate, (XtPointer) False},
X  {XtNwidthLinked, XtCWidget, XtRWidget, sizeof(Widget),
X     Offset(width_link), XtRWidget, (XtPointer)NULL},         /* new */
X  {XtNheightLinked, XtCWidget, XtRWidget, sizeof(Widget),
X     Offset(height_link), XtRWidget, (XtPointer)NULL},        /* new */
X  {XtNresizable, XtCBoolean, XtRBoolean, sizeof(Boolean),
X     Offset(allow_resize), XtRImmediate, (XtPointer) FALSE},
X};
X#undef Offset
X
Xstatic void ClassInitialize(), ClassPartInitialize(), Initialize(), Resize();
Xstatic void ConstraintInitialize();
Xstatic Boolean SetValues(), ConstraintSetValues();
Xstatic XtGeometryResult GeometryManager(), PreferredGeometry();
Xstatic void ChangeManaged();
Xstatic Boolean Layout(XedwFormWidget, Dimension, Dimension);
X
XXedwFormClassRec xedwFormClassRec = {
X  { /* core_class fields */
X    /* superclass         */    (WidgetClass) &constraintClassRec,
X    /* class_name         */    "XedwForm",
X    /* widget_size        */    sizeof(XedwFormRec),
X    /* class_initialize   */    ClassInitialize,
X    /* class_part_init    */    ClassPartInitialize,
X    /* class_inited       */    FALSE,
X    /* initialize         */    Initialize,
X    /* initialize_hook    */    NULL,
X    /* realize            */    XtInheritRealize,
X    /* actions            */    NULL,
X    /* num_actions        */    0,
X    /* resources          */    resources,
X    /* num_resources      */    XtNumber(resources),
X    /* xrm_class          */    NULLQUARK,
X    /* compress_motion    */    TRUE,
X    /* compress_exposure  */    TRUE,
X    /* compress_enterleave*/    TRUE,
X    /* visible_interest   */    FALSE,
X    /* destroy            */    NULL,
X    /* resize             */    Resize,                      /* new */
X    /* expose             */    XtInheritExpose,
X    /* set_values         */    SetValues,
X    /* set_values_hook    */    NULL,
X    /* set_values_almost  */    XtInheritSetValuesAlmost,
X    /* get_values_hook    */    NULL,
X    /* accept_focus       */    NULL,
X    /* version            */    XtVersion,
X    /* callback_private   */    NULL,
X    /* tm_table           */    NULL,
X    /* query_geometry     */    PreferredGeometry,
X    /* display_accelerator*/    XtInheritDisplayAccelerator,
X    /* extension          */    NULL
X  },
X  { /* composite_class fields */
X    /* geometry_manager   */   GeometryManager,
X    /* change_managed     */   ChangeManaged,
X    /* insert_child       */   XtInheritInsertChild,
X    /* delete_child       */   XtInheritDeleteChild,
X    /* extension          */   NULL
X  },
X  { /* constraint_class fields */
X    /* subresourses       */   xedwFormConstraintResources,
X    /* subresource_count  */   XtNumber(xedwFormConstraintResources),
X    /* constraint_size    */   sizeof(XedwFormConstraintsRec),
X    /* initialize         */   ConstraintInitialize,
X    /* destroy            */   NULL,
X    /* set_values         */   ConstraintSetValues,
X    /* extension          */   NULL
X  },
X  { /* xedwForm_class fields */
X    /* layout             */   Layout                        
X  }
X};
X
XWidgetClass xedwFormWidgetClass = (WidgetClass)&xedwFormClassRec;
X
X/****************************************************************
X *
X * Private Procedures
X *
X ****************************************************************/
X
X
Xstatic XrmQuark XtQChainLeft, XtQChainRight, XtQChainTop,
X  XtQChainBottom, XtQRubber;
X
X#define done(address, type) \
X{ toVal->size = sizeof(type); \
X  toVal->addr = (caddr_t) address; \
X  return; \
X}
X
Xstatic void _CvtStringToEdgeType(XrmValuePtr args, 
X				 Cardinal *num_args, 
X				 XrmValuePtr fromVal, 
X				 XrmValuePtr toVal)
X{
X  static XtEdgeType edgeType;
X  XrmQuark q;
X  char lowerName[1000];
X
X  XmuCopyISOLatin1Lowered (lowerName, (char*)fromVal->addr);
X  q = XrmStringToQuark(lowerName);
X  if (q == XtQChainLeft) {
X    edgeType = XtChainLeft;
X    done(&edgeType, XtEdgeType);
X  }
X  if (q == XtQChainRight) {
X    edgeType = XtChainRight;
X    done(&edgeType, XtEdgeType);
X  }
X  if (q == XtQChainTop) {
X    edgeType = XtChainTop;
X    done(&edgeType, XtEdgeType);
X  }
X  if (q == XtQChainBottom) {
X    edgeType = XtChainBottom;
X    done(&edgeType, XtEdgeType);
X  }
X  if (q == XtQRubber) {
X    edgeType = XtRubber;
X    done(&edgeType, XtEdgeType);
X  }
X  XtStringConversionWarning(fromVal->addr, "edgeType");
X  toVal->addr = NULL;
X  toVal->size = 0;
X}
X
Xstatic void ClassInitialize(void)
X{
X  static XtConvertArgRec parentCvtArgs[] = {
X    {XtBaseOffset, (caddr_t)XtOffset(Widget, core.parent), sizeof(Widget)}
X  };
X  XawInitializeWidgetSet();
X  XtQChainLeft   = XrmStringToQuark("chainleft");
X  XtQChainRight  = XrmStringToQuark("chainright");
X  XtQChainTop    = XrmStringToQuark("chaintop");
X  XtQChainBottom = XrmStringToQuark("chainbottom");
X  XtQRubber      = XrmStringToQuark("rubber");
X  
X  XtAddConverter( XtRString, XtREdgeType, _CvtStringToEdgeType, NULL, 0 );
X  XtAddConverter( XtRString, XtRWidget, XmuCvtStringToWidget,
X		 parentCvtArgs, XtNumber(parentCvtArgs) );
X}
X
Xstatic void ClassPartInitialize(WidgetClass class)
X{
X  register XedwFormWidgetClass c = (XedwFormWidgetClass)class;
X
X  if (((Boolean (*)())c->xedwForm_class.layout) ==  XtInheritLayout)
X    c->xedwForm_class.layout = Layout;
X}
X
X
Xstatic void Initialize(Widget request, Widget new)
X{
X  XedwFormWidget fw = (XedwFormWidget)new;
X
X  fw->xedwForm.old_width = fw->core.width;
X  fw->xedwForm.old_height = fw->core.height;
X  fw->xedwForm.no_refigure = False;
X  fw->xedwForm.needs_relayout = False;
X  fw->xedwForm.resize_in_layout = True;
X}
X
X
Xstatic void RefigureLocations(XedwFormWidget w)
X{
X  if (w->xedwForm.no_refigure) {
X    w->xedwForm.needs_relayout = True;
X  } else {
X    (*((XedwFormWidgetClass)w->core.widget_class)->xedwForm_class.layout)
X      ( w, w->core.width, w->core.height );
X    w->xedwForm.needs_relayout = False;
X  }
X}
X
Xstatic Boolean Layout(XedwFormWidget fw, Dimension width, Dimension height)
X{
X  int num_children = fw->composite.num_children;
X  WidgetList children = fw->composite.children;
X  Widget *childP;
X  Position maxx, maxy;
X  static void LayoutChild();
X  Boolean ret_val;
X  
X  for (childP = children; childP - children < num_children; childP++) {
X    XedwFormConstraints xedwForm =
X      (XedwFormConstraints)(*childP)->core.constraints;
X    xedwForm->xedwForm.layout_state = LayoutPending;
X  }
X
X  maxx = maxy = 1;
X  for (childP = children; childP - children < num_children; childP++) {
X    if (XtIsManaged(*childP)) {
X      Position x, y;
X      LayoutChild(*childP);
X      x = (*childP)->core.x + (*childP)->core.width
X	+ ((*childP)->core.border_width << 1);
X      y = (*childP)->core.y + (*childP)->core.height
X	+ ((*childP)->core.border_width << 1);
X      if (maxx < x) maxx = x;  /* Track width  */
X      if (maxy < y) maxy = y;  /* Track Height */
X    }
X  }
X
X  /* I want to be this big */
X  fw->xedwForm.preferred_width = (maxx += fw->xedwForm.default_spacing);
X  fw->xedwForm.preferred_height = (maxy += fw->xedwForm.default_spacing);
X
X  /* Go back and check to see if any widgets want to be full height or
X   * full width, if so, do it, dont recalculate sizes, assume the programmer
X   * didn't make any silly mistakes like putting another widget to the right
X   * of a full width one. EG.
X   * Should really do this in one pass. 
X   */
X
X  for (childP = children; childP - children < num_children; childP++) {
X    XedwFormConstraints form = (XedwFormConstraints)(*childP)->core.constraints;
X    Position newwidth  = (Position)(*childP)->core.width;
X    Position newheight = (Position)(*childP)->core.height;
X    if (form->xedwForm.full_width == True)
X      form->xedwForm.virtual_width = newwidth = 
X	(maxx - ((form->xedwForm.dx) + 
X		 ((*childP)->core.border_width * 2) + 
X		 ((*childP)->core.x)));
X    if (form->xedwForm.full_height == True)
X      form->xedwForm.virtual_height = newheight = 
X	(maxy - ((form->xedwForm.dy) + 
X		 ((*childP)->core.border_width * 2) +
X		 ((*childP)->core.y)));
X    /* Resize the widget if it has been changed. XtResizeWidget does the checking */
X    XtResizeWidget(*childP, newwidth, newheight, (*childP)->core.border_width);
X  }
X  
X  if (fw->xedwForm.resize_in_layout
X      && (maxx != fw->core.width || maxy != fw->core.height)) {
X    XtGeometryResult result;
X    result = XtMakeResizeRequest(fw, (Dimension)maxx, (Dimension)maxy,
X				 (Dimension*)&maxx, (Dimension*)&maxy );
X    if (result == XtGeometryAlmost)
X      result = XtMakeResizeRequest(fw, (Dimension)maxx, (Dimension)maxy,
X				   NULL, NULL );
X    fw->xedwForm.old_width  = fw->core.width;
X    fw->xedwForm.old_height = fw->core.height;
X    ret_val = (result == XtGeometryYes);
X  } else ret_val = False;
X  
X  return ret_val;
X}
X
X
Xstatic void LayoutChild(Widget w)
X{
X  XedwFormConstraints xedwForm = (XedwFormConstraints)w->core.constraints;
X  Position x, y;
X  Dimension width, height;
X  Widget ref;
X
X  switch (xedwForm->xedwForm.layout_state) {
X    
X  case LayoutPending:
X    xedwForm->xedwForm.layout_state = LayoutInProgress;
X    break;
X
X  case LayoutDone:
X    return;
X
X  case LayoutInProgress:
X    {
X      String subs[2];
X      Cardinal num_subs = 2;
X      subs[0] = w->core.name;
X      subs[1] = w->core.parent->core.name;
X      XtAppWarningMsg(XtWidgetToApplicationContext(w),
X		      "constraintLoop","XedwFormLayout","XawToolkitError",
X		      "constraint loop detected while laying out child '%s'"
X		      " in XedwFormWidget '%s'",
X		      subs, &num_subs);
X      return;
X    }
X  }
X  x = xedwForm->xedwForm.dx;
X  y = xedwForm->xedwForm.dy;
X  if ((ref = xedwForm->xedwForm.width_link) != (Widget)NULL) {
X    LayoutChild(ref);
X    width = xedwForm->xedwForm.virtual_width = ref->core.width;
X    XtResizeWidget(w, width, w->core.height, w->core.border_width);
X  }
X  if ((ref = xedwForm->xedwForm.height_link) != (Widget)NULL) {
X    LayoutChild(ref);
X    height = xedwForm->xedwForm.virtual_height = ref->core.height;
X    XtResizeWidget(w, w->core.width, height, w->core.border_width);
X  }
X  if ((ref = xedwForm->xedwForm.horiz_base) != (Widget)NULL) {
X    LayoutChild(ref);
X    x += ref->core.x + ref->core.width + (ref->core.border_width << 1);
X  }
X  if ((ref = xedwForm->xedwForm.vert_base) != (Widget)NULL) {
X    LayoutChild(ref);
X    y += ref->core.y + ref->core.height + (ref->core.border_width << 1);
X  }
X  XtMoveWidget( w, x, y );
X  xedwForm->xedwForm.layout_state = LayoutDone;
X}
X
X
Xstatic Position TransformCoord(Position loc, 
X			       Dimension old, Dimension new, 
X			       XtEdgeType type)
X{
X  if (type == XtRubber) {
X    if ( ((int) old) > 0)
X      loc = (loc * new) / old;
X  }
X  else if (type == XtChainBottom || type == XtChainRight)
X    loc += (Position)new - (Position)old;
X
X  /* I don't see any problem with returning values less than zero. */
X
X  return (loc);
X}
X
X
Xstatic void Resize(Widget w)
X{
X  XedwFormWidget fw = (XedwFormWidget)w;
X  WidgetList children = fw->composite.children;
X  int num_children = fw->composite.num_children;
X  Widget *childP;
X  Position x, y;
X  Dimension width, height;
X
X  for (childP = children; childP - children < num_children; childP++) {
X    XedwFormConstraints xedwForm = (XedwFormConstraints)(*childP)->core.constraints;
X    if (!XtIsManaged(*childP)) continue;
X    x = TransformCoord( (*childP)->core.x, fw->xedwForm.old_width,
X		       fw->core.width, xedwForm->xedwForm.left );
X    y = TransformCoord( (*childP)->core.y, fw->xedwForm.old_height,
X		       fw->core.height, xedwForm->xedwForm.top );
X    
X    if (xedwForm->xedwForm.rubber_width)
X      xedwForm->xedwForm.virtual_width =
X	TransformCoord((Position)((*childP)->core.x
X				  + xedwForm->xedwForm.virtual_width
X				  + 2 * (*childP)->core.border_width),
X		       fw->xedwForm.old_width, fw->core.width,
X		       xedwForm->xedwForm.right )
X	  - (x + 2 * (*childP)->core.border_width);
X
X    if (xedwForm->xedwForm.rubber_height)
X      xedwForm->xedwForm.virtual_height =
X	TransformCoord((Position)((*childP)->core.y
X				  + xedwForm->xedwForm.virtual_height
X				  + 2 * (*childP)->core.border_width),
X		       fw->xedwForm.old_height, fw->core.height,
X		       xedwForm->xedwForm.bottom )
X	  - ( y + 2 * (*childP)->core.border_width);
X    
X    width = (Dimension)
X      (xedwForm->xedwForm.virtual_width < 1) ? 1 : xedwForm->xedwForm.virtual_width;
X    height = (Dimension)
X      (xedwForm->xedwForm.virtual_height < 1) ? 1 : xedwForm->xedwForm.virtual_height;
X    
X    XtConfigureWidget( *childP, x, y, (Dimension)width, (Dimension)height,
X		      (*childP)->core.border_width );
X  }
X
X  fw->xedwForm.old_width = fw->core.width;
X  fw->xedwForm.old_height = fw->core.height;
X}
X
X
Xstatic XtGeometryResult GeometryManager(Widget w, 
X					XtWidgetGeometry *request, 
X					XtWidgetGeometry *reply)
X{
X  XedwFormConstraints xedwForm = (XedwFormConstraints)w->core.constraints;
X  XtWidgetGeometry allowed;
X
X  if ((request->request_mode & ~(XtCWQueryOnly | CWWidth | CWHeight)) ||
X      !xedwForm->xedwForm.allow_resize)
X    return XtGeometryNo;
X
X  if (request->request_mode & CWWidth)
X    allowed.width = request->width;
X  else
X    allowed.width = w->core.width;
X  
X  if (request->request_mode & CWHeight)
X    allowed.height = request->height;
X  else
X    allowed.height = w->core.height;
X
X  if (allowed.width == w->core.width && allowed.height == w->core.height)
X    return XtGeometryNo;
X
X  if (!(request->request_mode & XtCWQueryOnly)) {
X    /* reset virtual width and height. */
X    xedwForm->xedwForm.virtual_width = w->core.width = allowed.width;
X    xedwForm->xedwForm.virtual_height = w->core.height = allowed.height;
X    RefigureLocations( (XedwFormWidget)w->core.parent );
X  }
X  return XtGeometryYes;
X}
X
X
X
Xstatic Boolean SetValues(Widget current, Widget request, Widget new)
X{
X  return( FALSE );
X}
X
X
Xstatic void ConstraintInitialize(Widget request, Widget new)
X{
X  XedwFormConstraints xedwForm = (XedwFormConstraints)new->core.constraints;
X  XedwFormWidget fw = (XedwFormWidget)new->core.parent;
X
X  xedwForm->xedwForm.virtual_width = (int) new->core.width;
X  xedwForm->xedwForm.virtual_height = (int) new->core.height;
X
X  if (xedwForm->xedwForm.dx == default_value)
X    xedwForm->xedwForm.dx = fw->xedwForm.default_spacing;
X
X  if (xedwForm->xedwForm.dy == default_value)
X    xedwForm->xedwForm.dy = fw->xedwForm.default_spacing;
X}
X
Xstatic Boolean ConstraintSetValues(Widget current, Widget request, Widget new)
X{
X  return( FALSE );
X}
X
Xstatic void ChangeManaged(Widget w)
X{
X  XedwFormWidget fw = (XedwFormWidget)w;
X  XedwFormConstraints xedwForm;
X  WidgetList children, childP;
X  int num_children = fw->composite.num_children;
X  Widget child;
X
X  /*
X   * Reset virtual width and height for all children.
X   */
X
X  for (children = childP = fw->composite.children ;
X       childP - children < num_children; childP++) {
X    child = *childP;
X    if (XtIsManaged(child)) {
X      xedwForm = (XedwFormConstraints)child->core.constraints;
X      if ( child->core.width != 1)
X        xedwForm->xedwForm.virtual_width = (int) child->core.width;
X      if ( child->core.height != 1)
X        xedwForm->xedwForm.virtual_height = (int) child->core.height;
X    }
X  }
X  RefigureLocations( (XedwFormWidget)w );
X}
X
X
Xstatic XtGeometryResult PreferredGeometry(Widget widget, 
X					  XtWidgetGeometry *request, 
X					  XtWidgetGeometry *reply)
X{
X  XedwFormWidget w = (XedwFormWidget)widget;
X
X  reply->width = w->xedwForm.preferred_width;
X  reply->height = w->xedwForm.preferred_height;
X  reply->request_mode = CWWidth | CWHeight;
X  if (  request->request_mode & (CWWidth | CWHeight) ==
X      reply->request_mode & CWWidth | CWHeight
X      && request->width == reply->width
X      && request->height == reply->height)
X    return XtGeometryYes;
X  else if (reply->width == w->core.width && reply->height == w->core.height)
X    return XtGeometryNo;
X  else
X    return XtGeometryAlmost;
X}
X
X
X/**********************************************************************
X *
X * Public routines
X *
X **********************************************************************/
X
X/*
X * Set or reset figuring (ignored if not realized)
X */
X
Xvoid XedwFormDoLayout(Widget w, Boolean doit)
X{
X  register XedwFormWidget fw = (XedwFormWidget)w;
X
X  fw->xedwForm.no_refigure = !doit;
X
X  if ( XtIsRealized(w) && fw->xedwForm.needs_relayout )
X    RefigureLocations( fw );
X}
SHAR_EOF
chmod 0644 code/Xedw/XedwForm.c || echo "restore of code/Xedw/XedwForm.c fails"
echo "x - extracting code/Xedw/XedwForm.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/XedwForm.h &&
X/*****************************************************************************
XCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
Xand the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X
X                        All Rights Reserved
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted,
Xprovided that the above copyright notice appear in all copies and that
Xboth that copyright notice and this permission notice appear in
Xsupporting documentation, and that the names of Digital or MIT not be
Xused in advertising or publicity pertaining to distribution of the
Xsoftware without specific, written prior permission.
X
XDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
XDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
XSOFTWARE.
X
X*****************************************************************************/
X
X#ifndef _XedwForm_h
X#define _XedwForm_h
X
X#include <X11/Constraint.h>
X#include <X11/Xaw/Form.h>
X
X/***********************************************************************
X *
X * XedwForm Widget
X *
X ***********************************************************************/
X
X/* Parameters:
X
X Name               Class               RepType     Default Value
X ----               -----               -------     -------------
X background         Background          Pixel       XtDefaultBackground
X border             BorderColor         Pixel       XtDefaultForeground
X borderWidth        BorderWidth         Dimension   1
X defaultDistance    Thickness           int         4
X destroyCallback    Callback            Pointer     NULL
X height             Height              Dimension   computed at realize
X mappedWhenManaged  MappedWhenManaged   Boolean     True
X sensitive          Sensitive           Boolean     True
X width              Width               Dimension   computed at realize
X x                  Position            Position    0
X y                  Position            Position    0
X
X*/
X
X/* Constraint parameters:
X
X Name               Class               RepType     Default Value
X ----               -----               -------     -------------
X bottom             Edge                XtEdgeType  XtRubber
X fromHoriz          Widget              Widget      (left edge of xedwForm)
X fromVert           Widget              Widget      (top of xedwForm)
X fullHeight         Boolean             Boolean     False
X fullWidth          Boolean             Boolean     False
X horizDistance      Thickness           int         defaultDistance
X left               Edge                XtEdgeType  XtRubber
X resizable          Boolean             Boolean     False
X right              Edge                XtEdgeType  XtRubber
X rubberHeight       Boolean             Boolean     True
X rubberWidth        Boolean             Boolean     True
X top                Edge                XtEdgeType  XtRubber
X vertDistance       Thickness           int         defaultDistance
X widthLinked        Widget              Widget      NULL
X heightLinked       Widget              Widget      NULL
X
X*/
X
X
X
X#define XtNfullHeight "fullHeight"
X#define XtNfullWidth "fullWidth"
X#define XtNrubberHeight "rubberHeight"
X#define XtNrubberWidth "rubberWidth"
X#define XtNwidthLinked "widthLinked"
X#define XtNheightLinked "heightLinked"
X
Xtypedef struct _XedwFormClassRec    *XedwFormWidgetClass;
Xtypedef struct _XedwFormRec     *XedwFormWidget;
X
Xextern WidgetClass xedwFormWidgetClass;
X
Xextern void XedwFormDoLayout(Widget, Boolean);     /* Boolean doit */
X
X
X#endif /* _XedwForm_h */
SHAR_EOF
chmod 0644 code/Xedw/XedwForm.h || echo "restore of code/Xedw/XedwForm.h fails"
echo "x - extracting code/Xedw/XedwFormP.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/XedwFormP.h &&
X
X/*****************************************************************************
XCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
Xand the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X
X                        All Rights Reserved
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted,
Xprovided that the above copyright notice appear in all copies and that
Xboth that copyright notice and this permission notice appear in
Xsupporting documentation, and that the names of Digital or MIT not be
Xused in advertising or publicity pertaining to distribution of the
Xsoftware without specific, written prior permission.
X
XDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
XDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
XSOFTWARE.
X
X******************************************************************************/
X
X/* XedwForm widget private definitions. This Form is identical to the XawForm
X * Widget except for a few added capabilities.
X */
X
X#ifndef _XedwFormP_h
X#define _XedwFormP_h
X
X#include "XedwForm.h"
X#include <X11/Xaw/FormP.h>
X#include <X11/ConstrainP.h>
X
Xtypedef struct {
X    Boolean (*layout)(XedwFormWidget, Dimension, Dimension );
X} XedwFormClassPart;
X
Xtypedef struct _XedwFormClassRec {
X    CoreClassPart       core_class;
X    CompositeClassPart  composite_class;
X    ConstraintClassPart constraint_class;
X    XedwFormClassPart   xedwForm_class;
X} XedwFormClassRec;
X
Xextern XedwFormClassRec xedwFormClassRec;
X
Xtypedef struct _XedwFormPart {
X    /* resources */
X    int         default_spacing;    /* default distance between children */
X
X    /* private state */
X    Dimension   old_width, old_height; /* last known dimensions      */
X    int         no_refigure;        /* no re-layout while > 0        */
X    Boolean     needs_relayout;     /* next time no_refigure == 0    */
X    Boolean     resize_in_layout;   /* should layout() do geom request?  */
X    Dimension   preferred_width, preferred_height; /* cached from layout */
X} XedwFormPart;
X
Xtypedef struct _XedwFormRec {
X    CorePart            core;
X    CompositePart       composite;
X    ConstraintPart      constraint;
X    XedwFormPart        xedwForm;
X} XedwFormRec;
X
Xtypedef struct _XedwFormConstraintsPart {
X/*
X * Constraint Resources.
X */
X    XtEdgeType  top, bottom,    /* where to drag edge on resize     */
X                left, right;
X    int         dx;             /* desired horiz offset         */
X    int         dy;             /* desired vertical offset      */
X    Widget      horiz_base;     /* measure dx from here if non-null */
X    Widget      vert_base;      /* measure dy from here if non-null */
X    Widget      width_link;     /* get width from this widget if non-null */
X    Widget      height_link;    /* get height from this widget if non-null */
X    Boolean     allow_resize;   /* True if child may request resize */
X    Boolean     full_width;     /* True if child wants to be full width */
X    Boolean     full_height;    /* True if child wants to be full height */
X    Boolean     rubber_width;   /* True if the child may resize width */
X    Boolean     rubber_height;  /* True if the child may resize height */
X
X/*
X * Private contstraint resources.
X */
X
X    int         virtual_width, virtual_height;
X
X/*
X * What the size of this child would be if we did not impose the
X * constraint the width and height must be greater than zero (0).
X */
X
X    LayoutState layout_state;   /* temporary layout state       */
X} XedwFormConstraintsPart;
X
Xtypedef struct _XedwFormConstraintsRec {
X    XedwFormConstraintsPart xedwForm;
X} XedwFormConstraintsRec, *XedwFormConstraints;
X
X#endif /* _XawXedwFormP_h */
SHAR_EOF
chmod 0644 code/Xedw/XedwFormP.h || echo "restore of code/Xedw/XedwFormP.h fails"
echo "x - extracting code/Xedw/XedwList.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/XedwList.c &&
X/* v0.2 */
X#include <X11/copyright.h>
X
X/*
X * XedwList.c - XedwList widget
X *
X * This is the XedwList widget. It is very similar to the Athena Widget List,
X * except it has the ability to display an icon with the string. Plus allows
X * multiple selections.
X * It allows the user to select one or more items in a list and notifies the
X * application through a callback function.
X *
X *  List Created:   8/13/88
X *  By:     Chris D. Peterson
X *                      MIT X Consortium
X *
X *  Modified to XedwList: 1/26/90
X *  By:     Edward Groenendaal
X *                      University of Sussex, UK.
X */
X
X#include <stdio.h>
X#include <ctype.h>
X
X#include <X11/IntrinsicP.h>
X#include <X11/StringDefs.h>
X
X#include <X11/Xmu/Drawing.h>
X
X#include <X11/Xaw/XawInit.h>
X#include "XedwListP.h"
X
X/*
X * Include bitmap for the default icon
X */
X
X#include "DefIcon.icon"
X
X
X/*
X * Default Translation table.
X */
X
Xstatic char defaultTranslations[] =
X  "!Shift<Btn1Down>: 	        MultipleSet()\n\
X   <Btn1Down>:   	        Set()\n\
X   !Shift<Btn1Down>,<Btn1Up>:   Notify()\n\
X   <Btn1Down>,<Btn1Up>:     	Notify()";
X
X/****************************************************************
X *
X * Full class record constant
X *
X ****************************************************************/
X
X/* Private Data */
X
X#define offset(field) XtOffset(XedwListWidget, field)
X
Xstatic XtResource resources[] = {
X  {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
X     offset(xedwList.foreground), XtRString, "XtDefaultForeground"},
X  {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor),
X     offset(simple.cursor), XtRString, "left_ptr"},
X  {XtNfont,  XtCFont, XtRFontStruct, sizeof(XFontStruct *),
X     offset(xedwList.font),XtRString, "XtDefaultFont"},
X  {XtNxedwList, XtCXedwList, XtRPointer, sizeof(XedwList **), /* XedwList */
X     offset(xedwList.xedwList), XtRString, NULL},
X  {XtNdefaultColumns, XtCColumns, XtRInt,  sizeof(int),
X     offset(xedwList.default_cols), XtRImmediate, (caddr_t)2},
X  {XtNlongest, XtCLongest, XtRInt,  sizeof(int),
X     offset(xedwList.longest), XtRImmediate, (caddr_t)0},
X  {XtNnumberStrings, XtCNumberStrings, XtRInt,  sizeof(int),
X     offset(xedwList.nitems), XtRImmediate, (caddr_t)0},
X  {XtNpasteBuffer, XtCBoolean, XtRBoolean,  sizeof(Boolean),
X     offset(xedwList.paste), XtRString, (caddr_t) "False"},
X  {XtNforceColumns, XtCColumns, XtRBoolean,  sizeof(Boolean),
X     offset(xedwList.force_cols), XtRString, (caddr_t) "False"},
X  {XtNverticalList, XtCBoolean, XtRBoolean,  sizeof(Boolean),
X     offset(xedwList.vertical_cols), XtRString, (caddr_t) "False"},
X  {XtNinternalWidth, XtCWidth, XtRDimension,  sizeof(Dimension),
X     offset(xedwList.internal_width), XtRImmediate, (caddr_t)4},
X  {XtNinternalHeight, XtCHeight, XtRDimension, sizeof(Dimension),
X     offset(xedwList.internal_height), XtRImmediate, (caddr_t)2},
X  {XtNcolumnSpacing, XtCSpacing, XtRDimension,  sizeof(Dimension),
X     offset(xedwList.column_space), XtRImmediate, (caddr_t)10},
X  {XtNrowSpacing, XtCSpacing, XtRDimension,  sizeof(Dimension),
X     offset(xedwList.row_space), XtRImmediate, (caddr_t)10},
X  {XtNiconWidth, XtCWidth, XtRDimension, sizeof(Dimension),       /* IconWidth */
X     offset(xedwList.icon_width), XtRImmediate, (caddr_t)32},
X  {XtNiconHeight, XtCHeight, XtRDimension, sizeof(Dimension),     /* IconHeight */
X     offset(xedwList.icon_height), XtRImmediate, (caddr_t)32},
X  {XtNshowIcons, XtCBoolean, XtRBoolean, sizeof(Boolean),         /* ShowIcons */
X     offset(xedwList.show_icons), XtRString, (caddr_t) "False"},
X  {XtNmSelections, XtCBoolean, XtRBoolean, sizeof(Boolean),       /* Multiple   */
X     offset(xedwList.multiple), XtRString, (caddr_t) "False"},     /* Selections */
X  {XtNdefaultIcon, XtCPixmap, XtRPixmap, sizeof(Pixmap),          /* DefaultIcon */
X     offset(xedwList.default_icon), XtRPixmap, (caddr_t) NULL},
X  {XtNcallback, XtCCallback, XtRCallback, sizeof(caddr_t),
X     offset(xedwList.callback), XtRCallback, NULL},
X};
X
Xstatic void             Initialize   (Widget, Widget);
Xstatic void             ChangeSize   (Widget, Dimension, Dimension);
Xstatic void             Resize       (Widget);
Xstatic void             Redisplay    (Widget, XEvent*, Region);
Xstatic Boolean          Layout       (Widget, Boolean, Boolean, Dimension*, Dimension*);
Xstatic XtGeometryResult PreferredGeom(Widget, XtWidgetGeometry*, XtWidgetGeometry*);
Xstatic Boolean          SetValues    (Widget, Widget, Widget);
Xstatic void             Notify       (Widget, XEvent*, String*, Cardinal*),
X                        Set          (Widget, XEvent*, String*, Cardinal*), 
X                        MultipleSet  (Widget, XEvent*, String*, Cardinal*), 
X                        Unset        (Widget, XEvent*, String*, Cardinal*);
Xstatic Boolean 		IsHighlighted(Widget, int);
Xstatic void		AddNode	     (Widget, int);
Xstatic void		RemoveNode   (Widget, int);
X
Xstatic XtActionsRec actions[] = {
X  {"Notify",         Notify},
X  {"Set",            Set},
X  {"Unset",          Unset},
X  {"MultipleSet",    MultipleSet},
X  {NULL,NULL}
X};
X
XXedwListClassRec xedwListClassRec = {
X  {
X/* core_class fields */
X#define superclass                  (&simpleClassRec)
X    /* superclass               */  (WidgetClass) superclass,
X    /* class_name               */  "XedwList",
X    /* widget_size              */  sizeof(XedwListRec),
X    /* class_initialize         */  XawInitializeWidgetSet,
X    /* class_part_initialize    */  NULL,
X    /* class_inited             */  FALSE,
X    /* initialize               */  Initialize,
X    /* initialize_hook          */  NULL,
X    /* realize                  */  XtInheritRealize,
X    /* actions                  */  actions,
X    /* num_actions              */  XtNumber(actions),
X    /* resources                */  resources,
X    /* num_resources            */  XtNumber(resources),
X    /* xrm_class                */  NULLQUARK,
X    /* compress_motion          */  TRUE,
X    /* compress_exposure        */  FALSE,
X    /* compress_enterleave      */  TRUE,
X    /* visible_interest         */  FALSE,
X    /* destroy                  */  NULL,
X    /* resize                   */  Resize,
X    /* expose                   */  Redisplay,
X    /* set_values               */  SetValues,
X    /* set_values_hook          */  NULL,
X    /* set_values_almost        */  XtInheritSetValuesAlmost,
X    /* get_values_hook          */  NULL,
X    /* accept_focus             */  NULL,
X    /* version                  */  XtVersion,
X    /* callback_private         */  NULL,
X    /* tm_table                 */  defaultTranslations,
X    /* query_geometry           */  PreferredGeom,
X  },
X/* Simple class fields initialization */
X  {
X    /* change_sensitive     */  XtInheritChangeSensitive
X  }
X};
X
XWidgetClass xedwListWidgetClass = (WidgetClass)&xedwListClassRec;
X
X/****************************************************************
X *
X * Private Procedures
X *
X ****************************************************************/
X
Xstatic void GetGCs(Widget w)
X{
X
X  XGCValues   values;
X  XedwListWidget ilw = (XedwListWidget) w;
X
X  values.foreground   = ilw->xedwList.foreground;
X  values.background   = ilw->core.background_pixel; 
X  values.font         = ilw->xedwList.font->fid;
X  ilw->xedwList.normgc = XtGetGC(w, (unsigned) GCBackground | GCForeground | GCFont,
X				 &values);
X
X  values.foreground   = ilw->core.background_pixel; 
X  values.background   = ilw->xedwList.foreground;
X  ilw->xedwList.revgc = XtGetGC(w, (unsigned) GCBackground | GCForeground | GCFont, &values);
X
X  values.tile       = XmuCreateStippledPixmap(XtScreen(w),
X					      ilw->xedwList.foreground,
X					      ilw->core.background_pixel,
X					      ilw->core.depth);
X  values.fill_style = FillTiled;
X
X  ilw->xedwList.graygc = XtGetGC(w, (unsigned) GCFont | GCTile | GCFillStyle,
X				 &values);
X}
X
X/*  Function Name:  ResetXedwList
X *  Description:    Resets the new xedwList when important things change.
X *  Arguments:      w - the widget.
X *                  changex, changey - allow the height or width to change?
X *  Returns: none.
X */
X
Xstatic void ResetXedwList(Widget w, Boolean changex, Boolean changey)
X{
X  XedwListWidget ilw = (XedwListWidget) w;
X  Dimension width = w->core.width;
X  Dimension height = w->core.height;
X  register int i, len;
X
X  /*
X   * If xedwList is NULL then the xedwList will just be the name of the widget,
X   * the icon will be set to the default icon. (defined in XedwListP.h)
X   */
X
X  if (ilw->xedwList.xedwList == NULL) {
X    /* Make room for structure */
X    ilw->xedwList.xedwList = XtNew(XedwList *);
X    ilw->xedwList.xedwList[0] = XtNew(XedwList);
X    ilw->xedwList.xedwList[0]->string = ilw->core.name;
X    ilw->xedwList.xedwList[0]->icon = NULL;
X    ilw->xedwList.nitems = 1;
X  }
X
X  if (ilw->xedwList.nitems == 0)       /* Get number of items. */
X    for ( ; ilw->xedwList.xedwList[ilw->xedwList.nitems] != NULL ; ilw->xedwList.nitems++);
X  
X  if (ilw->xedwList.longest == 0) /* Get column width. */
X    for ( i = 0 ; i < ilw->xedwList.nitems; i++) {
X      len = XTextWidth(ilw->xedwList.font, ilw->xedwList.xedwList[i]->string,
X		       strlen(ilw->xedwList.xedwList[i]->string));
X      if (len > ilw->xedwList.longest)
X	ilw->xedwList.longest = len;
X    }
X
X  /* If longest string is less than the width of a bitmap then the longest is
X   * the width of a bitmap
X   */
X  if (ilw->xedwList.show_icons)
X    if (ilw->xedwList.longest < ilw->xedwList.icon_width)
X      ilw->xedwList.longest = ilw->xedwList.icon_width;
X
X
X  ilw->xedwList.col_width = ilw->xedwList.longest + ilw->xedwList.column_space;
X
X  if (Layout(w, changex, changey, &width, &height))
X    ChangeSize(w, width, height);
X}
X
X/*  Function Name: ChangeSize.
X *  Description: Laysout the widget.
X *  Arguments: w - the widget to try change the size of.
X *  Returns: none.
X */
X
Xstatic void ChangeSize(Widget w, Dimension width, Dimension height)
X{
X  XtWidgetGeometry request, reply;
X
X  request.request_mode = CWWidth | CWHeight;
X  request.width = width;
X  request.height = height;
X
X  switch ( XtMakeGeometryRequest(w, &request, &reply) ) {
X  case XtGeometryYes:
X  case XtGeometryNo:
X    break;
X  case XtGeometryAlmost:
X    Layout(w, (request.height != reply.height),
X	   (request.width != reply.width),
X           &(reply.width), &(reply.height));
X    request = reply;
X    switch (XtMakeGeometryRequest(w, &request, &reply) ) {
X    case XtGeometryYes:
X    case XtGeometryNo:
X      break;
X    case XtGeometryAlmost:
X      request = reply;
X      if (Layout(w, FALSE, FALSE,
X		 &(request.width), &(request.height))) {
X	char buf[BUFSIZ];
X	sprintf(buf, "XedwList Widget: %s %s",
X		"Size Changed when it shouldn't have",
SHAR_EOF
echo "End of part 6"
echo "File code/Xedw/XedwList.c is continued in part 7"
echo "7" > s2_seq_.tmp
exit 0

eddyg@syma.sussex.ac.uk (Edward J. Groenendaal) (04/18/91)

---- Cut Here and unpack ----
#!/bin/sh
# this is part 7 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file code/Xedw/XedwList.c continued
#
CurArch=7
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file code/Xedw/XedwList.c"
sed 's/^X//' << 'SHAR_EOF' >> code/Xedw/XedwList.c
X		"when computing layout");
X	XtAppWarning(XtWidgetToApplicationContext(w), buf);
X      }
X      request.request_mode = CWWidth | CWHeight;
X      XtMakeGeometryRequest(w, &request, &reply);
X      break;
X    default:
X      XtAppWarning(XtWidgetToApplicationContext(w),
X		   "XedwList Widget: Unknown geometry return.");
X      break;
X    }
X    break;
X  default:
X    XtAppWarning(XtWidgetToApplicationContext(w),
X		 "XedwList Widget: Unknown geometry return.");
X    break;
X  }
X}
X
X/*  Function Name: Initialise
X *  Description: Function that initilises the widget instance.
X *  Arguments: junk - NOT USED.
X *             new  - the new widget.
X *  Returns: none
X */
X
Xstatic void Initialize(Widget junk, Widget new)
X{
X  XedwListWidget ilw = (XedwListWidget) new;
X
X/*
X * Initialize all private resources.
X */
X
X  GetGCs(new);
X
X  /* Set row height. */
X  if (ilw->xedwList.show_icons)
X    ilw->xedwList.row_height = ilw->xedwList.font->max_bounds.ascent
X      + ilw->xedwList.font->max_bounds.descent
X      + ilw->xedwList.row_space
X      + ilw->xedwList.icon_height;
X  else
X    ilw->xedwList.row_height = ilw->xedwList.font->max_bounds.ascent
X      + ilw->xedwList.font->max_bounds.descent
X      + ilw->xedwList.row_space;
X
X  ResetXedwList(new, (new->core.width == 0), (new->core.height == 0));
X
X  ilw->xedwList.is_highlighted = (LinkedList*) XtMalloc (sizeof(LinkedList));
X
X  ilw->xedwList.highlight = ilw->xedwList.is_highlighted->index = NO_HIGHLIGHT;
X  ilw->xedwList.is_highlighted->next = NULL;
X
X} /* Initialize */
X
X/*  Function Name: CvtToItem
X *  Description: Converts Xcoord to item number of item containing that
X *               point.
X *  Arguments: w - the xedwList widget.
X *             xloc, yloc - x location, and y location.
X *  Returns: the item number.
X */
X
Xstatic int CvtToItem(Widget w, int xloc, int yloc, int *item)
X{
X  int one, another;
X  XedwListWidget ilw = (XedwListWidget) w;
X  int ret_val = OKAY;
X
X  if (ilw->xedwList.vertical_cols) {
X    one = ilw->xedwList.nrows * ((xloc - (int) ilw->xedwList.internal_width)
X				 / ilw->xedwList.col_width);
X    another = (yloc - (int) ilw->xedwList.internal_height)
X      / ilw->xedwList.row_height;
X    /* If out of range, return minimum possible value. */
X    if (another >= ilw->xedwList.nrows) {
X      another = ilw->xedwList.nrows - 1;
X      ret_val = OUT_OF_RANGE;
X    }
X  }
X  else {
X    one = (ilw->xedwList.ncols * ((yloc - (int) ilw->xedwList.internal_height)
X				  / ilw->xedwList.row_height)) ;
X    /* If in right margin handle things right. */
X    another = (xloc - (int) ilw->xedwList.internal_width) / ilw->xedwList.col_width;
X    if (another >= ilw->xedwList.ncols) {
X      another = ilw->xedwList.ncols - 1;
X      ret_val = OUT_OF_RANGE;
X    }
X  }
X  if ((xloc < 0) || (yloc < 0))
X    ret_val = OUT_OF_RANGE;
X  if (one < 0) one = 0;
X  if (another < 0) another = 0;
X  *item = one + another;
X  if (*item >= ilw->xedwList.nitems) return(OUT_OF_RANGE);
X  return(ret_val);
X}
X
X/*  Function Name: FindCornerItems.
X *  Description: Find the corners of the rectangle in item space.
X *  Arguments: w - the xedwList widget.
X *             event - the event structure that has the rectangle it it.
X *             ul_ret, lr_ret - the corners ** RETURNED **.
X *  Returns: none.
X */
X
Xstatic int FindCornerItems(Widget w, XEvent *event, int *ul_ret, int *lr_ret)
X{
X  int xloc, yloc;
X  
X  xloc = event->xexpose.x;
X  yloc = event->xexpose.y;
X  CvtToItem(w, xloc, yloc, ul_ret);
X  xloc += event->xexpose.width;
X  yloc += event->xexpose.height;
X  CvtToItem(w, xloc, yloc, lr_ret);
X}
X
X/*  Function Name: ItemInRectangle
X *  Description: returns TRUE if the item passed is in the given rectangle.
X *  Arguments: w - the xedwList widget.
X *             ul, lr - corners of the rectangle in item space.
X *             item - item to check.
X *  Returns: TRUE if the item passed is in the given rectangle.
X */
X
Xstatic int ItemInRectangle(Widget w, int ul, int lr, int item)
X{
X  XedwListWidget ilw = (XedwListWidget) w;
X  register int mod_item;
X  int things;
X
X  if (item < ul || item > lr)
X    return(FALSE);
X  if (ilw->xedwList.vertical_cols)
X    things = ilw->xedwList.nrows;
X  else
X    things = ilw->xedwList.ncols;
X  
X  mod_item = item % things;
X  if ( (mod_item >= ul % things) && (mod_item <= lr % things ) )
X    return(TRUE);
X  return(FALSE);
X}
X
X/*  Function Name: HighlightBackground
X *  Description: paints the color of the background for the given item.
X *  Arguments: w - the widget.
X *             x, y - ul corner of the area item occupies.
X *             item - the item we are dealing with.
X *             gc - the gc that is used to paint this rectangle
X *  Returns:
X */
X
Xstatic int HighlightBackground(Widget w, int x, int y, int item, GC gc)
X{
X  XedwListWidget ilw = (XedwListWidget) w;
X  int hl_x, hl_y, width, height;
X
X  hl_x = x - ilw->xedwList.column_space/2;
X  width = XTextWidth(ilw->xedwList.font, ilw->xedwList.xedwList[item]->string,
X		     strlen(ilw->xedwList.xedwList[item]->string))
X    + ilw->xedwList.column_space;
X  hl_y = y + ((ilw->xedwList.show_icons) ? ilw->xedwList.icon_height : 0);
X  height = ilw->xedwList.row_height - ilw->xedwList.row_space -
X    ((ilw->xedwList.show_icons) ? ilw->xedwList.icon_height : 0);
X
X  XFillRectangle(XtDisplay(w), XtWindow(w), gc, hl_x, hl_y, width, height);
X}
X
X/*  Function Name: PaintItemName
X *  Description: paints the name of the item in the appropriate location.
X *  Arguments: w - the xedwList widget.
X
X *             item - the item to draw.
X *	       op - XedwOn, XedwOff
X *  Returns: none.
X *
X *      NOTE: no action taken on an unrealized widget.
X */
X
Xstatic int PaintItemName(Widget w, int item, int operation)
X{
X  char * str;
X  GC gc;
X  unsigned normalmode, inversemode;
X  int x, y, str_y, str_x;
X  XedwListWidget ilw = (XedwListWidget) w;
X
X  if (!XtIsRealized(w)) return; /* Just in case... */
X
X
X  if (ilw->xedwList.vertical_cols) {
X    x = ilw->xedwList.col_width * (item / ilw->xedwList.nrows)
X      + ilw->xedwList.internal_width;
X    y = ilw->xedwList.row_height * (item % ilw->xedwList.nrows)
X      + ilw->xedwList.internal_height;
X  }
X  else {
X    x = ilw->xedwList.col_width * (item % ilw->xedwList.ncols)
X      + ilw->xedwList.internal_width;
X    y = ilw->xedwList.row_height * (item / ilw->xedwList.ncols)
X      + ilw->xedwList.internal_height;
X  }
X
X  
X  str =  ilw->xedwList.xedwList[item]->string;
X  
X  str_y = y + ilw->xedwList.font->max_bounds.ascent;
X
X  if (ilw->xedwList.show_icons)
X    str_x = x + ((ilw->xedwList.longest/2) -
X		 (XTextWidth(ilw->xedwList.font, str, strlen(str))/2));
X  else
X    str_x = x;
X  
X  if ((BlackPixelOfScreen(XtScreen(ilw))) == 1) {
X    normalmode = GXcopy;
X    inversemode = GXcopyInverted;
X  } else {
X    normalmode = GXcopyInverted;
X    inversemode = GXcopy;
X  }
X
X  if (ilw->xedwList.is_highlighted->index != NO_HIGHLIGHT) {
X    /* There are some highlighted items */
X    if (ilw->xedwList.highlight == NO_HIGHLIGHT) {
X      /* This is an update */
X      if (operation == XedwOn) {
X	if (XtIsSensitive(w)) {
X	  /* Draw Inverse item */
X	  gc = ilw->xedwList.revgc;
X	  XSetFunction(XtDisplay(w), gc, inversemode);
X	  HighlightBackground(w, str_x, y, item, ilw->xedwList.normgc);
X	} else {
X	  /* Draw Grey item */
X	}  
X      } else {
X	gc = ilw->xedwList.normgc;
X	/* XSetFunction(XtDisplay(w), gc, normalmode); */
X      }
X    } else {
X      /* Were toggling something */
X      if (operation == XedwOn) {
X        if (XtIsSensitive(w)) {
X          /* Draw Inverse item */
X          gc = ilw->xedwList.revgc;
X          XSetFunction(XtDisplay(w), gc, inversemode); 
X          HighlightBackground(w, str_x, y, item, ilw->xedwList.normgc);
X	} else {
X	  /* Draw Grey item */
X	} 
X      } else {
X	/* Draw Normal item */
X	gc = ilw->xedwList.normgc;
X	XSetFunction(XtDisplay(ilw), gc, normalmode);
X	HighlightBackground(w, str_x, y, item, ilw->xedwList.revgc); 
X      }
X    }
X  } else {
X    gc = ilw->xedwList.normgc;
X    XSetFunction(XtDisplay(ilw), gc, normalmode);
X  }
X
X  if (ilw->xedwList.default_icon == NULL)
X    ilw->xedwList.default_icon = 
X      XCreateBitmapFromData(XtDisplay(ilw), XtWindow(ilw), default_bits, 
X			    default_width, default_height);
X
X  if (ilw->xedwList.show_icons){
X    Pixmap icon;
X    if (ilw->xedwList.xedwList[item]->icon == NULL &&
X	ilw->xedwList.default_icon != NULL) 
X      icon = ilw->xedwList.default_icon;
X    else 
X      icon = ilw->xedwList.xedwList[item]->icon;
X    if (DefaultDepthOfScreen(XtScreen(ilw)) == 1)
X      XCopyArea(XtDisplay(ilw), icon,
X		XtWindow(ilw), gc, 0, 0,
X		ilw->xedwList.icon_width, ilw->xedwList.icon_height, x +
X		((ilw->xedwList.longest/2) - (ilw->xedwList.icon_width/2)), y);
X    else
X      XCopyPlane(XtDisplay(ilw), icon,
X		 XtWindow(ilw), gc, 0,0,
X		 ilw->xedwList.icon_width,ilw->xedwList.icon_height,x +
X		 ((ilw->xedwList.longest/2) - (ilw->xedwList.icon_width/2)), y,1);
X    /* Draw string */
X    XSetFunction(XtDisplay(ilw), gc, GXcopy);
X    XDrawString(XtDisplay(ilw), XtWindow(ilw), gc, str_x,
X		str_y+ilw->xedwList.icon_height, str, strlen(str));
X  } else { /* No Icons */
X    XSetFunction(XtDisplay(ilw), gc, GXcopy);
X    XDrawString(XtDisplay(ilw), XtWindow(ilw), gc, str_x, str_y, str, strlen(str));
X  }
X}
X
X/*  Function Name: Redisplay
X *  Description: Repaints the widget window on expose events.
X *  Arguments: w - the xedwList widget.
X *                 event - the expose event for this repaint.
X *                 junk - NOT USED.
X *  Returns:
X */
X
Xstatic void Redisplay(Widget w, XEvent *event, Region junk)
X{
X  int item;           /* an item to work with. */
X  int ul_item, lr_item;       /* corners of items we need to paint. */
X  XedwListWidget ilw = (XedwListWidget) w;
X
X  if (event == NULL) {    /* repaint all. */
X    ul_item = 0;
X    lr_item = ilw->xedwList.nrows * ilw->xedwList.ncols - 1;
X    XClearWindow(XtDisplay(w), XtWindow(w));
X  }
X  else
X    FindCornerItems(w, event, &ul_item, &lr_item);
X
X  ilw->xedwList.highlight = NO_HIGHLIGHT;
X  for (item = ul_item; (item <= lr_item && item < ilw->xedwList.nitems) ; item++)
X    if (ItemInRectangle(w, ul_item, lr_item, item))
X      if (IsHighlighted(w, item))
X	PaintItemName(w, item, XedwOn);
X      else
X	PaintItemName(w, item, XedwOff);
X}
X
X/*  Function Name: PreferredGeom
X *  Description: This tells the parent what size we would like to be
X *                   given certain constraints.
X *  Arguments: w - the widget.
X *                 intended - what the parent intends to do with us.
X *                 requested - what we want to happen.
X *  Returns: none.
X */
X
Xstatic XtGeometryResult PreferredGeom(Widget w, 
X				      XtWidgetGeometry *intended, 
X				      XtWidgetGeometry *requested)
X{
X  Dimension new_width, new_height;
X  Boolean change, width_req, height_req;
X
X  width_req = intended->request_mode & CWWidth;
X  height_req = intended->request_mode & CWHeight;
X
X  if (width_req)
X    new_width = intended->width;
X  else
X    new_width = w->core.width;
X
X  if (height_req)
X    new_height = intended->height;
X  else
X    new_height = w->core.height;
X
X  requested->request_mode = 0;
X
X  /*
X   * We only care about our height and width.
X   */
X
X  if ( !width_req && !height_req)
X    return(XtGeometryYes);
X
X  change = Layout(w, !width_req, !height_req, &new_width, &new_height);
X
X  requested->request_mode |= CWWidth;
X  requested->width = new_width;
X  requested->request_mode |= CWHeight;
X  requested->height = new_height;
X
X  if (change)
X    return(XtGeometryAlmost);
X  return(XtGeometryYes);
X}
X
X/*  Function Name: Resize
X *  Description: resizes the widget, by changing the number of rows and
X *               columns.
X *  Arguments: w - the widget.
X *  Returns: none.
X */
X
Xstatic void Resize(Widget w)
X{
X  Dimension width, height;
X
X  width = w->core.width;
X  height = w->core.height;
X
X  if (Layout(w, FALSE, FALSE, &width, &height))
X    XtAppWarning(XtWidgetToApplicationContext(w),
X		 "XedwList Widget: Size changed when it shouldn't have when resising.");
X}
X
X/*  Function Name: Layout
X *  Description: lays out the item in the xedwList.
X *  Arguments: w - the widget.
X *             xfree, yfree - TRUE if we are free to resize the widget in
X *                            this direction.
X *             width, height - the is the current width and height that
X *                             we are going to layout the xedwList widget to,
X *                             depending on xfree and yfree of course.
X *
X *  Returns: TRUE if width or height have been changed.
X */
X
Xstatic Boolean Layout(Widget w, Boolean xfree, Boolean yfree, 
X		      Dimension *width, Dimension *height)
X{
X  XedwListWidget ilw = (XedwListWidget) w;
X  Boolean change = FALSE;
X
X  /*
X   * If force columns is set then always use number of columns specified
X   * by default_cols.
X   */
X
X  if (ilw->xedwList.force_cols) {
X    ilw->xedwList.ncols = ilw->xedwList.default_cols;
X    if (ilw->xedwList.ncols <= 0) ilw->xedwList.ncols = 1;
X    /* 12/3 = 4 and 10/3 = 4, but 9/3 = 3 */
X    ilw->xedwList.nrows = ( ( ilw->xedwList.nitems - 1) / ilw->xedwList.ncols) + 1 ;
X    if (xfree) {        /* If allowed resize width. */
X      *width = ilw->xedwList.ncols * ilw->xedwList.col_width
X	+ 2 * ilw->xedwList.internal_width;
X      change = TRUE;
X    }
X    if (yfree) {        /* If allowed resize height. */
X      *height = (ilw->xedwList.nrows * ilw->xedwList.row_height)
X	+ 2 * ilw->xedwList.internal_height;
X      change = TRUE;
X    }
X    return(change);
X  }
X
X  /*
X   * If both width and height are free to change the use default_cols
X   * to determine the number columns and set new width and height to
X   * just fit the window.
X   */
X
X  if (xfree && yfree) {
X    ilw->xedwList.ncols = ilw->xedwList.default_cols;
X    if (ilw->xedwList.ncols <= 0) ilw->xedwList.ncols = 1;
X    ilw->xedwList.nrows = ( ( ilw->xedwList.nitems - 1) / ilw->xedwList.ncols) + 1 ;
X    *width = ilw->xedwList.ncols * ilw->xedwList.col_width
X      + 2 * ilw->xedwList.internal_width;
X    *height = (ilw->xedwList.nrows * ilw->xedwList.row_height)
X      + 2 * ilw->xedwList.internal_height;
X    change = TRUE;
X  }
X  /*
X   * If the width is fixed then use it to determine the number of columns.
X   * If the height is free to move (width still fixed) then resize the height
X   * of the widget to fit the current xedwList exactly.
X   */
X  else if (!xfree) {
X    ilw->xedwList.ncols = ( (*width - 2 * ilw->xedwList.internal_width)
X			   / ilw->xedwList.col_width);
X    if (ilw->xedwList.ncols <= 0) ilw->xedwList.ncols = 1;
X    ilw->xedwList.nrows = ( ( ilw->xedwList.nitems - 1) / ilw->xedwList.ncols) + 1 ;
X    if ( yfree ) {
X      *height = (ilw->xedwList.nrows * ilw->xedwList.row_height)
X	+ 2 * ilw->xedwList.internal_height;
X      change = TRUE;
X    }
X  }
X  /*
X   * The last case is xfree and !yfree we use the height to determine
X   * the number of rows and then set the width to just fit the resulting
X   * number of columns.
X   */
X  else if (!yfree) {      /* xfree must be TRUE. */
X    ilw->xedwList.nrows = (*height - 2 * ilw->xedwList.internal_height)
X      / ilw->xedwList.row_height;
X    if (ilw->xedwList.nrows <= 0) ilw->xedwList.nrows = 1;
X    ilw->xedwList.ncols = (( ilw->xedwList.nitems - 1 ) / ilw->xedwList.nrows) + 1;
X    *width = ilw->xedwList.ncols * ilw->xedwList.col_width
X      + 2 * ilw->xedwList.internal_width;
X    change = TRUE;
X  }
X  return(change);
X}
X
X/*  Function Name: Notify
X *  Description: Notifies the user that a button has been pressed, and
X *               calles the callback, if the XtNpasteBuffer resource
X *               is true then the name of the item is also put in the
X *               X cut buffer ( buf (0) ).
X *  Arguments: w - the widget that the notify occured in.
X *             event - event that caused this notification.
X *             params, num_params - not used.
X *  Returns: none.
X */
X
Xstatic void Notify(Widget w, XEvent *event, String *params, 
X		   Cardinal *num_params)
X{
X  XedwListWidget ilw = ( XedwListWidget ) w;
X  LinkedList *list = ilw->xedwList.is_highlighted;
X  int item, item_len;
X  XedwListReturnStruct ret_value;
X
X  if ( ((CvtToItem(w, event->xbutton.x, event->xbutton.y, &item))
X	== OUT_OF_RANGE) || (ilw->xedwList.highlight != item) ) {
X    XedwListUnhighlight(w, ilw->xedwList.highlight);
X    RemoveNode(w, ilw->xedwList.highlight);
X    XtCallCallbacks(w, XtNcallback, (caddr_t) 0);
X    return;
X  }
X
X  /* Put the name of ALL highlighted strings into the X cut buffer, 
X   * seperated by spaces.
X
X  item_len = 0;
X  while(list != NULL) {
X    item_len +=  strlen(ilw->xedwList.xedwList[list.index]->string) + 1;
X      list=list->next;
X  }
X
X  */
X
X  item_len = strlen(ilw->xedwList.xedwList[item]->string);
X  
X  if ( ilw->xedwList.paste )   /* if XtNpasteBuffer set then paste it. */
X    XStoreBytes(XtDisplay(w), ilw->xedwList.xedwList[item]->string, item_len);
X
X  /*
X   * Call Callback function.
X   */
X
X  ret_value.string = ilw->xedwList.xedwList[item]->string;
X  ret_value.xedwList_index = item;
X  ret_value.next = NULL;
X  
X  XtCallCallbacks( w, XtNcallback, (caddr_t) &ret_value);
X}
X
X/*  Function Name: Unset
X *  Description: unhighlights the current elements.
X *  Arguments: w - the widget that the event occured in.
X *                 event - not used.
X *                 params, num_params - not used.
X *  Returns: none.
X */
X
Xstatic void Unset(Widget w, XEvent *event, String *params, 
X		  Cardinal *num_params)
X{
X  XedwListUnhighlight(w, XedwAll);
X}
X
X/*  Function Name: Set
X *  Description: Highlights the current element.
X *  Arguments: w - the widget that the event occured in.
X *                 event - event that caused this notification.
X *                 params, num_params - not used.
X *  Returns: none.
X */
X
Xstatic void Set(Widget w, XEvent *event, String *params, 
X		Cardinal *num_params)
X{
X  int item;
X  XedwListWidget ilw = (XedwListWidget) w;
X
X  if ( (CvtToItem(w, event->xbutton.x, event->xbutton.y, &item))
X      == OUT_OF_RANGE)
X    XedwListUnhighlight(w, XedwAll);    /* Unhighlight current items. */
X  else {
X    if (ilw->xedwList.highlight != item || 
X	ilw->xedwList.is_highlighted->next != NULL) 
X      XedwListUnhighlight(w, XedwAll);	/* Unhighlight any others */
X    XedwListHighlight(w, item);   	/* highlight it */
X  }
X}
X
X/*  Function Name: MultipleSet
X *  Description: Highlights the current element.
X *  Arguments: w - the widget that the event occured in.
X *                 event - event that caused this notification.
X *                 params, num_params - not used.
X *  Returns: none.
X */
X
Xstatic void MultipleSet(Widget w, XEvent *event, String *params, 
X		Cardinal *num_params)
X{
X  int item;
X  XedwListWidget ilw = (XedwListWidget) w;
X
X  if (ilw->xedwList.multiple == True)
X    if ( (CvtToItem(w, event->xbutton.x, event->xbutton.y, &item))
X	== OUT_OF_RANGE)
X      XedwListUnhighlight(w, XedwAll);     /* Unhighlight all current items. */
X    else 
X      if (IsHighlighted(w, item))	/* If already highlighted, */
X	XedwListUnhighlight(w, item);	/* unhighlight it */
X      else
X	XedwListHighlight(w, item);   	/* otherwise highlight it */
X  else
X    XBell(XtDisplay(w), 100);
X}
X
X/* 
X * Return state of a list item 
X */
Xstatic Boolean IsHighlighted(Widget w, int item)
X{
X  XedwListWidget ilw = (XedwListWidget) w;
X  LinkedList *list = ilw->xedwList.is_highlighted;
X  Boolean ret_val;
X
X  while (list != NULL && list->index != item && list->index != NO_HIGHLIGHT)
X    list = list->next;
X  
X  if (list == NULL || list->index == NO_HIGHLIGHT)
X    ret_val=FALSE;
X  else
X    ret_val=TRUE;
X  
X  return(ret_val);	/* true if item was in list false otherwise */
X}
X
X/*
X * Set specified arguments into widget
X */
X
Xstatic Boolean SetValues(Widget current, 
X			 Widget request, 
X			 Widget new)
X{
X  XedwListWidget cl = (XedwListWidget) current;
X  XedwListWidget rl = (XedwListWidget) request;
X  XedwListWidget nl = (XedwListWidget) new;
X  Boolean redraw = FALSE;
X
X  if ((cl->xedwList.foreground != rl->xedwList.foreground) ||
X      (cl->core.background_pixel != rl->core.background_pixel) ||
X      (cl->xedwList.font != rl->xedwList.font) ) {
X    XtDestroyGC(cl->xedwList.normgc);
X    XtDestroyGC(cl->xedwList.graygc);
X    XtDestroyGC(cl->xedwList.revgc);
X    GetGCs(new);
X    redraw = TRUE;
X  }
X
X  /* Reset row height. */
X  
X  if ((cl->xedwList.row_space != rl->xedwList.row_space) ||
X      (cl->xedwList.font != rl->xedwList.font)           ||
X      (cl->xedwList.show_icons != rl->xedwList.show_icons) ||
X      (cl->xedwList.icon_width != rl->xedwList.icon_width)           ||
X      (cl->xedwList.icon_height != rl->xedwList.icon_height))
X    if (rl->xedwList.show_icons) 
X      nl->xedwList.row_height = nl->xedwList.font->max_bounds.ascent
X	+ nl->xedwList.font->max_bounds.descent
X	+ nl->xedwList.row_space
X        + nl->xedwList.icon_height;
X    else
X      nl->xedwList.row_height = nl->xedwList.font->max_bounds.ascent
X	+ nl->xedwList.font->max_bounds.descent
X	+ nl->xedwList.row_space;
X
X  if ((cl->core.width != rl->core.width)                     ||
X      (cl->core.height != rl->core.height)                   ||
X      (cl->xedwList.internal_width != rl->xedwList.internal_width)   ||
X      (cl->xedwList.internal_height != rl->xedwList.internal_height) ||
X      (cl->xedwList.column_space != rl->xedwList.column_space)       ||
X      (cl->xedwList.row_space != rl->xedwList.row_space)             ||
X      (cl->xedwList.default_cols != rl->xedwList.default_cols)       ||
X      ((cl->xedwList.force_cols != rl->xedwList.force_cols) &&
X       (rl->xedwList.force_cols != rl->xedwList.ncols))           ||
X      (cl->xedwList.vertical_cols != rl->xedwList.vertical_cols)     ||
X      (cl->xedwList.longest != rl->xedwList.longest)                 ||
X      (cl->xedwList.nitems != rl->xedwList.nitems)                   ||
X      (cl->xedwList.font != rl->xedwList.font)                       ||
X      (cl->xedwList.show_icons != rl->xedwList.show_icons)           ||
X      (cl->xedwList.icon_width != rl->xedwList.icon_width)           ||
X      (cl->xedwList.icon_height != rl->xedwList.icon_height)         ||
X      (cl->xedwList.default_icon != rl->xedwList.default_icon)       ||
X      (cl->xedwList.xedwList != rl->xedwList.xedwList)                        ) {
X    
X    ResetXedwList(new, TRUE, TRUE);
X    redraw = TRUE;
X  }
X
X  if (cl->xedwList.xedwList != rl->xedwList.xedwList)
X    nl->xedwList.highlight = NO_HIGHLIGHT;
X
X  if ((cl->core.sensitive != rl->core.sensitive) ||
X      (cl->core.ancestor_sensitive != rl->core.ancestor_sensitive)) {
X    nl->xedwList.highlight = NO_HIGHLIGHT;
X    redraw = TRUE;
X  }
X  
X  if (!XtIsRealized(current))
X    return(FALSE);
X
X  return(redraw);
X}
X
X/* Exported Functions */
X
X/*  Function Name: XedwListChange.
X *  Description: Changes the xedwList being used and shown.
X *  Arguments: w - the xedwList widget.
X *                 xedwList - the new xedwList.
X *                 nitems - the number of items in the xedwList.
X *                 longest - the length (in Pixels) of the longest element
X *                           in the xedwList.
X *                 resize - if TRUE the the xedwList widget will
X *                          try to resize itself.
X *  Returns: none.
X *      NOTE:      If nitems of longest are <= 0 then they will be calculated.
X *                 If nitems is <= 0 then the xedwList needs to be NULL terminated.
X */
X
Xvoid XedwListChange(Widget w, XedwList **xedwList, 
X			   int nitems, int longest, Boolean resize_it)
X{
X  XedwListWidget ilw = (XedwListWidget) w;
X
X  ilw->xedwList.xedwList = xedwList;
X  
X  if (nitems <= 0) nitems = 0;
X  ilw->xedwList.nitems = nitems;
X  if (longest <= 0) longest = 0;
X  ilw->xedwList.longest = longest;
X
X  ResetXedwList(w, resize_it, resize_it);
X  /* Free the memeory in the old list TODO */
X  ilw->xedwList.is_highlighted->index = ilw->xedwList.highlight = NO_HIGHLIGHT;
X  ilw->xedwList.is_highlighted->next = NULL;
X  if ( XtIsRealized(w) )
X    Redisplay(w, NULL, NULL);
X}
X
X/*  Function Name: XedwListUnhighlight
X *  Description: unlights the current highlighted element.
X *  Arguments: w - the widget.
X *  Returns: none.
X */
X
Xvoid XedwListUnhighlight(Widget w, int item)
X{
X  XedwListWidget ilw = ( XedwListWidget ) w;
X  LinkedList *list = ilw->xedwList.is_highlighted;
X  LinkedList *temp;
X
X  if (ilw->xedwList.is_highlighted->index != NO_HIGHLIGHT)
X    if (item == XedwAll) {
X      ilw->xedwList.highlight = list->index;	
X      PaintItemName(w, list->index, XedwOff);	/* unhighlight ALL */
X      while (list->next != NULL) {		
X	temp = list;
X	list = list->next;
X	ilw->xedwList.highlight = list->index;
X	PaintItemName(w, list->index, XedwOff);
X	XtFree(temp);
X      }
X      list->index = NO_HIGHLIGHT;
X      ilw->xedwList.is_highlighted = list;
X    } else {
X      ilw->xedwList.highlight = item;
X      PaintItemName(w, item, XedwOff);
X      RemoveNode(w, item);
X    }
X}
X
X/*  Function Name: XedwListHighlight
X *  Description: Highlights the given item.
X *  Arguments: w - the xedwList widget.
X *             item - the item to hightlight.
X *  Returns: none.
X */
X
Xvoid XedwListHighlight(Widget w, int item)
X{
X  XedwListWidget ilw = ( XedwListWidget ) w;
X  int n;
X
X  if (XtIsSensitive(w)) {
X    if (item == XedwAll) {
X      for(n=0; n < ilw->xedwList.nitems; n++) {
X	ilw->xedwList.highlight = n;
X	RemoveNode(w, n);
X	AddNode(w, n);
X	PaintItemName(w, n, XedwOn);
X      }
X    } else {
X      ilw->xedwList.highlight = item;
X      RemoveNode(w, item);
X      AddNode(w, item);
X      PaintItemName(w, item, XedwOn);    
X    }
X  }
X}
X
X/*  Function Name: XedwListShowCurrent
X *  Description: returns the currently highlighted object.
X *  Arguments: w - the xedwList widget.
X *  Returns: the info about the currently highlighted object.
X */
X
XXedwListReturnStruct *XedwListShowCurrent(Widget w)
X{
X  XedwListWidget ilw = ( XedwListWidget ) w;
X  LinkedList *hl = ilw->xedwList.is_highlighted;
X  XedwListReturnStruct *ret_val, *rest;
X
X  rest = NULL;
X  while (hl != NULL) {
X    ret_val = (XedwListReturnStruct *) XtMalloc (sizeof (XedwListReturnStruct));
X    
X    ret_val->xedwList_index = hl->index;
X    if (ret_val->xedwList_index == XDTM_LIST_NONE)
X      ret_val->string = "";
X    else
X      ret_val->string = 
X	XtNewString(ilw->xedwList.xedwList[ret_val->xedwList_index]->string);
X    hl = hl->next;
X    ret_val->next = rest;
X    rest = ret_val;
X  }
X  return(ret_val);
X}
X
XBoolean XedwListSelection(Widget w)
X{
X  XedwListWidget ilw = ( XedwListWidget ) w;
X  LinkedList *hl = ilw->xedwList.is_highlighted;
X  Boolean ret_val = True;
X  
X  if (hl->index == NO_HIGHLIGHT)
X    ret_val = False;
X
X  return(ret_val);
X}
X
X/* AddNode to LinkedList of highlighted items
X */
Xstatic void AddNode(Widget w, int item)
X{
X  XedwListWidget ilw = ( XedwListWidget ) w;
X  LinkedList *list = ilw->xedwList.is_highlighted;
X  LinkedList *temp;
X
X  if (list->index != NO_HIGHLIGHT) {
X    temp = (LinkedList*) XtMalloc (sizeof(LinkedList));
X    temp->index = item;
X    temp->next = list;
X    ilw->xedwList.is_highlighted = temp;
X  } else 
X    list->index = item;
X}
X  
X
Xstatic void RemoveNode(Widget w, int item)
X{
X  XedwListWidget ilw = ( XedwListWidget ) w;
X  LinkedList *list = ilw->xedwList.is_highlighted;
X  LinkedList *last;                              
X
X  last = list;
X  while (list != NULL && list->index != item) {
X    last = list;
X    list=list->next;
X  }
X  if (list != NULL) {	    	/* item WAS found */
X    if (last == list) {		/* it was the first item */
X      if (list->next == NULL)   /* there are no more in the list */
X	list->index = NO_HIGHLIGHT;
X      else {
X	ilw->xedwList.is_highlighted = list->next;
X	XtFree(list);
X      }
X    } else {
X      last->next = list->next;
X      XtFree(list);
X    }
X  } 
X}
SHAR_EOF
echo "File code/Xedw/XedwList.c is complete"
chmod 0644 code/Xedw/XedwList.c || echo "restore of code/Xedw/XedwList.c fails"
echo "x - extracting code/Xedw/XedwList.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/XedwList.h &&
X/*
X * Copyright 1989 Massachusetts Institute of Technology
X *
X * Permission to use, copy, modify, distribute, and sell this software and its
X * documentation for any purpose is hereby granted without fee, provided that
X * the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of M.I.T. not be used in advertising or
X * publicity pertaining to distribution of the software without specific,
X * written prior permission.  M.I.T. makes no representations about the
X * suitability of this software for any purpose.  It is provided "as is"
X * without express or implied warranty.
X *
X * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
X * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
X * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
X * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
X * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X */
X
X/*
X * XedwList.h - XedwList widget
X *
X * This is the XedwList widget. It is very similar to the Athena Widget List,
X * except it has the ability to display an icon with the string.
X * It allows the user to select an item in a xedwList and notifies the
X * application through a callback function.
X *
X *  List Created:   8/13/88
X *  By:     Chris D. Peterson
X *                      MIT X Consortium
X *
X * Modified to XedwList: 1/26/90
X * By:      Edward Groenendaal
X *                      University of Sussex, UK.
X */
X
X#ifndef _XawXedwList_h
X#define _XawXedwList_h
X
X/***********************************************************************
X *
X * XedwList Widget
X *
X ***********************************************************************/
X
X#include <X11/Xaw/Simple.h>
X
X/* Resources:
X
X Name               Class           RepType             Default Value
X ----               -----           -------             -------------
X background         Background      Pixel               XtDefaultBackground
X border             BorderColor     Pixel               XtDefaultForeground
X borderWidth        BorderWidth     Dimension           1
X callback           Callback        XtCallbackXedwList  NULL       **6
X columnSpacing      Spacing         Dimension           6
X cursor             Cursor          Cursor              left_ptr
X defaultColumns     Columns         int                 2          **5
X destroyCallback    Callback        Pointer             NULL
X font               Font            XFontStruct*        XtDefaultFont
X forceColumns       Columns         Boolean             False      **5
X foreground         Foreground      Pixel               XtDefaultForeground
X height             Height          Dimension           0          **1
X insensitiveBorder  Insensitive     Pixmap              Gray
X internalHeight     Height          Dimension           2
X internalWidth      Width           Dimension           4
X xedwList           XedwList        XedwList **      NULL       **2
X iconWidth          Width           Dimension           32
X iconHeight         Height          Dimension           32
X longest            Longest         int                 0          **3  **4
X mappedWhenManaged  MappedWhenManaged   Boolean         True
X mSelections	    Boolean         Boolean             False
X numberStrings      NumberStrings   int                 0          **4
X pasteBuffer        Boolean         Boolean             False
X rowSpacing         Spacing         Dimension           4
X sensitive          Sensitive       Boolean             True
X showIcons          Boolean         Boolean             False                  
X verticalList       Boolean         Boolean             False
X width              Width           Dimension           0          **1
X x                  Position        Position            0
X y                  Position        Position            0
X
X **1 - If the Width or Height of the xedwList widget is zero (0) then the value
X       is set to the minimum size necessay to fit the entire list.
X
X       If both Width and Height are zero then they are adjusted to fit the
X       entire list that is created width the number of default columns
X       specified in the defaultColumns resource.
X
X **2 - This is an array of strings the specify elements of the xedwList.
X       This resource must be specified.
X
X **3 - Longest is the length of the widest string in pixels.
X
X **4 - If either of these values are zero (0) then the xedwList widget calculates
X       the correct value.
X
X       (This allows you to make startup faster if you already have
X        this information calculated)
X
X       NOTE: If the numberStrings value is zero the xedwList must
X             be NULL terminated.
X
X **5 - By setting the XedwList.Columns resource you can force the application to
X       have a given number of columns.
X
X **6 - This returns the name and index of the item selected in an
X       XedwListReturnStruct that is pointed to by the client_data
X       in the CallbackProc.
X
X*/
X
X
X/*
X * Value returned when there are no highlighted objects.
X */
X
X#define XDTM_LIST_NONE -1
X
X#define XtCXedwList "XedwList"
X#define XtCSpacing "Spacing"
X#define XtCColumns "Columns"
X#define XtCLongest "Longest"
X#define XtCNumberStrings "NumberStrings"
X
X#define XtNcursor "cursor"
X#define XtNcolumnSpacing "columnSpacing"
X#define XtNdefaultColumns "defaultColumns"
X#define XtNforceColumns "forceColumns"
X#define XtNxedwList "xedwList"
X#define XtNiconWidth "iconWidth"
X#define XtNiconHeight "iconHeight"
X#define XtNdefaultIcon "defaultIcon"
X#define XtNlongest "longest"
X#define XtNnumberStrings "numberStrings"
X#define XtNpasteBuffer "pasteBuffer"
X#define XtNrowSpacing "rowSpacing"
X#define XtNshowIcons "showIcons"
X#define XtNmSelections "mSelections"
X#define XtNverticalList "verticalList"
X
X#define XedwSingle    1
X#define XedwMultiple  2
X
X#define XedwAll			-1
X
X#define IconBitmapWidth       32
X#define IconBitmapHeight      32
X
X/* Class record constants */
X
Xextern WidgetClass xedwListWidgetClass;
X
Xtypedef struct _XedwListClassRec *XedwListWidgetClass;
Xtypedef struct _XedwListRec      *XedwListWidget;
X
X/* The structure of XedwList */
X
Xtypedef struct _XedwList {
X  String string;
X  Pixmap icon;
X} XedwList;
X
X/* The xedwList return structure. */
X
Xtypedef struct _XedwListReturnStruct {
X  String   string;			/* String */
X  int      xedwList_index;		/* Index into list */
X  struct _XedwListReturnStruct *next;	/* Next highlighted entry */
X} XedwListReturnStruct;
X
X/******************************************************************
X *
X * Exported Functions
X *
X *****************************************************************/
X
X/*  Function Name:  XedwListChange.
X *  Description:    Changes the xedwList being used and shown.
X *  Arguments:      w        -  the xedwList widget.
X *                  xedwList -  the new xedwList.
X *                  nitems   -  the number of items in the xedwList.
X *                  longest  -  the length (in Pixels) of the longest element
X *                              in the xedwList.
X *                  resize   -  if TRUE the the xedwList widget will
X *                              try to resize itself.
X *  Returns: none.
X *  NOTE:    If nitems of longest are <= 0 then they will be caluculated.
X *           If nitems is <= 0 then the xedwList needs to be NULL terminated.
X */
X
Xextern void XedwListChange(Widget, XedwList**,int,int,Boolean); 
X
X/*  Function Name:  XedwListUnhighlight
X *  Description:    unlights the current highlighted element.
X *  Arguments:      w   -   the widget.
X *  Returns: none.
X */
X
Xextern void XedwListUnhighlight(Widget, int);
X
X/*  Function Name:  XedwListHighlight
X *  Description:    Highlights the given item.
X *  Arguments:      w    -  the xedwList widget.
X *                  item -  the item to hightlight.
X *  Returns: none.
X */
X
Xextern void XedwListHighlight(Widget, int); 
X
X
X/*  Function Name: XedwListShowCurrent
X *  Description: returns the currently highlighted objects.
X *  Arguments: w - the xedwList widget.
X *  Returns: the info about the currently highlighted object.
X */
X
Xextern XedwListReturnStruct *XedwListShowCurrent(Widget);
X
Xextern Boolean XedwListSelection(Widget);
X
X#endif /* _XedwList_h */
X
SHAR_EOF
chmod 0644 code/Xedw/XedwList.h || echo "restore of code/Xedw/XedwList.h fails"
echo "x - extracting code/Xedw/XedwListP.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/XedwListP.h &&
X/*
X * $XConsortium: XedwListP.h,v 1.12 89/12/11 15:09:04 kit Exp $
X *
X * Copyright 1989 Massachusetts Institute of Technology
X *
X * Permission to use, copy, modify, distribute, and sell this software and its
X * documentation for any purpose is hereby granted without fee, provided that
X * the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of M.I.T. not be used in advertising or
X * publicity pertaining to distribution of the software without specific,
X * written prior permission.  M.I.T. makes no representations about the
X * suitability of this software for any purpose.  It is provided "as is"
X * without express or implied warranty.
X *
X * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
X * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
X * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
X * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
X * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X *
X * Author:  Chris D. Peterson, MIT X Consortium
X */
X
X
X/* 
X * XedwListP.h - Private definitions for XedwList widget
X * 
X * This is the XedwList widget, it is useful to display a xedwList, without the
X * overhead of having a widget for each item in the xedwList.  It allows 
X * the user to select an item in a xedwList and notifies the application through
X * a callback function.
X *
X *	Created: 	8/13/88
X *	By:		Chris D. Peterson
X *                      MIT - Project Athena
X */
X
X#ifndef _XedwListP_h
X#define _XedwListP_h
X
X/***********************************************************************
X *
X * XedwList Widget Private Data
X *
X ***********************************************************************/
X
X#include <X11/Xaw/SimpleP.h>
X#include "XedwList.h"
X
X#define NO_HIGHLIGHT            XDTM_LIST_NONE
X#define OUT_OF_RANGE            -1
X#define OKAY                     0
X#define XedwOff			 0
X#define XedwOn			 1
X
X/* New fields for the XedwList widget class record */
X
Xtypedef struct {int foo;} XedwListClassPart;
X
X/* Full class record declaration */
Xtypedef struct _XedwListClassRec {
X    CoreClassPart      	core_class;
X    SimpleClassPart    	simple_class;
X    XedwListClassPart	xedwList_class;
X} XedwListClassRec;
X
Xextern XedwListClassRec xedwListClassRec;
X
Xtypedef struct _LinkedList {
X  int index;
X  struct _LinkedList *next;
X} LinkedList;
X
X/* New fields for the XedwList widget record */
Xtypedef struct {
X  /* resources */
X  Pixel         foreground;
X  Dimension     internal_width,
X                internal_height,
X                column_space,
X                row_space,
X                icon_width,
X                icon_height;
X  int           default_cols;
X  Boolean       force_cols,
X                paste,
X                vertical_cols,
X                show_icons,	/* Show icons with list */
X  		multiple;       /* Allow multiple selections */
X  int           longest;
X  int           nitems;		/* number of items in the xedwList. */
X  XFontStruct	*font;
X  XedwList  **xedwList;
X  XtCallbackList  callback;
X
X  /* private state */
X
X  LinkedList  *is_highlighted;	/* set to the items currently highlighted. */
X  int         highlight,	/* set to the item that should be highlighted.*/
X              col_width,	/* width of each column. */
X              row_height,	/* height of each row. */
X              nrows,		/* number of rows in the xedwList. */
X              ncols;		/* number of columns in the xedwList. */
X  GC	      normgc,		/* a couple o' GC's. */
X              revgc,
X              graygc;		/* used when inactive. */
X  Pixmap      default_icon;
X
X} XedwListPart;
X
X
X/****************************************************************
X *
X * Full instance record declaration
X *
X ****************************************************************/
X
Xtypedef struct _XedwListRec {
X  CorePart	core;
X  SimplePart	simple;
X  XedwListPart	xedwList;
X} XedwListRec;
X
X#endif /* _XedwListP_h */
X
X
X
SHAR_EOF
chmod 0644 code/Xedw/XedwListP.h || echo "restore of code/Xedw/XedwListP.h fails"
echo "x - extracting code/Xedw/XedwTree.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/XedwTree.c &&
X#include <X11/copyright.h>
X
X/* $XConsortium: Template.c,v 1.2 88/10/25 17:40:25 swick Exp $ */
X/* Copyright	Massachusetts Institute of Technology	1987, 1988 */
X
X#include <X11/IntrinsicP.h>
X#include <X11/StringDefs.h>
X#include "TemplateP.h"
X
Xstatic XtResource resources[] = {
X#define offset(field) XtOffset(TemplateWidget, template.field)
X    /* {name, class, type, size, offset, default_type, default_addr}, */
X    { XtNtemplateResource, XtCTemplateResource, XtRTemplateResource, sizeof(char*),
X	  offset(resource), XtRString, "default" },
X#undef offset
X};
X
Xstatic void TemplateAction(/* Widget, XEvent*, String*, Cardinal* */);
X
Xstatic XtActionsRec actions[] =
X{
X  /* {name, procedure}, */
X    {"template",	TemplateAction},
X};
X
Xstatic char translations[] =
X"<Key>:		template()	\n\
X";
X
XTemplateClassRec templateClassRec = {
X  { /* core fields */
X    /* superclass		*/	(WidgetClass) &widgetClassRec,
X    /* class_name		*/	"Template",
X    /* widget_size		*/	sizeof(TemplateRec),
X    /* class_initialize		*/	NULL,
X    /* class_part_initialize	*/	NULL,
X    /* class_inited		*/	FALSE,
X    /* initialize		*/	NULL,
X    /* initialize_hook		*/	NULL,
X    /* realize			*/	XtInheritRealize,
X    /* actions			*/	actions,
X    /* num_actions		*/	XtNumber(actions),
X    /* resources		*/	resources,
X    /* num_resources		*/	XtNumber(resources),
X    /* xrm_class		*/	NULLQUARK,
X    /* compress_motion		*/	TRUE,
X    /* compress_exposure	*/	TRUE,
X    /* compress_enterleave	*/	TRUE,
X    /* visible_interest		*/	FALSE,
X    /* destroy			*/	NULL,
X    /* resize			*/	NULL,
X    /* expose			*/	NULL,
X    /* set_values		*/	NULL,
X    /* set_values_hook		*/	NULL,
X    /* set_values_almost	*/	XtInheritSetValuesAlmost,
X    /* get_values_hook		*/	NULL,
X    /* accept_focus		*/	NULL,
X    /* version			*/	XtVersion,
X    /* callback_private		*/	NULL,
X    /* tm_table			*/	translations,
X    /* query_geometry		*/	XtInheritQueryGeometry,
X    /* display_accelerator	*/	XtInheritDisplayAccelerator,
X    /* extension		*/	NULL
X  },
X  { /* template fields */
X    /* empty			*/	0
X  }
X};
X
XWidgetClass templateWidgetClass = (WidgetClass)&templateClassRec;
SHAR_EOF
chmod 0644 code/Xedw/XedwTree.c || echo "restore of code/Xedw/XedwTree.c fails"
echo "x - extracting code/Xedw/XedwTree.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/XedwTree.h &&
X#include <X11/copyright.h>
X
X/* $XConsortium: Template.h,v 1.4 89/07/21 01:41:49 kit Exp $ */
X/* Copyright	Massachusetts Institute of Technology	1987, 1988 */
X
X#ifndef _Template_h
X#define _Template_h
X
X/****************************************************************
X *
X * Template widget
X *
X ****************************************************************/
X
X/* Resources:
X
X Name		     Class		RepType		Default Value
X ----		     -----		-------		-------------
X background	     Background		Pixel		XtDefaultBackground
X border		     BorderColor	Pixel		XtDefaultForeground
X borderWidth	     BorderWidth	Dimension	1
X destroyCallback     Callback		Pointer		NULL
X height		     Height		Dimension	0
X mappedWhenManaged   MappedWhenManaged	Boolean		True
X sensitive	     Sensitive		Boolean		True
X width		     Width		Dimension	0
X x		     Position		Position	0
X y		     Position		Position	0
X
X*/
X
X/* define any special resource names here that are not in <X11/StringDefs.h> */
X
X#define XtNtemplateResource "templateResource"
X
X#define XtCTemplateResource "TemplateResource"
X
X/* declare specific TemplateWidget class and instance datatypes */
X
Xtypedef struct _TemplateClassRec*	TemplateWidgetClass;
Xtypedef struct _TemplateRec*		TemplateWidget;
X
X/* declare the class constant */
X
Xextern WidgetClass templateWidgetClass;
X
X#endif /* _Template_h */
SHAR_EOF
chmod 0644 code/Xedw/XedwTree.h || echo "restore of code/Xedw/XedwTree.h fails"
echo "x - extracting code/Xedw/XedwTreeP.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > code/Xedw/XedwTreeP.h &&
X#include <X11/copyright.h>
X
X/* $XConsortium: TemplateP.h,v 1.4 89/07/21 01:41:48 kit Exp $ */
X/* Copyright	Massachusetts Institute of Technology	1987, 1988 */
X
X#ifndef _TemplateP_h
X#define _TemplateP_h
X
X#include "Template.h"
X/* include superclass private header file */
X#include <X11/CoreP.h>
X
X/* define unique representation types not found in <X11/StringDefs.h> */
X
X#define XtRTemplateResource "TemplateResource"
X
Xtypedef struct {
X    int empty;
X} TemplateClassPart;
X
Xtypedef struct _TemplateClassRec {
X    CoreClassPart	core_class;
X    TemplateClassPart	template_class;
X} TemplateClassRec;
X
Xextern TemplateClassRec templateClassRec;
X
Xtypedef struct {
X    /* resources */
X    char* resource;
X    /* private state */
X} TemplatePart;
X
Xtypedef struct _TemplateRec {
X    CorePart		core;
X    TemplatePart	template;
X} TemplateRec;
X
X#endif /* _TemplateP_h */
SHAR_EOF
chmod 0644 code/Xedw/XedwTreeP.h || echo "restore of code/Xedw/XedwTreeP.h fails"
rm -f s2_seq_.tmp
echo "You have unpacked the last part"
exit 0