aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--safetitle.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/safetitle.c b/safetitle.c
index e5adac3..bf73e2c 100644
--- a/safetitle.c
+++ b/safetitle.c
@@ -70,11 +70,9 @@ int
main(int argc, char *argv[])
{
char *ap, *buf;
- int r, screen, ttyfd;
+ int screen, ttyfd;
struct termios term, restore;
- r = 1;
-
/* parse arguments */
if(argc==2)
ap = argv[1];
@@ -115,10 +113,11 @@ main(int argc, char *argv[])
else dprintf(ttyfd, "\033]2;%s\007", ap);
}
- r = 0;
+ tcsetattr(ttyfd, TCSANOW, &restore);
+ return 0;
end:
tcsetattr(ttyfd, TCSANOW, &restore);
- return r;
+ return 1;
usage:
fprintf(stderr, "usage: %s [-d] title\n", argv[0]);
return 1;