projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
BSD 4 release
[unix-history]
/
usr
/
src
/
cmd
/
csh
/
sh.hist.c
diff --git
a/usr/src/cmd/csh/sh.hist.c
b/usr/src/cmd/csh/sh.hist.c
index
f3e40e9
..
eed9d90
100644
(file)
--- a/
usr/src/cmd/csh/sh.hist.c
+++ b/
usr/src/cmd/csh/sh.hist.c
@@
-1,4
+1,5
@@
-/* Copyright (c) 1979 Regents of the University of California */
+static char *sccsid = "@(#)sh.hist.c 4.1 10/9/80";
+
#include "sh.h"
/*
#include "sh.h"
/*
@@
-62,26
+63,50
@@
hfree(hp)
{
freelex(&hp->Hlex);
{
freelex(&hp->Hlex);
- xfree(hp);
+ xfree(
(char *)
hp);
}
}
-dohist()
+dohist(vp)
+ char **vp;
{
{
+ int n, rflg = 0;
if (getn(value("history")) == 0)
return;
if (getn(value("history")) == 0)
return;
- dohist1(Histlist.Hnext);
+ if (setintr)
+ sigrelse(SIGINT);
+ vp++;
+ if (*vp && eq(*vp, "-r")) {
+ rflg++;
+ vp++;
+ }
+ if (*vp)
+ n = getn(*vp);
+ else
+ n = 1000;
+ dohist1(Histlist.Hnext, &n, rflg);
}
}
-dohist1(hp)
- register struct Hist *hp;
+dohist1(hp, np, rflg)
+ struct Hist *hp;
+ int *np;
{
{
-
+ bool print = (*np) > 0;
+top:
if (hp == 0)
return;
if (hp == 0)
return;
+ (*np)--;
hp->Href++;
hp->Href++;
- dohist1(hp->Hnext);
- phist(hp);
+ if (rflg == 0) {
+ dohist1(hp->Hnext, np, rflg);
+ if (print)
+ phist(hp);
+ return;
+ }
+ if (*np >= 0)
+ phist(hp);
+ hp = hp->Hnext;
+ goto top;
}
phist(hp)
}
phist(hp)