diff options
author | jkh <jkh@FreeBSD.org> | 1995-03-22 02:06:06 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1995-03-22 02:06:06 +0000 |
commit | 689f0fbcddf0d3b6159dfeddfec34fd24d8a8d0a (patch) | |
tree | 7c89cdfd380e036827ff6511e18e43a72fc7d4c7 /gnu/lib | |
parent | ac5103f248881543ae32fd72bf8cfae5a0b91abc (diff) | |
download | FreeBSD-src-689f0fbcddf0d3b6159dfeddfec34fd24d8a8d0a.zip FreeBSD-src-689f0fbcddf0d3b6159dfeddfec34fd24d8a8d0a.tar.gz |
This just exited on most errors, some of which were legitimate and
I don't *want* to cause my application to be exited! Some of the fprintfs()
should probably be calls to some dialog error menu popup anyway.
Diffstat (limited to 'gnu/lib')
-rw-r--r-- | gnu/lib/libdialog/textbox.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/gnu/lib/libdialog/textbox.c b/gnu/lib/libdialog/textbox.c index a9a3a28..a5fdedb 100644 --- a/gnu/lib/libdialog/textbox.c +++ b/gnu/lib/libdialog/textbox.c @@ -49,31 +49,27 @@ int dialog_textbox(unsigned char *title, unsigned char *file, int height, int wi WINDOW *dialog, *text; if (height < 0 || width < 0) { - endwin(); fprintf(stderr, "\nAutosizing is impossible in dialog_textbox().\n"); - exit(-1); + return(-1); } search_term[0] = '\0'; /* no search term entered yet */ /* Open input file for reading */ if ((fd = open(file, O_RDONLY)) == -1) { - endwin(); fprintf(stderr, "\nCan't open input file <%s>in dialog_textbox().\n", file); - exit(-1); + return(-1); } /* Get file size. Actually, 'file_size' is the real file size - 1, since it's only the last byte offset from the beginning */ if ((file_size = lseek(fd, 0, SEEK_END)) == -1) { - endwin(); fprintf(stderr, "\nError getting file size in dialog_textbox().\n"); - exit(-1); + return(-1); } /* Restore file pointer to beginning of file after getting file size */ if (lseek(fd, 0, SEEK_SET) == -1) { - endwin(); fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); - exit(-1); + return(-1); } /* Allocate space for read buffer */ if ((buf = malloc(BUF_SIZE+1)) == NULL) { @@ -82,9 +78,8 @@ int dialog_textbox(unsigned char *title, unsigned char *file, int height, int wi exit(-1); } if ((bytes_read = read(fd, buf, BUF_SIZE)) == -1) { - endwin(); fprintf(stderr, "\nError reading file in dialog_textbox().\n"); - exit(-1); + return(-1); } buf[bytes_read] = '\0'; /* mark end of valid data */ page = buf; /* page is pointer to start of page to be displayed */ |