X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=std.c;h=5c12fbd6774a47c53401cb5f71ec17bf4aa15847;hb=746931a3d4114f9bd35a43307fd48bfa64ff0d8b;hp=5b430b8111e525833f4c080aff7a992257f40099;hpb=b3902ca1782515ee8b9cd38af10e51bc3ba2fc98;p=st.git diff --git a/std.c b/std.c index 5b430b8..5c12fbd 100644 --- a/std.c +++ b/std.c @@ -264,24 +264,18 @@ ungetch(int c) { int main(int argc, char *argv[]) { fd_set rfds; - int r; - if(argc == 2 && !strcmp("-v", argv[1])) { - fprintf(stderr, "std-"VERSION", © 2008 Matthias-Christian Ott\n"); - exit(EXIT_SUCCESS); - } - else if(argc == 1) { - fprintf(stderr, "usage: st [-v]\n"); - exit(EXIT_FAILURE); - } + if(argc == 2 && !strcmp("-v", argv[1])) + errx(EXIT_SUCCESS, "std-"VERSION", © 2008 Matthias-Christian Ott"); + else if(argc == 1) + errx(EXIT_FAILURE, "usage: st [-v]"); getpty(); shell(); FD_ZERO(&rfds); FD_SET(STDIN_FILENO, &rfds); FD_SET(ptm, &rfds); for(;;) { - r = select(ptm + 1, &rfds, NULL, NULL, NULL); - if(r == -1) + if(select(ptm + 1, &rfds, NULL, NULL, NULL) == -1) err(EXIT_FAILURE, "cannot select"); if(FD_ISSET(ptm, &rfds)) { do {