mirror of https://github.com/mkerrisk/man-pages
Replaced tabs with spaces
This commit is contained in:
parent
1bef0ec265
commit
7295b7eda0
4
Changes
4
Changes
|
@ -33,6 +33,10 @@ bdflush.2
|
||||||
mtk
|
mtk
|
||||||
Add <sys/kdaemon.h> header file to SYNOPSIS.
|
Add <sys/kdaemon.h> header file to SYNOPSIS.
|
||||||
|
|
||||||
|
sched_rr_get_interval.2
|
||||||
|
mtk
|
||||||
|
Moved timespec definition from SYNOPSIS into description.
|
||||||
|
|
||||||
select_tut.2
|
select_tut.2
|
||||||
mtk
|
mtk
|
||||||
Make SYNOPSIS match select.2.
|
Make SYNOPSIS match select.2.
|
||||||
|
|
|
@ -86,8 +86,8 @@ you call the system call by \fIname\fP.
|
||||||
.nf
|
.nf
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <linux/unistd.h> /* for _syscallX macros/related stuff */
|
#include <linux/unistd.h> /* for _syscallX macros/related stuff */
|
||||||
#include <linux/kernel.h> /* for struct sysinfo */
|
#include <linux/kernel.h> /* for struct sysinfo */
|
||||||
|
|
||||||
_syscall1(int, sysinfo, struct sysinfo *, info);
|
_syscall1(int, sysinfo, struct sysinfo *, info);
|
||||||
|
|
||||||
|
|
25
man2/msgop.2
25
man2/msgop.2
|
@ -64,21 +64,16 @@ The
|
||||||
.I msgp
|
.I msgp
|
||||||
argument is a pointer to caller-defined structure
|
argument is a pointer to caller-defined structure
|
||||||
of the following general form:
|
of the following general form:
|
||||||
.sp
|
.in +0.5i
|
||||||
.B
|
.nf
|
||||||
struct msgbuf {
|
|
||||||
.br
|
struct msgbuf {
|
||||||
.B
|
long mtype; /* message type, must be > 0 */
|
||||||
long mtype;
|
char mtext[1]; /* message data */
|
||||||
/* message type, must be > 0 */
|
};
|
||||||
.br
|
.fi
|
||||||
.B
|
.in -0.5i
|
||||||
char mtext[1];
|
.PP
|
||||||
/* message data */
|
|
||||||
.br
|
|
||||||
.B
|
|
||||||
};
|
|
||||||
.sp
|
|
||||||
The
|
The
|
||||||
.I mtext
|
.I mtext
|
||||||
field is an array (or other structure) whose size is specified by
|
field is an array (or other structure) whose size is specified by
|
||||||
|
|
|
@ -205,22 +205,21 @@ is a struct with the following elements
|
||||||
.sp
|
.sp
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
.ta 4 13 24
|
|
||||||
siginfo_t {
|
siginfo_t {
|
||||||
int si_signo; /* Signal number */
|
int si_signo; /* Signal number */
|
||||||
int si_errno; /* An errno value */
|
int si_errno; /* An errno value */
|
||||||
int si_code; /* Signal code */
|
int si_code; /* Signal code */
|
||||||
pid_t si_pid; /* Sending process ID */
|
pid_t si_pid; /* Sending process ID */
|
||||||
uid_t si_uid; /* Real user ID of sending process */
|
uid_t si_uid; /* Real user ID of sending process */
|
||||||
int si_status; /* Exit value or signal */
|
int si_status; /* Exit value or signal */
|
||||||
clock_t si_utime; /* User time consumed */
|
clock_t si_utime; /* User time consumed */
|
||||||
clock_t si_stime; /* System time consumed */
|
clock_t si_stime; /* System time consumed */
|
||||||
sigval_t si_value; /* Signal value */
|
sigval_t si_value; /* Signal value */
|
||||||
int si_int; /* POSIX.1b signal */
|
int si_int; /* POSIX.1b signal */
|
||||||
void * si_ptr; /* POSIX.1b signal */
|
void *si_ptr; /* POSIX.1b signal */
|
||||||
void * si_addr; /* Memory location which caused fault */
|
void *si_addr; /* Memory location which caused fault */
|
||||||
int si_band; /* Band event */
|
int si_band; /* Band event */
|
||||||
int si_fd; /* File descriptor */
|
int si_fd; /* File descriptor */
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
|
|
|
@ -99,7 +99,7 @@ main(int argc, char **argv)
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
printf("'%s': unknown month\en", argv[i]);
|
printf("'%s': unknown month\en", argv[i]);
|
||||||
else
|
else
|
||||||
printf("%s: month #%d\en", res->name, res->nr);
|
printf("%s: month #%d\en", res->name, res->nr);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ Used in security-conscious applications. If it is unavailable
|
||||||
the assignment
|
the assignment
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
environ = NULL;
|
environ = NULL;
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
will probably do.
|
will probably do.
|
||||||
|
|
24
man3/cmsg.3
24
man3/cmsg.3
|
@ -143,20 +143,20 @@ int received_ttl;
|
||||||
|
|
||||||
/* Receive auxiliary data in msgh */
|
/* Receive auxiliary data in msgh */
|
||||||
for (cmsg = CMSG_FIRSTHDR(&msgh);
|
for (cmsg = CMSG_FIRSTHDR(&msgh);
|
||||||
cmsg != NULL;
|
cmsg != NULL;
|
||||||
cmsg = CMSG_NXTHDR(&msgh,cmsg)) {
|
cmsg = CMSG_NXTHDR(&msgh,cmsg)) {
|
||||||
if (cmsg->cmsg_level == IPPROTO_IP
|
if (cmsg->cmsg_level == IPPROTO_IP
|
||||||
&& cmsg->cmsg_type == IP_TTL) {
|
&& cmsg->cmsg_type == IP_TTL) {
|
||||||
ttlptr = (int *) CMSG_DATA(cmsg);
|
ttlptr = (int *) CMSG_DATA(cmsg);
|
||||||
received_ttl = *ttlptr;
|
received_ttl = *ttlptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cmsg == NULL) {
|
if (cmsg == NULL) {
|
||||||
/*
|
/*
|
||||||
* Error: IP_TTL not enabled or small buffer
|
* Error: IP_TTL not enabled or small buffer
|
||||||
* or I/O error.
|
* or I/O error.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
.ta
|
.ta
|
||||||
.fi
|
.fi
|
||||||
|
|
|
@ -48,21 +48,19 @@ entries. The file \fIstream\fP must have the same format as
|
||||||
.PP
|
.PP
|
||||||
The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
|
The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
|
||||||
.sp
|
.sp
|
||||||
.RS
|
.in +0.5i
|
||||||
.nf
|
.nf
|
||||||
.ta 8n 16n 32n
|
|
||||||
struct passwd {
|
struct passwd {
|
||||||
char *pw_name; /* user name */
|
char *pw_name; /* user name */
|
||||||
char *pw_passwd; /* user password */
|
char *pw_passwd; /* user password */
|
||||||
uid_t pw_uid; /* user ID */
|
uid_t pw_uid; /* user ID */
|
||||||
gid_t pw_gid; /* group ID */
|
gid_t pw_gid; /* group ID */
|
||||||
char *pw_gecos; /* real name */
|
char *pw_gecos; /* real name */
|
||||||
char *pw_dir; /* home directory */
|
char *pw_dir; /* home directory */
|
||||||
char *pw_shell; /* shell program */
|
char *pw_shell; /* shell program */
|
||||||
};
|
};
|
||||||
.ta
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.in -0.5i
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
The \fBfgetpwent\fP() function returns the passwd structure, or NULL if
|
The \fBfgetpwent\fP() function returns the passwd structure, or NULL if
|
||||||
there are no more entries or an error occurs.
|
there are no more entries or an error occurs.
|
||||||
|
|
|
@ -78,7 +78,7 @@ main(int argc, char *argv[])
|
||||||
r = frexp(x, &exp);
|
r = frexp(x, &exp);
|
||||||
|
|
||||||
printf("frexp(%g, &e) = %g: %g * %d^%d = %g\\n",
|
printf("frexp(%g, &e) = %g: %g * %d^%d = %g\\n",
|
||||||
x, r, r, FLT_RADIX, exp, x);
|
x, r, r, FLT_RADIX, exp, x);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
} /* main */
|
} /* main */
|
||||||
.fi
|
.fi
|
||||||
|
|
|
@ -42,10 +42,10 @@ which is declared as follows:
|
||||||
.in +1i
|
.in +1i
|
||||||
.nf
|
.nf
|
||||||
struct timeb {
|
struct timeb {
|
||||||
time_t time;
|
time_t time;
|
||||||
unsigned short millitm;
|
unsigned short millitm;
|
||||||
short timezone;
|
short timezone;
|
||||||
short dstflag;
|
short dstflag;
|
||||||
};
|
};
|
||||||
.fi
|
.fi
|
||||||
.in -1i
|
.in -1i
|
||||||
|
|
|
@ -93,21 +93,18 @@ of size
|
||||||
.PP
|
.PP
|
||||||
The \fImntent\fP structure is defined in \fI<mntent.h>\fP as follows:
|
The \fImntent\fP structure is defined in \fI<mntent.h>\fP as follows:
|
||||||
.sp
|
.sp
|
||||||
.RS
|
.in +0.5i
|
||||||
.nf
|
.nf
|
||||||
.ne 8
|
|
||||||
.ta 8n 16n 32n
|
|
||||||
struct mntent {
|
struct mntent {
|
||||||
char *mnt_fsname; /* name of mounted file system */
|
char *mnt_fsname; /* name of mounted file system */
|
||||||
char *mnt_dir; /* file system path prefix */
|
char *mnt_dir; /* file system path prefix */
|
||||||
char *mnt_type; /* mount type (see mntent.h) */
|
char *mnt_type; /* mount type (see mntent.h) */
|
||||||
char *mnt_opts; /* mount options (see mntent.h) */
|
char *mnt_opts; /* mount options (see mntent.h) */
|
||||||
int mnt_freq; /* dump frequency in days */
|
int mnt_freq; /* dump frequency in days */
|
||||||
int mnt_passno; /* pass number on parallel fsck */
|
int mnt_passno; /* pass number on parallel fsck */
|
||||||
};
|
};
|
||||||
.ta
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.in -0.5i
|
||||||
|
|
||||||
Since fields in the mtab and fstab files are separated by whitespace,
|
Since fields in the mtab and fstab files are separated by whitespace,
|
||||||
octal escapes are used to represent the four characters space (\e040),
|
octal escapes are used to represent the four characters space (\e040),
|
||||||
|
|
|
@ -66,19 +66,16 @@ The \fBendnetent\fP() function closes \fI/etc/networks\fP.
|
||||||
.PP
|
.PP
|
||||||
The \fInetent\fP structure is defined in \fI<netdb.h>\fP as follows:
|
The \fInetent\fP structure is defined in \fI<netdb.h>\fP as follows:
|
||||||
.sp
|
.sp
|
||||||
.RS
|
.in +0.5i
|
||||||
.nf
|
.nf
|
||||||
.ne 6
|
|
||||||
.ta 8n 16n 34n
|
|
||||||
struct netent {
|
struct netent {
|
||||||
char *n_name; /* official network name */
|
char *n_name; /* official network name */
|
||||||
char **n_aliases; /* alias list */
|
char **n_aliases; /* alias list */
|
||||||
int n_addrtype; /* net address type */
|
int n_addrtype; /* net address type */
|
||||||
unsigned long int n_net; /* network number */
|
unsigned long n_net; /* network number */
|
||||||
}
|
}
|
||||||
.ta
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.in -0.5i
|
||||||
.PP
|
.PP
|
||||||
The members of the \fInetent\fP structure are:
|
The members of the \fInetent\fP structure are:
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -65,18 +65,15 @@ The \fBendprotoent\fP() function closes \fI/etc/protocols\fP.
|
||||||
.PP
|
.PP
|
||||||
The \fIprotoent\fP structure is defined in \fI<netdb.h>\fP as follows:
|
The \fIprotoent\fP structure is defined in \fI<netdb.h>\fP as follows:
|
||||||
.sp
|
.sp
|
||||||
.RS
|
.in +0.5i
|
||||||
.nf
|
.nf
|
||||||
.ne 5
|
|
||||||
.ta 8n 16n 32n
|
|
||||||
struct protoent {
|
struct protoent {
|
||||||
char *p_name; /* official protocol name */
|
char *p_name; /* official protocol name */
|
||||||
char **p_aliases; /* alias list */
|
char **p_aliases; /* alias list */
|
||||||
int p_proto; /* protocol number */
|
int p_proto; /* protocol number */
|
||||||
}
|
}
|
||||||
.ta
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.in -0.5i
|
||||||
.PP
|
.PP
|
||||||
The members of the \fIprotoent\fP structure are:
|
The members of the \fIprotoent\fP structure are:
|
||||||
.TP
|
.TP
|
||||||
|
|
16
man3/getpw.3
16
man3/getpw.3
|
@ -50,17 +50,15 @@ The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
|
||||||
.sp
|
.sp
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
.ta 8n 16n 32n
|
|
||||||
struct passwd {
|
struct passwd {
|
||||||
char *pw_name; /* user name */
|
char *pw_name; /* user name */
|
||||||
char *pw_passwd; /* user password */
|
char *pw_passwd; /* user password */
|
||||||
uid_t pw_uid; /* user ID */
|
uid_t pw_uid; /* user ID */
|
||||||
gid_t pw_gid; /* group ID */
|
gid_t pw_gid; /* group ID */
|
||||||
char *pw_gecos; /* real name */
|
char *pw_gecos; /* real name */
|
||||||
char *pw_dir; /* home directory */
|
char *pw_dir; /* home directory */
|
||||||
char *pw_shell; /* shell program */
|
char *pw_shell; /* shell program */
|
||||||
};
|
};
|
||||||
.ta
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
|
|
|
@ -74,15 +74,12 @@ The \fIservent\fP structure is defined in \fI<netdb.h>\fP as follows:
|
||||||
.sp
|
.sp
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
.ne 6
|
|
||||||
.ta 8n 16n 32n
|
|
||||||
struct servent {
|
struct servent {
|
||||||
char *s_name; /* official service name */
|
char *s_name; /* official service name */
|
||||||
char **s_aliases; /* alias list */
|
char **s_aliases; /* alias list */
|
||||||
int s_port; /* port number */
|
int s_port; /* port number */
|
||||||
char *s_proto; /* protocol to use */
|
char *s_proto; /* protocol to use */
|
||||||
}
|
}
|
||||||
.ta
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -71,12 +71,14 @@ the hash table so that a new table can be constructed.
|
||||||
.PP
|
.PP
|
||||||
The argument \fIitem\fP is of type \fBENTRY\fP, which is a typedef defined in
|
The argument \fIitem\fP is of type \fBENTRY\fP, which is a typedef defined in
|
||||||
\fI<search.h>\fP and includes these elements:
|
\fI<search.h>\fP and includes these elements:
|
||||||
|
.RS
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
typedef struct entry {
|
typedef struct entry {
|
||||||
char *\fIkey\fP;
|
char *\fIkey\fP;
|
||||||
void *\fIdata\fP;
|
void *\fIdata\fP;
|
||||||
} ENTRY;
|
} ENTRY;
|
||||||
|
.RE
|
||||||
.fi
|
.fi
|
||||||
.sp
|
.sp
|
||||||
The field \fIkey\fP points to the null-terminated string which is the
|
The field \fIkey\fP points to the null-terminated string which is the
|
||||||
|
|
|
@ -96,7 +96,7 @@ then two additional arguments must be supplied.
|
||||||
The
|
The
|
||||||
.I mode
|
.I mode
|
||||||
argument specifies the permissions to be placed on the new queue,
|
argument specifies the permissions to be placed on the new queue,
|
||||||
as for
|
as for
|
||||||
.BR open (2).
|
.BR open (2).
|
||||||
The permissions settings are masked against the process umask.
|
The permissions settings are masked against the process umask.
|
||||||
The
|
The
|
||||||
|
|
|
@ -155,13 +155,17 @@ the position in the argument list of the desired argument, indexed starting
|
||||||
from 1. Thus,
|
from 1. Thus,
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
printf("%*d", width, num);
|
|
||||||
|
printf("%*d", width, num);
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
and
|
and
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
printf("%2$*1$d", width, num);
|
|
||||||
|
printf("%2$*1$d", width, num);
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
are equivalent. The second style allows repeated references to the
|
are equivalent. The second style allows repeated references to the
|
||||||
|
@ -181,7 +185,7 @@ uses `.' as radix character, and does not have a grouping character.
|
||||||
Thus,
|
Thus,
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
printf("%'.2f", 1234567.89);
|
printf("%'.2f", 1234567.89);
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
results in `1234567.89' in the POSIX locale, in `1234567,89' in the
|
results in `1234567.89' in the POSIX locale, in `1234567,89' in the
|
||||||
|
@ -711,6 +715,7 @@ specification is `%%'.
|
||||||
To print \*(Pi to five decimal places:
|
To print \*(Pi to five decimal places:
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
fprintf(stdout, "pi = %.5f\en", 4 * atan(1.0));
|
fprintf(stdout, "pi = %.5f\en", 4 * atan(1.0));
|
||||||
|
@ -725,9 +730,10 @@ and
|
||||||
are pointers to strings:
|
are pointers to strings:
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
fprintf(stdout, "%s, %s %d, %.2d:%.2d\en",
|
fprintf(stdout, "%s, %s %d, %.2d:%.2d\en",
|
||||||
weekday, month, day, hour, min);
|
weekday, month, day, hour, min);
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
|
@ -736,9 +742,11 @@ Hence, an internationalized version must be able to print
|
||||||
the arguments in an order specified by the format:
|
the arguments in an order specified by the format:
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
fprintf(stdout, format,
|
fprintf(stdout, format,
|
||||||
weekday, month, day, hour, min);
|
weekday, month, day, hour, min);
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
where
|
where
|
||||||
|
@ -755,40 +763,42 @@ To allocate a sufficiently large string and print into it
|
||||||
(code correct for both glibc 2.0 and glibc 2.1):
|
(code correct for both glibc 2.0 and glibc 2.1):
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
char *
|
char *
|
||||||
make_message(const char *fmt, ...) {
|
make_message(const char *fmt, ...)
|
||||||
/* Guess we need no more than 100 bytes. */
|
{
|
||||||
int n, size = 100;
|
/* Guess we need no more than 100 bytes. */
|
||||||
char *p, *np;
|
int n, size = 100;
|
||||||
va_list ap;
|
char *p, *np;
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
if ((p = malloc(size)) == NULL)
|
if ((p = malloc(size)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
/* Try to print in the allocated space. */
|
/* Try to print in the allocated space. */
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
n = vsnprintf(p, size, fmt, ap);
|
n = vsnprintf(p, size, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
/* If that worked, return the string. */
|
/* If that worked, return the string. */
|
||||||
if (n > \-1 && n < size)
|
if (n > \-1 && n < size)
|
||||||
return p;
|
return p;
|
||||||
/* Else try again with more space. */
|
/* Else try again with more space. */
|
||||||
if (n > \-1) /* glibc 2.1 */
|
if (n > \-1) /* glibc 2.1 */
|
||||||
size = n+1; /* precisely what is needed */
|
size = n+1; /* precisely what is needed */
|
||||||
else /* glibc 2.0 */
|
else /* glibc 2.0 */
|
||||||
size *= 2; /* twice the old size */
|
size *= 2; /* twice the old size */
|
||||||
if ((np = realloc (p, size)) == NULL) {
|
if ((np = realloc (p, size)) == NULL) {
|
||||||
free(p);
|
free(p);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
p = np;
|
p = np;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
|
|
|
@ -93,7 +93,7 @@ and then read the byte of data at the mark:
|
||||||
perror("sockatmark");
|
perror("sockatmark");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (atmark)
|
if (atmark)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -154,15 +154,15 @@ In such a setup (by far the most common) there seems
|
||||||
nothing against an assignment
|
nothing against an assignment
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
va_list aq = ap;
|
va_list aq = ap;
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
Unfortunately, there are also systems that make it an
|
Unfortunately, there are also systems that make it an
|
||||||
array of pointers (of length 1), and there one needs
|
array of pointers (of length 1), and there one needs
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
va_list aq;
|
va_list aq;
|
||||||
*aq = *ap;
|
*aq = *ap;
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
Finally, on systems where parameters are passed in registers,
|
Finally, on systems where parameters are passed in registers,
|
||||||
|
@ -179,10 +179,10 @@ To accommodate this situation, C99 adds a macro
|
||||||
so that the above assignment can be replaced by
|
so that the above assignment can be replaced by
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
va_list aq;
|
va_list aq;
|
||||||
va_copy(aq, ap);
|
va_copy(aq, ap);
|
||||||
...
|
...
|
||||||
va_end(aq);
|
va_end(aq);
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
Each invocation of
|
Each invocation of
|
||||||
|
@ -205,30 +205,32 @@ with each format character based on the type.
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
void foo(char *fmt, ...) {
|
void
|
||||||
va_list ap;
|
foo(char *fmt, ...)
|
||||||
int d;
|
{
|
||||||
char c, *s;
|
va_list ap;
|
||||||
|
int d;
|
||||||
|
char c, *s;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
while (*fmt)
|
while (*fmt)
|
||||||
switch(*fmt++) {
|
switch(*fmt++) {
|
||||||
case 's': /* string */
|
case 's': /* string */
|
||||||
s = va_arg(ap, char *);
|
s = va_arg(ap, char *);
|
||||||
printf("string %s\en", s);
|
printf("string %s\en", s);
|
||||||
break;
|
break;
|
||||||
case 'd': /* int */
|
case 'd': /* int */
|
||||||
d = va_arg(ap, int);
|
d = va_arg(ap, int);
|
||||||
printf("int %d\en", d);
|
printf("int %d\en", d);
|
||||||
break;
|
break;
|
||||||
case 'c': /* char */
|
case 'c': /* char */
|
||||||
/* need a cast here since va_arg only
|
/* need a cast here since va_arg only
|
||||||
takes fully promoted types */
|
takes fully promoted types */
|
||||||
c = (char) va_arg(ap, int);
|
c = (char) va_arg(ap, int);
|
||||||
printf("char %c\en", c);
|
printf("char %c\en", c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
|
@ -254,16 +256,19 @@ The historic setup is:
|
||||||
.nf
|
.nf
|
||||||
#include <varargs.h>
|
#include <varargs.h>
|
||||||
|
|
||||||
void foo(va_alist) va_dcl {
|
void
|
||||||
va_list ap;
|
foo(va_alist)
|
||||||
|
va_dcl
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap);
|
va_start(ap);
|
||||||
while(...) {
|
while(...) {
|
||||||
...
|
...
|
||||||
x = va_arg(ap, type);
|
x = va_arg(ap, type);
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
|
|
|
@ -310,14 +310,17 @@ Of course programmers are encouraged to use %c, it gives the preferred
|
||||||
date and time representation. One meets all kinds of strange obfuscations
|
date and time representation. One meets all kinds of strange obfuscations
|
||||||
to circumvent this gcc problem. A relatively clean one is to add an
|
to circumvent this gcc problem. A relatively clean one is to add an
|
||||||
intermediate function
|
intermediate function
|
||||||
.RS
|
.in +0.5i
|
||||||
size_t my_strftime(char *s, size_t max, const char *fmt,
|
.nf
|
||||||
const struct tm *tm) {
|
|
||||||
.br
|
size_t
|
||||||
return strftime(s, max, fmt, tm);
|
my_strftime(char *s, size_t max, const char *fmt,
|
||||||
.br
|
const struct tm *tm)
|
||||||
|
{
|
||||||
|
return strftime(s, max, fmt, tm);
|
||||||
}
|
}
|
||||||
.RE
|
.fi
|
||||||
|
.in -0.5i
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
The program below can be used to experiment with
|
The program below can be used to experiment with
|
||||||
.BR strftime ().
|
.BR strftime ().
|
||||||
|
|
|
@ -666,7 +666,7 @@ until \fBtcsetattr\fP() is successfully called.
|
||||||
|
|
||||||
Setting the speed to \fBB0\fP instructs the modem to "hang up".
|
Setting the speed to \fBB0\fP instructs the modem to "hang up".
|
||||||
The actual bit rate corresponding to \fBB38400\fP may be altered with
|
The actual bit rate corresponding to \fBB38400\fP may be altered with
|
||||||
\fBsetserial\fP(8).
|
\fBsetserial\fP(8).
|
||||||
.LP
|
.LP
|
||||||
The input and output baud rates are stored in the \fItermios\fP
|
The input and output baud rates are stored in the \fItermios\fP
|
||||||
structure.
|
structure.
|
||||||
|
|
|
@ -226,7 +226,9 @@ For example, the following shell command line would change
|
||||||
the normal root device to
|
the normal root device to
|
||||||
.IR /dev/hdb1 :
|
.IR /dev/hdb1 :
|
||||||
.nf
|
.nf
|
||||||
echo 0x365 >/proc/sys/kernel/real-root-dev
|
|
||||||
|
echo 0x365 >/proc/sys/kernel/real-root-dev
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
For a NFS example, the following shell command lines would change the
|
For a NFS example, the following shell command lines would change the
|
||||||
normal root device to the NFS directory
|
normal root device to the NFS directory
|
||||||
|
@ -234,10 +236,11 @@ normal root device to the NFS directory
|
||||||
on a local networked NFS server with IP number 193.8.232.7 for a system with
|
on a local networked NFS server with IP number 193.8.232.7 for a system with
|
||||||
IP number 193.8.232.7 and named 'idefix':
|
IP number 193.8.232.7 and named 'idefix':
|
||||||
.nf
|
.nf
|
||||||
echo /var/nfsroot >/proc/sys/kernel/nfs-root-name
|
|
||||||
echo 193.8.232.2:193.8.232.7::255.255.255.0:idefix \\
|
echo /var/nfsroot >/proc/sys/kernel/nfs-root-name
|
||||||
>/proc/sys/kernel/nfs-root-addrs
|
echo 193.8.232.2:193.8.232.7::255.255.255.0:idefix \\
|
||||||
echo 255 >/proc/sys/kernel/real-root-dev
|
>/proc/sys/kernel/nfs-root-addrs
|
||||||
|
echo 255 >/proc/sys/kernel/real-root-dev
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
.BR Note :
|
.BR Note :
|
||||||
|
|
|
@ -49,9 +49,9 @@ If your system does not have
|
||||||
can be created with the following commands:
|
can be created with the following commands:
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
mknod \-m 644 /dev/random c 1 8
|
mknod \-m 644 /dev/random c 1 8
|
||||||
mknod \-m 644 /dev/urandom c 1 9
|
mknod \-m 644 /dev/urandom c 1 9
|
||||||
chown root:root /dev/random /dev/urandom
|
chown root:root /dev/random /dev/urandom
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
When a Linux system starts up without much operator interaction,
|
When a Linux system starts up without much operator interaction,
|
||||||
|
@ -63,34 +63,34 @@ To do this, add the following lines to an appropriate script
|
||||||
which is run during the Linux system start-up sequence:
|
which is run during the Linux system start-up sequence:
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
echo "Initializing random number generator..."
|
echo "Initializing random number generator..."
|
||||||
random_seed=/var/run/random-seed
|
random_seed=/var/run/random-seed
|
||||||
# Carry a random seed from start-up to start-up
|
# Carry a random seed from start-up to start-up
|
||||||
# Load and then save the whole entropy pool
|
# Load and then save the whole entropy pool
|
||||||
if [ \-f $random_seed ]; then
|
if [ \-f $random_seed ]; then
|
||||||
cat $random_seed >/dev/urandom
|
cat $random_seed >/dev/urandom
|
||||||
else
|
else
|
||||||
touch $random_seed
|
touch $random_seed
|
||||||
fi
|
fi
|
||||||
chmod 600 $random_seed
|
chmod 600 $random_seed
|
||||||
poolfile=/proc/sys/kernel/random/poolsize
|
poolfile=/proc/sys/kernel/random/poolsize
|
||||||
[ \-r $poolfile ] && bytes=`cat $poolfile` || bytes=512
|
[ \-r $poolfile ] && bytes=`cat $poolfile` || bytes=512
|
||||||
dd if=/dev/urandom of=$random_seed count=1 bs=$bytes
|
dd if=/dev/urandom of=$random_seed count=1 bs=$bytes
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
Also, add the following lines in an appropriate script which is
|
Also, add the following lines in an appropriate script which is
|
||||||
run during the Linux system shutdown:
|
run during the Linux system shutdown:
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
# Carry a random seed from shut-down to start-up
|
# Carry a random seed from shut-down to start-up
|
||||||
# Save the whole entropy pool
|
# Save the whole entropy pool
|
||||||
echo "Saving random seed..."
|
echo "Saving random seed..."
|
||||||
random_seed=/var/run/random-seed
|
random_seed=/var/run/random-seed
|
||||||
touch $random_seed
|
touch $random_seed
|
||||||
chmod 600 $random_seed
|
chmod 600 $random_seed
|
||||||
poolfile=/proc/sys/kernel/random/poolsize
|
poolfile=/proc/sys/kernel/random/poolsize
|
||||||
[ \-r $poolfile ] && bytes=`cat $poolfile` || bytes=512
|
[ \-r $poolfile ] && bytes=`cat $poolfile` || bytes=512
|
||||||
dd if=/dev/urandom of=$random_seed count=1 bs=$bytes
|
dd if=/dev/urandom of=$random_seed count=1 bs=$bytes
|
||||||
.fi
|
.fi
|
||||||
.SH "PROC INTERFACE"
|
.SH "PROC INTERFACE"
|
||||||
The files in the directory
|
The files in the directory
|
||||||
|
|
10
man5/hosts.5
10
man5/hosts.5
|
@ -76,11 +76,11 @@ network is not connected to the Internet, DNS offers little
|
||||||
advantage.
|
advantage.
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.nf
|
||||||
127.0.0.1 localhost
|
127.0.0.1 localhost
|
||||||
192.168.1.10 foo.mydomain.org foo
|
192.168.1.10 foo.mydomain.org foo
|
||||||
192.168.1.13 bar.mydomain.org bar
|
192.168.1.13 bar.mydomain.org bar
|
||||||
146.82.138.7 master.debian.org master
|
146.82.138.7 master.debian.org master
|
||||||
209.237.226.90 www.opensource.org
|
209.237.226.90 www.opensource.org
|
||||||
.fi
|
.fi
|
||||||
.SH "NOTE"
|
.SH "NOTE"
|
||||||
Modifications to this file normally take effect immediately,
|
Modifications to this file normally take effect immediately,
|
||||||
|
|
|
@ -63,11 +63,10 @@ these structures are defined as follows:
|
||||||
.in +.5i
|
.in +.5i
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
.ta .5i +\w'unsigned int\0\0'u
|
|
||||||
struct ttinfo {
|
struct ttinfo {
|
||||||
long tt_gmtoff;
|
long tt_gmtoff;
|
||||||
int tt_isdst;
|
int tt_isdst;
|
||||||
unsigned int tt_abbrind;
|
unsigned int tt_abbrind;
|
||||||
};
|
};
|
||||||
.in -.5i
|
.in -.5i
|
||||||
.fi
|
.fi
|
||||||
|
|
11
man7/arp.7
11
man7/arp.7
|
@ -67,13 +67,12 @@ They take a pointer to a
|
||||||
as their parameter.
|
as their parameter.
|
||||||
|
|
||||||
.nf
|
.nf
|
||||||
.ta 4 20 33
|
|
||||||
struct arpreq {
|
struct arpreq {
|
||||||
struct sockaddr arp_pa; /* protocol address */
|
struct sockaddr arp_pa; /* protocol address */
|
||||||
struct sockaddr arp_ha; /* hardware address */
|
struct sockaddr arp_ha; /* hardware address */
|
||||||
int arp_flags; /* flags */
|
int arp_flags; /* flags */
|
||||||
struct sockaddr arp_netmask; /* netmask of protocol address */
|
struct sockaddr arp_netmask; /* netmask of protocol address */
|
||||||
char arp_dev[16];
|
char arp_dev[16];
|
||||||
};
|
};
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ Link with \-lm. The imaginary unit is represented by I.
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
/* check that exp(i * pi) == \-1 */
|
/* check that exp(i * pi) == \-1 */
|
||||||
#include <math.h> /* for atan */
|
#include <math.h> /* for atan */
|
||||||
#include <complex.h>
|
#include <complex.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
11
man7/ddp.7
11
man7/ddp.7
|
@ -58,16 +58,15 @@ a node number, and a port number.
|
||||||
.PP
|
.PP
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
.ta 4n 20n 32n
|
|
||||||
struct at_addr {
|
struct at_addr {
|
||||||
u_short s_net;
|
u_short s_net;
|
||||||
u_char s_node;
|
u_char s_node;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sockaddr_atalk {
|
struct sockaddr_atalk {
|
||||||
sa_family_t sat_family; /* address family */
|
sa_family_t sat_family; /* address family */
|
||||||
u_char sat_port; /* port */
|
u_char sat_port; /* port */
|
||||||
struct at_addr sat_addr; /* net/node */
|
struct at_addr sat_addr; /* net/node */
|
||||||
};
|
};
|
||||||
.ta
|
.ta
|
||||||
.fi
|
.fi
|
||||||
|
|
|
@ -90,7 +90,7 @@ definition. It allowed one to have patterns that expand into
|
||||||
an empty list, as in
|
an empty list, as in
|
||||||
.br
|
.br
|
||||||
.nf
|
.nf
|
||||||
xv \-wait 0 *.gif *.jpg
|
xv \-wait 0 *.gif *.jpg
|
||||||
.fi
|
.fi
|
||||||
where perhaps no *.gif files are present (and this is not
|
where perhaps no *.gif files are present (and this is not
|
||||||
an error).
|
an error).
|
||||||
|
@ -105,12 +105,12 @@ one can force the classical behaviour by setting
|
||||||
(Similar problems occur elsewhere. E.g., where old scripts have
|
(Similar problems occur elsewhere. E.g., where old scripts have
|
||||||
.br
|
.br
|
||||||
.nf
|
.nf
|
||||||
rm `find . \-name "*~"`
|
rm `find . \-name "*~"`
|
||||||
.fi
|
.fi
|
||||||
new scripts require
|
new scripts require
|
||||||
.br
|
.br
|
||||||
.nf
|
.nf
|
||||||
rm \-f nosuchfile `find . \-name "*~"`
|
rm \-f nosuchfile `find . \-name "*~"`
|
||||||
.fi
|
.fi
|
||||||
to avoid error messages from
|
to avoid error messages from
|
||||||
.I rm
|
.I rm
|
||||||
|
|
|
@ -44,12 +44,10 @@ recommendation X.121.
|
||||||
.PP
|
.PP
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
.ta 4n 18n 32n
|
|
||||||
struct sockaddr_x25 {
|
struct sockaddr_x25 {
|
||||||
sa_family_t sx25_family; /* must be AF_X25 */
|
sa_family_t sx25_family; /* must be AF_X25 */
|
||||||
x25_address sx25_addr; /* X.121 Address */
|
x25_address sx25_addr; /* X.121 Address */
|
||||||
};
|
};
|
||||||
.ta
|
|
||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
|
|
Loading…
Reference in New Issue