mirror of git://git.suckless.org/sbase
Compare commits
13 Commits
d3a877d171
...
e24228e062
Author | SHA1 | Date |
---|---|---|
Jules Maselbas | e24228e062 | |
Roberto E. Vargas Caballero | 6a557314b9 | |
Roberto E. Vargas Caballero | bbdd7bedc4 | |
Roberto E. Vargas Caballero | 137f0917e4 | |
Roberto E. Vargas Caballero | 2d4d7dc6d4 | |
Roberto E. Vargas Caballero | 516e7fec92 | |
Roberto E. Vargas Caballero | 54a0fc3ecc | |
Roberto E. Vargas Caballero | 09dc00f995 | |
Roberto E. Vargas Caballero | 890f6c2c05 | |
Roberto E. Vargas Caballero | aacfa18b79 | |
Roberto E. Vargas Caballero | b089261c3a | |
Roberto E. Vargas Caballero | 1e10bf6069 | |
Roberto E. Vargas Caballero | b710ee81fc |
25
TODO
25
TODO
|
@ -28,10 +28,6 @@ Bugs
|
||||||
|
|
||||||
ed
|
ed
|
||||||
--
|
--
|
||||||
* Multi-line commands don't work in global commands:
|
|
||||||
g/^line/a \
|
|
||||||
line1
|
|
||||||
.
|
|
||||||
* cat <<EOF | ed
|
* cat <<EOF | ed
|
||||||
0a
|
0a
|
||||||
int radix = 16;
|
int radix = 16;
|
||||||
|
@ -54,19 +50,16 @@ ed
|
||||||
line
|
line
|
||||||
.
|
.
|
||||||
1g/^$/p
|
1g/^$/p
|
||||||
|
* cat <<EOF | ed
|
||||||
|
i
|
||||||
|
foobar1
|
||||||
|
foobar2
|
||||||
|
.
|
||||||
|
1,2s/foo/&\
|
||||||
|
&/
|
||||||
|
,n
|
||||||
|
|
||||||
* Editing huge files doesn't work well.
|
* Editing huge files doesn't work well.
|
||||||
* Escaping newlines in replacement doesn't work well:
|
|
||||||
% /bin/ed
|
|
||||||
i
|
|
||||||
foobar
|
|
||||||
.
|
|
||||||
s/foo/&\
|
|
||||||
->
|
|
||||||
->bar
|
|
||||||
,p
|
|
||||||
foo
|
|
||||||
->bar
|
|
||||||
Q
|
|
||||||
|
|
||||||
|
|
||||||
printf
|
printf
|
||||||
|
|
274
ed.c
274
ed.c
|
@ -64,30 +64,15 @@ static int pflag, modflag, uflag, gflag;
|
||||||
static size_t csize;
|
static size_t csize;
|
||||||
static String cmdline;
|
static String cmdline;
|
||||||
static char *ocmdline;
|
static char *ocmdline;
|
||||||
static int repidx;
|
static int inputidx;
|
||||||
static char *rhs;
|
static char *rhs;
|
||||||
static char *lastmatch;
|
static char *lastmatch;
|
||||||
static struct undo udata;
|
static struct undo udata;
|
||||||
static int newcmd;
|
static int newcmd;
|
||||||
int eol, bol;
|
static int eol, bol;
|
||||||
|
|
||||||
static sig_atomic_t intr, hup;
|
static sig_atomic_t intr, hup;
|
||||||
|
|
||||||
static void
|
|
||||||
discard(void)
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
|
|
||||||
if (repidx >= 0 || cmdline.siz == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* discard until the end of the line */
|
|
||||||
if (cmdline.str[cmdline.siz-1] != '\n') {
|
|
||||||
while ((c = getchar()) != '\n' && c != EOF)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void undo(void);
|
static void undo(void);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -102,7 +87,6 @@ error(char *msg)
|
||||||
if (!newcmd)
|
if (!newcmd)
|
||||||
undo();
|
undo();
|
||||||
|
|
||||||
discard();
|
|
||||||
curln = ocurln;
|
curln = ocurln;
|
||||||
longjmp(savesp, 1);
|
longjmp(savesp, 1);
|
||||||
}
|
}
|
||||||
|
@ -121,6 +105,24 @@ prevln(int line)
|
||||||
return (line < 0) ? lastln : line;
|
return (line < 0) ? lastln : line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String *
|
||||||
|
copystring(String *s, char *from)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
char *t;
|
||||||
|
|
||||||
|
if ((t = strdup(from)) == NULL)
|
||||||
|
error("out of memory");
|
||||||
|
len = strlen(t);
|
||||||
|
|
||||||
|
free(s->str);
|
||||||
|
s->str = t;
|
||||||
|
s->siz = len;
|
||||||
|
s->cap = len;
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
static String *
|
static String *
|
||||||
string(String *s)
|
string(String *s)
|
||||||
{
|
{
|
||||||
|
@ -154,30 +156,22 @@ static void chksignals(void);
|
||||||
static int
|
static int
|
||||||
input(void)
|
input(void)
|
||||||
{
|
{
|
||||||
int c;
|
int ch;
|
||||||
|
|
||||||
if (repidx >= 0)
|
|
||||||
return ocmdline[repidx++];
|
|
||||||
|
|
||||||
if ((c = getchar()) != EOF)
|
|
||||||
addchar(c, &cmdline);
|
|
||||||
|
|
||||||
chksignals();
|
chksignals();
|
||||||
|
|
||||||
return c;
|
ch = cmdline.str[inputidx];
|
||||||
|
if (ch != '\0')
|
||||||
|
inputidx++;
|
||||||
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
back(int c)
|
back(int c)
|
||||||
{
|
{
|
||||||
if (repidx > 0) {
|
if (c == '\0')
|
||||||
--repidx;
|
return c;
|
||||||
} else {
|
return cmdline.str[--inputidx] = c;
|
||||||
ungetc(c, stdin);
|
|
||||||
if (c != EOF)
|
|
||||||
--cmdline.siz;
|
|
||||||
}
|
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -185,25 +179,27 @@ makeline(char *s, int *off)
|
||||||
{
|
{
|
||||||
struct hline *lp;
|
struct hline *lp;
|
||||||
size_t len;
|
size_t len;
|
||||||
char c, *begin = s;
|
char *begin = s;
|
||||||
|
int c;
|
||||||
|
|
||||||
if (lastidx >= idxsize) {
|
if (lastidx >= idxsize) {
|
||||||
lp = NULL;
|
lp = NULL;
|
||||||
if (idxsize <= SIZE_MAX - NUMLINES)
|
if (idxsize <= SIZE_MAX - NUMLINES)
|
||||||
lp = reallocarray(zero, idxsize + NUMLINES, sizeof(*lp));
|
lp = reallocarray(zero, idxsize + NUMLINES, sizeof(*lp));
|
||||||
if (!lp)
|
if (!lp)
|
||||||
error("out of memory");
|
error("out of memory");
|
||||||
idxsize += NUMLINES;
|
idxsize += NUMLINES;
|
||||||
zero = lp;
|
zero = lp;
|
||||||
}
|
}
|
||||||
lp = zero + lastidx;
|
lp = zero + lastidx;
|
||||||
|
lp->global = 0;
|
||||||
|
|
||||||
if (!s) {
|
if (!s) {
|
||||||
lp->seek = -1;
|
lp->seek = -1;
|
||||||
len = 0;
|
len = 0;
|
||||||
} else {
|
} else {
|
||||||
while ((c = *s++) != '\n')
|
while ((c = *s++) && c != '\n')
|
||||||
/* nothing */;
|
;
|
||||||
len = s - begin;
|
len = s - begin;
|
||||||
if ((lp->seek = lseek(scratch, 0, SEEK_END)) < 0 ||
|
if ((lp->seek = lseek(scratch, 0, SEEK_END)) < 0 ||
|
||||||
write(scratch, begin, len) < 0) {
|
write(scratch, begin, len) < 0) {
|
||||||
|
@ -408,18 +404,14 @@ compile(int delim)
|
||||||
|
|
||||||
eol = bol = bracket = lastre.siz = 0;
|
eol = bol = bracket = lastre.siz = 0;
|
||||||
for (n = 0;; ++n) {
|
for (n = 0;; ++n) {
|
||||||
if ((c = input()) == delim && !bracket)
|
c = input();
|
||||||
|
if (c == delim && !bracket || c == '\0') {
|
||||||
break;
|
break;
|
||||||
if (c == '^') {
|
} else if (c == '^') {
|
||||||
bol = 1;
|
bol = 1;
|
||||||
} else if (c == '$') {
|
} else if (c == '$') {
|
||||||
eol = 1;
|
eol = 1;
|
||||||
} else if (c == '\n' || c == EOF) {
|
} else if (c == '\\') {
|
||||||
back(c);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c == '\\') {
|
|
||||||
addchar(c, &lastre);
|
addchar(c, &lastre);
|
||||||
c = input();
|
c = input();
|
||||||
} else if (c == '[') {
|
} else if (c == '[') {
|
||||||
|
@ -490,7 +482,7 @@ skipblank(void)
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
while ((c = input()) == ' ' || c == '\t')
|
while ((c = input()) == ' ' || c == '\t')
|
||||||
/* nothing */;
|
;
|
||||||
back(c);
|
back(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,9 +495,8 @@ ensureblank(void)
|
||||||
case ' ':
|
case ' ':
|
||||||
case '\t':
|
case '\t':
|
||||||
skipblank();
|
skipblank();
|
||||||
case '\n':
|
case '\0':
|
||||||
back(c);
|
back(c);
|
||||||
case EOF:
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error("unknown command");
|
error("unknown command");
|
||||||
|
@ -663,6 +654,55 @@ quit(void)
|
||||||
exit(exstatus);
|
exit(exstatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
setinput(char *s)
|
||||||
|
{
|
||||||
|
copystring(&cmdline, s);
|
||||||
|
inputidx = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
getinput(void)
|
||||||
|
{
|
||||||
|
int ch;
|
||||||
|
|
||||||
|
string(&cmdline);
|
||||||
|
|
||||||
|
while ((ch = getchar()) != '\n' && ch != EOF) {
|
||||||
|
if (ch == '\\') {
|
||||||
|
if ((ch = getchar()) == EOF)
|
||||||
|
break;
|
||||||
|
if (ch != '\n') {
|
||||||
|
ungetc(ch, stdin);
|
||||||
|
ch = '\\';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addchar(ch, &cmdline);
|
||||||
|
}
|
||||||
|
|
||||||
|
addchar('\0', &cmdline);
|
||||||
|
inputidx = 0;
|
||||||
|
|
||||||
|
if (ch == EOF) {
|
||||||
|
chksignals();
|
||||||
|
if (ferror(stdin)) {
|
||||||
|
exstatus = 1;
|
||||||
|
fputs("ed: error reading input\n", stderr);
|
||||||
|
}
|
||||||
|
quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
moreinput(void)
|
||||||
|
{
|
||||||
|
if (!uflag)
|
||||||
|
return cmdline.str[inputidx] != '\0';
|
||||||
|
|
||||||
|
getinput();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static void dowrite(const char *, int);
|
static void dowrite(const char *, int);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -670,6 +710,9 @@ dump(void)
|
||||||
{
|
{
|
||||||
char *home;
|
char *home;
|
||||||
|
|
||||||
|
if (modflag)
|
||||||
|
return;
|
||||||
|
|
||||||
line1 = nextln(0);
|
line1 = nextln(0);
|
||||||
line2 = lastln;
|
line2 = lastln;
|
||||||
|
|
||||||
|
@ -690,14 +733,14 @@ static void
|
||||||
chksignals(void)
|
chksignals(void)
|
||||||
{
|
{
|
||||||
if (hup) {
|
if (hup) {
|
||||||
if (modflag)
|
|
||||||
dump();
|
|
||||||
exstatus = 1;
|
exstatus = 1;
|
||||||
|
dump();
|
||||||
quit();
|
quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intr) {
|
if (intr) {
|
||||||
intr = 0;
|
intr = 0;
|
||||||
|
newcmd = 1;
|
||||||
clearerr(stdin);
|
clearerr(stdin);
|
||||||
error("Interrupt");
|
error("Interrupt");
|
||||||
}
|
}
|
||||||
|
@ -846,7 +889,7 @@ dohelp(void)
|
||||||
static void
|
static void
|
||||||
chkprint(int flag)
|
chkprint(int flag)
|
||||||
{
|
{
|
||||||
char c;
|
int c;
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
if ((c = input()) == 'p' || c == 'l' || c == 'n')
|
if ((c = input()) == 'p' || c == 'l' || c == 'n')
|
||||||
|
@ -854,12 +897,12 @@ chkprint(int flag)
|
||||||
else
|
else
|
||||||
back(c);
|
back(c);
|
||||||
}
|
}
|
||||||
if (input() != '\n')
|
if ((c = input()) != '\0' && c != '\n')
|
||||||
error("invalid command suffix");
|
error("invalid command suffix");
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
getfname(char comm)
|
getfname(int comm)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
char *bp;
|
char *bp;
|
||||||
|
@ -867,7 +910,7 @@ getfname(char comm)
|
||||||
|
|
||||||
skipblank();
|
skipblank();
|
||||||
for (bp = fname; bp < &fname[FILENAME_MAX]; *bp++ = c) {
|
for (bp = fname; bp < &fname[FILENAME_MAX]; *bp++ = c) {
|
||||||
if ((c = input()) == EOF || c == '\n')
|
if ((c = input()) == '\0')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (bp == fname) {
|
if (bp == fname) {
|
||||||
|
@ -889,16 +932,21 @@ getfname(char comm)
|
||||||
static void
|
static void
|
||||||
append(int num)
|
append(int num)
|
||||||
{
|
{
|
||||||
char *s = NULL;
|
int ch;
|
||||||
size_t len = 0;
|
static String line;
|
||||||
|
|
||||||
curln = num;
|
curln = num;
|
||||||
while (getline(&s, &len, stdin) > 0) {
|
while (moreinput()) {
|
||||||
if (*s == '.' && s[1] == '\n')
|
string(&line);
|
||||||
|
while ((ch = input()) != '\n' && ch != '\0')
|
||||||
|
addchar(ch, &line);
|
||||||
|
addchar('\n', &line);
|
||||||
|
addchar('\0', &line);
|
||||||
|
|
||||||
|
if (!strcmp(line.str, ".\n") || !strcmp(line.str, "."))
|
||||||
break;
|
break;
|
||||||
inject(s, AFTER);
|
inject(line.str, AFTER);
|
||||||
}
|
}
|
||||||
free(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1022,14 +1070,22 @@ execsh(void)
|
||||||
error("no previous command");
|
error("no previous command");
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((c = input()) != EOF && c != '\n') {
|
while ((c = input()) != '\0') {
|
||||||
if (c == '%' && (cmd.siz == 0 || cmd.str[cmd.siz - 1] != '\\')) {
|
switch (c) {
|
||||||
|
case '%':
|
||||||
if (savfname[0] == '\0')
|
if (savfname[0] == '\0')
|
||||||
error("no current filename");
|
error("no current filename");
|
||||||
repl = 1;
|
repl = 1;
|
||||||
for (p = savfname; *p; ++p)
|
for (p = savfname; *p; ++p)
|
||||||
addchar(*p, &cmd);
|
addchar(*p, &cmd);
|
||||||
} else {
|
break;
|
||||||
|
case '\\':
|
||||||
|
c = input();
|
||||||
|
if (c != '%') {
|
||||||
|
back(c);
|
||||||
|
c = '\\';
|
||||||
|
}
|
||||||
|
default:
|
||||||
addchar(c, &cmd);
|
addchar(c, &cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1049,20 +1105,18 @@ getrhs(int delim)
|
||||||
static String s;
|
static String s;
|
||||||
|
|
||||||
string(&s);
|
string(&s);
|
||||||
while ((c = input()) != '\n' && c != EOF && c != delim)
|
while ((c = input()) != '\0' && c != delim)
|
||||||
addchar(c, &s);
|
addchar(c, &s);
|
||||||
addchar('\0', &s);
|
addchar('\0', &s);
|
||||||
if (c == EOF)
|
if (c == '\0') {
|
||||||
error("invalid pattern delimiter");
|
|
||||||
if (c == '\n') {
|
|
||||||
pflag = 'p';
|
pflag = 'p';
|
||||||
back(c);
|
back(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp("%", s.str)) {
|
if (!strcmp("%", s.str)) {
|
||||||
free(s.str);
|
|
||||||
if (!rhs)
|
if (!rhs)
|
||||||
error("no previous substitution");
|
error("no previous substitution");
|
||||||
|
free(s.str);
|
||||||
} else {
|
} else {
|
||||||
free(rhs);
|
free(rhs);
|
||||||
rhs = s.str;
|
rhs = s.str;
|
||||||
|
@ -1183,8 +1237,7 @@ subst(int nth)
|
||||||
static void
|
static void
|
||||||
docmd(void)
|
docmd(void)
|
||||||
{
|
{
|
||||||
char cmd;
|
int cmd, c, line3, num, trunc;
|
||||||
int rep = 0, c, line3, num, trunc;
|
|
||||||
|
|
||||||
repeat:
|
repeat:
|
||||||
skipblank();
|
skipblank();
|
||||||
|
@ -1196,21 +1249,16 @@ repeat:
|
||||||
chkprint(0);
|
chkprint(0);
|
||||||
if (!ocmdline)
|
if (!ocmdline)
|
||||||
error("no previous command");
|
error("no previous command");
|
||||||
rep = 1;
|
setinput(ocmdline);
|
||||||
repidx = 0;
|
|
||||||
getlst();
|
getlst();
|
||||||
goto repeat;
|
goto repeat;
|
||||||
case '!':
|
case '!':
|
||||||
execsh();
|
execsh();
|
||||||
break;
|
break;
|
||||||
case EOF:
|
case '\0':
|
||||||
if (cmdline.siz == 0)
|
|
||||||
quit();
|
|
||||||
case '\n':
|
|
||||||
if (gflag && uflag)
|
|
||||||
return;
|
|
||||||
num = gflag ? curln : curln+1;
|
num = gflag ? curln : curln+1;
|
||||||
deflines(num, num);
|
deflines(num, num);
|
||||||
|
line1 = line2;
|
||||||
pflag = 'p';
|
pflag = 'p';
|
||||||
goto print;
|
goto print;
|
||||||
case 'l':
|
case 'l':
|
||||||
|
@ -1360,7 +1408,7 @@ repeat:
|
||||||
ensureblank();
|
ensureblank();
|
||||||
if (nlines > 0)
|
if (nlines > 0)
|
||||||
goto unexpected;
|
goto unexpected;
|
||||||
if (back(input()) != '\n')
|
if (back(input()) != '\0')
|
||||||
getfname(cmd);
|
getfname(cmd);
|
||||||
else
|
else
|
||||||
puts(savfname);
|
puts(savfname);
|
||||||
|
@ -1392,21 +1440,11 @@ repeat:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pflag)
|
if (!pflag)
|
||||||
goto save_last_cmd;
|
return;
|
||||||
|
|
||||||
line1 = line2 = curln;
|
line1 = line2 = curln;
|
||||||
|
|
||||||
print:
|
print:
|
||||||
doprint();
|
doprint();
|
||||||
|
|
||||||
save_last_cmd:
|
|
||||||
if (!uflag)
|
|
||||||
repidx = 0;
|
|
||||||
if (rep)
|
|
||||||
return;
|
|
||||||
free(ocmdline);
|
|
||||||
addchar('\0', &cmdline);
|
|
||||||
if ((ocmdline = strdup(cmdline.str)) == NULL)
|
|
||||||
error("out of memory");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1451,12 +1489,26 @@ chkglobal(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
doglobal(void)
|
savecmd(void)
|
||||||
{
|
{
|
||||||
int cnt, ln, k;
|
int ch;
|
||||||
|
|
||||||
|
skipblank();
|
||||||
|
ch = input();
|
||||||
|
if (ch != '&') {
|
||||||
|
ocmdline = strdup(cmdline.str);
|
||||||
|
if (ocmdline == NULL)
|
||||||
|
error("out of memory");
|
||||||
|
}
|
||||||
|
back(ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
doglobal(void)
|
||||||
|
{
|
||||||
|
int cnt, ln, k, idx;
|
||||||
|
|
||||||
skipblank();
|
skipblank();
|
||||||
string(&cmdline);
|
|
||||||
gflag = 1;
|
gflag = 1;
|
||||||
if (uflag)
|
if (uflag)
|
||||||
chkprint(0);
|
chkprint(0);
|
||||||
|
@ -1469,19 +1521,33 @@ doglobal(void)
|
||||||
zero[k].global = 0;
|
zero[k].global = 0;
|
||||||
curln = ln;
|
curln = ln;
|
||||||
nlines = 0;
|
nlines = 0;
|
||||||
if (uflag) {
|
|
||||||
line1 = line2 = ln;
|
if (!uflag) {
|
||||||
pflag = 0;
|
idx = inputidx;
|
||||||
doprint();
|
getlst();
|
||||||
|
docmd();
|
||||||
|
inputidx = idx;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
getlst();
|
|
||||||
docmd();
|
line1 = line2 = ln;
|
||||||
|
pflag = 0;
|
||||||
|
doprint();
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
getinput();
|
||||||
|
if (strcmp(cmdline.str, "") == 0)
|
||||||
|
break;
|
||||||
|
savecmd();
|
||||||
|
getlst();
|
||||||
|
docmd();
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cnt++;
|
cnt++;
|
||||||
ln = nextln(ln);
|
ln = nextln(ln);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
discard(); /* cover the case of not matching anything */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1509,12 +1575,12 @@ edit(void)
|
||||||
newcmd = 1;
|
newcmd = 1;
|
||||||
ocurln = curln;
|
ocurln = curln;
|
||||||
olastln = lastln;
|
olastln = lastln;
|
||||||
cmdline.siz = 0;
|
|
||||||
repidx = -1;
|
|
||||||
if (optprompt) {
|
if (optprompt) {
|
||||||
fputs(prompt, stdout);
|
fputs(prompt, stdout);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getinput();
|
||||||
getlst();
|
getlst();
|
||||||
chkglobal() ? doglobal() : docmd();
|
chkglobal() ? doglobal() : docmd();
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ main(int argc, char *argv[])
|
||||||
char *s = basename(argv[0]);
|
char *s = basename(argv[0]);
|
||||||
struct cmd *bp;
|
struct cmd *bp;
|
||||||
|
|
||||||
if(!strcmp(s,"sbase-box")) {
|
if (!strcmp(s, "sbase-box") && argc > 1) {
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
if (strcmp(argv[0], "-i") == 0) {
|
if (strcmp(argv[0], "-i") == 0) {
|
||||||
install(argv[1]);
|
install(argv[1]);
|
||||||
|
|
Loading…
Reference in New Issue