-/* $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.
*/
/*
}
/*
- * 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
/*
* 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
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;