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
mail back errors (perhaps this is why mail gets lost.....)
[unix-history]
/
usr
/
src
/
bin
/
csh
/
csh.c
diff --git
a/usr/src/bin/csh/csh.c
b/usr/src/bin/csh/csh.c
index
9109e26
..
5552b12
100644
(file)
--- a/
usr/src/bin/csh/csh.c
+++ b/
usr/src/bin/csh/csh.c
@@
-1,4
+1,4
@@
-static char *sccsid = "@(#)csh.c 4.
1
%G%";
+static char *sccsid = "@(#)csh.c 4.
4
%G%";
#include "sh.h"
#include <sys/ioctl.h>
#include "sh.h"
#include <sys/ioctl.h>
@@
-13,6
+13,7
@@
static char *sccsid = "@(#)csh.c 4.1 %G%";
*/
char *pathlist[] = { ".", "/usr/ucb", "/bin", "/usr/bin", 0 };
*/
char *pathlist[] = { ".", "/usr/ucb", "/bin", "/usr/bin", 0 };
+char *dumphist[] = { "history", "-c", "+1000" };
char HIST = '!';
char HISTSUB = '^';
bool nofile;
char HIST = '!';
char HISTSUB = '^';
bool nofile;
@@
-22,6
+23,7
@@
bool nexececho;
bool quitit;
bool fast;
bool prompt = 1;
bool quitit;
bool fast;
bool prompt = 1;
+bool enterhist = 0;
main(c, av)
int c;
main(c, av)
int c;
@@
-317,8
+319,10
@@
notty:
if (!fast && !arginp && !onelflg)
dohash();
if (loginsh) {
if (!fast && !arginp && !onelflg)
dohash();
if (loginsh) {
- int ldisc;
srccat(value("home"), "/.login");
srccat(value("home"), "/.login");
+ enterhist = 1;
+ srccat(value("home"), "/.history");
+ enterhist = 0;
}
}
}
}
@@
-525,8
+529,23
@@
srcunit(unit, onlyown)
goodbye()
{
goodbye()
{
+ char buf[BUFSIZ];
+ int fp, ftmp, oldidfds;
if (loginsh) {
if (loginsh) {
+ strcpy(buf, value("home"));
+ strcat(buf, "/.history");
+ fp = creat(buf, 0777);
+ if (fp != -1) {
+ oldidfds = didfds;
+ didfds = 0;
+ ftmp = SHOUT;
+ SHOUT = fp;
+ dohist(dumphist);
+ close(fp);
+ SHOUT = ftmp;
+ didfds = oldidfds;
+ }
signal(SIGQUIT, SIG_IGN);
sigset(SIGINT, SIG_IGN);
signal(SIGTERM, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
sigset(SIGINT, SIG_IGN);
signal(SIGTERM, SIG_IGN);
@@
-558,6
+577,12
@@
char *jobargv[2] = { "jobs", 0 };
* gets a chance to make the shell go away.
*/
pintr()
* gets a chance to make the shell go away.
*/
pintr()
+{
+ pintr1(1);
+}
+
+pintr1(wantnl)
+ bool wantnl;
{
register char **v;
{
register char **v;
@@
-588,7
+613,7
@@
pintr()
if (v = gargv)
gargv = 0, blkfree(v);
reset();
if (v = gargv)
gargv = 0, blkfree(v);
reset();
- } else if (intty)
+ } else if (intty
&& wantnl
)
printf("\n"); /* Some like this, others don't */
error(NOSTR);
}
printf("\n"); /* Some like this, others don't */
error(NOSTR);
}
@@
-621,7
+646,7
@@
process(catch)
paraml.word = "";
t = 0;
setexit();
paraml.word = "";
t = 0;
setexit();
- justpr =
0; /* A chance to execute
*/
+ justpr =
enterhist; /* execute if not entering history
*/
/*
* Interruptible during interactive reads
/*
* Interruptible during interactive reads
@@
-707,11
+732,12
@@
process(catch)
sighold(SIGINT);
/*
sighold(SIGINT);
/*
- * Save input text on the history list if it
+ * Save input text on the history list if
+ * reading in old history, or it
* is from the terminal at the top level and not
* in a loop.
*/
* is from the terminal at the top level and not
* in a loop.
*/
- if (catch && intty && !whyles)
+ if (
enterhist ||
catch && intty && !whyles)
savehist(¶ml);
/*
savehist(¶ml);
/*