🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #40

Re: history numbers are wrong

#40
From: Thomas Thyberg
Date: Thu, 22 Jun 1989 12:22
38 lines
1743 bytes
In article <8906210400.AA08380@hobbes.ai.mit.edu> roland@AI.MIT.EDU (Roland McGrath) writes:
>The history number displayed by \# in PS1 does not correspond
>to the numbers used in ! history references or the `history' builtin.
>The numbers given by \# start at 1 with each bash invocation,
>while the real history numbers start at the beginning of .bash_history.

This seems to fix that problem. I'm not sure this is the 'right' way of
fixing it, but it works.

*** history.c.orig	Tue Jun 13 12:03:19 1989
--- history.c	Thu Jun 15 12:52:03 1989
***************
*** 354,361 ****
  	line = (char *)xrealloc (line, line_size += TYPICAL_LINE_SIZE);
      }
      line[i] = '\0';
!     if (line[0])
        add_history (line);
    }
    free (line);
    fclose (file);
--- 354,364 ----
  	line = (char *)xrealloc (line, line_size += TYPICAL_LINE_SIZE);
      }
      line[i] = '\0';
!     if (line[0]) {
!       extern int current_command_number;
!       current_command_number++;
        add_history (line);
+     }
    }
    free (line);
    fclose (file);
-- 
Thomas Thyberg			INET : thomas@prosys.se
Programsystem AB		UUCP : ...!{uunet,mcvax}!sunic!prosys!thomas
Teknikringen 2A			PHONE: +46 (0)13 21 40 40
S-583 30 Linkoping, Sweden	FAX  : +46 (0)13 21 36 35
Technical Details
Message-ID: <428@helios.prosys.se>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!kth!sunic!liuida!prosys!thomas
References: <8906210400.AA08380@hobbes.ai.mit.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!kth!sunic!liuida!prosys!thomas
From: thomas@helios.prosys.se (Thomas Thyberg)
Newsgroups: gnu.bash.bug
Subject: Re: history numbers are wrong
Message-ID: <428@helios.prosys.se>
Date: 22 Jun 89 12:22:34 GMT
References: <8906210400.AA08380@hobbes.ai.mit.edu>
Distribution: gnu
Organization: Programsystem AB, Linkoping, SWEDEN
Lines: 38