put a bit of type safety into the history code
This commit is contained in:
parent
38dcf950c9
commit
da9ce25524
@ -26,7 +26,7 @@
|
|||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.114 2011/12/30 20:35:29 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.115 2011/12/30 21:00:30 tg Exp $");
|
||||||
|
|
||||||
Trap sigtraps[NSIG + 1];
|
Trap sigtraps[NSIG + 1];
|
||||||
static struct sigaction Sigact_ign;
|
static struct sigaction Sigact_ign;
|
||||||
@ -35,7 +35,7 @@ static struct sigaction Sigact_ign;
|
|||||||
static int hist_count_lines(unsigned char *, int);
|
static int hist_count_lines(unsigned char *, int);
|
||||||
static int hist_shrink(unsigned char *, int);
|
static int hist_shrink(unsigned char *, int);
|
||||||
static unsigned char *hist_skip_back(unsigned char *,int *,int);
|
static unsigned char *hist_skip_back(unsigned char *,int *,int);
|
||||||
static void histload(Source *, unsigned char *, int);
|
static void histload(Source *, unsigned char *, size_t);
|
||||||
static void histinsert(Source *, int, const char *);
|
static void histinsert(Source *, int, const char *);
|
||||||
static void writehistfile(int, char *);
|
static void writehistfile(int, char *);
|
||||||
static int sprinkle(int);
|
static int sprinkle(int);
|
||||||
@ -539,7 +539,7 @@ findhist(int start, int fwd, const char *str, int anchored)
|
|||||||
* set history; this means reallocating the dataspace
|
* set history; this means reallocating the dataspace
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
sethistsize(int n)
|
sethistsize(mksh_ari_t n)
|
||||||
{
|
{
|
||||||
if (n > 0 && n != histsize) {
|
if (n > 0 && n != histsize) {
|
||||||
int cursize = histptr - history;
|
int cursize = histptr - history;
|
||||||
@ -908,7 +908,7 @@ hist_skip_back(unsigned char *base, int *bytes, int no)
|
|||||||
* load the history structure from the stored data
|
* load the history structure from the stored data
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
histload(Source *s, unsigned char *base, int bytes)
|
histload(Source *s, unsigned char *base, size_t bytes)
|
||||||
{
|
{
|
||||||
State state;
|
State state;
|
||||||
int lno = 0;
|
int lno = 0;
|
||||||
|
10
sh.h
10
sh.h
@ -151,7 +151,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.514 2011/12/29 23:36:23 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.515 2011/12/30 21:00:30 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R40 2011/12/29"
|
#define MKSH_VERSION "R40 2011/12/29"
|
||||||
|
|
||||||
@ -1450,9 +1450,9 @@ EXTERN char ident[IDENT+1];
|
|||||||
|
|
||||||
#define HISTORYSIZE 500 /* size of saved history */
|
#define HISTORYSIZE 500 /* size of saved history */
|
||||||
|
|
||||||
EXTERN char **history; /* saved commands */
|
EXTERN char **history; /* saved commands */
|
||||||
EXTERN char **histptr; /* last history item */
|
EXTERN char **histptr; /* last history item */
|
||||||
EXTERN int histsize; /* history size */
|
EXTERN mksh_ari_t histsize; /* history size */
|
||||||
|
|
||||||
/* user and system time of last j_waitjed job */
|
/* user and system time of last j_waitjed job */
|
||||||
EXTERN struct timeval j_usrtime, j_systime;
|
EXTERN struct timeval j_usrtime, j_systime;
|
||||||
@ -1627,7 +1627,7 @@ void histsave(int *, const char *, bool, bool);
|
|||||||
bool histsync(void);
|
bool histsync(void);
|
||||||
#endif
|
#endif
|
||||||
int c_fc(const char **);
|
int c_fc(const char **);
|
||||||
void sethistsize(int);
|
void sethistsize(mksh_ari_t);
|
||||||
#if HAVE_PERSISTENT_HISTORY
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
void sethistfile(const char *);
|
void sethistfile(const char *);
|
||||||
#endif
|
#endif
|
||||||
|
4
var.c
4
var.c
@ -26,7 +26,7 @@
|
|||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.138 2011/12/16 20:03:28 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.139 2011/12/30 21:00:32 tg Exp $");
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Variables
|
* Variables
|
||||||
@ -1220,7 +1220,7 @@ setspec(struct tbl *vp)
|
|||||||
getopts_reset((int)i);
|
getopts_reset((int)i);
|
||||||
break;
|
break;
|
||||||
case V_HISTSIZE:
|
case V_HISTSIZE:
|
||||||
sethistsize((int)i);
|
sethistsize(i);
|
||||||
break;
|
break;
|
||||||
case V_COLUMNS:
|
case V_COLUMNS:
|
||||||
if (i >= MIN_COLS)
|
if (i >= MIN_COLS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user