diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | dba.c | 7 | ||||
-rw-r--r-- | main.c | 52 | ||||
-rw-r--r-- | man.c | 3 | ||||
-rw-r--r-- | man.options.1 | 35 | ||||
-rw-r--r-- | mandoc.1 | 16 | ||||
-rw-r--r-- | mdoc.7 | 35 | ||||
-rw-r--r-- | roff_term.c | 7 | ||||
-rw-r--r-- | term_ps.c | 6 |
9 files changed, 87 insertions, 76 deletions
@@ -15,7 +15,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -VERSION = 1.14.6s20250727 +VERSION = 1.14.6s20250926 # === LIST OF FILES ==================================================== @@ -1,6 +1,6 @@ -/* $Id: dba.c,v 1.10 2017/02/17 14:43:54 schwarze Exp $ */ +/* $Id: dba.c,v 1.11 2025/09/24 13:13:30 schwarze Exp $ */ /* - * Copyright (c) 2016, 2017 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2016, 2017, 2025 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -318,7 +318,8 @@ compare_names(const void *vp1, const void *vp2) cp1 = *(const char * const *)vp1; cp2 = *(const char * const *)vp2; return (diff = *cp2 - *cp1) ? diff : - strcasecmp(cp1 + 1, cp2 + 1); + (diff = strcasecmp(cp1 + 1, cp2 + 1)) ? diff : + strcmp(cp1 + 1, cp2 + 1); } static int @@ -1,6 +1,6 @@ -/* $Id: main.c,v 1.361 2022/04/14 16:43:43 schwarze Exp $ */ +/* $Id: main.c,v 1.364 2025/09/24 21:30:20 schwarze Exp $ */ /* - * Copyright (c) 2010-2012, 2014-2021 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010-2012,2014-2021,2025 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org> * @@ -109,7 +109,7 @@ static void parse(struct mparse *, int, const char *, struct outstate *, struct manconf *); static void passthrough(int, int); static void process_onefile(struct mparse *, struct manpage *, - int, struct outstate *, struct manconf *); + struct outstate *, struct manconf *); static void run_pager(struct outstate *, char *); static pid_t spawn_pager(struct outstate *, char *); static void usage(enum argmode) __attribute__((__noreturn__)); @@ -144,7 +144,6 @@ main(int argc, char *argv[]) int options; /* Parser options. */ int show_usage; /* Invalid argument: give up. */ int prio, best_prio; - int startdir; int c; enum mandoc_os os_e; /* Check base system conventions. */ enum outmode outmode; /* According to command line. */ @@ -484,7 +483,7 @@ main(int argc, char *argv[]) if (resnsz == 0) (void)fs_search(&search, &conf.manpath, *argv, &resn, &resnsz); - if (resnsz == 0 && strchr(*argv, '/') == NULL) { + if (resnsz == 0) { if (search.arch != NULL && arch_valid(search.arch, OSENUM) == 0) warnx("Unknown architecture \"%s\".", @@ -499,20 +498,6 @@ main(int argc, char *argv[]) mandoc_msg_setrc(MANDOCLEVEL_BADARG); continue; } - if (resnsz == 0) { - if (access(*argv, R_OK) == -1) { - mandoc_msg_setinfilename(*argv); - mandoc_msg(MANDOCERR_BADARG_BAD, - 0, 0, "%s", strerror(errno)); - mandoc_msg_setinfilename(NULL); - continue; - } - resnsz = 1; - resn = mandoc_calloc(resnsz, sizeof(*res)); - resn->file = mandoc_strdup(*argv); - resn->ipath = SIZE_MAX; - resn->form = FORM_SRC; - } if (outmode != OUTMODE_ONE || resnsz == 1) { res = mandoc_reallocarray(res, ressz + resnsz, sizeof(*res)); @@ -529,7 +514,8 @@ main(int argc, char *argv[]) best_prio = 40; for (ib = i = 0; i < resnsz; i++) { - sec = resn[i].file; + sec = resn[i].file + + strlen(conf.manpath.paths[resn[i].ipath]); sec += strcspn(sec, "123456789"); if (sec[0] == '\0') continue; /* No section at all. */ @@ -617,23 +603,13 @@ main(int argc, char *argv[]) mchars_alloc(); mp = mparse_alloc(options, os_e, os_s); - /* - * Remember the original working directory, if possible. - * This will be needed if some names on the command line - * are page names and some are relative file names. - * Do not error out if the current directory is not - * readable: Maybe it won't be needed after all. - */ - startdir = open(".", O_RDONLY | O_DIRECTORY); for (i = 0; i < ressz; i++) { - process_onefile(mp, res + i, startdir, &outst, &conf); + if (i > 0) + mparse_reset(mp); + process_onefile(mp, res + i, &outst, &conf); if (outst.wstop && mandoc_msg_getrc() != MANDOCLEVEL_OK) break; } - if (startdir != -1) { - (void)fchdir(startdir); - close(startdir); - } if (conf.output.tag != NULL && conf.output.tag_found == 0) { mandoc_msg(MANDOCERR_TAG, 0, 0, "%s", conf.output.tag); conf.output.tag = NULL; @@ -879,7 +855,7 @@ fs_search(const struct mansearch *cfg, const struct manpaths *paths, } static void -process_onefile(struct mparse *mp, struct manpage *resp, int startdir, +process_onefile(struct mparse *mp, struct manpage *resp, struct outstate *outst, struct manconf *conf) { int fd; @@ -891,8 +867,6 @@ process_onefile(struct mparse *mp, struct manpage *resp, int startdir, */ if (resp->ipath != SIZE_MAX) (void)chdir(conf->manpath.paths[resp->ipath]); - else if (startdir != -1) - (void)fchdir(startdir); mandoc_msg_setinfilename(resp->file); if (resp->file != NULL) { @@ -952,18 +926,12 @@ parse(struct mparse *mp, int fd, const char *file, struct outstate *outst, struct manconf *conf) { static struct manpaths basepaths; - static int previous; struct roff_meta *meta; assert(fd >= 0); if (file == NULL) file = "<stdin>"; - if (previous) - mparse_reset(mp); - else - previous = 1; - mparse_readfd(mp, fd, file); if (fd != STDIN_FILENO) close(fd); @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.189 2022/08/16 23:01:09 schwarze Exp $ */ +/* $Id: man.c,v 1.190 2025/08/22 13:17:06 schwarze Exp $ */ /* * Copyright (c) 2013-2015,2017-2019,2022 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> @@ -134,6 +134,7 @@ man_ptext(struct roff_man *man, int line, char *buf, int offs) *ep = '\0'; return 1; } + mandoc_msg(MANDOCERR_FI_BLANK, line, i, NULL); roff_elem_alloc(man, line, offs, ROFF_sp); man->next = ROFF_NEXT_SIBLING; return 1; diff --git a/man.options.1 b/man.options.1 index be65ad98fddc..be101d4b5b62 100644 --- a/man.options.1 +++ b/man.options.1 @@ -1,4 +1,4 @@ -.\" $Id: man.options.1,v 1.8 2025/06/30 00:11:06 schwarze Exp $ +.\" $Id: man.options.1,v 1.9 2025/08/28 13:46:57 schwarze Exp $ .\" .\" Copyright (c) 2017, 2025 Ingo Schwarze <schwarze@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: June 30 2025 $ +.Dd $Mdocdate: August 28 2025 $ .Dt MAN.OPTIONS 1 .Os .Sh NAME @@ -39,9 +39,18 @@ .de At5 .At V Pq January 1983 \\$1 .. +.de At8 +.No Version 8 At Pq February 1985 \\$1 +.. .de Bx43 .Bx 4.3 Pq June 1986 \\$1 .. +.de At9 +.No Version 9 At Pq September 1986 \\$1 +.. +.de At10 +.No Version 10 At Pq October 1989 \\$1 +.. .\" option was present in groff-1.01 as contained in 4.3BSD-Net/2 .\" and no mention of it could be found in the ChangeLog, .\" so it's probably older than groff-0.4, where the log started @@ -49,7 +58,7 @@ .No probably before groff-0.4 Pq before July 14, 1990 \\$1 .. .de Eaton -.No Eaton Pq before July 7, 1993; 1990/91? \\$1 +.No Eaton Pq before July 7, 1993; 1990/91?\& \\$1 .. .\" man-1.5e was released on July 11, 1998. .de man15e @@ -399,6 +408,12 @@ do not feed out paper nor stop phototypesetter .br .Nm troff : .At7 +.Pp +.Bq superseded by Fl l +interpret arguments as file names +.br +.Nm man : +.At10 .It Fl G preprocess with .Xr grap 1 @@ -549,6 +564,7 @@ mode .br .Nm man : .Bx4 , +.At10 , .Eaton ; .No POSIX , Ox , Fx , Nx , No man-db , man-1.6 , illumos , Solaris 9-11 .br @@ -720,7 +736,9 @@ specify a page number for the first page output mode .br .Nm man : -.At7 +.At7 , +.At8 , +.At10 .Pp do not create the .Xr whatis 1 @@ -852,6 +870,12 @@ invoke the simultaneous input-output mode of the .rd request .Nm nroff , troff : .At7 .Pp +quick mode: prefer preformatted page if available +.br +.Nm man : +.At8 , +.At10 +.Pp issue no warnings .br .Nm manpath : @@ -1046,6 +1070,8 @@ output mode .Bx 2 Pq May 10, 1979 , .At3 , .At5 , +.At8 , +.At10 , .Eaton ; .Fx , No man-db , man-1.6 , illumos , Solaris 9-11 .br @@ -1162,6 +1188,7 @@ list pathnames .At7 , .At3 , .At5 , +.At8 , .Eaton ; .Ox , Fx , Nx , No man-db , man-1.6 .br @@ -1,4 +1,4 @@ -.\" $Id: mandoc.1,v 1.272 2025/07/09 13:46:05 schwarze Exp $ +.\" $Id: mandoc.1,v 1.273 2025/08/22 13:17:06 schwarze Exp $ .\" .\" Copyright (c) 2012, 2014-2023, 2025 Ingo Schwarze <schwarze@openbsd.org> .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 9 2025 $ +.Dd $Mdocdate: August 22 2025 $ .Dt MANDOC 1 .Os .Sh NAME @@ -1002,14 +1002,14 @@ macro that could be represented using or .Ic \&Dx . .It Sy "errnos out of order" -.Pq mdoc, Nx +.Pq mdoc , Nx The .Ic \&Er items in a .Ic \&Bl list are not in alphabetical order. .It Sy "duplicate errno" -.Pq mdoc, Nx +.Pq mdoc , Nx A .Ic \&Bl list contains two consecutive @@ -1150,7 +1150,7 @@ The argument is used as provided anyway. Consider checking whether the file name or the argument need a correction. .It Sy "missing date, using \(dq\(dq" -.Pq mdoc, man +.Pq mdoc , man The document was parsed as .Xr mdoc 7 and it has no @@ -1732,7 +1732,7 @@ or macro contains an opening or closing parenthesis; that's probably wrong, parentheses are added automatically. .It Sy "unknown library name" -.Pq mdoc, not on Ox +.Pq mdoc , not on Ox An .Ic \&Lb macro has an unknown name argument and will be rendered as @@ -1790,7 +1790,7 @@ The last character is mapped to the blank character. .Ss "Warnings related to plain text" .Bl -ohang .It Sy "blank line in fill mode, using .sp" -.Pq mdoc +.Pq mdoc , man The meaning of blank input lines is only well-defined in non-fill mode: In fill mode, line breaks of text input lines are not supposed to be significant. @@ -1800,6 +1800,8 @@ are formatted like requests. To request a paragraph break, use .Ic \&Pp +or +.Ic \&PP instead of a blank line. .It Sy "tab in filled text" .Pq mdoc , man @@ -1,4 +1,4 @@ -.\" $Id: mdoc.7,v 1.299 2025/06/13 16:18:28 schwarze Exp $ +.\" $Id: mdoc.7,v 1.300 2025/08/19 14:08:59 schwarze Exp $ .\" .\" Copyright (c) 2010-2021, 2024, 2025 Ingo Schwarze <schwarze@openbsd.org> .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: June 13 2025 $ +.Dd $Mdocdate: August 19 2025 $ .Dt MDOC 7 .Os .Sh NAME @@ -972,7 +972,7 @@ Unless the .Fl compact argument is specified, list entries are separated by vertical space. .Pp -A list must specify one of the following list types: +The following list types are commonly used: .Bl -tag -width 12n -offset indent .It Fl bullet No item heads can be specified, but a bullet will be printed at the head @@ -987,7 +987,14 @@ The .Fl width argument has no effect; instead, the string length of each argument specifies the width of one column. -If the first line of the body of a +The width specification for the last column does not affect formatting. +.Pp +For two-column lists, using +.Fl tag +often results in simpler code, identical terminal output, and better HTML +output, especially when the first column contains short identifiers. +.Pp +For compatibility with legacy documents, if the first line of the body of a .Fl column list is not an .Ic \&It @@ -1009,7 +1016,7 @@ Like except that item heads are not parsed for macro invocations. Most often used in the .Em DIAGNOSTICS -section with error constants in the item heads. +section with error messages in the item heads. .It Fl enum A numbered list. No item heads can be specified. @@ -1017,6 +1024,17 @@ Formatted like .Fl bullet , except that ordinal numbers are used in place of bullets, starting at 1. +.It Fl tag +Item bodies are indented according to the +.Fl width +argument. +When an item head fits inside the indentation, the item body follows +this head on the same output line. +Otherwise, the body starts on the output line following the head. +.El +.Pp +The following list types are rarely useful: +.Bl -tag -width 12n -offset indent .It Fl hang Like .Fl tag , @@ -1043,13 +1061,6 @@ Item bodies start on the line following item heads and are not indented. The .Fl width argument is ignored. -.It Fl tag -Item bodies are indented according to the -.Fl width -argument. -When an item head fits inside the indentation, the item body follows -this head on the same output line. -Otherwise, the body starts on the output line following the head. .El .Pp Lists may be nested within lists and displays. diff --git a/roff_term.c b/roff_term.c index 8f95aa920790..38321c830013 100644 --- a/roff_term.c +++ b/roff_term.c @@ -1,4 +1,4 @@ -/* $Id: roff_term.c,v 1.26 2025/07/16 14:33:08 schwarze Exp $ */ +/* $Id: roff_term.c,v 1.27 2025/08/21 15:38:51 schwarze Exp $ */ /* * Copyright (c) 2010, 2014, 2015, 2017-2021, 2025 * Ingo Schwarze <schwarze@openbsd.org> @@ -165,6 +165,7 @@ roff_term_pre_po(ROFF_TERM_ARGS) static int polast; /* Previously requested. */ static int po; /* Currently requested. */ static int pouse; /* Currently used. */ + int pomin; /* Minimum to be used. */ int pomax; /* Maximum to be used. */ int ponew; /* Newly requested. */ @@ -186,9 +187,9 @@ roff_term_pre_po(ROFF_TERM_ARGS) po = ponew; /* Truncate to the range [-offset, 60], remember, and apply it. */ + pomin = -p->tcol->offset; pomax = term_len(p, 60); - pouse = po >= pomax ? pomax : - po < -(int)p->tcol->offset ? -p->tcol->offset : po; + pouse = po > pomax ? pomax : po < pomin ? pomin : po; p->tcol->offset += pouse; } diff --git a/term_ps.c b/term_ps.c index 4c6368ca1d1f..91124152d55a 100644 --- a/term_ps.c +++ b/term_ps.c @@ -1,4 +1,4 @@ -/* $Id: term_ps.c,v 1.94 2025/07/18 15:47:18 schwarze Exp $ */ +/* $Id: term_ps.c,v 1.95 2025/09/26 12:17:12 schwarze Exp $ */ /* * Copyright (c) 2014-2017, 2020, 2025 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> @@ -1222,6 +1222,8 @@ ps_endline(struct termp *p) ps_plast(p); ps_pclose(p); + p->viscol = 0; + p->minbl = 0; /* * If we're in the margin, don't try to recalculate our current @@ -1235,8 +1237,6 @@ ps_endline(struct termp *p) /* Left-justify. */ p->ps->pscol = p->ps->left; - p->viscol = 0; - p->minbl = 0; /* If we haven't printed anything, return. */ |