Subject: Re: Bash termcap and history file
From: [email-masked] (Jason Tishler)

22 Jan 1997 10:53:16 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="------------4AA3328560FF"
X-Mailer: Mozilla 3.0Gold (WinNT; I)
Original-To: gnu-win32 <[email-masked]>
Original-Sender: [email-masked]

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: [email-masked]
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
"[email-masked]" with one line of text: "help".