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
make install of mv a special case
[unix-history]
/
usr
/
src
/
bin
/
csh
/
hist.c
diff --git
a/usr/src/bin/csh/hist.c
b/usr/src/bin/csh/hist.c
index
79e6c43
..
8a68351
100644
(file)
--- a/
usr/src/bin/csh/hist.c
+++ b/
usr/src/bin/csh/hist.c
@@
-1,4
+1,4
@@
-static char *sccsid = "@(#)hist.c 4.
1
%G%";
+static char *sccsid = "@(#)hist.c 4.
4
%G%";
#include "sh.h"
#include "sh.h"
@@
-69,27
+69,33
@@
hfree(hp)
dohist(vp)
char **vp;
{
dohist(vp)
char **vp;
{
- int n, rflg = 0;
-
+ int n, rflg = 0, hflg = 0;
if (getn(value("history")) == 0)
return;
if (setintr)
sigrelse(SIGINT);
vp++;
if (getn(value("history")) == 0)
return;
if (setintr)
sigrelse(SIGINT);
vp++;
- if (*vp && eq(*vp, "-r")) {
- rflg++;
- vp++;
+ while (*vp && *vp[0] == '-') {
+ if (*vp && eq(*vp, "-h")) {
+ hflg++;
+ vp++;
+ }
+ if (*vp && eq(*vp, "-r")) {
+ rflg++;
+ vp++;
+ }
}
if (*vp)
n = getn(*vp);
}
if (*vp)
n = getn(*vp);
- else
- n = 1000;
- dohist1(Histlist.Hnext, &n, rflg);
+ else {
+ n = getn(value("history"));
+ }
+ dohist1(Histlist.Hnext, &n, rflg, hflg);
}
}
-dohist1(hp, np, rflg)
+dohist1(hp, np, rflg
, hflg
)
struct Hist *hp;
struct Hist *hp;
- int *np;
+ int *np
, rflg, hflg
;
{
bool print = (*np) > 0;
top:
{
bool print = (*np) > 0;
top:
@@
-98,21
+104,23
@@
top:
(*np)--;
hp->Href++;
if (rflg == 0) {
(*np)--;
hp->Href++;
if (rflg == 0) {
- dohist1(hp->Hnext, np, rflg);
+ dohist1(hp->Hnext, np, rflg
, hflg
);
if (print)
if (print)
- phist(hp);
+ phist(hp
, hflg
);
return;
}
if (*np >= 0)
return;
}
if (*np >= 0)
- phist(hp);
+ phist(hp
, hflg
);
hp = hp->Hnext;
goto top;
}
hp = hp->Hnext;
goto top;
}
-phist(hp)
+phist(hp
, hflg
)
register struct Hist *hp;
register struct Hist *hp;
+ int hflg;
{
{
- printf("%6d\t", hp->Hnum);
+ if (hflg == 0)
+ printf("%6d\t", hp->Hnum);
prlex(&hp->Hlex);
}
prlex(&hp->Hlex);
}