ESIZE = 256, /* max size of reg exp */
GBSIZE = 256, /* max size of global command */
MAXSUB = 9, /* max number of sub reg exp */
- ESCFLG = 0xFFFF, /* escape Rune - user defined code */
+ ESCFLG = Runemax, /* escape Rune - user defined code */
EOF = -1,
};
int peekc;
int pflag;
int rescuing;
-Rune rhsbuf[LBSIZE/2];
+Rune rhsbuf[LBSIZE/sizeof(Rune)];
char savedfile[FNSIZE];
jmp_buf savej;
int subnewa;
char *p1, *p2;
Binit(&bcons, 0, OREAD);
+ Blethal(&bcons, nil);
notify(notifyf);
ARGBEGIN {
case 'o':
globp = L"r";
}
zero = malloc((nlall+5)*sizeof(int*));
- tfname = mktemp("/tmp/eXXXXX");
+ tfname = mktemp(strdup("/tmp/eXXXXX"));
init();
setjmp(savej);
commands();
free(d);
}
Binit(&iobuf, io, OREAD);
+ Blethal(&iobuf, nil);
setwide();
squeeze(0);
c = zero != dol;
if(c == 0)
continue;
*p++ = c;
- if(p >= &linebuf[LBSIZE-2])
+ if(p >= &linebuf[LBSIZE-sizeof(Rune)])
error(Q);
}
}
lp = linebuf;
bp = getblock(tl, OREAD);
nl = nleft;
- tl &= ~((BLKSIZE/2) - 1);
+ tl &= ~((BLKSIZE/sizeof(Rune)) - 1);
while(*lp++ = *bp++) {
nl -= sizeof(Rune);
if(nl == 0) {
- bp = getblock(tl += BLKSIZE/2, OREAD);
+ bp = getblock(tl += BLKSIZE/sizeof(Rune), OREAD);
nl = nleft;
}
}
tl = tline;
bp = getblock(tl, OWRITE);
nl = nleft;
- tl &= ~((BLKSIZE/2)-1);
+ tl &= ~((BLKSIZE/sizeof(Rune))-1);
while(*bp = *lp++) {
if(*bp++ == '\n') {
bp[-1] = 0;
}
nl -= sizeof(Rune);
if(nl == 0) {
- tl += BLKSIZE/2;
+ tl += BLKSIZE/sizeof(Rune);
bp = getblock(tl, OWRITE);
nl = nleft;
}
static uchar ibuff[BLKSIZE];
static uchar obuff[BLKSIZE];
- bno = atl / (BLKSIZE/2);
- off = (atl<<1) & (BLKSIZE-1) & ~03;
+ bno = atl / (BLKSIZE/sizeof(Rune));
+ off = (atl*sizeof(Rune)) & (BLKSIZE-1) & ~03;
if(bno >= NBLK) {
lastc = '\n';
error(T);
for(a1=addr1; a1<=addr2; a1++) {
lp = getline(*a1);
while(*gp = *lp++)
- if(gp++ >= &genbuf[LBSIZE-2])
+ if(gp++ >= &genbuf[LBSIZE-sizeof(Rune)])
error(Q);
}
lp = linebuf;
if(c == '\\') {
c = getchr();
*p++ = ESCFLG;
- if(p >= &rhsbuf[LBSIZE/2])
+ if(p >= &rhsbuf[nelem(rhsbuf)])
error(Q);
} else
if(c == '\n' && (!globp || !globp[0])) {
if(c == seof)
break;
*p++ = c;
- if(p >= &rhsbuf[LBSIZE/2])
+ if(p >= &rhsbuf[nelem(rhsbuf)])
error(Q);
}
*p = 0;