diff -rc xless-1.6.1/CHANGES xless-1.7/CHANGES
*** xless-1.6.1/CHANGES	Mon Jun  6 15:06:14 1994
--- xless-1.7/CHANGES	Thu Jul 28 19:56:20 1994
***************
*** 1,3 ****
--- 1,29 ----
+ Changes for version 1.7:
+  - pressing [Search Next] button before [Search] button has been pressed
+    caused a core dump (reported by Mark Phillips <phillips@eso.mc.xerox.com>)
+  - fixed search code so Case Insensitive mode is possible (reported by
+    Dale W. King <c23dwk@kocrsv01.delcoelect.com>)
+  - non-regexp search code is buggy; use regexp code for all searches
+    (indirectly suggested by Dale W. King <c23dwk@kocrsv01.delcoelect.com>)
+  - fixed popup windows so input line is as long as possible (suggested by
+    Roberto Horowitz <horowitz@canaima.Berkeley.EDU>)
+  - a couple of man page bugs were fixed by "Len Makin, CSIRO DIT Melbourne."
+    <Len.Makin@mel.dit.csiro.au>
+  - added '-version' option (suggested by Marty Leisner
+    <leisner@sdsp.mc.xerox.com>)
+  - stdin now has 'monitorFile' mode off by default (suggested by EVERYONE)
+  - text width is now calculated correctly when text contains TAB chars
+    (fixed by Dimitrios P. Bouras <dimitri@ee.ubc.ca>)
+  - fixed geometry bug reported by Al Womelsdorf <al@planet8.sp.paramax.com>
+  - included Xmu/Converters.h in window.c, which may allow OpenWindows
+    users to build (fixed by Huzefa Mustaly <c23hm@kocrsv01.delcoelect.com>)
+  - added [Background] button (suggested by Marty Leisner
+    <leisner@sdsp.mc.xerox.com>)
+  - fixed Help window geometry problem (pointed out by Gordon Berkley
+    <gordonb@mcil.comm.mot.com> and others)
+  - complain about 'printCmd' usage; honor 'printCommand' (pointed out by
+    Tim Medley <tlm@frb.gov>)
+ 
  Changes for version 1.6.1:
   - pressing [Help] button caused xless to dump core (reported by several
     people, fixed by Martin Boyer <gamin@ireq-robot.hydro.qc.ca>)
diff -rc xless-1.6.1/CHANGES xless-1.7/CHANGESxless-1.6.1/README xless-1.7/README
*** xless-1.6.1/README	Mon Jun  6 15:20:47 1994
--- xless-1.7/README	Tue Jun  7 20:39:41 1994
***************
*** 1,4 ****
! This is XLess version 1.6.1, a file browsing tool for the X Window System
  
  CREDITS:
     By Dave Glowacki - UCB Software Warehouse
--- 1,4 ----
! This is XLess version 1.7, a file browsing tool for the X Window System
  
  CREDITS:
     By Dave Glowacki - UCB Software Warehouse
***************
*** 41,48 ****
        the VISUAL or EDITOR environment variable)
  
  AVAILABLE FROM:
!    ftp.cs.berkeley.edu:/ucb/people/dglo/xless/xless-1.6.1.tar.gz
!    ftp.x.org:/contrib/applications/xless-1.6.1.tar.gz
  
  TESTED ON:
     SunOS 4.1.3
--- 41,48 ----
        the VISUAL or EDITOR environment variable)
  
  AVAILABLE FROM:
!    ftp.cs.berkeley.edu:/ucb/people/dglo/xless/xless-1.7.tar.gz
!    ftp.x.org:/contrib/applications/xless-1.7.tar.gz
  
  TESTED ON:
     SunOS 4.1.3
diff -rc xless-1.6.1/README xless-1.7/READMExless-1.6.1/TODO xless-1.7/TODO
*** xless-1.6.1/TODO	Fri Jun  3 11:54:43 1994
--- xless-1.7/TODO	Thu Jul 28 18:31:50 1994
***************
*** 1,7 ****
  Add a "Save" command to save STDIN.
  Add actions for all buttons
  Document actions
- Let Text widget do file memory management
  Handle appropriate 'less' options & keys
! Dynamic file redisplay could be a bit nicer looking
! Track down any memory leaks
--- 1,17 ----
+ Check out RichText widget, see if it's usable.
+ Clean up help file.
  Add a "Save" command to save STDIN.
  Add actions for all buttons
  Document actions
  Handle appropriate 'less' options & keys
! Use selection as pattern if [Search Next] is pressed and searchBuf is NULL
! 	(suggested by Mark Phillips <phillips@eso.mc.xerox.com>)
! Allow for numbered lines
! 	(suggested by "John A. Murphy" <jam@philabs.Philips.COM>)
! Add a status line like that in 'less': "Lines 8-30 of 71  Byte 635 of 1818  34%"
! 	(suggested by "John A. Murphy" <jam@philabs.Philips.COM>)
! Allow text in dialog boxes to scroll
! 	(suggested by Michael Short <short@CS.Berkeley.EDU)
! Have searches wrap (suggested by Michael Short <short@CS.Berkeley.EDU)
! Add a -searchMode option to set defaultSearchType resource
! 	(suggested by Huzefa Mustaly <c23hm@kocrsv01.delcoelect.com>)
diff -rc xless-1.6.1/TODO xless-1.7/TODOxless-1.6.1/callbacks.c xless-1.7/callbacks.c
*** xless-1.6.1/callbacks.c	Fri Jun  3 14:37:46 1994
--- xless-1.7/callbacks.c	Thu Jul 28 19:29:23 1994
***************
*** 18,24 ****
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.6/RCS/callbacks.c,v 1.33 1994/06/03 21:31:18 dglo Exp $
   */
  
  #include <stdio.h>
--- 18,24 ----
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.7/RCS/callbacks.c,v 1.37 1994/07/29 02:28:14 dglo Exp $
   */
  
  #include <stdio.h>
***************
*** 40,46 ****
  extern int system __P((const char *));
  
  static void getReadOnlySource __P((Widget, const char *));
! static int Find __P((const char *, WindowInfo *, XawTextPosition));
  static void doSearch __P((WindowInfo *));
  static void popdownAndSearch __P((Widget, XtPointer, XtPointer));
  static void popdownAndChange __P((Widget, XtPointer, XtPointer));
--- 40,46 ----
  extern int system __P((const char *));
  
  static void getReadOnlySource __P((Widget, const char *));
! static int find __P((const char *, WindowInfo *, XawTextPosition));
  static void doSearch __P((WindowInfo *));
  static void popdownAndSearch __P((Widget, XtPointer, XtPointer));
  static void popdownAndChange __P((Widget, XtPointer, XtPointer));
***************
*** 145,221 ****
  }
  
  static int
! Find(text, wi, offset)
  const char *text;
  WindowInfo *wi;
  XawTextPosition offset;
  {
!   static Widget badPattern = 0;
    char *str = wi->searchBuf;
    XawTextPosition beg, end;
    regexp *pat;
-   const char *t;
    char *s;
!   Boolean insensitive;
    int len;
  
!   /* if regular expression, let library do all the work */
!   if (wi->flag & XLessSearchRegExpr) {
!     pat = regcomp(str);
!     if (pat) {
!       if (regexec(pat, text)) {
! 	beg = offset + (pat->startp[0] - text);
! 	end = beg + (pat->endp[0] - pat->startp[0]);
! 	XawTextSetInsertionPoint(wi->text, end);
! 	XawTextSetSelection(wi->text, beg, end);
! 	free(pat);
! 	return(0);
!       }
! 	
!       free(pat);
!       return(-1);
      }
  
!     if (!badPattern)
!       badPattern = MessageBox(wi->base, "Bad pattern ...", "OK", 0, 0);
!     if (badPattern)
!       SetPopup(wi->base, badPattern);
  
!     return(0);
!   }
  
!   /* if case-insensitive, make sure target is all lowercase */
!   insensitive = wi->flag & XLessSearchInsensitive;
!   if (insensitive)
!     for (s = str; *s; s++)
!       if (isupper(*s))
! 	*s = tolower(*s);
  
!   /* try to match the search string */
!   t = text;
!   s = str;
!   while ((*t != '\0')&&(*s != '\0')) {
!     if (*t == *s ||
! 	(insensitive && (isupper(*t) ? tolower(*t) == *s : 0))) {
!       t++;
!       s++;
!     } else {
!       t++;
!       s = str;
      }
    }
  
!   /* if we reached the end of the search string, we must have matched */
!   if (*s == '\0') {
!     len = strlen(str);
!     beg = offset + (t - text - len);
!     end = beg + len;
      XawTextSetInsertionPoint(wi->text, end);
      XawTextSetSelection(wi->text, beg, end);
!     return(0);
!   }
  
!   return (-1);
  }
  
  static void
--- 145,247 ----
  }
  
  static int
! find(text, wi, offset)
  const char *text;
  WindowInfo *wi;
  XawTextPosition offset;
  {
!   const char *special = "\\|*+?.^$[]()";
!   static Widget badPattern = NULL;
    char *str = wi->searchBuf;
    XawTextPosition beg, end;
    regexp *pat;
    char *s;
!   Boolean insensitive, allocated;
    int len;
+   unsigned slen, nSpecial, nAlpha;
+   char *newstr;
+   int rtnval;
  
!   /* is this a case-insensitive search? */
!   insensitive = (wi->flag & XLessSearchInsensitive) == XLessSearchInsensitive;
!   allocated = 0;
! 
!   /* if we need to escape special characters... */
!   if ((wi->flag & XLessSearchRegExpr) != XLessSearchRegExpr) {
! 
!     /* count the special characters */
!     nSpecial = nAlpha = 0;
!     for (s = str; *s; s++) {
!       if (strchr(special, *s) != NULL)
! 	nSpecial++;
!       else if (insensitive && isalpha(*s))
! 	nAlpha++;
      }
  
!     /* if we need to escape something... */
!     if (nSpecial > 0 || (insensitive && nAlpha > 0)) {
  
!       /* figure out how much space we'll need */
!       len = strlen(str);
!       if (insensitive)
! 	slen = nAlpha * 4 + nSpecial * 2 + (len - (nSpecial + nAlpha));
!       else
! 	slen = len + nSpecial;
  
!       /* get space for the new string */
!       newstr = (char *)XtMalloc(slen + 1);
!       if (newstr == NULL) {
! 	fprintf(stderr, "Out of space in search routine!\n");
! 	exit(1);
!       }
  
!       /* build the special string */
!       for (s = newstr; *str; str++) {
! 	if (strchr(special, *str) != NULL) {
! 	  *s++ = '\\';
! 	  *s++ = *str;
! 	} else if (insensitive && isalpha(*str)) {
! 	  *s++ = '[';
! 	  *s++ = *str;
! 	  if (isupper(*str))
! 	    *s++ = tolower(*str);
! 	  else
! 	    *s++ = toupper(*str);
! 	  *s++ = ']';
! 	} else
! 	  *s++ = *str; 
!       }
!       *s = 0;
! 
!       /* allocated string is the search pattern now */
!       allocated = 1; 
!       str = newstr;
      }
    }
  
!   /* try to match the pattern */
!   rtnval = 0;
!   pat = regcomp(str);
!   if (pat == NULL) {
!     if (!badPattern)
!       badPattern = MessageBox(wi->base, "Bad pattern ...", "OK", 0, 0);
!     if (badPattern)
!       SetPopup(wi->base, badPattern);
!   } else if (regexec(pat, text)) {
!     beg = offset + (pat->startp[0] - text);
!     end = beg + (pat->endp[0] - pat->startp[0]);
      XawTextSetInsertionPoint(wi->text, end);
      XawTextSetSelection(wi->text, beg, end);
!   } else
!     rtnval = -1;
  
!   /* clean up allocated memory */
!   if (allocated)
!     XtFree(str);
!   if (pat)
!     XtFree((char *)pat);
! 
!   return(rtnval);
  }
  
  static void
***************
*** 225,236 ****
    XawTextPosition offset;
    int len;
    const char *top;
!   static Widget notFound = 0;
  
    len = strlen(wi->searchBuf);
    offset = XawTextGetInsertionPoint(wi->text);
    top = wi->memory + offset;
!   if (Find(top, wi, offset)) {
      if (!notFound)
        notFound = MessageBox(wi->base, "String not found ...", "OK", 0, 0);
      if (notFound)
--- 251,262 ----
    XawTextPosition offset;
    int len;
    const char *top;
!   static Widget notFound = NULL;
  
    len = strlen(wi->searchBuf);
    offset = XawTextGetInsertionPoint(wi->text);
    top = wi->memory + offset;
!   if (len <= 0 || find(top, wi, offset)) {
      if (!notFound)
        notFound = MessageBox(wi->base, "String not found ...", "OK", 0, 0);
      if (notFound)
***************
*** 245,252 ****
  XtPointer callData;
  {
    WindowInfo *wi = (WindowInfo *)closure;
  
!   doSearch(wi);
  }
  
  static void
--- 271,286 ----
  XtPointer callData;
  {
    WindowInfo *wi = (WindowInfo *)closure;
+   static Widget noString = NULL;
  
!   if (wi->searchBuf == NULL) {
!     if (!noString)
!       noString = MessageBox(wi->base, "No search string specified ...",
! 			    "OK", 0, 0);
!     if (noString)
!       SetPopup(wi->base, noString);
!   } else
!     doSearch(wi);
  }
  
  static void
***************
*** 454,457 ****
--- 488,515 ----
    /* unlink the file if we created it */
    if (wi->file == NULL)
      unlink(printfile);
+ }
+ 
+ void
+ Background(widget, closure, callData)
+ Widget widget;
+ XtPointer closure;
+ XtPointer callData;
+ {
+   static Widget forkError = NULL;
+   WindowInfo *wi = (WindowInfo *)closure;
+ 
+   switch (fork()) {
+   case 0:
+     break;
+   case -1:
+     if (!forkError)
+       forkError = MessageBox(wi->base, "Error while backgrounding ...",
+ 			    "OK", 0, 0);
+     if (forkError)
+       SetPopup(wi->base, forkError);
+     break;
+   default:
+     exit(0);
+   }
  }
diff -rc xless-1.6.1/callbacks.c xless-1.7/callbacks.cxless-1.6.1/help.c xless-1.7/help.c
*** xless-1.6.1/help.c	Mon Jun  6 14:39:15 1994
--- xless-1.7/help.c	Thu Jul 28 19:28:59 1994
***************
*** 18,24 ****
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.6/RCS/help.c,v 1.21 1994/06/03 06:17:38 dglo Exp $
   */
  
  #include <fcntl.h>
--- 18,24 ----
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.7/RCS/help.c,v 1.23 1994/07/29 02:27:40 dglo Exp $
   */
  
  #include <fcntl.h>
***************
*** 63,68 ****
--- 63,69 ----
      CouldntOpen(top, resources.helpFile);
      return 0;
    }
+ 
    helpPage = InitData(fd, NULL);
  
    /* make sure the window title exists */
***************
*** 90,96 ****
    pane = XtVaCreateManagedWidget("helpPane", panedWidgetClass, base,
  				 NULL);
  
!   helpText = MakeText(pane, NULL, helpPage);
  
    /* set up Done button callback array */
    callback[0].callback = PopdownHelp;
--- 91,97 ----
    pane = XtVaCreateManagedWidget("helpPane", panedWidgetClass, base,
  				 NULL);
  
!   helpText = MakeText(pane, NULL, helpPage, 1);
  
    /* set up Done button callback array */
    callback[0].callback = PopdownHelp;
***************
*** 105,111 ****
    button = XtVaCreateManagedWidget("helpQuit", commandWidgetClass, pane,
  				   XtNaccelerators, accel,
  				   XtNcallback, callback,
! 				   XtNfont, buttonfont,
  				   XtNlabel, "Done With Help",
  				   NULL);
  
--- 106,112 ----
    button = XtVaCreateManagedWidget("helpQuit", commandWidgetClass, pane,
  				   XtNaccelerators, accel,
  				   XtNcallback, callback,
! 				   XtNfont, buttonFont,
  				   XtNlabel, "Done With Help",
  				   NULL);
  
diff -rc xless-1.6.1/help.c xless-1.7/help.cxless-1.6.1/init.c xless-1.7/init.c
*** xless-1.6.1/init.c	Mon Jun  6 15:19:14 1994
--- xless-1.7/init.c	Thu Jul 28 20:08:43 1994
***************
*** 18,24 ****
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.6.1/RCS/init.c,v 1.42 1994/06/06 22:16:49 dglo Exp $
   */
  
  #include <stdio.h>
--- 18,24 ----
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.7/RCS/init.c,v 1.45 1994/07/29 03:07:33 dglo Exp $
   */
  
  #include <stdio.h>
***************
*** 51,56 ****
--- 51,59 ----
  			      const char *));
  static void ParseGeometryRsrc __P((void));
  
+ #define DEFAULT_WIDTH	80
+ #define DEFAULT_HEIGHT	24
+ 
  static int geomParsed = 0;
  static int geomMask, geomX, geomY;
  static unsigned int geomWidth, geomHeight;
***************
*** 81,86 ****
--- 84,91 ----
  	  *wp = w;
  	w = 0;
  	(*hp)++;
+       } else if (*tmp == '\t') {
+ 	w += 8 - (w % 8);
        } else
  	w++;
        tmp++;
***************
*** 129,135 ****
      lastchar = wi->used - (wi->flag & XLessAddedNewline ? 2 : 1);
      bottom = (char *)&(wi->memory[lastchar]);
      strncpy(bottom, buffer, (size_t )nbytes);
!     wi->flag = (wi->flag & ~XLessAddedNewline);
      if (bottom[nbytes-1] != '\n') {
        wi->flag |= XLessAddedNewline;
        bottom[nbytes++] = '\n';
--- 134,140 ----
      lastchar = wi->used - (wi->flag & XLessAddedNewline ? 2 : 1);
      bottom = (char *)&(wi->memory[lastchar]);
      strncpy(bottom, buffer, (size_t )nbytes);
!     wi->flag = (wi->flag & ~(unsigned )XLessAddedNewline);
      if (bottom[nbytes-1] != '\n') {
        wi->flag |= XLessAddedNewline;
        bottom[nbytes++] = '\n';
***************
*** 164,226 ****
    }
  }
  
! const char *
! InitData(fd, wi)
  int fd;
  WindowInfo *wi;
  {
-   char *data;		/* pointer to the data stored
- 			   in dynamic memory */
    struct stat fileinfo;	/* file information from fstat */
    XtInputId id;
-   unsigned width, height, length;
  
!   /*
!    * Get file size and allocate a chunk of memory for the file to be
!    * copied into.
!    */
  
!   if (fd != 0) {
  
!     /* get size of file */
!     if (fstat(fd, &fileinfo)) {
!       fprintf(stderr, "%s: can't get file size.\n", progname);
!       exit(1);
      }
  
!     /* leave space for the NULL (and possibly a final NEWLINE) */
!     data = (char *)XtMalloc((Cardinal )(fileinfo.st_size + 2));
  
!     /* read file in one swoop */
!     read(fd, data, (size_t )fileinfo.st_size);
!     if (resources.monitorFile && wi) {
!       id = XtAppAddInput(context, fd, (XtPointer )XtInputReadMask,
! 			 handleNewInput, (XtPointer )wi);
!       if (wi) {
! 	wi->inputInfo = (InputInfo *)XtMalloc((Cardinal )sizeof(InputInfo));
! 	wi->inputInfo->fd = fd;
! 	wi->inputInfo->id = id;
! 	wi->inputInfo->interval = 1000;
! 	wi->inputInfo->falseAlarm = 0;
!       }
  
!     } else {
!       close(fd);
  
!       /* make sure file ends with a NEWLINE */
!       if (*(data + fileinfo.st_size - 1) != '\n') {
! 	*(data + fileinfo.st_size) = '\n';
! 	fileinfo.st_size++;
! 	if (wi)
! 	  wi->flag |= XLessAddedNewline;
!       }
!     }
  
!   } else {
  
!     /* only allocate a single byte, pretend it's a monitored file */
      data = (char *)XtMalloc(2);
!     fileinfo.st_size = 1;
      *data = '\n';
      if (wi) {
        wi->flag |= XLessAddedNewline;
--- 169,237 ----
    }
  }
  
! static char *
! readFile(fd, wi, szp)
  int fd;
  WindowInfo *wi;
+ Cardinal *szp;
  {
    struct stat fileinfo;	/* file information from fstat */
+   char *data;
    XtInputId id;
  
!   /* get size of file */
!   if (fstat(fd, &fileinfo)) {
!     fprintf(stderr, "%s: can't get file size.\n", progname);
!     exit(1);
!   }
  
!   /* leave space for the NULL (and possibly a final NEWLINE) */
!   data = (char *)XtMalloc((Cardinal )(fileinfo.st_size + 2));
  
!   /* read entire file */
!   read(fd, data, (size_t )fileinfo.st_size);
!   if (resources.monitorFile && wi) {
!     id = XtAppAddInput(context, fd, (XtPointer )XtInputReadMask,
! 		       handleNewInput, (XtPointer )wi);
!     if (wi) {
!       wi->inputInfo = (InputInfo *)XtMalloc((Cardinal )sizeof(InputInfo));
!       wi->inputInfo->fd = fd;
!       wi->inputInfo->id = id;
!       wi->inputInfo->interval = 1000;
!       wi->inputInfo->falseAlarm = 0;
      }
  
!   } else {
!     close(fd);
  
!     /* make sure file ends with a NEWLINE */
!     if (*(data + fileinfo.st_size - 1) != '\n') {
!       *(data + fileinfo.st_size) = '\n';
!       fileinfo.st_size++;
!       if (wi)
! 	wi->flag |= XLessAddedNewline;
!     }
!   }
  
!   *szp = fileinfo.st_size;
!   return(data);
! }
  
! static char *
! readStdIn(fd, wi, szp)
! int fd;
! WindowInfo *wi;
! Cardinal *szp;
! {
!   XtInputId id;
!   char *data, *where;
!   int size, sz, newsz;
  
!   if (resources.monitorFile && wi) {
  
!     /* only allocate a single byte, read everything dynamically */
      data = (char *)XtMalloc(2);
!     size = 1;
      *data = '\n';
      if (wi) {
        wi->flag |= XLessAddedNewline;
***************
*** 232,249 ****
        wi->inputInfo->interval = 1000;
        wi->inputInfo->falseAlarm = 0;
      }
    }
  
    /* NUL-terminate file string */
!   *(data + fileinfo.st_size) = '\0';
  
    width = height = 0;
!   length = fileinfo.st_size;
    fixNewText((char *)data, &length, &width, &height);
  
    if (wi) {
      wi->memory = data;
!     wi->allocated = fileinfo.st_size + 1;
      wi->used = length;
      wi->dataWidth = width;
      wi->dataHeight = height;
--- 243,310 ----
        wi->inputInfo->interval = 1000;
        wi->inputInfo->falseAlarm = 0;
      }
+ 
+   } else {
+ 
+     /* read STDIN a chunk at a time */
+     data = (char *)XtMalloc(XLESS_MEMORY_CHUNK);
+     size = 0;
+     where = data;
+     while ((sz = read(fd, where, (size_t )XLESS_MEMORY_CHUNK)) != 0) {
+       size += sz;
+       newsz = size + XLESS_MEMORY_CHUNK;
+       data = (char *)XtRealloc(data, (unsigned)newsz);
+       where = data + size;
+     }
+ 
+     /* see if file ends with a NEWLINE */
+     if (*(data + size - 1) != '\n')
+       size++;
+ 
+     /* allocate final chunk of memory */
+     newsz = size + 1;
+     data = (char *)XtRealloc(data, (unsigned)newsz);
+ 
+     /* make sure file ends with a NEWLINE */
+     if (*(data + size - 1) != '\n')
+       *(data + size - 1) = '\n';
+ 
    }
  
+   *szp = size;
+   return(data);
+ }
+ 
+ const char *
+ InitData(fd, wi)
+ int fd;
+ WindowInfo *wi;
+ {
+   char *data;		/* pointer to the data stored
+ 			   in dynamic memory */
+   unsigned width, height, length;
+   Cardinal size;
+ 
+   /*
+    * Get file size and allocate a chunk of memory for the file to be
+    * copied into.
+    */
+ 
+   if (fd != 0)
+     data = readFile(fd, wi, &size);
+   else
+     data = readStdIn(fd, wi, &size);
+ 
    /* NUL-terminate file string */
!   *(data + size) = '\0';
  
    width = height = 0;
!   length = size;
    fixNewText((char *)data, &length, &width, &height);
  
    if (wi) {
      wi->memory = data;
!     wi->allocated = size + 1;
      wi->used = length;
      wi->dataWidth = width;
      wi->dataHeight = height;
***************
*** 280,286 ****
  			      XtNbottom, XtChainTop,
  			      XtNcallback, callback,
  			      XtNcursor, stdcur,
! 			      XtNfont, buttonfont,
  			      XtNfromVert, prevwidg,
  			      XtNfromHoriz, NULL,
  			      XtNhorizDistance, 4,
--- 341,347 ----
  			      XtNbottom, XtChainTop,
  			      XtNcallback, callback,
  			      XtNcursor, stdcur,
! 			      XtNfont, buttonFont,
  			      XtNfromVert, prevwidg,
  			      XtNfromHoriz, NULL,
  			      XtNhorizDistance, 4,
***************
*** 325,330 ****
--- 386,392 ----
    const String AccPrint = "#override Meta<Key>P: set() notify() unset()\n";
    const String AccHelp = "#override <Key>?: set() notify() unset()\n";
    const String AccClose = "#override <Key>Q: set() notify() unset()\n";
+   const String AccBackgnd = "#override Meta<Key>&: set() notify() unset()\n";
    const String AccQuit = "#override Meta<Key>Q: set() notify() unset()\n";
  
    /* create the ButtonBox which contains the toolbox */
***************
*** 364,369 ****
--- 426,433 ----
    button = makeButton(box, False, 1, button, NewWindow, wi,
  		      AccWind, "New window");
    button = makeButton(box, False, 1, button, Print, wi, AccPrint, "Print");
+   button = makeButton(box, False, 1, button, Background, wi, AccBackgnd,
+ 		      "Background");
    button = makeButton(box, False, 1, button, CloseWindow, wi, AccClose,
  		      "Close window");
    if (resources.quitButton)
***************
*** 376,391 ****
  ParseGeometryRsrc()
  {
    /* get geometry from resource */
!   geomMask = XParseGeometry(resources.geometry, &geomX, &geomY,
! 			    &geomWidth, &geomHeight);
  
!   /* supply width & height if unspecified */
!   if ((geomMask & WidthValue) == 0 || (geomMask & HeightValue) == 0) {
!     if (((geomMask & WidthValue) && geomWidth <= 0) ||
! 	((geomMask & HeightValue) && geomHeight <= 0))
!       printf("Bad WIDTHxHEIGHT in geometry \"%s\"!\n", resources.geometry);
!     geomWidth = 80;
!     geomHeight = 24;
    }
  
    /* remember that we've been here */
--- 440,461 ----
  ParseGeometryRsrc()
  {
    /* get geometry from resource */
!   if (resources.geometry) {
!     geomMask = XParseGeometry(resources.geometry, &geomX, &geomY,
! 			      &geomWidth, &geomHeight);
  
!     /* supply width & height if unspecified */
!     if ((geomMask & WidthValue) == 0 || (geomMask & HeightValue) == 0) {
!       if (((geomMask & WidthValue) && geomWidth <= 0) ||
! 	  ((geomMask & HeightValue) && geomHeight <= 0))
! 	fprintf(stderr, "Bad WIDTHxHEIGHT in geometry \"%s\"!\n",
! 		resources.geometry);
!       geomWidth = DEFAULT_WIDTH;
!       geomHeight = DEFAULT_HEIGHT;
!     }
!   } else {
!     geomWidth = DEFAULT_WIDTH;
!     geomHeight = DEFAULT_HEIGHT;
    }
  
    /* remember that we've been here */
***************
*** 410,426 ****
   *	Function Name: MakeText
   *	Description:   This function creates the text widget necessary
   *		       to display the data.
!  *	Arguments:     parent - the parent widget
!  *		       wi     - pointer to window information
!  *		       data   - pointer to data in memory.
!  *	Returns:       tmp    - the text widget so created.
   */
  
  Widget
! MakeText(parent, wi, data)
  Widget parent;
  WindowInfo *wi;
  const char *data;
  {
    int windowWidth, windowHeight;
    int charWidth, charHeight;
--- 480,498 ----
   *	Function Name: MakeText
   *	Description:   This function creates the text widget necessary
   *		       to display the data.
!  *	Arguments:     parent     - the parent widget
!  *		       wi         - pointer to window information
!  *		       data       - pointer to data in memory.
!  *		       ignoreGeom - TRUE if we should ignore supplied geometry
!  *	Returns:       tmp        - the text widget so created.
   */
  
  Widget
! MakeText(parent, wi, data, ignoreGeom)
  Widget parent;
  WindowInfo *wi;
  const char *data;
+ int ignoreGeom;
  {
    int windowWidth, windowHeight;
    int charWidth, charHeight;
***************
*** 431,445 ****
      ParseGeometryRsrc();
  
    /* set window width & height (expressed in characters) */
!   windowWidth = geomWidth;
!   windowHeight = geomHeight;
  
    /* get width/height of a text window character */
!   charWidth = FontWidth(textfont);
!   charHeight = FontHeight(textfont);
  
    /* if actual text is smaller, use it instead */
!   if (wi && (wi->inputInfo == NULL) && resources.sizeToFit) {
      if (windowWidth > wi->dataWidth)
        windowWidth = wi->dataWidth + 1;
      if (windowHeight > wi->dataHeight)
--- 503,518 ----
      ParseGeometryRsrc();
  
    /* set window width & height (expressed in characters) */
!   windowWidth = (ignoreGeom ? DEFAULT_WIDTH : geomWidth);
!   windowHeight = (ignoreGeom ? DEFAULT_HEIGHT : geomHeight);
  
    /* get width/height of a text window character */
!   charWidth = FontWidth(textFont);
!   charHeight = FontHeight(textFont);
  
    /* if actual text is smaller, use it instead */
!   if (wi && (wi->inputInfo == NULL) && resources.sizeToFit &&
!       (resources.geometry == NULL)) {
      if (windowWidth > wi->dataWidth)
        windowWidth = wi->dataWidth + 1;
      if (windowHeight > wi->dataHeight)
***************
*** 453,477 ****
  #ifdef DUMP_TEXTFONT_INFO
  
  printf("\nTextFont info:\n");
! printf("\tfid=%ld, direction=%d\n", textfont->fid, textfont->direction);
  printf("\tmin_char_or_byte2=%d, max_char_or_byte2=%d\n",
! 	textfont->min_char_or_byte2, textfont->max_char_or_byte2);
! printf("\tmin_byte1=%d, max_byte1=%d\n", textfont->min_byte1,
! 	textfont->max_byte1);
  printf("\tall_chars_exist=%s, default_char=%d, n_properties=%d\n",
! 	(textfont->all_chars_exist ? "TRUE" : "FALSE"),
! 	textfont->default_char, textfont->n_properties);
  printf("\tmin_bounds: lbearing=%d, rbearing=%d, width=%d,\n",
! 	textfont->min_bounds.lbearing, textfont->min_bounds.rbearing,
! 	textfont->min_bounds.width);
! printf("\t\tascent=%d, descent=%d\n", textfont->min_bounds.ascent,
! 	textfont->min_bounds.descent);
  printf("\tmax_bounds: lbearing=%d, rbearing=%d, width=%d,\n",
! 	textfont->max_bounds.lbearing, textfont->max_bounds.rbearing,
! 	textfont->max_bounds.width);
! printf("\t\tascent=%d, descent=%d\n", textfont->max_bounds.ascent,
! 	textfont->max_bounds.descent);
! printf("\tascent=%d, descent=%d\n", textfont->ascent, textfont->descent);
  printf("TextWindow: char=(%d,%d), lines=(%d,%d), txtwin=(%d,%d)\n",
  	charWidth, charHeight,
  	(wi ? wi->dataWidth : -1), (wi? wi->dataHeight : -1),
--- 526,550 ----
  #ifdef DUMP_TEXTFONT_INFO
  
  printf("\nTextFont info:\n");
! printf("\tfid=%ld, direction=%d\n", textFont->fid, textFont->direction);
  printf("\tmin_char_or_byte2=%d, max_char_or_byte2=%d\n",
! 	textFont->min_char_or_byte2, textFont->max_char_or_byte2);
! printf("\tmin_byte1=%d, max_byte1=%d\n", textFont->min_byte1,
! 	textFont->max_byte1);
  printf("\tall_chars_exist=%s, default_char=%d, n_properties=%d\n",
! 	(textFont->all_chars_exist ? "TRUE" : "FALSE"),
! 	textFont->default_char, textFont->n_properties);
  printf("\tmin_bounds: lbearing=%d, rbearing=%d, width=%d,\n",
! 	textFont->min_bounds.lbearing, textFont->min_bounds.rbearing,
! 	textFont->min_bounds.width);
! printf("\t\tascent=%d, descent=%d\n", textFont->min_bounds.ascent,
! 	textFont->min_bounds.descent);
  printf("\tmax_bounds: lbearing=%d, rbearing=%d, width=%d,\n",
! 	textFont->max_bounds.lbearing, textFont->max_bounds.rbearing,
! 	textFont->max_bounds.width);
! printf("\t\tascent=%d, descent=%d\n", textFont->max_bounds.ascent,
! 	textFont->max_bounds.descent);
! printf("\tascent=%d, descent=%d\n", textFont->ascent, textFont->descent);
  printf("TextWindow: char=(%d,%d), lines=(%d,%d), txtwin=(%d,%d)\n",
  	charWidth, charHeight,
  	(wi ? wi->dataWidth : -1), (wi? wi->dataHeight : -1),
***************
*** 484,490 ****
  				XtNbottom, XtChainBottom,
  				XtNdisplayNonprinting, False,
  				XtNeditType, XawtextRead,
! 				XtNfont, textfont,
  				XtNfromHoriz, NULL,
  				XtNheight, windowHeight,
  				XtNhorizDistance, 1,
--- 557,563 ----
  				XtNbottom, XtChainBottom,
  				XtNdisplayNonprinting, False,
  				XtNeditType, XawtextRead,
! 				XtNfont, textFont,
  				XtNfromHoriz, NULL,
  				XtNheight, windowHeight,
  				XtNhorizDistance, 1,
***************
*** 595,602 ****
    baseHeight = (tbxHeight > txtHeight ? tbxHeight : txtHeight);
  
    /* get width/height of a text window character */
!   charWidth = FontWidth(textfont);
!   charHeight = FontHeight(textfont);
  
    /* set base & increment size */
    XtVaSetValues(wi->base,
--- 668,675 ----
    baseHeight = (tbxHeight > txtHeight ? tbxHeight : txtHeight);
  
    /* get width/height of a text window character */
!   charWidth = FontWidth(textFont);
!   charHeight = FontHeight(textFont);
  
    /* set base & increment size */
    XtVaSetValues(wi->base,
diff -rc xless-1.6.1/init.c xless-1.7/init.cxless-1.6.1/main.c xless-1.7/main.c
*** xless-1.6.1/main.c	Thu Jun  2 22:14:52 1994
--- xless-1.7/main.c	Thu Jul 28 19:57:15 1994
***************
*** 18,24 ****
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.6/RCS/main.c,v 1.33 1994/06/03 05:14:27 dglo Exp $
   */
  
  #include <stdio.h>
--- 18,24 ----
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.7/RCS/main.c,v 1.36 1994/07/29 02:55:50 dglo Exp $
   */
  
  #include <stdio.h>
***************
*** 33,38 ****
--- 33,39 ----
  #include <X11/Xmu/Xmu.h>
  
  #include "xless.h"
+ #include "version.h"
  #include "XLessTop.icn"
  
  #define XtRSearchType	"SearchType"
***************
*** 47,53 ****
  
  static XtResource privResources[] = {
    {XtNgeometry, XtCGeometry, XtRString, sizeof(String),
!      XtOffset(XLessResources *, geometry), XtRString, "80x24"},
    {XtNname, "Name", XtRString, sizeof(String),
       XtOffset(XLessResources *, name), XtRString, NULL},
    {XtNtitle, XtCTitle, XtRString, sizeof(String),
--- 48,54 ----
  
  static XtResource privResources[] = {
    {XtNgeometry, XtCGeometry, XtRString, sizeof(String),
!      XtOffset(XLessResources *, geometry), XtRString, NULL},
    {XtNname, "Name", XtRString, sizeof(String),
       XtOffset(XLessResources *, name), XtRString, NULL},
    {XtNtitle, XtCTitle, XtRString, sizeof(String),
***************
*** 70,79 ****
       XtOffset(XLessResources *, editor), XtRString, DEFEDITOR},
    {"editorDoesWindows", "EditorDoesWindows", XtRBoolean, sizeof(Boolean),
       XtOffset(XLessResources *, editorDoesWindows), XtRString, "False"},
    {"printCommand", "PrintCommand", XtRString, sizeof(String),
       XtOffset(XLessResources *, printCmd), XtRString, PRINTCMD},
-   {"printCmd", "PrintCommand", XtRString, sizeof(String),
-      XtOffset(XLessResources *, printCmd), XtRString, PRINTCMD},
    {"maxWindows", "MaxWindows", XtRInt, sizeof(int),
       XtOffset(XLessResources *, maxWindows), XtRString, "0"},
    {"quitButton", "QuitButton", XtRBoolean, sizeof(Boolean),
--- 71,80 ----
       XtOffset(XLessResources *, editor), XtRString, DEFEDITOR},
    {"editorDoesWindows", "EditorDoesWindows", XtRBoolean, sizeof(Boolean),
       XtOffset(XLessResources *, editorDoesWindows), XtRString, "False"},
+   {"printCmd", "PrintCommand", XtRString, sizeof(String),
+      XtOffset(XLessResources *, oldPrintCmd), XtRString, NULL},
    {"printCommand", "PrintCommand", XtRString, sizeof(String),
       XtOffset(XLessResources *, printCmd), XtRString, PRINTCMD},
    {"maxWindows", "MaxWindows", XtRInt, sizeof(int),
       XtOffset(XLessResources *, maxWindows), XtRString, "0"},
    {"quitButton", "QuitButton", XtRBoolean, sizeof(Boolean),
***************
*** 88,105 ****
--- 89,111 ----
       XtOffset(XLessResources *, defaultSearchType), XtRString, "ExactMatch"},
    {"monitorFile", "MonitorFile", XtRBoolean, sizeof(Boolean),
       XtOffset(XLessResources *, monitorFile), XtRString, "False"},
+   {"printVersion", "PrintVersion", XtRBoolean, sizeof(Boolean),
+      XtOffset(XLessResources *, printVersion), XtRString, "False"},
  };
  
  static XrmOptionDescRec options[] = {
    {"-f",	"*monitorFile", XrmoptionNoArg,	(XtPointer )"True"},
+   {"-follow",	"*monitorFile", XrmoptionNoArg,	(XtPointer )"True"},
    {"-fn", 	"*textFont", XrmoptionSepArg,	(XtPointer )NULL},
    {"-font", 	"*textFont", XrmoptionSepArg,	(XtPointer )NULL},
    {"-help",	"*helpMessage", XrmoptionNoArg,	(XtPointer )"True"},
+   {"-version",	"*printVersion", XrmoptionNoArg, (XtPointer )"True"},
  };
  
  static Boolean cvtStringToSearchType __P((Display *, XrmValue *, Cardinal *,
  					  XrmValue *, XrmValue *, XtPointer *));
  static void cleanup __P((void));
+ static void argPrint __P((const char *));
  
  #define done(type, value)				\
  	{						\
***************
*** 169,174 ****
--- 175,204 ----
    XtDestroyApplicationContext(context);
  }
  
+ static void
+ argPrint(str)
+ const char *str;
+ {
+   static int lineLen = 0;
+   static int current = 0;
+   int len;
+ 
+   /* find line length */
+   if (lineLen == 0) {
+     lineLen = 80;
+     current = lineLen;
+   }
+ 
+   len = strlen(str);
+   current -= len;
+   if (current > 0) {
+     fputs(str, stderr);
+   } else {
+     fprintf(stderr, "\n\t%s", str);
+     current = lineLen - (8 + len);
+   }
+ }
+ 
  void
  main(argc, argv)
  int argc;
***************
*** 203,208 ****
--- 233,254 ----
    XtGetApplicationResources(toplevel, (XtPointer )&resources, privResources,
  			    XtNumber(privResources), NULL, (Cardinal) 0);
  
+   /* print our version number if user wants it */
+   if (resources.printVersion)
+     printf("XLess version %s\n", VERSION);
+ 
+   /* complain about old printCmd resource usage */
+   if (resources.oldPrintCmd != NULL) {
+     if (strcmp(resources.printCmd, PRINTCMD) != 0)
+       fprintf(stderr, "%s: Both 'printCommand' and 'printCmd' specified!\n",
+ 	      progname);
+     else {
+       fprintf(stderr, "%s: Please use the 'printCommand' resource", progname);
+       fprintf(stderr, " instead of 'printCmd'\n");
+       resources.printCmd = resources.oldPrintCmd;
+     }
+   }
+ 
    /* save class name */
    className = XLESS_CLASS;
  
***************
*** 225,232 ****
  
      /* whine if there's still an argument */
      if (resources.helpMessage || *argv[i] == '-') {
!       fprintf(stdout, "usage:\t%s filename\n", progname);
!       fprintf(stdout, "\t(%s also takes input from stdin)\n", progname);
        cleanup();
        exit(0);
      }
--- 271,290 ----
  
      /* whine if there's still an argument */
      if (resources.helpMessage || *argv[i] == '-') {
!       argPrint("Usage: ");
!       argPrint(progname);
!       argPrint(" [-f]");
!       argPrint(" [-follow]");
!       argPrint(" [-fn textFont]");
!       argPrint(" [-font textFont]");
!       argPrint(" [-help]");
!       argPrint(" [-version]");
!       argPrint(" [file ...]");
!       argPrint("\n");
!       argPrint("\t(");
!       argPrint(progname);
!       argPrint(" also takes input");
!       argPrint(" from stdin)\n");
        cleanup();
        exit(0);
      }
diff -rc xless-1.6.1/main.c xless-1.7/main.cxless-1.6.1/popup.c xless-1.7/popup.c
*** xless-1.6.1/popup.c	Thu Jun  2 23:28:24 1994
--- xless-1.7/popup.c	Thu Jun  9 15:58:59 1994
***************
*** 18,24 ****
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.6/RCS/popup.c,v 1.27 1994/06/03 06:28:05 dglo Exp $
   */
  
  #include <stdio.h>
--- 18,24 ----
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.7/RCS/popup.c,v 1.29 1994/06/09 22:59:12 dglo Exp $
   */
  
  #include <stdio.h>
***************
*** 89,97 ****
    form = XtVaCreateManagedWidget("form", formWidgetClass, popup,
  				 NULL);
  
!   lbl = XtVaCreateManagedWidget("label", labelWidgetClass, form,
  				XtNborderWidth, 0,
! 				XtNfont, labelfont,
  				XtNjustify, XtJustifyLeft,
  				XtNlabel, label,
  				XtNleft, XtChainLeft,
--- 89,97 ----
    form = XtVaCreateManagedWidget("form", formWidgetClass, popup,
  				 NULL);
  
!   lbl = XtVaCreateManagedWidget(label, labelWidgetClass, form,
  				XtNborderWidth, 0,
! 				XtNfont, labelFont,
  				XtNjustify, XtJustifyLeft,
  				XtNlabel, label,
  				XtNleft, XtChainLeft,
***************
*** 101,113 ****
    xlate = XtParseTranslationTable(mytranslations);
    input = XtVaCreateManagedWidget("input", asciiTextWidgetClass, form,
  				  XtNeditType, XawtextEdit,
! 				  XtNfont, textfont,
  				  XtNfromHoriz, NULL,
  				  XtNfromVert, lbl,
  				  XtNleft, XtChainLeft,
  				  XtNlength, XLESS_MAX_INPUT,
  				  XtNresizable, True,
! 				  XtNright, XtChainLeft,
  				  XtNstring, selection,
  #ifdef X11R4
  				  XtNtextOptions, resizeWidth,
--- 101,113 ----
    xlate = XtParseTranslationTable(mytranslations);
    input = XtVaCreateManagedWidget("input", asciiTextWidgetClass, form,
  				  XtNeditType, XawtextEdit,
! 				  XtNfont, textFont,
  				  XtNfromHoriz, NULL,
  				  XtNfromVert, lbl,
  				  XtNleft, XtChainLeft,
  				  XtNlength, XLESS_MAX_INPUT,
  				  XtNresizable, True,
! 				  XtNright, XtChainRight,
  				  XtNstring, selection,
  #ifdef X11R4
  				  XtNtextOptions, resizeWidth,
***************
*** 127,133 ****
  				    XtNaccelerators, accel,
  				    XtNcallback, callback,
  				    XtNcursor, dialogcur,
! 				    XtNfont, buttonfont,
  				    XtNfromVert, input,
  				    XtNfromHoriz, NULL,
  				    XtNleft, XtChainLeft,
--- 127,133 ----
  				    XtNaccelerators, accel,
  				    XtNcallback, callback,
  				    XtNcursor, dialogcur,
! 				    XtNfont, buttonFont,
  				    XtNfromVert, input,
  				    XtNfromHoriz, NULL,
  				    XtNleft, XtChainLeft,
***************
*** 141,152 ****
    cancel = XtVaCreateManagedWidget("Cancel", commandWidgetClass, form,
  				   XtNcallback, callback,
  				   XtNcursor, dialogcur,
! 				   XtNfont, buttonfont,
  				   XtNfromVert, input,
  				   XtNfromHoriz, confirm,
  				   XtNhorizDistance, 2,
! 				   XtNleft, XtChainLeft,
! 				   XtNright, XtChainLeft,
  				   XtNvertDistance, 5,
  				   XtNwidth, XLESS_BUTTON_WIDTH,
  				   NULL);
--- 141,152 ----
    cancel = XtVaCreateManagedWidget("Cancel", commandWidgetClass, form,
  				   XtNcallback, callback,
  				   XtNcursor, dialogcur,
! 				   XtNfont, buttonFont,
  				   XtNfromVert, input,
  				   XtNfromHoriz, confirm,
  				   XtNhorizDistance, 2,
! 				   XtNleft, XtChainRight,
! 				   XtNright, XtChainRight,
  				   XtNvertDistance, 5,
  				   XtNwidth, XLESS_BUTTON_WIDTH,
  				   NULL);
***************
*** 222,230 ****
    form = XtVaCreateManagedWidget("form", formWidgetClass, popup,
  				 NULL);
  
!   lbl = XtVaCreateManagedWidget("label", labelWidgetClass, form,
  				XtNborderWidth, 0,
! 				XtNfont, labelfont,
  				XtNjustify, XtJustifyLeft,
  				XtNlabel, label,
  				XtNleft, XtChainLeft,
--- 222,230 ----
    form = XtVaCreateManagedWidget("form", formWidgetClass, popup,
  				 NULL);
  
!   lbl = XtVaCreateManagedWidget(label, labelWidgetClass, form,
  				XtNborderWidth, 0,
! 				XtNfont, labelFont,
  				XtNjustify, XtJustifyLeft,
  				XtNlabel, label,
  				XtNleft, XtChainLeft,
***************
*** 234,246 ****
    xlate = XtParseTranslationTable(mytranslations);
    input = XtVaCreateManagedWidget("input", asciiTextWidgetClass, form,
  				  XtNeditType, XawtextEdit,
! 				  XtNfont, textfont,
  				  XtNfromHoriz, NULL,
  				  XtNfromVert, lbl,
  				  XtNleft, XtChainLeft,
  				  XtNlength, XLESS_MAX_INPUT,
  				  XtNresizable, True,
! 				  XtNright, XtChainLeft,
  				  XtNstring, selection,
  #ifdef X11R4
  				  XtNtextOptions, resizeWidth,
--- 234,246 ----
    xlate = XtParseTranslationTable(mytranslations);
    input = XtVaCreateManagedWidget("input", asciiTextWidgetClass, form,
  				  XtNeditType, XawtextEdit,
! 				  XtNfont, textFont,
  				  XtNfromHoriz, NULL,
  				  XtNfromVert, lbl,
  				  XtNleft, XtChainLeft,
  				  XtNlength, XLESS_MAX_INPUT,
  				  XtNresizable, True,
! 				  XtNright, XtChainRight,
  				  XtNstring, selection,
  #ifdef X11R4
  				  XtNtextOptions, resizeWidth,
***************
*** 266,276 ****
  
    callback[0].callback = toggleSearchType;
    callback[0].closure = (XtPointer )wi;
!   searchType = XtVaCreateManagedWidget(searchLabel, commandWidgetClass, form,
  				       XtNcallback, callback,
! 				       XtNfont, buttonfont,
  				       XtNfromVert, input,
  				       XtNfromHoriz, NULL,
  				       XtNleft, XtChainLeft,
  				       XtNright, XtChainRight,
  				       NULL);
--- 266,277 ----
  
    callback[0].callback = toggleSearchType;
    callback[0].closure = (XtPointer )wi;
!   searchType = XtVaCreateManagedWidget("searchType", commandWidgetClass, form,
  				       XtNcallback, callback,
! 				       XtNfont, buttonFont,
  				       XtNfromVert, input,
  				       XtNfromHoriz, NULL,
+ 				       XtNlabel, searchLabel,
  				       XtNleft, XtChainLeft,
  				       XtNright, XtChainRight,
  				       NULL);
***************
*** 283,289 ****
  				   XtNaccelerators, accel,
  				   XtNcallback, callback,
  				   XtNcursor, dialogcur,
! 				   XtNfont, buttonfont,
  				   XtNfromVert, searchType,
  				   XtNfromHoriz, NULL,
  				   XtNleft, XtChainLeft,
--- 284,290 ----
  				   XtNaccelerators, accel,
  				   XtNcallback, callback,
  				   XtNcursor, dialogcur,
! 				   XtNfont, buttonFont,
  				   XtNfromVert, searchType,
  				   XtNfromHoriz, NULL,
  				   XtNleft, XtChainLeft,
***************
*** 297,308 ****
    cancel = XtVaCreateManagedWidget("Cancel", commandWidgetClass, form,
  				   XtNcallback, callback,
  				   XtNcursor, dialogcur,
! 				   XtNfont, buttonfont,
  				   XtNfromVert, searchType,
  				   XtNfromHoriz, search,
  				   XtNhorizDistance, 2,
! 				   XtNleft, XtChainLeft,
! 				   XtNright, XtChainLeft,
  				   XtNvertDistance, 5,
  				   XtNwidth, XLESS_BUTTON_WIDTH,
  				   NULL);
--- 298,309 ----
    cancel = XtVaCreateManagedWidget("Cancel", commandWidgetClass, form,
  				   XtNcallback, callback,
  				   XtNcursor, dialogcur,
! 				   XtNfont, buttonFont,
  				   XtNfromVert, searchType,
  				   XtNfromHoriz, search,
  				   XtNhorizDistance, 2,
! 				   XtNleft, XtChainRight,
! 				   XtNright, XtChainRight,
  				   XtNvertDistance, 5,
  				   XtNwidth, XLESS_BUTTON_WIDTH,
  				   NULL);
***************
*** 369,375 ****
    msgLabel = XtVaCreateManagedWidget("message", labelWidgetClass, form,
  				     XtNallowShellResize, True,
  				     XtNborderWidth, 0,
! 				     XtNfont, labelfont,
  				     XtNjustify, XtJustifyLeft,
  				     XtNlabel, msg,
  				     NULL);
--- 370,376 ----
    msgLabel = XtVaCreateManagedWidget("message", labelWidgetClass, form,
  				     XtNallowShellResize, True,
  				     XtNborderWidth, 0,
! 				     XtNfont, labelFont,
  				     XtNjustify, XtJustifyLeft,
  				     XtNlabel, msg,
  				     NULL);
***************
*** 392,398 ****
  				     XtNaccelerators, accel,
  				     XtNcallback, callback,
  				     XtNcursor, dialogcur,
! 				     XtNfont, buttonfont,
  				     XtNfromVert, msgLabel,
  				     XtNfromHoriz, button,
  				     XtNleft, XtChainRight,
--- 393,399 ----
  				     XtNaccelerators, accel,
  				     XtNcallback, callback,
  				     XtNcursor, dialogcur,
! 				     XtNfont, buttonFont,
  				     XtNfromVert, msgLabel,
  				     XtNfromHoriz, button,
  				     XtNleft, XtChainRight,
diff -rc xless-1.6.1/popup.c xless-1.7/popup.cxless-1.6.1/util.c xless-1.7/util.c
*** xless-1.6.1/util.c	Thu Jun  2 23:17:57 1994
--- xless-1.7/util.c	Thu Jun 16 15:33:55 1994
***************
*** 18,24 ****
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.6/RCS/util.c,v 1.20 1994/06/03 06:17:38 dglo Exp $
   */
  
  
--- 18,24 ----
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.7/RCS/util.c,v 1.22 1994/06/16 22:33:46 dglo Exp $
   */
  
  
***************
*** 34,42 ****
  
  #include "xless.h"
  
! XFontStruct *buttonfont;
! XFontStruct *labelfont;
! XFontStruct *textfont;
  Cursor stdcur;
  Cursor dialogcur;
  
--- 34,42 ----
  
  #include "xless.h"
  
! XFontStruct *buttonFont;
! XFontStruct *labelFont;
! XFontStruct *textFont;
  Cursor stdcur;
  Cursor dialogcur;
  
***************
*** 102,118 ****
  void
  CheckFonts()
  {
!   if (!(buttonfont = resources.fonts.button))
!     buttonfont = resources.fonts.standard;
!   if (!(labelfont = resources.fonts.label))
!     labelfont = resources.fonts.standard;
!   if (!(textfont = resources.fonts.text))
!     textfont = resources.fonts.standard;
  
    dialogcur = resources.cursors.dialog;
    stdcur = resources.cursors.dialog;
  
!   if (!buttonfont || !labelfont || !textfont) {
      fprintf(stderr, "%s: unable to open any of the specified fonts\n",
  	    progname);
      exit(1);
--- 102,118 ----
  void
  CheckFonts()
  {
!   if (!(buttonFont = resources.fonts.button))
!     buttonFont = resources.fonts.standard;
!   if (!(labelFont = resources.fonts.label))
!     labelFont = resources.fonts.standard;
!   if (!(textFont = resources.fonts.text))
!     textFont = resources.fonts.standard;
  
    dialogcur = resources.cursors.dialog;
    stdcur = resources.cursors.dialog;
  
!   if (!buttonFont || !labelFont || !textFont) {
      fprintf(stderr, "%s: unable to open any of the specified fonts\n",
  	    progname);
      exit(1);
diff -rc xless-1.6.1/util.c xless-1.7/util.cxless-1.6.1/version.h xless-1.7/version.h
*** xless-1.6.1/version.h	Thu Jul 28 20:08:42 1994
--- xless-1.7/version.h	Tue Jun  7 20:38:22 1994
***************
*** 0 ****
--- 1 ----
+ #define VERSION "1.7"
diff -rc xless-1.6.1/version.h xless-1.7/version.hxless-1.6.1/window.c xless-1.7/window.c
*** xless-1.6.1/window.c	Fri Jun  3 14:40:18 1994
--- xless-1.7/window.c	Thu Jul 28 19:36:07 1994
***************
*** 18,24 ****
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.6/RCS/window.c,v 1.23 1994/06/03 21:39:15 dglo Exp $
   */
  
  #include <stdio.h>
--- 18,24 ----
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  * $Header: /usr/sww/share/src/X11R6/local/applications/xless-1.7/RCS/window.c,v 1.24 1994/07/29 02:34:16 dglo Exp $
   */
  
  #include <stdio.h>
***************
*** 32,37 ****
--- 32,39 ----
  
  #include <X11/Xaw/Paned.h>
  
+ #include <X11/Xmu/Converters.h>
+ 
  #include "xless.h"
  #include "XLessWin.icn"
  
***************
*** 45,50 ****
--- 47,72 ----
  static void popdownTooMany __P((Widget, XtPointer, XtPointer));
  
  WindowInfo *
+ createWindowInfo()
+ {
+   WindowInfo *wi;
+ 
+   wi = (WindowInfo *)XtMalloc((Cardinal )sizeof(WindowInfo));
+   wi->base = wi->text = wi->toolbox = NULL;
+   wi->searchPopup = wi->newWindowPopup = wi->changeFilePopup = NULL;
+   wi->editorButton = wi->reloadButton = NULL;
+   wi->memory = NULL;
+   wi->allocated = 0;
+   wi->used = 0;
+   wi->file = NULL;
+   wi->flag = XLessClearFlag;
+   wi->dataHeight = wi->dataWidth = 0;
+   wi->searchBuf = wi->newWindowBuf = wi->changeFileBuf = NULL;
+   wi->inputInfo = NULL;
+   return(wi);
+ }
+ 
+ WindowInfo *
  findWindowInfo(w)
  Widget w;
  {
***************
*** 150,167 ****
    }
  
    /* keep track of the new window */
!   wi = (WindowInfo *)XtMalloc((Cardinal )sizeof(WindowInfo));
!   wi->base = wi->text = wi->toolbox = NULL;
!   wi->searchPopup = wi->newWindowPopup = wi->changeFilePopup = NULL;
!   wi->editorButton = wi->reloadButton = NULL;
!   wi->memory = NULL;
!   wi->allocated = 0;
!   wi->used = 0;
    wi->file = fixedName;
    wi->flag = flag;
-   wi->dataHeight = wi->dataWidth = 0;
-   wi->searchBuf = wi->newWindowBuf = wi->changeFileBuf = NULL;
-   wi->inputInfo = NULL;
  
    /* read the file into memory */
    InitData(fd, wi);
--- 172,180 ----
    }
  
    /* keep track of the new window */
!   wi = createWindowInfo();
    wi->file = fixedName;
    wi->flag = flag;
  
    /* read the file into memory */
    InitData(fd, wi);
***************
*** 200,206 ****
  
    /* build widgets for new window */
    wi->base = base;
!   wi->text = MakeText(mainFrame, wi, wi->memory);
    wi->toolbox = MakeToolbox(mainFrame, wi, filename);
  
    /* make sure text window gets all keystrokes */
--- 213,219 ----
  
    /* build widgets for new window */
    wi->base = base;
!   wi->text = MakeText(mainFrame, wi, wi->memory, 0);
    wi->toolbox = MakeToolbox(mainFrame, wi, filename);
  
    /* make sure text window gets all keystrokes */
diff -rc xless-1.6.1/window.c xless-1.7/window.cxless-1.6.1/xless.h xless-1.7/xless.h
*** xless-1.6.1/xless.h	Fri Jun  3 12:28:30 1994
--- xless-1.7/xless.h	Thu Jul 28 19:56:41 1994
***************
*** 18,24 ****
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  *	$Header: /usr/sww/share/src/X11R6/local/applications/xless-1.6/RCS/xless.h,v 1.49 1994/06/03 19:27:59 dglo Exp $
   *
   */
  
--- 18,24 ----
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   *
!  *	$Header: /usr/sww/share/src/X11R6/local/applications/xless-1.7/RCS/xless.h,v 1.53 1994/07/29 02:55:34 dglo Exp $
   *
   */
  
***************
*** 183,188 ****
--- 183,190 ----
    Boolean helpMessage;		/* should we just print a help msg and exit? */
    unsigned defaultSearchType;	/* flag used to set default search type */
    Boolean monitorFile;		/* should we keep checking for input? */
+   Boolean printVersion;		/* should we keep print our version number? */
+   String oldPrintCmd;		/* catch old resource name usage */
  } XLessResources;
  
  /* prototypes from help.c */
***************
*** 192,198 ****
  const char *InitData __P((int, WindowInfo *));
  Widget MakeToolbox __P((Widget, WindowInfo *, const char *));
  const char *GetGeometryPosition __P((void));
! Widget MakeText __P((Widget, WindowInfo *, const char *));
  void SetXNames __P((Widget, const char *));
  void SetWMHints __P((WindowInfo *));
  
--- 194,200 ----
  const char *InitData __P((int, WindowInfo *));
  Widget MakeToolbox __P((Widget, WindowInfo *, const char *));
  const char *GetGeometryPosition __P((void));
! Widget MakeText __P((Widget, WindowInfo *, const char *, int));
  void SetXNames __P((Widget, const char *));
  void SetWMHints __P((WindowInfo *));
  
***************
*** 209,217 ****
  void CheckFonts __P((void));
  void CouldntOpen __P((Widget, const char *));
  const char *TildeExpand __P((const char *));
! extern XFontStruct *buttonfont;
! extern XFontStruct *labelfont;
! extern XFontStruct *textfont;
  extern Cursor stdcur;
  extern Cursor dialogcur;
  
--- 211,219 ----
  void CheckFonts __P((void));
  void CouldntOpen __P((Widget, const char *));
  const char *TildeExpand __P((const char *));
! extern XFontStruct *buttonFont;
! extern XFontStruct *labelFont;
! extern XFontStruct *textFont;
  extern Cursor stdcur;
  extern Cursor dialogcur;
  
***************
*** 226,231 ****
--- 228,234 ----
  void NewWindow __P((Widget, XtPointer, XtPointer));
  void CloseWindow __P((Widget, XtPointer, XtPointer));
  void Print __P((Widget, XtPointer, XtPointer));
+ void Background __P((Widget, XtPointer, XtPointer));
  
  /* prototypes from functions.c */
  void QuitFunction __P((void));
***************
*** 240,245 ****
--- 243,249 ----
  extern const char *className;
  
  /* prototypes from window.c */
+ WindowInfo *createWindowInfo __P((void));
  WindowInfo *findWindowInfo __P((Widget));
  int CreateWindow __P((Widget, const char *));
  void DestroyWindowInfo __P((WindowInfo *));
diff -rc xless-1.6.1/xless.h xless-1.7/xless.hxless-1.6.1/xless.help xless-1.7/xless.help
*** xless-1.6.1/xless.help	Mon Jun  6 15:20:17 1994
--- xless-1.7/xless.help	Thu Jul 28 19:26:57 1994
***************
*** 1,7 ****
! This is XLess version 1.6.1, a file browsing tool for the X Window System
  
  CREDITS:
!    By Dave Glowacki - UCB Software Warehouse
     Originally By Carlo Lisa - MIT Project Athena.
     Based Upon Xmore for X11R2 by Chris Peterson - MIT Project Athena.
  
--- 1,7 ----
! This is XLess version 1.7, a file browsing tool for the X Window System
  
  CREDITS:
!    By Dave Glowacki - UCB Software Warehouse	<dglo@CS.Berkeley.EDU>
     Originally By Carlo Lisa - MIT Project Athena.
     Based Upon Xmore for X11R2 by Chris Peterson - MIT Project Athena.
  
***************
*** 56,62 ****
      <Key>j	OR
      <Key>e		Scroll up one line
  
! Meta<Key>s		Bring up Search dialog box (like pressing Search button)
  Meta<Key>n		Search for next occurence of pattern (like pressing
  				Search Next button)
  Meta<Key>r		Reload current file (like pressing Reload button)
--- 56,63 ----
      <Key>j	OR
      <Key>e		Scroll up one line
  
! Meta<Key>s		Bring up Search dialog box (like pressing Search
! 			button)
  Meta<Key>n		Search for next occurence of pattern (like pressing
  				Search Next button)
  Meta<Key>r		Reload current file (like pressing Reload button)
diff -rc xless-1.6.1/xless.help xless-1.7/xless.helpxless-1.6.1/xless.man xless-1.7/xless.man
*** xless-1.6.1/xless.man	Thu Jun  2 22:28:35 1994
--- xless-1.7/xless.man	Thu Jul 28 15:51:45 1994
***************
*** 1,4 ****
! .TH Xless 1 "1 June 1989" "X Version 11"
  .SH NAME
  xless - File browsing program for the X Window System.
  .SH SYNOPSIS
--- 1,4 ----
! .TH Xless 1 "6 June 1993" "X Version 11"
  .SH NAME
  xless - File browsing program for the X Window System.
  .SH SYNOPSIS
***************
*** 43,51 ****
  Xless is build upon the \fIX Toolkit (Xt)\fP and as such understands all
  the normal command line options (as described in \fIX(1)\fP.
  It also supports:
! .TP \-f
  Continually check the file for new input (so that \fBxless\fP behaves like
  \fItail -f\fP).
  .SH "WIDGET AND RESOURCE NAMES"
  .LP
  In addition to the usual widget resources, Xless has the following
--- 43,60 ----
  Xless is build upon the \fIX Toolkit (Xt)\fP and as such understands all
  the normal command line options (as described in \fIX(1)\fP.
  It also supports:
! .TP
! .B \-follow
  Continually check the file for new input (so that \fBxless\fP behaves like
  \fItail -f\fP).
+ .TP
+ .B -f
+ Alias for \fI-f\fP.
+ .TP
+ .B -help
+ Print a list of valid options.
+ .B -version
+ Print the version number of this \fBxless\fP executable.
  .SH "WIDGET AND RESOURCE NAMES"
  .LP
  In addition to the usual widget resources, Xless has the following
***************
*** 106,116 ****
  Set to TRUE if you want the directory portion of the file path removed.
  For example, a path like \fI/usr/src/X11/xless/main.c\fP would be shortened to
  \fImain.c\fP.  The default is TRUE.
! .TP defaultSearchType
  Default method used to search the text (invoked from the Search button).
  Possible values are \fBExactMatch\fP (which is the default),
  \fBCaseInsensitive\fP and \fBRegularExpression\fP.
! .TP monitorFile
  Set to TRUE if you want the file to be continually checked for new input
  (so that \fBxless\fP behaves like \fItail -f\fP).  The default is FALSE.
  .LP
--- 115,127 ----
  Set to TRUE if you want the directory portion of the file path removed.
  For example, a path like \fI/usr/src/X11/xless/main.c\fP would be shortened to
  \fImain.c\fP.  The default is TRUE.
! .TP
! .B defaultSearchType
  Default method used to search the text (invoked from the Search button).
  Possible values are \fBExactMatch\fP (which is the default),
  \fBCaseInsensitive\fP and \fBRegularExpression\fP.
! .TP
! .B monitorFile
  Set to TRUE if you want the file to be continually checked for new input
  (so that \fBxless\fP behaves like \fItail -f\fP).  The default is FALSE.
  .LP
***************
*** 145,151 ****
  There probably are some.
  .LP
  .SH AUTHOR
! Dave Glowacki (UC Berkeley Software Warehouse)
  
  Originally by Carlo Lisa (MIT Project Athena) from
  xmore written by Chris Peterson (MIT Project Athena).
--- 156,162 ----
  There probably are some.
  .LP
  .SH AUTHOR
! Dave Glowacki (UC Berkeley Software Warehouse)	<dglo@CS.Berkeley.EDU>
  
  Originally by Carlo Lisa (MIT Project Athena) from
  xmore written by Chris Peterson (MIT Project Athena).
diff -rc xless-1.6.1/regexp/regsub.c xless-1.7/regexp/regsub.c
*** xless-1.6.1/regexp/regsub.c	Sun Feb 24 14:15:09 1991
--- xless-1.7/regexp/regsub.c	Thu Jun 16 15:29:08 1994
***************
*** 43,49 ****
--- 43,51 ----
  	register char c;
  	register int no;
  	register int len;
+ #ifndef AIXV3
  	extern char *strncpy();
+ #endif
  
  	if (prog == NULL || source == NULL || dest == NULL) {
  		regerror("NULL parm to regsub");
