Internal shuffling for debugging.
[rsc] --rw-rw-r-- M 320859 glenda sys 10758 Oct 27 10:36 sys/src/cmd/sam/cmd.c
/n/sourcesdump/2005/1027/plan9/sys/src/cmd/sam/cmd.c:3,9 -
/n/sourcesdump/2005/1028/plan9/sys/src/cmd/sam/cmd.c:3,9
static char linex[]="\n";
static char wordx[]=" \t\n";
- struct cmdtab cmdtab[]={
+ Cmdtab cmdtab[]={
/* cmdc text regexp addr defcmd defaddr count token fn */
'\n', 0, 0, 0, 0, aDot, 0, 0, nl_cmd,
'a', 1, 0, 0, 0, aDot, 0, 0, a_cmd,
/n/sourcesdump/2005/1027/plan9/sys/src/cmd/sam/cmd.c:108,122 -
/n/sourcesdump/2005/1028/plan9/sys/src/cmd/sam/cmd.c:108,133
int
inputline(void)
{
- int i, c;
+ int i, c, start;
- linep = line;
- i = 0;
+ /*
+ * Could set linep = line and i = 0 here and just
+ * error(Etoolong) below, but this way we keep
+ * old input buffer history around for a while.
+ * This is useful only for debugging.
+ */
+ i = linep - line;
do{
if((c = inputc())<=0)
return -1;
- if(i == (sizeof line)/RUNESIZE-1)
- error(Etoolong);
+ if(i == nelem(line)-1){
+ if(linep == line)
+ error(Etoolong);
+ start = linep - line;
+ runemove(line, linep, i-start);
+ i -= start;
+ linep = line;
+ }
}while((line[i++]=c) != '\n');
line[i] = 0;
return 1;
/n/sourcesdump/2005/1027/plan9/sys/src/cmd/sam/cmd.c:186,192 -
/n/sourcesdump/2005/1028/plan9/sys/src/cmd/sam/cmd.c:197,203
Posn p;
for(p=cmdpt; p<cmd->nc; p++){
- if(terminp >= &termline[BLOCKSIZE]){
+ if(terminp >= termline+nelem(termline)){
cmdpt = cmd->nc;
error(Etoolong);
}
/n/sourcesdump/2005/1027/plan9/sys/src/cmd/sam/cmd.c:389,395 -
/n/sourcesdump/2005/1028/plan9/sys/src/cmd/sam/cmd.c:400,406
parsecmd(int nest)
{
int i, c;
- struct cmdtab *ct;
+ Cmdtab *ct;
Cmd *cp, *ncp;
Cmd cmd;
[rsc] --rw-rw-r-- M 320859 glenda sys 1934 Oct 27 10:36 sys/src/cmd/sam/parse.h
/n/sourcesdump/2005/1027/plan9/sys/src/cmd/sam/parse.h:33,39 -
/n/sourcesdump/2005/1028/plan9/sys/src/cmd/sam/parse.h:33,41
#define ctext g.text
#define caddr g.addr
- extern struct cmdtab{
+ typedef struct Cmdtab Cmdtab;
+ struct Cmdtab
+ {
ushort cmdc; /* command character */
uchar text; /* takes a textual argument? */
uchar regexp; /* takes a regular expression? */
|