delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/01/22/10:53:16

From: jt AT boxhill DOT com (Jason Tishler)
Subject: Re: Bash termcap and history file
22 Jan 1997 10:53:16 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <32E628EB.26E5.cygnus.gnu-win32@boxhill.com>
Reply-To: jt AT boxhill DOT com
Mime-Version: 1.0
X-Mailer: Mozilla 3.0Gold (WinNT; I)
Original-To: gnu-win32 <gnu-win32 AT cygnus DOT com>
Original-Sender: owner-gnu-win32 AT cygnus DOT com

This is a multi-part message in MIME format.

--------------4AA3328560FF
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

> > I just added it to
> > ftp://ftp.deerinet.nb.ca/pub/gnu-win32
> > as
> > bash.fix.zip
> 
> Grant was nice enough to place my "fixed" version of bash on the above
> ftp server for public access.  "Fixed" means that bash successfully reads
> your history file on start-up even without mounting the filesystem that
> contains your home directory in binary mode.

For those interested in incorporating the above fix into their own version
of bash, then patch your bash/lib/readline/history.c with the attached
diff -c output and rebuild.

Enjoy,
Jason

-- 
Jason Tishler                        Phone: +1 (212) 989-4455 ext. 120
Box Hill Systems Corporation         Fax:   +1 (212) 989-6817
161 Avenue of the Americas           Email: jt AT boxhill DOT com
New York, NY 10013 USA               WWW:   http://www.boxhill.com

--------------4AA3328560FF
Content-Type: text/plain; charset=us-ascii; name="history.c.diff-c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="history.c.diff-c"

*** Ohistory.c	Wed Jan 15 17:01:30 1997
--- history.c	Wed Jan 22 09:28:21 1997
***************
*** 558,564 ****
  {
    register int line_start, line_end;
    char *input, *buffer = (char *)NULL;
!   int file, current_line;
    struct stat finfo;
  
    input = history_filename (filename);
--- 558,564 ----
  {
    register int line_start, line_end;
    char *input, *buffer = (char *)NULL;
!   int file, current_line, chars_read;
    struct stat finfo;
  
    input = history_filename (filename);
***************
*** 569,575 ****
  
    buffer = xmalloc ((int)finfo.st_size + 1);
  
!   if (read (file, buffer, finfo.st_size) != finfo.st_size)
      {
    error_and_exit:
        if (file >= 0)
--- 569,575 ----
  
    buffer = xmalloc ((int)finfo.st_size + 1);
  
!   if ((chars_read = read (file, buffer, finfo.st_size)) <= 0)
      {
    error_and_exit:
        if (file >= 0)
***************
*** 588,602 ****
  
    /* Set TO to larger than end of file if negative. */
    if (to < 0)
!     to = finfo.st_size;
  
    /* Start at beginning of file, work to end. */
    line_start = line_end = current_line = 0;
  
    /* Skip lines until we are at FROM. */
!   while (line_start < finfo.st_size && current_line < from)
      {
!       for (line_end = line_start; line_end < finfo.st_size; line_end++)
  	if (buffer[line_end] == '\n')
  	  {
  	    current_line++;
--- 588,602 ----
  
    /* Set TO to larger than end of file if negative. */
    if (to < 0)
!     to = chars_read;
  
    /* Start at beginning of file, work to end. */
    line_start = line_end = current_line = 0;
  
    /* Skip lines until we are at FROM. */
!   while (line_start < chars_read && current_line < from)
      {
!       for (line_end = line_start; line_end < chars_read; line_end++)
  	if (buffer[line_end] == '\n')
  	  {
  	    current_line++;
***************
*** 607,613 ****
      }
  
    /* If there are lines left to gobble, then gobble them now. */
!   for (line_end = line_start; line_end < finfo.st_size; line_end++)
      if (buffer[line_end] == '\n')
        {
  	buffer[line_end] = '\0';
--- 607,613 ----
      }
  
    /* If there are lines left to gobble, then gobble them now. */
!   for (line_end = line_start; line_end < chars_read; line_end++)
      if (buffer[line_end] == '\n')
        {
  	buffer[line_end] = '\0';

--------------4AA3328560FF--

-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019