added read/write error handling to ed
This commit is contained in:
parent
591c37b4b9
commit
acf6c4a6a4
|
@ -127,6 +127,7 @@ main(int argc, char *argv[])
|
||||||
char *p1, *p2;
|
char *p1, *p2;
|
||||||
|
|
||||||
Binit(&bcons, 0, OREAD);
|
Binit(&bcons, 0, OREAD);
|
||||||
|
Blethal(&bcons, nil);
|
||||||
notify(notifyf);
|
notify(notifyf);
|
||||||
ARGBEGIN {
|
ARGBEGIN {
|
||||||
case 'o':
|
case 'o':
|
||||||
|
@ -322,6 +323,7 @@ commands(void)
|
||||||
free(d);
|
free(d);
|
||||||
}
|
}
|
||||||
Binit(&iobuf, io, OREAD);
|
Binit(&iobuf, io, OREAD);
|
||||||
|
Blethal(&iobuf, nil);
|
||||||
setwide();
|
setwide();
|
||||||
squeeze(0);
|
squeeze(0);
|
||||||
c = zero != dol;
|
c = zero != dol;
|
||||||
|
@ -370,6 +372,7 @@ commands(void)
|
||||||
if((io = create(file, OWRITE, 0666)) < 0)
|
if((io = create(file, OWRITE, 0666)) < 0)
|
||||||
error(file);
|
error(file);
|
||||||
Binit(&iobuf, io, OWRITE);
|
Binit(&iobuf, io, OWRITE);
|
||||||
|
Blethal(&iobuf, nil);
|
||||||
wrapp = 0;
|
wrapp = 0;
|
||||||
if(dol > zero)
|
if(dol > zero)
|
||||||
putfile();
|
putfile();
|
||||||
|
@ -669,6 +672,7 @@ rescue(void)
|
||||||
io = create("ed.hup", OWRITE, 0666);
|
io = create("ed.hup", OWRITE, 0666);
|
||||||
if(io > 0){
|
if(io > 0){
|
||||||
Binit(&iobuf, io, OWRITE);
|
Binit(&iobuf, io, OWRITE);
|
||||||
|
Blethal(&iobuf, nil);
|
||||||
putfile();
|
putfile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue