diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2015-10-08 15:55:00 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2015-10-08 15:55:00 +0000 |
commit | 33d6754907f6e8756b273bf35b8e1e5d12fb197b (patch) | |
tree | 388c023102f70db603e1834fb972013ad2eb4ece /bin/ksh | |
parent | ce87a267ea86409a8498391d17644470084548a6 (diff) |
little cleanup from Michael McConville, mostly related to stale comments.
Diffstat (limited to 'bin/ksh')
-rw-r--r-- | bin/ksh/history.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/bin/ksh/history.c b/bin/ksh/history.c index ebd06cb41d1..19ba4e2a539 100644 --- a/bin/ksh/history.c +++ b/bin/ksh/history.c @@ -1,9 +1,7 @@ -/* $OpenBSD: history.c,v 1.44 2015/09/17 21:39:54 nicm Exp $ */ +/* $OpenBSD: history.c,v 1.45 2015/10/08 15:54:59 tedu Exp $ */ /* * command history - * - * only implements in-memory history. */ /* @@ -598,24 +596,18 @@ histsave(int lno, const char *cmd, int dowrite) } /* - * Write history data to a file nominated by HISTFILE - * if HISTFILE is unset then history still happens, but - * the data is not written to a file - * All copies of ksh looking at the file will maintain the - * same history. This is ksh behaviour. - * - * This stuff uses mmap() - * if your system ain't got it - then you'll have to undef HISTORYFILE + * Write history data to a file nominated by HISTFILE. If HISTFILE + * is unset then history is still recorded, but the data is not + * written to a file. All copies of ksh looking at the file will + * maintain the same history. This is ksh behaviour. */ /* - * Open a history file - * Format is: - * Bytes 1, 2: HMAGIC - just to check that we are dealing with - * the correct object - * Then follows a number of stored commands - * Each command is - * <command byte><command number(4 bytes)><bytes><null> + * History file format: + * Bytes 1, 2: HMAGIC - just to check that we are dealing with + the correct object + * Each command, in the format: + <command byte><command number(4 bytes)><bytes><null> */ #define HMAGIC1 0xab #define HMAGIC2 0xcd @@ -664,7 +656,7 @@ hist_init(Source *s) /* * we have some data */ - base = (unsigned char *)mmap(0, hsize, PROT_READ, + base = mmap(0, hsize, PROT_READ, MAP_FILE|MAP_PRIVATE, histfd, 0); /* * check on its validity @@ -902,7 +894,7 @@ writehistfile(int lno, char *cmd) if (sizenow > hsize) { /* someone has added some lines */ bytes = sizenow - hsize; - base = (unsigned char *)mmap(0, sizenow, + base = mmap(0, sizenow, PROT_READ, MAP_FILE|MAP_PRIVATE, histfd, 0); if (base == MAP_FAILED) goto bad; |