home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
x
/
volume13
/
xdtm
/
part04
< prev
next >
Wrap
Internet Message Format
|
1991-05-18
|
51KB
Path: uunet!cs.utexas.edu!sun-barr!newstop!exodus!cogs.sussex.ac.uk
From: eddyg@cogs.sussex.ac.uk (EdwardJ. Groenendaal)
Newsgroups: comp.sources.x
Subject: v13i009: xdtm - X Desktop Manager for the X Window System, Part04/11
Message-ID: <13573@exodus.Eng.Sun.COM>
Date: 19 May 91 00:02:58 GMT
References: <csx-13i006:xdtm@uunet.UU.NET>
Sender: news@exodus.Eng.Sun.COM
Lines: 1437
Approved: argv@sun.com
Submitted-by: Edward "J." Groenendaal <eddyg@cogs.sussex.ac.uk>
Posting-number: Volume 13, Issue 9
Archive-name: xdtm/part04
Submitted-by: eddyg@cste
Archive-name: xdtm/part04
---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is part 04 of xdtm
# ============= xdtm/Xedw/XedwListP.h ==============
if test ! -d 'xdtm'; then
echo 'x - creating directory xdtm'
mkdir 'xdtm'
fi
if test ! -d 'xdtm/Xedw'; then
echo 'x - creating directory xdtm/Xedw'
mkdir 'xdtm/Xedw'
fi
if test -f 'xdtm/Xedw/XedwListP.h' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/Xedw/XedwListP.h (File already exists)'
else
echo 'x - extracting xdtm/Xedw/XedwListP.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/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 xdtm/Xedw/XedwListP.h ||
echo 'restore of xdtm/Xedw/XedwListP.h failed'
Wc_c="`wc -c < 'xdtm/Xedw/XedwListP.h'`"
test 4117 -eq "$Wc_c" ||
echo 'xdtm/Xedw/XedwListP.h: original size 4117, current size' "$Wc_c"
fi
# ============= xdtm/appman.c ==============
if test -f 'xdtm/appman.c' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/appman.c (File already exists)'
else
echo 'x - extracting xdtm/appman.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/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 <sys/wait.h>
X
X#ifndef TRUE_SYSV
X#include <sys/file.h> /* For access(2) */
X#endif
X
X#include <signal.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/* Thank Harald Vogt for persueding me to change my version of strstr
X * to mystrstr, not that you would get a clash if compiled with the
X * correct options.. but better safe than sorry.
X */
X
X#ifdef HAS_STRSTR
X#define mystrstr(cs, ct) strstr(cs, ct)
X#else
Xextern char *mystrstr(char *, char *);
X#endif
X
X/*****************************************************************************
X * createAppManagerWidgets *
X *****************************************************************************/
Xvoid createAppManagerWidgets(Widget topForm)
X{
X /* Create and initialise the widgets for the Application Manager and the
X * copy, move, and trash buttons below.
X *
X * - Takes a Widget which will be their parent.
X * + Returns nothing
X */
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 /* Translations for the Application Manager.. not quite what I wanted but
X * near enough that it doesn't matter.
X */
X static char defaultTranslations[] =
X "<Btn1Down>: Set()\n\
X <Btn1Up>: Unset()\n\
X <Btn1Up>(2): Notify() Unset()";
X
X /* Create Application Manager Selector */
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 /* Create Menu for Application Manager Selector, the panes are added after
X * parsing the config file.
X */
X selectionMenu = XtCreatePopupShell("selectionMenu",
X simpleMenuWidgetClass,
X appManagerButton,
X NULL, 0);
X
X
X /* Create Application Manager Viewport*/
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 /* Create Application Manager List */
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; /* Start off insensitive */
X
X /* Create Form to hold buttons in place, and nicely spaced */
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 /* Create the Pixmap for the trash button */
X trash = XCreateBitmapFromData(XtDisplay(topForm),
X RootWindowOfScreen(XtScreen(topForm)),
X trash_bits,
X trash_width, trash_height);
X
X /* Create Trash Button */
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 /* Create the Pixmap for the move button */
X move = XCreateBitmapFromData(XtDisplay(topForm),
X RootWindowOfScreen(XtScreen(topForm)),
X move_bits,
X move_width, move_height);
X
X /* Create the Move Button */
X i = t = i-1; /* Share resource settings with trash, and copy */
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 /* Create Pixmap for the copy button */
X copy = XCreateBitmapFromData(XtDisplay(topForm),
X RootWindowOfScreen(XtScreen(topForm)),
X copy_bits,
X copy_width, copy_height);
X
X /* Create the Copy Button */
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 /* Add the Callbacks for the Buttons */
X XtAddCallback(trashButton, XtNcallback, button_selected, Trash);
X XtAddCallback(copyButton, XtNcallback, button_selected, Copy);
X XtAddCallback(moveButton, XtNcallback, button_selected, Move);
X
X /* Add Callback and translations for the Application Manager */
X XtAddCallback(appManager, XtNcallback, program_selected, 0);
X appManTranslations = XtParseTranslationTable(defaultTranslations);
X XtUninstallTranslations(appManager);
X XtOverrideTranslations(appManager, appManTranslations);
X}
X
X/*****************************************************************************
X * initAppManager *
X *****************************************************************************/
Xpublic void initAppManager(Widget w)
X{
X /* Get the cursors, setup the path and signal handler for catching the
X * death of children. (Thanks to Christos Zoulas, Cornell for suggesting
X * the use of the signal handler).
X *
X * - Takes a Widget (any old widget will do!)
X * + Returns nothing
X */
X extern int count_chr(String, char);
X public void selectionChange(Widget, Cardinal, caddr_t);
X private void child_died(int, int);
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 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 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; /* Start in Normal Mode */
X
X /* Get path and put it into patharray, for use by execute to find programs */
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 * after many complaints the warning about non-fully qualified directories
X * has been removed!
X */
X n = 0;
X
X pathptr = strtok(path, ":");
X while (pathptr != NULL) {
X if (*pathptr == '/')
X patharray[n++] = pathptr;
X pathptr = strtok(NULL, ":");
X }
X
X pathsize = n;
X
X /* setup the signal handler for catching the childrens deaths */
X
X#ifdef SIGCLD
X signal(SIGCLD, child_died); /* Old */
X#else
X signal(SIGCHLD, child_died); /* New */
X#endif
X
X}
X
X/*****************************************************************************
X * button_selected *
X *****************************************************************************/
Xpublic void button_selected(Widget w, Cardinal type, caddr_t call_data)
X{
X /* One of the copy, move or delete buttons has been pressed, if
X * there are any files selected then do the stuff.
X *
X * - Takes a Widget, the Button type and call_data which is ignored
X * + Returns nothing
X */
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; /* first time button selected */
X static Boolean movefirst = True; /* first time button selected */
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); /* The dialog does the rest */
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); /* Remember src dir */
X copyfirst = False;
X } else { /* Second press, copy files */
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); /* Remember src dir */
X movefirst = False;
X } else {
X setCursor(left_ptr); /* Second press, move files */
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); /* Nothing selected - ring bell */
X
X}
X
X/*****************************************************************************
X * trashQueryResult *
X *****************************************************************************/
Xpublic void trashQueryResult(Widget w, Boolean delete, caddr_t call_data)
X{
X /* The action routine called by the Trash dialog,
X * if the person selected delete then try to delete those files,
X * otherwise do nothing.
X *
X * - Takes a Widget, A Boolean saying whether to delete the files, and
X * some call_data, ignored.
X * + Returns nothing
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) + 5));
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); /* Remove failed */
X }
X XtFree(rmstring);
X /* Delay so that systems using
X * NFS have time to update the directory table.
X */
X sleep(app_data.delay);
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 setCursor(left_ptr);
X
X /* free memory for list */
X freeReturnStruct();
X
X}
X
X/*****************************************************************************
X * copyQueryResult *
X *****************************************************************************/
Xpublic void copyQueryResult(Widget w, Boolean copy, caddr_t call_data)
X{
X /* The action routine called by the copy dialog,
X * if the user selected the copy button, copy the files,
X * otherwise do nothing.
X *
X * - Takes a widget, copy - whether to copy files, call_data - ignored
X * + Returns Nothing
X */
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 + 6));
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 + 5));
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 /* Delay so that systems using
X * NFS have time to update the directory table.
X */
X sleep(app_data.delay);
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/*****************************************************************************
X * moveQueryResult *
X *****************************************************************************/
Xpublic void moveQueryResult(Widget w, Boolean move, caddr_t call_data)
X{
X /* Action called when option selected in move dialog,
X * if move was selected move the file, otherwise do nothing.
X */
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(); /* Get rid of 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 + 7));
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 + 5));
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 /* Delay so that systems using
X * NFS have time to update the directory table.
X */
X sleep(app_data.delay);
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
X/*****************************************************************************
X * freeReturnStruct *
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
X/*****************************************************************************
X * selectionChange *
X *****************************************************************************/
Xpublic void selectionChange(Widget w, Cardinal selection, caddr_t crap)
X{
X /* Action called when a selection menu pane is chosen
X * Change the current selection list to that of 'selection'
X */
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
X/*****************************************************************************
X * program_selected *
X *****************************************************************************/
Xprivate void program_selected(Widget w, caddr_t client, caddr_t call)
X{
X /* Action called when an icon in the selection list is double clicked.
X * it executes the program.
X *
X * - All arguments ignored
X */
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 * Thanks to David Byers for spotting a bug here in v1.0
X */
X list = XedwListShowCurrent(w);
X if (list->xedwList_index == XDTM_LIST_NONE) {
X XBell(XtDisplay(w), 100);
X } else {
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 if ((program = build_arguments(program, node->options)) != NULL) {
X /* execute program */
X execute(NULL, filename, program, False);
X }
X }
X setCursor(NULL);
X
X}
X
X/*****************************************************************************
X * execute *
X *****************************************************************************/
Xpublic int execute(String fullname, String filename,
X String args, Boolean cwait)
X{
X /* This procedure executes a program. by specifying cwait to true
X * the parent will wait for the child to terminate, then return
X * the return value of the child.
X *
X * - Takes the full path of the program to be executed, maybe NULL.
X * filename of the program to be executed,
X * program argument list, e.g. "emacs filename",
X * whether to wait for the child to terminate.
X * + returns the return value from the child if cwait is set.
X */
X
X typedef enum {ready, quote, normal, quoteready} QModes;
X
X public Cardinal count_chr(String, char);
X private void child_died(void);
X QModes mode;
X Cardinal i, n, arglen;
X int result, pid, fd;
X int status = 0;
X String *newargs, strptr;
X int w_stat;
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) + 5)
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 * The number of arguments is always less than or equal to the number
X * of spaces in the args + one.
X * If a string of characters is enclosed within quotes, it is counted
X * as a single argument.
X * Maybe not pretty - but fast.
X */
X
X newargs = (char **) XtMalloc (sizeof(char*) * (count_chr(args, ' ') + 2));
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 newargs[n++] = args+i;
X if (mode == ready)
X mode = normal;
X else
X mode = quote;
X }
X break;
X }
X }
X
X if (cwait)
X#ifdef SIGCLD
X signal(SIGCLD, SIG_DFL);
X#else
X signal(SIGCHLD, SIG_DFL);
X#endif
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
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 /* The exec failed, ring the bell then exit */
X
X XBell(XtDisplay(appManager), 100);
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(&w_stat);
X if (WIFEXITED(w_stat)) /* jcc */
X status = WEXITSTATUS(w_stat); /* ejg */
X else
X status = 1;
X fprintf(stderr, "");
X#ifdef SIGCLD
X signal(SIGCLD, child_died);
X#else
X signal(SIGCHLD, child_died);
X#endif
X }
X }
X
X return(status);
X}
X
X/*****************************************************************************
X * build_arguments *
X *****************************************************************************/
Xpublic String build_arguments(String program, SelOptions options)
X{
X /* Given the program with it's previous arguments, this procedure
X * will insert any highlighted files into the place specified by
X * the !@ or on the end if none found.
X *
X * - Takes the program string, and whether the program is allowed to
X * take arguments, if so how many.
X * + Returns the resultant command line.
X */
X
X extern void changestate(Boolean);
X extern String getfilename(String);
X extern void query_dialog(String, Boolean);
X extern Widget directoryManager;
X XedwListReturnStruct *list, *tmplist;
X String ptr, tmpptr, arguments;
X Cardinal number = 0;
X
X /* Get the list */
X list = XedwListShowCurrent(directoryManager);
X
X arguments = XtNewString(" ");
X if (options != N_SEL) {
X if (list->xedwList_index == XDTM_LIST_NONE) {
X query_dialog("No files selected!", False);
X } else {
X while (list != NULL) {
X ptr = getfilename(list->string);
X arguments = XtRealloc (arguments, sizeof(char) *
X (((arguments == NULL) ? 0 : strlen(arguments)) +
X strlen(ptr) + 10));
X strcat(arguments, " ");
X strcat(arguments, ptr);
X tmplist = list;
X list = list->next;
X XtFree(tmplist);
X number++;
X }
X if (options == O_SEL && number != 1) {
X query_dialog("only ONE file!", False);
X program = NULL;
X } else {
X /* insert the arguments into the program string */
X program = XtRealloc (program, sizeof(char) * (strlen(program) +
X strlen(arguments) + 10));
X
X if ((ptr = mystrstr(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 }
X XtFree(arguments);
X }
X } else {
X if (list->xedwList_index != XDTM_LIST_NONE) {
X query_dialog("No files allowed!", False);
X program = NULL;
X }
X XtFree(list);
X }
X
X XedwListUnhighlight(directoryManager, XedwAll);
X changestate(False);
X
X return(program);
X}
X
X/*****************************************************************************
X * child_died *
X *****************************************************************************/
Xprivate void child_died(void)
X{
X /* Signal handler for when a child dies.
X * waits for the child (stops zombies), rings the Bell, then
X * Resets the signals.
X */
X extern Boolean directoryManagerNewDirectory(String);
X extern String cwd;
X
X unsigned int a;
X
X wait(&a);
X
X XBell(XtDisplay(appManager), 100);
X
X XFlush(XtDisplay(appManager));
X
X#ifdef SIGCLD
X signal(SIGCLD, child_died);
X#else
X signal(SIGCHLD, child_died);
X#endif
X
X if (app_data.dironexit == True)
X directoryManagerNewDirectory(cwd);
X
X}
SHAR_EOF
chmod 0644 xdtm/appman.c ||
echo 'restore of xdtm/appman.c failed'
Wc_c="`wc -c < 'xdtm/appman.c'`"
test 31645 -eq "$Wc_c" ||
echo 'xdtm/appman.c: original size 31645, current size' "$Wc_c"
fi
# ============= xdtm/bitmaps/Copy.Button ==============
if test ! -d 'xdtm/bitmaps'; then
echo 'x - creating directory xdtm/bitmaps'
mkdir 'xdtm/bitmaps'
fi
if test -f 'xdtm/bitmaps/Copy.Button' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/bitmaps/Copy.Button (File already exists)'
else
echo 'x - extracting xdtm/bitmaps/Copy.Button (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/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 xdtm/bitmaps/Copy.Button ||
echo 'restore of xdtm/bitmaps/Copy.Button failed'
Wc_c="`wc -c < 'xdtm/bitmaps/Copy.Button'`"
test 1076 -eq "$Wc_c" ||
echo 'xdtm/bitmaps/Copy.Button: original size 1076, current size' "$Wc_c"
fi
# ============= xdtm/bitmaps/Copy.Cursor ==============
if test -f 'xdtm/bitmaps/Copy.Cursor' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/bitmaps/Copy.Cursor (File already exists)'
else
echo 'x - extracting xdtm/bitmaps/Copy.Cursor (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/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 xdtm/bitmaps/Copy.Cursor ||
echo 'restore of xdtm/bitmaps/Copy.Cursor failed'
Wc_c="`wc -c < 'xdtm/bitmaps/Copy.Cursor'`"
test 496 -eq "$Wc_c" ||
echo 'xdtm/bitmaps/Copy.Cursor: original size 496, current size' "$Wc_c"
fi
# ============= xdtm/bitmaps/Copy.Mask ==============
if test -f 'xdtm/bitmaps/Copy.Mask' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/bitmaps/Copy.Mask (File already exists)'
else
echo 'x - extracting xdtm/bitmaps/Copy.Mask (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/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 xdtm/bitmaps/Copy.Mask ||
echo 'restore of xdtm/bitmaps/Copy.Mask failed'
Wc_c="`wc -c < 'xdtm/bitmaps/Copy.Mask'`"
test 452 -eq "$Wc_c" ||
echo 'xdtm/bitmaps/Copy.Mask: original size 452, current size' "$Wc_c"
fi
# ============= xdtm/bitmaps/EmptyTick ==============
if test -f 'xdtm/bitmaps/EmptyTick' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/bitmaps/EmptyTick (File already exists)'
else
echo 'x - extracting xdtm/bitmaps/EmptyTick (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/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 xdtm/bitmaps/EmptyTick ||
echo 'restore of xdtm/bitmaps/EmptyTick failed'
Wc_c="`wc -c < 'xdtm/bitmaps/EmptyTick'`"
test 266 -eq "$Wc_c" ||
echo 'xdtm/bitmaps/EmptyTick: original size 266, current size' "$Wc_c"
fi
# ============= xdtm/bitmaps/Grey.Mask ==============
if test -f 'xdtm/bitmaps/Grey.Mask' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/bitmaps/Grey.Mask (File already exists)'
else
echo 'x - extracting xdtm/bitmaps/Grey.Mask (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/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 xdtm/bitmaps/Grey.Mask ||
echo 'restore of xdtm/bitmaps/Grey.Mask failed'
Wc_c="`wc -c < 'xdtm/bitmaps/Grey.Mask'`"
test 875 -eq "$Wc_c" ||
echo 'xdtm/bitmaps/Grey.Mask: original size 875, current size' "$Wc_c"
fi
# ============= xdtm/bitmaps/Move.Button ==============
if test -f 'xdtm/bitmaps/Move.Button' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/bitmaps/Move.Button (File already exists)'
else
echo 'x - extracting xdtm/bitmaps/Move.Button (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/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 xdtm/bitmaps/Move.Button ||
echo 'restore of xdtm/bitmaps/Move.Button failed'
Wc_c="`wc -c < 'xdtm/bitmaps/Move.Button'`"
test 1076 -eq "$Wc_c" ||
echo 'xdtm/bitmaps/Move.Button: original size 1076, current size' "$Wc_c"
fi
# ============= xdtm/bitmaps/Move.Cursor ==============
if test -f 'xdtm/bitmaps/Move.Cursor' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/bitmaps/Move.Cursor (File already exists)'
else
echo 'x - extracting xdtm/bitmaps/Move.Cursor (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/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 xdtm/bitmaps/Move.Cursor ||
echo 'restore of xdtm/bitmaps/Move.Cursor failed'
Wc_c="`wc -c < 'xdtm/bitmaps/Move.Cursor'`"
test 496 -eq "$Wc_c" ||
echo 'xdtm/bitmaps/Move.Cursor: original size 496, current size' "$Wc_c"
fi
# ============= xdtm/bitmaps/Move.Mask ==============
if test -f 'xdtm/bitmaps/Move.Mask' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/bitmaps/Move.Mask (File already exists)'
else
echo 'x - extracting xdtm/bitmaps/Move.Mask (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/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 xdtm/bitmaps/Move.Mask ||
echo 'restore of xdtm/bitmaps/Move.Mask failed'
Wc_c="`wc -c < 'xdtm/bitmaps/Move.Mask'`"
test 452 -eq "$Wc_c" ||
echo 'xdtm/bitmaps/Move.Mask: original size 452, current size' "$Wc_c"
fi
# ============= xdtm/bitmaps/Tick ==============
if test -f 'xdtm/bitmaps/Tick' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/bitmaps/Tick (File already exists)'
else
echo 'x - extracting xdtm/bitmaps/Tick (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/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 xdtm/bitmaps/Tick ||
echo 'restore of xdtm/bitmaps/Tick failed'
Wc_c="`wc -c < 'xdtm/bitmaps/Tick'`"
test 251 -eq "$Wc_c" ||
echo 'xdtm/bitmaps/Tick: original size 251, current size' "$Wc_c"
fi
# ============= xdtm/bitmaps/Trash.Button ==============
if test -f 'xdtm/bitmaps/Trash.Button' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/bitmaps/Trash.Button (File already exists)'
else
echo 'x - extracting xdtm/bitmaps/Trash.Button (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/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 xdtm/bitmaps/Trash.Button ||
echo 'restore of xdtm/bitmaps/Trash.Button failed'
Wc_c="`wc -c < 'xdtm/bitmaps/Trash.Button'`"
test 1079 -eq "$Wc_c" ||
echo 'xdtm/bitmaps/Trash.Button: original size 1079, current size' "$Wc_c"
fi
true || echo 'restore of xdtm/bitmaps/file.icon failed'
echo End of part 4, continue with part 5
exit 0
--
Dan Heller
O'Reilly && Associates Z-Code Software Comp-sources-x:
Senior Writer President comp-sources-x@uunet.uu.net
argv@ora.com argv@zipcode.com