From 3bdf20c2d462cc80209c0710163c0b50644cde6d Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Wed, 22 Mar 1995 02:06:06 +0000 Subject: [PATCH] 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. --- gnu/lib/libdialog/textbox.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/gnu/lib/libdialog/textbox.c b/gnu/lib/libdialog/textbox.c index a9a3a28ec2c..a5fdedb9620 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 */