Make the standard indent for code samples, shell session

logs, etc. to be ".in +4n".
This commit is contained in:
Michael Kerrisk 2007-12-19 07:19:23 +00:00
parent 088a639be3
commit a6e2f12821
26 changed files with 105 additions and 103 deletions

View File

@ -53,21 +53,21 @@ They have the form:
.sp
.RS
.RI _syscall X ( type , name , type1 , arg1 , type2 , arg2 ,...)
.RS
.HP
where \fIX\fP is 0\(en5, which are the number of arguments taken by the
.RE
.PP
where
.IP
\fIX\fP is 0\(en6, which are the number of arguments taken by the
system call
.HP
.IP
\fItype\fP is the return type of the system call
.HP
.IP
\fIname\fP is the name of the system call
.HP
.IP
\fItypeN\fP is the Nth argument's type
.HP
.IP
\fIargN\fP is the name of the Nth argument
.RE
.RE
.sp
.PP
These macros create a function called \fIname\fP with the arguments you
specify.
Once you include the _syscall() in your source file,

View File

@ -47,12 +47,12 @@ The size of the kind of pages that
.BR mmap (2)
uses, is found using
.RS
.in +4n
.nf
#include <unistd.h>
long sz = sysconf(_SC_PAGESIZE);
.fi
.RE
.in
(most systems allow the synonym
.B _SC_PAGE_SIZE
@ -60,12 +60,12 @@ for
.BR _SC_PAGESIZE ),
or
.RS
.in +4n
.nf
#include <unistd.h>
int sz = getpagesize();
.fi
.RE
.in
.\" .SH HISTORY
.\" This call first appeared in 4.2BSD.
.SH CONFORMING TO

View File

@ -25,7 +25,7 @@ The module image begins with a module structure and is followed by
code and data as appropriate.
The module structure is defined as follows:
.PP
.RS
.in +4n
.nf
struct module {
unsigned long size_of_struct;
@ -48,7 +48,7 @@ struct module {
#endif
};
.fi
.RE
.in
.PP
All of the pointer fields, with the exception of
.I next

View File

@ -112,10 +112,10 @@ is set appropriately.
SVr4, 4.3BSD, POSIX.1-2001.
.SH NOTES
The number of clock ticks per second can be obtained using:
.RS
.in +4n
sysconf(_SC_CLK_TCK);
.RE
.in
.PP
In POSIX.1-1996 the symbol \fBCLK_TCK\fP (defined in
.IR <time.h> )

View File

@ -154,7 +154,7 @@ Before glibc 2.2.1, the glibc version of
did not correctly handle pathnames with trailing '/' characters,
and generated a segfault if given a NULL argument.
.SH EXAMPLE
.RS
.in +4n
.nf
char *dirc, *basec, *bname, *dname;
char *path = "/etc/passwd";
@ -165,7 +165,7 @@ dname = dirname(dirc);
bname = basename(basec);
printf("dirname=%s, basename=%s\\n", dname, bname);
.fi
.RE
.in
.SH "SEE ALSO"
.BR basename (1),
.BR dirname (1),

View File

@ -33,10 +33,9 @@ bsearch \- binary search of a sorted array
.nf
.B #include <stdlib.h>
.sp
.BI "void *bsearch(const void *" key ", const void *" base ", size_t " nmemb ,
.RS
.BI "size_t " size ", int (*" compar ")(const void *, const void *));"
.RE
.BI "void *bsearch(const void *" key ", const void *" base ,
.BI " size_t " nmemb ", size_t " size ,
.BI " int (*" compar ")(const void *, const void *));"
.fi
.SH DESCRIPTION
The

View File

@ -447,10 +447,10 @@ main(int argc, char **argv)
.PP
If this program were in a file named "foo.c", you would build the program
with the following command:
.RS
.in +4n
.LP
gcc \-rdynamic \-o foo foo.c \-ldl
.RE
.in
.PP
Libraries exporting
.BR _init ()
@ -458,10 +458,10 @@ and
.BR _fini ()
will want to be compiled as
follows, using \fIbar.c\fP as the example name:
.RS
.in +4n
.LP
gcc \-shared \-nostartfiles \-o bar bar.c
.RE
.in
.SH "SEE ALSO"
.BR ld (1),
.BR ldd (1),

View File

@ -471,7 +471,7 @@ Improper link (POSIX.1)
Exchange full
.SH NOTES
A common mistake is to do
.RS
.in +4n
.nf
if (somecall() == \-1) {
@ -480,7 +480,7 @@ if (somecall() == \-1) {
}
.fi
.RE
.in
where
.I errno
no longer needs to have the value it had upon return from
@ -490,7 +490,7 @@ no longer needs to have the value it had upon return from
If the value of
.I errno
should be preserved across a library call, it must be saved:
.RS
.in +4n
.nf
if (somecall() == \-1) {
@ -499,7 +499,7 @@ if (somecall() == \-1) {
if (errsv == ...) { ... }
}
.fi
.RE
.in
.PP
It was common in traditional C to declare
.I errno

View File

@ -49,9 +49,9 @@ The following is an example of the kind of string
that might be passed in
.IR optionp :
.sp
.RS
.in +4n
.B ro,name=xyz
.RE
.in
The
.I tokens

View File

@ -80,9 +80,9 @@ Otherwise, \fI*ps\fP must be a valid \fImbstate_t\fP object.
An \fImbstate_t\fP object \fIa\fP can be initialized to the initial state
by zeroing it, for example using
.sp
.RS
.in +4n
memset(&a, 0, sizeof(a));
.RE
.in
.SH "RETURN VALUE"
The
.BR mbrtowc ()

View File

@ -225,11 +225,11 @@ part of the locale.
The POSIX locale
uses `.' as radix character, and does not have a grouping character.
Thus,
.RS
.in +4n
.nf
printf("%'.2f", 1234567.89);
.fi
.RE
.in
results in `1234567.89' in the POSIX locale, in `1234567,89' in the
nl_NL locale, and in `1.234.567,89' in the da_DK locale.
.SS "The flag characters"

View File

@ -140,20 +140,21 @@ In
(William H. Press, Brian P. Flannery, Saul A. Teukolsky, William
T. Vetterling; New York: Cambridge University Press, 1992 (2nd ed.,
p. 277)), the following comments are made:
.RS
.PP
.RS 4
"If you want to generate a random integer between 1 and 10, you should
always do it by using high-order bits, as in
.RS
.in +4n
.sp
j = 1 + (int) (10.0 * (rand() / (RAND_MAX + 1.0)));
.sp
.RE
.in
and never by anything resembling
.RS
.in +4n
.sp
j = 1 + (rand() % 10);
.sp
.RE
.in
(which uses lower-order bits)."
.RE
.PP
@ -176,19 +177,21 @@ and
.BR srand (),
possibly useful when one needs the same sequence on two different machines.
.sp
.in +4n
.nf
static unsigned long next = 1;
static unsigned long next = 1;
/* RAND_MAX assumed to be 32767 */
int myrand(void) {
next = next * 1103515245 + 12345;
return((unsigned)(next/65536) % 32768);
}
/* RAND_MAX assumed to be 32767 */
int myrand(void) {
next = next * 1103515245 + 12345;
return((unsigned)(next/65536) % 32768);
}
void mysrand(unsigned seed) {
next = seed;
}
void mysrand(unsigned seed) {
next = seed;
}
.fi
.in
.SH "SEE ALSO"
.BR drand48 (3),
.BR random (3)

View File

@ -120,7 +120,7 @@ as found in \fI<limits.h>\fP or provided by the
function.
A typical source fragment would be
.LP
.RS
.in +4n
.nf
#ifdef PATH_MAX
path_max = PATH_MAX;
@ -130,7 +130,7 @@ A typical source fragment would be
path_max = 4096;
#endif
.fi
.RE
.in
(But see the BUGS section.)
.LP
The 4.4BSD, Linux and SUSv2 versions always return an absolute

View File

@ -97,7 +97,7 @@ file.
.SH "CONFORMING TO"
These routines are glibc-specific.
The NeXT has similar routines:
.RS
.in +4n
.nf
#include <aliasdb.h>
@ -107,7 +107,7 @@ void alias_endent(void);
alias_ent *alias_getent(void);
alias_ent *alias_getbyname(char *name);
.fi
.RE
.in
.SH EXAMPLE
The following example compiles with
.IR "gcc example.c \-o example" .

View File

@ -131,9 +131,9 @@ The
.BR setbuf ()
function is exactly equivalent to the call
.PP
.RS
.in +4n
setvbuf(stream, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
.RE
.in
.PP
The
.BR setbuffer ()
@ -144,9 +144,9 @@ The
.BR setlinebuf ()
function is exactly equivalent to the call:
.PP
.RS
.in +4n
setvbuf(stream, (char *) NULL, _IOLBF, 0);
.RE
.in
.SH "RETURN VALUE"
The function
.BR setvbuf ()

View File

@ -157,23 +157,23 @@ An obvious implementation would have a
be a pointer to the stack frame of the variadic function.
In such a setup (by far the most common) there seems
nothing against an assignment
.RS
.in +4n
.nf
va_list aq = ap;
va_list aq = ap;
.fi
.RE
.in
Unfortunately, there are also systems that make it an
array of pointers (of length 1), and there one needs
.RS
.in +4n
.nf
va_list aq;
*aq = *ap;
va_list aq;
*aq = *ap;
.fi
.RE
.in
Finally, on systems where parameters are passed in registers,
it may be necessary for
.BR va_start ()
@ -187,16 +187,16 @@ can free the allocated memory again.
To accommodate this situation, C99 adds a macro
.BR va_copy (),
so that the above assignment can be replaced by
.RS
.in +4n
.nf
va_list aq;
va_copy(aq, ap);
...
va_end(aq);
va_list aq;
va_copy(aq, ap);
...
va_end(aq);
.fi
.RE
.in
Each invocation of
.BR va_copy ()
must be matched by a corresponding invocation of
@ -274,7 +274,6 @@ The function
.I foo
takes a string of format characters and prints out the argument associated
with each format character based on the type.
.RS
.nf
#include <stdio.h>
@ -308,4 +307,3 @@ foo(char *fmt, ...)
va_end(ap);
}
.fi
.RE

View File

@ -129,20 +129,20 @@ Not in POSIX.1-2001.
Present on several other systems.
.SH EXAMPLE
The call
.RS
.in +4n
.nf
strfmon(buf, sizeof(buf), "[%^=*#6n] [%=*#6i]",
1234.567, 1234.567);
.fi
.RE
.in
outputs
.RS
.in +4n
[ fl **1234,57] [ NLG **1 234,57]
.RE
.in
in the Dutch locale (with fl for "florijnen" and NLG for Netherlands Guilders).
The grouping character is very ugly because it takes as much space
as a digit, while it should not take more than half that,
@ -152,7 +152,7 @@ and "NLG" is preceded by one and followed by two spaces.
This may be a bug in the locale files.
The Italian, Australian, Swiss
and Portuguese locales yield
.RS
.in +4n
[ L. **1235] [ ITL **1.235]
.br
@ -161,7 +161,7 @@ and Portuguese locales yield
[Fr. **1234,57] [CHF **1.234,57]
.br
[ **1234$57Esc] [ **1.234$57PTE ]
.RE
.in
.SH "SEE ALSO"
.BR setlocale (3),
.BR sprintf (3),

View File

@ -93,7 +93,7 @@ that is a pointer to a \fItermios\fP structure.
This structure contains at least the following members:
.ne 9
.sp
.RS
.in +4n
.nf
tcflag_t \fIc_iflag\fP; /* input modes */
tcflag_t \fIc_oflag\fP; /* output modes */
@ -101,7 +101,7 @@ tcflag_t \fIc_cflag\fP; /* control modes */
tcflag_t \fIc_lflag\fP; /* local modes */
cc_t \fIc_cc\fP[\fBNCCS\fP]; /* control chars */
.fi
.RE
.in
.PP
The values that may be assigned to these fields are described below.
In the case of the first four bit-mask fields,

View File

@ -70,7 +70,7 @@ and restore the value of
.BR TZ .
Something like
.RS
.in +4n
.nf
#include <time.h>
#include <stdlib.h>
@ -93,7 +93,7 @@ my_timegm(struct tm *tm)
return ret;
}
.fi
.RE
.in
.SH "SEE ALSO"
.BR gmtime (3),
.BR localtime (3),

View File

@ -87,7 +87,7 @@ in the range [0,1000000].
Programs will be more portable
if they never mention this type explicitly.
Use
.RS
.in +4n
.nf
.ta 8
.sp
@ -97,7 +97,7 @@ Use
\&...
usleep(usecs);
.fi
.RE
.in
.LP
The interaction of this function with the
.B SIGALRM

View File

@ -579,17 +579,17 @@ available with the X distribution.
That document, though terse, is much longer than this manual page.
For a chronological overview,
.PP
.RS
.in +4n
http://invisible-island.net/xterm/xterm.log.html
.RE
.in
.PP
details changes to xterm.
.PP
The \fIvttest\fP program
.PP
.RS
.in +4n
http://invisible-island.net/vttest/
.RE
.in
.PP
demonstrates many of these control sequences.
The \fIxterm\fP source distribution also contains sample

View File

@ -80,7 +80,7 @@ or directly with the ioctl requests listed below.
Besides tracking the date and time, many RTCs can also generate
interrupts
.IP *
.IP * 3
on every clock update (i.e., once per second);
.IP *
at periodic intervals with a frequency that can be set to
@ -123,8 +123,7 @@ requests are defined on file descriptors connected to RTC devices:
.TP
.B RTC_RD_TIME
Returns this RTC's time in the following structure:
.PP
.RS
.IP
.in +4n
.nf
struct rtc_time {
@ -140,7 +139,6 @@ struct rtc_time {
};
.fi
.in
.RE
.IP
The fields in this structure have the same meaning and ranges as for the
.I tm

View File

@ -76,7 +76,7 @@ For instance, it is possible to control up to 64 tape drives
with two minor numbers for different options.)
.PP
Devices are typically created by:
.RS
.in +4n
.nf
mknod \-m 666 /dev/st0 c 9 0
@ -88,7 +88,7 @@ mknod \-m 666 /dev/nst0l c 9 160
mknod \-m 666 /dev/nst0m c 9 192
mknod \-m 666 /dev/nst0a c 9 224
.fi
.RE
.in
.PP
There is no corresponding block device.
.PP

View File

@ -30,9 +30,11 @@ acct \- execution accounting file
.SH DESCRIPTION
If the kernel was compiled with the process accounting option enabled,
the system call
.RS
.in +4n
acct("/somewhere/accountingfile");
.RE
.in
will start the process accounting.
Each time a process terminates
a record for this process is appended to the accounting file.

View File

@ -34,7 +34,7 @@ The file
gives statistics.
For example:
.LP
.RS
.in +4n
.nf
% cat /proc/slabinfo
slabinfo \- version: 1.1
@ -51,7 +51,7 @@ size-8192 1 17 8192 1 17 2
size-4096 41 73 4096 41 73 1
\&...
.fi
.RE
.in
.LP
For each slab cache, the cache name, the number of currently
active objects, the total number of available objects, the
@ -104,9 +104,11 @@ before flushing objects to the global cache.
It is possible to tune the SMP per-CPU slab cache limit
and batchcount via:
.in +4n
.nf
echo "\fIcache_name limit batchcount\fP" > /proc/slabinfo
.fi
.in
.SH FILES
.I <linux/slab.h>
.SH VERSIONS

View File

@ -259,13 +259,13 @@ macro in
.IR <net/if.h> .
Add the following to your program as a workaround:
.sp
.RS
.in +4n
.nf
#ifndef ifr_newname
#define ifr_newname ifr_ifru.ifru_slave
#endif
.fi
.RE
.in
.SH "SEE ALSO"
.BR proc (5),
.BR capabilities (7),