be more semantical
This commit is contained in:
parent
1e313c282c
commit
f34f24fefc
20
histrap.c
20
histrap.c
@ -3,12 +3,16 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.22 2006/08/15 23:43:30 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.23 2006/08/15 23:45:53 tg Exp $");
|
||||||
|
|
||||||
static int histfd;
|
static int histfd;
|
||||||
static int hsize;
|
static int hsize;
|
||||||
|
|
||||||
#ifndef __sun__
|
#if defined(__sun__)
|
||||||
|
#define NO_HISTORY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NO_HISTORY
|
||||||
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);
|
||||||
@ -585,7 +589,7 @@ histsave(int lno __attribute__((unused)), const char *cmd,
|
|||||||
if ((cp = strchr(c, '\n')) != NULL)
|
if ((cp = strchr(c, '\n')) != NULL)
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
|
|
||||||
#ifndef __sun__
|
#ifdef NO_HISTORY
|
||||||
if (histfd && dowrite)
|
if (histfd && dowrite)
|
||||||
writehistfile(lno, c);
|
writehistfile(lno, c);
|
||||||
#endif
|
#endif
|
||||||
@ -628,7 +632,7 @@ histsave(int lno __attribute__((unused)), const char *cmd,
|
|||||||
void
|
void
|
||||||
hist_init(Source *s)
|
hist_init(Source *s)
|
||||||
{
|
{
|
||||||
#ifndef __sun__
|
#ifdef NO_HISTORY
|
||||||
unsigned char *base;
|
unsigned char *base;
|
||||||
int lines;
|
int lines;
|
||||||
int fd;
|
int fd;
|
||||||
@ -641,7 +645,7 @@ hist_init(Source *s)
|
|||||||
|
|
||||||
hist_source = s;
|
hist_source = s;
|
||||||
|
|
||||||
#if !defined(__sun__)
|
#ifdef NO_HISTORY
|
||||||
hname = str_val(global("HISTFILE"));
|
hname = str_val(global("HISTFILE"));
|
||||||
if (hname == NULL)
|
if (hname == NULL)
|
||||||
return;
|
return;
|
||||||
@ -711,7 +715,7 @@ typedef enum state {
|
|||||||
sn2, sn3, sn4
|
sn2, sn3, sn4
|
||||||
} State;
|
} State;
|
||||||
|
|
||||||
#ifndef __sun__
|
#ifdef NO_HISTORY
|
||||||
static int
|
static int
|
||||||
hist_count_lines(unsigned char *base, int bytes)
|
hist_count_lines(unsigned char *base, int bytes)
|
||||||
{
|
{
|
||||||
@ -951,14 +955,14 @@ writehistfile(int lno, char *cmd)
|
|||||||
void
|
void
|
||||||
hist_finish(void)
|
hist_finish(void)
|
||||||
{
|
{
|
||||||
#ifndef __sun__
|
#ifdef NO_HISTORY
|
||||||
(void) flock(histfd, LOCK_UN);
|
(void) flock(histfd, LOCK_UN);
|
||||||
(void) close(histfd);
|
(void) close(histfd);
|
||||||
#endif
|
#endif
|
||||||
histfd = 0;
|
histfd = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __sun__
|
#ifdef NO_HISTORY
|
||||||
/*
|
/*
|
||||||
* add magic to the history file
|
* add magic to the history file
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user