Compare commits

...

38 Commits

Author SHA1 Message Date
Alejandro Colomar 1cf69258ad execveat.2: Remove unused include
This complements commit e3eba861bd.

Since we don't need syscall(2) anymore, we don't need SYS_* definitions.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 05:06:23 +12:00
Michael Kerrisk e43e45b477 Makefile: Remove shebang line
On 5/10/21 7:13 PM, Alejandro Colomar (man-pages) wrote:
> Hi Michael,
>
> On 5/10/21 1:39 AM, Michael Kerrisk (man-pages) wrote:
>>> - Specify shebang
>>
>> Why? It's not quite obvious to me, and the commit message
>> should really explain...
>
> Hmmm.  I have some minor reasons to add it, but not a really good one.
>
> * Some editors don't recognize 'Makefile' as a special name, so the
> shebang helps detecting which language the file is using (e.g., for
> coloring).
>
> * I tend to subdivide a big Makefile into a small Makefile and many
> submakefiles stored in <./libexec/>.  Those obviously need different
> names, and given that the makefile extension is not very standard (I use
> .mk), having a shebang helps knowing what the file is.  After that, I
> also have it on the main Makefile for consistency.   But here we only
> have one Makefile, so it doesn apply very much.

I think I'll remove it. It is kind of idiosyncratic, leaves the
reader asking "why?".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 04:34:03 +12:00
Michael Kerrisk 80a45bed73 .gitignore: Tweaks to Alex's .gitignore
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 04:34:03 +12:00
Alejandro Colomar 0fbec630fd .gitignore: Add file
Ignore everything new by default.

This avoids having to update the .gitignore when we need to ignore
something new.  It also avoids accidents that may add an unwanted
temporary file.

Cc: Debian man-pages <manpages@packages.debian.org>
Cc: Dr. Tobias Quathamer <toddy@debian.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 04:34:03 +12:00
Alejandro Colomar 3bbc7a7554 fflush.3: SEE ALSO: Add fpurge(3)
fpurge(i_stream) does the same as fflush(i_stream), AFAIK.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 04:34:03 +12:00
Alejandro Colomar 1c55195743 open.2: Fix bug in linkat(2) call example
AT_EMPTY_PATH works with empty strings (""), but not with NULL
(or at least it's not obvious).

The relevant kernel code is the following:

linux$ sed -n 189,198p fs/namei.c
	result->refcnt = 1;
	/* The empty path is special. */
	if (unlikely(!len)) {
		if (empty)
			*empty = 1;
		if (!(flags & LOOKUP_EMPTY)) {
			putname(result);
			return ERR_PTR(-ENOENT);
		}
	}

Reported-by: Walter Harms <wharms@bfs.de>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 04:34:03 +12:00
Michael Kerrisk 3eb81f5117 basename.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:07:24 +12:00
Alejandro Colomar 58d7a46ccb bswap.3: bswap_*() are implemented using functions
See <bits/byteswap.h> in glibc.
These macros call functions of the form __bswap_N(),
which use uintN_t.

Even though it's true that they are macros,
it's transparent to the user.

The user will see their results casted to unsigned types
after the conversion due to the underlying functions,
so it's better to document these as the underlying functions,
specifying the types.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:07:02 +12:00
Alejandro Colomar 5175f162a3 pthread_attr_setschedparam.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in
pthread_attr_getschedparam(), pthread_attr_setschedparam().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_getschedparam
sysdeps/htl/pthread.h:102:
extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
				       struct sched_param *__restrict __param)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:294:
extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
				       struct sched_param *__restrict __param)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype pthread_attr_setschedparam
sysdeps/htl/pthread.h:107:
extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
				       const struct sched_param *__restrict
				       __param) __THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:299:
extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
				       const struct sched_param *__restrict
				       __param) __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 161c0ae7a6 pthread_attr_setinheritsched.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in
pthread_attr_getinheritsched().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_getinheritsched
sysdeps/htl/pthread.h:90:
extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict __attr,
					 int *__restrict __inheritsched)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:313:
extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict
					 __attr, int *__restrict __inherit)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 099b33fbff epoll_wait.2: Move subsection to NOTES from BUGS
'C library/kernel differences' was added to BUGS incorrectly.
Fix it

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 2ce1caae32 xdr.3: SYNOPSIS: Fix prototype types
Use the same types glibc uses, and add a missing 'const'.

.../glibc$ grep_glibc_prototype xdr_union
sunrpc/rpc/xdr.h:315:
extern bool_t xdr_union (XDR *__xdrs, enum_t *__dscmp, char *__unp,
			 const struct xdr_discrim *__choices,
			 xdrproc_t __dfault) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 3126777905 rpc.3: SYNOPSIS: Fix prototypes (misc.)
Fix the types for the following functions:

authunix_create(),
callrpc(),
clnt_create(),
clnt_pcreateerror(),
clnt_perror(),
clnt_spcreateerror(),
clnt_sperror(),
pmap_set(),
svc_register(),
svcerr_progvers().

.../glibc$ grep_glibc_prototype authunix_create
sunrpc/rpc/auth.h:158:
extern AUTH *authunix_create (char *__machname, __uid_t __uid, __gid_t __gid,
			      int __len, __gid_t *__aup_gids);
.../glibc$ grep_glibc_prototype callrpc
sunrpc/rpc/clnt.h:359:
extern int callrpc (const char *__host, const u_long __prognum,
		    const u_long __versnum, const u_long __procnum,
		    const xdrproc_t __inproc, const char *__in,
		    const xdrproc_t __outproc, char *__out) __THROW;
.../glibc$ grep_glibc_prototype clnt_create
sunrpc/rpc/clnt.h:291:
extern CLIENT *clnt_create (const char *__host, const u_long __prog,
			    const u_long __vers, const char *__prot)
     __THROW;
.../glibc$ grep_glibc_prototype clnt_pcreateerror
sunrpc/rpc/clnt.h:368:
extern void clnt_pcreateerror (const char *__msg);	/* stderr */
.../glibc$ grep_glibc_prototype clnt_perror
sunrpc/rpc/clnt.h:379:
extern void clnt_perror (CLIENT *__clnt, const char *__msg);
.../glibc$ grep_glibc_prototype clnt_spcreateerror
sunrpc/rpc/clnt.h:369:
extern char *clnt_spcreateerror(const char *__msg) __THROW;	/* string */
.../glibc$ grep_glibc_prototype clnt_sperror
sunrpc/rpc/clnt.h:381:
extern char *clnt_sperror (CLIENT *__clnt, const char *__msg) __THROW;
.../glibc$ grep_glibc_prototype pmap_set
sunrpc/rpc/pmap_clnt.h:69:
extern bool_t pmap_set (const u_long __program, const u_long __vers,
			int __protocol, u_short __port) __THROW;
.../glibc$ grep_glibc_prototype svc_register
sunrpc/rpc/svc.h:188:
extern bool_t svc_register (SVCXPRT *__xprt, rpcprog_t __prog,
			    rpcvers_t __vers, __dispatch_fn_t __dispatch,
			    rpcprot_t __protocol) __THROW;
.../glibc$ grep_glibc_prototype svcerr_progvers
sunrpc/rpc/svc.h:253:
extern void	svcerr_progvers (SVCXPRT *__xprt, rpcvers_t __low_vers,
				 rpcvers_t __high_vers) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 54dde4f8e3 cpow.3: Use 'complex' after the type consistently
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 7dfd227b7e system_data_types.7: tfix
Those pages didn't exist.  Fix the section number.
I noticed the typo thanks to the HTML pages on man7.org.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 881f51062f Makefile: Fix bug when running in parallel
Prerequisites can run in parallel.  This wouldn't make any sense
when uninstalling and installing again.

For that, use consecutive commands, which run one after the other
even with multiple cores.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar e4b890cdb8 Makefile: Use standard features (IMPORTANT: default prefix changed)
IMPORTANT for distributions:
This changes prefix to be '/usr/local' as is expected by default,
instead of the old '/usr' value.

- Use standard variables:
    - prefix should be '/usr/local'
    - mandir (instead of MANDIR)
    - htmldir (instead of HTDIR)
    - ...
    see <https://www.gnu.org/software/make/manual/html_node/Directory-Variables.html>

- Use standard targets:
    - html (build html files; don't install them)
    - install-html (instead of html)
    - installdirs (instead of 'mkdir -p'/'install -d' inside other targets)
    - ...
    see <https://www.gnu.org/software/make/manual/html_node/Standard-Targets.html#Standard-Targets>

- Use .PHONY

- ?= is not needed.  User input overrides any assignment.  Use =

- Use standard command variables, instead of directly calling commands.
    - $(INSTALL_DATA) (instead of install -m 644)
    - $(INSTALL_DIR) (instead of install -d -m 755 or mkdir -p)
    see <https://www.gnu.org/software/make/manual/html_node/Command-Variables.html#Command-Variables>

- Specify SHELL = /bin/bash

- Specify shebang

- Allow variable html extension (or no extension at all)

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:36 +12:00
Alejandro Colomar 5f9596780c Makefile: html: Simplify target
mkdir -p doesn't fail if the directory already exists.
Remove redundant checks.

Use .html as default HTDIR.
Remove checks for undefined HTDIR.

Show what the target does, as with other targets (remove '@').

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:35:11 +12:00
Alejandro Colomar 34afcb0dad scripts/bash_aliases: srcfix
I clarified the code about two things:

- Checking how many arguments are being passed.
    Here, some functions didn't reject extra arguments when they
    weren't being used.  Fix that.
    I also changed the code to use $#, which is more explicit.
    And use arithmetic expressions, which better indicate that
    we're dealing with numbers.

- Remove unneeded options from sort.
    Reported-by: Stefan Puiu <stefan.puiu@gmail.com>
    After Stefan asked about why am I using 'sort -V',
    I noticed that I really don't need '-V', and it may confuse
    people trying to understand the script, so even though I
    slightly prefer the output of 'sort -V', in this case, it's
    better to use the simpler 'sort' (yet I need 'sort', to
    maintain consistency in the results (find is quite random)).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:33:51 +12:00
Alejandro Colomar 94bf02f41b scripts/bash_aliases: Fix error messages
Fix the error messages to clearly show that both dirs and manual
pages are accepted, and that more than one argument is accepted.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:33:27 +12:00
Alejandro Colomar a3ccd456f3 scripts/bash_aliases: man_section(): Accept multiple sections
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:33:10 +12:00
Alejandro Colomar 3a42b0815e scripts/bash_aliases: Add man_lsvar(), similar to man_lsfunc() but lists variables
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:32:42 +12:00
Alejandro Colomar 5ae99ccb42 scripts/bash_aliases: Make man_lsfunc() more robust; Add sed_rm_ccomments().
This patch makes man_lsfunc() search for the function prototypes,
instead of relying on the current manual page formatting,
which might change in the future, and break this function.

It also simplifies the code, by reusing man_section().

Create a new function sed_rm_ccomments(), which is needed by
man_lsfunc(), and may also be useful in other cases.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:32:17 +12:00
Alejandro Colomar b08daf3c0c scripts/bash_aliases: man_gitstaged(): Script around a porcelain git command
The output of 'git status' is not stable.

The more stable 'git status --porcelain' is more complex,
and scripting around it would be more complex.

However, 'git diff --staged --name-only' produces
the output that we were lookiong for.

Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:27:19 +12:00
Alejandro Colomar f493a71fe1 scripts/bash_aliases, scripts/modified_pages.sh: Move scripts/modified_pages.sh to a function man_gitstaged()
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:27:12 +12:00
Alejandro Colomar bacf09154d dladdr.3: SYNOPSIS: Add missing 'const'
Glibc uses 'const' for the 1st parameter of these functions.
Fix the prototypes.

......

.../glibc$ grep_glibc_prototype dladdr
dlfcn/dlfcn.h:98:
extern int dladdr (const void *__address, Dl_info *__info)
     __THROW __nonnull ((2));
.../glibc$ grep_glibc_prototype dladdr1
dlfcn/dlfcn.h:102:
extern int dladdr1 (const void *__address, Dl_info *__info,
		    void **__extra_info, int __flags) __THROW __nonnull ((2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:20:21 +12:00
Alejandro Colomar 4cc91169d0 sched_get_priority_max.2, open_memstream.3: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:19:29 +12:00
Alejandro Colomar c20d4d883c pthread_getattr_default_np.3: SYNOPSIS: Add missing 'const'
glibc uses 'const' in pthread_setattr_default_np().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_setattr_default_np
sysdeps/nptl/pthread.h:406:
extern int pthread_setattr_default_np (const pthread_attr_t *__attr)
     __THROW __nonnull ((1));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:18:44 +12:00
Alejandro Colomar f750ab384c pthread_mutexattr_setrobust.3: SYNOPSIS: Remove incorrect 'const'
Neither POSIX or glibc use 'const' in
pthread_mutexattr_setrobust().
Remove it.

.../glibc$ grep_glibc_prototype pthread_mutexattr_setrobust
sysdeps/htl/pthread.h:355:
extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
					int __robustness)
     __THROW __nonnull ((1));
sysdeps/nptl/pthread.h:888:
extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
					int __robustness)
     __THROW __nonnull ((1));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:17:53 +12:00
Alejandro Colomar fe10d82f6e clone.2: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:17:11 +12:00
Alejandro Colomar 2faa0fbddf tzset.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:15:15 +12:00
Alejandro Colomar a2d963a81c strsignal.3: SYNOPSIS: Add missing 'const'
glibc uses 'const' in sigdescr_np(), sigabbrev_np().
Let's use it here too.

.../glibc$ grep_glibc_prototype sigdescr_np
string/string.h:469:
extern const char *sigdescr_np (int __sig) __THROW;
.../glibc$ grep_glibc_prototype sigabbrev_np
string/string.h:466:
extern const char *sigabbrev_np (int __sig) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:15:15 +12:00
Alejandro Colomar ea2807f8af strsignal.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:14:12 +12:00
Alejandro Colomar 6e7a60c016 __ppc_get_timebase.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:13:33 +12:00
Alejandro Colomar 27931e4a6b perror.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:11:21 +12:00
Alejandro Colomar d62694cc6e on_exit.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:10:59 +12:00
Alejandro Colomar 8632f524ef getutmp.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:10:35 +12:00
Alejandro Colomar 27398f1b64 malloc_usable_size.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:10:06 +12:00
29 changed files with 263 additions and 165 deletions

13
.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
# Ignore everything new by default
/*
# Ignore everything in man?/ that doesn't follow conventions (e.g., tmp files)
!/man?/
/man?/*
!/man?/*.[1-8]
# These files change name in each release
!/man-pages*.Announce
!/man-pages*.lsm
!/scripts/

112
Makefile
View File

@ -1,35 +1,101 @@
DESTDIR=
prefix?=/usr
MANDIR=$(prefix)/share/man
# Do not print "Entering directory ..."
MAKEFLAGS += --no-print-directory
all: remove install
htmlbuilddir = $(CURDIR)/.html
HTOPTS =
uninstall remove:
for i in man?/*; do \
rm -f $(MANDIR)/"$$i" $(MANDIR)/"$$i".*; \
done
DESTDIR =
prefix = /usr/local
datarootdir = $(prefix)/share
docdir = $(datarootdir)/doc
mandir = $(datarootdir)/man
htmldir = $(docdir)
htmldir_ = $(htmldir)/man
htmlext = .html
INSTALL = install
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -m 755 -d
.PHONY: all
all:
$(MAKE) uninstall;
$(MAKE) install;
# Use with
# make HTDIR=/some/dir HTOPTS=whatever html
# make HTOPTS=whatever html
# The sed removes the lines "Content-type: text/html\n\n"
html:
@if [ x$(HTDIR) = x ]; then echo "You must set HTDIR."; else \
for i in man?; do \
[ -d $(HTDIR)/"$$i" ] || mkdir -p $(HTDIR)/"$$i"; \
find "$$i/" -type f | while read f; do \
man2html $(HTOPTS) $$f | \
sed -e '1,2d' > $(HTDIR)/"$$i"/`basename $$f`.html; \
done; \
done; fi
.PHONY: html
html: | builddirs-html
find man?/ -type f \
|while read f; do \
man2html $(HTOPTS) "$$f" \
|sed -e '1,2d' \
>"$(htmlbuilddir)/$${f}$(htmlext)" \
|| exit $$?; \
done;
install:
for i in man?; do \
install -d -m 755 $(DESTDIR)$(MANDIR)/"$$i" || exit $$?; \
install -m 644 "$$i"/* $(DESTDIR)$(MANDIR)/"$$i" || exit $$?; \
done
.PHONY: builddirs-html
builddirs-html:
find man?/ -type d \
|while read d; do \
$(INSTALL_DIR) "$(htmlbuilddir)/$$d" || exit $$?; \
done;
.PHONY: install-html
install-html: | installdirs-html
cd $(htmlbuilddir) && \
find man?/ -type f \
|while read f; do \
$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(htmldir_)/$$f" || exit $$?; \
done;
.PHONY: installdirs-html
installdirs-html:
find man?/ -type d \
|while read d; do \
$(INSTALL_DIR) "$(DESTDIR)$(htmldir_)/$$d" || exit $$?; \
done;
.PHONY: install
install: | installdirs
find man?/ -type f \
|while read f; do \
$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(mandir)/$$f" || exit $$?; \
done;
.PHONY: installdirs
installdirs:
find man?/ -type d \
|while read d; do \
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/$$d" || exit $$?; \
done;
.PHONY: uninstall remove
uninstall remove:
find man?/ -type f \
|while read f; do \
rm -f "$(DESTDIR)$(mandir)/$$f" || exit $$?; \
rm -f "$(DESTDIR)$(mandir)/$$f".* || exit $$?; \
done;
.PHONY: uninstall-html
uninstall-html:
find man?/ -type f \
|while read f; do \
rm -f "$(DESTDIR)$(htmldir_)/$$f".* || exit $$?; \
done;
.PHONY: clean
clean:
find man?/ -type f \
|while read f; do \
rm -f "$(htmlbuilddir)/$$f".* || exit $$?; \
done;
# Check if groff reports warnings (may be words of sentences not displayed)
# from https://lintian.debian.org/tags/groff-message.html
.PHONY: check-groff-warnings
check-groff-warnings:
GROFF_LOG="$$(mktemp --tmpdir manpages-checksXXXX)" || exit $$?; \
for i in man?/*.[1-9]; \

View File

@ -969,7 +969,7 @@ mask must also include
.B CLONE_VM
if
.B CLONE_SIGHAND
is specified
is specified.
.TP
.BR CLONE_STOPPED " (since Linux 2.6.0)"
.\" Precisely: Linux 2.6.0-test2

View File

@ -285,18 +285,6 @@ instance whose interest list is currently empty
or removed from the interest in another thread).
The call will block until some file descriptor is later added to the
interest list (in another thread) and that file descriptor becomes ready.
.SH BUGS
In kernels before 2.6.37, a
.I timeout
value larger than approximately
.I LONG_MAX / HZ
milliseconds is treated as \-1 (i.e., infinity).
Thus, for example, on a system where
.I sizeof(long)
is 4 and the kernel
.I HZ
value is 1000,
this means that timeouts greater than 35.79 minutes are treated as infinity.
.SS C library/kernel differences
The raw
.BR epoll_pwait ()
@ -312,6 +300,18 @@ The glibc
wrapper function specifies this argument as a fixed value
(equal to
.IR sizeof(sigset_t) ).
.SH BUGS
In kernels before 2.6.37, a
.I timeout
value larger than approximately
.I LONG_MAX / HZ
milliseconds is treated as \-1 (i.e., infinity).
Thus, for example, on a system where
.I sizeof(long)
is 4 and the kernel
.I HZ
value is 1000,
this means that timeouts greater than 35.79 minutes are treated as infinity.
.SH SEE ALSO
.BR epoll_create (2),
.BR epoll_ctl (2),

View File

@ -29,7 +29,6 @@ execveat \- execute program relative to a directory file descriptor
.SH SYNOPSIS
.nf
.BR "#include <linux/fcntl.h>" " /* Definition of " AT_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int execveat(int " dirfd ", const char *" pathname ,

View File

@ -824,7 +824,7 @@ fd = open("/path/to/dir", O_TMPFILE | O_RDWR,
/* File I/O on \(aqfd\(aq... */
linkat(fd, NULL, AT_FDCWD, "/path/for/file", AT_EMPTY_PATH);
linkat(fd, "", AT_FDCWD, "/path/for/file", AT_EMPTY_PATH);
/* If the caller doesn\(aqt have the CAP_DAC_READ_SEARCH
capability (needed to use AT_EMPTY_PATH with linkat(2)),

View File

@ -80,7 +80,7 @@ thus it is a good idea for portable applications to use a virtual
priority range and map it to the interval given by
.BR sched_get_priority_max ()
and
.BR sched_get_priority_min
.BR sched_get_priority_min ()
POSIX.1 requires
.\" POSIX.1-2001, POSIX.1-2008 (XBD 2.8.4)
a spread of at least 32 between the maximum and the minimum values for

View File

@ -31,7 +31,7 @@ __ppc_get_timebase, __ppc_get_timebase_freq \- get the current value
.nf
.B #include <sys/platform/ppc.h>
.PP
.BI "uint64_t __ppc_get_timebase(void)"
.BI "uint64_t __ppc_get_timebase(void);"
.BI "uint64_t __ppc_get_timebase_freq(void);"
.fi
.SH DESCRIPTION

View File

@ -36,8 +36,8 @@ basename, dirname \- parse pathname components
.fi
.SH DESCRIPTION
Warning: there are two different functions
.BR basename ()
- see below.
.BR basename ();
see below.
.PP
The functions
.BR dirname ()

View File

@ -29,19 +29,19 @@ bswap_16, bswap_32, bswap_64 \- reverse order of bytes
.nf
.B #include <byteswap.h>
.PP
.BI bswap_16( x );
.BI bswap_32( x );
.BI bswap_64( x );
.BI "uint16_t bswap_16(uint16_t " x );
.BI "uint32_t bswap_32(uint32_t " x );
.BI "uint64_t bswap_64(uint64_t " x );
.fi
.SH DESCRIPTION
These macros return a value in which the order of the bytes
These functions return a value in which the order of the bytes
in their 2-, 4-, or 8-byte arguments is reversed.
.SH RETURN VALUE
These macros return the value of their argument with the bytes reversed.
These functions return the value of their argument with the bytes reversed.
.SH ERRORS
These macros always succeed.
These functions always succeed.
.SH CONFORMING TO
These macros are GNU extensions.
These functions are GNU extensions.
.SH EXAMPLES
The program below swaps the bytes of the 8-byte integer supplied as
its command-line argument.

View File

@ -11,10 +11,10 @@ cpow, cpowf, cpowl \- complex power function
.nf
.B #include <complex.h>
.PP
.BI "double complex cpow(double complex " x ", complex double " z ");"
.BI "float complex cpowf(float complex " x ", complex float " z ");"
.BI "double complex cpow(double complex " x ", double complex " z );
.BI "float complex cpowf(float complex " x ", float complex " z );
.BI "long double complex cpowl(long double complex " x ,
.BI " complex long double " z ");"
.BI " long double complex " z );
.PP
Link with \fI\-lm\fP.
.fi

View File

@ -31,9 +31,9 @@ dladdr, dladdr1 \- translate address to symbolic information
.B #define _GNU_SOURCE
.B #include <dlfcn.h>
.PP
.BI "int dladdr(void *" addr ", Dl_info *" info );
.BI "int dladdr1(void *" addr ", Dl_info *" info ", void **" \
extra_info ", int " flags );
.BI "int dladdr(const void *" addr ", Dl_info *" info );
.BI "int dladdr1(const void *" addr ", Dl_info *" info ", void **" extra_info ,
.BI " int " flags );
.PP
Link with \fI\-ldl\fP.
.fi

View File

@ -133,6 +133,7 @@ or
.BR sync (2),
.BR write (2),
.BR fclose (3),
.BR fpurge (3),
.BR fileno (3),
.BR fopen (3),
.BR setbuf (3),

View File

@ -31,8 +31,8 @@ getutmp, getutmpx \- copy utmp structure to utmpx, and vice versa
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <utmpx.h>
.PP
.BI " void getutmp(const struct utmpx *" ux ", struct utmp *" u );
.BI " void getutmpx(const struct utmp *" u ", struct utmpx *" ux );
.BI "void getutmp(const struct utmpx *" ux ", struct utmp *" u );
.BI "void getutmpx(const struct utmp *" u ", struct utmpx *" ux );
.fi
.SH DESCRIPTION
The

View File

@ -29,7 +29,7 @@ malloc_usable_size \- obtain size of block of memory allocated from heap
.nf
.B #include <malloc.h>
.PP
.BI "size_t malloc_usable_size (void *" ptr );
.BI "size_t malloc_usable_size(void *" ptr );
.fi
.SH DESCRIPTION
The

View File

@ -35,7 +35,7 @@ on_exit \- register a function to be called at normal process termination
.nf
.B #include <stdlib.h>
.PP
.BI "int on_exit(void (*" function ")(int , void *), void *" arg );
.BI "int on_exit(void (*" function ")(int, void *), void *" arg );
.fi
.PP
.RS -4

View File

@ -110,7 +110,7 @@ l l l.
Interface Attribute Value
T{
.BR open_memstream (),
.BR open_wmemstream
.BR open_wmemstream ()
T} Thread safety MT-Safe
.TE
.hy

View File

@ -39,7 +39,7 @@ perror \- print a system error message
.PP
.B #include <errno.h>
.PP
.BI "const char * const " sys_errlist [];
.BI "const char *const " sys_errlist [];
.BI "int " sys_nerr ;
.BI "int " errno "; \fR/* Not really declared this way; see errno(3) */"
.fi

View File

@ -33,8 +33,8 @@ inherit-scheduler attribute in thread attributes object
.PP
.BI "int pthread_attr_setinheritsched(pthread_attr_t *" attr ,
.BI " int " inheritsched );
.BI "int pthread_attr_getinheritsched(const pthread_attr_t *" attr ,
.BI " int *" inheritsched );
.BI "int pthread_attr_getinheritsched(const pthread_attr_t *restrict " attr ,
.BI " int *restrict " inheritsched );
.PP
Compile and link with \fI\-pthread\fP.
.fi

View File

@ -31,10 +31,10 @@ scheduling parameter attributes in thread attributes object
.nf
.B #include <pthread.h>
.PP
.BI "int pthread_attr_setschedparam(pthread_attr_t *" attr ,
.BI " const struct sched_param *" param );
.BI "int pthread_attr_getschedparam(const pthread_attr_t *" attr ,
.BI " struct sched_param *" param );
.BI "int pthread_attr_setschedparam(pthread_attr_t *restrict " attr ,
.BI " const struct sched_param *restrict " param );
.BI "int pthread_attr_getschedparam(const pthread_attr_t *restrict " attr ,
.BI " struct sched_param *restrict " param );
.PP
Compile and link with \fI\-pthread\fP.
.fi

View File

@ -32,7 +32,7 @@ get or set default thread-creation attributes
.B #include <pthread.h>
.PP
.BI "int pthread_getattr_default_np(pthread_attr_t *" attr );
.BI "int pthread_setattr_default_np(pthread_attr_t *" attr );
.BI "int pthread_setattr_default_np(const pthread_attr_t *" attr );
.PP
Compile and link with \fI\-pthread\fP.
.fi

View File

@ -33,7 +33,7 @@ pthread_mutexattr_getrobust, pthread_mutexattr_setrobust
.PP
.BI "int pthread_mutexattr_getrobust(const pthread_mutexattr_t *" attr ,
.BI " int *" robustness ");"
.BI "int pthread_mutexattr_setrobust(const pthread_mutexattr_t *" attr ,
.BI "int pthread_mutexattr_setrobust(pthread_mutexattr_t *" attr ,
.BI " int " robustness ");"
.fi
.PP

View File

@ -70,8 +70,8 @@ information with each remote procedure call.
This is the default authentication used by RPC.
.PP
.nf
.BI "AUTH *authunix_create(char *" host ", int " uid ", int " gid ,
.BI " int " len ", int *" aup_gids );
.BI "AUTH *authunix_create(char *" host ", uid_t " uid ", gid_t " gid ,
.BI " int " len ", gid_t *" aup_gids );
.fi
.IP
Create and return an RPC authentication handle that contains
@ -100,7 +100,7 @@ with the appropriate parameters.
.nf
.BI "int callrpc(char *" host ", unsigned long " prognum ,
.BI " unsigned long " versnum ", unsigned long " procnum ,
.BI " xdrproc_t " inproc ", char *" in ,
.BI " xdrproc_t " inproc ", const char *" in ,
.BI " xdrproc_t " outproc ", char *" out );
.fi
.IP
@ -216,8 +216,8 @@ If the RPC library opened the associated socket, it will close it also.
Otherwise, the socket remains open.
.PP
.nf
.BI "CLIENT *clnt_create(char *" host ", unsigned long " prog ,
.BI " unsigned long " vers ", char *" proto );
.BI "CLIENT *clnt_create(const char *" host ", unsigned long " prog ,
.BI " unsigned long " vers ", const char *" proto );
.fi
.IP
Generic client creation routine.
@ -305,7 +305,7 @@ handle to the structure at address
.IR errp .
.PP
.nf
.BI "void clnt_pcreateerror(char *" s );
.BI "void clnt_pcreateerror(const char *" s );
.fi
.IP
Print a message to standard error indicating why a client RPC
@ -332,7 +332,7 @@ Used after
.BR callrpc ().
.PP
.nf
.BI "clnt_perror(CLIENT *" clnt ", char *" s );
.BI "clnt_perror(CLIENT *" clnt ", const char *" s );
.fi
.IP
Print a message to standard error indicating why an RPC call failed;
@ -345,7 +345,7 @@ Used after
.BR clnt_call ().
.PP
.nf
.BI "char *clnt_spcreateerror(char *" s );
.BI "char *clnt_spcreateerror(const char *" s );
.fi
.IP
Like
@ -383,7 +383,7 @@ returns pointer to static data, but the
result will not get overwritten on each call.
.PP
.nf
.BI "char *clnt_sperror(CLIENT *" rpch ", char *" s );
.BI "char *clnt_sperror(CLIENT *" rpch ", const char *" s );
.fi
.IP
Like
@ -601,7 +601,7 @@ See also
.PP
.nf
.BI "bool_t pmap_set(unsigned long " prognum ", unsigned long " versnum ,
.BI " unsigned int " protocol ", unsigned short " port );
.BI " int " protocol ", unsigned short " port );
.fi
.IP
A user interface to the
@ -781,7 +781,7 @@ This interface is obsoleted by
.nf
.BI "bool_t svc_register(SVCXPRT *" xprt ", unsigned long " prognum ,
.BI " unsigned long " versnum ,
.BI " void (*" dispatch ")(svc_req *, SVCXPRT *),"
.BI " void (*" dispatch ")(struct svc_req *, SVCXPRT *),"
.BI " unsigned long " protocol );
.fi
.IP
@ -894,7 +894,8 @@ Called when the desired program is not registered with the RPC package.
Service implementors usually do not need this routine.
.PP
.nf
.BI "void svcerr_progvers(SVCXPRT *" xprt );
.BI "void svcerr_progvers(SVCXPRT *" xprt ", unsigned long " low_vers ,
.BI " unsigned long " high_vers );
.fi
.IP
Called when the desired version of a program is not registered

View File

@ -36,10 +36,10 @@ strsignal, sigdescr_np, sigdescr_np, sys_siglist \- return string describing sig
.B #include <string.h>
.PP
.BI "char *strsignal(int " sig );
.BI "char *sigdescr_np(int " sig );
.BI "char *sigabbrev_np(int " sig );
.BI "const char *sigdescr_np(int " sig );
.BI "const char *sigabbrev_np(int " sig );
.PP
.BI "extern const char * const " sys_siglist [];
.BI "extern const char *const " sys_siglist [];
.fi
.PP
.RS -4

View File

@ -37,7 +37,7 @@ tzset, tzname, timezone, daylight \- initialize time conversion information
.nf
.B #include <time.h>
.PP
.B void tzset (void);
.B void tzset(void);
.PP
.BI "extern char *" tzname [2];
.BI "extern long " timezone ;

View File

@ -460,8 +460,8 @@ integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
.PP
.nf
.BI "bool_t xdr_union(XDR *" xdrs ", int *" dscmp ", char *" unp ,
.BI " struct xdr_discrim *" choices ,
.BI "bool_t xdr_union(XDR *" xdrs ", enum_t *" dscmp ", char *" unp ,
.BI " const struct xdr_discrim *" choices ,
.BI " xdrproc_t " defaultarm "); /* may equal NULL */"
.fi
.IP

View File

@ -374,7 +374,7 @@ POSIX.1-2001 and later.
.BR getegid (2),
.BR getgroups (2),
.BR getresgid (2),
.BR getgrnam (2),
.BR getgrnam (3),
.BR credentials (7)
.RE
.\"------------------------------------- id_t -------------------------/
@ -675,7 +675,7 @@ C11 and later; POSIX.1-2001 and later.
.IR "See also" :
.BR setlocale (3),
.BR localeconv (3),
.BR charsets (5),
.BR charsets (7),
.BR locale (7)
.RE
.\"------------------------------------- ldiv_t -----------------------/
@ -1534,7 +1534,7 @@ POSIX.1-2001 and later.
.BR getuid (2),
.BR geteuid (2),
.BR getresuid (2),
.BR getpwnam (2),
.BR getpwnam (3),
.BR credentials (7)
.RE
.\"------------------------------------- uintmax_t --------------------/

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
########################################################################
#
# (C) Copyright 2021, Alejandro Colomar
# (C) Copyright 2020, 2021, Alejandro Colomar
# These functions are free software; you can redistribute them and/or
# modify them under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2.
@ -20,6 +20,21 @@
EX_OK=0;
EX_USAGE=64;
########################################################################
# C
# sed_rm_ccomments() removes C comments.
# It can't handle multiple comments in a sinlge line correctly,
# nor mixed or embedded //... and /*...*/ comments.
# Use as a filter (see man_lsfunc() in this file).
function sed_rm_ccomments()
{
sed 's%/\*.*\*/%%' \
|sed -E '\%/\*%,\%\*/%{\%(\*/|/\*)%!d; s%/\*.*%%; s%.*\*/%%;}' \
|sed 's%//.*%%';
}
########################################################################
# Linux kernel
@ -30,20 +45,20 @@ EX_USAGE=64;
function grep_syscall()
{
if ! [ -v 1 ]; then
if (($# != 1)); then
>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
return ${EX_USAGE};
fi
find * -type f \
|grep '\.c$' \
|sort -V \
|sort \
|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?\)" \
|sed -E 's/^[^:]+:[0-9]+:/&\n/';
find * -type f \
|grep '\.[ch]$' \
|sort -V \
|sort \
|xargs pcregrep -Mn "(?s)^asmlinkage\s+[\w\s]+\**sys_${1}\s*\(.*?\)" \
|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}
@ -55,14 +70,14 @@ function grep_syscall()
function grep_syscall_def()
{
if ! [ -v 1 ]; then
if (($# != 1)); then
>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
return ${EX_USAGE};
fi
find * -type f \
|grep '\.c$' \
|sort -V \
|sort \
|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?^}" \
|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}
@ -70,26 +85,35 @@ function grep_syscall_def()
########################################################################
# Linux man-pages
# man_section() prints a specific manual page section (DESCRIPTION, SYNOPSIS,
# man_section() prints specific manual page sections (DESCRIPTION, SYNOPSIS,
# ...) of all manual pages in a directory (or in a single manual page file).
# Usage example: .../man-pages$ man_section man2 SYNOPSIS;
# Usage example: .../man-pages$ man_section man2 SYNOPSIS 'CONFORMING TO';
function man_section()
{
if ! [ -v 2 ]; then
>&2 echo "Usage: ${FUNCNAME[0]} <dir> <section>";
if (($# < 2)); then
>&2 echo "Usage: ${FUNCNAME[0]} <dir> <section>...";
return ${EX_USAGE};
fi
find "${1}" -type f \
|xargs grep -l "\.SH ${2}" \
|sort -V \
local page="$1";
shift;
local sect="$@";
find "${page}" -type f \
|xargs wc -l \
|grep -v -e '\b1 ' -e '\btotal\b' \
|awk '{ print $2 }' \
|sort \
|while read -r manpage; do
<${manpage} \
sed -n \
-e '/^\.TH/,/^\.SH/{/^\.SH/!p}' \
-e "/^\.SH ${2}/p" \
-e "/^\.SH ${2}/,/^\.SH/{/^\.SH/!p}" \
cat \
<(<${manpage} sed -n '/^\.TH/,/^\.SH/{/^\.SH/!p}') \
<(for s in ${sect}; do
<${manpage} \
sed -n \
-e "/^\.SH ${s}/p" \
-e "/^\.SH ${s}/,/^\.SH/{/^\.SH/!p}"; \
done;) \
|man -P cat -l - 2>/dev/null;
done;
}
@ -101,30 +125,45 @@ function man_section()
function man_lsfunc()
{
if ! [ -v 1 ]; then
>&2 echo "Usage: ${FUNCNAME[0]} <dir>";
if (($# < 1)); then
>&2 echo "Usage: ${FUNCNAME[0]} <manpage|manNdir>...";
return ${EX_USAGE};
fi
find "${@}" -type f \
|xargs grep -l "\.SH SYNOPSIS" \
|sort -V \
|while read -r manpage; do
<${manpage} \
sed -n \
-e '/^\.TH/,/^\.SH/{/^\.SH/!p}' \
-e "/^\.SH SYNOPSIS/p" \
-e "/^\.SH SYNOPSIS/,/^\.SH/{/^\.SH/!p}" \
|sed \
-e '/Feature/,$d' \
-e '/{/,/}/d' \
|man -P cat -l - 2>/dev/null;
for arg in "$@"; do
man_section "${arg}" 'SYNOPSIS';
done \
|sed -n "/^SYNOPSIS/,/^\w/p" \
|grep '^ \w' \
|grep -v ':' \
|sed 's/^[^(]* \**\(\w*\)(.*/\1/' \
|grep '^\w' \
|sed_rm_ccomments \
|pcregrep -Mn '(?s)^ [\w ]+ \**\w+\([\w\s(,)[\]*]+?(...)?\s*\); *$' \
|grep '^[0-9]' \
|sed -E 's/^[^(]+ \**(\w+)\(.*/\1/' \
|uniq;
}
# man_lsvar() prints the name of all C variables declared in the SYNOPSIS
# of all manual pages in a directory (or in a single manual page file).
# Each name is printed in a separate line
# Usage example: .../man-pages$ man_lsvar man3;
function man_lsvar()
{
if (($# < 1)); then
>&2 echo "Usage: ${FUNCNAME[0]} <manpage|manNdir>...";
return ${EX_USAGE};
fi
for arg in "$@"; do
man_section "${arg}" 'SYNOPSIS';
done \
|sed_rm_ccomments \
|pcregrep -Mv '(?s)^ [\w ]+ \**\w+\([\w\s(,)[\]*]+?(...)?\s*\); *$' \
|pcregrep -Mn \
-e '(?s)^ +extern [\w ]+ \**\(\*+[\w ]+\)\([\w\s(,)[\]*]+?\s*\); *$' \
-e '^ +extern [\w ]+ \**[\w ]+; *$' \
|grep '^[0-9]' \
|grep -v 'typedef' \
|sed -E 's/^[0-9]+: +extern [^(]+ \**\(\*+(\w* )?(\w+)\)\(.*/\2/' \
|sed 's/^[0-9]\+: \+extern .* \**\(\w\+\); */\1/' \
|uniq;
}
@ -133,7 +172,7 @@ function man_lsfunc()
function pdfman()
{
if ! [ -v 1 ]; then
if (($# != 1)); then
>&2 echo "Usage: ${FUNCNAME[0]} <man-page.n>";
return ${EX_USAGE};
fi;
@ -147,6 +186,19 @@ function pdfman()
xdg-open ${tmp};
}
# man_gitstaged prints a list of all files with changes staged for commit
# (basename only if the files are within <man?/>), separated by ", ".
# Usage example: .../man-pages$ git commit -m "$(man_gitstaged): msg";
function man_gitstaged()
{
git diff --staged --name-only \
|sed "s/$/, /" \
|sed "s%man[1-9]/%%" \
|tr -d '\n' \
|sed "s/, $//"
}
########################################################################
# Glibc
@ -157,14 +209,14 @@ function pdfman()
function grep_glibc_prototype()
{
if ! [ -v 1 ]; then
if (($# != 1)); then
>&2 echo "Usage: ${FUNCNAME[0]} <func>";
return ${EX_USAGE};
fi
find * -type f \
|grep '\.h$' \
|sort -V \
|sort \
|xargs pcregrep -Mn \
"(?s)^[\w[][\w\s(,)[:\]]+\s+\**${1}\s*\([\w\s(,)[\]*]+?(...)?\)[\w\s(,)[:\]]*;" \
|sed -E 's/^[^:]+:[0-9]+:/&\n/';

View File

@ -1,34 +0,0 @@
#!/bin/bash
## SPDX-License-Identifier: GPL-2.0-only
########################################################################
##
## (C) Copyright 2020, Alejandro Colomar
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; version 2.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details
## (http://www.gnu.org/licenses/gpl-2.0.html).
##
########################################################################
##
## The output of this script is a
## list of all files with changes staged for commit
## (basename only if the files are within "man?/"),
## separated by ", ".
## Usage:
## git commit -m "$(./scripts/modified_pages.sh): Short message here"
##
git status \
|sed "/Changes not staged for commit:/q" \
|grep -E "^\s*(modified|deleted|new file):" \
|sed "s/^.*:\s*/, /" \
|sed "s%man[1-9]/%%" \
|tr -d '\n' \
|sed "s/^, //"