version 1.85, 2017/07/19 12:25:52 |
version 1.86, 2018/09/30 14:35:32 |
|
|
int needconnect; /* Do we need to be connected to execute? */ |
int needconnect; /* Do we need to be connected to execute? */ |
} Command; |
} Command; |
|
|
|
#define MAXARGV 20 |
|
|
static char line[256]; |
static char line[256]; |
static int margc; |
static int margc; |
static char *margv[20]; |
static char *margv[MAXARGV+1]; |
|
|
static void |
static int |
makeargv(void) |
makeargv(void) |
{ |
{ |
char *cp, *cp2, c; |
char *cp, *cp2, c; |
char **argp = margv; |
char **argp = margv; |
|
int ret = 0; |
|
|
margc = 0; |
margc = 0; |
cp = line; |
cp = line; |
while ((c = *cp)) { |
while ((c = *cp)) { |
|
if (margc >= MAXARGV) { |
|
printf("too many arguments\n"); |
|
ret = 1; |
|
break; |
|
} |
int inquote = 0; |
int inquote = 0; |
while (isspace((unsigned char)c)) |
while (isspace((unsigned char)c)) |
c = *++cp; |
c = *++cp; |
|
|
cp++; |
cp++; |
} |
} |
*argp++ = 0; |
*argp++ = 0; |
|
return (ret); |
} |
} |
|
|
/* |
/* |
|
|
continue; |
continue; |
gotmachine = 1; |
gotmachine = 1; |
} |
} |
makeargv(); |
if (makeargv()) |
|
continue; |
if (margv[0] == 0) |
if (margv[0] == 0) |
continue; |
continue; |
c = getcmd(margv[0]); |
c = getcmd(margv[0]); |
|
|
strlcpy(line, "open ", sizeof(line)); |
strlcpy(line, "open ", sizeof(line)); |
printf("(to) "); |
printf("(to) "); |
(void) fgets(&line[strlen(line)], sizeof(line) - strlen(line), stdin); |
(void) fgets(&line[strlen(line)], sizeof(line) - strlen(line), stdin); |
makeargv(); |
if (makeargv()) |
|
return 0; |
argc = margc; |
argc = margc; |
argv = margv; |
argv = margv; |
} |
} |
|
|
} |
} |
if (line[0] == 0) |
if (line[0] == 0) |
break; |
break; |
makeargv(); |
if (makeargv()) |
|
break; |
if (margv[0] == 0) { |
if (margv[0] == 0) { |
break; |
break; |
} |
} |