diff options
author | ache <ache@FreeBSD.org> | 1995-02-23 22:36:56 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-02-23 22:36:56 +0000 |
commit | e062767a522d941f0c5c2e0e4f60087cf9247105 (patch) | |
tree | c6725ce63fd4e727d857231f2cd03d2561d7be89 /gnu/lib/libdialog/help.c | |
parent | 7f1876afbb91cad4d594995573123bfa1ef83b2f (diff) | |
download | FreeBSD-src-e062767a522d941f0c5c2e0e4f60087cf9247105.zip FreeBSD-src-e062767a522d941f0c5c2e0e4f60087cf9247105.tar.gz |
Simplify notify()
Fix dupwin usage, now it really restore screen
Disable helpline while helpfile displayed
Fix helpfile borders
Fix mesgbox range computing
Diffstat (limited to 'gnu/lib/libdialog/help.c')
-rw-r--r-- | gnu/lib/libdialog/help.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/gnu/lib/libdialog/help.c b/gnu/lib/libdialog/help.c index eee04ca..fbc2e83 100644 --- a/gnu/lib/libdialog/help.c +++ b/gnu/lib/libdialog/help.c @@ -64,35 +64,45 @@ display_helpfile(void) struct stat sb; char msg[80], *buf; static int in_help = FALSE; + char *savehline = NULL; if (in_help) return; /* dont call help when you're in help */ if (_helpfile != NULL) { - w = dupwin(curscr); + if (_helpline != NULL) { + savehline = _helpline; + _helpline = NULL; + } + if ((w = dupwin(newscr)) == NULL) { + dialog_notify("No memory to dup previous screen\n"); + goto ret; + } if ((f = fopen(_helpfile, "r")) == NULL) { sprintf(msg, "Can't open helpfile : %s\n", _helpfile); dialog_notify(msg); - return; + goto ret; } if (fstat(fileno(f), &sb)) { sprintf(msg, "Can't stat helpfile : %s\n", _helpfile); dialog_notify(msg); - return; + goto ret; } if ((buf = (char *) malloc( sb.st_size )) == NULL) { sprintf(msg, "Could not malloc space for helpfile : %s\n", _helpfile); dialog_notify(msg); - return; + goto ret; } if (fread(buf, 1, sb.st_size, f) != sb.st_size) { sprintf(msg, "Could not read entire help file : %s", _helpfile); dialog_notify(msg); - return; + free(buf); + goto ret; } buf[sb.st_size] = 0; in_help = TRUE; dialog_mesgbox("Online help", buf, LINES-4, COLS-4); in_help = FALSE; + touchwin(w); wrefresh(w); delwin(w); free(buf); @@ -100,6 +110,10 @@ display_helpfile(void) /* do nothing */ } +ret: + if (savehline != NULL) + _helpline = savehline; + return; } /* display_helpfile() */ |