diff options
author | A. Wilcox <awilcox@wilcox-tech.com> | 2020-06-15 21:01:43 +0000 |
---|---|---|
committer | A. Wilcox <awilcox@wilcox-tech.com> | 2020-06-15 21:01:43 +0000 |
commit | 00232199464eaa13cd475988b17886a7635e8758 (patch) | |
tree | 07022c77daeabfcd5cb9756075265db3e2f204c5 /system/mandoc/less.patch | |
parent | 5e30a49b7a4cd903d446302f3a7f4ac685b53f2d (diff) | |
parent | abe028b0d7927e92ab1dda0920a70955ef839be4 (diff) | |
download | packages-00232199464eaa13cd475988b17886a7635e8758.tar.gz packages-00232199464eaa13cd475988b17886a7635e8758.tar.bz2 packages-00232199464eaa13cd475988b17886a7635e8758.tar.xz packages-00232199464eaa13cd475988b17886a7635e8758.zip |
Merge branch 'new/mandoc' into 'master'
Switch from man-db to mandoc
See merge request adelie/packages!458
Diffstat (limited to 'system/mandoc/less.patch')
-rw-r--r-- | system/mandoc/less.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/system/mandoc/less.patch b/system/mandoc/less.patch new file mode 100644 index 000000000..19d567365 --- /dev/null +++ b/system/mandoc/less.patch @@ -0,0 +1,58 @@ +Default to using less(1) instead of more(1) if MANPAGER and PAGER are +unset, and also set a pretty prompt and smart case searching like man-db +does if less is used as a pager. + +The name of the manpage is not available in the scope of the patched +function - maybe add it at some point. + +--- mandoc-1.14.5/main.c 2019-03-10 04:56:43.000000000 -0500 ++++ mandoc-1.14.5/main.c 2020-06-05 01:59:10.640524340 -0500 +@@ -1170,8 +1170,9 @@ spawn_pager(struct tag_files *tag_files) + pager = getenv("MANPAGER"); + if (pager == NULL || *pager == '\0') + pager = getenv("PAGER"); +- if (pager == NULL || *pager == '\0') +- pager = "more -s"; ++ if (pager == NULL || *pager == '\0') { ++ pager = "less"; ++ } + cp = mandoc_strdup(pager); + + /* +@@ -1195,10 +1196,24 @@ spawn_pager(struct tag_files *tag_files) + /* For less(1), use the tag file. */ + + use_ofn = 1; +-#if HAVE_LESS_T + if ((cmdlen = strlen(argv[0])) >= 4) { + cp = argv[0] + cmdlen - 4; + if (strcmp(cp, "less") == 0) { ++ /* ++ * Set a few options like man-db does. ++ * -i: smart case search ++ * -mPm: set prompt to following string terminated by $ ++ */ ++ argv[argc++] = "-imPm" \ ++ " Manual page" \ ++ /* ++ * print " (END)" if EOF, else % in file followed by % sign. ++ * ?X if X:else not X. ++ */ ++ "?e (END):?pB %pB\\%.. " \ ++ "(press h for help or q to quit)" \ ++ "$"; ++#if HAVE_LESS_T + argv[argc++] = mandoc_strdup("-T"); + argv[argc++] = tag_files->tfn; + if (tag_files->tagname != NULL) { +@@ -1206,9 +1221,9 @@ spawn_pager(struct tag_files *tag_files) + argv[argc++] = tag_files->tagname; + use_ofn = 0; + } ++#endif + } + } +-#endif + if (use_ofn) + argv[argc++] = tag_files->ofn; + argv[argc] = NULL; |