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

The return value of regcom() is now checked for errors. If a regexp can't be compiled, show an error message instead of segfaulting. (fixes Debian bug #222650)
git-svn-id: svn://svn.debian.org/svn/pinfo/pinfo/trunk@21 ea4b0d59-4df7-0310-a9f9-bf8cbe41ce66
Author: bas
Author date (UTC): 2005-07-25 16:52
Committer name: bas
Committer date (UTC): 2005-07-25 16:52
Parent(s): 1a437cf8829a6fc7847a881ecd3471b22a2591bc
Signing key:
Tree: efd2cf3f53090b48aeb425dd546a337cb42aa9a5
File Lines added Lines deleted
src/mainfunction.c 14 1
src/manual.c 12 1
src/utils.c 4 2
src/utils.h 1 1
File src/mainfunction.c changed (mode: 100644) (index 60a46d4..2b82e8b)
... ... work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos)
546 546 curs_set(0); curs_set(0);
547 547 noecho(); noecho();
548 548 attrset(normal); attrset(normal);
549 pinfo_re_comp(token); /* compile the read token */
549 /* compile the read token */
550 if (pinfo_re_comp(token) != 0)
551 {
552 /* print error message */
553 attrset(bottomline);
554 mymvhline(maxy - 1, 0, ' ', maxx);
555 move(maxy - 1, 0);
556 printw(_("Invalid regular expression;"));
557 printw(" ");
558 printw(_("Press any key to continue..."));
559 getch();
560 goto skip_search;
561
562 }
550 563 /* scan for the token in the following lines. */ /* scan for the token in the following lines. */
551 564 for (i = pos + 1; i < Lines; i++) for (i = pos + 1; i < Lines; i++)
552 565 { {
File src/manual.c changed (mode: 100644) (index 56c92ab..f9962aa)
... ... manualwork()
1120 1120 #endif #endif
1121 1121 attrset(normal); attrset(normal);
1122 1122 /* compile regexp expression */ /* compile regexp expression */
1123 pinfo_re_comp(token);
1123 if (pinfo_re_comp(token) != 0)
1124 {
1125 /* print error message */
1126 attrset(bottomline);
1127 mymvhline(maxy - 1, 0, ' ', maxx);
1128 move(maxy - 1, 0);
1129 printw(_("Invalid regular expression;"));
1130 printw(" ");
1131 printw(_("Press any key to continue..."));
1132 getch();
1133 goto skip_search;
1134 }
1124 1135 /* and search for it in all subsequential lines */ /* and search for it in all subsequential lines */
1125 1136 for (i = manualpos + 1; i < ManualLines - 1; i++) for (i = manualpos + 1; i < ManualLines - 1; i++)
1126 1137 { {
File src/utils.c changed (mode: 100644) (index 690336f..59bd05d)
... ... waitforgetch()
353 353 select(1, &rdfs, NULL, NULL, NULL); select(1, &rdfs, NULL, NULL, NULL);
354 354 } }
355 355
356 void
356 /* returns 0 on success, 1 on error */
357 int
357 358 pinfo_re_comp(char *name) pinfo_re_comp(char *name)
358 359 { {
359 360 #ifdef ___DONT_USE_REGEXP_SEARCH___ #ifdef ___DONT_USE_REGEXP_SEARCH___
 
... ... pinfo_re_comp(char *name)
363 364 pinfo_re_pattern = 0; pinfo_re_pattern = 0;
364 365 } }
365 366 pinfo_re_pattern = strdup(name); pinfo_re_pattern = strdup(name);
367 return 0;
366 368 #else #else
367 369 if (pinfo_re_offset == -1) if (pinfo_re_offset == -1)
368 370 { {
 
... ... pinfo_re_comp(char *name)
376 378 { {
377 379 regfree(&h_regexp[pinfo_re_offset]); regfree(&h_regexp[pinfo_re_offset]);
378 380 } }
379 regcomp(&h_regexp[pinfo_re_offset], name, REG_ICASE);
381 return regcomp(&h_regexp[pinfo_re_offset], name, REG_ICASE);
380 382 #endif #endif
381 383 } }
382 384
File src/utils.h changed (mode: 100644) (index 5294cde..8e4c674)
... ... extern char *pinfo_re_pattern;
13 13 #endif #endif
14 14
15 15 /* wrappers for re_comp and re_exec */ /* wrappers for re_comp and re_exec */
16 void pinfo_re_comp (char *name);
16 int pinfo_re_comp (char *name);
17 17 int pinfo_re_exec (char *name); int pinfo_re_exec (char *name);
18 18
19 19 /* user defined getch, capable of handling ALT keybindings */ /* user defined getch, capable of handling ALT keybindings */
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