~sircmpwn/scdoc

Fix logical error in comparison with ULONG_MAX

The expression `epoch > ULONG_MAX` will always return false because
`epoch` is of type `unsigned long long`.
Makefile: drop -static
Emit \(ti and \(ha instead of ~ and ^

Groff since 1.23 maps '^' and '~' by default to U+02C6 and U+02DC
respectively.

The suggestion in groff_man_style(7) is to use \(ti and \(ha when the
latin variants are desired.

Links: https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00001.html
e760004f — Nico Wagner 10 months ago
Makefile: remove unnecessary path separator

This commit removes an unnecessary path separator between $(DESTDIR) and
$(BINDIR).

Signed-off-by: Nico Wagner <code@nicowagner.me>
Update version to 1.11.3
README.md: mention system packages
man: add section about SOURCE_DATE_EPOCH

scdoc supports SOURCE_DATE_EPOCH but it's not documented anywhere.
fix formatting of escaped backticks

Currently, an escaped backtick (\`) is translated to \\` which gets
rendered as "Left Single Quotation Mark" (‘) (for a UTF-8 locale).

This commit translates \` to \` which results in an actual backtick in
the rendered man page.
Emit '\e' instead of '\\'

I noticed that the rc shell's docs are messed up when using
man-db, but fine with mandoc. '\e' is the standard way to emit a
backslash, and the way that makes man-db not cry.
afeda241 — Eli Schwartz 1 year, 10 months ago
get rid of some unused includes

In main.c, unistd.h is a fairly big stick to use just to get stdint
types, so downgrade that header.
d562d7ef — Eli Schwartz 1 year, 10 months ago
remove useless re-declarations of standard functions

Historically, scdoc has used a project-local string.h, which overrode
and masked <string.h> and caused issues.

For example, strstr and strerror were impossible to obtain definitions
for. Instead of fixing the clashing names, the definitions were locally
copied into main.c

In commit 309ff4672b7f5cba9bca1ce8657f767b51f32220 this was fixed
properly (by renaming string.h to str.h) as part of adding printf usage
to the file as well. But the old hacks were never cleaned up.
1923fb61 — Dimitry Andric 2 years ago
Fix clang 15 -Wstrict-prototypes warnings

As of https://github.com/llvm/llvm-project/commit/11da1b53d8c, clang 15
has started warning about functions which take no arguments, but are
declared or defined using "()" instead of "(void)". See also [1].

At first this was even an error by default, but before clang 15 was
released, it was again downgraded to a warning. Since scdoc builds
with both "-std=c99 -pedantic" and "-Wall -Wextra -Werror", this leads
to two compile errors:

    include/str.h:10:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    struct str *str_create();
                          ^
                           void
    src/string.c:15:23: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    struct str *str_create() {
                          ^
                           void

To fix this, use "(void)" for both the declaration and definition of the
str_create function.

[1] https://discourse.llvm.org/t/rfc-enabling-wstrict-prototypes-by-default-in-c/60521
simplify list output

For lists, plain old indented paragraphs are the perfect tool.  To not
have vertical space between list items, we use .PD 0.

Should the many needless .PP be removed, will the .PD 0 have to be moved
after the first list item, such that that introduces vertical space
after the last paragraph.
scdoc(1), scdoc(5): follow conventions more closely

The man page title must be all caps.

Always traditionally and usually today, man page references using -man
set the name in italic type:

	See
	.IR man (1).
use .PP for paragraph breaks

.P is an extension not in v7 -man.  This makes the man pages work with
v7 -man.
scdoc.5: fix formatting in the preamble

In a manpage, bold indicates literal text which should be entered
verbatim by the user.  That makes no sense for the preamble: the
user should change "name" to the name of their manpage.
scdoc.5: fix capitalization of subsection headers

In most manpages, section headers (.SH) are set in all caps while
subsection headers (.SS) are simply capitalized.  For example, on my
system:

    $ zgrep -lE '^\.SS [A-Z][a-z ]+$' /usr/share/man/man1/*.1.gz | wc -l
    154
    $ zgrep -lE '^\.SS [A-Z ]+$' /usr/share/man/man1/*.1.gz | wc -l
    31

(Also, from my perspective, the less SCREAMING CASE the better.  It's
fine when the text is outdented by 8 spaces (.SH), but becomes more
irritating when it's outdented by 4.)
Update version to 1.11.2
Disallows differing row lengths in table

scdoc will now fail if the rows in a table don't all have the same
length. A test has also been added to check this behavior, and scdoc(5)
has been updated to clarify the behavior.

Signed-off-by: Sebastian <sebastian@sebsite.pw>
Check for and abort on failed memory allocations

This commit adds checks for memory allocation failures (i.e. malloc or
calloc returns NULL), and cleanly exits the program in such a scenario.
This removes several null-deference bugs.

Signed-off-by: Sebastian <sebastian@sebsite.pw>
Next