commit a5de9125f6dd591b8800c771755ae71a418330f4
parent eb46f82c0e2e5f410e96b02e3fde0662ee69ea02
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 17 Mar 2026 09:39:38 +0100
doc: Add man page for scc-ranlib
Diffstat:
2 files changed, 75 insertions(+), 2 deletions(-)
diff --git a/doc/man1/scc-ranlib.1 b/doc/man1/scc-ranlib.1
@@ -0,0 +1,73 @@
+.TH RANLIB 1 scc\-VERSION
+.SH NAME
+scc-ranlib \- generate index to archive
+.SH SYNOPSIS
+.B scc-ranlib
+.RB [ \-t ]
+.I archive ...
+.SH DESCRIPTION
+.B scc-ranlib
+generates a symbol index for each
+.I archive
+and adds it as the first member of the archive.
+The index maps each exported symbol defined in an object file member
+to the offset of that member within the archive.
+This index allows the linker to quickly locate the object files needed
+to resolve external references without scanning the entire archive.
+.PP
+If an archive already contains a symbol index, it is replaced.
+The index member is named
+.B /
+for archives of ELF or COFF object files or
+.B __.SYMDEF
+for archives of other supported formats.
+.SH OPTIONS
+.TP
+.B \-t
+Accepted for compatibility with other implementations of
+.BR scc-ranlib (1)
+but has no effect.
+.SH OPERANDS
+.TP
+.I archive
+The pathname of an archive file to be indexed.
+One or more archive files must be specified.
+.SH EXIT STATUS
+.TP
+.B 0
+Successful completion.
+.TP
+.B >0
+An error occurred processing one or more archives.
+.SH EXAMPLES
+Generate a symbol index for a library archive:
+.IP
+.EX
+scc-ranlib libfoo.a
+.EE
+.PP
+Generate a symbol index for multiple archives at once:
+.IP
+.EX
+scc-ranlib libfoo.a libbar.a
+.EE
+.SH DIAGNOSTICS
+Error messages are written to standard error and have the format:
+.IP
+.EX
+scc-ranlib: archive: message
+.EE
+.PP
+If a member within the archive caused the error, the format is:
+.IP
+.EX
+scc-ranlib: archive: member: message
+.EE
+.SH AUTHORS
+See the LICENSE file for the authors.
+.SH LICENSE
+See the LICENSE file for the terms of redistribution.
+.SH SEE ALSO
+.BR scc-ar (1),
+.BR scc-ld (1),
+.BR scc-nm (1)
diff --git a/src/cmd/scc-ranlib.c b/src/cmd/scc-ranlib.c
@@ -37,7 +37,7 @@ error(char *fmt, ...)
va_list va;
va_start(va, fmt);
- fprintf(stderr, "ranlib: %s: ", filename);
+ fprintf(stderr, "scc-ranlib: %s: ", filename);
if (membname)
fprintf(stderr, "%s: ", membname);
vfprintf(stderr, fmt, va);
@@ -352,7 +352,7 @@ err1:
static void
usage(void)
{
- fputs("usage: ranlib [-t] file...\n", stderr);
+ fputs("usage: scc-ranlib [-t] file...\n", stderr);
exit(EXIT_FAILURE);
}