From 59dfced11d8aad36531aa3f218059ffa6eccee7f Mon Sep 17 00:00:00 2001 From: tedu Date: Thu, 8 Oct 2015 15:54:59 +0000 Subject: [PATCH] little cleanup from Michael McConville, mostly related to stale comments. --- bin/ksh/history.c | 32 ++++++++++++-------------------- 1 file 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 - * + * History file format: + * Bytes 1, 2: HMAGIC - just to check that we are dealing with + the correct object + * Each command, in the format: + */ #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; -- 2.20.1