xaizek / pinfo (License: GPLv2 only) (since 2018-12-07)
Console-based info and manual pages reader, which adds interactive navigation to man pages.
Commit bd7c5936a080e747adb741e7de29637cbd717acd

Fix getch() handling after suspend/resume. Thanks to Scott McDermott for the patch.
git-svn-id: svn://svn.debian.org/svn/pinfo/pinfo/trunk@309 ea4b0d59-4df7-0310-a9f9-bf8cbe41ce66
Author: bas
Author date (UTC): 2010-09-19 11:36
Committer name: bas
Committer date (UTC): 2010-09-19 11:36
Parent(s): 7d6e4a065d4ef69264a50ff11ab5c9095a5efd2b
Signing key:
Tree: 32e9577017e89c691d5ee3490d2aa329e6d83def
File Lines added Lines deleted
src/manual.c 1 1
src/signal_handler.c 25 0
src/utils.c 6 1
File src/manual.c changed (mode: 100644) (index d7e9173..51866cb)
... ... manualwork()
967 967 key = pinfo_getch(); key = pinfo_getch();
968 968 } }
969 969 /************************ keyboard handling **********************************/ /************************ keyboard handling **********************************/
970 if (key != 0)
970 if (key > 0)
971 971 { {
972 972 if ((key == keys.print_1) || if ((key == keys.print_1) ||
973 973 (key == keys.print_2)) (key == keys.print_2))
File src/signal_handler.c changed (mode: 100644) (index 5c1b7f4..39c6165)
... ... handle_window_resize(int signum)
43 43 signal(SIGWINCH, handle_window_resize); signal(SIGWINCH, handle_window_resize);
44 44 } }
45 45
46 void
47 handle_suspend(int signum)
48 {
49 if (!isendwin()) {
50 curs_set(1);
51 endwin();
52 }
53 fprintf(stderr, "\n");
54 signal(SIGTSTP, handle_suspend);
55 kill(0, SIGSTOP);
56 }
57
58 void
59 handle_resume(int signum)
60 {
61 if (isendwin()) {
62 refresh();
63 curs_set(0);
64 }
65 ungetch(keys.refresh_1);
66 signal(SIGCONT, handle_resume);
67 }
68
46 69 void void
47 70 signal_handler() signal_handler()
48 71 { {
 
... ... signal_handler()
52 75 signal(SIGTERM, handle_crash); /* handle soft kill */ signal(SIGTERM, handle_crash); /* handle soft kill */
53 76 signal(SIGSEGV, handle_crash); /* handle seg. fault */ signal(SIGSEGV, handle_crash); /* handle seg. fault */
54 77 signal(SIGHUP, handle_crash); /* handle hup signal */ signal(SIGHUP, handle_crash); /* handle hup signal */
78 signal(SIGTSTP, handle_suspend);/* handle terminal suspend */
79 signal(SIGCONT, handle_resume); /* handle back from suspend */
55 80 #ifdef SIGWINCH #ifdef SIGWINCH
56 81 signal(SIGWINCH, handle_window_resize); signal(SIGWINCH, handle_window_resize);
57 82 #endif #endif
File src/utils.c changed (mode: 100644) (index 1801b7a..8da99a4)
... ... pinfo_getch()
376 376 void void
377 377 waitforgetch() waitforgetch()
378 378 { {
379 int ret;
380
379 381 fd_set rdfs; fd_set rdfs;
380 382 FD_ZERO(&rdfs); FD_ZERO(&rdfs);
381 383 FD_SET(0, &rdfs); FD_SET(0, &rdfs);
382 select(1, &rdfs, NULL, NULL, NULL);
384
385 /* we might get interrupted by e.g. SIGTSTP/SIGCONT */
386 do ret = select(1, &rdfs, NULL, NULL, NULL);
387 while (ret == -1 && errno == EINTR);
383 388 } }
384 389
385 390 /* returns 0 on success, 1 on error */ /* returns 0 on success, 1 on error */
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/pinfo

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/pinfo

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master