home *** CD-ROM | disk | FTP | other *** search
- /*
- * Systems Sciences Laboratory, Webster Research Center
- *
- * Copyright (c) 1988 Xerox Corporation. All rights reserved.
- *
- * Copyright protection claimed includes all forms and matters of copyrightable
- * material and information now allowed by statutory or judicial lay or
- * herinafter granted, including without limitation, material generated from
- * the software programs which are displayed on the screen such as icons,
- * screen display looks, etc.
- */
-
-
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/dir.h>
- #include <sys/stat.h>
-
- #include <X11/Xlib.h>
- #include <X11/IntrinsicP.h>
-
- #include <X11/cursorfont.h>
- #include <X11/Box.h>
- #include <X11/Label.h>
- #include <X11/StringDefs.h>
- #include <X11/Command.h>
- #include <X11/VPaned.h>
- #include <X11/Viewport.h>
- #include <X11/AsciiTextP.h>
- #include <X11/Shell.h>
- #include <X11/Dialog.h>
- #include "toggle.h"
- #include "option.h"
-
-
-
-
- #define max(a,b) (((a) > (b)) ? (a) : (b))
- #define min(a,b) (((a) < (b)) ? (a) : (b))
-
- #define Feep() XBell(curdisplay, 20)
-
- #define MakeArg(n, v){ args[numargs].name = n; \
- args[numargs].value = v; \
- numargs++; \
- }
- #define MAXNAME 255
-
-
- /* data structures */
- typedef struct _lineelement {
- XtTextPosition pa; /* specifies start position of line */
- XtTextPosition pe; /* specifies end position of line */
- int linenumber; /* line number in text file */
- struct _lineelement *next;
- } LineElement;
-
- typedef struct _searchelement {
- XtTextPosition pos1; /* specifies start position in widget */
- XtTextPosition pos2; /* specifies end position in widget */
- LineElement *lines; /* list of linenumbers */
- char name[MAXNAME + 1]; /* file name */
- } SearchElement;
-
- struct afile {
- u_short d_marked; /* file marked for deletion */
- char d_type; /* file type, e.g. 'd', 'c', 'f' */
- u_short d_nl; /* number of links */
- u_short d_uid; /* owner id */
- u_short d_gid; /* group id */
- u_short d_nlink; /* number of hard links */
- char d_access[12]; /* access rights */
- u_long d_size; /* file size */
- u_long d_ctime; /* last modification time */
- XtTextPosition d_pos1; /* start position of display */
- XtTextPosition d_pos2; /* end position of display */
- u_long d_ino; /* inode number of entry */
- u_short d_reclen; /* length of this record */
- u_short d_namlen; /* length of string in d_name */
- char d_name[MAXNAME + 1]; /* name must be no longer than this */
- };
-
- typedef struct _dialogdata {
- Widget w; /* widget which requested dialog */
- int start; /* index to first selected file in files[] */
- int end; /* index to last selected file in files[] */
- int current; /* index to currently handled file in files[] */
- char *answer; /* dialog provided by user */
- Boolean diag; /* save standard diagnostics */
- Boolean out; /* save standard output */
- int (*yes)(); /* yes function */
- int (*no)(); /* no function */
- int (*cancel)(); /* cancel function */
- } DialogData;
-
- /*
- * The DIRSIZ macro gives the minimum record length which will hold
- * the directory entry. This requires the amount of space in struct direct
- * without the d_name field, plus enough space for the name with a terminating
- * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
- */
-
- #define MYDIRSIZ(dp, length) \
- ((sizeof (struct afile) - (MAXNAME+1)) + \
- (((dp)->d_namlen+1 + 3 + length) &~ 3))
-
-
- /* misc externs */
- extern char *XtMalloc();
- extern char *XtRealloc();
- extern char *XtCalloc();
- extern char *index();
- extern char *rindex();
- extern char *getcwd();
-
-
- /* externs in xfilebrowser.c */
- extern char *filepattern;
- extern char *searchpattern;
- extern char *curdirectory;
- extern char *oldpattern;
- extern char *cmdline;
- extern int viewEdit;
-
- extern struct afile **files;
- extern int numfiles;
- extern SearchElement **hitfiles;
- extern int numhitfiles;
- extern int allowedit;
-
- extern Widget toplevel;
- extern Widget outer;
- extern Widget messwidget;
- extern Widget listwidget;
- extern Widget dirwidget;
- extern Widget fpatwindow;
- extern Widget grepwidget;
-
- Widget quitbutton; /* command button for quit */
- Widget listbutton; /* command button for list */
- Widget editbutton; /* command button for edit file selected
- in directory listing */
- Widget parentdirbutton; /* command button for selecting
- parent directory */
- Widget shellbutton; /* command button for invoking shell */
- Widget copybutton; /* command button for invoking copy */
- Widget renamebutton; /* command button for invoking rename */
- Widget deletebutton; /* command button for invoking delete on files */
-
- Widget grepbutton; /* command button for invoking grep on files */
- Widget grepwindow; /* string box to specify the grep search pattern */
- Widget grepeditbutton; /* command button for edit file selected
- in list of searched files */
-
- extern Display *curdisplay;
- extern XtTextSource messsource, listsource, grepsource;
-
- /* externals in util.c */
- extern Widget makeCommandButton();
- extern Widget makeBooleanButton();
- extern Widget makeStringBox();
- extern int select_file();
- extern char *expand_tilde();
-
- /* externs in commands.c */
- extern DoQuit();
- extern DoList();
- extern DoEdit();
- extern DoGrep();
- extern DoChangeDir();
- extern DoShell();
- extern DoParent();
- extern DoGrepEdit();
- extern DoCopy();
- extern DoRename();
- extern DoDelete();
-
- /* externs in ap.c */
- extern XtTextSource TCreateApAsSource();
-
- /* externs in popup.c */
- extern int create_confirm();
- extern int confirm_prompt();
- extern int check_confirm();
- extern int check_prompt();
-
- /* externs in scandir.c */
- extern int check_option();
- extern int currentid;
-
-