mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
assorted fixes uncovered by randomconfig runs
This commit is contained in:
parent
d0587ed966
commit
58875aefe4
12
editors/vi.c
12
editors/vi.c
@ -260,7 +260,9 @@ static void crash_dummy();
|
|||||||
static void crash_test();
|
static void crash_test();
|
||||||
static int crashme = 0;
|
static int crashme = 0;
|
||||||
#endif
|
#endif
|
||||||
|
#if ENABLE_FEATURE_VI_COLON
|
||||||
static char *initial_cmds[] = { NULL, NULL , NULL }; // currently 2 entries, NULL terminated
|
static char *initial_cmds[] = { NULL, NULL , NULL }; // currently 2 entries, NULL terminated
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void write1(const char *out)
|
static void write1(const char *out)
|
||||||
@ -307,12 +309,14 @@ int vi_main(int argc, char **argv)
|
|||||||
// 1- process $HOME/.exrc file (not inplemented yet)
|
// 1- process $HOME/.exrc file (not inplemented yet)
|
||||||
// 2- process EXINIT variable from environment
|
// 2- process EXINIT variable from environment
|
||||||
// 3- process command line args
|
// 3- process command line args
|
||||||
|
#if ENABLE_FEATURE_VI_COLON
|
||||||
{
|
{
|
||||||
char *p = getenv("EXINIT");
|
char *p = getenv("EXINIT");
|
||||||
if (p && *p)
|
if (p && *p)
|
||||||
initial_cmds[0] = xstrdup(p);
|
initial_cmds[0] = xstrdup(p);
|
||||||
}
|
}
|
||||||
while ((c = getopt(argc, argv, "hCRc:")) != -1) {
|
#endif
|
||||||
|
while ((c = getopt(argc, argv, "hCR" USE_FEATURE_VI_COLON("c:"))) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
#if ENABLE_FEATURE_VI_CRASHME
|
#if ENABLE_FEATURE_VI_CRASHME
|
||||||
case 'C':
|
case 'C':
|
||||||
@ -328,11 +332,13 @@ int vi_main(int argc, char **argv)
|
|||||||
//case 'r': // recover flag- ignore- we don't use tmp file
|
//case 'r': // recover flag- ignore- we don't use tmp file
|
||||||
//case 'x': // encryption flag- ignore
|
//case 'x': // encryption flag- ignore
|
||||||
//case 'c': // execute command first
|
//case 'c': // execute command first
|
||||||
|
#if ENABLE_FEATURE_VI_COLON
|
||||||
case 'c': // cmd line vi command
|
case 'c': // cmd line vi command
|
||||||
if (*optarg)
|
if (*optarg)
|
||||||
initial_cmds[initial_cmds[0] != 0] = xstrdup(optarg);
|
initial_cmds[initial_cmds[0] != 0] = xstrdup(optarg);
|
||||||
break;
|
break;
|
||||||
//case 'h': // help -- just use default
|
//case 'h': // help -- just use default
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
show_help();
|
show_help();
|
||||||
return 1;
|
return 1;
|
||||||
@ -431,6 +437,7 @@ static void edit_file(char * fn)
|
|||||||
redraw(FALSE); // dont force every col re-draw
|
redraw(FALSE); // dont force every col re-draw
|
||||||
show_status_line();
|
show_status_line();
|
||||||
|
|
||||||
|
#if ENABLE_FEATURE_VI_COLON
|
||||||
{
|
{
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
@ -450,6 +457,7 @@ static void edit_file(char * fn)
|
|||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
//------This is the main Vi cmd handling loop -----------------------
|
//------This is the main Vi cmd handling loop -----------------------
|
||||||
while (editing > 0) {
|
while (editing > 0) {
|
||||||
#if ENABLE_FEATURE_VI_CRASHME
|
#if ENABLE_FEATURE_VI_CRASHME
|
||||||
@ -938,7 +946,9 @@ static void colon(char * buf)
|
|||||||
}
|
}
|
||||||
#if ENABLE_FEATURE_VI_SET
|
#if ENABLE_FEATURE_VI_SET
|
||||||
} else if (strncasecmp(cmd, "set", i) == 0) { // set or clear features
|
} else if (strncasecmp(cmd, "set", i) == 0) { // set or clear features
|
||||||
|
#if ENABLE_FEATURE_VI_SETOPTS
|
||||||
char *argp;
|
char *argp;
|
||||||
|
#endif
|
||||||
i = 0; // offset into args
|
i = 0; // offset into args
|
||||||
// only blank is regarded as args delmiter. What about tab '\t' ?
|
// only blank is regarded as args delmiter. What about tab '\t' ?
|
||||||
if (!args[0] || strcasecmp(args, "all") == 0) {
|
if (!args[0] || strcasecmp(args, "all") == 0) {
|
||||||
|
@ -387,9 +387,10 @@ int ifconfig_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
|
len_and_sockaddr *lsa;
|
||||||
if (strcmp(host, "inet") == 0)
|
if (strcmp(host, "inet") == 0)
|
||||||
continue; /* compat stuff */
|
continue; /* compat stuff */
|
||||||
len_and_sockaddr *lsa = xhost2sockaddr(host, 0);
|
lsa = xhost2sockaddr(host, 0);
|
||||||
#if ENABLE_FEATURE_IPV6
|
#if ENABLE_FEATURE_IPV6
|
||||||
if (lsa->sa.sa_family == AF_INET6) {
|
if (lsa->sa.sa_family == AF_INET6) {
|
||||||
int sockfd6;
|
int sockfd6;
|
||||||
|
@ -325,6 +325,7 @@ struct globals {
|
|||||||
s |= (sector >> 2) & 0xc0; \
|
s |= (sector >> 2) & 0xc0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#if ENABLE_FEATURE_FDISK_WRITABLE
|
||||||
/* read line; return 0 or first printable char */
|
/* read line; return 0 or first printable char */
|
||||||
static int
|
static int
|
||||||
read_line(const char *prompt)
|
read_line(const char *prompt)
|
||||||
@ -343,6 +344,7 @@ read_line(const char *prompt)
|
|||||||
line_ptr++;
|
line_ptr++;
|
||||||
return *line_ptr;
|
return *line_ptr;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* return partition name - uses static storage
|
* return partition name - uses static storage
|
||||||
|
Loading…
Reference in New Issue
Block a user