install library manpages
. harmonize bsd.lib.mk and bsd.man.mk with netbsd files . throw out minix section 3 (library calls) manpages, replaced by netbsd ones that are now installed
This commit is contained in:
parent
3919b46a4d
commit
39fea0a5b9
98 changed files with 777 additions and 10375 deletions
|
@ -7,12 +7,12 @@
|
|||
|
||||
SRCS+= md4c.c md5c.c md4hl.c md5hl.c
|
||||
|
||||
MAN+= md4.3 md5.3
|
||||
#MAN+= md4.3 md5.3
|
||||
|
||||
MLINKS+=md4.3 MD4Init.3 md4.3 MD4Update.3 md4.3 MD4Final.3
|
||||
MLINKS+=md4.3 MD4End.3 md4.3 MD4File.3 md4.3 MD4Data.3
|
||||
MLINKS+=md5.3 MD5Init.3 md5.3 MD5Update.3 md5.3 MD5Final.3
|
||||
MLINKS+=md5.3 MD5End.3 md5.3 MD5File.3 md5.3 MD5Data.3
|
||||
#MLINKS+=md4.3 MD4Init.3 md4.3 MD4Update.3 md4.3 MD4Final.3
|
||||
#MLINKS+=md4.3 MD4End.3 md4.3 MD4File.3 md4.3 MD4Data.3
|
||||
#MLINKS+=md5.3 MD5Init.3 md5.3 MD5Update.3 md5.3 MD5Final.3
|
||||
#MLINKS+=md5.3 MD5End.3 md5.3 MD5File.3 md5.3 MD5Data.3
|
||||
|
||||
CLEANFILES+= md[45]hl.c md[45].3
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.include <bsd.own.mk>
|
||||
|
||||
SUBDIR= man1 man1x man2 man3 man4 man5 man6 man7 man8 man9
|
||||
SUBDIR= man1 man1x man2 man4 man5 man6 man7 man8 man9
|
||||
|
||||
WHATISDBDIR?= /usr/man
|
||||
|
||||
|
|
|
@ -1,206 +0,0 @@
|
|||
MAN= abort.3 abs.3 assert.3 atof.3 bstring.3 configfile.3 \
|
||||
crypt.3 ctime.3 ctype.3 directory.3 dirname.3 \
|
||||
editline.3 end.3 execl.3 exit.3 fabs.3 fclose.3 \
|
||||
feholdexcept.3 ferror.3 fesetround.3 fnmatch.3 fopen.3 \
|
||||
fpclassify.3 fread.3 fseek.3 getaddrinfo.3 getc.3 getcontext.3 \
|
||||
getcwd.3 getdtablesize.3 getenv.3 getgrent.3 getloadavg.3 getlogin.3 \
|
||||
getopt.3 getopt_long.3 getpass.3 getpwent.3 getrlimit.3 \
|
||||
gets.3 getservent.3 getttyent.3 g_h_b_n.3 hton.3 int64.3 \
|
||||
islessgreater.3 ldexp.3 makecontext.3 malloc.3 nearbyint.3 newctime.3 \
|
||||
newstrftime.3 newtzset.3 oneC_sum.3 openpty.3 popen.3 \
|
||||
printf.3 putc.3 puts.3 qsort.3 rand.3 random.3 rcmd.3 \
|
||||
readv.3 realpath.3 regex.3 remainder.3 resolver.3 scanf.3 \
|
||||
servxcheck.3 setbuf.3 setjmp.3 sigset.3 sleep.3 stdarg.3 \
|
||||
stdio.3 string.3 strtol.3 syslog.3 system.3 termcap.3 \
|
||||
termios.3 time2posix.3 ttyname.3 ttyslot.3 ungetc.3 fetch.3 md5.3 \
|
||||
sha1.3
|
||||
|
||||
MLINKS += md5.3 MD5Init.3
|
||||
MLINKS += md5.3 MD5Update.3
|
||||
MLINKS += md5.3 MD5Final.3
|
||||
MLINKS += md5.3 MD5End.3
|
||||
MLINKS += md5.3 MD5File.3
|
||||
MLINKS += sha1.3 SHA1Update.3
|
||||
MLINKS += sha1.3 SHA1Init.3
|
||||
MLINKS += sha1.3 SHA1Final.3
|
||||
MLINKS += sha1.3 SHA1Transform.3
|
||||
MLINKS += sha1.3 SHA1End.3
|
||||
MLINKS += sha1.3 SHA1File.3
|
||||
MLINKS += atof.3 atoi.3
|
||||
MLINKS += bstring.3 bcopy.3
|
||||
MLINKS += bstring.3 bcmp.3
|
||||
MLINKS += bstring.3 bzero.3
|
||||
MLINKS += configfile.3 config_read.3
|
||||
MLINKS += configfile.3 config_delete.3
|
||||
MLINKS += configfile.3 config_renewed.3
|
||||
MLINKS += configfile.3 config_length.3
|
||||
MLINKS += configfile.3 config_issub.3
|
||||
MLINKS += configfile.3 config_isatom.3
|
||||
MLINKS += ctime.3 localtime.3
|
||||
MLINKS += ctime.3 difftime.3
|
||||
MLINKS += ctime.3 gmtime.3
|
||||
MLINKS += ctime.3 localtime.3
|
||||
MLINKS += ctype.3 isalpha.3
|
||||
MLINKS += ctype.3 isupper.3
|
||||
MLINKS += ctype.3 islower.3
|
||||
MLINKS += ctype.3 isdigit.3
|
||||
MLINKS += ctype.3 isxdigit.3
|
||||
MLINKS += ctype.3 isalnum.3
|
||||
MLINKS += ctype.3 isspace.3
|
||||
MLINKS += ctype.3 ispunct.3
|
||||
MLINKS += ctype.3 isprint.3
|
||||
MLINKS += ctype.3 isgraph.3
|
||||
MLINKS += ctype.3 iscntrl.3
|
||||
MLINKS += ctype.3 isascii.3
|
||||
MLINKS += ctype.3 toupper.3
|
||||
MLINKS += ctype.3 tolower.3
|
||||
MLINKS += directory.3 opendir.3
|
||||
MLINKS += directory.3 readdir.3
|
||||
MLINKS += directory.3 rewinddir.3
|
||||
MLINKS += directory.3 closedir.3
|
||||
MLINKS += directory.3 telldir.3
|
||||
MLINKS += end.3 etext.3
|
||||
MLINKS += execl.3 execv.3
|
||||
MLINKS += execl.3 execle.3
|
||||
MLINKS += execl.3 execlp.3
|
||||
MLINKS += execl.3 execvp.3
|
||||
MLINKS += execl.3 exec.3
|
||||
MLINKS += ferror.3 feof.3
|
||||
MLINKS += ferror.3 clearerr.3
|
||||
MLINKS += fopen.3 freopen.3
|
||||
MLINKS += fpclassify.3 isfinite.3
|
||||
MLINKS += fpclassify.3 isinf.3
|
||||
MLINKS += fpclassify.3 isnan.3
|
||||
MLINKS += fpclassify.3 isnormal.3
|
||||
MLINKS += fseek.3 fseeko.3
|
||||
MLINKS += fseek.3 ftell.3
|
||||
MLINKS += fseek.3 ftello.3
|
||||
MLINKS += g_h_b_n.3 gethostbyname.3
|
||||
MLINKS += g_h_b_n.3 gethostbyaddr.3
|
||||
MLINKS += g_h_b_n.3 gethostent.3
|
||||
MLINKS += g_h_b_n.3 sethostent.3
|
||||
MLINKS += g_h_b_n.3 endhostent.3
|
||||
MLINKS += getaddrinfo.3 freeaddrinfo.3
|
||||
MLINKS += getaddrinfo.3 gai_strerror.3
|
||||
MLINKS += getc.3 getchar.3
|
||||
MLINKS += getc.3 fgetc.3
|
||||
MLINKS += getgrent.3 getgrnam.3
|
||||
MLINKS += getgrent.3 getgrgid.3
|
||||
MLINKS += getgrent.3 setgrent.3
|
||||
MLINKS += getgrent.3 endgrent.3
|
||||
MLINKS += getpwent.3 getpwnam.3
|
||||
MLINKS += getpwent.3 getpwuid.3
|
||||
MLINKS += getpwent.3 setpwent.3
|
||||
MLINKS += getpwent.3 endpwent.3
|
||||
MLINKS += getservent.3 getservbyport.3
|
||||
MLINKS += getservent.3 getservbyname.3
|
||||
MLINKS += getservent.3 setservent.3
|
||||
MLINKS += getttyent.3 getttynam.3
|
||||
MLINKS += getttyent.3 setttyent.3
|
||||
MLINKS += hton.3 htons.3
|
||||
MLINKS += hton.3 htonl.3
|
||||
MLINKS += hton.3 ntohs.3
|
||||
MLINKS += int64.3 add64.3
|
||||
MLINKS += int64.3 add64u.3
|
||||
MLINKS += int64.3 add64ul.3
|
||||
MLINKS += int64.3 sub64.3
|
||||
MLINKS += int64.3 sub64u.3
|
||||
MLINKS += int64.3 sub64ul.3
|
||||
MLINKS += int64.3 diff64.3
|
||||
MLINKS += int64.3 bsr64.3
|
||||
MLINKS += int64.3 cvu64.3
|
||||
MLINKS += int64.3 cvul64.3
|
||||
MLINKS += int64.3 cv64u.3
|
||||
MLINKS += int64.3 cv64ul.3
|
||||
MLINKS += int64.3 div64.3
|
||||
MLINKS += int64.3 div64u.3
|
||||
MLINKS += int64.3 div64u64.3
|
||||
MLINKS += int64.3 rem64.3
|
||||
MLINKS += int64.3 rem64u.3
|
||||
MLINKS += int64.3 mul64.3
|
||||
MLINKS += int64.3 mul64u.3
|
||||
MLINKS += int64.3 cmp64.3
|
||||
MLINKS += int64.3 cmp64u.3
|
||||
MLINKS += int64.3 cmp64ul.3
|
||||
MLINKS += int64.3 ex64lo.3
|
||||
MLINKS += int64.3 ex64hi.3
|
||||
MLINKS += islessgreater.3 isgreater.3
|
||||
MLINKS += islessgreater.3 isgreaterequal.3
|
||||
MLINKS += islessgreater.3 isless.3
|
||||
MLINKS += islessgreater.3 islessequal.3
|
||||
MLINKS += ldexp.3 scalbn.3
|
||||
MLINKS += ldexp.3 scalbnf.3
|
||||
MLINKS += ldexp.3 scalbln.3
|
||||
MLINKS += malloc.3 free.3
|
||||
MLINKS += malloc.3 realloc.3
|
||||
MLINKS += malloc.3 calloc.3
|
||||
MLINKS += nearbyint.3 ceil.3
|
||||
MLINKS += nearbyint.3 floor.3
|
||||
MLINKS += printf.3 fprintf.3
|
||||
MLINKS += printf.3 sprintf.3
|
||||
MLINKS += printf.3 snprintf.3
|
||||
MLINKS += printf.3 vprintf.3
|
||||
MLINKS += printf.3 vfprintf.3
|
||||
MLINKS += printf.3 vsprintf.3
|
||||
MLINKS += putc.3 putchar.3
|
||||
MLINKS += putc.3 fputc.3
|
||||
MLINKS += random.3 srandom.3
|
||||
MLINKS += random.3 initstate.3
|
||||
MLINKS += rcmd.3 rresvport.3
|
||||
MLINKS += regex.3 regcomp.3
|
||||
MLINKS += regex.3 regexec.3
|
||||
MLINKS += regex.3 regerror.3
|
||||
MLINKS += resolver.3 res_query.3
|
||||
MLINKS += resolver.3 res_search.3
|
||||
MLINKS += resolver.3 res_mkquery.3
|
||||
MLINKS += resolver.3 res_send.3
|
||||
MLINKS += resolver.3 res_init.3
|
||||
MLINKS += resolver.3 dn_comp.3
|
||||
MLINKS += scanf.3 fscanf.3
|
||||
MLINKS += scanf.3 sscanf.3
|
||||
MLINKS += scanf.3 vscanf.3
|
||||
MLINKS += scanf.3 vfscanf.3
|
||||
MLINKS += setjmp.3 longjmp.3
|
||||
MLINKS += setjmp.3 _setjmp.3
|
||||
MLINKS += setjmp.3 _longjmp.3
|
||||
MLINKS += setjmp.3 sigsetjmp.3
|
||||
MLINKS += sigset.3 sigaddset.3
|
||||
MLINKS += sigset.3 sigdelset.3
|
||||
MLINKS += sigset.3 sigemptyset.3
|
||||
MLINKS += sigset.3 sigfillset.3
|
||||
MLINKS += string.3 strcat.3
|
||||
MLINKS += string.3 strncat.3
|
||||
MLINKS += string.3 strcmp.3
|
||||
MLINKS += string.3 strncmp.3
|
||||
MLINKS += string.3 strcpy.3
|
||||
MLINKS += string.3 strncpy.3
|
||||
MLINKS += string.3 strlen.3
|
||||
MLINKS += string.3 strchr.3
|
||||
MLINKS += string.3 strrchr.3
|
||||
MLINKS += string.3 strerror.3
|
||||
MLINKS += string.3 memcmp.3
|
||||
MLINKS += string.3 memcpy.3
|
||||
MLINKS += string.3 memmove.3
|
||||
MLINKS += string.3 memchr.3
|
||||
MLINKS += string.3 memset.3
|
||||
MLINKS += string.3 index.3
|
||||
MLINKS += strtol.3 strtoll.3
|
||||
MLINKS += strtol.3 strtoul.3
|
||||
MLINKS += syslog.3 openlog.3
|
||||
MLINKS += termcap.3 tgetent.3
|
||||
MLINKS += termcap.3 tgetnum.3
|
||||
MLINKS += termcap.3 tgetflag.3
|
||||
MLINKS += termcap.3 tgetstr.3
|
||||
MLINKS += termcap.3 tgoto.3
|
||||
MLINKS += termios.3 tcgetattr.3
|
||||
MLINKS += termios.3 tcsetattr.3
|
||||
MLINKS += termios.3 cfgetispeed.3
|
||||
MLINKS += termios.3 cfgetospeed.3
|
||||
MLINKS += termios.3 cfsetispeed.3
|
||||
MLINKS += termios.3 cfsetospeed.3
|
||||
MLINKS += termios.3 tcsendbreak.3
|
||||
MLINKS += termios.3 tcdrain.3
|
||||
MLINKS += termios.3 tcflush.3
|
||||
|
||||
.include <bsd.man.mk>
|
||||
.include <bsd.subdir.mk>
|
|
@ -1,27 +0,0 @@
|
|||
.\" @(#)abort.3 6.3 (Berkeley) 5/27/86
|
||||
.\"
|
||||
.TH ABORT 3 "May 27, 1986"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
abort \- generate a fault
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdlib.h>
|
||||
|
||||
void abort(void)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Abort
|
||||
executes an instruction which is illegal in user mode.
|
||||
This causes a signal that normally terminates
|
||||
the process with a core dump, which may be used for debugging.
|
||||
.SH SEE ALSO
|
||||
.BR sigaction (2),
|
||||
.BR exit (2).
|
||||
.SH DIAGNOSTICS
|
||||
Usually ``abort \- core dumped'' from the shell.
|
||||
.SH BUGS
|
||||
The abort() function does not flush standard I/O buffers. Use
|
||||
.BR fflush (3).
|
|
@ -1,24 +0,0 @@
|
|||
.\" @(#)abs.3 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH ABS 3 "May 15, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
abs \- integer absolute value
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdlib.h>
|
||||
|
||||
int abs(int \fIi\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Abs
|
||||
returns the absolute value of its integer operand.
|
||||
.SH SEE ALSO
|
||||
.BR floor (3).
|
||||
.SH BUGS
|
||||
Applying the \fIabs\fP function to the most negative integer generates a
|
||||
result which is the most negative integer. That is, abs(0x80000000)
|
||||
returns 0x80000000 as a result on a machine with 32-bit ints. Using the
|
||||
result in unsigned computations is sound however.
|
|
@ -1,42 +0,0 @@
|
|||
.\" @(#)assert.3 6.2 (Berkeley) 5/12/86
|
||||
.\"
|
||||
.TH ASSERT 3 "May 12, 1986"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
assert \- program verification
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <assert.h>
|
||||
|
||||
void assert(int \fIexpression\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Assert
|
||||
is a macro that indicates
|
||||
.I expression
|
||||
is expected to be true at this point in the program.
|
||||
It causes an
|
||||
.BR abort (3)
|
||||
with a diagnostic comment on the standard output when
|
||||
.I expression
|
||||
is false (0).
|
||||
Compiling with the
|
||||
.BR cc (1)
|
||||
option
|
||||
.SM
|
||||
.B \-DNDEBUG
|
||||
effectively deletes
|
||||
.B assert
|
||||
from the program.
|
||||
.SH DIAGNOSTICS
|
||||
`Assertion "\fIexpression\fR" failed: file
|
||||
.I f
|
||||
line
|
||||
.IR n .'
|
||||
.I F
|
||||
is the source file and
|
||||
.I n
|
||||
the source line number of the
|
||||
.B assert
|
||||
statement.
|
|
@ -1,39 +0,0 @@
|
|||
.\" @(#)atof.3 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH ATOF 3 "May 15, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
atof, atoi, atol \- convert ASCII to numbers
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdlib.h>
|
||||
|
||||
double atof(const char *\fInptr\fP)
|
||||
int atoi(const char *\fInptr\fP)
|
||||
long atol(const char *\fInptr\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These functions convert a string pointed to by
|
||||
.I nptr
|
||||
to floating, integer, and long integer representation respectively.
|
||||
The first unrecognized character ends the string.
|
||||
.PP
|
||||
.B Atof
|
||||
recognizes an optional string of spaces, then an optional sign, then
|
||||
a string of digits optionally containing a decimal
|
||||
point, then an optional `e' or `E' followed by an optionally signed integer.
|
||||
.PP
|
||||
.B Atoi
|
||||
and
|
||||
.B atol
|
||||
recognize an optional string of spaces, then an optional sign, then a
|
||||
string of
|
||||
digits.
|
||||
.SH SEE ALSO
|
||||
.BR strtol (3),
|
||||
.BR strtod (3),
|
||||
.BR scanf (3).
|
||||
.SH BUGS
|
||||
There are no provisions for overflow.
|
|
@ -1,84 +0,0 @@
|
|||
.\" Copyright (c) 1983 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)bstring.3 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH BSTRING 3 "May 15, 1985"
|
||||
.UC 5
|
||||
.SH NAME
|
||||
bstring, bcopy, bcmp, bzero, ffs \- bit and byte string operations
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void bcopy(const void *\fIsrc\fP, void *\fIdst\fP, size_t \fIlength\fP)
|
||||
int bcmp(const void *\fIb1\fP, const void *\fIb2\fP, size_t \fIlength\fP)
|
||||
void bzero(void *\fIdst\fP, size_t \fIlength\fP)
|
||||
int ffs(int \fIi\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The functions
|
||||
.BR bcopy ,
|
||||
.BR bcmp ,
|
||||
and
|
||||
.B bzero
|
||||
operate on variable length strings of bytes.
|
||||
They do not check for null bytes as the routines in
|
||||
.BR string (3)
|
||||
do.
|
||||
.PP
|
||||
.B Bcopy
|
||||
copies
|
||||
.I length
|
||||
bytes from string
|
||||
.I src
|
||||
to the string
|
||||
.IR dst .
|
||||
.PP
|
||||
.B Bcmp
|
||||
compares byte string
|
||||
.I b1
|
||||
against byte string
|
||||
.IR b2 ,
|
||||
returning zero if they are identical,
|
||||
non-zero otherwise. Both strings are
|
||||
assumed to be
|
||||
.I length
|
||||
bytes long.
|
||||
.PP
|
||||
.B Bzero
|
||||
places
|
||||
.I length
|
||||
0 bytes in the string
|
||||
.IR b1 .
|
||||
.PP
|
||||
.B Ffs
|
||||
find the first bit set in the argument passed it and
|
||||
returns the index of that bit. Bits are numbered
|
||||
starting at 1. A return value of 0 indicates the
|
||||
value passed is zero.
|
||||
.SH BUGS
|
||||
The
|
||||
.BR bcopy ,
|
||||
.BR bcmp ,
|
||||
and
|
||||
.BR bzero
|
||||
functions are obsolete; new code should use
|
||||
.BR memmove ,
|
||||
.BR memcmp ,
|
||||
and
|
||||
.BR memset
|
||||
respectively.
|
||||
.PP
|
||||
The
|
||||
.B bcopy
|
||||
routine takes parameters backwards from
|
||||
.BR memcpy ,
|
||||
.BR memmove ,
|
||||
and
|
||||
.BR strcpy .
|
|
@ -1,194 +0,0 @@
|
|||
.TH CONFIGFILE 3
|
||||
.SH NAME
|
||||
configfile, config_read, config_delete, config_renewed, config_length, config_issub, config_isatom, config_isstring \- generic configuration file functions
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
.nf
|
||||
#include <configfile.h>
|
||||
|
||||
config_t *config_read(const char *\fIfile\fP, int \fIflags\fP, config_t *\fIcfg\fP)
|
||||
void config_delete(config_t *\fIcfg\fP)
|
||||
int config_renewed(config_t *\fIcfg\fP)
|
||||
size_t config_length(config_t *\fIcfg\fP)
|
||||
int config_issub(config_t *\fIcfg\fP)
|
||||
int config_isatom(config_t *\fIcfg\fP)
|
||||
int config_isstring(config_t *\fIcfg\fP)
|
||||
.fi
|
||||
.ft P
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B configfile
|
||||
routines operate on a generic configuration file that follows the syntax
|
||||
described in
|
||||
.BR configfile (5).
|
||||
.PP
|
||||
The interface presented by the functions above uses the following type and
|
||||
definitions from <configfile.h>:
|
||||
.PP
|
||||
.if n .in +2
|
||||
.if t .RS
|
||||
.nf
|
||||
.ta +\w'type'u +\w'const charmm'u +\w'word[];mm'u
|
||||
typedef const struct config {
|
||||
config_t *next; /* Next configuration file thing. */
|
||||
config_t *list; /* For a { sublist }. */
|
||||
const char *file; /* File and line where this is found. */
|
||||
unsigned line;
|
||||
int flags; /* Special flags. */
|
||||
char word[]; /* Payload. */
|
||||
} config_t;
|
||||
|
||||
.ta +\w'#definem'u +\w'CFG_SUBLISTm'u +\w'0x0000mm'u
|
||||
#define CFG_CLONG 0x0001 /* strtol(word, &end, 0) is valid. */
|
||||
#define CFG_OLONG 0x0002 /* strtol(word, &end, 010). */
|
||||
#define CFG_DLONG 0x0004 /* strtol(word, &end, 10). */
|
||||
#define CFG_XLONG 0x0008 /* strtol(word, &end, 0x10). */
|
||||
#define CFG_CULONG 0x0010 /* strtoul(word, &end, 0). */
|
||||
#define CFG_OULONG 0x0020 /* strtoul(word, &end, 010). */
|
||||
#define CFG_DULONG 0x0040 /* strtoul(word, &end, 10). */
|
||||
#define CFG_XULONG 0x0080 /* strtoul(word, &end, 0x10). */
|
||||
#define CFG_STRING 0x0100 /* The word is enclosed in quotes. */
|
||||
#define CFG_SUBLIST 0x0200 /* This is a sublist, so no word. */
|
||||
#define CFG_ESCAPED 0x0400 /* Escapes are still marked with \e. */
|
||||
.fi
|
||||
.if n .in -2
|
||||
.if t .RE
|
||||
.PP
|
||||
In memory a configuration file is represented as a list of
|
||||
.B config_t
|
||||
cells linked together with the
|
||||
.B next
|
||||
field ending with a null pointer. A sublist between braces is attached to a
|
||||
cell at the
|
||||
.B list
|
||||
field.
|
||||
Words and strings are put in the
|
||||
.B word
|
||||
field, a null terminated string. The
|
||||
.B flags
|
||||
field records the type and features of a cell. The
|
||||
.B CFG_*LONG
|
||||
flags are set if a word is a number according to one of the
|
||||
.B strtol
|
||||
or
|
||||
.B strtoul
|
||||
calls. Purely a number, no quotes or trailing garbage. The
|
||||
.B CFG_STRING
|
||||
flag is set if the object was enclosed in double quotes. Lastly
|
||||
.B CFG_SUBLIST
|
||||
tells if the cell is only a pointer to a sublist in braces.
|
||||
.PP
|
||||
Characters in a word or string may have been formed with the
|
||||
.B \e
|
||||
escape character. They have been parsed and expanded, but the \e is still
|
||||
present if
|
||||
.B CFG_ESCAPED
|
||||
is set. The
|
||||
.B word
|
||||
array may be changed, as long as it doesn't grow longer, so one may remove
|
||||
the \es like this:
|
||||
.PP
|
||||
.RS
|
||||
.ta +4n +4n
|
||||
.nf
|
||||
if (cfg->flags & CFG_ESCAPED) {
|
||||
char *p, *q;
|
||||
p= q= cfg->word;
|
||||
for (;;) {
|
||||
if ((*q = *p) == '\e\e') *q = *++p;
|
||||
if (*q == 0) break;
|
||||
p++;
|
||||
q++;
|
||||
}
|
||||
}
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The low level syntax of a config file is checked when it is read. If an
|
||||
error is encountered a message is printed and the program exits with exit
|
||||
code 1. What the data means is not checked, that
|
||||
should be done by the program using the data. Only the atom
|
||||
.B include
|
||||
at the beginning of a list is special. It should be followed by a string.
|
||||
The string is seen as the name of a file, that is opened, read, and inserted
|
||||
in place of the
|
||||
.BR include .
|
||||
Unless the name of the file starts with a
|
||||
.BR / ,
|
||||
it is sought relative to the directory the current file is found in.
|
||||
Nonexistent files are treated as being empty.
|
||||
.PP
|
||||
The
|
||||
.B file
|
||||
and
|
||||
.B line
|
||||
fields in each cell tell where the cell was read.
|
||||
.SS Functions
|
||||
A configuration file is read with
|
||||
.BR config_read .
|
||||
The first argument is the file to read. The second is either
|
||||
.B 0
|
||||
or
|
||||
.B CFG_ESCAPED
|
||||
to tell whether \e escapes should be fully expanded without leaving a trace,
|
||||
or if they should still be marked with a \e so that the caller knows where
|
||||
the excapes are.
|
||||
The third argument,
|
||||
.IR cfg ,
|
||||
should be a null pointer on the first call. If you want to reread a config
|
||||
file that may have changed then
|
||||
.I cfg
|
||||
should be what you previously read.
|
||||
.PP
|
||||
With
|
||||
.B config_delete
|
||||
one can free up the memory that has been acquired with
|
||||
.BR malloc (3)
|
||||
to hold the contents of the configuration file.
|
||||
.PP
|
||||
To determine if the contents of configuration file has changed when reread
|
||||
one uses
|
||||
.BR config_renewed
|
||||
after
|
||||
.BR config_read .
|
||||
It returns a "changed" flag that is set when the configuration file changed
|
||||
and then clears that flag. It returns true on the very first call. For the
|
||||
function to work you need to feed the old data back into
|
||||
.BR config_read ,
|
||||
not delete and reread.
|
||||
.PP
|
||||
The length of a series of config structures is told by
|
||||
.BR config_length .
|
||||
It follows the
|
||||
.B next
|
||||
fields, so a sublist between braces counts as one extra.
|
||||
.PP
|
||||
The
|
||||
.BR config_issub ,
|
||||
.BR config_isatom
|
||||
and
|
||||
.BR config_isstring
|
||||
functions are just pretty macros to test if a cell references a sublist, is
|
||||
a word/string, or is just a string.
|
||||
.B CFG_SUBLIST
|
||||
and
|
||||
.B CFG_STRING
|
||||
tell the same story.
|
||||
.SH FILES
|
||||
.TP \w'*/etc/*.confmmmm'u
|
||||
.B */etc/*.conf
|
||||
Several files in several
|
||||
.B etc
|
||||
directories.
|
||||
.SH "SEE ALSO"
|
||||
.BR configfile (5).
|
||||
.SH NOTES
|
||||
The syntax of a config file puts some constraints on what you find in memory.
|
||||
The top level list consists entirely of sublist cells. These point to lists
|
||||
that start with at least an atom, followed by a mix of atoms and sublist cells.
|
||||
These sublists in turn point to a list of only sublist cells (recurse now.)
|
||||
.PP
|
||||
The struct config shown above is not exactly proper C to aid
|
||||
readability, read <configfile.h> itself to see why.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
|
@ -1,71 +0,0 @@
|
|||
.TH CRYPT 3
|
||||
.SH NAME
|
||||
crypt \- one-way password encryption function
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
.nf
|
||||
#define _MINIX_SOURCE 1
|
||||
#include <unistd.h>
|
||||
|
||||
char *crypt(const char *\fIkey\fP, const char *\fIsalt\fP)
|
||||
.fi
|
||||
.ft P
|
||||
.SH DESCRIPTION
|
||||
The first use of
|
||||
.B crypt()
|
||||
is to encrypt a password. Its second use is to authenticate a shadow
|
||||
password. In both cases
|
||||
.B crypt()
|
||||
calls
|
||||
.BR pwdauth (8)
|
||||
to do the real work.
|
||||
.PP
|
||||
.B Crypt()
|
||||
encrypts a password if called with a user typed key, and a salt
|
||||
whose first two characters are in the set [./0-9A-Za-z]. The result is a
|
||||
character string in the [./0-9A-Za-z] alphabet of which the first two
|
||||
characters are equal to the salt, and the rest is the result of encrypting
|
||||
the key and the salt.
|
||||
.PP
|
||||
If
|
||||
.B crypt()
|
||||
is called with a salt that has the form
|
||||
.BI "##" user
|
||||
then the key is encrypted and compared to the encrypted password of
|
||||
.I user
|
||||
in the shadow password file. If they are equal then
|
||||
.B crypt()
|
||||
returns the
|
||||
.BI "##" user
|
||||
argument, if not then some other string is returned. This trick assures
|
||||
that the normal way to authenticate a password still works:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
if (strcmp(pw->pw_passwd, crypt(key, pw->pw_passwd))) ...
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
If
|
||||
.I key
|
||||
is a null string, and the shadow password is a null string or the salt is a
|
||||
null string then the result equals
|
||||
.IR salt .
|
||||
(This is because the caller can't tell if a password field is empty in the
|
||||
shadow password file.)
|
||||
.PP
|
||||
The key and salt are limited to 1024 bytes total including the null bytes.
|
||||
.SH FILES
|
||||
.TP 25
|
||||
/usr/lib/pwdauth
|
||||
The password authentication program
|
||||
.SH "SEE ALSO"
|
||||
.BR getpass (3),
|
||||
.BR getpwent (3),
|
||||
.BR passwd (5),
|
||||
.BR pwdauth (8).
|
||||
.SH NOTES
|
||||
The result of an encryption is returned in a static array that is
|
||||
overwritten by each call. The return value should not be modified.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
109
man/man3/ctime.3
109
man/man3/ctime.3
|
@ -1,109 +0,0 @@
|
|||
.\" Copyright (c) 1980 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)ctime.3 6.8 (Berkeley) 4/2/87
|
||||
.\"
|
||||
.TH CTIME 3 "April 2, 1987"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
ctime, localtime, gmtime, asctime, tzset \- convert date and time to ASCII
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
|
||||
void tzset(void)
|
||||
char *ctime(const time_t *\fIclock\fP)
|
||||
char *asctime(const struct tm *\fItm\fP)
|
||||
struct tm *localtime(const time_t *\fIclock\fP)
|
||||
struct tm *gmtime(const time_t *\fIclock\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
\fBTzset\fP uses the value of the environment variable \fBTZ\fP to
|
||||
set up the time conversion information used by \fBlocaltime\fP.
|
||||
.PP
|
||||
If \fBTZ\fP does not appear in the environment, the \fBTZDEFAULT\fP
|
||||
file (as defined in \fI<tzfile.h>\fP) is used by \fBlocaltime\fP. If
|
||||
this file fails for any reason, the GMT offset as provided by the
|
||||
kernel is used. In this case, DST is ignored, resulting in the time
|
||||
being incorrect by some amount if DST is currently in effect. If
|
||||
this fails for any reason, GMT is used.
|
||||
.PP
|
||||
If \fBTZ\fP appears in the environment but its value is a null string,
|
||||
Greenwich Mean Time is used; if \fBTZ\fP appears and begins with a
|
||||
slash, it is used as the absolute pathname of the \fBtzfile\fP(5)-format
|
||||
file from which to read the time conversion information; if \fBTZ\fP
|
||||
appears and begins with a character other than a slash, it's used as
|
||||
a pathname relative to the system time conversion information directory,
|
||||
defined as \fBTZDIR\fP in the include file \fBtzfile.h\fP. If this file
|
||||
fails for any reason, the GMT offset as provided by the kernel is
|
||||
used, as described above. If this fails for any reason, GMT is used.
|
||||
See
|
||||
.BR TZ (5)
|
||||
for a proper description of the
|
||||
.B TZ
|
||||
variable.
|
||||
.PP
|
||||
\fBCtime\fP converts a time value, pointed to by \fIclock\fP,
|
||||
such as returned by \fBtime\fP(2) into ASCII and returns a pointer
|
||||
to a 26-character string in the following form. All the fields
|
||||
have constant width.
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
Sun Sep 16 01:03:52 1973\en\e0
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
.B Localtime
|
||||
and
|
||||
.B gmtime
|
||||
return pointers to structures containing
|
||||
the broken-down time.
|
||||
.B Localtime
|
||||
corrects for the time zone and possible daylight savings time;
|
||||
.B gmtime
|
||||
converts directly to GMT, which is the time UNIX uses.
|
||||
.B Asctime
|
||||
converts a broken-down time to ASCII and returns a pointer
|
||||
to a 26-character string.
|
||||
.PP
|
||||
The structure declaration from the include file is:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
.nr .0 .8i+\w'int tm_isdst'u
|
||||
.ta .5i \n(.0u \n(.0u+\w'/* 0-000'u+1n
|
||||
struct tm {
|
||||
int tm_sec; /* 0-59 seconds */
|
||||
int tm_min; /* 0-59 minutes */
|
||||
int tm_hour; /* 0-23 hour */
|
||||
int tm_mday; /* 1-31 day of month */
|
||||
int tm_mon; /* 0-11 month */
|
||||
int tm_year; /* 0- year \- 1900 */
|
||||
int tm_wday; /* 0-6 day of week (Sunday = 0) */
|
||||
int tm_yday; /* 0-365 day of year */
|
||||
int tm_isdst; /* flag: daylight savings time in effect */
|
||||
};
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBTm_isdst\fP is non-zero if a time zone adjustment such as Daylight
|
||||
Savings time is in effect.
|
||||
.SH FILES
|
||||
.ta \w'/usr/lib/zoneinfo\0\0'u
|
||||
/usr/lib/zoneinfo time zone information directory
|
||||
.br
|
||||
/etc/localtime local time zone file
|
||||
.SH SEE ALSO
|
||||
.BR time (2),
|
||||
.BR getenv (3),
|
||||
.BR tzfile (5),
|
||||
.BR TZ (5),
|
||||
.BR environ (7),
|
||||
.BR zic (8).
|
||||
.SH NOTE
|
||||
The return values point to static data whose content is overwritten by
|
||||
each call.
|
|
@ -1,95 +0,0 @@
|
|||
.\" @(#)ctype.3 6.4 (Berkeley) 5/12/86
|
||||
.\"
|
||||
.TH CTYPE 3 "May 12, 1986"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
ctype, isalpha, isupper, islower, isdigit, isxdigit, isalnum, isspace, ispunct, isprint, isgraph, iscntrl, isascii, toupper, tolower, toascii \- character classification macros
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <ctype.h>
|
||||
|
||||
int isalpha(int \fIc\fP)
|
||||
\&...
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These macros classify characters
|
||||
by table lookup.
|
||||
Each is a predicate returning nonzero for true,
|
||||
zero for false.
|
||||
.B Isascii
|
||||
and
|
||||
.B toascii
|
||||
are defined on all integer values; the rest
|
||||
are defined only on the range of
|
||||
.B "unsigned char"
|
||||
and on the special value
|
||||
EOF (see
|
||||
.BR stdio (3)).
|
||||
.TP 15n
|
||||
.B isalpha
|
||||
.I c
|
||||
is a letter
|
||||
.TP
|
||||
.B isupper
|
||||
.I c
|
||||
is an upper case letter
|
||||
.TP
|
||||
.B islower
|
||||
.I c
|
||||
is a lower case letter
|
||||
.TP
|
||||
.B isdigit
|
||||
.I c
|
||||
is a digit
|
||||
.TP
|
||||
.B isxdigit
|
||||
.I c
|
||||
is a hex digit
|
||||
.TP
|
||||
.B isalnum
|
||||
.I c
|
||||
is an alphanumeric character
|
||||
.TP
|
||||
.B isspace
|
||||
.I c
|
||||
is a space, tab, carriage return, newline, vertical tab, or formfeed
|
||||
.TP
|
||||
.B ispunct
|
||||
.I c
|
||||
is a punctuation character (neither control nor alphanumeric)
|
||||
.TP
|
||||
.B isprint
|
||||
.I c
|
||||
is a printing character, code 040(8) (space) through 0176 (tilde)
|
||||
.TP
|
||||
.B isgraph
|
||||
.I c
|
||||
is a printing character, similar to
|
||||
.B isprint
|
||||
except false for space.
|
||||
.TP
|
||||
.B iscntrl
|
||||
.I c
|
||||
is a delete character (0177) or ordinary control character
|
||||
(less than 040).
|
||||
.TP
|
||||
.B isascii
|
||||
.I c
|
||||
is an ASCII character, code less than 0200
|
||||
.TP
|
||||
.B tolower
|
||||
.I c
|
||||
is converted to lower case. Return value is undefined if not
|
||||
.BR isupper (\fIc\fR).
|
||||
.TP
|
||||
.B toupper
|
||||
.I c
|
||||
is converted to upper case. Return value is undefined if not
|
||||
.BR islower (\fIc\fR).
|
||||
.TP
|
||||
.B toascii
|
||||
.I c
|
||||
is converted to be a valid ascii character.
|
||||
.SH "SEE ALSO"
|
||||
.BR ascii (7)
|
|
@ -1,89 +0,0 @@
|
|||
.TH DIRECTORY 3
|
||||
.SH NAME
|
||||
directory, opendir, readdir, rewinddir, closedir, telldir, seekdir \- directory routines
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
DIR *opendir(const char *\fIdirname\fP)
|
||||
struct dirent *readdir(DIR *\fIdirp\fP)
|
||||
void rewinddir(DIR *\fIdirp\fP)
|
||||
int closedir(DIR *\fIdirp\fP)
|
||||
|
||||
#define _MINIX 1
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
long telldir(DIR *\fIdirp\fP)
|
||||
int seekdir(DIR *\fIdirp\fP, long \fIpos\fP)
|
||||
.SH DESCRIPTION
|
||||
These routines form a system independent interface to access directories.
|
||||
.PP
|
||||
.B Opendir()
|
||||
opens the directory
|
||||
.I dirname
|
||||
and returns a pointer to this open directory stream.
|
||||
.PP
|
||||
.B Readdir()
|
||||
reads one entry from the directory as a pointer to a structure containing
|
||||
the field
|
||||
.BR d_name ,
|
||||
a character array containing the null-terminated name of the entry.
|
||||
.PP
|
||||
.B Rewinddir()
|
||||
allows the directory to be read again from the beginning.
|
||||
.PP
|
||||
.B Closedir()
|
||||
closes the directory and releases administrative data.
|
||||
.PP
|
||||
The MINIX 3 specific functions
|
||||
.B telldir()
|
||||
and
|
||||
.B seekdir()
|
||||
allow one to get the current position in the directory file and to return
|
||||
there later.
|
||||
.B Seekdir()
|
||||
may only be called with a position returned by
|
||||
.B telldir()
|
||||
or 0 (rewind). These functions should not be used in portable programs.
|
||||
.SH "SEE ALSO"
|
||||
.BR dir (5).
|
||||
.SH DIAGNOSTICS
|
||||
.B Opendir()
|
||||
returns a null pointer if
|
||||
.I dirname
|
||||
can't be opened, or if it can't allocate enough memory for the
|
||||
.B DIR
|
||||
structure.
|
||||
.PP
|
||||
.B Readdir()
|
||||
returns null if there are no more directory entries or on error.
|
||||
.PP
|
||||
.B Closedir()
|
||||
and
|
||||
.B seekdir()
|
||||
returns 0 on success, -1 on error.
|
||||
.PP
|
||||
.B Telldir()
|
||||
returns -1 on error.
|
||||
.PP
|
||||
All of them set
|
||||
.B errno
|
||||
appropriately.
|
||||
.B Readdir()
|
||||
will only set
|
||||
.B errno
|
||||
on error, not on end-of-dir, so you should set
|
||||
.B errno
|
||||
to zero beforehand, and check its value if
|
||||
.B readdir()
|
||||
returns null.
|
||||
.SH NOTES
|
||||
The return value of
|
||||
.B readdir()
|
||||
needs to be copied before the next operation on the same directory if it is
|
||||
to be saved.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
|
@ -1,19 +0,0 @@
|
|||
.TH DIRNAME 3
|
||||
.SH NAME
|
||||
dirname \- determine name of containing directory
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <libgen.h>
|
||||
|
||||
char *dirname(char *\fIpath\fP);
|
||||
.SH DESCRIPTION
|
||||
The dirname function returns the name of the directory containing \fIpath\fP.
|
||||
If the path does not contain slashes, the string "." is returned. Trailing
|
||||
slashes are ignored.
|
||||
.SH "SEE ALSO"
|
||||
.BR basename (3).
|
||||
.SH NOTES
|
||||
This function may, but need not, overwrite the buffer passed to it.
|
||||
Although MINIX' implementation of this function is re-entrant, POSIX does not
|
||||
guarantee this property and portable programs should not rely on it.
|
|
@ -1,168 +0,0 @@
|
|||
.TH EDITLINE 3
|
||||
.SH NAME
|
||||
editline \- command-line editing library with history
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
char *readline(char *\fIprompt\fP)
|
||||
.ft P
|
||||
.SH DESCRIPTION
|
||||
.I Editline
|
||||
is a library that provides an line-editing interface with text recall.
|
||||
It is intended to be compatible with the
|
||||
.I readline
|
||||
library provided by the Free Software Foundation, but much smaller.
|
||||
The bulk of this manual page describes the user interface.
|
||||
.PP
|
||||
The
|
||||
.I readline
|
||||
routine returns a line of text with the trailing newline removed.
|
||||
The data is returned in a buffer allocated with
|
||||
.IR malloc (3),
|
||||
so the space should be released with
|
||||
.IR free (3)
|
||||
when the calling program is done with it.
|
||||
Before accepting input from the user, the specified
|
||||
.I prompt
|
||||
is displayed on the terminal.
|
||||
.PP
|
||||
Each line returned is copied to the internal history list, unless it happens
|
||||
to be equal to the previous line.
|
||||
.SS "User Interface"
|
||||
A program that uses this library provides a simple emacs-like editing
|
||||
interface to its users.
|
||||
A line may be edited before it is sent to the calling program by typing either
|
||||
control characters or escape sequences.
|
||||
A control character, shown as a caret followed by a letter, is typed by
|
||||
holding down the ``control'' key while the letter is typed.
|
||||
For example, ``^A'' is a control-A.
|
||||
An escape sequence is entered by typing the ``escape'' key followed by one or
|
||||
more characters.
|
||||
The escape key is abbreviated as ``ESC.''
|
||||
Note that unlike control keys, case matters in escape sequences; ``ESC\ F''
|
||||
is not the same as ``ESC\ f''.
|
||||
.PP
|
||||
An editing command may be typed anywhere on the line, not just at the
|
||||
beginning.
|
||||
In addition, a return may also be typed anywhere on the line, not just at
|
||||
the end.
|
||||
.PP
|
||||
Most editing commands may be given a repeat count,
|
||||
.IR n ,
|
||||
where
|
||||
.I n
|
||||
is a number.
|
||||
To enter a repeat count, type the escape key, the number, and then
|
||||
the command to execute.
|
||||
For example, ``ESC\ 4\ ^f'' moves forward four characters.
|
||||
If a command may be given a repeat count then the text ``[n]'' is given at the
|
||||
end of its description.
|
||||
.PP
|
||||
The following control characters are accepted:
|
||||
.RS
|
||||
.nf
|
||||
.ta \w'ESC DEL 'u
|
||||
^A Move to the beginning of the line
|
||||
^B Move left (backwards) [n]
|
||||
^D Delete character [n]
|
||||
^E Move to end of line
|
||||
^F Move right (forwards) [n]
|
||||
^G Ring the bell
|
||||
^H Delete character before cursor (backspace key) [n]
|
||||
^I Complete filename (tab key); see below
|
||||
^J Done with line (return key)
|
||||
^K Kill to end of line (or column [n])
|
||||
^L Redisplay line
|
||||
^M Done with line (alternate return key)
|
||||
^N Get next line from history [n]
|
||||
^P Get previous line from history [n]
|
||||
^R Search backward (forward if [n]) through history for text;
|
||||
\& must start line if text begins with an uparrow
|
||||
^T Transpose characters
|
||||
^V Insert next character, even if it is an edit command
|
||||
^W Wipe to the mark
|
||||
^X^X Exchange current location and mark
|
||||
^Y Yank back last killed text
|
||||
^[ Start an escape sequence (escape key)
|
||||
^]c Move forward to next character ``c''
|
||||
^? Delete character before cursor (delete key) [n]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The following escape sequences are provided.
|
||||
.RS
|
||||
.nf
|
||||
.ta \w'ESC DEL 'u
|
||||
ESC\ ^H Delete previous word (backspace key) [n]
|
||||
ESC\ DEL Delete previous word (delete key) [n]
|
||||
ESC\ SP Set the mark (space key); see ^X^X and ^Y above
|
||||
ESC\ \. Get the last (or [n]'th) word from previous line
|
||||
ESC\ ? Show possible completions; see below
|
||||
ESC\ < Move to start of history
|
||||
ESC\ > Move to end of history
|
||||
ESC\ b Move backward a word [n]
|
||||
ESC\ d Delete word under cursor [n]
|
||||
ESC\ f Move forward a word [n]
|
||||
ESC\ l Make word lowercase [n]
|
||||
ESC\ m Toggle if 8bit chars display normally or with ``M\-'' prefix
|
||||
ESC\ u Make word uppercase [n]
|
||||
ESC\ y Yank back last killed text
|
||||
ESC\ v Show library version
|
||||
ESC\ w Make area up to mark yankable
|
||||
ESC\ nn Set repeat count to the number nn
|
||||
ESC\ C Read from environment variable ``_C_'', where C is
|
||||
\& an uppercase letter
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The
|
||||
.I editline
|
||||
library has a small macro facility.
|
||||
If you type the escape key followed by an uppercase letter,
|
||||
.IR C ,
|
||||
then the contents of the environment variable
|
||||
.I _C_
|
||||
are read in as if you had typed them at the keyboard.
|
||||
For example, if the variable
|
||||
.I _L_
|
||||
contains the following:
|
||||
.RS
|
||||
^A^Kecho '^V^[[H^V^[[2J'^M
|
||||
.RE
|
||||
Then typing ``ESC L'' will move to the beginning of the line, kill the
|
||||
entire line, enter the echo command needed to clear the terminal (if your
|
||||
terminal is like a VT-100), and send the line back to the shell.
|
||||
.PP
|
||||
The
|
||||
.I editline
|
||||
library also does filename completion.
|
||||
Suppose the root directory has the following files in it:
|
||||
.RS
|
||||
.nf
|
||||
.ta \w'core 'u
|
||||
bin vmunix
|
||||
core vmunix.old
|
||||
.fi
|
||||
.RE
|
||||
If you type ``rm\ /v'' and then the tab key.
|
||||
.I Editline
|
||||
will then finish off as much of the name as possible by adding ``munix''.
|
||||
Because the name is not unique, it will then beep.
|
||||
If you type the escape key and a question mark, it will display the
|
||||
two choices.
|
||||
If you then type a period and a tab, the library will finish off the filename
|
||||
for you:
|
||||
.RS
|
||||
.nf
|
||||
.RI "rm /v[TAB]" munix .TAB old
|
||||
.fi
|
||||
.RE
|
||||
The tab key is shown by ``[TAB]'' and the automatically-entered text
|
||||
is shown in italics.
|
||||
.SH "BUGS AND LIMITATIONS"
|
||||
Doesn't know how to handle multiple lines.
|
||||
.SH AUTHORS
|
||||
Simmule R. Turner <uunet.uu.net!capitol!sysgo!simmy>
|
||||
and Rich $alz <rsalz@osf.org>.
|
||||
Original manual page by DaviD W. Sanderson <dws@ssec.wisc.edu>.
|
||||
|
||||
.\" $PchId: editline.3,v 1.3 1996/02/22 21:18:51 philip Exp $
|
|
@ -1,42 +0,0 @@
|
|||
.\" @(#)end.3 6.2 (Berkeley) 5/12/86
|
||||
.\"
|
||||
.TH END 3 "May 12, 1986"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
end, etext, edata \- last locations in program
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
extern int etext;
|
||||
extern int edata;
|
||||
extern int end, _end;
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These names refer neither to routines nor to locations with interesting
|
||||
contents. The address of
|
||||
.B etext
|
||||
is the first address above the program text,
|
||||
.B edata
|
||||
above the initialized data region, and
|
||||
.B end
|
||||
above the uninitialized data region.
|
||||
.B _end
|
||||
is the same as
|
||||
.BR end ,
|
||||
but in the implementers name space, i.e. for use in libraries.
|
||||
.PP
|
||||
When execution begins, the program break coincides with
|
||||
.BR end ,
|
||||
but it is reset by the routines
|
||||
.BR brk (2),
|
||||
.BR malloc (3),
|
||||
standard input/output
|
||||
.RB ( stdio (3)),
|
||||
etc.
|
||||
The current value of the program break is reliably returned by `sbrk(0)',
|
||||
see
|
||||
.BR brk (2).
|
||||
.SH "SEE ALSO"
|
||||
.BR brk (2),
|
||||
.BR malloc (3).
|
196
man/man3/execl.3
196
man/man3/execl.3
|
@ -1,196 +0,0 @@
|
|||
.\" Copyright (c) 1983 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)execl.3 6.2 (Berkeley) 4/25/86
|
||||
.\"
|
||||
.TH EXECL 3 "April 25, 1986"
|
||||
.UC 5
|
||||
.SH NAME
|
||||
execl, execv, execle, execlp, execvp, exec, environ \- execute a file
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
#include <unistd.h>
|
||||
|
||||
.in +.5i
|
||||
.ti -.5i
|
||||
int execl(const char *\fIname\fP, const char *\fIarg0\fP, ..., (char *) NULL)
|
||||
.ti -.5i
|
||||
int execv(const char *\fIname\fP, char *const \fIargv\fP[])
|
||||
.ti -.5i
|
||||
int execle(const char *\fIname\fP, const char *\fIarg0\fP, ..., (char *) NULL, char *const \fIenvp\fP[])
|
||||
.ti -.5i
|
||||
int execlp(const char *\fIname\fP, const char *\fIarg0\fP, ..., (char *) NULL)
|
||||
.ti -.5i
|
||||
int execvp(const char *\fIname\fP, char *const \fIargv\fP[])
|
||||
.in -.5i
|
||||
|
||||
extern char *const *environ;
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These routines provide various interfaces to the
|
||||
.B execve
|
||||
system call. Refer to
|
||||
.BR execve (2)
|
||||
for a description of their properties; only
|
||||
brief descriptions are provided here.
|
||||
.PP
|
||||
.B Exec
|
||||
in all its forms
|
||||
overlays the calling process with the named file, then
|
||||
transfers to the
|
||||
entry point of the core image of the file.
|
||||
There can be no return from a successful exec; the calling
|
||||
core image is lost.
|
||||
.PP
|
||||
The
|
||||
.I name
|
||||
argument
|
||||
is a pointer to the name of the file
|
||||
to be executed.
|
||||
The pointers
|
||||
.IR arg [ 0 ],
|
||||
.IR arg [ 1 "] ..."
|
||||
address null-terminated strings.
|
||||
Conventionally
|
||||
.IR arg [ 0 ]
|
||||
is the name of the
|
||||
file.
|
||||
.PP
|
||||
Two interfaces are available.
|
||||
.B execl
|
||||
is useful when a known file with known arguments is
|
||||
being called;
|
||||
the arguments to
|
||||
.B execl
|
||||
are the character strings
|
||||
constituting the file and the arguments;
|
||||
the first argument is conventionally
|
||||
the same as the file name (or its last component).
|
||||
A null pointer argument must end the argument list.
|
||||
(Note that the
|
||||
.B execl*
|
||||
functions are variable argument functions. This means that the type
|
||||
of the arguments beyond
|
||||
.I arg0
|
||||
is not checked. So the null pointer requires an explicit cast to type
|
||||
.B "(char *)"
|
||||
if not of that type already.)
|
||||
.PP
|
||||
The
|
||||
.B execv
|
||||
version is useful when the number of arguments is unknown
|
||||
in advance;
|
||||
the arguments to
|
||||
.B execv
|
||||
are the name of the file to be
|
||||
executed and a vector of strings containing
|
||||
the arguments.
|
||||
The last argument string must be followed
|
||||
by a null pointer.
|
||||
.PP
|
||||
When a C program is executed,
|
||||
it is called as follows:
|
||||
.PP
|
||||
.RS
|
||||
.ft B
|
||||
.nf
|
||||
int main(int \fIargc\fP, char *const \fIargv\fP[], char *const \fIenvp\fP[]);
|
||||
|
||||
exit(main(\fIargc\fP, \fIargv\fP, \fIenvp\fP));
|
||||
.fi
|
||||
.ft R
|
||||
.RE
|
||||
.PP
|
||||
where
|
||||
.I argc
|
||||
is the argument count
|
||||
and
|
||||
.I argv
|
||||
is an array of character pointers
|
||||
to the arguments themselves.
|
||||
As indicated,
|
||||
.I argc
|
||||
is conventionally at least one
|
||||
and the first member of the array points to a
|
||||
string containing the name of the file.
|
||||
.PP
|
||||
.I Argv
|
||||
is directly usable in another
|
||||
.B execv
|
||||
because
|
||||
.IR argv [ argc ]
|
||||
is 0.
|
||||
.PP
|
||||
.I Envp
|
||||
is a pointer to an array of strings that constitute
|
||||
the
|
||||
.I environment
|
||||
of the process.
|
||||
Each string consists of a name, an \*(lq=\*(rq, and a null-terminated value.
|
||||
The array of pointers is terminated by a null pointer.
|
||||
The shell
|
||||
.BR sh (1)
|
||||
passes an environment entry for each global shell variable
|
||||
defined when the program is called.
|
||||
See
|
||||
.BR environ (7)
|
||||
for some conventionally
|
||||
used names.
|
||||
The C run-time start-off routine places a copy of
|
||||
.I envp
|
||||
in the global cell
|
||||
.BR environ ,
|
||||
which is used
|
||||
by
|
||||
.B execv
|
||||
and
|
||||
.B execl
|
||||
to pass the environment to any subprograms executed by the
|
||||
current program.
|
||||
.PP
|
||||
.B Execlp
|
||||
and
|
||||
.B execvp
|
||||
are called with the same arguments as
|
||||
.B execl
|
||||
and
|
||||
.BR execv ,
|
||||
but duplicate the shell's actions in searching for an executable
|
||||
file in a list of directories.
|
||||
The directory list is obtained from the environment variable
|
||||
.BR PATH .
|
||||
Under standard MINIX 3, if a file is found that is executable, but does
|
||||
not have the proper executable header then it is assumed to be
|
||||
a shell script.
|
||||
.B Execlp
|
||||
and
|
||||
.B execvp
|
||||
execute
|
||||
.B /bin/sh
|
||||
to interpret the script.
|
||||
Under Minix-vmd this does not happen, a script must begin with
|
||||
.B #!
|
||||
and the full path name of the interpreter if it is to be an
|
||||
executable script.
|
||||
.SH "SEE ALSO"
|
||||
.BR execve (2),
|
||||
.BR fork (2),
|
||||
.BR environ (7),
|
||||
.BR sh (1).
|
||||
.SH DIAGNOSTICS
|
||||
If the file cannot be found,
|
||||
if it is not executable,
|
||||
if it does not start with a valid magic number (see
|
||||
.BR a.out (5)),
|
||||
if maximum memory is exceeded,
|
||||
or if the arguments require too much space,
|
||||
a return
|
||||
constitutes the diagnostic;
|
||||
the return value is \-1 and
|
||||
.B errno
|
||||
is set as for
|
||||
.BR execve .
|
||||
Even for the super-user,
|
||||
at least one of the execute-permission bits must be set for
|
||||
a file to be executed.
|
|
@ -1,39 +0,0 @@
|
|||
.\" Copyright (c) 1983 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)exit.3 6.2 (Berkeley) 5/12/86
|
||||
.\"
|
||||
.TH EXIT 3 "May 12, 1986"
|
||||
.UC 5
|
||||
.SH NAME
|
||||
exit, atexit \- terminate a process after flushing any pending output
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdlib.h>
|
||||
|
||||
void exit(int \fIstatus\fP)
|
||||
int atexit(void (*\fIfunc\fP)(void))
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Exit
|
||||
first calls all functions registered by
|
||||
.BR atexit ,
|
||||
flushes all data buffered by the Standard I/O library, and finally
|
||||
terminates the process.
|
||||
.B Exit
|
||||
never returns.
|
||||
.PP
|
||||
.B Atexit
|
||||
registers the function
|
||||
.I func
|
||||
into a table of functions to be called on exit.
|
||||
.SH "SEE ALSO"
|
||||
.BR exit (2).
|
||||
.SH DIAGNOSTICS
|
||||
.B Atexit
|
||||
returns 0 on success, \-1 if
|
||||
.B malloc
|
||||
cannot allocate more memory for the list of registered functions.
|
|
@ -1,18 +0,0 @@
|
|||
.TH FABS 3 "January 7, 2010"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
fabs, fabsf \- compute absolute value
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <math.h>
|
||||
|
||||
double fabs(double \fIx\fP);
|
||||
float fabsf(float \fIx\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
\fBfabs\fP and \fBfabsf\fP return the absolute value of their argument.
|
||||
.SH "RETURN VALUE
|
||||
The return value is a number with the same magnitude as the argument and with
|
||||
a positive sign.
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
.\" @(#)fclose.3s 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH FCLOSE 3 "May 15, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
fclose, fflush \- close or flush a stream
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
|
||||
int fclose(FILE *\fIstream\fP)
|
||||
int fflush(FILE *\fIstream\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Fclose
|
||||
causes any buffers for the named
|
||||
.I stream
|
||||
to be emptied, and the file to be closed.
|
||||
Buffers allocated by the standard input/output system
|
||||
are freed.
|
||||
.PP
|
||||
.B Fclose
|
||||
is performed automatically upon
|
||||
calling
|
||||
.BR exit (3).
|
||||
.PP
|
||||
.B Fflush
|
||||
causes any buffered data for the named output
|
||||
.I stream
|
||||
to be written to that file.
|
||||
The stream remains open.
|
||||
.SH "SEE ALSO"
|
||||
.BR close (2),
|
||||
.BR fopen (3),
|
||||
.BR setbuf (3).
|
||||
.SH DIAGNOSTICS
|
||||
These routines return
|
||||
.SM
|
||||
.B EOF
|
||||
if
|
||||
.I stream
|
||||
is not associated with an output file, or
|
||||
if buffered data cannot be transferred to that file.
|
|
@ -1,28 +0,0 @@
|
|||
.TH FEHOLDEXCEPT 3 "December 22, 2009"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
feholdexcept \- disable floating point exceptions
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <fenv.h>
|
||||
|
||||
int feholdexcept(fenv_t *\fIenvp\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The feholdexcept function disables floating point exceptions. The floating
|
||||
point environment prior to disabling exceptions is stored in the struct
|
||||
pointed to by \fIenvp\fP.
|
||||
.SH "RETURN VALUE"
|
||||
On x86, this function never fails and the return value is always 0. A portable
|
||||
program should, however, consider the possibility that this function may fail
|
||||
and will return -1 to indicate this.
|
||||
.SH "KNOWN ISSUES"
|
||||
POSIX requires the function to clear exception flags. However, as none of the
|
||||
other functions dealing with FPU flags and FPU state have been implemented this
|
||||
has no effect on MINIX. A full implementation may need to store more FPU state
|
||||
as there is no instruction to change the status word independent of the rest
|
||||
of the FPU state. Do not depend on the fields of fenv_t as they may change even
|
||||
on future versions of MINIX/x86.
|
||||
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
.\" Copyright (c) 1980 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)ferror.3s 6.3 (Berkeley) 5/14/86
|
||||
.\"
|
||||
.TH FERROR 3 "May 14, 1986"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
ferror, feof, clearerr, fileno \- stream status inquiries
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
|
||||
int feof(FILE *\fIstream\fP)
|
||||
int ferror(FILE *\fIstream\fP)
|
||||
int clearerr(FILE *\fIstream\fP)
|
||||
int fileno(FILE *\fIstream\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Feof
|
||||
returns non-zero when end of file is read on the named input
|
||||
.IR stream ,
|
||||
otherwise zero.
|
||||
Unless cleared by
|
||||
.BR clearerr ,
|
||||
the end-of-file indication lasts until
|
||||
the stream is closed.
|
||||
.PP
|
||||
.B Ferror
|
||||
returns non-zero when an error has occurred reading or writing
|
||||
the named
|
||||
.IR stream ,
|
||||
otherwise zero.
|
||||
Unless cleared by
|
||||
.BR clearerr ,
|
||||
the error indication lasts until
|
||||
the stream is closed.
|
||||
.PP
|
||||
.B Clearerr
|
||||
resets the error and end-of-file indicators on the named
|
||||
.IR stream .
|
||||
.PP
|
||||
.B Fileno
|
||||
returns the integer file descriptor
|
||||
associated with the
|
||||
.IR stream ,
|
||||
see
|
||||
.BR open (2).
|
||||
.PP
|
||||
Currently all of these functions
|
||||
are implemented as macros;
|
||||
they cannot be redeclared.
|
||||
.SH "SEE ALSO"
|
||||
.BR fopen (3),
|
||||
.BR open (2).
|
|
@ -1,34 +0,0 @@
|
|||
.TH FESETROUND 3 "December 18, 2009"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
fesetround, fegetround \- floating point rounding mode control
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <fenv.h>
|
||||
|
||||
int fegetround(void);
|
||||
int fesetround(int \fIround\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These functions control the floating point rounding mode. One can use
|
||||
fegetround to determine the rounding mode currently in effect and fesetround
|
||||
the change the rounding mode. Four rounding modes are recognized: FE_TONEAREST,
|
||||
FE_DOWNWARD, FE_UPWARD and FE_TOWARDZERO. When rounding a value \fIx\fP to an
|
||||
integer \fIn\fP, the following approaches can be taken: FE_TONEAREST selects
|
||||
the \fIn\fP for which abs(fIx\fP - \fIn\fP) is minimal, preferring an even
|
||||
\fIn\fP if there are two possibilities; FE_DOWNWARD selects the largest \fIn\fP
|
||||
for which \fIn\fP <= fIx\fP; FE_UPWARD selects the smallest \fIn\fP for which
|
||||
\fIn\fP >= fIx\fP; and FE_TOWARDZERO selects \fIn\fP with the largest
|
||||
abs(\fIn\fP) for which abs(\fIn\fP) <= abs(\fIx\fP).
|
||||
.SH "RETURN VALUE"
|
||||
fegetround returns the current rounding mode. fesetround returns 0 if it was
|
||||
succesful in adjusting the rounding mode and -1 otherwise. The only possible
|
||||
reason for failure is an unsupported value for \fIround\fP, which is signalled
|
||||
by setting errno to EINVAL.
|
||||
.SH DIAGNOSTICS
|
||||
fegetround always succeeds. The only possible reason for failure of fesetround
|
||||
is an unsupported value for \fIround\fP, which is signalled by setting errno to
|
||||
EINVAL.
|
||||
.SH "SEE ALSO"
|
||||
nearbyint(3)
|
781
man/man3/fetch.3
781
man/man3/fetch.3
|
@ -1,781 +0,0 @@
|
|||
.\"-
|
||||
.\" Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
|
||||
.\" Copyright (c) 2010 Joerg Sonnenberger <joerg@NetBSD.org>
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD: fetch.3,v 1.64 2007/12/18 11:03:26 des Exp $
|
||||
.\" $NetBSD: fetch.3,v 1.15 2010/01/22 13:56:45 wiz Exp $
|
||||
.\"
|
||||
.Dd January 22, 2010
|
||||
.Dt FETCH 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm fetchMakeURL ,
|
||||
.Nm fetchParseURL ,
|
||||
.Nm fetchCopyURL ,
|
||||
.Nm fetchFreeURL ,
|
||||
.Nm fetchXGetURL ,
|
||||
.Nm fetchGetURL ,
|
||||
.Nm fetchPutURL ,
|
||||
.Nm fetchStatURL ,
|
||||
.Nm fetchListURL ,
|
||||
.Nm fetchXGet ,
|
||||
.Nm fetchGet ,
|
||||
.Nm fetchPut ,
|
||||
.Nm fetchStat ,
|
||||
.Nm fetchList ,
|
||||
.Nm fetchXGetFile ,
|
||||
.Nm fetchGetFile ,
|
||||
.Nm fetchPutFile ,
|
||||
.Nm fetchStatFile ,
|
||||
.Nm fetchListFile ,
|
||||
.Nm fetchXGetHTTP ,
|
||||
.Nm fetchGetHTTP ,
|
||||
.Nm fetchPutHTTP ,
|
||||
.Nm fetchStatHTTP ,
|
||||
.Nm fetchListHTTP ,
|
||||
.Nm fetchXGetFTP ,
|
||||
.Nm fetchGetFTP ,
|
||||
.Nm fetchPutFTP ,
|
||||
.Nm fetchStatFTP ,
|
||||
.Nm fetchListFTP
|
||||
.Nm fetchInitURLList ,
|
||||
.Nm fetchFreeURLList ,
|
||||
.Nm fetchUnquotePath ,
|
||||
.Nm fetchUnquoteFilename ,
|
||||
.Nm fetchStringifyURL ,
|
||||
.Nm fetchConnectionCacheInit ,
|
||||
.Nm fetchConnectionCacheClose ,
|
||||
.Nm fetch
|
||||
.Nd file transfer functions
|
||||
.Sh LIBRARY
|
||||
.Lb libfetch
|
||||
.Sh SYNOPSIS
|
||||
.In stdio.h
|
||||
.In fetch.h
|
||||
.Ft struct url *
|
||||
.Fn fetchMakeURL "const char *scheme" "const char *host" "int port" "const char *doc" "const char *user" "const char *pwd"
|
||||
.Ft struct url *
|
||||
.Fn fetchParseURL "const char *URL"
|
||||
.Ft struct url *
|
||||
.Fn fetchCopyURL "const struct url *u"
|
||||
.Ft void
|
||||
.Fn fetchFreeURL "struct url *u"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchXGetURL "const char *URL" "struct url_stat *us" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchGetURL "const char *URL" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchPutURL "const char *URL" "const char *flags"
|
||||
.Ft int
|
||||
.Fn fetchStatURL "const char *URL" "struct url_stat *us" "const char *flags"
|
||||
.Ft int
|
||||
.Fn fetchListURL "struct url_list *list" "const char *URL" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchXGet "struct url *u" "struct url_stat *us" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchGet "struct url *u" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchPut "struct url *u" "const char *flags"
|
||||
.Ft int
|
||||
.Fn fetchStat "struct url *u" "struct url_stat *us" "const char *flags"
|
||||
.Ft int
|
||||
.Fn fetchList "struct url_list *list" "struct url *u" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchXGetFile "struct url *u" "struct url_stat *us" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchGetFile "struct url *u" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchPutFile "struct url *u" "const char *flags"
|
||||
.Ft int
|
||||
.Fn fetchStatFile "struct url *u" "struct url_stat *us" "const char *flags"
|
||||
.Ft int
|
||||
.Fn fetchListFile "struct url_list *list" "struct url *u" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchXGetHTTP "struct url *u" "struct url_stat *us" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchGetHTTP "struct url *u" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchPutHTTP "struct url *u" "const char *flags"
|
||||
.Ft int
|
||||
.Fn fetchStatHTTP "struct url *u" "struct url_stat *us" "const char *flags"
|
||||
.Ft int
|
||||
.Fn fetchListHTTP "struct url_list *list" "struct url *u" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchXGetFTP "struct url *u" "struct url_stat *us" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchGetFTP "struct url *u" "const char *flags"
|
||||
.Ft fetchIO *
|
||||
.Fn fetchPutFTP "struct url *u" "const char *flags"
|
||||
.Ft int
|
||||
.Fn fetchStatFTP "struct url *u" "struct url_stat *us" "const char *flags"
|
||||
.Ft int
|
||||
.Fn fetchListFTP "struct url_list *list" "struct url *u" "const char *flags"
|
||||
.Ft void
|
||||
.Fn fetchInitURLList "struct url_list *ul"
|
||||
.Ft int
|
||||
.Fn fetchAppendURLList "struct url_list *dst" "const struct url_list *src"
|
||||
.Ft void
|
||||
.Fn fetchFreeURLList "struct url_list *ul"
|
||||
.Ft char *
|
||||
.Fn fetchUnquotePath "struct url *u"
|
||||
.Ft char *
|
||||
.Fn fetchUnquoteFilename "struct url *u"
|
||||
.Ft char *
|
||||
.Fn fetchStringifyURL "const struct url *u"
|
||||
.Ft void
|
||||
.Fn fetchConnectionCacheInit "int global" "int per_host"
|
||||
.Ft void
|
||||
.Fn fetchConnectionCacheClose "void"
|
||||
.Sh DESCRIPTION
|
||||
These functions implement a high-level library for retrieving and
|
||||
uploading files using Uniform Resource Locators (URLs).
|
||||
.Pp
|
||||
.Fn fetchParseURL
|
||||
takes a URL in the form of a null-terminated string and splits it into
|
||||
its components function according to the Common Internet Scheme Syntax
|
||||
detailed in RFC 1738.
|
||||
A regular expression which produces this syntax is:
|
||||
.Bd -literal -offset indent
|
||||
\*[Lt]scheme\*[Gt]:(//(\*[Lt]user\*[Gt](:\*[Lt]pwd\*[Gt])?@)?\*[Lt]host\*[Gt](:\*[Lt]port\*[Gt])?)?/(\*[Lt]document\*[Gt])?
|
||||
.Ed
|
||||
.Pp
|
||||
If the URL does not seem to begin with a scheme name, it is assumed to be a local path.
|
||||
Only absolute path names are accepted.
|
||||
.Pp
|
||||
Note that some components of the URL are not necessarily relevant to
|
||||
all URL schemes.
|
||||
For instance, the file scheme only needs the
|
||||
.Aq scheme
|
||||
and
|
||||
.Aq document
|
||||
components.
|
||||
.Fn fetchParseURL
|
||||
quotes any unsafe character in the URL automatically.
|
||||
This is not done by
|
||||
.Fn fetchMakeURL .
|
||||
.Fn fetchCopyURL
|
||||
copies an existing
|
||||
.Vt url
|
||||
structure.
|
||||
.Pp
|
||||
.Fn fetchMakeURL ,
|
||||
.Fn fetchParseURL ,
|
||||
and
|
||||
.Fn fetchCopyURL
|
||||
return a pointer to a
|
||||
.Vt url
|
||||
structure, which is defined as follows in
|
||||
.In fetch.h :
|
||||
.Bd -literal
|
||||
#define URL_SCHEMELEN 16
|
||||
#define URL_USERLEN 256
|
||||
#define URL_PWDLEN 256
|
||||
#define URL_HOSTLEN 255
|
||||
|
||||
struct url {
|
||||
char scheme[URL_SCHEMELEN + 1];
|
||||
char user[URL_USERLEN + 1];
|
||||
char pwd[URL_PWDLEN + 1];
|
||||
char host[URL_HOSTLEN + 1];
|
||||
int port;
|
||||
char *doc;
|
||||
off_t offset;
|
||||
size_t length;
|
||||
time_t last_modified;
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
The pointer returned by
|
||||
.Fn fetchMakeURL ,
|
||||
.Fn fetchCopyURL ,
|
||||
and
|
||||
.Fn fetchParseURL
|
||||
should be freed using
|
||||
.Fn fetchFreeURL .
|
||||
The size of
|
||||
.Vt struct URL
|
||||
is not part of the ABI.
|
||||
.Pp
|
||||
.Fn fetchXGetURL ,
|
||||
.Fn fetchGetURL ,
|
||||
and
|
||||
.Fn fetchPutURL
|
||||
constitute the recommended interface to the
|
||||
.Nm fetch
|
||||
library.
|
||||
They examine the URL passed to them to determine the transfer
|
||||
method, and call the appropriate lower-level functions to perform the
|
||||
actual transfer.
|
||||
.Fn fetchXGetURL
|
||||
also returns the remote document's metadata in the
|
||||
.Vt url_stat
|
||||
structure pointed to by the
|
||||
.Fa us
|
||||
argument.
|
||||
.Pp
|
||||
The
|
||||
.Fa flags
|
||||
argument is a string of characters which specify transfer options.
|
||||
The
|
||||
meaning of the individual flags is scheme-dependent, and is detailed
|
||||
in the appropriate section below.
|
||||
.Pp
|
||||
.Fn fetchStatURL
|
||||
attempts to obtain the requested document's metadata and fill in the
|
||||
structure pointed to by its second argument.
|
||||
The
|
||||
.Vt url_stat
|
||||
structure is defined as follows in
|
||||
.In fetch.h :
|
||||
.Bd -literal
|
||||
struct url_stat {
|
||||
off_t size;
|
||||
time_t atime;
|
||||
time_t mtime;
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
If the size could not be obtained from the server, the
|
||||
.Fa size
|
||||
field is set to \-1.
|
||||
If the modification time could not be obtained from the server, the
|
||||
.Fa mtime
|
||||
field is set to the epoch.
|
||||
If the access time could not be obtained from the server, the
|
||||
.Fa atime
|
||||
field is set to the modification time.
|
||||
.Pp
|
||||
.Fn fetchListURL
|
||||
attempts to list the contents of the directory pointed to by the URL provided.
|
||||
The pattern can be a simple glob-like expression as hint.
|
||||
Callers should not depend on the server to filter names.
|
||||
If successful, it appends the list of entries to the
|
||||
.Vt url_list
|
||||
structure.
|
||||
The
|
||||
.Vt url_list
|
||||
structure is defined as follows in
|
||||
.In fetch.h :
|
||||
.Bd -literal
|
||||
struct url_list {
|
||||
size_t length;
|
||||
size_t alloc_size;
|
||||
struct url *urls;
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
The list should be initialized by calling
|
||||
.Fn fetchInitURLList
|
||||
and the entries be freed by calling
|
||||
.Fn fetchFreeURLList .
|
||||
The function
|
||||
.Fn fetchAppendURLList
|
||||
can be used to append one URL lists to another.
|
||||
If the
|
||||
.Ql c
|
||||
(cache result) flag is specified, the library is allowed to internally
|
||||
cache the result.
|
||||
.Pp
|
||||
.Fn fetchStringifyURL
|
||||
returns the URL as string.
|
||||
.Fn fetchUnquotePath
|
||||
returns the path name part of the URL with any quoting undone.
|
||||
Query arguments and fragment identifiers are not included.
|
||||
.Fn fetchUnquoteFilename
|
||||
returns the last component of the path name as returned by
|
||||
.Fn fetchUnquotePath .
|
||||
.Fn fetchStringifyURL ,
|
||||
.Fn fetchUnquotePath ,
|
||||
and
|
||||
.Fn fetchUnquoteFilename
|
||||
return a string that should be deallocated with
|
||||
.Fn free
|
||||
after use.
|
||||
.Pp
|
||||
.Fn fetchConnectionCacheInit
|
||||
enables the connection cache.
|
||||
The first argument specifies the global limit on cached connections.
|
||||
The second argument specifies the host limit.
|
||||
Entries are considered to specify the same host, if the host name
|
||||
from the URL is identical, indepent of the address or address family.
|
||||
.Fn fetchConnectionCacheClose
|
||||
flushed the connection cache and closes all cached connections.
|
||||
.Pp
|
||||
.Fn fetchXGet ,
|
||||
.Fn fetchGet ,
|
||||
.Fn fetchPut ,
|
||||
and
|
||||
.Fn fetchStat
|
||||
are similar to
|
||||
.Fn fetchXGetURL ,
|
||||
.Fn fetchGetURL ,
|
||||
.Fn fetchPutURL ,
|
||||
and
|
||||
.Fn fetchStatURL ,
|
||||
except that they expect a pre-parsed URL in the form of a pointer to
|
||||
a
|
||||
.Vt struct url
|
||||
rather than a string.
|
||||
.Pp
|
||||
All of the
|
||||
.Fn fetchXGetXXX ,
|
||||
.Fn fetchGetXXX ,
|
||||
and
|
||||
.Fn fetchPutXXX
|
||||
functions return a pointer to a stream which can be used to read or
|
||||
write data from or to the requested document, respectively.
|
||||
Note that
|
||||
although the implementation details of the individual access methods
|
||||
vary, it can generally be assumed that a stream returned by one of the
|
||||
.Fn fetchXGetXXX
|
||||
or
|
||||
.Fn fetchGetXXX
|
||||
functions is read-only, and that a stream returned by one of the
|
||||
.Fn fetchPutXXX
|
||||
functions is write-only.
|
||||
.Sh PROTOCOL INDEPENDENT FLAGS
|
||||
If the
|
||||
.Ql i
|
||||
(if-modified-since) flag is specified, the library will try to fetch
|
||||
the content only if it is newer than
|
||||
.Va last_modified .
|
||||
For HTTP an
|
||||
.Li If-Modified-Since
|
||||
HTTP header is sent.
|
||||
For FTP a
|
||||
.Li MTDM
|
||||
command is sent first and compared locally.
|
||||
For FILE the source file is compared.
|
||||
.Sh FILE SCHEME
|
||||
.Fn fetchXGetFile ,
|
||||
.Fn fetchGetFile ,
|
||||
and
|
||||
.Fn fetchPutFile
|
||||
provide access to documents which are files in a locally mounted file
|
||||
system.
|
||||
Only the
|
||||
.Aq document
|
||||
component of the URL is used.
|
||||
.Pp
|
||||
.Fn fetchXGetFile
|
||||
and
|
||||
.Fn fetchGetFile
|
||||
do not accept any flags.
|
||||
.Pp
|
||||
.Fn fetchPutFile
|
||||
accepts the
|
||||
.Ql a
|
||||
(append to file) flag.
|
||||
If that flag is specified, the data written to
|
||||
the stream returned by
|
||||
.Fn fetchPutFile
|
||||
will be appended to the previous contents of the file, instead of
|
||||
replacing them.
|
||||
.Sh FTP SCHEME
|
||||
.Fn fetchXGetFTP ,
|
||||
.Fn fetchGetFTP ,
|
||||
and
|
||||
.Fn fetchPutFTP
|
||||
implement the FTP protocol as described in RFC 959.
|
||||
.Pp
|
||||
By default
|
||||
.Nm libfetch
|
||||
will attempt to use passive mode first and only fallback to active mode
|
||||
if the server reports a syntax error.
|
||||
If the
|
||||
.Ql a
|
||||
(active) flag is specified, a passive connection is not tried and active mode
|
||||
is used directly.
|
||||
.Pp
|
||||
If the
|
||||
.Ql l
|
||||
(low) flag is specified, data sockets will be allocated in the low (or
|
||||
default) port range instead of the high port range (see
|
||||
.Xr ip 4 ) .
|
||||
.Pp
|
||||
If the
|
||||
.Ql d
|
||||
(direct) flag is specified,
|
||||
.Fn fetchXGetFTP ,
|
||||
.Fn fetchGetFTP ,
|
||||
and
|
||||
.Fn fetchPutFTP
|
||||
will use a direct connection even if a proxy server is defined.
|
||||
.Pp
|
||||
If no user name or password is given, the
|
||||
.Nm fetch
|
||||
library will attempt an anonymous login, with user name "anonymous"
|
||||
and password "anonymous@\*[Lt]hostname\*[Gt]".
|
||||
.Sh HTTP SCHEME
|
||||
The
|
||||
.Fn fetchXGetHTTP ,
|
||||
.Fn fetchGetHTTP ,
|
||||
and
|
||||
.Fn fetchPutHTTP
|
||||
functions implement the HTTP/1.1 protocol.
|
||||
With a little luck, there is
|
||||
even a chance that they comply with RFC 2616 and RFC 2617.
|
||||
.Pp
|
||||
If the
|
||||
.Ql d
|
||||
(direct) flag is specified,
|
||||
.Fn fetchXGetHTTP ,
|
||||
.Fn fetchGetHTTP ,
|
||||
and
|
||||
.Fn fetchPutHTTP
|
||||
will use a direct connection even if a proxy server is defined.
|
||||
.Pp
|
||||
Since there seems to be no good way of implementing the HTTP PUT
|
||||
method in a manner consistent with the rest of the
|
||||
.Nm fetch
|
||||
library,
|
||||
.Fn fetchPutHTTP
|
||||
is currently unimplemented.
|
||||
.Sh AUTHENTICATION
|
||||
Apart from setting the appropriate environment variables and
|
||||
specifying the user name and password in the URL or the
|
||||
.Vt struct url ,
|
||||
the calling program has the option of defining an authentication
|
||||
function with the following prototype:
|
||||
.Pp
|
||||
.Ft int
|
||||
.Fn myAuthMethod "struct url *u"
|
||||
.Pp
|
||||
The callback function should fill in the
|
||||
.Fa user
|
||||
and
|
||||
.Fa pwd
|
||||
fields in the provided
|
||||
.Vt struct url
|
||||
and return 0 on success, or any other value to indicate failure.
|
||||
.Pp
|
||||
To register the authentication callback, simply set
|
||||
.Va fetchAuthMethod
|
||||
to point at it.
|
||||
The callback will be used whenever a site requires authentication and
|
||||
the appropriate environment variables are not set.
|
||||
.Pp
|
||||
This interface is experimental and may be subject to change.
|
||||
.Sh RETURN VALUES
|
||||
.Fn fetchParseURL
|
||||
returns a pointer to a
|
||||
.Vt struct url
|
||||
containing the individual components of the URL.
|
||||
If it is
|
||||
unable to allocate memory, or the URL is syntactically incorrect,
|
||||
.Fn fetchParseURL
|
||||
returns a
|
||||
.Dv NULL
|
||||
pointer.
|
||||
.Pp
|
||||
The
|
||||
.Fn fetchStat
|
||||
functions return 0 on success and \-1 on failure.
|
||||
.Pp
|
||||
All other functions return a stream pointer which may be used to
|
||||
access the requested document, or
|
||||
.Dv NULL
|
||||
if an error occurred.
|
||||
.Pp
|
||||
The following error codes are defined in
|
||||
.In fetch.h :
|
||||
.Bl -tag -width 18n
|
||||
.It Bq Er FETCH_ABORT
|
||||
Operation aborted
|
||||
.It Bq Er FETCH_AUTH
|
||||
Authentication failed
|
||||
.It Bq Er FETCH_DOWN
|
||||
Service unavailable
|
||||
.It Bq Er FETCH_EXISTS
|
||||
File exists
|
||||
.It Bq Er FETCH_FULL
|
||||
File system full
|
||||
.It Bq Er FETCH_INFO
|
||||
Informational response
|
||||
.It Bq Er FETCH_MEMORY
|
||||
Insufficient memory
|
||||
.It Bq Er FETCH_MOVED
|
||||
File has moved
|
||||
.It Bq Er FETCH_NETWORK
|
||||
Network error
|
||||
.It Bq Er FETCH_OK
|
||||
No error
|
||||
.It Bq Er FETCH_PROTO
|
||||
Protocol error
|
||||
.It Bq Er FETCH_RESOLV
|
||||
Resolver error
|
||||
.It Bq Er FETCH_SERVER
|
||||
Server error
|
||||
.It Bq Er FETCH_TEMP
|
||||
Temporary error
|
||||
.It Bq Er FETCH_TIMEOUT
|
||||
Operation timed out
|
||||
.It Bq Er FETCH_UNAVAIL
|
||||
File is not available
|
||||
.It Bq Er FETCH_UNKNOWN
|
||||
Unknown error
|
||||
.It Bq Er FETCH_URL
|
||||
Invalid URL
|
||||
.El
|
||||
.Pp
|
||||
The accompanying error message includes a protocol-specific error code
|
||||
and message, e.g.\& "File is not available (404 Not Found)"
|
||||
.Sh ENVIRONMENT
|
||||
.Bl -tag -width ".Ev FETCH_BIND_ADDRESS"
|
||||
.It Ev FETCH_BIND_ADDRESS
|
||||
Specifies a host name or IP address to which sockets used for outgoing
|
||||
connections will be bound.
|
||||
.It Ev FTP_LOGIN
|
||||
Default FTP login if none was provided in the URL.
|
||||
.It Ev FTP_PASSIVE_MODE
|
||||
If set to anything but
|
||||
.Ql no ,
|
||||
forces the FTP code to use passive mode.
|
||||
.It Ev FTP_PASSWORD
|
||||
Default FTP password if the remote server requests one and none was
|
||||
provided in the URL.
|
||||
.It Ev FTP_PROXY
|
||||
URL of the proxy to use for FTP requests.
|
||||
The document part is ignored.
|
||||
FTP and HTTP proxies are supported; if no scheme is specified, FTP is
|
||||
assumed.
|
||||
If the proxy is an FTP proxy,
|
||||
.Nm libfetch
|
||||
will send
|
||||
.Ql user@host
|
||||
as user name to the proxy, where
|
||||
.Ql user
|
||||
is the real user name, and
|
||||
.Ql host
|
||||
is the name of the FTP server.
|
||||
.Pp
|
||||
If this variable is set to an empty string, no proxy will be used for
|
||||
FTP requests, even if the
|
||||
.Ev HTTP_PROXY
|
||||
variable is set.
|
||||
.It Ev ftp_proxy
|
||||
Same as
|
||||
.Ev FTP_PROXY ,
|
||||
for compatibility.
|
||||
.It Ev HTTP_AUTH
|
||||
Specifies HTTP authorization parameters as a colon-separated list of
|
||||
items.
|
||||
The first and second item are the authorization scheme and realm
|
||||
respectively; further items are scheme-dependent.
|
||||
Currently, only basic authorization is supported.
|
||||
.Pp
|
||||
Basic authorization requires two parameters: the user name and
|
||||
password, in that order.
|
||||
.Pp
|
||||
This variable is only used if the server requires authorization and
|
||||
no user name or password was specified in the URL.
|
||||
.It Ev HTTP_PROXY
|
||||
URL of the proxy to use for HTTP requests.
|
||||
The document part is ignored.
|
||||
Only HTTP proxies are supported for HTTP requests.
|
||||
If no port number is specified, the default is 3128.
|
||||
.Pp
|
||||
Note that this proxy will also be used for FTP documents, unless the
|
||||
.Ev FTP_PROXY
|
||||
variable is set.
|
||||
.It Ev http_proxy
|
||||
Same as
|
||||
.Ev HTTP_PROXY ,
|
||||
for compatibility.
|
||||
.It Ev HTTP_PROXY_AUTH
|
||||
Specifies authorization parameters for the HTTP proxy in the same
|
||||
format as the
|
||||
.Ev HTTP_AUTH
|
||||
variable.
|
||||
.Pp
|
||||
This variable is used if and only if connected to an HTTP proxy, and
|
||||
is ignored if a user and/or a password were specified in the proxy
|
||||
URL.
|
||||
.It Ev HTTP_REFERER
|
||||
Specifies the referrer URL to use for HTTP requests.
|
||||
If set to
|
||||
.Dq auto ,
|
||||
the document URL will be used as referrer URL.
|
||||
.It Ev HTTP_USER_AGENT
|
||||
Specifies the User-Agent string to use for HTTP requests.
|
||||
This can be useful when working with HTTP origin or proxy servers that
|
||||
differentiate between user agents.
|
||||
.It Ev NETRC
|
||||
Specifies a file to use instead of
|
||||
.Pa ~/.netrc
|
||||
to look up login names and passwords for FTP sites.
|
||||
See
|
||||
.Xr ftp 1
|
||||
for a description of the file format.
|
||||
This feature is experimental.
|
||||
.It Ev NO_PROXY
|
||||
Either a single asterisk, which disables the use of proxies
|
||||
altogether, or a comma- or whitespace-separated list of hosts for
|
||||
which proxies should not be used.
|
||||
.It Ev no_proxy
|
||||
Same as
|
||||
.Ev NO_PROXY ,
|
||||
for compatibility.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
To access a proxy server on
|
||||
.Pa proxy.example.com
|
||||
port 8080, set the
|
||||
.Ev HTTP_PROXY
|
||||
environment variable in a manner similar to this:
|
||||
.Pp
|
||||
.Dl HTTP_PROXY=http://proxy.example.com:8080
|
||||
.Pp
|
||||
If the proxy server requires authentication, there are
|
||||
two options available for passing the authentication data.
|
||||
The first method is by using the proxy URL:
|
||||
.Pp
|
||||
.Dl HTTP_PROXY=http://\*[Lt]user\*[Gt]:\*[Lt]pwd\*[Gt]@proxy.example.com:8080
|
||||
.Pp
|
||||
The second method is by using the
|
||||
.Ev HTTP_PROXY_AUTH
|
||||
environment variable:
|
||||
.Bd -literal -offset indent
|
||||
HTTP_PROXY=http://proxy.example.com:8080
|
||||
HTTP_PROXY_AUTH=basic:*:\*[Lt]user\*[Gt]:\*[Lt]pwd\*[Gt]
|
||||
.Ed
|
||||
.Pp
|
||||
To disable the use of a proxy for an HTTP server running on the local
|
||||
host, define
|
||||
.Ev NO_PROXY
|
||||
as follows:
|
||||
.Bd -literal -offset indent
|
||||
NO_PROXY=localhost,127.0.0.1
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.\" .Xr fetch 1 ,
|
||||
.\" .Xr ftpio 3 ,
|
||||
.Xr ftp 1 ,
|
||||
.Xr ip 4
|
||||
.Rs
|
||||
.%A J. Postel
|
||||
.%A J. K. Reynolds
|
||||
.%D October 1985
|
||||
.%B File Transfer Protocol
|
||||
.%O RFC 959
|
||||
.Re
|
||||
.Rs
|
||||
.%A P. Deutsch
|
||||
.%A A. Emtage
|
||||
.%A A. Marine
|
||||
.%D May 1994
|
||||
.%T How to Use Anonymous FTP
|
||||
.%O RFC 1635
|
||||
.Re
|
||||
.Rs
|
||||
.%A T. Berners-Lee
|
||||
.%A L. Masinter
|
||||
.%A M. McCahill
|
||||
.%D December 1994
|
||||
.%T Uniform Resource Locators (URL)
|
||||
.%O RFC 1738
|
||||
.Re
|
||||
.Rs
|
||||
.%A R. Fielding
|
||||
.%A J. Gettys
|
||||
.%A J. Mogul
|
||||
.%A H. Frystyk
|
||||
.%A L. Masinter
|
||||
.%A P. Leach
|
||||
.%A T. Berners-Lee
|
||||
.%D January 1999
|
||||
.%B Hypertext Transfer Protocol -- HTTP/1.1
|
||||
.%O RFC 2616
|
||||
.Re
|
||||
.Rs
|
||||
.%A J. Franks
|
||||
.%A P. Hallam-Baker
|
||||
.%A J. Hostetler
|
||||
.%A S. Lawrence
|
||||
.%A P. Leach
|
||||
.%A A. Luotonen
|
||||
.%A L. Stewart
|
||||
.%D June 1999
|
||||
.%B HTTP Authentication: Basic and Digest Access Authentication
|
||||
.%O RFC 2617
|
||||
.Re
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm fetch
|
||||
library first appeared in
|
||||
.Fx 3.0 .
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
The
|
||||
.Nm fetch
|
||||
library was mostly written by
|
||||
.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org
|
||||
with numerous suggestions from
|
||||
.An Jordan K. Hubbard Aq jkh@FreeBSD.org ,
|
||||
.An Eugene Skepner Aq eu@qub.com
|
||||
and other
|
||||
.Fx
|
||||
developers.
|
||||
It replaces the older
|
||||
.Nm ftpio
|
||||
library written by
|
||||
.An Poul-Henning Kamp Aq phk@FreeBSD.org
|
||||
and
|
||||
.An Jordan K. Hubbard Aq jkh@FreeBSD.org .
|
||||
.Pp
|
||||
This manual page was written by
|
||||
.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
|
||||
.Sh BUGS
|
||||
Some parts of the library are not yet implemented.
|
||||
The most notable
|
||||
examples of this are
|
||||
.Fn fetchPutHTTP
|
||||
and FTP proxy support.
|
||||
.Pp
|
||||
There is no way to select a proxy at run-time other than setting the
|
||||
.Ev HTTP_PROXY
|
||||
or
|
||||
.Ev FTP_PROXY
|
||||
environment variables as appropriate.
|
||||
.Pp
|
||||
.Nm libfetch
|
||||
does not understand or obey 305 (Use Proxy) replies.
|
||||
.Pp
|
||||
Error numbers are unique only within a certain context; the error
|
||||
codes used for FTP and HTTP overlap, as do those used for resolver and
|
||||
system errors.
|
||||
For instance, error code 202 means "Command not
|
||||
implemented, superfluous at this site" in an FTP context and
|
||||
"Accepted" in an HTTP context.
|
||||
.Pp
|
||||
.Fn fetchStatFTP
|
||||
does not check that the result of an MDTM command is a valid date.
|
||||
.Pp
|
||||
The man page is incomplete, poorly written and produces badly
|
||||
formatted text.
|
||||
.Pp
|
||||
The error reporting mechanism is unsatisfactory.
|
||||
.Pp
|
||||
Some parts of the code are not fully reentrant.
|
|
@ -1,120 +0,0 @@
|
|||
.\" Copyright (c) 1989, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" This code is derived from software contributed to Berkeley by
|
||||
.\" Guido van Rossum.
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)fnmatch.3 8.3 (Berkeley) 4/28/95
|
||||
.\" $FreeBSD: src/lib/libc/gen/fnmatch.3,v 1.19.6.1 2008/11/25 02:59:29 kensmith Exp $
|
||||
.\"
|
||||
.TH FNMATCH 3 "July 18, 2004"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
fnmatch \- test whether a filename or pathname matches a shell-style pattern
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <fnmatch.h>
|
||||
|
||||
int fnmatch(const char *\fIpattern\fP, const char *\fIstring\fP, int \fIflags\fP);
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B fnmatch
|
||||
function matches patterns according to the rules used by the shell.
|
||||
It checks the string specified by the
|
||||
.IR string
|
||||
argument to see if it matches the pattern specified by the
|
||||
.IR pattern
|
||||
argument.
|
||||
.PP
|
||||
The
|
||||
.IR flags
|
||||
argument modifies the interpretation of
|
||||
.IR pattern
|
||||
and
|
||||
.IR string .
|
||||
The value of
|
||||
.IR flags
|
||||
is the bitwise inclusive OR of any of the following
|
||||
constants, which are defined in the include file fnmatch.h.
|
||||
.TP 15
|
||||
FNM_NOESCAPE
|
||||
Normally, every occurrence of a backslash followed by a character in
|
||||
.IR pattern
|
||||
is replaced by that character.
|
||||
This is done to negate any special meaning for the character.
|
||||
If the FNM_NOESCAPE
|
||||
flag is set, a backslash character is treated as an ordinary character.
|
||||
.TP 15
|
||||
FNM_PATHNAME
|
||||
Slash characters in
|
||||
.IR string
|
||||
must be explicitly matched by slashes in
|
||||
.IR pattern .
|
||||
If this flag is not set, then slashes are treated as regular characters.
|
||||
.TP 15
|
||||
FNM_PERIOD
|
||||
Leading periods in
|
||||
.IR string
|
||||
must be explicitly matched by periods in
|
||||
.IR pattern .
|
||||
If this flag is not set, then leading periods are treated as regular
|
||||
characters.
|
||||
The definition of leading is related to the specification of FNM_PATHNAME.
|
||||
A period is always leading if it is the first character in
|
||||
.IR string .
|
||||
Additionally, if FNM_PATHNAME is set, a period is leading
|
||||
if it immediately follows a slash.
|
||||
.TP 15
|
||||
FNM_LEADING_DIR
|
||||
Ignore /* rest after successful
|
||||
.IR pattern
|
||||
matching.
|
||||
.TP 15
|
||||
FNM_CASEFOLD
|
||||
Ignore case distinctions in both the
|
||||
.IR pattern
|
||||
and the
|
||||
.IR string .
|
||||
.SH RETURN VALUES
|
||||
The
|
||||
.B fnmatch
|
||||
function returns zero if
|
||||
.IR string
|
||||
matches the pattern specified by
|
||||
.IR pattern ,
|
||||
otherwise, it returns the value FNM_NOMATCH.
|
||||
.SH SEE ALSO
|
||||
.BR sh (1),
|
||||
.BR regex (3),
|
||||
.SH HISTORY
|
||||
The
|
||||
.B fnmatch
|
||||
function first appeared in 4.4BSD.
|
||||
.SH BUGS
|
||||
The pattern * matches the empty string, even if FNM_PATHNAME is specified.
|
|
@ -1,99 +0,0 @@
|
|||
.\" Copyright (c) 1980 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)fopen.3s 6.3 (Berkeley) 5/27/86
|
||||
.\"
|
||||
.TH FOPEN 3 "May 27, 1986"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
fopen, freopen, fdopen \- open a stream
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
|
||||
FILE *fopen(const char *\fIfilename\fP, const char *\fItype\fP)
|
||||
FILE *freopen(const char *\fIfilename\fP, const char *\fItype\fP, FILE *\fIstream\fP)
|
||||
FILE *fdopen(int \fIfildes\fP, const char *\fItype\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Fopen
|
||||
opens the file named by
|
||||
.I filename
|
||||
and associates a stream with it.
|
||||
.B Fopen
|
||||
returns a pointer to be used to identify the stream in subsequent operations.
|
||||
.PP
|
||||
.I Type
|
||||
is a character string having one of the following values:
|
||||
.TP 5
|
||||
"r"
|
||||
open for reading
|
||||
.ns
|
||||
.TP 5
|
||||
"w"
|
||||
create for writing
|
||||
.ns
|
||||
.TP 5
|
||||
"a"
|
||||
append: open for writing at end of file, or create for writing
|
||||
.PP
|
||||
In addition, each
|
||||
.I type
|
||||
may be followed by a "+" to have the file opened for reading and writing.
|
||||
"r+" positions the stream at the beginning of the file, "w+" creates
|
||||
or truncates it, and "a+" positions it at the end. Both reads and writes
|
||||
may be used on read/write streams, with the limitation that an
|
||||
.BR fseek ,
|
||||
.BR rewind ,
|
||||
or reading an end-of-file must be used between a read and a write or vice-versa.
|
||||
.PP
|
||||
.B Freopen
|
||||
substitutes the named file in place of the open
|
||||
.IR stream .
|
||||
It returns the original value of
|
||||
.IR stream .
|
||||
The original stream is closed.
|
||||
.PP
|
||||
.B Freopen
|
||||
is typically used to attach the preopened constant names,
|
||||
.B stdin, stdout, stderr,
|
||||
to specified files.
|
||||
.PP
|
||||
.B Fdopen
|
||||
associates a stream with a file descriptor obtained from
|
||||
.BR open ,
|
||||
.BR dup ,
|
||||
.BR creat ,
|
||||
or
|
||||
.BR pipe (2).
|
||||
The
|
||||
.I type
|
||||
of the stream must agree with the mode of the open file.
|
||||
.SH "SEE ALSO"
|
||||
.BR open (2),
|
||||
.BR fclose (3).
|
||||
.SH DIAGNOSTICS
|
||||
.B Fopen
|
||||
and
|
||||
.B freopen
|
||||
return the pointer
|
||||
.SM
|
||||
.B NULL
|
||||
if
|
||||
.I filename
|
||||
cannot be accessed,
|
||||
if too many files are already open,
|
||||
or if other resources needed cannot be allocated.
|
||||
.SH BUGS
|
||||
.B Fdopen
|
||||
is not portable to systems other than UNIX.
|
||||
.PP
|
||||
The read/write
|
||||
.I types
|
||||
do not exist on all systems. Those systems without
|
||||
read/write modes will probably treat the
|
||||
.I type
|
||||
as if the "+" was not present. These are unreliable in any event.
|
|
@ -1,25 +0,0 @@
|
|||
.TH FPCLASSIFY 3 "December 18, 2009"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
fpclassify, isfinite, isinf, isnan, isnormal, signbit \- classify floating point numbers
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <math.h>
|
||||
|
||||
int fpclassify(double \fIx\fP):
|
||||
int isfinite(double \fIx\fP);
|
||||
int isinf(double \fIx\fP);
|
||||
int isnan(double \fIx\fP);
|
||||
int isnormal(double \fIx\fP);
|
||||
int signbit(double \fIx\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These functions provide information about the specified floating point number
|
||||
\fIx\fP. fpclassify returns one of the values FP_INFINITE, FP_NAN, FP_NORMAL,
|
||||
FP_SUBNORMAL and FP_ZERO depending on the type of number provided. The isinf,
|
||||
isinf, isnan and isnormal test for specific number classes, returning a
|
||||
non-zero value is and only if the specified number belongs to the class
|
||||
specified by the function name. The signbit function returns a non-zero value
|
||||
if and only if the sign bit is set, which for non-NaN values (including zero)
|
||||
means that the number is negative.
|
|
@ -1,66 +0,0 @@
|
|||
.\" Copyright (c) 1980 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)fread.3s 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH FREAD 3 "May 15, 1985"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
fread, fwrite \- buffered binary input/output
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
|
||||
size_t fread(void *\fIptr\fP, size_t \fIitemsize\fP, size_t \fInitems\fP, FILE *\fIstream\fP)
|
||||
size_t fwrite(void *\fIptr\fP, size_t \fIitemsize\fP, size_t \fInitems\fP, FILE *\fIstream\fP)
|
||||
.SH DESCRIPTION
|
||||
.B Fread
|
||||
reads, into a block beginning at
|
||||
.IR ptr ,
|
||||
.I nitems
|
||||
of data of the type of
|
||||
.I *ptr
|
||||
from the named input
|
||||
.IR stream .
|
||||
It returns the number of items actually read.
|
||||
.PP
|
||||
If
|
||||
.I stream
|
||||
is
|
||||
.B stdin
|
||||
and the standard output is line buffered, then any partial output line
|
||||
will be flushed before any call to
|
||||
.BR read (2)
|
||||
to satisfy the
|
||||
.BR fread .
|
||||
.PP
|
||||
.B Fwrite
|
||||
appends at most
|
||||
.I nitems
|
||||
of data of the type of
|
||||
.I *ptr
|
||||
beginning at
|
||||
.I ptr
|
||||
to the named output
|
||||
.IR stream .
|
||||
It returns the number of items actually written.
|
||||
.SH "SEE ALSO"
|
||||
.BR read (2),
|
||||
.BR write (2),
|
||||
.BR fopen (3),
|
||||
.BR getc (3),
|
||||
.BR putc (3),
|
||||
.BR gets (3),
|
||||
.BR puts (3),
|
||||
.BR printf (3),
|
||||
.BR scanf (3).
|
||||
.SH DIAGNOSTICS
|
||||
.B Fread
|
||||
and
|
||||
.B fwrite
|
||||
return
|
||||
0
|
||||
upon end of file or error.
|
|
@ -1,65 +0,0 @@
|
|||
.\" @(#)fseek.3s 6.3 (Berkeley) 2/24/86
|
||||
.\"
|
||||
.TH FSEEK 3 "February 24, 1986"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
fseek, fseeko, ftell, ftello, rewind \- reposition a stream
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
|
||||
int fseek(FILE *\fIstream\fP, long \fIoffset\fP, int \fIptrname\fP)
|
||||
int fseeko(FILE *\fIstream\fP, off_t \fIoffset\fP, int \fIptrname\fP)
|
||||
long ftell(FILE *\fIstream\fP)
|
||||
off_t ftello(FILE *\fIstream\fP)
|
||||
void rewind(FILE *\fIstream\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Fseek
|
||||
and
|
||||
.B fseeko
|
||||
set the position of the next input or output
|
||||
operation on the
|
||||
.IR stream .
|
||||
The new position is at the signed distance
|
||||
.I offset
|
||||
bytes
|
||||
from the beginning, the current position, or the end of the file,
|
||||
according as
|
||||
.I ptrname
|
||||
has the value 0, 1, or 2.
|
||||
.PP
|
||||
.B Fseek
|
||||
and
|
||||
.B fseeko
|
||||
undo any effects of
|
||||
.BR ungetc (3).
|
||||
.PP
|
||||
.B Ftell
|
||||
and
|
||||
.B ftello
|
||||
return the current value of the offset relative to the beginning
|
||||
of the file associated with the named
|
||||
.IR stream .
|
||||
It is measured in bytes on UNIX;
|
||||
on some other systems it is a magic cookie,
|
||||
and the only foolproof way to obtain an
|
||||
.I offset
|
||||
for
|
||||
.BR fseek
|
||||
and
|
||||
.BR fseeko .
|
||||
.PP
|
||||
.BR Rewind "(\fIstream\fR)"
|
||||
is equivalent to
|
||||
.BR fseek "(\fIstream\fR, 0L, 0)."
|
||||
.SH "SEE ALSO"
|
||||
.BR lseek (2),
|
||||
.BR fopen (3).
|
||||
.SH DIAGNOSTICS
|
||||
.B Fseek
|
||||
and
|
||||
.B fseeko
|
||||
return \-1 for improper seeks, otherwise zero.
|
|
@ -1,165 +0,0 @@
|
|||
.\" Copyright (c) 1983, 1987 The Regents of the University of California.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms are permitted provided
|
||||
.\" that: (1) source distributions retain this entire copyright notice and
|
||||
.\" comment, and (2) distributions including binaries display the following
|
||||
.\" acknowledgement: ``This product includes software developed by the
|
||||
.\" University of California, Berkeley and its contributors'' in the
|
||||
.\" documentation or other materials provided with the distribution and in
|
||||
.\" all advertising materials mentioning features or use of this software.
|
||||
.\" Neither the name of the University nor the names of its contributors may
|
||||
.\" be used to endorse or promote products derived from this software without
|
||||
.\" specific prior written permission.
|
||||
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.\"
|
||||
.\" @(#)gethostbyname.3 6.12 (Berkeley) 6/23/90
|
||||
.\"
|
||||
.TH GETHOSTBYNAME 3 "June 23, 1990"
|
||||
.UC 5
|
||||
.SH NAME
|
||||
g_h_b_n, gethostbyname, gethostbyaddr, gethostent, sethostent, endhostent, herror \- get network host entry
|
||||
.SH SYNOPSIS
|
||||
.B "#include <net/gen/netdb.h>
|
||||
.PP
|
||||
.B "extern int h_errno;
|
||||
.PP
|
||||
.B "struct hostent *gethostbyname(name)
|
||||
.br
|
||||
.B "char *name;
|
||||
.PP
|
||||
.B "struct hostent *gethostbyaddr(addr, len, type)
|
||||
.br
|
||||
.B "char *addr; int len, type;
|
||||
.PP
|
||||
.B "struct hostent *gethostent()
|
||||
.PP
|
||||
.B "sethostent(stayopen)
|
||||
.br
|
||||
.B "int stayopen;
|
||||
.PP
|
||||
.B "endhostent()
|
||||
.PP
|
||||
.B "herror(string)
|
||||
.br
|
||||
.B "char *string;
|
||||
.PP
|
||||
.SH DESCRIPTION
|
||||
.I Gethostbyname
|
||||
and
|
||||
.I gethostbyaddr
|
||||
each return a pointer to an object with the
|
||||
following structure describing an internet host
|
||||
referenced by name or by address, respectively.
|
||||
This structure contains the information obtained from the name server.
|
||||
.PP
|
||||
.nf
|
||||
struct hostent {
|
||||
char *h_name; /* official name of host */
|
||||
char **h_aliases; /* alias list */
|
||||
int h_addrtype; /* host address type */
|
||||
int h_length; /* length of address */
|
||||
char **h_addr_list; /* list of addresses from name server */
|
||||
};
|
||||
#define h_addr h_addr_list[0] /* address, for backward compatibility */
|
||||
.ft R
|
||||
.ad
|
||||
.fi
|
||||
.PP
|
||||
The members of this structure are:
|
||||
.TP \w'h_addr_list'u+2n
|
||||
h_name
|
||||
Official name of the host.
|
||||
.TP \w'h_addr_list'u+2n
|
||||
h_aliases
|
||||
A zero terminated array of alternate names for the host.
|
||||
.TP \w'h_addr_list'u+2n
|
||||
h_addrtype
|
||||
The type of address being returned; currently always AF_INET.
|
||||
.TP \w'h_addr_list'u+2n
|
||||
h_length
|
||||
The length, in bytes, of the address.
|
||||
.TP \w'h_addr_list'u+2n
|
||||
h_addr_list
|
||||
A zero terminated array of network addresses for the host.
|
||||
Host addresses are returned in network byte order.
|
||||
.TP \w'h_addr_list'u+2n
|
||||
h_addr
|
||||
The first address in h_addr_list; this is for backward compatiblity.
|
||||
.PP
|
||||
When using the nameserver,
|
||||
.I gethostbyname
|
||||
will search for the named host in the current domain and its parents
|
||||
unless the name ends in a dot.
|
||||
If the name contains no dot, and if the environment variable ``HOSTALAIASES''
|
||||
contains the name of an alias file, the alias file will first be searched
|
||||
for an alias matching the input name.
|
||||
See
|
||||
.IR hostname (7)
|
||||
for the domain search procedure and the alias file format.
|
||||
.PP
|
||||
.I Sethostent
|
||||
may be used to request the use of a connected TCP socket for queries.
|
||||
If the
|
||||
.I stayopen
|
||||
flag is non-zero,
|
||||
this sets the option to send all queries to the name server using TCP
|
||||
and to retain the connection after each call to
|
||||
.I gethostbyname
|
||||
or
|
||||
.IR gethostbyaddr .
|
||||
Otherwise, queries are performed using UDP datagrams.
|
||||
.PP
|
||||
.I Endhostent
|
||||
closes the TCP connection.
|
||||
.SH DIAGNOSTICS
|
||||
.PP
|
||||
Error return status from
|
||||
.I gethostbyname
|
||||
and
|
||||
.I gethostbyaddr
|
||||
is indicated by return of a null pointer.
|
||||
The external integer
|
||||
.IR h_errno
|
||||
may then be checked to see whether this is a temporary failure
|
||||
or an invalid or unknown host.
|
||||
The routine
|
||||
.I herror
|
||||
can be used to print an error message describing the failure.
|
||||
If its argument
|
||||
.I string
|
||||
is non-NULL, it is printed, followed by a colon and a space.
|
||||
The error message is printed with a trailing newline.
|
||||
.PP
|
||||
.IR h_errno
|
||||
can have the following values:
|
||||
.RS
|
||||
.IP HOST_NOT_FOUND \w'HOST_NOT_FOUND'u+2n
|
||||
No such host is known.
|
||||
.IP TRY_AGAIN \w'HOST_NOT_FOUND'u+2n
|
||||
This is usually a temporary error
|
||||
and means that the local server did not receive
|
||||
a response from an authoritative server.
|
||||
A retry at some later time may succeed.
|
||||
.IP NO_RECOVERY \w'HOST_NOT_FOUND'u+2n
|
||||
Some unexpected server failure was encountered.
|
||||
This is a non-recoverable error.
|
||||
.IP NO_DATA \w'HOST_NOT_FOUND'u+2n
|
||||
The requested name is valid but does not have an IP address;
|
||||
this is not a temporary error.
|
||||
This means that the name is known to the name server but there is no address
|
||||
associated with this name.
|
||||
Another type of request to the name server using this domain name
|
||||
will result in an answer;
|
||||
for example, a mail-forwarder may be registered for this domain.
|
||||
.RE
|
||||
.SH "SEE ALSO"
|
||||
resolver(3), hostname(7), nonamed(8), named(8)
|
||||
.SH BUGS
|
||||
All information
|
||||
is contained in a static area
|
||||
so it must be copied if it is
|
||||
to be saved. Only the Internet
|
||||
address format is currently understood.
|
|
@ -1,66 +0,0 @@
|
|||
.TH GETADDRINFO 3 "January 19, 2010"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo \- address information
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <netdb.h>
|
||||
|
||||
void freeaddrinfo(struct addrinfo *\fIai\fP);
|
||||
int getaddrinfo(const char *\fInodename\fP,
|
||||
const char *\fIservname\fP,
|
||||
const struct addrinfo *\fIhints\fP,
|
||||
struct addrinfo **\fIres\fP);
|
||||
int getnameinfo(const struct sockaddr *\fIsa\fP, socklen_t \fIsalen\fP,
|
||||
char *\fInode\fP, socklen_t \fInodelen\fP, char *\fIservice\fP,
|
||||
socklen_t \fIservicelen\fP, int \fIflags\fP);
|
||||
const char *gai_strerror(int \fIecode\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These functions provide to convert between host and service names on the one
|
||||
hand and network addresses and ports on the other.
|
||||
.PP
|
||||
getaddrinfo converts the hostname specified in \fInodename\fP and/or the service
|
||||
name in \fIservname\fP into a socket address that can be used to connect to that
|
||||
service or listen for incoming connections. One of the parameters may be NULL.
|
||||
If \fInodename\fP is NULL, an address for the local host is provided. If
|
||||
\fIservname\fP is NULL, the network port is not filled in (and therefore set to
|
||||
zero). Buffers are allocated to store the results and a pointer to the first
|
||||
element of a linked list of addresses is stored in \fIai\fP. These buffers must
|
||||
be freed by calling freeaddrinfo on the pointer returned in \fIai\fP.
|
||||
.PP
|
||||
getnameinfo converts the specified socket address into a hostname and/or service
|
||||
name. These are stored in the buffers pointed to by \fInode\fP and \fIservice\fP
|
||||
resepectively. \fInodelen\fP and \fIservicelen\fP specify the sizes of these
|
||||
buffers. If the result string including null terminator does not fit in the
|
||||
buffer, the function fails and EAI_OVERFLOW is returned.
|
||||
.PP
|
||||
For both functions, some flags may be specified to alter their behaviour. For
|
||||
getaddrinfo these flags are specified in the ai_flags field of the optional
|
||||
\fIhints\fP parameter. AI_PASSIVE indicates that an address suitable for the
|
||||
bind function should be returned, otherwise an address suitable for connect is
|
||||
provided. AI_CANONNAME requests that the canonical name of the host be retrieved
|
||||
and stored in the ai_canonname field of the result. AI_NUMERICHOST and
|
||||
AI_NUMERICSERV indicate respectively that \fInodename\fP is an IP address and
|
||||
\fIservname\fP is a port number, avoiding a lookup. Search can be limited to a
|
||||
specific socket type by setting \fIhints\fP\->ai_socktype to SOCK_STREAM or
|
||||
SOCK_DGRAM. \fIhints\fP\->ai_family can be set to AF_UNSPEC or AF_INET but this
|
||||
doesn't make a difference as MINIX supports only IPv4. Unused fields of
|
||||
\fIhints\fP must be set to zero.
|
||||
.PP
|
||||
Flags for getnameinfo are specified in the \fIflags\fP parameter. NI_NUMERICHOST
|
||||
and NI_NUMERICSERV respectively cause \fInode\fP to be set to an IP address
|
||||
and \fIservice\fP to be set to a port number. NI_NAMEREQD causes the function
|
||||
to fail with EAI_NONAME if a name is not found for the host (otherwise the IP
|
||||
address is returned). NI_DGRAM indicates that a datagram service is specified,
|
||||
the default being a stream service.
|
||||
.SH "RETURN VALUE
|
||||
If the functions succeed, they return 0. If they fail, one of the EAI_* values
|
||||
defined in netdb.h is returned. This value can be converted into a string using
|
||||
gai_strerror. The most important ones are EAI_NONAME (host name not found),
|
||||
EAI_SERVICE (service name not found) and EAI_OVERFLOW (buffer too small, only
|
||||
for getnameinfo).
|
||||
.SH "KNOWN ISSUES
|
||||
Since MINIX does not support IPv6, the related flags are not supported.
|
||||
The NI_NOFQDN flag is also not (yet) supported.
|
|
@ -1,79 +0,0 @@
|
|||
.\" @(#)getc.3s 6.2 (Berkeley) 5/14/86
|
||||
.\"
|
||||
.TH GETC 3 "May 14, 1986"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
getc, getchar, fgetc, getw \- get character or word from stream
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
|
||||
int getc(FILE *\fIstream\fP)
|
||||
int getchar(void)
|
||||
int fgetc(FILE *\fIstream\fP)
|
||||
int getw(FILE *\fIstream\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Getc
|
||||
returns the next character from the named input
|
||||
.IR stream .
|
||||
.PP
|
||||
.BR Getchar ()
|
||||
is identical to
|
||||
.BR getc ( stdin ).
|
||||
.PP
|
||||
.B Fgetc
|
||||
behaves like
|
||||
.BR getc ,
|
||||
but is a genuine function, not a macro;
|
||||
it may be used to save object text.
|
||||
.PP
|
||||
.B Getw
|
||||
returns the next
|
||||
.B int
|
||||
from the named input
|
||||
.IR stream .
|
||||
It returns the constant
|
||||
.SM
|
||||
.B EOF
|
||||
upon end of file or error, but since that is a good
|
||||
integer value,
|
||||
.B feof
|
||||
and
|
||||
.BR ferror (3)
|
||||
should be used to check the success of
|
||||
.BR getw .
|
||||
.B Getw
|
||||
assumes no special alignment in the file.
|
||||
.SH "SEE ALSO"
|
||||
.BR clearerr (3),
|
||||
.BR fopen (3),
|
||||
.BR putc (3),
|
||||
.BR gets (3),
|
||||
.BR scanf (3),
|
||||
.BR fread (3),
|
||||
.BR ungetc (3).
|
||||
.SH DIAGNOSTICS
|
||||
These functions return the integer constant
|
||||
.SM
|
||||
.B EOF
|
||||
at end of file, upon read error,
|
||||
or if an attempt is made to read a file not opened by
|
||||
.BR fopen .
|
||||
The end-of-file condition is remembered,
|
||||
even on a terminal,
|
||||
and all subsequent attempts to read will return
|
||||
.B EOF
|
||||
until the condition is cleared with
|
||||
.BR clearerr (3).
|
||||
.SH BUGS
|
||||
Because it is implemented as a macro,
|
||||
.B getc
|
||||
treats a
|
||||
.I stream
|
||||
argument with side effects incorrectly.
|
||||
In particular,
|
||||
`getc(*f++);'
|
||||
doesn't work sensibly.
|
|
@ -1,136 +0,0 @@
|
|||
.Dd Mar 2, 2010
|
||||
.Dt GETCONTEXT 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm getcontext ,
|
||||
.Nm setcontext
|
||||
.Nd get and set current user context
|
||||
.Sh LIBRARY
|
||||
.Lb libc
|
||||
.Sh SYNOPSIS
|
||||
.In ucontext.h
|
||||
.Ft int
|
||||
.Fn getcontext "ucontext_t *ucp"
|
||||
.Ft int
|
||||
.Fn setcontext "const ucontext_t *ucp"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Xr makecontext 3
|
||||
,
|
||||
.Xr swapcontext 3
|
||||
,
|
||||
.Xr getcontext 3
|
||||
, and
|
||||
.Xr setcontext 3
|
||||
together form a set of functions that allow user-level context switching between multiple threads of control within a process.
|
||||
.Pp
|
||||
The
|
||||
.Vt ucontext_t
|
||||
type is a structure that has at least the following members:
|
||||
.Bd -offset 4n -literal
|
||||
typedef struct __ucontext {
|
||||
ucontext_t *uc_link;
|
||||
sigset_t uc_sigmask;
|
||||
stack_t uc_stack;
|
||||
mcontext_t uc_mcontext;
|
||||
...
|
||||
} ucontext_t;
|
||||
.Ed
|
||||
|
||||
with
|
||||
.Vt sigset_t
|
||||
and
|
||||
.Vt stack_t
|
||||
defined in
|
||||
.In signal.h .
|
||||
Here
|
||||
.Va uc_link
|
||||
points to the context that will be resumed when the current context returns (if
|
||||
.Va uc_link
|
||||
is NULL, the process exits),
|
||||
.Va uc_sigmask
|
||||
is the set of signals blocked in this context,
|
||||
.Va uc_stack
|
||||
is the stack used by this context (when the context was modified by
|
||||
.Xr makecontext 3 ),
|
||||
and
|
||||
.Va uc_mcontext
|
||||
is the machine-specific representation of the saved context. The
|
||||
.Vt mcontext_t
|
||||
type is machine-dependent and opaque.
|
||||
.Pp
|
||||
MINIX 3 has an additional
|
||||
.Va uc_flags
|
||||
member that supports the following flags:
|
||||
.Pp
|
||||
.Bd -offset 4n -literal
|
||||
UCF_IGNSIGM /* Current signal mask is not stored or restored */
|
||||
UCF_IGNFPU /* FPU state is not stored or restored for this context */
|
||||
.Ed
|
||||
.Pp
|
||||
Not storing and restoring the signal mask and/or FPU state speeds up context switching considerably.
|
||||
.Pp
|
||||
The
|
||||
.Fn getcontext
|
||||
function initializes the structure pointed to by
|
||||
.Va ucp
|
||||
to the current user context of the calling thread.
|
||||
.Pp
|
||||
The
|
||||
.Fn setcontext
|
||||
function restores the user context pointed to by
|
||||
.Va ucp .
|
||||
A succesful call does not return; program execution resumes at the point specified by the
|
||||
.Va ucp
|
||||
argument passed to
|
||||
.Fn setcontext .
|
||||
The
|
||||
.Va ucp
|
||||
argument should be created either by a prior call to
|
||||
.Fn getcontext
|
||||
or
|
||||
.Fn makecontext .
|
||||
If the
|
||||
.Va ucp
|
||||
argument was created with
|
||||
.Fn getcontext ,
|
||||
program execution continues as if the corresponding call of
|
||||
.Fn getcontext
|
||||
had just returned. If the
|
||||
.Va ucp
|
||||
argument was created with
|
||||
.Fn makecontext ,
|
||||
program execution continues with the function passed to
|
||||
.Fn makecontext .
|
||||
|
||||
.Sh RETURN VALUES
|
||||
When successful,
|
||||
.Fn getcontext
|
||||
returns 0 and
|
||||
.Fn setcontext
|
||||
does not return. Otherwise, both return -1 and
|
||||
.Va errno
|
||||
is set to indicate the error.
|
||||
|
||||
.Sh ERRORS
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
The context is not properly initialized.
|
||||
.It Bq Er EFAULT
|
||||
.Va ucp
|
||||
is a NULL pointer.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr makecontext 3 ,
|
||||
.Xr swapcontext 3
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Fn getcontext ,
|
||||
and
|
||||
.Fn setcontext
|
||||
functions conform to
|
||||
.St -xsh5
|
||||
and
|
||||
.St -p1003.1-2001 .
|
||||
.Sh AUTHORS
|
||||
Thomas Veerman
|
|
@ -1,36 +0,0 @@
|
|||
.\" Copyright (c) 1983 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)getwd.3 6.2 (Berkeley) 5/12/86
|
||||
.\"
|
||||
.TH GETCWD 3 "May 12, 1986"
|
||||
.UC 5
|
||||
.SH NAME
|
||||
getcwd \- get current working directory pathname
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <unistd.h>
|
||||
|
||||
char *getcwd(char *\fIpathname\fP, size_t \fIlen\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Getcwd
|
||||
copies the absolute pathname of the current working directory to
|
||||
.I pathname
|
||||
and returns a pointer to the result.
|
||||
.I Pathname
|
||||
is a character array of length
|
||||
.IR len .
|
||||
.SH DIAGNOSTICS
|
||||
.B Getcwd
|
||||
returns a null pointer and sets
|
||||
.B errno
|
||||
if an error occurs. The error will reflect the system call errors that
|
||||
may occur if the path to the current directory is searched upwards to
|
||||
the root directory. The error
|
||||
.B ERANGE
|
||||
is returned if the result does not fit within
|
||||
.I len
|
||||
bytes.
|
|
@ -1,16 +0,0 @@
|
|||
.TH GETDTABLESIZE 3 "December 4, 2009"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
getdtablesize \- query maximum number of open files
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <unistd.h>
|
||||
|
||||
int getdtablesize(void);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
getdtablesize returns the number of files that may be open at the same time
|
||||
in a process.
|
||||
.SH "RETURN VALUE
|
||||
The number of files that may be open at the same time in a process is returned.
|
|
@ -1,29 +0,0 @@
|
|||
.\" @(#)getenv.3 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH GETENV 3 "May 15, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
getenv \- value for environment name
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdlib.h>
|
||||
|
||||
char *getenv(const char *\fIname\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Getenv
|
||||
searches the environment list
|
||||
(see
|
||||
.BR environ (7))
|
||||
for a string of the form
|
||||
.IB name = value
|
||||
and returns a pointer to the string
|
||||
.I value
|
||||
if such a string is present, otherwise
|
||||
.B getenv
|
||||
returns the null pointer.
|
||||
.SH SEE ALSO
|
||||
.BR environ (7),
|
||||
.BR execve (2).
|
|
@ -1,136 +0,0 @@
|
|||
.TH GETGRENT 3
|
||||
.SH NAME
|
||||
getgrent, getgrnam, getgrgid, setgrent, endgrent, setgrfile \- group file routines
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
.nf
|
||||
#include <grp.h>
|
||||
|
||||
struct group *getgrent(void)
|
||||
struct group *getgrnam(const char *\fIname\fP)
|
||||
struct group *getgrgid(gid_t \fIgid\fP)
|
||||
int setgrent(void)
|
||||
void endgrent(void)
|
||||
void setgrfile(const char *\fIfile\fP)
|
||||
.fi
|
||||
.ft P
|
||||
.SH DESCRIPTION
|
||||
These functions are used to obtain information from the group file. They
|
||||
return this information in a
|
||||
.B struct group
|
||||
as defined by <grp.h>:
|
||||
.PP
|
||||
.nf
|
||||
.ta +4n +6n +15n
|
||||
struct group {
|
||||
char *gr_name; /* login name */
|
||||
char *gr_passwd; /* encrypted password */
|
||||
gid_t gr_gid; /* numeric group id */
|
||||
char **gr_mem; /* null-terminated list of group members */
|
||||
};
|
||||
.fi
|
||||
.PP
|
||||
.B Getgrent()
|
||||
reads the group file entry by entry.
|
||||
.B Getgrnam()
|
||||
scans the entire group file for the group with the given
|
||||
.IR name .
|
||||
.B Getgrgid()
|
||||
looks for the first group with the given
|
||||
.IR gid .
|
||||
The
|
||||
.B setgrent()
|
||||
and
|
||||
.B endgrent()
|
||||
functions are used to open and later close the group file. With
|
||||
.B setgrfile()
|
||||
one can specify the file to read other than the normal group file. This
|
||||
only sets the name, the next
|
||||
.B setgrent()
|
||||
call will open the file. Do not touch the file name while it is active.
|
||||
Use
|
||||
.B setgrfile(NULL)
|
||||
to revert back to the normal group file.
|
||||
.PP
|
||||
The usual way to scan the group file is (error checking omitted):
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
.DT
|
||||
setgrent();
|
||||
while ((gr = getgrent()) != NULL)
|
||||
if (appropriate_test(gr)) break;
|
||||
endgrent();
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The
|
||||
.B gr
|
||||
variable contains the entry that is wanted if non-NULL. The
|
||||
.B getgrnam()
|
||||
and
|
||||
.B getgrgid()
|
||||
functions are implemented as in this example, with error checking of course.
|
||||
.PP
|
||||
.B Getgrent()
|
||||
calls
|
||||
.B setgrent()
|
||||
if this has not yet been done.
|
||||
.B Setgrent()
|
||||
first calls
|
||||
.B endgrent()
|
||||
if the group file is still open. (Other implementations may simply
|
||||
rewind the file.)
|
||||
.SH FILES
|
||||
.TP 15
|
||||
.B /etc/group
|
||||
The group file database.
|
||||
.SH "SEE ALSO"
|
||||
.BR getgroups (2),
|
||||
.BR initgroups (3),
|
||||
.BR getpwent (3),
|
||||
.BR passwd (5).
|
||||
.SH DIAGNOSTICS
|
||||
.B Setgrent()
|
||||
has the same return value and error codes as the
|
||||
.BR open (2)
|
||||
call it uses to open the group file. The
|
||||
.BI get xxx ()
|
||||
functions return NULL on end of file, entry not found, or error. You can
|
||||
set
|
||||
.B errno
|
||||
to zero before the call and check it after.
|
||||
.SH NOTES
|
||||
All
|
||||
.BI get xxx ()
|
||||
routines return a pointer to static storage that is overwritten in each call.
|
||||
.PP
|
||||
Only
|
||||
.B getgrnam()
|
||||
and
|
||||
.B getgrgid()
|
||||
are defined by \s-2POSIX\s+2. The
|
||||
.B _MINIX_SOURCE
|
||||
macro must be defined before including <grp.h> to make the other functions
|
||||
visible. The
|
||||
.B gr_passwd
|
||||
field is also not defined by \s-2POSIX\s+2, but is always visible.
|
||||
Portable code cannot reliably detect errors by setting
|
||||
.B errno
|
||||
to zero. Under MINIX 3 it is better to make a
|
||||
.B getgrent()
|
||||
scan if you need to look up several group-id's or names, but portable code
|
||||
had better use several
|
||||
.B getgrgid()
|
||||
or
|
||||
.B getgrnam()
|
||||
calls. The
|
||||
.B getgrent()
|
||||
is usually available on other systems, but may be very expensive. See
|
||||
.BR initgroups (3)
|
||||
if you are after supplementary group id's.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
||||
|
||||
.\"
|
||||
.\" $PchId: getgrent.3,v 1.2 1996/04/11 06:35:01 philip Exp $
|
|
@ -1,36 +0,0 @@
|
|||
.\" @(#)getloadavg.3
|
||||
.\"
|
||||
.TH GETLOADAVG 3 "Nov 14, 2005"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
getloadavg \- system load average values
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdlib.h>
|
||||
|
||||
int getloadavg(double *\fIaverages\fP, int \fInelem\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Getloadavg
|
||||
returns the system load average values as elements of
|
||||
.IR averages
|
||||
up to
|
||||
a maximum of
|
||||
.IR nelem
|
||||
elements.
|
||||
The system load average is the average number of
|
||||
runnable processes over a certain period. Currently the averages are
|
||||
delivered over the last 1, 5 and 15 minutes of system usage. So
|
||||
currently the system maximum is 3.
|
||||
.SH RETURNS
|
||||
The returned value of
|
||||
.B getloadavg
|
||||
is zero or more if the call was successful, or a negative value if the
|
||||
call was unsuccessful. If the call was successful, the number of
|
||||
elements entered into
|
||||
.IR averages
|
||||
is returned.
|
||||
.SH SEE ALSO
|
||||
.BR uptime (1).
|
|
@ -1,45 +0,0 @@
|
|||
.\" @(#)getlogin.3 6.2 (Berkeley) 5/9/86
|
||||
.\"
|
||||
.TH GETLOGIN 3 "May 9, 1986"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
getlogin \- get login name
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <unistd.h>
|
||||
|
||||
char *getlogin(void)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Getlogin
|
||||
returns a pointer to the login name as found in
|
||||
.BR /etc/utmp .
|
||||
It may be used in conjunction with
|
||||
.B getpwnam
|
||||
to locate the correct password file entry when the same user ID
|
||||
is shared by several login names.
|
||||
.PP
|
||||
If
|
||||
.B getlogin
|
||||
is called within a process that is not attached to a
|
||||
terminal, or if there is no entry in
|
||||
.B /etc/utmp
|
||||
for the process's terminal,
|
||||
.B getlogin
|
||||
returns a null pointer.
|
||||
A reasonable procedure for determining the login name is to first call
|
||||
.B getlogin
|
||||
and if it fails, to call
|
||||
.BR getpwuid ( getuid ()).
|
||||
.SH FILES
|
||||
/etc/utmp
|
||||
.SH "SEE ALSO"
|
||||
.BR getpwent (3),
|
||||
.BR utmp (5),
|
||||
.BR ttyslot (3)
|
||||
.SH DIAGNOSTICS
|
||||
Returns a null pointer if the name cannot be found.
|
||||
.SH BUGS
|
||||
The return values point to static data
|
||||
whose content is overwritten by each call.
|
|
@ -1,150 +0,0 @@
|
|||
.\" Copyright (c) 1985 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)getopt.3 6.4 (Berkeley) 5/27/86
|
||||
.\"
|
||||
.TH GETOPT 3 "May 27, 1986"
|
||||
.UC 6
|
||||
.SH NAME
|
||||
getopt \- get option letter from argv
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
int getopt(argc, argv, optstring)
|
||||
.br
|
||||
int argc;
|
||||
.br
|
||||
char **argv;
|
||||
.br
|
||||
char *optstring;
|
||||
.sp
|
||||
extern char *optarg;
|
||||
.br
|
||||
extern int optind;
|
||||
.ft
|
||||
.SH DESCRIPTION
|
||||
.I Getopt
|
||||
returns the next option letter in
|
||||
.I argv
|
||||
that matches a letter in
|
||||
.IR optstring .
|
||||
.I Optstring
|
||||
is a string of recognized option letters;
|
||||
if a letter is followed by a colon, the option is expected to have
|
||||
an argument that may or may not be separated from it by white space.
|
||||
.I Optarg
|
||||
is set to point to the start of the option argument on return from
|
||||
.IR getopt .
|
||||
.PP
|
||||
.I Getopt
|
||||
places in
|
||||
.I optind
|
||||
the
|
||||
.I argv
|
||||
index of the next argument to be processed.
|
||||
Because
|
||||
.I optind
|
||||
is external, it is normally initialized to zero automatically
|
||||
before the first call to
|
||||
.IR getopt .
|
||||
.PP
|
||||
When all options have been processed (i.e., up to the first
|
||||
non-option argument),
|
||||
.I getopt
|
||||
returns
|
||||
.BR EOF .
|
||||
The special option
|
||||
.B \-\-
|
||||
may be used to delimit the end of the options;
|
||||
.B EOF
|
||||
will be returned, and
|
||||
.B \-\-
|
||||
will be skipped.
|
||||
.SH DIAGNOSTICS
|
||||
.I Getopt
|
||||
prints an error message on
|
||||
.I stderr
|
||||
and returns a question mark
|
||||
.RB ( ? )
|
||||
when it encounters an option letter not included in
|
||||
.IR optstring .
|
||||
.SH EXAMPLE
|
||||
The following code fragment shows how one might process the arguments
|
||||
for a command that can take the mutually exclusive options
|
||||
.B a
|
||||
and
|
||||
.BR b ,
|
||||
and the options
|
||||
.B f
|
||||
and
|
||||
.BR o ,
|
||||
both of which require arguments:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int c;
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
\&.
|
||||
\&.
|
||||
\&.
|
||||
while ((c = getopt(argc, argv, "abf:o:")) != EOF)
|
||||
switch (c) {
|
||||
case `a':
|
||||
if (bflg)
|
||||
errflg++;
|
||||
else
|
||||
aflg++;
|
||||
break;
|
||||
case `b':
|
||||
if (aflg)
|
||||
errflg++;
|
||||
else
|
||||
bproc();
|
||||
break;
|
||||
case `f':
|
||||
ifile = optarg;
|
||||
break;
|
||||
case `o':
|
||||
ofile = optarg;
|
||||
break;
|
||||
case `?':
|
||||
default:
|
||||
errflg++;
|
||||
break;
|
||||
}
|
||||
if (errflg) {
|
||||
fprintf(stderr, "Usage: ...");
|
||||
exit(2);
|
||||
}
|
||||
for (; optind < argc; optind++) {
|
||||
\&.
|
||||
\&.
|
||||
\&.
|
||||
}
|
||||
\&.
|
||||
\&.
|
||||
\&.
|
||||
}
|
||||
.RE
|
||||
.SH HISTORY
|
||||
Written by Henry Spencer, working from a Bell Labs manual page.
|
||||
Modified by Keith Bostic to behave more like the System V version.
|
||||
.SH BUGS
|
||||
It is not obvious how
|
||||
`\-'
|
||||
standing alone should be treated; this version treats it as
|
||||
a non-option argument, which is not always right.
|
||||
.PP
|
||||
Option arguments are allowed to begin with `\-';
|
||||
this is reasonable but reduces the amount of error checking possible.
|
||||
.PP
|
||||
.I Getopt
|
||||
is quite flexible but the obvious price must be paid: there is much
|
||||
it could do that it doesn't, like
|
||||
checking mutually exclusive options, checking type of
|
||||
option arguments, etc.
|
|
@ -1,310 +0,0 @@
|
|||
.\" $NetBSD: getopt_long.3,v 1.18 2007/07/02 17:56:17 ginsbach Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1988, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95
|
||||
.\"
|
||||
.Dd July 2, 2007
|
||||
.Dt GETOPT_LONG 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm getopt_long
|
||||
.Nd get long options from command line argument list
|
||||
.Sh LIBRARY
|
||||
.Lb libc
|
||||
.Sh SYNOPSIS
|
||||
.In getopt.h
|
||||
.Ft int
|
||||
.Fn getopt_long "int argc" "char * const *argv" "const char *optstring" "struct option *long_options" "int *index"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn getopt_long
|
||||
function is similar to
|
||||
.Xr getopt 3
|
||||
but it accepts options in two forms: words and characters.
|
||||
The
|
||||
.Fn getopt_long
|
||||
function provides a superset of the functionality of
|
||||
.Xr getopt 3 .
|
||||
.Fn getopt_long
|
||||
can be used in two ways.
|
||||
In the first way, every long option understood by the program has a
|
||||
corresponding short option, and the option structure is only used to
|
||||
translate from long options to short options.
|
||||
When used in this fashion,
|
||||
.Fn getopt_long
|
||||
behaves identically to
|
||||
.Xr getopt 3 .
|
||||
This is a good way to add long option processing to an existing program
|
||||
with the minimum of rewriting.
|
||||
.Pp
|
||||
In the second mechanism, a long option sets a flag in the
|
||||
.Fa option
|
||||
structure passed, or will store a pointer to the command line argument
|
||||
in the
|
||||
.Fa option
|
||||
structure passed to it for options that take arguments.
|
||||
Additionally, the long option's argument may be specified as a single
|
||||
argument with an equal sign, e.g.
|
||||
.Bd -literal
|
||||
myprogram --myoption=somevalue
|
||||
.Ed
|
||||
.Pp
|
||||
When a long option is processed the call to
|
||||
.Fn getopt_long
|
||||
will return 0.
|
||||
For this reason, long option processing without
|
||||
shortcuts is not backwards compatible with
|
||||
.Xr getopt 3 .
|
||||
.Pp
|
||||
It is possible to combine these methods, providing for long options
|
||||
processing with short option equivalents for some options.
|
||||
Less frequently used options would be processed as long options only.
|
||||
.Pp
|
||||
Abbreviated long option names are accepted when
|
||||
.Fn getopt_long
|
||||
processes long options if the abbreviation is unique.
|
||||
An exact match is always preferred for a defined long option.
|
||||
.Pp
|
||||
The
|
||||
.Fn getopt_long
|
||||
call requires a structure to be initialized describing the long options.
|
||||
The structure is:
|
||||
.Bd -literal
|
||||
struct option {
|
||||
char *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
The
|
||||
.Fa name
|
||||
field should contain the option name without the leading double dash.
|
||||
.Pp
|
||||
The
|
||||
.Fa has_arg
|
||||
field should be one of:
|
||||
.Bl -tag -width "optional_argument"
|
||||
.It Li no_argument
|
||||
no argument to the option is expect.
|
||||
.It Li required_argument
|
||||
an argument to the option is required.
|
||||
.It Li optional_argument
|
||||
an argument to the option may be presented.
|
||||
.El
|
||||
.Pp
|
||||
If
|
||||
.Fa flag
|
||||
is not
|
||||
.Dv NULL ,
|
||||
then the integer pointed to by it will be set to the value in the
|
||||
.Fa val
|
||||
field.
|
||||
If the
|
||||
.Fa flag
|
||||
field is
|
||||
.Dv NULL ,
|
||||
then the
|
||||
.Fa val
|
||||
field will be returned.
|
||||
Setting
|
||||
.Fa flag
|
||||
to
|
||||
.Dv NULL
|
||||
and setting
|
||||
.Fa val
|
||||
to the corresponding short option will make this function act just
|
||||
like
|
||||
.Xr getopt 3 .
|
||||
.Pp
|
||||
If the
|
||||
.Fa index
|
||||
field is not
|
||||
.Dv NULL ,
|
||||
the integer it points to will be set to the index of the long option
|
||||
in the
|
||||
.Fa long_options
|
||||
array.
|
||||
.Pp
|
||||
The last element of the
|
||||
.Fa long_options
|
||||
array has to be filled with zeroes (see
|
||||
.Sx EXAMPLES
|
||||
section).
|
||||
.Sh EXAMPLES
|
||||
.Bd -literal -compact
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
int bflag, ch, fd;
|
||||
int daggerset;
|
||||
|
||||
/* options descriptor */
|
||||
static struct option longopts[] = {
|
||||
{ "buffy", no_argument, 0, 'b' },
|
||||
{ "fluoride", required_argument, 0, 'f' },
|
||||
{ "daggerset", no_argument, \*[Am]daggerset, 1 },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
bflag = 0;
|
||||
while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1)
|
||||
switch (ch) {
|
||||
case 'b':
|
||||
bflag = 1;
|
||||
break;
|
||||
case 'f':
|
||||
if ((fd = open(optarg, O_RDONLY, 0)) \*[Lt] 0) {
|
||||
(void)fprintf(stderr,
|
||||
"myname: %s: %s\en", optarg, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
if(daggerset) {
|
||||
fprintf(stderr,"Buffy will use her dagger to "
|
||||
"apply fluoride to dracula's teeth\en");
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
.Ed
|
||||
.Sh IMPLEMENTATION DIFFERENCES
|
||||
This section describes differences to the GNU implementation
|
||||
found in glibc-2.1.3:
|
||||
.Bl -tag -width "xxx"
|
||||
.It Li o
|
||||
handling of - as first char of option string in presence of
|
||||
environment variable POSIXLY_CORRECT:
|
||||
.Bl -tag -width "NetBSD"
|
||||
.It Li GNU
|
||||
ignores POSIXLY_CORRECT and returns non-options as
|
||||
arguments to option '\e1'.
|
||||
.It Li NetBSD
|
||||
honors POSIXLY_CORRECT and stops at the first non-option.
|
||||
.El
|
||||
.It Li o
|
||||
handling of :: in options string in presence of POSIXLY_CORRECT:
|
||||
.Bl -tag -width "NetBSD"
|
||||
.It Li Both
|
||||
GNU and NetBSD ignore POSIXLY_CORRECT here and take :: to
|
||||
mean the preceding option takes an optional argument.
|
||||
.El
|
||||
.It Li o
|
||||
return value in case of missing argument if first character
|
||||
(after + or -) in option string is not ':':
|
||||
.Bl -tag -width "NetBSD"
|
||||
.It Li GNU
|
||||
returns '?'
|
||||
.It NetBSD
|
||||
returns ':' (since NetBSD's getopt does).
|
||||
.El
|
||||
.It Li o
|
||||
handling of --a in getopt:
|
||||
.Bl -tag -width "NetBSD"
|
||||
.It Li GNU
|
||||
parses this as option '-', option 'a'.
|
||||
.It Li NetBSD
|
||||
parses this as '--', and returns \-1 (ignoring the a).
|
||||
(Because the original getopt does.)
|
||||
.El
|
||||
.It Li o
|
||||
setting of optopt for long options with flag !=
|
||||
.Dv NULL :
|
||||
.Bl -tag -width "NetBSD"
|
||||
.It Li GNU
|
||||
sets optopt to val.
|
||||
.It Li NetBSD
|
||||
sets optopt to 0 (since val would never be returned).
|
||||
.El
|
||||
.It Li o
|
||||
handling of -W with W; in option string in getopt (not getopt_long):
|
||||
.Bl -tag -width "NetBSD"
|
||||
.It Li GNU
|
||||
causes a segfault.
|
||||
.It Li NetBSD
|
||||
returns \-1, with optind pointing past the argument of -W
|
||||
(as if `-W arg' were `--arg', and thus '--' had been found).
|
||||
.\" How should we treat W; in the option string when called via
|
||||
.\" getopt? Ignore the ';' or treat it as a ':'? Issue a warning?
|
||||
.El
|
||||
.It Li o
|
||||
setting of optarg for long options without an argument that are
|
||||
invoked via -W (W; in option string):
|
||||
.Bl -tag -width "NetBSD"
|
||||
.It Li GNU
|
||||
sets optarg to the option name (the argument of -W).
|
||||
.It Li NetBSD
|
||||
sets optarg to
|
||||
.Dv NULL
|
||||
(the argument of the long option).
|
||||
.El
|
||||
.It Li o
|
||||
handling of -W with an argument that is not (a prefix to) a known
|
||||
long option (W; in option string):
|
||||
.Bl -tag -width "NetBSD"
|
||||
.It Li GNU
|
||||
returns -W with optarg set to the unknown option.
|
||||
.It Li NetBSD
|
||||
treats this as an error (unknown option) and returns '?' with
|
||||
optopt set to 0 and optarg set to
|
||||
.Dv NULL
|
||||
(as GNU's man page documents).
|
||||
.El
|
||||
.It Li o
|
||||
The error messages are different.
|
||||
.It Li o
|
||||
NetBSD does not permute the argument vector at the same points in
|
||||
the calling sequence as GNU does.
|
||||
The aspects normally used by the caller
|
||||
(ordering after \-1 is returned, value of optind relative
|
||||
to current positions) are the same, though.
|
||||
(We do fewer variable swaps.)
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr getopt 3
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Fn getopt_long
|
||||
function first appeared in GNU libiberty.
|
||||
The first
|
||||
.Nx
|
||||
implementation appeared in 1.5.
|
||||
.Sh BUGS
|
||||
The implementation can completely replace
|
||||
.Xr getopt 3 ,
|
||||
but right now we are using separate code.
|
||||
.Pp
|
||||
The
|
||||
.Fa argv
|
||||
argument is not really const.
|
|
@ -1,28 +0,0 @@
|
|||
.\" @(#)getpass.3 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH GETPASS 3 "May 15, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
getpass \- read a password
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <minix/minlib.h>
|
||||
|
||||
char *getpass(const char *\fIprompt\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Getpass
|
||||
reads a password from the file
|
||||
.BR /dev/tty ,
|
||||
or if that cannot be opened, from the standard input,
|
||||
after prompting with the null-terminated string
|
||||
.I prompt
|
||||
and disabling echoing.
|
||||
A pointer is returned to a null-terminated string
|
||||
of at most 32 characters, excluding the null.
|
||||
.SH "SEE ALSO"
|
||||
.BR crypt (3).
|
||||
.SH BUGS
|
||||
The return value points to static data
|
||||
whose content is overwritten by each call.
|
|
@ -1,139 +0,0 @@
|
|||
.TH GETPWENT 3
|
||||
.SH NAME
|
||||
getpwent, getpwnam, getpwuid, setpwent, endpwent, setpwfile \- password file routines
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
.nf
|
||||
#include <pwd.h>
|
||||
|
||||
struct passwd *getpwent(void)
|
||||
struct passwd *getpwnam(const char *\fIname\fP)
|
||||
struct passwd *getpwuid(uid_t \fIuid\fP)
|
||||
int setpwent(void)
|
||||
void endpwent(void)
|
||||
void setpwfile(const char *\fIfile\fP)
|
||||
.fi
|
||||
.ft P
|
||||
.SH DESCRIPTION
|
||||
These functions are used to obtain information from the password file. They
|
||||
return this information in a
|
||||
.B struct passwd
|
||||
as defined by <pwd.h>:
|
||||
.PP
|
||||
.nf
|
||||
.ta +4n +6n +15n
|
||||
struct passwd {
|
||||
char *pw_name; /* login name */
|
||||
char *pw_passwd; /* encrypted password */
|
||||
uid_t pw_uid; /* numeric user id */
|
||||
gid_t pw_gid; /* numeric group id */
|
||||
char *pw_gecos; /* user full name and other info */
|
||||
char *pw_dir; /* user's home directory */
|
||||
char *pw_shell; /* name of the user's shell */
|
||||
};
|
||||
.fi
|
||||
.PP
|
||||
.B Getpwent()
|
||||
reads the password file entry by entry.
|
||||
.B Getpwnam()
|
||||
scans the entire password file for the user with the given
|
||||
.IR name .
|
||||
.B Getpwuid()
|
||||
looks for the first user with the given
|
||||
.IR uid .
|
||||
The
|
||||
.B setpwent()
|
||||
and
|
||||
.B endpwent()
|
||||
functions are used to open and later close the password file. With
|
||||
.B setpwfile()
|
||||
one can specify the file to read other than the normal password file. This
|
||||
only sets the name, the next
|
||||
.B setpwent()
|
||||
call will open the file. Do not touch the file name while it is active.
|
||||
Use
|
||||
.B setpwfile(NULL)
|
||||
to revert back to the normal password file.
|
||||
.PP
|
||||
The usual way to scan the password file is (error checking omitted):
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
.DT
|
||||
setpwent();
|
||||
while ((pw = getpwent()) != NULL)
|
||||
if (appropriate_test(pw)) break;
|
||||
endpwent();
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The
|
||||
.B pw
|
||||
variable contains the entry that is wanted if non-NULL. The
|
||||
.B getpwnam()
|
||||
and
|
||||
.B getpwuid()
|
||||
functions are implemented as in this example, with error checking of course.
|
||||
.PP
|
||||
.B Getpwent()
|
||||
calls
|
||||
.B setpwent()
|
||||
if this has not yet been done.
|
||||
.B Setpwent()
|
||||
first calls
|
||||
.B endpwent()
|
||||
if the password file is still open. (Other implementations may simply
|
||||
rewind the file.)
|
||||
.SH FILES
|
||||
.TP 15
|
||||
.B /etc/passwd
|
||||
The password file database.
|
||||
.SH "SEE ALSO"
|
||||
.BR cuserid (3),
|
||||
.BR getlogin (3),
|
||||
.BR getgrent (3),
|
||||
.BR passwd (5).
|
||||
.SH DIAGNOSTICS
|
||||
.B Setpwent()
|
||||
has the same return value and error codes as the
|
||||
.BR open (2)
|
||||
call it uses to open the password file. The
|
||||
.BI get xxx ()
|
||||
functions return NULL on end of file, entry not found, or error. You can
|
||||
set
|
||||
.B errno
|
||||
to zero before the call and check it after.
|
||||
.SH NOTES
|
||||
All
|
||||
.BI get xxx ()
|
||||
routines return a pointer to static storage that is overwritten in each call.
|
||||
.PP
|
||||
Only
|
||||
.B getpwnam()
|
||||
and
|
||||
.B getpwuid()
|
||||
are defined by \s-2POSIX\s+2. The
|
||||
.B _MINIX_SOURCE
|
||||
macro must be defined before including <pwd.h> to make the other functions
|
||||
visible. The
|
||||
.B pw_passwd
|
||||
and
|
||||
.B pw_gecos
|
||||
fields are also not defined by \s-2POSIX\s+2, but are always visible.
|
||||
Portable code cannot reliably detect errors by setting
|
||||
.B errno
|
||||
to zero. Under MINIX 3 it is better to make a
|
||||
.B getpwent()
|
||||
scan if you need to look up several user-id's or names, but portable code
|
||||
had better use several
|
||||
.B getpwuid()
|
||||
or
|
||||
.B getpwnam()
|
||||
calls. The
|
||||
.B getpwent()
|
||||
is usually available on other systems, but may be very expensive.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
||||
|
||||
.\"
|
||||
.\" $PchId: getpwent.3,v 1.2 1996/04/11 06:37:43 philip Exp $
|
|
@ -1,23 +0,0 @@
|
|||
.TH GETRLIMIT 3 "December 4, 2009"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
getrlimit \- query resource consumption limits
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <sys/resource.h>
|
||||
|
||||
int getrlimit(int \fIresource\fP, struct rlimit *\fIrlp\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
getrlimit queries the current resource limit regarding the specified
|
||||
\fIresource\fP. This can be one of the following: RLIMIT_CORE, RLIMIT_CPU,
|
||||
RLIMIT_DATA, RLIMIT_FSIZE, RLIMIT_NOFILE, RLIMIT_STACK or RLIMIT_AS.
|
||||
The soft limit is specified in \fIrlp\fP\->rlim_cur and the hard limit in
|
||||
\fIrlp\fP\->rlim_max. On MINIX, these are currently always the same.
|
||||
A value of RLIM_INFINITY specifies that no limit is enforced, although
|
||||
architectural limits may still apply.
|
||||
.SH "RETURN VALUE
|
||||
If the function succeeds, 0 is returned.
|
||||
If the function fails, -1 is returned and errno is set to indicate the
|
||||
cause of the failure.
|
|
@ -1,68 +0,0 @@
|
|||
.\" @(#)gets.3s 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH GETS 3 "May 15, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
gets, fgets \- get a string from a stream
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
|
||||
char *gets(char *\fIs\fP)
|
||||
char *fgets(char *\fIs\fP, int \fIn\fP, FILE *\fIstream\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Gets
|
||||
reads a string into
|
||||
.I s
|
||||
from the standard input stream
|
||||
.BR stdin .
|
||||
The string is terminated by a newline
|
||||
character, which is replaced in
|
||||
.I s
|
||||
by a null character.
|
||||
.B Gets
|
||||
returns its argument.
|
||||
.PP
|
||||
.B Fgets
|
||||
reads
|
||||
.IR n \-1
|
||||
characters, or up through a newline
|
||||
character, whichever comes first,
|
||||
from the
|
||||
.I stream
|
||||
into the string
|
||||
.IR s .
|
||||
The last character read into
|
||||
.I s
|
||||
is followed by a null character.
|
||||
.B Fgets
|
||||
returns its first argument.
|
||||
.SH "SEE ALSO"
|
||||
.BR puts (3),
|
||||
.BR getc (3),
|
||||
.BR scanf (3),
|
||||
.BR fread (3),
|
||||
.BR ferror (3).
|
||||
.SH DIAGNOSTICS
|
||||
.B Gets
|
||||
and
|
||||
.B fgets
|
||||
return the constant pointer
|
||||
.SM
|
||||
.B NULL
|
||||
upon end of file or error.
|
||||
.SH BUGS
|
||||
.B Gets
|
||||
deletes a newline,
|
||||
.B fgets
|
||||
keeps it,
|
||||
all in the name of backward compatibility.
|
||||
.PP
|
||||
.B Gets
|
||||
is not present in the Minix-vmd C library for reasons that should be obvious.
|
||||
Use
|
||||
.B fgets
|
||||
instead.
|
|
@ -1,112 +0,0 @@
|
|||
.\" Copyright (c) 1983 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)getservent.3n 6.3 (Berkeley) 5/19/86
|
||||
.\"
|
||||
.TH GETSERVENT 3 "May 19, 1986"
|
||||
.UC 5
|
||||
.SH NAME
|
||||
getservent, getservbyport, getservbyname, setservent, endservent \- get service entry
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <netdb.h>
|
||||
.PP
|
||||
.ft B
|
||||
struct servent *getservent()
|
||||
.PP
|
||||
.ft B
|
||||
struct servent *getservbyname(name, proto)
|
||||
char *name, *proto;
|
||||
.PP
|
||||
.ft B
|
||||
struct servent *getservbyport(port, proto)
|
||||
int port; char *proto;
|
||||
.PP
|
||||
.ft B
|
||||
setservent(stayopen)
|
||||
int stayopen
|
||||
.PP
|
||||
.ft B
|
||||
endservent()
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.IR Getservent ,
|
||||
.IR getservbyname ,
|
||||
and
|
||||
.I getservbyport
|
||||
each return a pointer to an object with the
|
||||
following structure
|
||||
containing the broken-out
|
||||
fields of a line in the network services data base,
|
||||
.IR /etc/services .
|
||||
.RS
|
||||
.PP
|
||||
.nf
|
||||
struct servent {
|
||||
char *s_name; /* official name of service */
|
||||
char **s_aliases; /* alias list */
|
||||
int s_port; /* port service resides at */
|
||||
char *s_proto; /* protocol to use */
|
||||
};
|
||||
.ft R
|
||||
.ad
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The members of this structure are:
|
||||
.TP \w's_aliases'u+2n
|
||||
s_name
|
||||
The official name of the service.
|
||||
.TP \w's_aliases'u+2n
|
||||
s_aliases
|
||||
A zero terminated list of alternate names for the service.
|
||||
.TP \w's_aliases'u+2n
|
||||
s_port
|
||||
The port number at which the service resides.
|
||||
Port numbers are returned in network byte order.
|
||||
.TP \w's_aliases'u+2n
|
||||
s_proto
|
||||
The name of the protocol to use when contacting the
|
||||
service.
|
||||
.PP
|
||||
.I Getservent
|
||||
reads the next line of the file, opening the file if necessary.
|
||||
.PP
|
||||
.I Setservent
|
||||
opens and rewinds the file. If the
|
||||
.I stayopen
|
||||
flag is non-zero,
|
||||
the net data base will not be closed after each call to
|
||||
.I getservbyname
|
||||
or
|
||||
.IR getservbyport .
|
||||
.PP
|
||||
.I Endservent
|
||||
closes the file.
|
||||
.PP
|
||||
.I Getservbyname
|
||||
and
|
||||
.I getservbyport
|
||||
sequentially search from the beginning
|
||||
of the file until a matching
|
||||
protocol name or
|
||||
port number is found,
|
||||
or until EOF is encountered.
|
||||
If a protocol name is also supplied (non-NULL),
|
||||
searches must also match the protocol.
|
||||
.SH FILES
|
||||
/etc/services
|
||||
.SH "SEE ALSO"
|
||||
getprotoent(3), services(5)
|
||||
.SH DIAGNOSTICS
|
||||
Null pointer
|
||||
(0) returned on EOF or error.
|
||||
.SH BUGS
|
||||
All information
|
||||
is contained in a static area
|
||||
so it must be copied if it is
|
||||
to be saved. Expecting port
|
||||
numbers to fit in a 32 bit
|
||||
quantity is probably naive.
|
|
@ -1,107 +0,0 @@
|
|||
.TH GETTTYENT 3
|
||||
.SH NAME
|
||||
getttyent, getttynam, setttyent, endttyent \- interface to /etc/ttytab
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
.nf
|
||||
#include <ttyent.h>
|
||||
|
||||
struct ttyent *getttyent(void)
|
||||
struct ttyent *getttynam(const char *\fIname\fP)
|
||||
int setttyent(void)
|
||||
void endttyent(void)
|
||||
.fi
|
||||
.ft P
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B getttyent
|
||||
functions provide an interface to the /etc/ttytab. (See
|
||||
.BR ttytab (5)).
|
||||
.PP
|
||||
To read one of these files one calls
|
||||
.B getttyent()
|
||||
several times to read the entries in the table until NULL is returned for
|
||||
end-of-file.
|
||||
.PP
|
||||
.B Getttyname()
|
||||
searches the
|
||||
.B ttytab
|
||||
file for the given terminal device. It is equivalent to a call to
|
||||
.BR setttyent(),
|
||||
several calls to
|
||||
.B getttyent()
|
||||
to locate the entry, and a final
|
||||
.B endttyent()
|
||||
to close the file.
|
||||
.PP
|
||||
.B Setttyent()
|
||||
opens or rewinds the ttytab database, and
|
||||
.B endttyent() closes it.
|
||||
.B Getttyent()
|
||||
opens the database if not already open, but does not close it.
|
||||
.PP
|
||||
The struct ttyent is defined by <ttyent.h> as follows:
|
||||
.sp
|
||||
.nf
|
||||
.ta +4n +6n +15n
|
||||
struct ttyent {
|
||||
char *ty_name; /* Name of the terminal device. */
|
||||
char *ty_type; /* Terminal type name (termcap(3)). */
|
||||
char **ty_getty; /* Program to run, normally getty. */
|
||||
char **ty_init; /* Initialization command, normally stty. */
|
||||
};
|
||||
.fi
|
||||
.PP
|
||||
A valid entry has at least two strings, so both
|
||||
.B ty_name
|
||||
and
|
||||
.B ty_type
|
||||
are filled in. The optional
|
||||
.B ty_getty
|
||||
and
|
||||
.B ty_init
|
||||
may be NULL (field omitted), point to a pointer that is NULL (null lenght
|
||||
field, i.e. ""), or an array of strings terminated by a NULL (field
|
||||
present). For now no useful distinction can be made between a omitted field
|
||||
and an empty field, so treat both cases as an omission.
|
||||
.SH FILES
|
||||
.TP 15
|
||||
.B /etc/ttytab
|
||||
The terminal device database
|
||||
.SH "SEE ALSO"
|
||||
.BR ttyname (3),
|
||||
.BR ttyslot (3),
|
||||
.BR ttytab (5),
|
||||
.BR init (8).
|
||||
.SH DIAGNOSTICS
|
||||
.B Setttyent()
|
||||
has the same return value and error codes as the
|
||||
.BR open (2)
|
||||
call it uses to open the ttytab file. The
|
||||
.BI get xxx ()
|
||||
functions return NULL on end of file, entry not found, or error. You can
|
||||
set
|
||||
.B errno
|
||||
to zero before the call and check it after.
|
||||
.SH NOTES
|
||||
.B Getttyent()
|
||||
and
|
||||
.B getttynam()
|
||||
return a pointer to static storage that is overwritten in each call.
|
||||
.PP
|
||||
The MINIX 3
|
||||
.B struct ttyent
|
||||
has only the
|
||||
.B ty_name
|
||||
and
|
||||
.B ty_type
|
||||
fields in common with the BSD implementation. This does not seem to be a
|
||||
problem, because most third party software that need to know about terminals
|
||||
only look at the
|
||||
.B ty_name
|
||||
field.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
||||
|
||||
.\"
|
||||
.\" $PchId: getttyent.3,v 1.2 1996/04/11 06:57:26 philip Exp $
|
|
@ -1,60 +0,0 @@
|
|||
.TH HTON 3
|
||||
.SH NAME
|
||||
hton, htons, htonl, ntohs, ntohl \- host to network byte order conversion
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
.nf
|
||||
#define _MINIX_SOURCE 1
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <net/hton.h>
|
||||
|
||||
u16_t htons(u16_t \fIhost_word\fP)
|
||||
u32_t htonl(u32_t \fIhost_dword\fP)
|
||||
u16_t ntohs(u16_t \fInetwork_word\fP)
|
||||
u32_t ntohl(u32_t \fInetwork_dword\fP)
|
||||
u16_t HTONS(u16_t \fIhost_word\fP)
|
||||
u32_t HTONL(u32_t \fIhost_dword\fP)
|
||||
u16_t NTOHS(u16_t \fInetwork_word\fP)
|
||||
u32_t NTOHL(u32_t \fInetwork_dword\fP)
|
||||
.fi
|
||||
.ft R
|
||||
.SH DESCRIPTION
|
||||
These macros convert 16-bit and 32-bit quantities to and from the network
|
||||
byte order used by the TCP/IP protocols.
|
||||
The function of the macros is encoded in their name.
|
||||
.B H
|
||||
means host byte order,
|
||||
.B n
|
||||
means network byte order,
|
||||
.B s
|
||||
means a 16-bit quantity and
|
||||
.B l
|
||||
means a 32-bit quantity.
|
||||
Thus
|
||||
.B htons
|
||||
converts a 16-bit quantity from host byte order to network byte order.
|
||||
The difference between the lower case and upper case variants is that
|
||||
the lower case variants evaluate the argument at most once and the
|
||||
upper case variants can be used for constant folding.
|
||||
That is,
|
||||
.PP
|
||||
.RS
|
||||
htonl(f(x))
|
||||
.RE
|
||||
.PP
|
||||
will call f(x) at most once and
|
||||
.PP
|
||||
.RS
|
||||
HTONS(0x10)
|
||||
.RE
|
||||
.PP
|
||||
will be equivalent to 0x10 on a big-endian machine and 0x1000 on a
|
||||
little-endian machine.
|
||||
.SH "SEE ALSO"
|
||||
.BR ip (4).
|
||||
.SH AUTHOR
|
||||
Philip Homburg (philip@cs.vu.nl)
|
||||
.\"
|
||||
.\" $PchId: hton.3,v 1.3 1996/02/22 21:10:01 philip Exp $
|
258
man/man3/int64.3
258
man/man3/int64.3
|
@ -1,258 +0,0 @@
|
|||
.TH INT64 3
|
||||
.SH NAME
|
||||
int64, add64, add64u, add64ul, sub64, sub64u, sub64ul, diff64, bsr64, cvu64, cvul64, cv64u, cv64ul, div64, div64u, div64u64, rem64, rem64u, mul64, mul64u, cmp64, cmp64u, cmp64ul, ex64lo, ex64hi, make64 \- 64 bit disk offset computations
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
.nf
|
||||
#include <minix/u64.h>
|
||||
|
||||
u64_t add64(u64_t \fIi\fP, u64_t \fIj\fP)
|
||||
u64_t add64u(u64_t \fIi\fP, unsigned \fIj\fP)
|
||||
u64_t add64ul(u64_t \fIi\fP, unsigned long \fIj\fP)
|
||||
u64_t sub64(u64_t \fIi\fP, u64_t \fIj\fP)
|
||||
u64_t sub64u(u64_t \fIi\fP, unsigned \fIj\fP)
|
||||
u64_t sub64ul(u64_t \fIi\fP, unsigned long \fIj\fP)
|
||||
unsigned diff64(u64_t \fIi\fP, u64_t \fIj\fP)
|
||||
int bsr64(u64_t \fIi\fP)
|
||||
u64_t cvu64(unsigned \fIi\fP)
|
||||
u64_t cvul64(unsigned long \fIi\fP)
|
||||
unsigned cv64u(u64_t \fIi\fP)
|
||||
unsigned long cv64ul(u64_t \fIi\fP)
|
||||
u64_t div64(u64_t \fIi\fP, u64_t \fIj\fP)
|
||||
unsigned long div64u(u64_t \fIi\fP, unsigned \fIj\fP)
|
||||
u64_t div64u64(u64_t \fIi\fP, unsigned \fIj\fP)
|
||||
u64_t rem64(u64_t \fIi\fP, u64_t \fIj\fP)
|
||||
unsigned rem64u(u64_t \fIi\fP, unsigned \fIj\fP)
|
||||
u64_t mul64(u64_t \fIi\fP, u64_t \fIj\fP)
|
||||
u64_t mul64u(unsigned long \fIi\fP, unsigned \fIj\fP)
|
||||
int cmp64(u64_t \fIi\fP, u64_t \fIj\fP)
|
||||
int cmp64u(u64_t \fIi\fP, unsigned \fIj\fP)
|
||||
int cmp64ul(u64_t \fIi\fP, unsigned long \fIj\fP)
|
||||
unsigned long ex64lo(u64_t \fIi\fP)
|
||||
unsigned long ex64hi(u64_t \fIi\fP)
|
||||
u64_t make64(unsigned long \fIlo\fP, unsigned long \fIhi\fP)
|
||||
u64_t rrotate64(u64_t \fIi\fP, unsigned short \fIb\fP)
|
||||
u64_t rshift64(u64_t \fIi\fP, unsigned short \fIb\fP)
|
||||
u64_t xor64(u64_t \fIi\fP, u64_t \fIj\fP)
|
||||
u64_t and64(u64_t \fIi\fP, u64_t \fIj\fP)
|
||||
u64_t not64(u64_t \fIi\fP)
|
||||
.fi
|
||||
.ft P
|
||||
.SH DESCRIPTION
|
||||
.de SP
|
||||
.if t .sp 0.4
|
||||
.if n .sp
|
||||
..
|
||||
The
|
||||
.B int64
|
||||
family of functions allow MINIX 3 to handle disks of up to 4 terabytes using
|
||||
32 bit sector numbers and 64 bit byte offsets on a machine where the C type
|
||||
.B long
|
||||
is 32 bits. The <minix/u64.h> include file defines a 64 bit data
|
||||
type,
|
||||
.BR u64_t ,
|
||||
and a number of functions to operate on them. Note that these functions are
|
||||
geared towards common disk offset and block computations, and do not provide
|
||||
a full set of 64 bit operations. They are:
|
||||
.PP
|
||||
.TP
|
||||
.B "u64_t add64(u64_t \fIi\fP, u64_t \fIj\fP)"
|
||||
Add the 64 bit numbers
|
||||
.I i
|
||||
and
|
||||
.I j
|
||||
forming a 64 bit result.
|
||||
.TP
|
||||
.B "u64_t add64u(u64_t \fIi\fP, unsigned \fIj\fP)"
|
||||
Add an unsigned
|
||||
.I j
|
||||
to a 64 bit number
|
||||
.I i
|
||||
forming a 64 bit result.
|
||||
.TP
|
||||
.B "u64_t add64ul(u64_t \fIi\fP, unsigned long \fIj\fP)"
|
||||
Add an unsigned long
|
||||
.I j
|
||||
to a 64 bit number
|
||||
.I i
|
||||
forming a 64 bit result.
|
||||
.TP
|
||||
.B "u64_t sub64(u64_t \fIi\fP, u64_t \fIj\fP)"
|
||||
Subtract the 64 bit number
|
||||
.I j
|
||||
from the 64 bit number
|
||||
.I i
|
||||
forming a 64 bit result.
|
||||
.TP
|
||||
.B "u64_t sub64u(u64_t \fIi\fP, unsigned \fIj\fP)"
|
||||
Subtract the unsigned
|
||||
.I j
|
||||
from the 64 bit number
|
||||
.I i
|
||||
forming a 64 bit result.
|
||||
.TP
|
||||
.B "u64_t sub64ul(u64_t \fIi\fP, unsigned long \fIj\fP)"
|
||||
Subtract the unsigned long
|
||||
.I j
|
||||
from the 64 bit number
|
||||
.I i
|
||||
forming a 64 bit result.
|
||||
.TP
|
||||
.B "unsigned diff64(u64_t \fIi\fP, u64_t \fIj\fP)"
|
||||
Subtract the 64 bit number
|
||||
.I j
|
||||
from the 64 bit number
|
||||
.I i
|
||||
forming an unsigned. Overflow is not checked.
|
||||
.TP
|
||||
.B "int bsr64(u64_t \fIi\fP)"
|
||||
Return the index of the highest-order bit set. If the value is zero, -1 is returned.
|
||||
.TP
|
||||
.B "u64_t cvu64(unsigned \fIi\fP)"
|
||||
Convert an unsigned to a 64 bit number.
|
||||
.TP
|
||||
.B "u64_t cvul64(unsigned long \fIi\fP)"
|
||||
Convert an unsigned long to a 64 bit number.
|
||||
.TP
|
||||
.B "unsigned cv64u(u64_t \fIi\fP)"
|
||||
Convert a 64 bit number to an unsigned if it fits, otherwise return
|
||||
.BR UINT_MAX .
|
||||
.TP
|
||||
.B "unsigned long cv64ul(u64_t \fIi\fP)"
|
||||
Convert a 64 bit number to an unsigned long if it fits, otherwise return
|
||||
.BR ULONG_MAX .
|
||||
.TP
|
||||
.B "u64_t div64(u64_t \fIi\fP, u64_t \fIj\fP)"
|
||||
Divide the 64 bit number
|
||||
.I i
|
||||
by the 64 bit number
|
||||
.I j
|
||||
giving a 64 bit number.
|
||||
.TP
|
||||
.B "unsigned long div64u(u64_t \fIi\fP, unsigned \fIj\fP)"
|
||||
Divide the 64 bit number
|
||||
.I i
|
||||
by the unsigned
|
||||
.I j
|
||||
giving an unsigned long. Overflow is not checked. (Typical "byte offset to
|
||||
block number" conversion.)
|
||||
.TP
|
||||
.B "u64_t div64u64(u64_t \fIi\fP, unsigned \fIj\fP)"
|
||||
Divide the 64 bit number
|
||||
.I i
|
||||
by the unsigned
|
||||
.I j
|
||||
giving a 64 bit number.
|
||||
.TP
|
||||
.B "u64_t rem64(u64_t \fIi\fP, u64_t \fIj\fP)"
|
||||
Compute the remainder of the division of the 64 bit number
|
||||
.I i
|
||||
by the 64 bit number
|
||||
.I j
|
||||
as a 64 bit number.
|
||||
.TP
|
||||
.B "unsigned rem64u(u64_t \fIi\fP, unsigned \fIj\fP)"
|
||||
Compute the remainder of the division of the 64 bit number
|
||||
.I i
|
||||
by the unsigned
|
||||
.I j
|
||||
as an unsigned. (Typical "byte offset within a block" computation.)
|
||||
.TP
|
||||
.B "u64_t mul64(u64_t \fIi\fP, u64_t \fIj\fP)"
|
||||
Multiply the 64 bit number
|
||||
.I i
|
||||
by the 64 bit number
|
||||
.I j
|
||||
giving a 64 bit number.
|
||||
.TP
|
||||
.B "u64_t mul64u(unsigned long \fIi\fP, unsigned \fIj\fP)"
|
||||
Multiply the unsigned long
|
||||
.I i
|
||||
by the unsigned
|
||||
.I j
|
||||
giving a 64 bit number. (Typical "block number to byte offset" conversion.)
|
||||
.TP
|
||||
.B "int cmp64(u64_t \fIi\fP, u64_t \fIj\fP)"
|
||||
Compare two 64 bit numbers.
|
||||
Returns
|
||||
.B -1
|
||||
if
|
||||
.I i
|
||||
<
|
||||
.IR j ,
|
||||
.B 0
|
||||
if
|
||||
.I i
|
||||
==
|
||||
.IR j ,
|
||||
and
|
||||
.B 1
|
||||
if
|
||||
.I i
|
||||
>
|
||||
.IR j .
|
||||
|
||||
.TP
|
||||
.B "u64_t rrotate64(u64_t \fIi\fP, unsigned short \fIb\fP)"
|
||||
Rotate first 64-bit argument to the right by \fIb\fP bits and
|
||||
return the result.
|
||||
|
||||
.TP
|
||||
.B "u64_t rshift64(u64_t \fIi\fP, unsigned short \fIb\fP)"
|
||||
Shift first 64-bit argument to the right by \fIb\fP bits and
|
||||
return the result.
|
||||
|
||||
.TP
|
||||
.B "u64_t xor64(u64_t \fIi\fP, u64_t \fIj\fP)"
|
||||
Return the 64-bit bitwise xor of the 64-bit \fIi\fP and \fIj\fP arguments.
|
||||
|
||||
.TP
|
||||
.B "u64_t and64(u64_t \fIi\fP, u64_t \fIj\fP)"
|
||||
Return the 64-bit bitwise and of the 64-bit \fIi\fP and \fIj\fP arguments.
|
||||
|
||||
.TP
|
||||
.B "u64_t not64(u64_t \fIi\fP)"
|
||||
Return the 64-bit bitwise not of the 64-bit \fIi\fP argument.
|
||||
|
||||
.TP
|
||||
.B "int cmp64u(u64_t \fIi\fP, unsigned \fIj\fP)"
|
||||
Likewise compare a 64 bit number with an unsigned.
|
||||
|
||||
.TP
|
||||
.B "int cmp64ul(u64_t \fIi\fP, unsigned long \fIj\fP)"
|
||||
Likewise compare a 64 bit number with an unsigned long.
|
||||
.TP
|
||||
.B "unsigned long ex64lo(u64_t \fIi\fP)"
|
||||
Extract the low 32 bits of a 64 bit number.
|
||||
.TP
|
||||
.B "unsigned long ex64hi(u64_t \fIi\fP)"
|
||||
Extract the high 32 bits of a 64 bit number.
|
||||
.TP
|
||||
.B "u64_t make64(unsigned long \fIlo\fP, unsigned long \fIhi\fP)"
|
||||
Combine the low and high parts of a 64 bit number to a 64 bit number. (The
|
||||
last three functions are used to pass 64 bit numbers in messages within the
|
||||
kernel. They should not be used for anything else.)
|
||||
.SH "SEE ALSO"
|
||||
.BR fcntl (2),
|
||||
.BR controller (4).
|
||||
.SH NOTES
|
||||
With the usual disk block size of 512 bytes the maximum disk size is 512
|
||||
\(** 4 gigabytes = 2 terabytes.
|
||||
.PP
|
||||
Standard MINIX 3 only uses 64 bit computations within the disk drivers, so
|
||||
individual partitions are still limited to 4 gigabytes. Minix-vmd has 64
|
||||
bit computations also in the file system code.
|
||||
.PP
|
||||
Special care must be taken when accessing disk devices. For MINIX 3 one may
|
||||
have to temporarily change the start of the partition to go beyond 4 G.
|
||||
Minix-vmd can go beyond 4 G, but the
|
||||
.B lseek
|
||||
system call is still limited to a 32 bit offset. One needs to use
|
||||
.PP
|
||||
.RS
|
||||
.BI "fcntl(" fd ", F_SEEK, u64_t " offset ")"
|
||||
.RE
|
||||
.PP
|
||||
to seek to a 64 bit position.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot <kjb@cs.vu.nl>
|
|
@ -1,26 +0,0 @@
|
|||
.TH ISLESSGREATER 3 "December 18, 2009"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
islessgreater, isgreater, isgreaterequal, isless, islessequal, isunordered \- order floating point numbers
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <math.h>
|
||||
|
||||
int isgreater(double \fIx\fP, double \fIy\fP);
|
||||
int isgreaterequal(double \fIx\fP, double \fIy\fP);
|
||||
int isless(double \fIx\fP, double \fIy\fP);
|
||||
int islessequal(double \fIx\fP, double \fIy\fP);
|
||||
int islessgreater(double \fIx\fP, double \fIy\fP);
|
||||
int isunordered(double \fIx\fP, double \fIy\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These functions compare the specified floating point numbers \fIx\fP and
|
||||
\fIy\fP. They differ from the regular comparison operators in that they
|
||||
recognize and additional 'unordered' relationship between the numbers if one of
|
||||
them is NaN. As a consequence, these functions do not raise floating point
|
||||
expceptions and can be safely used with NaN values.
|
||||
.SH "RETURN VALUE"
|
||||
The functions return a non-zero value if and only if the relationship specified
|
||||
in the name holds between \fIx\fP and \fIy\fP. All functions except for
|
||||
'isunordered' return zero if either of the numbers is NaN.
|
|
@ -1,19 +0,0 @@
|
|||
.TH LDEXP 3 "January 7, 2010"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
ldexp, scalbn, scalbnf, scalbln, scalblnf \- compute absolute value
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <math.h>
|
||||
|
||||
double ldexp(double \fIx\fP, int \fIn\fP);
|
||||
double scalbn(double \fIx\fP, int \fIn\fP);
|
||||
float scalbnf(float \fIx\fP, int \fIn\fP);
|
||||
double scalbln(double \fIx\fP, long \fIn\fP);
|
||||
float scalblnf(float \fIx\fP, long \fIn\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These functions all compute \fIx\fP * 2^\fIn\fP.
|
||||
.SH "RETURN VALUE
|
||||
These functions all return \fIx\fP * 2^\fIn\fP.
|
|
@ -1,97 +0,0 @@
|
|||
.Dd Mar 2, 2010
|
||||
.Dt MAKECONTEXT 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm makecontext ,
|
||||
.Nm swapcontext
|
||||
.Nd manipulate user contexts
|
||||
.Sh LIBRARY
|
||||
.Lb libc
|
||||
.Sh SYNOPSIS
|
||||
.In ucontext.h
|
||||
.Ft void
|
||||
.Fn makecontext "ucontext_t *ucp" "void (*func)(void)" "int argc" ...
|
||||
.Ft int
|
||||
.Fn swapcontext "ucontext_t *oucp" "const ucontext_t *ucp"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Xr makecontext 3 ,
|
||||
.Xr swapcontext 3 ,
|
||||
.Xr getcontext 3 ,
|
||||
and
|
||||
.Xr setcontext 3
|
||||
together form a set of functions that allow user-level context switching between multiple threads of control within a process.
|
||||
.Pp
|
||||
The
|
||||
.Fn makecontext
|
||||
function modifies the user thread pointed to by
|
||||
.Va ucp
|
||||
to continue execution by invoking function
|
||||
.Va func
|
||||
and passing that function a number of
|
||||
.Va argc
|
||||
integer arguments. The value of
|
||||
.Va argc
|
||||
must match the number of integer arguments passed to
|
||||
.Va func ,
|
||||
otherwise the behavior is undefined. Context
|
||||
.Va ucp
|
||||
must have been initialized by a call to
|
||||
.Xr getcontext 3
|
||||
and have a stack allocated for it. The address of the stack must be assigned to
|
||||
.Va ucp->uc_stack.ss_sp
|
||||
and the size of the stack to
|
||||
.Va ucp->uc_stack.ss_size .
|
||||
The
|
||||
.Va ucp->uc_link
|
||||
member is used to determine which successor context is run after the context modified by
|
||||
.Fn makecontext
|
||||
returns. If left NULL, the process exits.
|
||||
.Pp
|
||||
The
|
||||
.Fn swapcontext
|
||||
function saves the current context in the context structure pointed to by
|
||||
.Va oucp
|
||||
and sets the context to the context structure pointed to by
|
||||
.Va ucp .
|
||||
.Sh RETURN VALUES
|
||||
When successful,
|
||||
.Fn swapcontext
|
||||
returns 0. Otherwise, -1 is returned and
|
||||
.Va errno
|
||||
is set to indicate the error. Note that a successful call to
|
||||
.Fn swapcontext
|
||||
actually does not return. Only after returning to the context that called
|
||||
.Fn swapcontext ,
|
||||
it appears as if
|
||||
.Fn swapcontext
|
||||
returned 0.
|
||||
.Sh ERRORS
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EFAULT
|
||||
Either the
|
||||
.Va ucp
|
||||
or
|
||||
.Va oucp
|
||||
is a NULL pointer.
|
||||
.It Bq Er EINVAL
|
||||
The context is not properly initialized.
|
||||
.It Bq Er ENOMEM
|
||||
The
|
||||
.Va ucp
|
||||
argument does not have enough stack left to complete the operation.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr getcontext 3 ,
|
||||
.Xr setcontext 3
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Fn makecontext ,
|
||||
and
|
||||
.Fn swapcontext
|
||||
functions conform to
|
||||
.St -xsh5
|
||||
and
|
||||
.St -p1003.1-2001 .
|
||||
.Sh AUTHORS
|
||||
Thomas Veerman
|
|
@ -1,128 +0,0 @@
|
|||
.\" Copyright (c) 1980 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)malloc.3 6.3 (Berkeley) 5/14/86
|
||||
.\"
|
||||
.TH MALLOC 3 "May 14, 1986"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
malloc, free, realloc, calloc, alloca \- memory allocator
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <alloca.h>
|
||||
|
||||
void *malloc(size_t \fIsize\fP)
|
||||
void free(void *\fIptr\fP)
|
||||
void *realloc(void *\fIptr\fP, size_t \fIsize\fP)
|
||||
void *calloc(size_t \fInelem\fP, size_t \fIelsize\fP)
|
||||
void *alloca(size_t \fIsize\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Malloc
|
||||
and
|
||||
.B free
|
||||
provide a general-purpose memory allocation package.
|
||||
.B Malloc
|
||||
returns a pointer to a block of at least
|
||||
.I size
|
||||
bytes beginning on a word boundary.
|
||||
.PP
|
||||
The argument to
|
||||
.B free
|
||||
is a pointer to a block previously allocated by
|
||||
.BR malloc ;
|
||||
this space is made available for further allocation,
|
||||
but its contents are left undisturbed.
|
||||
A call with a null
|
||||
.I ptr
|
||||
is legal and does nothing.
|
||||
.PP
|
||||
Needless to say, grave disorder will result if the space assigned by
|
||||
.B malloc
|
||||
is overrun or if some random number is handed to
|
||||
.BR free .
|
||||
.PP
|
||||
.B Malloc
|
||||
maintains multiple lists of free blocks according to size,
|
||||
allocating space from the appropriate list.
|
||||
It calls
|
||||
.B sbrk
|
||||
(see
|
||||
.BR brk (2))
|
||||
to get more memory from the system when there is no
|
||||
suitable space already free.
|
||||
.PP
|
||||
.B Realloc
|
||||
changes the size of the block pointed to by
|
||||
.I ptr
|
||||
to
|
||||
.I size
|
||||
bytes and returns a pointer to the (possibly moved) block.
|
||||
The contents will be unchanged up to the lesser of the new and old sizes.
|
||||
A call with a null
|
||||
.I ptr
|
||||
is legal and has the same result as
|
||||
.BI malloc( size )\fR.
|
||||
.PP
|
||||
.B Calloc
|
||||
allocates space for an array of
|
||||
.I nelem
|
||||
elements of size
|
||||
.I elsize.
|
||||
The space is initialized to zeros.
|
||||
.PP
|
||||
.B Alloca
|
||||
allocates
|
||||
.I size
|
||||
bytes of space in the stack frame of the caller.
|
||||
This temporary space is automatically freed on
|
||||
return.
|
||||
.PP
|
||||
Each of the allocation routines returns a pointer
|
||||
to space suitably aligned (after possible pointer coercion)
|
||||
for storage of any type of object.
|
||||
.PP
|
||||
To debug malloc-related errors, specify the
|
||||
.I MALLOC_DEBUG
|
||||
variable in the environment of the program you want to debug. This causes an
|
||||
alternate malloc implementation to be used. This version allocates blocks at
|
||||
the end of random pages so that reads and writes past the end of the buffer
|
||||
cause SIGSEGV. On realloc or free calls, the area just before the buffer is
|
||||
verified to also detect writes before the start of the buffer. Buffer overflows
|
||||
in the BSS section are also more likely to be detected because the brk is never
|
||||
moved. Please note that this flags comes with a considerable performance
|
||||
penalty and dramatically increases memory usage.
|
||||
.SH SEE ALSO
|
||||
.BR brk (2).
|
||||
.SH DIAGNOSTICS
|
||||
.BR Malloc ,
|
||||
.BR realloc
|
||||
and
|
||||
.B calloc
|
||||
return a null pointer if there is no available memory or if the arena
|
||||
has been detectably corrupted by storing outside the bounds of a block.
|
||||
.SH NOTES
|
||||
Other implementations of
|
||||
.BR malloc ,
|
||||
.BR realloc
|
||||
or
|
||||
.BR calloc
|
||||
may return a null pointer if the size of the requested block is zero. This
|
||||
implementation will always return a zero length block at a unique address,
|
||||
but you should keep in mind that a null return is possible if the program
|
||||
is run to another system and that this should not be mistakenly seen as
|
||||
an error.
|
||||
.SH BUGS
|
||||
When
|
||||
.B realloc
|
||||
returns a null pointer, the block pointed to by
|
||||
.I ptr
|
||||
may be destroyed.
|
||||
.PP
|
||||
.B Alloca
|
||||
is machine dependent; its use is discouraged.
|
130
man/man3/md5.3
130
man/man3/md5.3
|
@ -1,130 +0,0 @@
|
|||
.\"
|
||||
.\" ----------------------------------------------------------------------------
|
||||
.\" "THE BEER-WARE LICENSE" (Revision 42):
|
||||
.\" <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
|
||||
.\" can do whatever you want with this stuff. If we meet some day, and you think
|
||||
.\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
.\" ----------------------------------------------------------------------------
|
||||
.\"
|
||||
.\" $OpenBSD: md5.3,v 1.10 2007/05/31 19:19:29 jmc Exp $
|
||||
.\"
|
||||
.Dd $Mdocdate: May 31 2007 $
|
||||
.Dt MD5 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm MD5Init ,
|
||||
.Nm MD5Update ,
|
||||
.Nm MD5Final ,
|
||||
.Nm MD5End ,
|
||||
.Nm MD5File ,
|
||||
.Nm MD5Data
|
||||
.Nd calculate the RSA Data Security, Inc., ``MD5'' message digest
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <sys/types.h>
|
||||
.Fd #include <minix/md5.h>
|
||||
.Ft void
|
||||
.Fn MD5Init "MD5_CTX *context"
|
||||
.Ft void
|
||||
.Fn MD5Update "MD5_CTX *context" "const u_int8_t *data" "size_t len"
|
||||
.Ft void
|
||||
.Fn MD5Final "u_int8_t digest[MD5_DIGEST_LENGTH]" "MD5_CTX *context"
|
||||
.Ft "char *"
|
||||
.Fn MD5End "MD5_CTX *context" "char *buf"
|
||||
.Ft "char *"
|
||||
.Fn MD5File "const char *filename" "char *buf"
|
||||
.Ft "char *"
|
||||
.Fn MD5Data "const u_int8_t *data" "size_t len" "char *buf"
|
||||
.Sh DESCRIPTION
|
||||
The MD5 functions calculate a 128-bit cryptographic checksum (digest)
|
||||
for any number of input bytes.
|
||||
A cryptographic checksum is a one-way
|
||||
hash-function, that is, you cannot find (except by exhaustive search)
|
||||
the input corresponding to a particular output.
|
||||
This net result is a
|
||||
.Dq fingerprint
|
||||
of the input-data, which doesn't disclose the actual input.
|
||||
.Pp
|
||||
The
|
||||
.Fn MD5Init ,
|
||||
.Fn MD5Update ,
|
||||
and
|
||||
.Fn MD5Final
|
||||
functions are the core functions.
|
||||
Allocate an MD5_CTX, initialize it with
|
||||
.Fn MD5Init ,
|
||||
run over the data with
|
||||
.Fn MD5Update ,
|
||||
and finally extract the result using
|
||||
.Fn MD5Final .
|
||||
.Pp
|
||||
.Fn MD5End
|
||||
is a wrapper for
|
||||
.Fn MD5Final
|
||||
which converts the return value to an MD5_DIGEST_STRING_LENGTH-character
|
||||
(including the terminating '\e0')
|
||||
.Tn ASCII
|
||||
string which represents the 128 bits in hexadecimal.
|
||||
.Pp
|
||||
.Fn MD5File
|
||||
calculates the digest of a file, and uses
|
||||
.Fn MD5End
|
||||
to return the result.
|
||||
If the file cannot be opened, a null pointer is returned.
|
||||
.Pp
|
||||
.Fn MD5Data
|
||||
calculates the digest of a chunk of data in memory, and uses
|
||||
.Fn MD5End
|
||||
to return the result.
|
||||
.Pp
|
||||
When using
|
||||
.Fn MD5End ,
|
||||
.Fn MD5File ,
|
||||
or
|
||||
.Fn MD5Data ,
|
||||
the
|
||||
.Ar buf
|
||||
argument can be a null pointer, in which case the returned string
|
||||
is allocated with
|
||||
.Xr malloc 3
|
||||
and subsequently must be explicitly deallocated using
|
||||
.Xr free 3
|
||||
after use.
|
||||
If the
|
||||
.Ar buf
|
||||
argument is non-null it must point to at least MD5_DIGEST_STRING_LENGTH
|
||||
characters of buffer space.
|
||||
.Rs
|
||||
.%A R. Rivest
|
||||
.%T The MD4 Message-Digest Algorithm
|
||||
.%O RFC 1186
|
||||
.Re
|
||||
.Rs
|
||||
.%A R. Rivest
|
||||
.%T The MD5 Message-Digest Algorithm
|
||||
.%O RFC 1321
|
||||
.Re
|
||||
.Rs
|
||||
.%A RSA Laboratories
|
||||
.%T Frequently Asked Questions About today's Cryptography
|
||||
.%O \&<http://www.rsa.com/rsalabs/faq/>
|
||||
.Re
|
||||
.Rs
|
||||
.%A H. Dobbertin
|
||||
.%T Alf Swindles Ann
|
||||
.%J CryptoBytes
|
||||
.%N 1(3):5
|
||||
.%D 1995
|
||||
.Re
|
||||
.Rs
|
||||
.%A MJ. B. Robshaw
|
||||
.%T On Recent Results for MD4 and MD5
|
||||
.%J RSA Laboratories Bulletin
|
||||
.%N 4
|
||||
.%D November 12, 1996
|
||||
.Re
|
||||
.Rs
|
||||
.%A Hans Dobbertin
|
||||
.%T Cryptanalysis of MD5 Compress
|
||||
.Re
|
||||
.Sh BUGS
|
||||
Collisions have been found for the full version of MD5.
|
|
@ -1,28 +0,0 @@
|
|||
.TH NEARBYINT 3 "December 18, 2009"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
nearbyint, ceil, floor, trunc \- floating point rounding
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <math.h>
|
||||
|
||||
double ceil(double \fIx\fP);
|
||||
double floor(double \fIx\fP);
|
||||
double nearbyint(double \fIx\fP);
|
||||
double trunc(double \fIx\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These functions round the specified floating point number to a nearby integer.
|
||||
For nearbyint, the rounding mode is determined by the value set using the
|
||||
fesetround function. The other functions are not influenced by the rounding
|
||||
mode. The ceil function rounds upwards, selecting the smallest integer that is
|
||||
larger than or equal to \fIx\fP. The floor function rounds downwards, selecting
|
||||
the largest integer that is smaller than or equal to \fIx\fP. The trunc function
|
||||
rounds towards zero, selecting the largest integer with the largest absolute
|
||||
value of which the absolute value is smaller than or equal to the absolute
|
||||
value of \fIx\fP.
|
||||
.SH "RETURN VALUE"
|
||||
The functions return an integer close to \fIx\fP.
|
||||
.SH "SEE ALSO"
|
||||
fesetround(3)
|
|
@ -1,237 +0,0 @@
|
|||
.TH NEWCTIME 3
|
||||
.SH NAME
|
||||
asctime, ctime, difftime, gmtime, localtime, mktime \- convert date and time to ASCII
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B extern char *tzname[2];
|
||||
.PP
|
||||
.B void tzset()
|
||||
.PP
|
||||
.B #include <sys/types.h>
|
||||
.PP
|
||||
.B char *ctime(clock)
|
||||
.B const time_t *clock;
|
||||
.PP
|
||||
.B double difftime(time1, time0)
|
||||
.B time_t time1;
|
||||
.B time_t time0;
|
||||
.PP
|
||||
.B #include <time.h>
|
||||
.PP
|
||||
.B char *asctime(tm)
|
||||
.B const struct tm *tm;
|
||||
.PP
|
||||
.B struct tm *localtime(clock)
|
||||
.B const time_t *clock;
|
||||
.PP
|
||||
.B struct tm *gmtime(clock)
|
||||
.B const time_t *clock;
|
||||
.PP
|
||||
.B time_t mktime(tm)
|
||||
.B struct tm *tm;
|
||||
.PP
|
||||
.B cc ... -ltz
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.I Ctime\^
|
||||
converts a long integer, pointed to by
|
||||
.IR clock ,
|
||||
representing the time in seconds since
|
||||
00:00:00 UTC, 1970-01-01,
|
||||
and returns a pointer to a
|
||||
string of the form
|
||||
.br
|
||||
.ce
|
||||
.eo
|
||||
Thu Nov 24 18:22:48 1986\n\0
|
||||
.br
|
||||
.ec
|
||||
Years requiring fewer than four characters are padded with leading zeroes.
|
||||
For years longer than four characters, the string is of the form
|
||||
.br
|
||||
.ce
|
||||
.eo
|
||||
Thu Nov 24 18:22:48 81986\n\0
|
||||
.ec
|
||||
.br
|
||||
with five spaces before the year.
|
||||
These unusual formats are designed to make it less likely that older
|
||||
software that expects exactly 26 bytes of output will mistakenly output
|
||||
misleading values for out-of-range years.
|
||||
.PP
|
||||
.I Localtime\^
|
||||
and
|
||||
.I gmtime\^
|
||||
return pointers to ``tm'' structures, described below.
|
||||
.I Localtime\^
|
||||
corrects for the time zone and any time zone adjustments
|
||||
(such as Daylight Saving Time in the United States).
|
||||
After filling in the ``tm'' structure,
|
||||
.I localtime
|
||||
sets the
|
||||
.BR tm_isdst 'th
|
||||
element of
|
||||
.B tzname
|
||||
to a pointer to an
|
||||
ASCII string that's the time zone abbreviation to be used with
|
||||
.IR localtime 's
|
||||
return value.
|
||||
.PP
|
||||
.I Gmtime\^
|
||||
converts to Coordinated Universal Time.
|
||||
.PP
|
||||
.I Asctime\^
|
||||
converts a time value contained in a
|
||||
``tm'' structure to a string,
|
||||
as shown in the above example,
|
||||
and returns a pointer to the string.
|
||||
.PP
|
||||
.I Mktime\^
|
||||
converts the broken-down time,
|
||||
expressed as local time,
|
||||
in the structure pointed to by
|
||||
.I tm
|
||||
into a calendar time value with the same encoding as that of the values
|
||||
returned by the
|
||||
.I time
|
||||
function.
|
||||
The original values of the
|
||||
.B tm_wday
|
||||
and
|
||||
.B tm_yday
|
||||
components of the structure are ignored,
|
||||
and the original values of the other components are not restricted
|
||||
to their normal ranges.
|
||||
(A positive or zero value for
|
||||
.B tm_isdst
|
||||
causes
|
||||
.I mktime
|
||||
to presume initially that summer time (for example, Daylight Saving Time
|
||||
in the U.S.A.)
|
||||
respectively,
|
||||
is or is not in effect for the specified time.
|
||||
A negative value for
|
||||
.B tm_isdst
|
||||
causes the
|
||||
.I mktime
|
||||
function to attempt to divine whether summer time is in effect
|
||||
for the specified time.)
|
||||
On successful completion, the values of the
|
||||
.B tm_wday
|
||||
and
|
||||
.B tm_yday
|
||||
components of the structure are set appropriately,
|
||||
and the other components are set to represent the specified calendar time,
|
||||
but with their values forced to their normal ranges; the final value of
|
||||
.B tm_mday
|
||||
is not set until
|
||||
.B tm_mon
|
||||
and
|
||||
.B tm_year
|
||||
are determined.
|
||||
.I Mktime\^
|
||||
returns the specified calendar time;
|
||||
If the calendar time cannot be represented,
|
||||
it returns
|
||||
.BR -1 .
|
||||
.PP
|
||||
.I Difftime\^
|
||||
returns the difference between two calendar times,
|
||||
.RI ( time1
|
||||
-
|
||||
.IR time0 ),
|
||||
expressed in seconds.
|
||||
.PP
|
||||
Declarations of all the functions and externals, and the ``tm'' structure,
|
||||
are in the
|
||||
.B <time.h>\^
|
||||
header file.
|
||||
The structure (of type)
|
||||
.B struct tm
|
||||
includes the following fields:
|
||||
.RS
|
||||
.PP
|
||||
.nf
|
||||
.ta .5i +\w'long tm_gmtoff;\0\0'u
|
||||
int tm_sec; /\(** seconds (0 - 60) \(**/
|
||||
int tm_min; /\(** minutes (0 - 59) \(**/
|
||||
int tm_hour; /\(** hours (0 - 23) \(**/
|
||||
int tm_mday; /\(** day of month (1 - 31) \(**/
|
||||
int tm_mon; /\(** month of year (0 - 11) \(**/
|
||||
int tm_year; /\(** year \- 1900 \(**/
|
||||
int tm_wday; /\(** day of week (Sunday = 0) \(**/
|
||||
int tm_yday; /\(** day of year (0 - 365) \(**/
|
||||
int tm_isdst; /\(** is summer time in effect? \(**/
|
||||
char \(**tm_zone; /\(** abbreviation of timezone name \(**/
|
||||
long tm_gmtoff; /\(** offset from UTC in seconds \(**/
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The
|
||||
.I tm_zone
|
||||
and
|
||||
.I tm_gmtoff
|
||||
fields exist, and are filled in, only if arrangements to do
|
||||
so were made when the library containing these functions was
|
||||
created.
|
||||
There is no guarantee that these fields will continue to exist
|
||||
in this form in future releases of this code.
|
||||
.PP
|
||||
.I Tm_isdst\^
|
||||
is non-zero if summer time is in effect.
|
||||
.PP
|
||||
.I Tm_gmtoff
|
||||
is the offset (in seconds) of the time represented
|
||||
from UTC, with positive values indicating east
|
||||
of the Prime Meridian.
|
||||
.SH FILES
|
||||
.ta \w'/usr/share/zoneinfo/posixrules\0\0'u
|
||||
/usr/share/zoneinfo time zone information directory
|
||||
.br
|
||||
/usr/share/zoneinfo/localtime local time zone file
|
||||
.br
|
||||
/usr/share/zoneinfo/posixrules used with POSIX-style TZ's
|
||||
.br
|
||||
/usr/share/zoneinfo/GMT for UTC leap seconds
|
||||
.sp
|
||||
If
|
||||
.B /usr/share/zoneinfo/GMT
|
||||
is absent,
|
||||
UTC leap seconds are loaded from
|
||||
.BR /usr/share/zoneinfo/posixrules .
|
||||
.SH SEE ALSO
|
||||
getenv(3),
|
||||
newstrftime(3),
|
||||
newtzset(3),
|
||||
time(2),
|
||||
tzfile(5)
|
||||
.SH NOTES
|
||||
The return values point to static data;
|
||||
the data is overwritten by each call.
|
||||
The
|
||||
.B tm_zone
|
||||
field of a returned
|
||||
.B "struct tm"
|
||||
points to a static array of characters, which
|
||||
will also be overwritten at the next call
|
||||
(and by calls to
|
||||
.IR tzset ).
|
||||
.PP
|
||||
.I Asctime\^
|
||||
and
|
||||
.I ctime\^
|
||||
behave strangely for years before 1000 or after 9999.
|
||||
The 1989 and 1999 editions of the C Standard say
|
||||
that years from \-99 through 999 are converted without
|
||||
extra spaces, but this conflicts with longstanding
|
||||
tradition and with this implementation.
|
||||
Traditional implementations of these two functions are
|
||||
restricted to years in the range 1900 through 2099.
|
||||
To avoid this portability mess, new programs should use
|
||||
.I strftime\^
|
||||
instead.
|
||||
.PP
|
||||
Avoid using out-of-range values with
|
||||
.I mktime
|
||||
when setting up lunch with promptness sticklers in Riyadh.
|
||||
.\" @(#)newctime.3 7.17
|
|
@ -1,230 +0,0 @@
|
|||
.\" Based on the UCB file whose copyright information appears below.
|
||||
.\" Copyright (c) 1989, 1991 The Regents of the University of California.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" This code is derived from software contributed to Berkeley by
|
||||
.\" the American National Standards Committee X3, on Information
|
||||
.\" Processing Systems.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)strftime.3 5.12 (Berkeley) 6/29/91
|
||||
.\" $Id: strftime.3,v 1.4 1993/12/15 20:33:00 jtc Exp $
|
||||
.\"
|
||||
.TH NEWSTRFTIME 3
|
||||
.SH NAME
|
||||
strftime \- format date and time
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <sys/types.h>
|
||||
.B #include <time.h>
|
||||
.PP
|
||||
.B size_t strftime(buf, maxsize, format, timeptr)
|
||||
.B char *buf;
|
||||
.B size_t maxsize;
|
||||
.B const char *format;
|
||||
.B const struct tm *timeptr
|
||||
.PP
|
||||
.B cc ... -ltz
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.I strftime\^
|
||||
function formats the information from
|
||||
.I timeptr\^
|
||||
into the buffer
|
||||
.I buf\^
|
||||
according to the string pointed to by
|
||||
.IR format\^ .
|
||||
.PP
|
||||
The
|
||||
.I format\^
|
||||
string consists of zero or more conversion specifications and
|
||||
ordinary characters.
|
||||
All ordinary characters are copied directly into the buffer.
|
||||
A conversion specification consists of a percent sign
|
||||
.Ql %
|
||||
and one other character.
|
||||
.PP
|
||||
No more than
|
||||
.I maxsize\^
|
||||
characters are be placed into the array.
|
||||
If the total number of resulting characters, including the terminating
|
||||
null character, is not more than
|
||||
.IR maxsize\^ ,
|
||||
.I strftime\^
|
||||
returns the number of characters in the array, not counting the
|
||||
terminating null.
|
||||
Otherwise, zero is returned.
|
||||
.PP
|
||||
Each conversion specification is replaced by the characters as
|
||||
follows which are then copied into the buffer.
|
||||
.TP
|
||||
%A
|
||||
is replaced by the locale's full weekday name.
|
||||
.TP
|
||||
%a
|
||||
is replaced by the locale's abbreviated weekday name.
|
||||
.TP
|
||||
%B
|
||||
is replaced by the locale's full month name.
|
||||
.TP
|
||||
%b or %h
|
||||
is replaced by the locale's abbreviated month name.
|
||||
.TP
|
||||
%C
|
||||
is replaced by the century (a year divided by 100 and truncated to an integer)
|
||||
as a decimal number (00-99).
|
||||
.TP
|
||||
%c
|
||||
is replaced by the locale's appropriate date and time representation.
|
||||
.TP
|
||||
%D
|
||||
is replaced by the date in the format %m/%d/%y.
|
||||
.TP
|
||||
%d
|
||||
is replaced by the day of the month as a decimal number (01-31).
|
||||
.TP
|
||||
%e
|
||||
is replaced by the day of month as a decimal number (1-31);
|
||||
single digits are preceded by a blank.
|
||||
.TP
|
||||
%F
|
||||
is replaced by the date in the format %Y-%m-%d.
|
||||
.TP
|
||||
%G
|
||||
is replaced by the ISO 8601 year with century as a decimal number.
|
||||
.TP
|
||||
%g
|
||||
is replaced by the ISO 8601 year without century as a decimal number (00-99).
|
||||
.TP
|
||||
%H
|
||||
is replaced by the hour (24-hour clock) as a decimal number (00-23).
|
||||
.TP
|
||||
%I
|
||||
is replaced by the hour (12-hour clock) as a decimal number (01-12).
|
||||
.TP
|
||||
%j
|
||||
is replaced by the day of the year as a decimal number (001-366).
|
||||
.TP
|
||||
%k
|
||||
is replaced by the hour (24-hour clock) as a decimal number (0-23);
|
||||
single digits are preceded by a blank.
|
||||
.TP
|
||||
%l
|
||||
is replaced by the hour (12-hour clock) as a decimal number (1-12);
|
||||
single digits are preceded by a blank.
|
||||
.TP
|
||||
%M
|
||||
is replaced by the minute as a decimal number (00-59).
|
||||
.TP
|
||||
%m
|
||||
is replaced by the month as a decimal number (01-12).
|
||||
.TP
|
||||
%n
|
||||
is replaced by a newline.
|
||||
.TP
|
||||
%p
|
||||
is replaced by the locale's equivalent of either AM or PM.
|
||||
.TP
|
||||
%R
|
||||
is replaced by the time in the format %H:%M.
|
||||
.TP
|
||||
%r
|
||||
is replaced by the locale's representation of 12-hour clock time
|
||||
using AM/PM notation.
|
||||
.TP
|
||||
%S
|
||||
is replaced by the second as a decimal number (00-60).
|
||||
.TP
|
||||
%s
|
||||
is replaced by the number of seconds since the Epoch, UTC (see mktime(3)).
|
||||
.TP
|
||||
%T
|
||||
is replaced by the time in the format %H:%M:%S.
|
||||
.TP
|
||||
%t
|
||||
is replaced by a tab.
|
||||
.TP
|
||||
%U
|
||||
is replaced by the week number of the year (Sunday as the first day of
|
||||
the week) as a decimal number (00-53).
|
||||
.TP
|
||||
%u
|
||||
is replaced by the weekday (Monday as the first day of the week)
|
||||
as a decimal number (1-7).
|
||||
.TP
|
||||
%V
|
||||
is replaced by the week number of the year (Monday as the first day of
|
||||
the week) as a decimal number (01-53). If the week containing January
|
||||
1 has four or more days in the new year, then it is week 1; otherwise
|
||||
it is week 53 of the previous year, and the next week is week 1.
|
||||
.TP
|
||||
%W
|
||||
is replaced by the week number of the year (Monday as the first day of
|
||||
the week) as a decimal number (00-53).
|
||||
.TP
|
||||
%w
|
||||
is replaced by the weekday (Sunday as the first day of the week)
|
||||
as a decimal number (0-6).
|
||||
.TP
|
||||
%X
|
||||
is replaced by the locale's appropriate time representation.
|
||||
.TP
|
||||
%x
|
||||
is replaced by the locale's appropriate date representation.
|
||||
.TP
|
||||
%Y
|
||||
is replaced by the year with century as a decimal number.
|
||||
.TP
|
||||
%y
|
||||
is replaced by the year without century as a decimal number (00-99).
|
||||
.TP
|
||||
%Z
|
||||
is replaced by the time zone name,
|
||||
or by the empty string if this is not determinable.
|
||||
.TP
|
||||
%z
|
||||
is replaced by the offset from UTC in the format +HHMM or -HHMM as appropriate,
|
||||
with positive values representing locations east of Greenwich,
|
||||
or by the empty string if this is not determinable.
|
||||
.TP
|
||||
%%
|
||||
is replaced by a single %.
|
||||
.TP
|
||||
%+
|
||||
is replaced by the date and time in date(1) format.
|
||||
.SH SEE ALSO
|
||||
date(1),
|
||||
getenv(3),
|
||||
newctime(3),
|
||||
newtzset(3),
|
||||
time(2),
|
||||
tzfile(5)
|
||||
.\" @(#)newstrftime.3 7.15
|
|
@ -1,237 +0,0 @@
|
|||
.TH NEWTZSET 3
|
||||
.SH NAME
|
||||
tzset \- initialize time conversion information
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B void tzset()
|
||||
.PP
|
||||
.B cc ... -ltz
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.I Tzset
|
||||
uses the value of the environment variable
|
||||
.B TZ
|
||||
to set time conversion information used by
|
||||
.IR localtime .
|
||||
If
|
||||
.B TZ
|
||||
does not appear in the environment,
|
||||
the best available approximation to local wall clock time, as specified
|
||||
by the
|
||||
.IR tzfile (5)-format
|
||||
file
|
||||
.B localtime
|
||||
in the system time conversion information directory, is used by
|
||||
.IR localtime .
|
||||
If
|
||||
.B TZ
|
||||
appears in the environment but its value is a null string,
|
||||
Coordinated Universal Time (UTC) is used (without leap second
|
||||
correction). If
|
||||
.B TZ
|
||||
appears in the environment and its value is not a null string:
|
||||
.IP
|
||||
if the value begins with a colon, it is used as a pathname of a file
|
||||
from which to read the time conversion information;
|
||||
.IP
|
||||
if the value does not begin with a colon, it is first used as the
|
||||
pathname of a file from which to read the time conversion information,
|
||||
and, if that file cannot be read, is used directly as a specification of
|
||||
the time conversion information.
|
||||
.PP
|
||||
When
|
||||
.B TZ
|
||||
is used as a pathname, if it begins with a slash,
|
||||
it is used as an absolute pathname; otherwise,
|
||||
it is used as a pathname relative to a system time conversion information
|
||||
directory.
|
||||
The file must be in the format specified in
|
||||
.IR tzfile (5).
|
||||
.PP
|
||||
When
|
||||
.B TZ
|
||||
is used directly as a specification of the time conversion information,
|
||||
it must have the following syntax (spaces inserted for clarity):
|
||||
.IP
|
||||
\fIstd\|offset\fR[\fIdst\fR[\fIoffset\fR][\fB,\fIrule\fR]]
|
||||
.PP
|
||||
Where:
|
||||
.RS
|
||||
.TP 15
|
||||
.IR std " and " dst
|
||||
Three or more bytes that are the designation for the standard
|
||||
.RI ( std )
|
||||
or summer
|
||||
.RI ( dst )
|
||||
time zone. Only
|
||||
.I std
|
||||
is required; if
|
||||
.I dst
|
||||
is missing, then summer time does not apply in this locale.
|
||||
Upper- and lowercase letters are explicitly allowed. Any characters
|
||||
except a leading colon
|
||||
.RB ( : ),
|
||||
digits, comma
|
||||
.RB ( , ),
|
||||
minus
|
||||
.RB ( \(mi ),
|
||||
plus
|
||||
.RB ( \(pl ),
|
||||
and ASCII NUL are allowed.
|
||||
.TP
|
||||
.I offset
|
||||
Indicates the value one must add to the local time to arrive at
|
||||
Coordinated Universal Time. The
|
||||
.I offset
|
||||
has the form:
|
||||
.RS
|
||||
.IP
|
||||
\fIhh\fR[\fB:\fImm\fR[\fB:\fIss\fR]]
|
||||
.RE
|
||||
.IP
|
||||
The minutes
|
||||
.RI ( mm )
|
||||
and seconds
|
||||
.RI ( ss )
|
||||
are optional. The hour
|
||||
.RI ( hh )
|
||||
is required and may be a single digit. The
|
||||
.I offset
|
||||
following
|
||||
.I std
|
||||
is required. If no
|
||||
.I offset
|
||||
follows
|
||||
.IR dst ,
|
||||
summer time is assumed to be one hour ahead of standard time. One or
|
||||
more digits may be used; the value is always interpreted as a decimal
|
||||
number. The hour must be between zero and 24, and the minutes (and
|
||||
seconds) \(em if present \(em between zero and 59. If preceded by a
|
||||
.RB `` \(mi '',
|
||||
the time zone shall be east of the Prime Meridian; otherwise it shall be
|
||||
west (which may be indicated by an optional preceding
|
||||
.RB `` \(pl '').
|
||||
.TP
|
||||
.I rule
|
||||
Indicates when to change to and back from summer time. The
|
||||
.I rule
|
||||
has the form:
|
||||
.RS
|
||||
.IP
|
||||
\fIdate\fB/\fItime\fB,\fIdate\fB/\fItime\fR
|
||||
.RE
|
||||
.IP
|
||||
where the first
|
||||
.I date
|
||||
describes when the change from standard to summer time occurs and the
|
||||
second
|
||||
.I date
|
||||
describes when the change back happens. Each
|
||||
.I time
|
||||
field describes when, in current local time, the change to the other
|
||||
time is made.
|
||||
.IP
|
||||
The format of
|
||||
.I date
|
||||
is one of the following:
|
||||
.RS
|
||||
.TP 10
|
||||
.BI J n
|
||||
The Julian day
|
||||
.I n
|
||||
.RI "(1\ \(<=" "\ n\ " "\(<=\ 365).
|
||||
Leap days are not counted; that is, in all years \(em including leap
|
||||
years \(em February 28 is day 59 and March 1 is day 60. It is
|
||||
impossible to explicitly refer to the occasional February 29.
|
||||
.TP
|
||||
.I n
|
||||
The zero-based Julian day
|
||||
.RI "(0\ \(<=" "\ n\ " "\(<=\ 365).
|
||||
Leap days are counted, and it is possible to refer to February 29.
|
||||
.TP
|
||||
.BI M m . n . d
|
||||
The
|
||||
.IR d' th
|
||||
day
|
||||
.RI "(0\ \(<=" "\ d\ " "\(<=\ 6)
|
||||
of week
|
||||
.I n
|
||||
of month
|
||||
.I m
|
||||
of the year
|
||||
.RI "(1\ \(<=" "\ n\ " "\(<=\ 5,
|
||||
.RI "1\ \(<=" "\ m\ " "\(<=\ 12,
|
||||
where week 5 means ``the last
|
||||
.I d
|
||||
day in month
|
||||
.IR m ''
|
||||
which may occur in either the fourth or the fifth week). Week 1 is the
|
||||
first week in which the
|
||||
.IR d' th
|
||||
day occurs. Day zero is Sunday.
|
||||
.RE
|
||||
.IP "" 15
|
||||
The
|
||||
.I time
|
||||
has the same format as
|
||||
.I offset
|
||||
except that no leading sign
|
||||
.RB (`` \(mi ''
|
||||
or
|
||||
.RB `` \(pl '')
|
||||
is allowed. The default, if
|
||||
.I time
|
||||
is not given, is
|
||||
.BR 02:00:00 .
|
||||
.RE
|
||||
.LP
|
||||
If no
|
||||
.I rule
|
||||
is present in
|
||||
.BR TZ ,
|
||||
the rules specified
|
||||
by the
|
||||
.IR tzfile (5)-format
|
||||
file
|
||||
.B posixrules
|
||||
in the system time conversion information directory are used, with the
|
||||
standard and summer time offsets from UTC replaced by those specified by
|
||||
the
|
||||
.I offset
|
||||
values in
|
||||
.BR TZ .
|
||||
.PP
|
||||
For compatibility with System V Release 3.1, a semicolon
|
||||
.RB ( ; )
|
||||
may be used to separate the
|
||||
.I rule
|
||||
from the rest of the specification.
|
||||
.PP
|
||||
If the
|
||||
.B TZ
|
||||
environment variable does not specify a
|
||||
.IR tzfile (5)-format
|
||||
and cannot be interpreted as a direct specification,
|
||||
UTC is used.
|
||||
.SH FILES
|
||||
.ta \w'/usr/share/zoneinfo/posixrules\0\0'u
|
||||
/usr/share/zoneinfo time zone information directory
|
||||
.br
|
||||
/usr/share/zoneinfo/localtime local time zone file
|
||||
.br
|
||||
/usr/share/zoneinfo/posixrules used with POSIX-style TZ's
|
||||
.br
|
||||
/usr/share/zoneinfo/GMT for UTC leap seconds
|
||||
.sp
|
||||
If
|
||||
.B /usr/share/zoneinfo/GMT
|
||||
is absent,
|
||||
UTC leap seconds are loaded from
|
||||
.BR /usr/share/zoneinfo/posixrules .
|
||||
.SH SEE ALSO
|
||||
getenv(3),
|
||||
newctime(3),
|
||||
newstrftime(3),
|
||||
time(2),
|
||||
tzfile(5)
|
||||
.\" @(#)newtzset.3 7.5
|
|
@ -1,45 +0,0 @@
|
|||
.TH ONEC_SUM 3
|
||||
.SH NAME
|
||||
oneC_sum \- One's complement internet checksum
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
.nf
|
||||
#define _MINIX_SOURCE 1
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <net/gen/oneCsum.h>
|
||||
|
||||
u16_t oneC_sum(u16_t \fIprev\fP, void *\fIdata\fP, size_t \fIsize\fP)
|
||||
.fi
|
||||
.ft R
|
||||
.SH DESCRIPTION
|
||||
.B OneC_sum
|
||||
is used to calculate the one's complement checksum needed for IP network
|
||||
packets.
|
||||
A good document about the Internet Checksum is RFC-1071 (Computing the
|
||||
Internet checksum).
|
||||
.PP
|
||||
.B OneC_sum
|
||||
expects three parameters:
|
||||
.TP 10
|
||||
.I prev
|
||||
The checksum of previous blocks of data that are to be included in the
|
||||
checksum.
|
||||
The value of prev in first call to oneC_sum should be 0.
|
||||
.TP
|
||||
.I data
|
||||
A pointer to the block of data.
|
||||
The data is interpreted as a series of 16 bit numbers in network byte order, but
|
||||
an odd number of bytes is also allowed.
|
||||
.TP
|
||||
.I size
|
||||
The size of the data in bytes.
|
||||
.SH "SEE ALSO"
|
||||
.BR ip (4).
|
||||
.br
|
||||
.B RFC-1071
|
||||
.SH AUTHOR
|
||||
Philip Homburg (philip@cs.vu.nl)
|
||||
.\"
|
||||
.\" $PchId: oneC_sum.3,v 1.3 1996/02/22 21:05:31 philip Exp $
|
|
@ -1,18 +0,0 @@
|
|||
.TH OPENPTY 3 "May 15, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
openpty \- library call to obtain a pty
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <libutil.h>
|
||||
|
||||
int openpty(int *\fIamaster\fP, int *\fIaslave\fP, char *\fIname\fP, struct termios *\fItermp\fP, struct winsize *\fIwinp\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Openpty
|
||||
tries to obtain pty file descriptors by opening /dev/ttypX and
|
||||
/dev/ptypX, setting *\fIamaster\fP and *\fIaslave\fP to these fd's,
|
||||
changing ownership of the slave pty to the current process, and making
|
||||
it only group-writable by group tty.
|
|
@ -1,51 +0,0 @@
|
|||
.\" @(#)popen.3 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH POPEN 3 "May 15, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
popen, pclose \- initiate I/O to/from a process
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
|
||||
FILE *popen(const char *command, const char *type)
|
||||
int pclose(FILE *stream)
|
||||
.SH DESCRIPTION
|
||||
The arguments to
|
||||
.B popen
|
||||
are pointers to null-terminated strings containing respectively a
|
||||
shell command line and an I/O mode, either "r" for reading or "w" for
|
||||
writing. It creates a pipe between the calling process and
|
||||
the command to be executed. The value returned is a stream pointer that
|
||||
can be used (as appropriate) to write to the standard input
|
||||
of the command or read from its standard output.
|
||||
.PP
|
||||
A stream opened by
|
||||
.B popen
|
||||
should be closed by
|
||||
.BR pclose ,
|
||||
which waits for the associated process to terminate
|
||||
and returns the exit status of the command.
|
||||
.PP
|
||||
Because open files are shared, a type "r" command may be used as an input
|
||||
filter, and a type "w" as an output filter.
|
||||
.SH "SEE ALSO"
|
||||
.BR pipe (2),
|
||||
.BR fopen (3),
|
||||
.BR fclose (3),
|
||||
.BR system (3),
|
||||
.BR wait (2),
|
||||
.BR sh (1).
|
||||
.SH DIAGNOSTICS
|
||||
.B Popen
|
||||
returns a null pointer if files or processes cannot be created, or the shell
|
||||
cannot be accessed.
|
||||
.SH BUGS
|
||||
Buffered reading before opening an input filter
|
||||
may leave the standard input of that filter mispositioned.
|
||||
Similar problems with an output filter may be
|
||||
forestalled by careful buffer flushing, for instance, with
|
||||
.BR fflush ,
|
||||
see
|
||||
.BR fclose (3).
|
|
@ -1,264 +0,0 @@
|
|||
.\" @(#)printf.3s 6.3 (Berkeley) 6/5/86
|
||||
.\"
|
||||
.TH PRINTF 3 "June 5, 1986"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf \- formatted output conversion
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int printf(const char *\fIformat\fP \fR[\fP, \fIarg\fP\fR] ...\fP);
|
||||
int fprintf(FILE *\fIstream\fP, const char *\fIformat\fP \fR[\fP, \fIarg\fP\fR] ...\fP);
|
||||
int sprintf(char *\fIs\fP, const char *\fIformat\fP \fR[\fP, \fIarg\fP\fR] ...\fP);
|
||||
int snprintf(char *\fIs\fP, size_t \fIn\fP, const char *\fIformat\fP \fR[\fP, \fIarg\fP\fR] ...\fP);
|
||||
int vprintf(const char *\fIformat\fP, va_list \fIargs\fP);
|
||||
int vfprintf(FILE *\fIstream\fP, const char *\fIformat\fP, va_list \fIargs\fP);
|
||||
int vsprintf(char *\fIs\fP, const char *\fIformat\fP, va_list \fIargs\fP);
|
||||
int vsnprintf(char *\fIs\fP, size_t \fIn\fP, const char *\fIformat\fP, va_list \fIargs\fP);
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Printf
|
||||
places output on the standard output stream
|
||||
.BR stdout .
|
||||
.B Fprintf
|
||||
places output on the named output
|
||||
.IR stream .
|
||||
.B Sprintf
|
||||
places `output' in the string
|
||||
.IR s ,
|
||||
followed by the character `\e0'.
|
||||
.B Snprintf
|
||||
(Minix-vmd only)
|
||||
is like
|
||||
.B sprintf
|
||||
except that no more than
|
||||
.IR n \-1
|
||||
characters are written to
|
||||
.I s
|
||||
followed by a `\e0'.
|
||||
.PP
|
||||
The
|
||||
.B v*printf
|
||||
functions can be used to make functions like the first four by using the
|
||||
.BR stdarg (3)
|
||||
method to process the argument.
|
||||
.PP
|
||||
Each of these functions converts, formats, and prints its arguments after
|
||||
the first under control of the first argument.
|
||||
The first argument is a character string which contains two types of objects:
|
||||
plain characters, which are simply copied to the output stream,
|
||||
and conversion specifications, each of which causes conversion and printing
|
||||
of the next successive
|
||||
.IR arg .
|
||||
.PP
|
||||
Each conversion specification is introduced by the character
|
||||
.BR % .
|
||||
The remainder of the conversion specification includes
|
||||
in the following order
|
||||
.TP
|
||||
\(bu
|
||||
Zero or more of following flags:
|
||||
.RS
|
||||
.TP
|
||||
\(bu
|
||||
a `#' character
|
||||
specifying that the value should be converted to an ``alternate form''.
|
||||
For
|
||||
.BR c ,
|
||||
.BR d ,
|
||||
.BR s ,
|
||||
and
|
||||
.BR u
|
||||
conversions, this option has no effect. For
|
||||
.B o
|
||||
conversions, the precision of the number is increased to force the first
|
||||
character of the output string to a zero. For
|
||||
.BR x ( X )
|
||||
conversion, a non-zero result has the string
|
||||
.BR 0x ( 0X )
|
||||
prepended to it. For
|
||||
.BR e ,
|
||||
.BR E ,
|
||||
.BR f ,
|
||||
.BR g ,
|
||||
and
|
||||
.BR G
|
||||
conversions, the result will always contain a decimal point, even if no
|
||||
digits follow the point (normally, a decimal point only appears in the
|
||||
results of those conversions if a digit follows the decimal point). For
|
||||
.B g
|
||||
and
|
||||
.B G
|
||||
conversions, trailing zeros are not removed from the result as they
|
||||
would otherwise be.
|
||||
.TP
|
||||
\(bu
|
||||
a minus sign `\-' which specifies
|
||||
.I "left adjustment"
|
||||
of the converted value in the indicated field;
|
||||
.TP
|
||||
\(bu
|
||||
a `+' character specifying that there should always be
|
||||
a sign placed before the number when using signed conversions.
|
||||
.TP
|
||||
\(bu
|
||||
a space specifying that a blank should be left before a positive number
|
||||
during a signed conversion. A `+' overrides a space if both are used.
|
||||
.RE
|
||||
.TP
|
||||
\(bu
|
||||
an optional digit string specifying a
|
||||
.I "field width;"
|
||||
if the converted value has fewer characters than the field width
|
||||
it will be blank-padded on the left (or right,
|
||||
if the left-adjustment indicator has been given) to make up the field width;
|
||||
if the field width begins with a zero,
|
||||
zero-padding will be done instead of blank-padding;
|
||||
.TP
|
||||
\(bu
|
||||
an optional period
|
||||
.RB ` . '
|
||||
which serves to separate the field width from the next digit string;
|
||||
.TP
|
||||
\(bu
|
||||
an optional digit string specifying a
|
||||
.I precision
|
||||
which specifies the number of digits to appear after the
|
||||
decimal point, for e- and f-conversion, or the maximum number of characters
|
||||
to be printed from a string;
|
||||
.TP
|
||||
\(bu
|
||||
the character
|
||||
.B l
|
||||
specifying that a following
|
||||
.BR d ,
|
||||
.BR o ,
|
||||
.BR x ,
|
||||
or
|
||||
.B u
|
||||
corresponds to a long integer
|
||||
.IR arg .
|
||||
.TP
|
||||
\(bu
|
||||
a character which indicates the type of
|
||||
conversion to be applied.
|
||||
.PP
|
||||
A field width or precision may be `*' instead of a digit string.
|
||||
In this case an integer
|
||||
.I arg
|
||||
supplies
|
||||
the field width or precision.
|
||||
.PP
|
||||
The conversion characters
|
||||
and their meanings are
|
||||
.TP
|
||||
.B dox
|
||||
The integer
|
||||
.I arg
|
||||
is converted to decimal, octal, or
|
||||
hexadecimal notation respectively.
|
||||
.TP
|
||||
.B X
|
||||
Like
|
||||
.BR x ,
|
||||
but use upper case instead of lower case.
|
||||
.TP
|
||||
.B f
|
||||
The float or double
|
||||
.I arg
|
||||
is converted to decimal notation
|
||||
in the style `[\fB\-\fR]ddd.ddd'
|
||||
where the number of d's after the decimal point
|
||||
is equal to the precision specification
|
||||
for the argument.
|
||||
If the precision
|
||||
is missing,
|
||||
6 digits are given;
|
||||
if the precision is explicitly 0, no digits and
|
||||
no decimal point are printed.
|
||||
.TP
|
||||
.B e
|
||||
The float or double
|
||||
.I arg
|
||||
is converted in the style
|
||||
`[\fB\-\fR]d\fB.\fRddd\fBe\fR\(+-dd'
|
||||
where there is one digit before the decimal point and
|
||||
the number after is equal to the
|
||||
precision specification for the argument;
|
||||
when the precision is missing,
|
||||
6 digits are produced.
|
||||
.TP
|
||||
.B g
|
||||
The float or double
|
||||
.I arg
|
||||
is printed in style
|
||||
.BR d ,
|
||||
in style
|
||||
.BR f ,
|
||||
or in
|
||||
style
|
||||
.BR e ,
|
||||
whichever gives full precision in minimum space.
|
||||
.TP
|
||||
.B c
|
||||
The character
|
||||
.I arg
|
||||
is printed.
|
||||
.TP
|
||||
.B s
|
||||
.I Arg
|
||||
is taken to be a string (character pointer)
|
||||
and characters from the string are printed until
|
||||
a null character or until
|
||||
the number of characters indicated by the precision
|
||||
specification is reached;
|
||||
however if the precision is 0 or missing
|
||||
all characters up to a null are printed.
|
||||
.TP
|
||||
.B u
|
||||
The unsigned integer
|
||||
.I arg
|
||||
is converted to decimal
|
||||
and printed.
|
||||
.TP
|
||||
.B %
|
||||
Print a `%'; no argument is converted.
|
||||
.PP
|
||||
In no case does a non-existent or small field width
|
||||
cause truncation of a field;
|
||||
padding takes place only if the specified field
|
||||
width exceeds the actual width.
|
||||
Characters generated by
|
||||
.B printf
|
||||
are printed by
|
||||
.BR putc (3).
|
||||
.PP
|
||||
.B Examples
|
||||
.br
|
||||
To print a date and time in the form `Sunday, July 3, 10:02',
|
||||
where
|
||||
.I weekday
|
||||
and
|
||||
.I month
|
||||
are pointers to null-terminated strings:
|
||||
.PP
|
||||
.RS
|
||||
printf("%s, %s %d, %02d:%02d", weekday, month, day, hour, min);
|
||||
.RE
|
||||
.PP
|
||||
To print
|
||||
.if n pi
|
||||
.if t \(*p
|
||||
to 5 decimals:
|
||||
.IP
|
||||
printf("pi = %.5f", 4*atan(1.0));
|
||||
.SH "SEE ALSO"
|
||||
.BR putc (3),
|
||||
.BR scanf (3),
|
||||
.BR ecvt (3),
|
||||
.BR stdarg (3).
|
|
@ -1,70 +0,0 @@
|
|||
.\" @(#)putc.3s 6.2 (Berkeley) 11/6/85
|
||||
.\"
|
||||
.TH PUTC 3 "November 6, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
putc, putchar, fputc, putw \- put character or word on a stream
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
|
||||
int putc(int \fIc\fP, FILE *\fIstream\fP)
|
||||
int putchar(int \fIc\fP)
|
||||
int fputc(int \fIc\fP, FILE *\fIstream\fP)
|
||||
int putw(int \fIw\fP, FILE *\fIstream\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Putc
|
||||
appends the character
|
||||
.I c
|
||||
to the named output
|
||||
.IR stream .
|
||||
It returns the character written.
|
||||
.PP
|
||||
.BI Putchar( c )
|
||||
is defined as
|
||||
.BI putc( c ", stdout)\fR."
|
||||
.PP
|
||||
.B Fputc
|
||||
behaves like
|
||||
.BR putc ,
|
||||
but is a genuine function rather than a macro.
|
||||
.PP
|
||||
.B Putw
|
||||
appends word (that is,
|
||||
.BR int )
|
||||
.I w
|
||||
to the output
|
||||
.IR stream .
|
||||
It returns the word written.
|
||||
.B Putw
|
||||
neither assumes nor causes special alignment in the file.
|
||||
.SH "SEE ALSO"
|
||||
.BR fopen (3),
|
||||
.BR fclose (3),
|
||||
.BR getc (3),
|
||||
.BR puts (3),
|
||||
.BR printf (3),
|
||||
.BR fread (3).
|
||||
.SH DIAGNOSTICS
|
||||
These functions return the constant
|
||||
.SM
|
||||
.B EOF
|
||||
upon error. Since this is a good integer,
|
||||
.BR ferror (3)
|
||||
should be used to detect
|
||||
.B putw
|
||||
errors.
|
||||
.SH BUGS
|
||||
Because it is implemented as a macro,
|
||||
.B putc
|
||||
treats a
|
||||
.I stream
|
||||
argument with side effects improperly. In particular
|
||||
`putc(c,\ *f++);'
|
||||
doesn't work sensibly.
|
||||
.PP
|
||||
Errors can occur long after the call to
|
||||
.BR putc .
|
|
@ -1,43 +0,0 @@
|
|||
.\" @(#)puts.3s 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH PUTS 3 "May 15, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
puts, fputs \- put a string on a stream
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
|
||||
int puts(char *\fIs\fP)
|
||||
int fputs(char *\fIs\fP, FILE *\fIstream\fP)
|
||||
.ft P
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Puts
|
||||
copies the null-terminated string
|
||||
.I s
|
||||
to the standard output stream
|
||||
.B stdout
|
||||
and appends a
|
||||
newline character.
|
||||
.PP
|
||||
.B Fputs
|
||||
copies the null-terminated string
|
||||
.I s
|
||||
to the named output
|
||||
.IR stream .
|
||||
.PP
|
||||
Neither routine copies the terminal null character.
|
||||
.SH "SEE ALSO"
|
||||
.BR fopen (3),
|
||||
.BR gets (3),
|
||||
.BR putc (3),
|
||||
.BR printf (3),
|
||||
.BR ferror (3),
|
||||
.BR fread (3).
|
||||
.SH BUGS
|
||||
.B Puts
|
||||
appends a newline,
|
||||
.B fputs
|
||||
does not, all in the name of backward compatibility.
|
|
@ -1,36 +0,0 @@
|
|||
.\" Copyright (c) 1980 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)qsort.3 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH QSORT 3 "May 15, 1985"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
qsort \- quicker sort
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
.fi
|
||||
.in +.5i
|
||||
.ti -.5i
|
||||
void qsort(void *\fIbase\fP, size_t \fInel\fP, size_t \fIwidth\fP, int (*\fIcompar\fP)(const void *, const void *))
|
||||
.in -.5i
|
||||
.ft R
|
||||
.SH DESCRIPTION
|
||||
.B Qsort
|
||||
is an implementation of the quicker-sort algorithm.
|
||||
The first argument is a pointer to the base of the data;
|
||||
the second is the number of elements;
|
||||
the third is the width of an element in bytes;
|
||||
the last is the name of the comparison routine
|
||||
to be called with two arguments which are pointers
|
||||
to the elements being compared.
|
||||
The routine must return an integer less than, equal to, or greater than 0
|
||||
according as the first argument is to be considered
|
||||
less than, equal to, or greater than the second.
|
||||
.SH "SEE ALSO"
|
||||
.BR sort (1).
|
|
@ -1,33 +0,0 @@
|
|||
.\" @(#)rand.3c 6.2 (Berkeley) 9/29/85
|
||||
.\"
|
||||
.TH RAND 3 "September 29, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
rand, srand \- random number generator
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdlib.h>
|
||||
|
||||
void srand(unsigned \fIseed\fP)
|
||||
unsigned rand(void)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Rand
|
||||
uses a multiplicative congruential
|
||||
random number generator with period
|
||||
.if t 2\u\s732\s0\d
|
||||
.if n 2**32
|
||||
to return successive pseudo-random
|
||||
numbers in the range from 0 to
|
||||
.BR RAND_MAX .
|
||||
.PP
|
||||
The generator is reinitialized by calling
|
||||
.B srand
|
||||
with 1 as argument.
|
||||
It can be set to a random starting point by calling
|
||||
.B srand
|
||||
with whatever you like as argument.
|
||||
.SH "SEE ALSO"
|
||||
.BR random (3).
|
|
@ -1,131 +0,0 @@
|
|||
.\" Copyright (c) 1983 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)random.3 6.2 (Berkeley) 9/29/85
|
||||
.\"
|
||||
.TH RANDOM 3 "September 29, 1985"
|
||||
.UC 5
|
||||
.SH NAME
|
||||
random, srandom, initstate, setstate \- better random number generator; routines for changing generators
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdlib.h>
|
||||
|
||||
long random(void)
|
||||
void srandom(unsigned \fIseed\fP)
|
||||
char *initstate(unsigned \fIseed\fP, char *\fIstate\fP, int \fIn\fP)
|
||||
char *setstate(char *\fIstate\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
.B Random
|
||||
uses a non-linear additive feedback random number generator employing a
|
||||
default table of size 31 long integers to return successive pseudo-random
|
||||
numbers in the range from 0 to
|
||||
.if t 2\u\s731\s10\d\(mi1.
|
||||
.if n (2**31)\(mi1.
|
||||
The period of this random number generator is very large, approximately
|
||||
.if t 16\(mu(2\u\s731\s10\d\(mi1).
|
||||
.if n 16*((2**31)\(mi1).
|
||||
.PP
|
||||
.B Random/srandom
|
||||
have (almost) the same calling sequence and initialization properties as
|
||||
.B rand/srand.
|
||||
The difference is that
|
||||
.BR rand (3)
|
||||
produces a much less random sequence \(em in fact, the low dozen bits
|
||||
generated by rand go through a cyclic pattern. All the bits generated by
|
||||
.B random
|
||||
are usable. For example, ``random()&01'' will produce a random binary
|
||||
value.
|
||||
.PP
|
||||
Unlike
|
||||
.BR srand ,
|
||||
.B srandom
|
||||
does not return the old seed; the reason for this is that the amount of
|
||||
state information used is much more than a single word. (Two other
|
||||
routines are provided to deal with restarting/changing random
|
||||
number generators). Like
|
||||
.BR rand (3),
|
||||
however,
|
||||
.B random
|
||||
will by default produce a sequence of numbers that can be duplicated
|
||||
by calling
|
||||
.B srandom
|
||||
with
|
||||
.B 1
|
||||
as the seed.
|
||||
.PP
|
||||
The
|
||||
.B initstate
|
||||
routine allows a state array, passed in as an argument, to be initialized
|
||||
for future use. The size of the state array (in bytes) is used by
|
||||
.B initstate
|
||||
to decide how sophisticated a random number generator it should use -- the
|
||||
more state, the better the random numbers will be.
|
||||
(Current "optimal" values for the amount of state information are
|
||||
8, 32, 64, 128, and 256 bytes; other amounts will be rounded down to
|
||||
the nearest known amount. Using less than 8 bytes will cause an error).
|
||||
The seed for the initialization (which specifies a starting point for
|
||||
the random number sequence, and provides for restarting at the same
|
||||
point) is also an argument.
|
||||
.B Initstate
|
||||
returns a pointer to the previous state information array.
|
||||
.PP
|
||||
Once a state has been initialized, the
|
||||
.B setstate
|
||||
routine provides for rapid switching between states.
|
||||
.B Setstate
|
||||
returns a pointer to the previous state array; its
|
||||
argument state array is used for further random number generation
|
||||
until the next call to
|
||||
.B initstate
|
||||
or
|
||||
.BR setstate .
|
||||
.PP
|
||||
Once a state array has been initialized, it may be restarted at a
|
||||
different point either by calling
|
||||
.B initstate
|
||||
(with the desired seed, the state array, and its size) or by calling
|
||||
both
|
||||
.B setstate
|
||||
(with the state array) and
|
||||
.B srandom
|
||||
(with the desired seed).
|
||||
The advantage of calling both
|
||||
.B setstate
|
||||
and
|
||||
.B srandom
|
||||
is that the size of the state array does not have to be remembered after
|
||||
it is initialized.
|
||||
.PP
|
||||
With 256 bytes of state information, the period of the random number
|
||||
generator is greater than
|
||||
.if t 2\u\s769\s10\d,
|
||||
.if n 2**69
|
||||
which should be sufficient for most purposes.
|
||||
.SH AUTHOR
|
||||
Earl T. Cohen
|
||||
.SH DIAGNOSTICS
|
||||
.PP
|
||||
If
|
||||
.B initstate
|
||||
is called with less than 8 bytes of state information, or if
|
||||
.B setstate
|
||||
detects that the state information has been garbled, error
|
||||
messages are printed on the standard error output.
|
||||
.SH "SEE ALSO"
|
||||
.BR rand (3).
|
||||
.SH NOTES
|
||||
.B initstate
|
||||
and
|
||||
.B setstate
|
||||
are not declared in
|
||||
.IR <stdlib.h> ,
|
||||
programmers must provide their own declarations.
|
||||
.SH BUGS
|
||||
About 2/3 the speed of
|
||||
.BR rand (3).
|
141
man/man3/rcmd.3
141
man/man3/rcmd.3
|
@ -1,141 +0,0 @@
|
|||
.\" Copyright (c) 1983 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)rcmd.3 6.7 (Berkeley) 5/14/86
|
||||
.\"
|
||||
.TH RCMD 3 "May 14, 1986"
|
||||
.UC 5
|
||||
.SH NAME
|
||||
rcmd, rresvport, ruserok \- routines for returning a stream to a remote command
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B "#include <sys/types.h>"
|
||||
.B "#include <net/netlib.h>"
|
||||
.PP
|
||||
.B "rem = rcmd(ahost, inport, locuser, remuser, cmd, fd2p);"
|
||||
.B char **ahost;
|
||||
.B int inport;
|
||||
.B "char *locuser, *remuser, *cmd;"
|
||||
.B int *fd2p;
|
||||
.PP
|
||||
.B s = rresvport(port);
|
||||
.B int *port;
|
||||
.PP
|
||||
.B "ruserok(rhost, superuser, ruser, luser);"
|
||||
.B char *rhost;
|
||||
.B int superuser;
|
||||
.B char *ruser, *luser;
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.I Rcmd
|
||||
is a routine used by the super-user to execute a command on
|
||||
a remote machine using an authentication scheme based
|
||||
on reserved port numbers.
|
||||
.I Rresvport
|
||||
is a routine which returns a descriptor to a socket
|
||||
with an address in the privileged port space.
|
||||
.I Ruserok
|
||||
is a routine used by servers
|
||||
to authenticate clients requesting service with
|
||||
.IR rcmd .
|
||||
All three functions are present in the same file and are used
|
||||
by the
|
||||
.IR rshd (8)
|
||||
server (among others).
|
||||
.PP
|
||||
.I Rcmd
|
||||
looks up the host
|
||||
.I *ahost
|
||||
using
|
||||
.IR gethostbyname (3),
|
||||
returning \-1 if the host does not exist.
|
||||
Otherwise
|
||||
.I *ahost
|
||||
is set to the standard name of the host
|
||||
and a connection is established to a server
|
||||
residing at the well-known Internet port
|
||||
.IR inport .
|
||||
.PP
|
||||
If the connection succeeds,
|
||||
a socket in the Internet domain of type SOCK_STREAM
|
||||
is returned to the caller, and given to the remote
|
||||
command as
|
||||
.B stdin
|
||||
and
|
||||
.BR stdout .
|
||||
If
|
||||
.I fd2p
|
||||
is non-zero, then an auxiliary channel to a control
|
||||
process will be set up, and a descriptor for it will be placed
|
||||
in
|
||||
.IR *fd2p .
|
||||
The control process will return diagnostic
|
||||
output from the command (unit 2) on this channel, and will also
|
||||
accept bytes on this channel as being UNIX signal numbers, to be
|
||||
forwarded to the process group of the command.
|
||||
If
|
||||
.I fd2p
|
||||
is 0, then the
|
||||
.B stderr
|
||||
(unit 2 of the remote
|
||||
command) will be made the same as the
|
||||
.B stdout
|
||||
and no
|
||||
provision is made for sending arbitrary signals to the remote process,
|
||||
although you may be able to get its attention by using out-of-band data.
|
||||
.PP
|
||||
The protocol is described in detail in
|
||||
.IR rshd (8).
|
||||
.PP
|
||||
The
|
||||
.I rresvport
|
||||
routine is used to obtain a socket with a privileged
|
||||
address bound to it. This socket is suitable for use
|
||||
by
|
||||
.I rcmd
|
||||
and several other routines. Privileged Internet ports are those
|
||||
in the range 0 to 1023. Only the super-user
|
||||
is allowed to bind an address of this sort to a socket.
|
||||
.PP
|
||||
.I Ruserok
|
||||
takes a remote host's name, as returned by a
|
||||
.IR gethostbyaddr (3)
|
||||
routine, two user names and a flag indicating whether
|
||||
the local user's name is that of the super-user. It then
|
||||
checks the files
|
||||
.I /etc/hosts.equiv
|
||||
and, possibly,
|
||||
.I .rhosts
|
||||
in the current working directory (normally the local
|
||||
user's home directory) to see if the request for
|
||||
service is allowed. A 0 is returned if the machine
|
||||
name is listed in the ``hosts.equiv'' file, or the
|
||||
host and remote user name are found in the ``.rhosts''
|
||||
file; otherwise
|
||||
.I ruserok
|
||||
returns \-1. If the
|
||||
.I superuser
|
||||
flag is 1, the checking of the ``host.equiv'' file is
|
||||
bypassed.
|
||||
If the local domain (as obtained from \fIgethostname\fP\|(3))
|
||||
is the same as the remote domain, only the machine name need be specified.
|
||||
.SH SEE ALSO
|
||||
rlogin(1),
|
||||
rsh(1),
|
||||
intro(2),
|
||||
rexec(3),
|
||||
rexecd(8),
|
||||
rlogind(8),
|
||||
rshd(8)
|
||||
.SH DIAGNOSTICS
|
||||
.I Rcmd
|
||||
returns a valid socket descriptor on success.
|
||||
It returns -1 on error and prints a diagnostic message on the standard error.
|
||||
.PP
|
||||
.I Rresvport
|
||||
returns a valid, bound socket descriptor on success.
|
||||
It returns -1 on error with the global value
|
||||
.I errno
|
||||
set according to the reason for failure.
|
||||
The error code EAGAIN is overloaded to mean ``All network ports in use.''
|
|
@ -1,28 +0,0 @@
|
|||
.TH READV 3 "January 6, 2010"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
readv, writev \- vector-based IO
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <sys/uio.h>
|
||||
|
||||
ssize_t readv(int \fIfildes\fP, const struct iovec *\fIiov\fP, int \fIiovcnt\fP);
|
||||
ssize_t writev(int \fIfildes\fP, const struct iovec *\fIiov\fP, int \fIiovcnt\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBreadv\fP and \fBwritev\fP functions allow one to use multiple buffers
|
||||
when reading from or writing to files. The \fIfildes\fP parameter specifies the
|
||||
file descriptor as with the \fBread\fP and \fBwrite\fP functions. \fIiov\fP
|
||||
specifies an array of buffers to be read into or written from. For each element
|
||||
of this array, the iov_base member specifies the address of the buffer and
|
||||
iov_len specifies its size in bytes. The number of buffers is specified by
|
||||
\fIiovcnt\fP. At most IOV_MAX buffers may be specified and their total size may
|
||||
not exceed SSIZE_MAX (both constants are defined in limits.h).
|
||||
.SH "RETURN VALUE"
|
||||
In case of success, the total number of bytes read or written is returned.
|
||||
Zero may be returned if no buffers were specified or each buffer has size zero.
|
||||
In the case of writev, a return value zero may also indicate an end of file
|
||||
condition. If the functions fail, -1 is returned.
|
||||
.SH "SEE ALSO"
|
||||
read(2), write(2)
|
|
@ -1,20 +0,0 @@
|
|||
.TH REALPATH 3 "December 3, 2009"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
realpath \- resolve a pathname
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdlib.h>
|
||||
|
||||
char *realpath(const char *\fIfile_name\fP, char *\fIresolved_name\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
realpath finds an absolute path to \fIfile_name\fP which does not
|
||||
contain . and .. components or symbolic links. The absolute path is stored
|
||||
in \fIresolved_name\fP, which is expected to provide storage for at least
|
||||
MAX_PATH bytes.
|
||||
.SH "RETURN VALUE
|
||||
If the function succeeds, a pointer to \fIresolved_name\fP is returned.
|
||||
If the function fails, NULL is returned and errno is set to indicate the
|
||||
cause of the failure.
|
541
man/man3/regex.3
541
man/man3/regex.3
|
@ -1,541 +0,0 @@
|
|||
.\" Copyright (c) 1992, 1993, 1994 Henry Spencer.
|
||||
.\" Copyright (c) 1992, 1993, 1994
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" This code is derived from software contributed to Berkeley by
|
||||
.\" Henry Spencer.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)regex.3 8.4 (Berkeley) 3/20/94
|
||||
.\"
|
||||
.TH REGEX 3 "March 20, 1994"
|
||||
.de ZR
|
||||
.\" one other place knows this name: the SEE ALSO section
|
||||
.BR re_format (7) \\$1
|
||||
..
|
||||
.SH NAME
|
||||
regex, regcomp, regexec, regerror, regfree \- regular-expression library
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
.\".na
|
||||
#include <sys/types.h>
|
||||
.br
|
||||
#include <regex.h>
|
||||
.sp
|
||||
.in +.5i
|
||||
.ti -.5i
|
||||
int regcomp(regex_t *\fIpreg\fP, const char *\fIpattern\fP, int \fIcflags\fP);
|
||||
.ti -.5i
|
||||
int regexec(const regex_t *\fIpreg\fP, const char *\fIstring\fP,
|
||||
size_t \fInmatch\fP, regmatch_t \fIpmatch\fP[], int \fIeflags\fP);
|
||||
.ti -.5i
|
||||
size_t regerror(int \fIerrcode\fP, const regex_t *\fIpreg\fP,
|
||||
char *\fIerrbuf\fP, size_t \fIerrbuf_size\fP);
|
||||
.ti -.5i
|
||||
void regfree(regex_t *\fIpreg\fP);
|
||||
.in -.5i
|
||||
.ft R
|
||||
.SH DESCRIPTION
|
||||
These routines implement POSIX 1003.2 regular expressions (``RE''s);
|
||||
see
|
||||
.ZR .
|
||||
.B Regcomp
|
||||
compiles an RE written as a string into an internal form,
|
||||
.B regexec
|
||||
matches that internal form against a string and reports results,
|
||||
.B regerror
|
||||
transforms error codes from either into human-readable messages,
|
||||
and
|
||||
.B regfree
|
||||
frees any dynamically-allocated storage used by the internal form
|
||||
of an RE.
|
||||
.PP
|
||||
The header
|
||||
.I <regex.h>
|
||||
declares two structure types,
|
||||
.B regex_t
|
||||
and
|
||||
.BR regmatch_t ,
|
||||
the former for compiled internal forms and the latter for match reporting.
|
||||
It also declares the four functions,
|
||||
a type
|
||||
.BR regoff_t ,
|
||||
and a number of constants with names starting with ``REG_''.
|
||||
.PP
|
||||
.B Regcomp
|
||||
compiles the regular expression contained in the
|
||||
.I pattern
|
||||
string,
|
||||
subject to the flags in
|
||||
.IR cflags ,
|
||||
and places the results in the
|
||||
.B regex_t
|
||||
structure pointed to by
|
||||
.IR preg .
|
||||
.I Cflags
|
||||
is the bitwise OR of zero or more of the following flags:
|
||||
.IP REG_EXTENDED \w'REG_EXTENDED'u+2n
|
||||
Compile modern (``extended'') REs,
|
||||
rather than the obsolete (``basic'') REs that
|
||||
are the default.
|
||||
.IP REG_BASIC
|
||||
This is a synonym for 0,
|
||||
provided as a counterpart to REG_EXTENDED to improve readability.
|
||||
.IP REG_NOSPEC
|
||||
Compile with recognition of all special characters turned off.
|
||||
All characters are thus considered ordinary,
|
||||
so the ``RE'' is a literal string.
|
||||
This is an extension,
|
||||
compatible with but not specified by POSIX 1003.2,
|
||||
and should be used with
|
||||
caution in software intended to be portable to other systems.
|
||||
REG_EXTENDED and REG_NOSPEC may not be used
|
||||
in the same call to
|
||||
.IR regcomp .
|
||||
.IP REG_ICASE
|
||||
Compile for matching that ignores upper/lower case distinctions.
|
||||
See
|
||||
.ZR .
|
||||
.IP REG_NOSUB
|
||||
Compile for matching that need only report success or failure,
|
||||
not what was matched.
|
||||
.IP REG_NEWLINE
|
||||
Compile for newline-sensitive matching.
|
||||
By default, newline is a completely ordinary character with no special
|
||||
meaning in either REs or strings.
|
||||
With this flag,
|
||||
`[^' bracket expressions and `.' never match newline,
|
||||
a `^' anchor matches the null string after any newline in the string
|
||||
in addition to its normal function,
|
||||
and the `$' anchor matches the null string before any newline in the
|
||||
string in addition to its normal function.
|
||||
.IP REG_PEND
|
||||
The regular expression ends,
|
||||
not at the first NUL,
|
||||
but just before the character pointed to by the
|
||||
.B re_endp
|
||||
member of the structure pointed to by
|
||||
.IR preg .
|
||||
The
|
||||
.B re_endp
|
||||
member is of type
|
||||
.BR "const\ char\ *" .
|
||||
This flag permits inclusion of NULs in the RE;
|
||||
they are considered ordinary characters.
|
||||
This is an extension,
|
||||
compatible with but not specified by POSIX 1003.2,
|
||||
and should be used with
|
||||
caution in software intended to be portable to other systems.
|
||||
.PP
|
||||
When successful,
|
||||
.B regcomp
|
||||
returns 0 and fills in the structure pointed to by
|
||||
.IR preg .
|
||||
One member of that structure
|
||||
(other than
|
||||
.BR re_endp )
|
||||
is publicized:
|
||||
.BR re_nsub ,
|
||||
of type
|
||||
.BR size_t ,
|
||||
contains the number of parenthesized subexpressions within the RE
|
||||
(except that the value of this member is undefined if the
|
||||
REG_NOSUB flag was used).
|
||||
If
|
||||
.B regcomp
|
||||
fails, it returns a non-zero error code;
|
||||
see DIAGNOSTICS.
|
||||
.PP
|
||||
.B Regexec
|
||||
matches the compiled RE pointed to by
|
||||
.I preg
|
||||
against the
|
||||
.IR string ,
|
||||
subject to the flags in
|
||||
.IR eflags ,
|
||||
and reports results using
|
||||
.IR nmatch ,
|
||||
.IR pmatch ,
|
||||
and the returned value.
|
||||
The RE must have been compiled by a previous invocation of
|
||||
.BR regcomp .
|
||||
The compiled form is not altered during execution of
|
||||
.BR regexec ,
|
||||
so a single compiled RE can be used simultaneously by multiple threads.
|
||||
.PP
|
||||
By default,
|
||||
the NUL-terminated string pointed to by
|
||||
.I string
|
||||
is considered to be the text of an entire line, minus any terminating
|
||||
newline.
|
||||
The
|
||||
.I eflags
|
||||
argument is the bitwise OR of zero or more of the following flags:
|
||||
.IP REG_NOTBOL \w'REG_STARTEND'u+2n
|
||||
The first character of
|
||||
the string
|
||||
is not the beginning of a line, so the `^' anchor should not match before it.
|
||||
This does not affect the behavior of newlines under REG_NEWLINE.
|
||||
.IP REG_NOTEOL
|
||||
The NUL terminating
|
||||
the string
|
||||
does not end a line, so the `$' anchor should not match before it.
|
||||
This does not affect the behavior of newlines under REG_NEWLINE.
|
||||
.IP REG_STARTEND
|
||||
The string is considered to start at
|
||||
\fIstring\fR\ + \fIpmatch\fR[0].\fBrm_so\fR
|
||||
and to have a terminating NUL located at
|
||||
\fIstring\fR\ + \fIpmatch\fR[0].\fBrm_eo\fR
|
||||
(there need not actually be a NUL at that location),
|
||||
regardless of the value of
|
||||
.IR nmatch .
|
||||
See below for the definition of
|
||||
.IR pmatch
|
||||
and
|
||||
.IR nmatch .
|
||||
This is an extension,
|
||||
compatible with but not specified by POSIX 1003.2,
|
||||
and should be used with
|
||||
caution in software intended to be portable to other systems.
|
||||
Note that a non-zero \fBrm_so\fR does not imply REG_NOTBOL;
|
||||
REG_STARTEND affects only the location of the string,
|
||||
not how it is matched.
|
||||
.PP
|
||||
See
|
||||
.ZR
|
||||
for a discussion of what is matched in situations where an RE or a
|
||||
portion thereof could match any of several substrings of
|
||||
.IR string .
|
||||
.PP
|
||||
Normally,
|
||||
.B regexec
|
||||
returns 0 for success and the non-zero code REG_NOMATCH for failure.
|
||||
Other non-zero error codes may be returned in exceptional situations;
|
||||
see DIAGNOSTICS.
|
||||
.PP
|
||||
If REG_NOSUB was specified in the compilation of the RE,
|
||||
or if
|
||||
.I nmatch
|
||||
is 0,
|
||||
.B regexec
|
||||
ignores the
|
||||
.I pmatch
|
||||
argument (but see below for the case where REG_STARTEND is specified).
|
||||
Otherwise,
|
||||
.I pmatch
|
||||
points to an array of
|
||||
.I nmatch
|
||||
structures of type
|
||||
.BR regmatch_t .
|
||||
Such a structure has at least the members
|
||||
.B rm_so
|
||||
and
|
||||
.BR rm_eo ,
|
||||
both of type
|
||||
.B regoff_t
|
||||
(a signed arithmetic type at least as large as an
|
||||
.B off_t
|
||||
and a
|
||||
.BR ssize_t ),
|
||||
containing respectively the offset of the first character of a substring
|
||||
and the offset of the first character after the end of the substring.
|
||||
Offsets are measured from the beginning of the
|
||||
.I string
|
||||
argument given to
|
||||
.BR regexec .
|
||||
An empty substring is denoted by equal offsets,
|
||||
both indicating the character following the empty substring.
|
||||
.PP
|
||||
The 0th member of the
|
||||
.I pmatch
|
||||
array is filled in to indicate what substring of
|
||||
.I string
|
||||
was matched by the entire RE.
|
||||
Remaining members report what substring was matched by parenthesized
|
||||
subexpressions within the RE;
|
||||
member
|
||||
.I i
|
||||
reports subexpression
|
||||
.IR i ,
|
||||
with subexpressions counted (starting at 1) by the order of their opening
|
||||
parentheses in the RE, left to right.
|
||||
Unused entries in the array\(emcorresponding either to subexpressions that
|
||||
did not participate in the match at all, or to subexpressions that do not
|
||||
exist in the RE (that is, \fIi\fR\ > \fIpreg\fR\->\fBre_nsub\fR)\(emhave both
|
||||
.B rm_so
|
||||
and
|
||||
.B rm_eo
|
||||
set to \-1.
|
||||
If a subexpression participated in the match several times,
|
||||
the reported substring is the last one it matched.
|
||||
(Note, as an example in particular, that when the RE `(b*)+' matches `bbb',
|
||||
the parenthesized subexpression matches each of the three `b's and then
|
||||
an infinite number of empty strings following the last `b',
|
||||
so the reported substring is one of the empties.)
|
||||
.PP
|
||||
If REG_STARTEND is specified,
|
||||
.I pmatch
|
||||
must point to at least one
|
||||
.B regmatch_t
|
||||
(even if
|
||||
.I nmatch
|
||||
is 0 or REG_NOSUB was specified),
|
||||
to hold the input offsets for REG_STARTEND.
|
||||
Use for output is still entirely controlled by
|
||||
.IR nmatch ;
|
||||
if
|
||||
.I nmatch
|
||||
is 0 or REG_NOSUB was specified,
|
||||
the value of
|
||||
.IR pmatch [0]
|
||||
will not be changed by a successful
|
||||
.BR regexec .
|
||||
.PP
|
||||
.B Regerror
|
||||
maps a non-zero
|
||||
.I errcode
|
||||
from either
|
||||
.B regcomp
|
||||
or
|
||||
.B regexec
|
||||
to a human-readable, printable message.
|
||||
If
|
||||
.I preg
|
||||
is non-NULL,
|
||||
the error code should have arisen from use of
|
||||
the
|
||||
.B regex_t
|
||||
pointed to by
|
||||
.IR preg ,
|
||||
and if the error code came from
|
||||
.BR regcomp ,
|
||||
it should have been the result from the most recent
|
||||
.B regcomp
|
||||
using that
|
||||
.BR regex_t .
|
||||
.RI ( Regerror
|
||||
may be able to supply a more detailed message using information
|
||||
from the
|
||||
.BR regex_t .)
|
||||
.B Regerror
|
||||
places the NUL-terminated message into the buffer pointed to by
|
||||
.IR errbuf ,
|
||||
limiting the length (including the NUL) to at most
|
||||
.I errbuf_size
|
||||
bytes.
|
||||
If the whole message won't fit,
|
||||
as much of it as will fit before the terminating NUL is supplied.
|
||||
In any case,
|
||||
the returned value is the size of buffer needed to hold the whole
|
||||
message (including terminating NUL).
|
||||
If
|
||||
.I errbuf_size
|
||||
is 0,
|
||||
.I errbuf
|
||||
is ignored but the return value is still correct.
|
||||
.PP
|
||||
If the
|
||||
.I errcode
|
||||
given to
|
||||
.B regerror
|
||||
is first ORed with REG_ITOA,
|
||||
the ``message'' that results is the printable name of the error code,
|
||||
e.g. ``REG_NOMATCH'',
|
||||
rather than an explanation thereof.
|
||||
If
|
||||
.I errcode
|
||||
is REG_ATOI,
|
||||
then
|
||||
.I preg
|
||||
shall be non-NULL and the
|
||||
.B re_endp
|
||||
member of the structure it points to
|
||||
must point to the printable name of an error code;
|
||||
in this case, the result in
|
||||
.I errbuf
|
||||
is the decimal digits of
|
||||
the numeric value of the error code
|
||||
(0 if the name is not recognized).
|
||||
REG_ITOA and REG_ATOI are intended primarily as debugging facilities;
|
||||
they are extensions,
|
||||
compatible with but not specified by POSIX 1003.2,
|
||||
and should be used with
|
||||
caution in software intended to be portable to other systems.
|
||||
Be warned also that they are considered experimental and changes are possible.
|
||||
.PP
|
||||
.B Regfree
|
||||
frees any dynamically-allocated storage associated with the compiled RE
|
||||
pointed to by
|
||||
.IR preg .
|
||||
The remaining
|
||||
.B regex_t
|
||||
is no longer a valid compiled RE
|
||||
and the effect of supplying it to
|
||||
.B regexec
|
||||
or
|
||||
.B regerror
|
||||
is undefined.
|
||||
.PP
|
||||
None of these functions references global variables except for tables
|
||||
of constants;
|
||||
all are safe for use from multiple threads if the arguments are safe.
|
||||
.SH IMPLEMENTATION CHOICES
|
||||
There are a number of decisions that 1003.2 leaves up to the implementor,
|
||||
either by explicitly saying ``undefined'' or by virtue of them being
|
||||
forbidden by the RE grammar.
|
||||
This implementation treats them as follows.
|
||||
.PP
|
||||
See
|
||||
.ZR
|
||||
for a discussion of the definition of case-independent matching.
|
||||
.PP
|
||||
There is no particular limit on the length of REs,
|
||||
except insofar as memory is limited.
|
||||
Memory usage is approximately linear in RE size, and largely insensitive
|
||||
to RE complexity, except for bounded repetitions.
|
||||
See BUGS for one short RE using them
|
||||
that will run almost any system out of memory.
|
||||
.PP
|
||||
A backslashed character other than one specifically given a magic meaning
|
||||
by 1003.2 (such magic meanings occur only in obsolete [``basic''] REs)
|
||||
is taken as an ordinary character.
|
||||
.PP
|
||||
Any unmatched [ is a REG_EBRACK error.
|
||||
.PP
|
||||
Equivalence classes cannot begin or end bracket-expression ranges.
|
||||
The endpoint of one range cannot begin another.
|
||||
.PP
|
||||
RE_DUP_MAX, the limit on repetition counts in bounded repetitions, is 255.
|
||||
.PP
|
||||
A repetition operator (?, *, +, or bounds) cannot follow another
|
||||
repetition operator.
|
||||
A repetition operator cannot begin an expression or subexpression
|
||||
or follow `^' or `|'.
|
||||
.PP
|
||||
`|' cannot appear first or last in a (sub)expression or after another `|',
|
||||
i.e. an operand of `|' cannot be an empty subexpression.
|
||||
An empty parenthesized subexpression, `()', is legal and matches an
|
||||
empty (sub)string.
|
||||
An empty string is not a legal RE.
|
||||
.PP
|
||||
A `{' followed by a digit is considered the beginning of bounds for a
|
||||
bounded repetition, which must then follow the syntax for bounds.
|
||||
A `{' \fInot\fR followed by a digit is considered an ordinary character.
|
||||
.PP
|
||||
`^' and `$' beginning and ending subexpressions in obsolete (``basic'')
|
||||
REs are anchors, not ordinary characters.
|
||||
.SH SEE ALSO
|
||||
.BR grep (1),
|
||||
.BR re_format (7).
|
||||
.PP
|
||||
POSIX 1003.2, sections 2.8 (Regular Expression Notation)
|
||||
and
|
||||
B.5 (C Binding for Regular Expression Matching).
|
||||
.SH DIAGNOSTICS
|
||||
Non-zero error codes from
|
||||
.B regcomp
|
||||
and
|
||||
.B regexec
|
||||
include the following:
|
||||
.PP
|
||||
.nf
|
||||
.ta \w'REG_ECOLLATE'u+3n
|
||||
REG_NOMATCH regexec() failed to match
|
||||
REG_BADPAT invalid regular expression
|
||||
REG_ECOLLATE invalid collating element
|
||||
REG_ECTYPE invalid character class
|
||||
REG_EESCAPE \e applied to unescapable character
|
||||
REG_ESUBREG invalid backreference number
|
||||
REG_EBRACK brackets [ ] not balanced
|
||||
REG_EPAREN parentheses ( ) not balanced
|
||||
REG_EBRACE braces { } not balanced
|
||||
REG_BADBR invalid repetition count(s) in { }
|
||||
REG_ERANGE invalid character range in [ ]
|
||||
REG_ESPACE ran out of memory
|
||||
REG_BADRPT ?, *, or + operand invalid
|
||||
REG_EMPTY empty (sub)expression
|
||||
REG_ASSERT ``can't happen''\(emyou found a bug
|
||||
REG_INVARG invalid argument, e.g. negative-length string
|
||||
.fi
|
||||
.SH HISTORY
|
||||
Originally written by Henry Spencer.
|
||||
Altered for inclusion in the 4.4BSD distribution.
|
||||
.SH BUGS
|
||||
This is an alpha release with known defects.
|
||||
Please report problems.
|
||||
.PP
|
||||
There is one known functionality bug.
|
||||
The implementation of internationalization is incomplete:
|
||||
the locale is always assumed to be the default one of 1003.2,
|
||||
and only the collating elements etc. of that locale are available.
|
||||
.PP
|
||||
The back-reference code is subtle and doubts linger about its correctness
|
||||
in complex cases.
|
||||
.PP
|
||||
.B Regexec
|
||||
performance is poor.
|
||||
This will improve with later releases.
|
||||
.I Nmatch
|
||||
exceeding 0 is expensive;
|
||||
.I nmatch
|
||||
exceeding 1 is worse.
|
||||
.B Regexec
|
||||
is largely insensitive to RE complexity \fIexcept\fR that back
|
||||
references are massively expensive.
|
||||
RE length does matter; in particular, there is a strong speed bonus
|
||||
for keeping RE length under about 30 characters,
|
||||
with most special characters counting roughly double.
|
||||
.PP
|
||||
.B Regcomp
|
||||
implements bounded repetitions by macro expansion,
|
||||
which is costly in time and space if counts are large
|
||||
or bounded repetitions are nested.
|
||||
An RE like, say,
|
||||
`((((a{1,100}){1,100}){1,100}){1,100}){1,100}'
|
||||
will (eventually) run almost any existing machine out of swap space.
|
||||
.PP
|
||||
There are suspected problems with response to obscure error conditions.
|
||||
Notably,
|
||||
certain kinds of internal overflow,
|
||||
produced only by truly enormous REs or by multiply nested bounded repetitions,
|
||||
are probably not handled well.
|
||||
.PP
|
||||
Due to a mistake in 1003.2, things like `a)b' are legal REs because `)' is
|
||||
a special character only in the presence of a previous unmatched `('.
|
||||
This can't be fixed until the spec is fixed.
|
||||
.PP
|
||||
The standard's definition of back references is vague.
|
||||
For example, does
|
||||
`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?
|
||||
Until the standard is clarified,
|
||||
behavior in such cases should not be relied on.
|
||||
.PP
|
||||
The implementation of word-boundary matching is a bit of a kludge,
|
||||
and bugs may lurk in combinations of word-boundary matching and anchoring.
|
|
@ -1,20 +0,0 @@
|
|||
.TH REMAINDER 3 "December 18, 2009"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
remainder \- floating point remainder after division
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <math.h>
|
||||
|
||||
double remainder(double \fIx\fP, double \fIy\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
This function returns the remainder of a division of \fIx\fP by \fIy\fP. More
|
||||
formally, it computes which integer \fIn\fP is closest to the fraction
|
||||
\fIx\fP/\fIy\fP and returns \fIx\fP - \fIn\fP*\fIy\fP. An even value for
|
||||
\fIn\fP is preferred over an odd one if both are equally far away (that is,
|
||||
banker's rounding is applied). If \fIx\fP is infinite or \fIy\fP is zero,
|
||||
a NaN value is returned.
|
||||
.SH "RETURN VALUE"
|
||||
The function returns the remainder of a division of \fIx\fP by \fIy\fP.
|
|
@ -1,280 +0,0 @@
|
|||
.\" Copyright (c) 1985 The Regents of the University of California.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms are permitted provided
|
||||
.\" that: (1) source distributions retain this entire copyright notice and
|
||||
.\" comment, and (2) distributions including binaries display the following
|
||||
.\" acknowledgement: ``This product includes software developed by the
|
||||
.\" University of California, Berkeley and its contributors'' in the
|
||||
.\" documentation or other materials provided with the distribution and in
|
||||
.\" all advertising materials mentioning features or use of this software.
|
||||
.\" Neither the name of the University nor the names of its contributors may
|
||||
.\" be used to endorse or promote products derived from this software without
|
||||
.\" specific prior written permission.
|
||||
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.\"
|
||||
.\" @(#)resolver.3 6.5 (Berkeley) 6/23/90
|
||||
.\"
|
||||
.TH RESOLVER 3 "June 23, 1990"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
resolver, res_query, res_search, res_mkquery, res_send, res_init, dn_comp, dn_expand \- resolver routines
|
||||
.SH SYNOPSIS
|
||||
.B #include <sys/types.h>
|
||||
.br
|
||||
.B #include <net/gen/in.h>
|
||||
.br
|
||||
.B #include <net/gen/nameser.h>
|
||||
.br
|
||||
.B #include <net/gen/resolv.h>
|
||||
.PP
|
||||
.B "res_query(dname, class, type, answer, anslen)"
|
||||
.br
|
||||
.B char *dname;
|
||||
.br
|
||||
.B int class, type;
|
||||
.br
|
||||
.B u_char *answer;
|
||||
.br
|
||||
.B int anslen;
|
||||
.PP
|
||||
.B "res_search(dname, class, type, answer, anslen)"
|
||||
.br
|
||||
.B char *dname;
|
||||
.br
|
||||
.B int class, type;
|
||||
.br
|
||||
.B u_char *answer;
|
||||
.br
|
||||
.B int anslen;
|
||||
.PP
|
||||
.B "res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)"
|
||||
.br
|
||||
.B int op;
|
||||
.br
|
||||
.B char *dname;
|
||||
.br
|
||||
.B int class, type;
|
||||
.br
|
||||
.B char *data;
|
||||
.br
|
||||
.B int datalen;
|
||||
.br
|
||||
.B struct rrec *newrr;
|
||||
.br
|
||||
.B char *buf;
|
||||
.br
|
||||
.B int buflen;
|
||||
.PP
|
||||
.B res_send(msg, msglen, answer, anslen)
|
||||
.br
|
||||
.B char *msg;
|
||||
.br
|
||||
.B int msglen;
|
||||
.br
|
||||
.B char *answer;
|
||||
.br
|
||||
.B int anslen;
|
||||
.PP
|
||||
.B res_init()
|
||||
.PP
|
||||
.B dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
|
||||
.br
|
||||
.B char *exp_dn, *comp_dn;
|
||||
.br
|
||||
.B int length;
|
||||
.br
|
||||
.B char **dnptrs, **lastdnptr;
|
||||
.PP
|
||||
.B dn_expand(msg, eomorig, comp_dn, exp_dn, length)
|
||||
.br
|
||||
.B char *msg, *eomorig, *comp_dn, exp_dn;
|
||||
.br
|
||||
.B int length;
|
||||
.SH DESCRIPTION
|
||||
These routines are used for making, sending and interpreting
|
||||
query and reply messages with Internet domain name servers.
|
||||
.PP
|
||||
Global configuration and state information that is used by the
|
||||
resolver routines is kept in the structure
|
||||
.IR _res .
|
||||
Most of the values have reasonable defaults and can be ignored.
|
||||
Options
|
||||
stored in
|
||||
.I _res.options
|
||||
are defined in
|
||||
.I resolv.h
|
||||
and are as follows.
|
||||
Options are stored as a simple bit mask containing the bitwise ``or''
|
||||
of the options enabled.
|
||||
.IP RES_INIT
|
||||
True if the initial name server address and default domain name are
|
||||
initialized (i.e.,
|
||||
.I res_init
|
||||
has been called).
|
||||
.IP RES_DEBUG
|
||||
Print debugging messages.
|
||||
.IP RES_AAONLY
|
||||
Accept authoritative answers only.
|
||||
With this option,
|
||||
.I res_send
|
||||
should continue until it finds an authoritative answer or finds an error.
|
||||
Currently this is not implemented.
|
||||
.IP RES_USEVC
|
||||
Use TCP connections for queries instead of UDP datagrams.
|
||||
.IP RES_STAYOPEN
|
||||
Used with RES_USEVC to keep the TCP connection open between
|
||||
queries.
|
||||
This is useful only in programs that regularly do many queries.
|
||||
UDP should be the normal mode used.
|
||||
.IP RES_IGNTC
|
||||
Unused currently (ignore truncation errors, i.e., don't retry with TCP).
|
||||
.IP RES_RECURSE
|
||||
Set the recursion-desired bit in queries.
|
||||
This is the default.
|
||||
(\c
|
||||
.I res_send
|
||||
does not do iterative queries and expects the name server
|
||||
to handle recursion.)
|
||||
.IP RES_DEFNAMES
|
||||
If set,
|
||||
.I res_search
|
||||
will append the default domain name to single-component names
|
||||
(those that do not contain a dot).
|
||||
This option is enabled by default.
|
||||
.IP RES_DNSRCH
|
||||
If this option is set,
|
||||
.I res_search
|
||||
will search for host names in the current domain and in parent domains; see
|
||||
.IR hostname (7).
|
||||
This is used by the standard host lookup routine
|
||||
.IR gethostbyname (3).
|
||||
This option is enabled by default.
|
||||
.PP
|
||||
The
|
||||
.I res_init
|
||||
routine
|
||||
reads the configuration file (if any; see
|
||||
.IR resolver (5))
|
||||
to get the default domain name,
|
||||
search list and
|
||||
the Internet address of the local name server(s).
|
||||
If no server is configured, the host running
|
||||
the resolver is tried.
|
||||
The current domain name is defined by the hostname
|
||||
if not specified in the configuration file;
|
||||
it can be overridden by the environment variable LOCALDOMAIN.
|
||||
Initialization normally occurs on the first call
|
||||
to one of the following routines.
|
||||
.PP
|
||||
The
|
||||
.I res_query
|
||||
function provides an interface to the server query mechanism.
|
||||
It constructs a query, sends it to the local server,
|
||||
awaits a response, and makes preliminary checks on the reply.
|
||||
The query requests information of the specified
|
||||
.I type
|
||||
and
|
||||
.I class
|
||||
for the specified fully-qualified domain name
|
||||
.I dname .
|
||||
The reply message is left in the
|
||||
.I answer
|
||||
buffer with length
|
||||
.I anslen
|
||||
supplied by the caller.
|
||||
.PP
|
||||
The
|
||||
.I res_search
|
||||
routine makes a query and awaits a response like
|
||||
.IR res_query ,
|
||||
but in addition, it implements the default and search rules
|
||||
controlled by the RES_DEFNAMES and RES_DNSRCH options.
|
||||
It returns the first successful reply.
|
||||
.PP
|
||||
The remaining routines are lower-level routines used by
|
||||
.IR res_query .
|
||||
The
|
||||
.I res_mkquery
|
||||
function
|
||||
constructs a standard query message and places it in
|
||||
.IR buf .
|
||||
It returns the size of the query, or \-1 if the query is
|
||||
larger than
|
||||
.IR buflen .
|
||||
The query type
|
||||
.I op
|
||||
is usually QUERY, but can be any of the query types defined in
|
||||
.IR <arpa/nameser.h> .
|
||||
The domain name for the query is given by
|
||||
.IR dname .
|
||||
.I Newrr
|
||||
is currently unused but is intended for making update messages.
|
||||
.PP
|
||||
The
|
||||
.I res_send
|
||||
routine
|
||||
sends a pre-formatted query and returns an answer.
|
||||
It will call
|
||||
.I res_init
|
||||
if RES_INIT is not set, send the query to the local name server, and
|
||||
handle timeouts and retries.
|
||||
The length of the reply message is returned, or
|
||||
\-1 if there were errors.
|
||||
.PP
|
||||
The
|
||||
.I dn_comp
|
||||
function
|
||||
compresses the domain name
|
||||
.I exp_dn
|
||||
and stores it in
|
||||
.IR comp_dn .
|
||||
The size of the compressed name is returned or \-1 if there were errors.
|
||||
The size of the array pointed to by
|
||||
.I comp_dn
|
||||
is given by
|
||||
.IR length .
|
||||
The compression uses
|
||||
an array of pointers
|
||||
.I dnptrs
|
||||
to previously-compressed names in the current message.
|
||||
The first pointer points to
|
||||
to the beginning of the message and the list ends with NULL.
|
||||
The limit to the array is specified by
|
||||
.IR lastdnptr .
|
||||
A side effect of
|
||||
.I dn_comp
|
||||
is to update the list of pointers for
|
||||
labels inserted into the message
|
||||
as the name is compressed.
|
||||
If
|
||||
.I dnptr
|
||||
is NULL, names are not compressed.
|
||||
If
|
||||
.I lastdnptr
|
||||
is NULL, the list of labels is not updated.
|
||||
.PP
|
||||
The
|
||||
.I dn_expand
|
||||
entry
|
||||
expands the compressed domain name
|
||||
.I comp_dn
|
||||
to a full domain name
|
||||
The compressed name is contained in a query or reply message;
|
||||
.I msg
|
||||
is a pointer to the beginning of the message.
|
||||
The uncompressed name is placed in the buffer indicated by
|
||||
.I exp_dn
|
||||
which is of size
|
||||
.IR length .
|
||||
The size of compressed name is returned or \-1 if there was an error.
|
||||
.SH FILES
|
||||
/etc/resolv.conf see resolver(5)
|
||||
.SH "SEE ALSO"
|
||||
gethostbyname(3), named(8), resolver(5), hostname(7),
|
||||
.br
|
||||
RFC1032, RFC1033, RFC1034, RFC1035, RFC974,
|
||||
.br
|
||||
SMM:11 Name Server Operations Guide for BIND
|
251
man/man3/scanf.3
251
man/man3/scanf.3
|
@ -1,251 +0,0 @@
|
|||
.\" @(#)scanf.3s 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH SCANF 3 "May 15, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
scanf, fscanf, sscanf, vscanf, vfscanf, vsscanf \- formatted input conversion
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int scanf(const char *\fIformat\fP \fR[\fP, \fIpointer\fP\fR] ...\fP)
|
||||
int fscanf(FILE *\fIstream\fP, const char *\fIformat\fP \fR[\fP, \fIpointer\fP\fR] ...\fP)
|
||||
int sscanf(const char *\fIs\fP, const char *\fIformat\fP \fR[\fP, \fIpointer\fP\fR] ...\fP)
|
||||
int vscanf(const char *\fIformat\fP, va_list \fIargs\fP)
|
||||
int vfscanf(FILE *\fIstream\fP, const char *\fIformat\fP, va_list \fIargs\fP)
|
||||
int vsscanf(const char *\fIs\fP, const char *\fIformat\fP, va_list \fIargs\fP)
|
||||
.SH DESCRIPTION
|
||||
.B Scanf
|
||||
reads from the standard input stream
|
||||
.BR stdin .
|
||||
.B Fscanf
|
||||
reads from the named input
|
||||
.IR stream .
|
||||
.B Sscanf
|
||||
reads from the character string
|
||||
.IR s .
|
||||
Each function reads characters, interprets
|
||||
them according to a format, and stores the results in its arguments.
|
||||
Each expects as arguments
|
||||
a control string
|
||||
.IR format ,
|
||||
described below,
|
||||
and a set of
|
||||
.I pointer
|
||||
arguments
|
||||
indicating where the converted input should be stored.
|
||||
.PP
|
||||
The
|
||||
.B v*scanf
|
||||
functions can be used to make functions like the first three by using the
|
||||
.BR stdarg (3)
|
||||
method to process the argument pointers.
|
||||
.PP
|
||||
The
|
||||
control string
|
||||
usually contains
|
||||
conversion specifications, which are used to direct interpretation
|
||||
of input sequences.
|
||||
The control string may contain:
|
||||
.TP 4
|
||||
1.
|
||||
Blanks, tabs or newlines,
|
||||
which match optional white space in the input.
|
||||
.TP 4
|
||||
2.
|
||||
An ordinary character (not %) which must match
|
||||
the next character of the input stream.
|
||||
.TP 4
|
||||
3.
|
||||
Conversion specifications, consisting of the
|
||||
character
|
||||
.BR % ,
|
||||
an optional assignment suppressing character
|
||||
.BR * ,
|
||||
an optional numerical maximum field width, and a conversion
|
||||
character.
|
||||
.PP
|
||||
A conversion specification directs the conversion of the
|
||||
next input field; the result
|
||||
is placed in the variable pointed to by the corresponding argument,
|
||||
unless assignment suppression was
|
||||
indicated by
|
||||
.BR * .
|
||||
An input field is defined as a string of non-space characters;
|
||||
it extends to the next inappropriate character or until the field
|
||||
width, if specified, is exhausted.
|
||||
.PP
|
||||
The conversion character indicates the interpretation of the
|
||||
input field; the corresponding pointer argument must
|
||||
usually be of a restricted type.
|
||||
The following conversion characters are legal:
|
||||
.TP 4
|
||||
.B %
|
||||
a single `%' is expected
|
||||
in the input at this point;
|
||||
no assignment is done.
|
||||
.TP 4
|
||||
.B d
|
||||
a decimal integer is expected;
|
||||
the corresponding argument should be an integer pointer.
|
||||
.TP 4
|
||||
.B o
|
||||
an octal integer is expected;
|
||||
the corresponding argument should be a integer pointer.
|
||||
.TP 4
|
||||
.B x
|
||||
a hexadecimal integer is expected;
|
||||
the corresponding argument should be an integer pointer.
|
||||
.ti -0.2i
|
||||
.TP 4
|
||||
.B s
|
||||
a character string is expected;
|
||||
the corresponding argument should be a character pointer
|
||||
pointing to an array of characters large enough to accept the
|
||||
string and a terminating `\e0', which will be added.
|
||||
The input field is terminated by a space character
|
||||
or a newline.
|
||||
.TP 4
|
||||
.B c
|
||||
a character is expected; the
|
||||
corresponding argument should be a character pointer.
|
||||
The normal skip over space characters is suppressed
|
||||
in this case;
|
||||
to read the next non-space character, try
|
||||
`%1s'.
|
||||
If a field width is given, the corresponding argument
|
||||
should refer to a character array, and the
|
||||
indicated number of characters is read.
|
||||
.TP 4
|
||||
.B efg
|
||||
a floating point number is expected;
|
||||
the next field is converted accordingly and stored through the
|
||||
corresponding argument, which should be a pointer to a
|
||||
.BR float .
|
||||
The input format for
|
||||
floating point numbers is
|
||||
an optionally signed
|
||||
string of digits
|
||||
possibly containing a decimal point, followed by an optional
|
||||
exponent field consisting of an E or e followed by an optionally signed integer.
|
||||
.TP 4
|
||||
.B [
|
||||
indicates a string not to be delimited by space characters.
|
||||
The left bracket is followed by a set of characters and a right
|
||||
bracket; the characters between the brackets define a set
|
||||
of characters making up the string.
|
||||
If the first character
|
||||
is not circumflex (\|^\|), the input field
|
||||
is all characters until the first character not in the set between
|
||||
the brackets; if the first character
|
||||
after the left bracket is ^, the input field is all characters
|
||||
until the first character which is in the remaining set of characters
|
||||
between the brackets.
|
||||
The corresponding argument must point to a character array.
|
||||
.PP
|
||||
The conversion characters
|
||||
.BR d ,
|
||||
.B o
|
||||
and
|
||||
.B x
|
||||
may be capitalized or preceded by
|
||||
.B l
|
||||
to indicate that a pointer to
|
||||
.B long
|
||||
rather than to
|
||||
.B int
|
||||
is in the argument list.
|
||||
Similarly, the conversion characters
|
||||
.BR e ,
|
||||
.B f
|
||||
or
|
||||
.B g
|
||||
may be capitalized or
|
||||
preceded by
|
||||
.B l
|
||||
to indicate a pointer to
|
||||
.B double
|
||||
rather than to
|
||||
.BR float .
|
||||
The conversion characters
|
||||
.BR d ,
|
||||
.B o
|
||||
and
|
||||
.B x
|
||||
may be preceded by
|
||||
.B h
|
||||
to indicate a pointer to
|
||||
.B short
|
||||
rather than to
|
||||
.BR int .
|
||||
.PP
|
||||
The
|
||||
.B scanf
|
||||
functions return the number of successfully matched and assigned input
|
||||
items.
|
||||
This can be used to decide how many input items were found.
|
||||
The constant
|
||||
.SM
|
||||
.B EOF
|
||||
is returned upon end of input; note that this is different
|
||||
from 0, which means that no conversion was done;
|
||||
if conversion was intended, it was frustrated by an
|
||||
inappropriate character in the input.
|
||||
.PP
|
||||
For example, the call
|
||||
.IP "\&" 10
|
||||
int i; float x; char name[50];
|
||||
.br
|
||||
scanf("%d%f%s", &i, &x, name);
|
||||
.PP
|
||||
with the input line
|
||||
.IP
|
||||
25 54.32E\(mi1 thompson
|
||||
.PP
|
||||
will assign to
|
||||
.B i
|
||||
the value
|
||||
25,
|
||||
.B x
|
||||
the value 5.432, and
|
||||
.B name
|
||||
will contain `\fBthompson\e0\fP' .
|
||||
Or,
|
||||
.IP
|
||||
int i; float x; char name[50];
|
||||
.br
|
||||
scanf("%2d%f%*d%[1234567890]", &i, &x, name);
|
||||
.PP
|
||||
with input
|
||||
.IP
|
||||
56789 0123 56a72
|
||||
.PP
|
||||
will assign 56 to
|
||||
.BR i ,
|
||||
789.0 to
|
||||
.BR x ,
|
||||
skip `0123',
|
||||
and place the string `56\e0' in
|
||||
.BR name .
|
||||
The next call to
|
||||
.B getchar
|
||||
will return `a'.
|
||||
.SH "SEE ALSO"
|
||||
.BR atof (3),
|
||||
.BR getc (3),
|
||||
.BR printf (3),
|
||||
.BR stdarg (3).
|
||||
.SH DIAGNOSTICS
|
||||
The
|
||||
.B scanf
|
||||
functions return
|
||||
.SM
|
||||
.B EOF
|
||||
on end of input,
|
||||
and a short count for missing or illegal data items.
|
||||
.SH BUGS
|
||||
The success of literal matches and suppressed
|
||||
assignments is not directly
|
||||
determinable.
|
|
@ -1,120 +0,0 @@
|
|||
.TH SERVXCHECK 3
|
||||
.SH NAME
|
||||
servxcheck \- Internet service access check
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
.nf
|
||||
#define _MINIX_SOURCE 1
|
||||
#include </net/gen/netdb.h>
|
||||
|
||||
int servxcheck(ipaddr_t \fIpeer\fP, const char *\fIservice\fP,
|
||||
void (*\fIlogf\fP)(int \fIpass\fP, const char *\fIname\fP));
|
||||
char *servxfile(const char *\fIfile\fP);
|
||||
.fi
|
||||
.ft R
|
||||
.SH DESCRIPTION
|
||||
.B Servxcheck()
|
||||
is used by programs like
|
||||
.B inetd
|
||||
to perform an access check on the host connected to the other end of the TCP
|
||||
channel that has IP address
|
||||
.IR peer .
|
||||
.PP
|
||||
.B Servxcheck()
|
||||
translates the IP address to the
|
||||
associated host name if necessary, and checks if the host is granted access
|
||||
as guided by the file
|
||||
.BR /etc/serv.access .
|
||||
(See
|
||||
.BR serv.access (5).)
|
||||
The service name used to search the access file is passed by the caller as
|
||||
.IR service .
|
||||
These names should be the same as the service names in
|
||||
.BR /etc/services .
|
||||
.PP
|
||||
The caller should use the NWIOGTCPCONF ioctl() call to find out what the
|
||||
IP address of the remote end is. It is wise to bypass the
|
||||
.B servxcheck()
|
||||
call if the remote end happens to be the local machine (remaddr == locaddr),
|
||||
so that local connections aren't impeded by slow checks.
|
||||
.B Servxcheck()
|
||||
will itself allow connections from 127.0.0.1/8 immediately, so you
|
||||
don't have to check for that. Example of use:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
.ta +4n +4n +4n
|
||||
if (ioctl(fd, NWIOGTCPCONF, &tcpconf) < 0
|
||||
|| tcpconf.nwtc_remaddr == tcpconf.nwtc_locaddr
|
||||
|| servxcheck(tcpconf.nwtc_remaddr, service_name, NULL)
|
||||
) {
|
||||
serve();
|
||||
}
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
An attempt to connect to a service is logged if the access is denied. You
|
||||
can use the special checkword "\fBlog\fP" to also log if access is granted.
|
||||
Logging will be done with
|
||||
.B syslog()
|
||||
at the
|
||||
.B warning
|
||||
level.
|
||||
A syntax error in the access file may be logged under the
|
||||
.B err
|
||||
level.
|
||||
The caller must use
|
||||
.B openlog()
|
||||
to set the appropriate logging facility. One may do one's own logging by
|
||||
supplying a
|
||||
.I logf
|
||||
function that will be called by
|
||||
.B servxcheck
|
||||
with a first argument that is true if access is granted, false if
|
||||
denied, and a second argument that is the name of the remote host whose
|
||||
access has been checked.
|
||||
.PP
|
||||
The default is to fail the check unless the access file says otherwise.
|
||||
Strange errors make the check succeed. (We do not want
|
||||
remote access to fail because of some system error.) Note that this
|
||||
function is not meant to check access to the system, that's what
|
||||
passwords and such are for, but only to limit access to those who are
|
||||
allowed to use the services the system offers.
|
||||
.PP
|
||||
Connections from a machine to itself are accepted immediately. No further
|
||||
checks, no logging.
|
||||
.PP
|
||||
.B Servxfile()
|
||||
may be used to specify a file other than the default
|
||||
.BR /etc/serv.access .
|
||||
This is useful for programs started from
|
||||
.B inetd
|
||||
that want to handle the access check themselves, using a private access file.
|
||||
The return value of
|
||||
.B servxfile()
|
||||
is the pathname of the old access file. Only a pointer to the new path is
|
||||
saved, the caller must keep the string it points to intact.
|
||||
.SH FILES
|
||||
.TP 25n
|
||||
.B /etc/serv.access
|
||||
Default access check file.
|
||||
.SH "SEE ALSO"
|
||||
.BR syslog (3),
|
||||
.BR serv.access (5),
|
||||
.BR services (5),
|
||||
.BR inetd (8).
|
||||
.SH DIAGNOSTICS
|
||||
.B Servxcheck()
|
||||
returns 0 if the access is denied, 1 if granted.
|
||||
.PP
|
||||
Typical syslog message:
|
||||
.PP
|
||||
.RS
|
||||
Jan 10 20:27:20 flotsam inetd[174]: service 'shell' granted to jetsam.cs.vu.nl
|
||||
.RE
|
||||
.SH BUGS
|
||||
IP and DNS based access checks will stop most crackers, but not the really
|
||||
determined ones. Luckily MINIX 3 is sufficiently strange to thwart the well
|
||||
known cracking schemes. But don't ever allow yourself to feel secure.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot <kjb@cs.vu.nl>
|
|
@ -1,112 +0,0 @@
|
|||
.\" Copyright (c) 1980 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)setbuf.3s 6.2 (Berkeley) 5/12/86
|
||||
.\"
|
||||
.TH SETBUF 3 "May 12, 1986"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
setbuf, setvbuf \- assign buffering to a stream
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
|
||||
int setbuf(FILE *\fIstream\fP, char *\fIbuf\fP)
|
||||
int setvbuf(FILE *\fIstream\fP, char *\fIbuf\fP, int \fItype\fP, size_t \fIsize\fP)
|
||||
.SH DESCRIPTION
|
||||
The three types of buffering available are unbuffered, block buffered,
|
||||
and line buffered.
|
||||
When an output stream is unbuffered, information appears on the
|
||||
destination file or terminal as soon as written;
|
||||
when it is block buffered many characters are saved up and written as a block;
|
||||
when it is line buffered characters are saved up until a newline is
|
||||
encountered or input is read from stdin.
|
||||
.B Fflush
|
||||
(see
|
||||
.BR fclose (3))
|
||||
may be used to force the block out early.
|
||||
Normally all files are block buffered.
|
||||
A buffer is obtained from
|
||||
.BR malloc (3)
|
||||
upon the first
|
||||
.B getc
|
||||
or
|
||||
.BR putc (3)
|
||||
on the file.
|
||||
If the standard stream
|
||||
.B stdout
|
||||
refers to a terminal it is line buffered.
|
||||
The standard stream
|
||||
.B stderr
|
||||
is always unbuffered.
|
||||
.PP
|
||||
.B Setbuf
|
||||
is used after a stream has been opened but before it is read or written.
|
||||
The character array
|
||||
.I buf
|
||||
is used instead of an automatically allocated buffer. If
|
||||
.I buf
|
||||
is the constant pointer
|
||||
.SM
|
||||
.BR NULL ,
|
||||
input/output will be completely unbuffered.
|
||||
A manifest constant
|
||||
.SM
|
||||
.B BUFSIZ
|
||||
tells how big an array is needed:
|
||||
.IP
|
||||
.B char
|
||||
buf[BUFSIZ];
|
||||
.PP
|
||||
.BR Setvbuf ,
|
||||
an alternate form of
|
||||
.BR setbuf ,
|
||||
is used after a stream has been opened but before it is read or written.
|
||||
It has three uses, depending on the value of the
|
||||
.IR type
|
||||
argument:
|
||||
.TP 5
|
||||
.B "setvbuf(\fIstream\fP, \fIbuf\fP, _IOFBF, \fIsize\fP)"
|
||||
Causes input/output to be fully buffered using the character array
|
||||
.I buf
|
||||
whose size is determined by the
|
||||
.I size
|
||||
argument.
|
||||
If
|
||||
.I buf
|
||||
is the constant pointer
|
||||
.SM
|
||||
.BR NULL ,
|
||||
then an automatically allocated buffer will be used.
|
||||
.TP 5
|
||||
.B "setvbuf(\fIstream\fP, \fIbuf\fP, _IOLBF, \fIsize\fP)"
|
||||
Like above, except that output will be line buffered, i.e. the buffer will
|
||||
be flushed when a newline is written, the buffer is full, or input is
|
||||
requested.
|
||||
.TP 5
|
||||
.B "setvbuf(\fIstream\fP, \fIbuf\fP, _IONBF, \fIsize\fP)"
|
||||
Causes input/output to be completely unbuffered.
|
||||
.I Buf
|
||||
and
|
||||
.I size
|
||||
are ignored.
|
||||
.PP
|
||||
A file can be changed between unbuffered, line buffered, or block buffered
|
||||
by using
|
||||
.B freopen
|
||||
(see
|
||||
.BR fopen (3))
|
||||
followed by the appropriate
|
||||
.B setvbuf
|
||||
call.
|
||||
.SH "SEE ALSO"
|
||||
.BR fopen (3),
|
||||
.BR getc (3),
|
||||
.BR putc (3),
|
||||
.BR malloc (3),
|
||||
.BR fclose (3),
|
||||
.BR puts (3),
|
||||
.BR printf (3),
|
||||
.BR fread (3).
|
|
@ -1,69 +0,0 @@
|
|||
.TH SETJMP 3 "June 22, 2006"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
setjmp, longjmp, _setjmp, _longjmp, sigsetjmp, siglongjmp \- save and restore execution contexts
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <setjmp.h>
|
||||
|
||||
int setjmp(jmp_buf env);
|
||||
void longjmp(jmp_buf env, int val);
|
||||
|
||||
int _setjmp(jmp_buf env);
|
||||
void _longjmp(jmp_buf env, int val);
|
||||
|
||||
#define _POSIX_SOURCE
|
||||
int sigsetjmp(sigjmp_buf env, int savemask);
|
||||
void siglongjmp(sigjmp_buf env, int val);
|
||||
.SH DESCRIPTION
|
||||
These calls provide a way for a process to save an execution context into a
|
||||
buffer, and later resume execution from that context, effectively performing
|
||||
a non-local jump. The
|
||||
.B setjmp
|
||||
family of functions store the context into the \fIenv\fP data structure,
|
||||
and return the value 0. The
|
||||
.B longjmp
|
||||
family of functions jump to the context saved in the given \fIenv\fP data
|
||||
structure, causing the process to continue as if it returned from the
|
||||
corresponding
|
||||
.B setjmp
|
||||
call again, but this time with the non-zero return value in \fIval\fP.
|
||||
.PP
|
||||
The difference between the three pairs of setjmp/longjmp functions lies in the
|
||||
behaviour with respect to saving/restoring the process signal mask. POSIX does
|
||||
not require the process signal mask to be saved and restored during
|
||||
.B setjmp
|
||||
/
|
||||
.B longjmp
|
||||
\. However, the current implementation does this in order to agree with OSF/1
|
||||
and other BSD derived systems.
|
||||
.PP
|
||||
The pair of functions
|
||||
.B _setjmp
|
||||
/
|
||||
.B _longjmp
|
||||
, traditional in BSD systems, may be used when the signal mask is not to be
|
||||
saved/restored.
|
||||
.PP
|
||||
Finally, the POSIX
|
||||
.B sigsetjmp
|
||||
/
|
||||
.B siglongjmp
|
||||
functions allow the programmer to specify explicitly whether the signal mask
|
||||
is to be saved/restored, by means of the \fIsavemask\fP parameter. If this
|
||||
parameter is zero, the signal mask will not be saved/restored, otherwise it
|
||||
will.
|
||||
.SH NOTES
|
||||
After the function calling
|
||||
.B setjmp
|
||||
has returned, the saved context may not be used in a call to
|
||||
.B longjmp
|
||||
anymore, since the relevant portion of the stack may already have been wiped
|
||||
out at that point.
|
||||
.PP
|
||||
Using these functions to return to a previous state from a signal handler
|
||||
is possible but should be done with extreme care, as some interrupted library
|
||||
routines may not be reentrant and/or temporarily allocate resources.
|
||||
.PP
|
||||
See the setjmp.h header file for more implementation details specific to Minix.
|
193
man/man3/sha1.3
193
man/man3/sha1.3
|
@ -1,193 +0,0 @@
|
|||
.\" $OpenBSD: sha1.3,v 1.37 2008/02/13 08:43:39 art Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997, 2004 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.\" See http://csrc.nist.gov/publications/fips/fips180-1/fip180-1.txt
|
||||
.\" for the detailed standard
|
||||
.\"
|
||||
.Dd $Mdocdate: February 13 2008 $
|
||||
.Dt SHA1 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm SHA1Init ,
|
||||
.Nm SHA1Update ,
|
||||
.Nm SHA1Final ,
|
||||
.Nm SHA1Transform ,
|
||||
.Nm SHA1End ,
|
||||
.Nm SHA1File ,
|
||||
.Nm SHA1Data
|
||||
.Nd calculate the NIST Secure Hash Algorithm
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <sys/types.h>
|
||||
.Fd #include <minix/sha1.h>
|
||||
.Ft void
|
||||
.Fn SHA1Init "SHA1_CTX *context"
|
||||
.Ft void
|
||||
.Fn SHA1Update "SHA1_CTX *context" "const u_int8_t *data" "size_t len"
|
||||
.Ft void
|
||||
.Fn SHA1Final "u_int8_t digest[SHA1_DIGEST_LENGTH]" "SHA1_CTX *context"
|
||||
.Ft void
|
||||
.Fn SHA1Transform "u_int32_t state[5]" "const u_int8_t buffer[SHA1_BLOCK_LENGTH]"
|
||||
.Ft "char *"
|
||||
.Fn SHA1End "SHA1_CTX *context" "char *buf"
|
||||
.Ft "char *"
|
||||
.Fn SHA1File "const char *filename" "char *buf"
|
||||
.Ft "char *"
|
||||
.Fn SHA1Data "const u_int8_t *data" "size_t len" "char *buf"
|
||||
.Sh DESCRIPTION
|
||||
The SHA1 functions implement the NIST Secure Hash Algorithm (SHA-1),
|
||||
FIPS PUB 180-1.
|
||||
SHA-1 is used to generate a condensed representation
|
||||
of a message called a message digest.
|
||||
The algorithm takes a
|
||||
message less than 2^64 bits as input and produces a 160-bit digest
|
||||
suitable for use as a digital signature.
|
||||
.Pp
|
||||
The SHA1 functions are considered to be more secure than the
|
||||
.Xr md4 3
|
||||
and
|
||||
.Xr md5 3
|
||||
functions with which they share a similar interface.
|
||||
.Pp
|
||||
The
|
||||
.Fn SHA1Init
|
||||
function initializes a SHA1_CTX
|
||||
.Ar context
|
||||
for use with
|
||||
.Fn SHA1Update ,
|
||||
and
|
||||
.Fn SHA1Final .
|
||||
The
|
||||
.Fn SHA1Update
|
||||
function adds
|
||||
.Ar data
|
||||
of length
|
||||
.Ar len
|
||||
to the SHA1_CTX specified by
|
||||
.Ar context .
|
||||
.Fn SHA1Final
|
||||
is called when all data has been added via
|
||||
.Fn SHA1Update
|
||||
and stores a message digest in the
|
||||
.Ar digest
|
||||
parameter.
|
||||
.Pp
|
||||
The
|
||||
.Fn SHA1Transform
|
||||
function is used by
|
||||
.Fn SHA1Update
|
||||
to hash 512-bit blocks and forms the core of the algorithm.
|
||||
Most programs should use the interface provided by
|
||||
.Fn SHA1Init ,
|
||||
.Fn SHA1Update
|
||||
and
|
||||
.Fn SHA1Final
|
||||
instead of calling
|
||||
.Fn SHA1Transform
|
||||
directly.
|
||||
.Pp
|
||||
The
|
||||
.Fn SHA1End
|
||||
function is a front end for
|
||||
.Fn SHA1Final
|
||||
which converts the digest into an
|
||||
.Tn ASCII
|
||||
representation of the 160 bit digest in hexadecimal.
|
||||
.Pp
|
||||
The
|
||||
.Fn SHA1File
|
||||
function calculates the digest for a file and returns the result via
|
||||
.Fn SHA1End .
|
||||
If
|
||||
.Fn SHA1File
|
||||
is unable to open the file a NULL pointer is returned.
|
||||
.Pp
|
||||
The
|
||||
.Fn SHA1Data
|
||||
function
|
||||
calculates the digest of an arbitrary string and returns the result via
|
||||
.Fn SHA1End .
|
||||
.Pp
|
||||
For each of the
|
||||
.Fn SHA1End ,
|
||||
.Fn SHA1File ,
|
||||
and
|
||||
.Fn SHA1Data
|
||||
functions the
|
||||
.Ar buf
|
||||
parameter should either be a string of at least 41 characters in
|
||||
size or a NULL pointer.
|
||||
In the latter case, space will be dynamically allocated via
|
||||
.Xr malloc 3
|
||||
and should be freed using
|
||||
.Xr free 3
|
||||
when it is no longer needed.
|
||||
.Sh EXAMPLES
|
||||
The follow code fragment will calculate the digest for
|
||||
the string "abc" which is ``0xa9993e364706816aba3e25717850c26c9cd0d89d''.
|
||||
.Bd -literal -offset indent
|
||||
SHA1_CTX sha;
|
||||
u_int8_t results[SHA1_DIGEST_LENGTH];
|
||||
char *buf;
|
||||
int n;
|
||||
|
||||
buf = "abc";
|
||||
n = strlen(buf);
|
||||
SHA1Init(&sha);
|
||||
SHA1Update(&sha, (u_int8_t *)buf, n);
|
||||
SHA1Final(results, &sha);
|
||||
|
||||
/* Print the digest as one long hex value */
|
||||
printf("0x");
|
||||
for (n = 0; n < SHA1_DIGEST_LENGTH; n++)
|
||||
printf("%02x", results[n]);
|
||||
putchar('\en');
|
||||
.Ed
|
||||
.Pp
|
||||
Alternately, the helper functions could be used in the following way:
|
||||
.Bd -literal -offset indent
|
||||
u_int8_t output[SHA1_DIGEST_STRING_LENGTH];
|
||||
char *buf = "abc";
|
||||
|
||||
printf("0x%s\en", SHA1Data(buf, strlen(buf), output));
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr cksum 1 ,
|
||||
.Xr sha1 1 ,
|
||||
.Xr md4 3 ,
|
||||
.Xr md5 3 ,
|
||||
.Xr rmd160 3 ,
|
||||
.Xr sha2 3
|
||||
.Rs
|
||||
.%A J. Burrows
|
||||
.%T The Secure Hash Standard
|
||||
.%O FIPS PUB 180-1
|
||||
.Re
|
||||
.Rs
|
||||
.%A D. Eastlake and P. Jones
|
||||
.%T US Secure Hash Algorithm 1
|
||||
.%O RFC 3174
|
||||
.Re
|
||||
.Sh HISTORY
|
||||
The SHA-1 functions appeared in
|
||||
.Ox 2.0 .
|
||||
.Sh CAVEATS
|
||||
This implementation of SHA-1 has not been validated by NIST
|
||||
and as such is not in official compliance with the standard.
|
||||
.Pp
|
||||
If a message digest is to be copied to a multi-byte type (ie:
|
||||
an array of five 32-bit integers) it will be necessary to
|
||||
perform byte swapping on little endian machines such as the i386, alpha,
|
||||
and vax.
|
|
@ -1,85 +0,0 @@
|
|||
.TH SIGSET 3
|
||||
.SH NAME
|
||||
sigset, sigaddset, sigdelset, sigemptyset, sigfillset, sigismember \- manipulate signal sets
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
#include <signal.h>
|
||||
|
||||
.nf
|
||||
int sigaddset(sigset_t *\fIset\fP, int \fIsig\fP)
|
||||
int sigdelset(sigset_t *\fIset\fP, int \fIsig\fP)
|
||||
int sigemptyset(sigset_t *\fIset\fP)
|
||||
int sigfillset(sigset_t *\fIset\fP)
|
||||
int sigismember(const sigset_t *\fIset\fP, int \fIsig\fP)
|
||||
.fi
|
||||
.ft P
|
||||
.SH DESCRIPTION
|
||||
The system calls that handle signals, such as
|
||||
.BR sigaction (2)
|
||||
and
|
||||
.BR sigprocmask (2)
|
||||
use sets of signals to keep a process from being interrupted by those
|
||||
signals while executing a signal handler or a critical code segment. These
|
||||
signal sets are manipulated by the following functions:
|
||||
.TP 5
|
||||
.B "int sigaddset(sigset_t *\fIset\fP, int \fIsig\fP)"
|
||||
Add signal
|
||||
.I sig
|
||||
to the signal set referenced by
|
||||
.IR set .
|
||||
.TP
|
||||
.B "int sigdelset(sigset_t *\fIset\fP, int \fIsig\fP)"
|
||||
Remove signal
|
||||
.I sig
|
||||
from the signal set referenced by
|
||||
.IR set .
|
||||
.TP
|
||||
.B "int sigemptyset(sigset_t *\fIset\fP)"
|
||||
Initialize the signal set referenced by
|
||||
.I set
|
||||
to an empty set.
|
||||
.TP
|
||||
.B "int sigfillset(sigset_t *\fIset\fP)"
|
||||
Initialize the signal set referenced by
|
||||
.I set
|
||||
to an full set, i.e. all signals are in the set.
|
||||
.TP
|
||||
.B "int sigismember(const sigset_t *\fIset\fP, int \fIsig\fP)"
|
||||
Return
|
||||
.B 1
|
||||
if the signal
|
||||
.I sig
|
||||
is present in the set referenced by
|
||||
.IR set ,
|
||||
.B 0
|
||||
otherwise.
|
||||
.SH "SEE ALSO"
|
||||
.BR sigaction (2),
|
||||
.BR sigpending (2),
|
||||
.BR sigprocmask (2),
|
||||
.BR sigsuspend (2).
|
||||
.SH DIAGNOSTICS
|
||||
All functions except
|
||||
.B sigismember
|
||||
return
|
||||
.B 0
|
||||
on success.
|
||||
.B Sigismember
|
||||
returns
|
||||
.B 0
|
||||
or
|
||||
.B 1
|
||||
on success. They return
|
||||
.B \-1
|
||||
with error code
|
||||
.B EINVAL
|
||||
for an invalid signal number. (They do not use
|
||||
.B EFAULT
|
||||
for a bad
|
||||
.I set
|
||||
address, but will simply cause a segmentation violation.)
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
||||
|
||||
.\"
|
||||
.\" $PchId: sigset.3,v 1.2 1996/04/11 06:39:09 philip Exp $
|
|
@ -1,29 +0,0 @@
|
|||
.\" Copyright (c) 1980 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)sleep.3 6.2 (Berkeley) 5/12/86
|
||||
.\"
|
||||
.TH SLEEP 3 "August 16, 2009"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
sleep \- suspend execution for interval
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <unistd.h>
|
||||
|
||||
unsigned int sleep(unsigned int \fIseconds\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The current process is suspended from execution for the number
|
||||
of seconds specified by the argument.
|
||||
.PP
|
||||
The routine is implemented using the 'select' function, so it does not
|
||||
interfere with alarm timers. If a signal is received, the function returns.
|
||||
.SH "RETURN VALUE
|
||||
The amount of time that remains to be slept is returned. This value is
|
||||
specified in seconds and rounded up.
|
||||
.SH "SEE ALSO"
|
||||
.BR pause (2),
|
||||
.BR nanosleep (3).
|
|
@ -1,123 +0,0 @@
|
|||
.\" @(#)varargs.3 6.3 (Berkeley) 5/15/86
|
||||
.\"
|
||||
.TH STDARG 3 "May 15, 1986"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
stdarg \- variable argument list
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdarg.h>
|
||||
|
||||
void va_start(va_list \fIap\fP, \fIargtypeN\fP \fIparmN\fP)
|
||||
\fItype\fP va_arg(va_list \fIap\fP, \fItype\fP)
|
||||
void va_end(va_list \fIap\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
This set of macros provides a means of writing portable procedures that
|
||||
accept variable argument lists.
|
||||
Routines having variable argument lists (such as
|
||||
.BR printf (3))
|
||||
that do not use
|
||||
.B stdarg
|
||||
are inherently nonportable, since different
|
||||
machines use different argument passing conventions.
|
||||
.PP
|
||||
A function that accepts a variable argument list is declared with "..." at
|
||||
the end of its parameter list. It must have at least one normal argument
|
||||
before the "...". For example:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
int printf(const char *format, ...) { /* code */ }
|
||||
int fprintf(FILE *stream, const char *format, ...) { /* code */ }
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
.B va_list
|
||||
is a type which is used for the variable
|
||||
.I ap
|
||||
within the body of a variable argument function which is used to traverse
|
||||
the list.
|
||||
.PP
|
||||
.B va_start\c
|
||||
.RI ( ap ,
|
||||
.IR parmN )
|
||||
is called to initialize
|
||||
.I ap
|
||||
to the beginning of the list. The last true parameter of the function,
|
||||
.IR parmN ,
|
||||
must be supplied to allow
|
||||
.B va_start
|
||||
to compute the address of the first variable parameter.
|
||||
.PP
|
||||
.B va_arg\c
|
||||
.RI ( ap ,
|
||||
.IR type )
|
||||
will return the next argument in the list pointed to by
|
||||
.IR ap .
|
||||
.I Type
|
||||
is the type to which the expected argument will be converted
|
||||
when passed as an argument.
|
||||
.PP
|
||||
Different types can be mixed, but it is up
|
||||
to the routine to know what type of argument is
|
||||
expected, since it cannot be determined at runtime.
|
||||
.PP
|
||||
.B va_end\c
|
||||
.RI ( ap )
|
||||
must be used to finish up.
|
||||
.PP
|
||||
Multiple traversals, each bracketed by
|
||||
.B va_start
|
||||
\&...
|
||||
.B va_end,
|
||||
are possible.
|
||||
.SH EXAMPLE
|
||||
.nf
|
||||
.ta +4n +4n +4n +4n
|
||||
\fB#include\fP <stdarg.h>
|
||||
.sp 0.4
|
||||
execl(\fBconst char\fP *path, \fB...\fP)
|
||||
{
|
||||
\fBva_list\fP ap;
|
||||
\fBchar\fP *args[100];
|
||||
\fBint\fP argno = 0;
|
||||
|
||||
\fBva_start\fP(ap, path);
|
||||
\fBwhile\fP ((args[argno++] = \fBva_arg\fP(ap, \fBchar\fP *)) != NULL) {}
|
||||
\fBva_end\fP(ap);
|
||||
\fBreturn\fP execv(path, args);
|
||||
}
|
||||
.DT
|
||||
.fi
|
||||
.SH NOTES
|
||||
It is up to the calling routine to determine how many arguments
|
||||
there are, since it is not possible to determine this from the
|
||||
stack frame. For example,
|
||||
.B execl
|
||||
passes a null pointer to signal the end of the list.
|
||||
.B Printf
|
||||
can tell how many arguments are supposed to be there by the format.
|
||||
.PP
|
||||
The macros
|
||||
.B va_start
|
||||
and
|
||||
.B va_end
|
||||
may be arbitrarily complex;
|
||||
for example,
|
||||
.B va_start
|
||||
might contain an opening brace,
|
||||
which is closed by a matching brace in
|
||||
.BR va_end .
|
||||
Thus, they should only be used where they could
|
||||
be placed within a single complex statement.
|
||||
.SH BUGS
|
||||
It is impossible to properly show the macros as C declarations as is
|
||||
done in the synopsis. They can never be coded as C functions, because
|
||||
all three macros use their arguments by address, and the
|
||||
.I type
|
||||
field is certainly impossible.
|
||||
Just look at them as being part of the C language, like
|
||||
.BR sizeof .
|
199
man/man3/stdio.3
199
man/man3/stdio.3
|
@ -1,199 +0,0 @@
|
|||
.\" Copyright (c) 1980 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)stdio.3s 6.2 (Berkeley) 5/13/86
|
||||
.\"
|
||||
.TH STDIO 3 "May 13, 1986"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
stdio \- standard buffered input/output package
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
|
||||
FILE *stdin;
|
||||
FILE *stdout;
|
||||
FILE *stderr;
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The functions in the standard I/O library constitute a user-level buffering
|
||||
scheme. The in-line macros
|
||||
.B getc
|
||||
and
|
||||
.BR putc (3)
|
||||
handle characters quickly. The higher level routines
|
||||
.BR gets ,
|
||||
.BR fgets ,
|
||||
.BR scanf ,
|
||||
.BR fscanf ,
|
||||
.BR fread ,
|
||||
.BR puts ,
|
||||
.BR fputs ,
|
||||
.BR printf ,
|
||||
.BR fprintf ,
|
||||
.BR fwrite
|
||||
all use
|
||||
.B getc
|
||||
and
|
||||
.BR putc ;
|
||||
they can be freely intermixed.
|
||||
.PP
|
||||
A file with associated buffering is called a
|
||||
.IR stream ,
|
||||
and is declared to be a pointer to a defined type
|
||||
.SM
|
||||
.BR FILE .
|
||||
.BR Fopen (3)
|
||||
creates certain descriptive data for a stream
|
||||
and returns a pointer to designate the stream in all further transactions.
|
||||
There are three normally open streams with constant pointers declared in
|
||||
the include file and associated with the standard open files:
|
||||
.TP 10n
|
||||
.B stdin
|
||||
standard input file
|
||||
.br
|
||||
.ns
|
||||
.TP
|
||||
.B stdout
|
||||
standard output file
|
||||
.br
|
||||
.ns
|
||||
.TP
|
||||
.B stderr
|
||||
standard error file
|
||||
.PP
|
||||
A constant `pointer'
|
||||
.SM
|
||||
.B NULL
|
||||
(0)
|
||||
designates no stream at all.
|
||||
.PP
|
||||
An integer constant
|
||||
.SM
|
||||
.B EOF
|
||||
(\-1) is returned upon end of file or error by integer functions that
|
||||
deal with streams.
|
||||
.PP
|
||||
Any routine that uses the standard input/output package
|
||||
must include the header file
|
||||
.RI < stdio.h >
|
||||
of pertinent macro definitions.
|
||||
The functions and constants mentioned in the standard I/O manual pages
|
||||
are declared in the include file and need no further declaration.
|
||||
The constants, and the following `functions' are
|
||||
implemented as macros; redeclaration of these names is perilous:
|
||||
.BR clearerr ,
|
||||
.BR getc ,
|
||||
.BR getchar ,
|
||||
.BR putc ,
|
||||
.BR putchar ,
|
||||
.BR feof ,
|
||||
.BR ferror ,
|
||||
.BR fileno .
|
||||
.SH "SEE ALSO"
|
||||
.BR open (2),
|
||||
.BR close (2),
|
||||
.BR read (2),
|
||||
.BR write (2),
|
||||
.BR fclose (3),
|
||||
.BR ferror (3),
|
||||
.BR fopen (3),
|
||||
.BR fread (3),
|
||||
.BR fseek (3),
|
||||
.BR getc (3),
|
||||
.BR gets (3),
|
||||
.BR printf (3),
|
||||
.BR putc (3),
|
||||
.BR puts (3),
|
||||
.BR scanf (3),
|
||||
.BR setbuf (3),
|
||||
.BR ungetc (3).
|
||||
.SH DIAGNOSTICS
|
||||
The value
|
||||
.SM
|
||||
.B EOF
|
||||
is returned uniformly to indicate that a
|
||||
.SM
|
||||
.B FILE
|
||||
pointer has not been initialized with
|
||||
.BR fopen ,
|
||||
input (output) has been attempted on an output (input) stream, or a
|
||||
.SM
|
||||
.B FILE
|
||||
pointer designates corrupt or otherwise unintelligible
|
||||
.SM
|
||||
.B FILE
|
||||
data.
|
||||
.PP
|
||||
For purposes of efficiency, this implementation of the standard library
|
||||
has been changed to line buffer output to a terminal by default and attempts
|
||||
to do this transparently by flushing the output whenever a
|
||||
.BR read (2)
|
||||
from the standard input is necessary. This is almost always transparent,
|
||||
but may cause confusion or malfunctioning of programs which use
|
||||
standard i/o routines but use
|
||||
.BR read (2)
|
||||
themselves to read from the standard input.
|
||||
.PP
|
||||
In cases where a large amount of computation is done after printing
|
||||
part of a line on an output terminal, it is necessary to
|
||||
.BR fflush (3)
|
||||
the standard output before going off and computing so that the output
|
||||
will appear.
|
||||
.SH BUGS
|
||||
The standard buffered functions do not interact well with certain other
|
||||
library and system functions, especially \fBfork\fP and \fBabort\fP.
|
||||
.SH "LIST OF FUNCTIONS"
|
||||
.sp 2
|
||||
.nf
|
||||
.ta \w'setlinebuf'u+2n +\w'setbuf(3)'u+10n
|
||||
\fBName\fP \fBAppears on Page\fP \fBDescription\fP
|
||||
.ta \w'setlinebuf'u+4n +\w'setbuf(3)'u+4n
|
||||
.sp 5p
|
||||
clearerr ferror(3) stream status inquiries
|
||||
fclose fclose(3) close or flush a stream
|
||||
fdopen fopen(3) open a stream
|
||||
feof ferror(3) stream status inquiries
|
||||
ferror ferror(3) stream status inquiries
|
||||
fflush fclose(3) close or flush a stream
|
||||
fgetc getc(3) get character or word from stream
|
||||
fgets gets(3) get a string from a stream
|
||||
fileno ferror(3) stream status inquiries
|
||||
fopen fopen(3) open a stream
|
||||
fprintf printf(3) formatted output conversion
|
||||
fputc putc(3) put character or word on a stream
|
||||
fputs puts(3) put a string on a stream
|
||||
fread fread(3) buffered binary input/output
|
||||
freopen fopen(3) open a stream
|
||||
fscanf scanf(3) formatted input conversion
|
||||
fseek fseek(3) reposition a stream
|
||||
ftell fseek(3) reposition a stream
|
||||
fwrite fread(3) buffered binary input/output
|
||||
getc getc(3) get character or word from stream
|
||||
getchar getc(3) get character or word from stream
|
||||
gets gets(3) get a string from a stream
|
||||
getw getc(3) get character or word from stream
|
||||
printf printf(3) formatted output conversion
|
||||
putc putc(3) put character or word on a stream
|
||||
putchar putc(3) put character or word on a stream
|
||||
puts puts(3) put a string on a stream
|
||||
putw putc(3) put character or word on a stream
|
||||
rewind fseek(3) reposition a stream
|
||||
scanf scanf(3) formatted input conversion
|
||||
setbuf setbuf(3) assign buffering to a stream
|
||||
setvbuf setbuf(3) assign buffering to a stream
|
||||
snprintf printf(3) formatted output conversion
|
||||
sprintf printf(3) formatted output conversion
|
||||
sscanf scanf(3) formatted input conversion
|
||||
ungetc ungetc(3) push character back into input stream
|
||||
vfprintf printf(3) formatted output conversion
|
||||
vfscanf scanf(3) formatted input conversion
|
||||
vprintf printf(3) formatted output conversion
|
||||
vscanf scanf(3) formatted input conversion
|
||||
vsnprintf printf(3) formatted output conversion
|
||||
vsprintf printf(3) formatted output conversion
|
||||
vsscanf scanf(3) formatted input conversion
|
||||
.fi
|
|
@ -1,149 +0,0 @@
|
|||
.\" Copyright (c) 1980 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)string.3 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH STRING 3 "May 15, 1985"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
string, strcat, strncat, strcmp, strncmp, strcpy, strncpy, strlen, strchr, strrchr, strerror, memcmp, memcpy, memmove, memchr, memset, index, rindex \- string operations
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <string.h>
|
||||
|
||||
char *strcat(char *\fIs1\fP, const char *\fIs2\fP)
|
||||
char *strncat(char *\fIs1\fP, const char *\fIs2\fP, size_t \fIn\fP)
|
||||
int strcmp(const char *\fIs1\fP, const char *\fIs2\fP)
|
||||
int strncmp(const char *\fIs1\fP, const char *\fIs2\fP, size_t \fIn\fP)
|
||||
char *strcpy(char *\fIs1\fP, const char *\fIs2\fP)
|
||||
char *strncpy(char *\fIs1\fP, const char *\fIs2\fP, size_t \fIn\fP)
|
||||
size_t strlen(const char *\fIs\fP)
|
||||
char *strchr(const char *\fIs\fP, int \fIc\fP)
|
||||
char *strrchr(const char *\fIs\fP, int \fIc\fP)
|
||||
char *strerror(int \fIerrnum\fP)
|
||||
int memcmp(const void *\fIs1\fP, const void *\fIs2\fP, size_t \fIn\fP)
|
||||
void *memcpy(void *\fIs1\fP, const void *\fIs2\fP, size_t \fIn\fP)
|
||||
void *memmove(void *\fIs1\fP, const void *\fIs2\fP, size_t \fIn\fP)
|
||||
void *memchr(const void *\fIs\fP, int \fIc\fP, size_t \fIn\fP)
|
||||
void *memset(void *\fIs\fP, int \fIc\fP, size_t \fIn\fP)
|
||||
char *index(const char *\fIs\fP, int \fIc\fP)
|
||||
char *rindex(const char *\fIs\fP, int \fIc\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These functions operate on null-terminated strings.
|
||||
They do not check for overflow of any receiving string.
|
||||
.PP
|
||||
.B Strcat
|
||||
appends a copy of string
|
||||
.I s2
|
||||
to the end of string
|
||||
.IR s1 .
|
||||
.B Strncat
|
||||
copies at most
|
||||
.I n
|
||||
characters. Both return a pointer to the null-terminated result.
|
||||
.PP
|
||||
.B Strcmp
|
||||
compares its arguments and returns an integer
|
||||
greater than, equal to, or less than 0, according as
|
||||
.I s1
|
||||
is lexicographically greater than, equal to, or less than
|
||||
.IR s2 .
|
||||
.B Strncmp
|
||||
makes the same comparison but looks at at most
|
||||
.I n
|
||||
characters.
|
||||
.PP
|
||||
.B Strcpy
|
||||
copies string
|
||||
.I s2
|
||||
to
|
||||
.IR s1 ,
|
||||
stopping after the null character has been moved.
|
||||
.B Strncpy
|
||||
copies exactly
|
||||
.I n
|
||||
characters, truncating or null-padding
|
||||
.I s2;
|
||||
the target may not be null-terminated if the length of
|
||||
.I s2
|
||||
is
|
||||
.I n
|
||||
or more. Both return
|
||||
.IR s1 .
|
||||
.PP
|
||||
.B Strlen
|
||||
returns the number of non-null characters in
|
||||
.IR s .
|
||||
.PP
|
||||
.B Strchr
|
||||
.RB ( strrchr )
|
||||
returns a pointer to the first (last) occurrence of character
|
||||
.I c
|
||||
in string
|
||||
.I s,
|
||||
or null if
|
||||
.I c
|
||||
does not occur in the string.
|
||||
.PP
|
||||
.B Strerror
|
||||
returns the error string for the system call error
|
||||
.IR errnum .
|
||||
See
|
||||
.BR intro (2).
|
||||
.PP
|
||||
.B Memcmp
|
||||
is like
|
||||
.B strcmp
|
||||
except that the strings are memory blocks of length
|
||||
.IR n .
|
||||
Null characters are treated as ordinary characters.
|
||||
.PP
|
||||
.B Memcpy
|
||||
copies
|
||||
.I n
|
||||
bytes from the location pointed to by
|
||||
.I s2
|
||||
to
|
||||
.IR s1 .
|
||||
.B Memmove
|
||||
is like memcpy, except that it can handle overlap between the two strings.
|
||||
Both functions return
|
||||
.IR s1 .
|
||||
.PP
|
||||
.B Memchr
|
||||
returns a pointer to the first occurrence of character
|
||||
.I c
|
||||
in string
|
||||
.I s,
|
||||
or null if
|
||||
.I c
|
||||
does not occur in the string.
|
||||
.PP
|
||||
.B Memset
|
||||
sets
|
||||
.I n
|
||||
bytes to
|
||||
.I c
|
||||
starting at location
|
||||
.IR s .
|
||||
It returns
|
||||
.IR s .
|
||||
.PP
|
||||
.B Index
|
||||
and
|
||||
.B rindex
|
||||
are obsolete versions of
|
||||
.B strchr
|
||||
and
|
||||
.BR strrchr .
|
||||
New code should avoid using them.
|
||||
.SH NOTES
|
||||
Characters are compared as
|
||||
.BR "unsigned char" ,
|
||||
whether
|
||||
.B char
|
||||
itself is signed or not.
|
|
@ -1,33 +0,0 @@
|
|||
.TH STRTOL 3 "December 9, 2009"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
strtol, strtoll, strtoul, strtoull \- convert string to number
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdlib.h>
|
||||
|
||||
long strtol(const char *\fInptr\fP, char **\fIendptr\fP, int \fIbase\fP);
|
||||
unsigned long strtoul(const char *\fInptr\fP, char **\fIendptr\fP, int \fIbase\fP);
|
||||
#ifdef __LONG_LONG_SUPPORTED
|
||||
long long strtoll(const char *\fInptr\fP, char **\fIendptr\fP, int \fIbase\fP);
|
||||
unsigned long long strtoull(const char *\fInptr\fP, char **\fIendptr\fP, int \fIbase\fP);
|
||||
#endif
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These functions parse as much from the string \fInptr\fP as possible and return
|
||||
it as an integer. The string should consist of any number of whitespace
|
||||
characters followed by a sign (either plus or minus) and at least one digit in
|
||||
the specified \fIbase\fP. The digits of a hexadecimal string may be preceded by
|
||||
the prefix 0x or 0X, which is ignored. If \fIbase\fP is zero, hexadecimal is
|
||||
assumed if this prefix is present, octal is assumed if there is a leading zero
|
||||
and decimal is assumed otherwise. If not zero, \fIbase\fP must be at least 2
|
||||
and at most 36. A pointer to the first character following the numeric string is
|
||||
stored in *\fIendptr\fP.
|
||||
.PP
|
||||
Note that the strtoll and strtoull functions, which return 64-bit values,
|
||||
are supported only on GCC as ACK does not support 64-bit arithmatic.
|
||||
.SH "RETURN VALUE
|
||||
The parsed number is returned.
|
||||
.SH "SEE ALSO"
|
||||
.BR atoi (3).
|
|
@ -1,197 +0,0 @@
|
|||
.\" Written Feb 1994 by Steve Greenland (stevegr@neosoft.com)
|
||||
.\"
|
||||
.\" Permission is granted to make and distribute verbatim copies of this
|
||||
.\" manual provided the copyright notice and this permission notice are
|
||||
.\" preserved on all copies.
|
||||
.\"
|
||||
.\" Permission is granted to copy and distribute modified versions of this
|
||||
.\" manual under the conditions for verbatim copying, provided that the
|
||||
.\" entire resulting derived work is distributed under the terms of a
|
||||
.\" permission notice identical to this one
|
||||
.\"
|
||||
.\" Since the Linux kernel and libraries are constantly changing, this
|
||||
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
||||
.\" responsibility for errors or omissions, or for damages resulting from
|
||||
.\" the use of the information contained herein. The author(s) may not
|
||||
.\" have taken the same level of care in the production of this manual,
|
||||
.\" which is licensed free of charge, as they might when working
|
||||
.\" professionally.
|
||||
.\"
|
||||
.\" Formatted or processed versions of this manual, if unaccompanied by
|
||||
.\" the source, must acknowledge the copyright and authors of this work.
|
||||
.\"
|
||||
.\" from SYSLOG 3 "15 Feb 1994" "Linux" "Linux Programmer's Manual"
|
||||
.\" Modified for Minix porting by G. Falzoni <gfalzoni@inwind.it>
|
||||
.\"
|
||||
.\" Local macros
|
||||
.de Xr
|
||||
.BR \\$1 (\\$2)\\$3
|
||||
..
|
||||
.de LB
|
||||
.TP \\$1
|
||||
\\fB\\$2\\fR
|
||||
\\$3
|
||||
..
|
||||
.de LI
|
||||
.TP \\$1
|
||||
\\fI\\$2\\fR
|
||||
\\$3
|
||||
..
|
||||
.de LR
|
||||
.TP \\$1
|
||||
\\fR\\$2\\fR
|
||||
\\$3
|
||||
..
|
||||
.\" end local macros
|
||||
.TH SYSLOG 3 "Jan. 18, 2000"
|
||||
.SH NAME
|
||||
syslog, openlog, closelog \- send messages to the system logger
|
||||
.SH SYNOPSIS
|
||||
.B #include <syslog.h>
|
||||
.sp
|
||||
.BI "void openlog(char " *ident ", int " option ", int " facility)
|
||||
.sp
|
||||
.BI "void syslog(int " priority ", char " *format ", ...)"
|
||||
.sp
|
||||
.BI "void closelog(void)"
|
||||
.sp
|
||||
.SH DESCRIPTION
|
||||
.B openlog()
|
||||
opens a connection to the system logger for a program. The string pointed to by
|
||||
.I ident
|
||||
is added to each message, and is typically set to the program name. Values for
|
||||
.I option
|
||||
and
|
||||
.I facility
|
||||
are given in the next section. Its use is optional. It will automatically be called by
|
||||
.B syslog()
|
||||
if necessary, in which case
|
||||
.I ident
|
||||
will default to "syslog".
|
||||
.sp
|
||||
.B syslog()
|
||||
generates a log message, which will be distributed by
|
||||
.Xr syslogd 8 .
|
||||
.I priority
|
||||
is a combination of the
|
||||
.I facility
|
||||
and the
|
||||
.IR level ,
|
||||
values for which are given in the next section. The remaining arguments
|
||||
are a
|
||||
.IR format ,
|
||||
as in
|
||||
.Xr printf 3
|
||||
and any arguments required by the
|
||||
.IR format .
|
||||
.\" except that the two character %m will be replaced by the error message string
|
||||
.\" RI ( strerror )
|
||||
.\" corresponding to the present value of
|
||||
.\" IR errno .
|
||||
.sp
|
||||
.B closelog()
|
||||
closes the descriptor being used to write to the system logger. Its use is optional.
|
||||
.SH "PARAMETERS"
|
||||
This section lists the parameters used to set the values of
|
||||
.IR option , " facility" ", and " priority .
|
||||
.SS option
|
||||
The
|
||||
.I option
|
||||
argument to
|
||||
.B openlog()
|
||||
is an OR of any of these:
|
||||
.TP
|
||||
.B LOG_CONS
|
||||
write directly to system console if there is an error while sending to
|
||||
system logger
|
||||
.TP
|
||||
.B LOG_NDELAY
|
||||
open the connection immediately (normally, the connection is opened when
|
||||
the first message is logged)
|
||||
.TP
|
||||
.B LOG_PERROR
|
||||
print to stderr as well
|
||||
.TP
|
||||
.B LOG_PID
|
||||
include PID with each message
|
||||
.SS facility
|
||||
The
|
||||
.I facility
|
||||
argument is used to specify what type of program is logging the message.
|
||||
This lets the configuration file specify that messages from different
|
||||
facilities will be handled differently.
|
||||
.TP
|
||||
.B LOG_AUTH
|
||||
security/authorization messages (DEPRECATED Use
|
||||
.B LOG_AUTHPRIV
|
||||
instead)
|
||||
.TP
|
||||
.B LOG_AUTHPRIV
|
||||
security/authorization messages (private)
|
||||
.TP
|
||||
.B LOG_CRON
|
||||
clock daemon
|
||||
.RB ( cron " and " at )
|
||||
.TP
|
||||
.B LOG_DAEMON
|
||||
other system daemons
|
||||
.TP
|
||||
.B LOG_KERN
|
||||
kernel messages
|
||||
.TP
|
||||
.BR LOG_LOCAL0 " through " LOG_LOCAL7
|
||||
reserved for local use
|
||||
.TP
|
||||
.B LOG_LPR
|
||||
line printer subsystem
|
||||
.TP
|
||||
.B LOG_MAIL
|
||||
mail subsystem
|
||||
.TP
|
||||
.B LOG_NEWS
|
||||
USENET news subsystem
|
||||
.TP
|
||||
.B LOG_SYSLOG
|
||||
messages generated internally by
|
||||
.B syslogd
|
||||
.TP
|
||||
.BR LOG_USER (default)
|
||||
generic user-level messages
|
||||
.TP
|
||||
.B LOG_UUCP
|
||||
UUCP subsystem
|
||||
.SS level
|
||||
This determines the importance of the message. The levels are, in order
|
||||
of decreasing importance:
|
||||
.TP
|
||||
.B LOG_EMERG
|
||||
system is unusable
|
||||
.TP
|
||||
.B LOG_ALERT
|
||||
action must be taken immediately
|
||||
.TP
|
||||
.B LOG_CRIT
|
||||
critical conditions
|
||||
.TP
|
||||
.B LOG_ERR
|
||||
error conditions
|
||||
.TP
|
||||
.B LOG_WARNING
|
||||
warning conditions
|
||||
.TP
|
||||
.B LOG_NOTICE
|
||||
normal, but significant, condition
|
||||
.TP
|
||||
.B LOG_INFO
|
||||
informational message
|
||||
.TP
|
||||
.B LOG_DEBUG
|
||||
debug-level message
|
||||
.SH HISTORY
|
||||
A
|
||||
.B syslog
|
||||
function call appeared in BSD 4.2.
|
||||
.SH SEE ALSO
|
||||
.Xr logger 1 ,
|
||||
.Xr syslog.conf 5 ,
|
||||
.Xr syslogd 8 .
|
|
@ -1,30 +0,0 @@
|
|||
.\" @(#)system.3 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH SYSTEM 3 "May 15, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
system \- issue a shell command
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdlib.h>
|
||||
|
||||
int system(const char *\fIstring\fP)
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B System
|
||||
causes the
|
||||
.I string
|
||||
to be given to
|
||||
.BR sh (1)
|
||||
as input as if the string had been typed as a command
|
||||
at a terminal.
|
||||
The current process waits until the shell has
|
||||
completed, then returns the exit status of the shell.
|
||||
.SH "SEE ALSO"
|
||||
.BR sh (1),
|
||||
.BR popen (3),
|
||||
.BR execve (2),
|
||||
.BR wait (2).
|
||||
.SH DIAGNOSTICS
|
||||
Exit status 127 indicates the shell couldn't be executed.
|
|
@ -1,167 +0,0 @@
|
|||
.\" Copyright (c) 1980 Regents of the University of California.
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.\" @(#)termcap.3x 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH TERMCAP 3 "May 15, 1985"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
termcap, tgetent, tgetnum, tgetflag, tgetstr, tgoto, tputs \- terminal independent operation routines
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <termcap.h>
|
||||
|
||||
int tgetent(char *\fIbp\fP, char *\fIname\fP)
|
||||
int tgetflag(char *\fIid\fP)
|
||||
int tgetnum(char *\fIid\fP)
|
||||
char *tgetstr(char *\fIid\fP, char **\fIarea\fP)
|
||||
char *tgoto(char *\fIcm\fP, int \fIdestcol\fP, int \fIdestline\fP)
|
||||
int tputs(char *\fIcp\fP, int \fIaffcnt\fP, void (*\fIoutc\fP)(int))
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These functions extract and use capabilities from the terminal capability data
|
||||
base
|
||||
.BR termcap (5).
|
||||
These are low level routines;
|
||||
see
|
||||
.BR curses (3)
|
||||
for a higher level package.
|
||||
.PP
|
||||
.B Tgetent
|
||||
extracts the entry for terminal
|
||||
.I name
|
||||
into the buffer at
|
||||
.IR bp .
|
||||
.I Bp
|
||||
should be a character buffer of size
|
||||
1024 and must be retained through all subsequent calls
|
||||
to
|
||||
.BR tgetnum ,
|
||||
.BR tgetflag ,
|
||||
and
|
||||
.BR tgetstr .
|
||||
.B Tgetent
|
||||
returns \-1 if it cannot find a termcap
|
||||
file, 0 if the terminal name given does not have an entry,
|
||||
and 1 if all goes well.
|
||||
.PP
|
||||
.B Tgetent
|
||||
uses the following recipe to find the termcap file and entry
|
||||
.IR name :
|
||||
.PP
|
||||
.in +5n
|
||||
if $TERMCAP is itself a termcap entry for
|
||||
.I name
|
||||
.br
|
||||
then
|
||||
.in +5n
|
||||
use $TERMCAP
|
||||
.in -5n
|
||||
elif $TERMCAP names a file
|
||||
.br
|
||||
then
|
||||
.in +5n
|
||||
use entry
|
||||
.I name
|
||||
found in that file
|
||||
.in -5n
|
||||
elif this is Minix-vmd
|
||||
.br
|
||||
then
|
||||
.in +5n
|
||||
if $TERMPATH is defined
|
||||
.br
|
||||
then
|
||||
.in +5n
|
||||
search the termcap files named in $TERMPATH for the first occurance of a
|
||||
.I name
|
||||
entry and use that entry
|
||||
.in -5n
|
||||
else
|
||||
.in +5n
|
||||
the path
|
||||
.B $HOME/.termcap:/etc/termcap:/usr/etc/termcap"
|
||||
is searched for entry
|
||||
.I name
|
||||
.in -5n
|
||||
fi
|
||||
.in -5n
|
||||
fi
|
||||
.in -5n
|
||||
.RE
|
||||
.PP
|
||||
.B Tgetnum
|
||||
gets the numeric value of capability
|
||||
.IR id ,
|
||||
returning \-1 if is not given for the terminal.
|
||||
.B Tgetflag
|
||||
returns 1 if the specified capability is present in
|
||||
the terminal's entry, 0 if it is not.
|
||||
.B Tgetstr
|
||||
returns the string value of the capability
|
||||
.IR id ,
|
||||
places it in the buffer at
|
||||
.IR area ,
|
||||
and advances the
|
||||
.I area
|
||||
pointer.
|
||||
It decodes the abbreviations for this field described in
|
||||
.BR termcap (5),
|
||||
except for cursor addressing and padding information.
|
||||
.B Tgetstr
|
||||
returns NULL if the capability was not found.
|
||||
.PP
|
||||
.B Tgoto
|
||||
returns a cursor addressing string decoded from
|
||||
.I cm
|
||||
to go to column
|
||||
.I destcol
|
||||
in line
|
||||
.IR destline .
|
||||
It uses the external variables
|
||||
.B UP
|
||||
(from the \fBup\fR capability)
|
||||
and
|
||||
.B BC
|
||||
(if \fBbc\fR is given rather than \fBbs\fR)
|
||||
if necessary to avoid placing \fB\en\fR, \fB^D\fR or \fB^@\fR in
|
||||
the returned string.
|
||||
(Programs which call tgoto should be sure to turn off the XTABS bit(s),
|
||||
since
|
||||
.B tgoto
|
||||
may now output a tab.
|
||||
Note that programs using termcap should in general turn off XTABS
|
||||
anyway since some terminals use CTRL-I for other functions,
|
||||
such as nondestructive space.)
|
||||
If a \fB%\fR sequence is given which is not understood, then
|
||||
.B tgoto
|
||||
returns \*(lqOOPS\*(rq.
|
||||
.PP
|
||||
.B Tputs
|
||||
decodes the leading padding information of the string
|
||||
.IR cp ;
|
||||
.I affcnt
|
||||
gives the number of lines affected by the operation, or 1 if this is
|
||||
not applicable,
|
||||
.I outc
|
||||
is a routine which is called with each character in turn.
|
||||
The external variable
|
||||
.B ospeed
|
||||
should contain the output speed of the terminal as encoded by
|
||||
.BR stty (3).
|
||||
The external variable
|
||||
.B PC
|
||||
should contain a pad character to be used (from the \fBpc\fR capability)
|
||||
if a null (\fB^@\fR) is inappropriate.
|
||||
.SH SEE ALSO
|
||||
.BR curses (3),
|
||||
.BR termcap (5).
|
||||
.SH AUTHOR
|
||||
William Joy
|
||||
.SH NOTES
|
||||
The MINIX 3 implementation does not support any of the external variables,
|
||||
only the functions calls. The Minix-vmd termcap does support it all,
|
||||
although noone in his right mind meddles with those variables.
|
|
@ -1,155 +0,0 @@
|
|||
.TH TERMIOS 3
|
||||
.SH NAME
|
||||
termios, tcgetattr, tcsetattr, cfgetispeed, cfgetospeed, cfsetispeed, cfsetospeed, tcsendbreak, tcdrain, tcflush, tcflow \- change terminal attributes
|
||||
.SH SYNOPSIS
|
||||
.ft B
|
||||
.nf
|
||||
#include <termios.h>
|
||||
|
||||
int tcgetattr(int \fIfd\fP, struct termios *\fItp\fP)
|
||||
int tcsetattr(int \fIfd\fP, int \fIaction\fP, const struct termios *\fItp\fP)
|
||||
|
||||
speed_t cfgetispeed(const struct termios *\fItp\fP)
|
||||
speed_t cfgetospeed(const struct termios *\fItp\fP)
|
||||
int cfsetispeed(struct termios *\fItp\fP, speed_t \fIspeed\fP)
|
||||
int cfsetospeed(struct termios *\fItp\fP, speed_t \fIspeed\fP)
|
||||
|
||||
int tcsendbreak(int \fIfd\fP, int \fIduration\fP)
|
||||
int tcdrain(int \fIfd\fP)
|
||||
int tcflush(int \fIfd\fP, int \fIqueue_selector\fP)
|
||||
int tcflow(int \fIfd\fP, int \fIaction\fP)
|
||||
.fi
|
||||
.ft P
|
||||
.SH DESCRIPTION
|
||||
.de SP
|
||||
.if t .sp 0.4
|
||||
.if n .sp
|
||||
..
|
||||
These are the user functions that modify the tty attributes mentioned in
|
||||
.BR tty (4).
|
||||
In the following,
|
||||
.I fd
|
||||
refers to an open terminal device file,
|
||||
.I tp
|
||||
is the address of a
|
||||
.BR "struct termios" ,
|
||||
and
|
||||
.I speed
|
||||
and values of type
|
||||
.B speed_t
|
||||
are equal to one of the
|
||||
.BR B0 ,
|
||||
.BR B50 ,
|
||||
etc. baud rate symbols. All functions, symbols, and types are declared in
|
||||
.BR <termios.h> .
|
||||
.PP
|
||||
The effects of the tty functions are:
|
||||
.TP
|
||||
.B tcgetattr(\fIfd\fP, \fItp\fP)
|
||||
Get the current settings of the tty attributes.
|
||||
.TP
|
||||
.B tcsetattr(\fIfd\fP, TCSANOW, \fItp\fP)
|
||||
Set the terminal attributes. The change occurs immediately.
|
||||
.TP
|
||||
.B tcsetattr(\fIfd\fP, TCSADRAIN, \fItp\fP)
|
||||
Set the terminal attributes. The change occurs once all the output waiting
|
||||
in the output queues has been transmitted. This should be used when options
|
||||
affecting output are changed.
|
||||
.TP
|
||||
.B tcsetattr(\fIfd\fP, TCSAFLUSH, \fItp\fP)
|
||||
Set the terminal attributes. But first wait until all the output waiting
|
||||
in the output queues has been transmitted. All input waiting in the input
|
||||
queues is then discarded and the change is made. This should be used when
|
||||
switching from canonical to non-canonical mode or vice-versa. (Oddly
|
||||
enough, this is seldom what you want, because it discards typeahead. An
|
||||
editing shell does the Right Thing if it uses
|
||||
.B TCSANOW
|
||||
instead. \s-2POSIX\s+2 may not guarantee good results, but in practice most
|
||||
systems make the canonical input available in raw mode.)
|
||||
.TP
|
||||
.B cfgetispeed(\fItp\fP)
|
||||
Return the input baud rate encoded in the termios structure.
|
||||
.TP
|
||||
.B cfgetospeed(\fItp\fP)
|
||||
Return the output baud rate encoded in the termios structure.
|
||||
.TP
|
||||
.B cfsetispeed(\fItp\fP, \fIspeed\fP)
|
||||
Encode the new input baud rate into the termios structure.
|
||||
.TP
|
||||
.B cfsetospeed(\fItp\fP, \fIspeed\fP)
|
||||
Encode the new output baud rate into the termios structure.
|
||||
.TP
|
||||
.B tcsendbreak(\fIfd\fP, \fIduration\fP)
|
||||
Emit a break condition on a serial line for a time indicated by
|
||||
.IR duration .
|
||||
(Always 0.4 seconds under MINIX 3,
|
||||
.I duration
|
||||
is ignored.)
|
||||
.TP
|
||||
.B tcdrain(\fIfd\fP)
|
||||
Wait until all output waiting in the output queues has been transmitted.
|
||||
.TP
|
||||
.B tcflush(\fIfd\fP, TCIFLUSH)
|
||||
Flush the input queue. (I.e. discard it.)
|
||||
.TP
|
||||
.B tcflush(\fIfd\fP, TCOFLUSH)
|
||||
Flush the output queue.
|
||||
.TP
|
||||
.B tcflush(\fIfd\fP, TCIOFLUSH)
|
||||
Flush the input and output queues.
|
||||
.TP
|
||||
.B tcflow(\fIfd\fP, TCOOFF)
|
||||
Suspend output. (Like the effect of
|
||||
.BR STOP .)
|
||||
.TP
|
||||
.B tcflow(\fIfd\fP, TCOON)
|
||||
Restart output. (Like the effect of
|
||||
.BR START .)
|
||||
.TP
|
||||
.B tcflow(\fIfd\fP, TCIOFF)
|
||||
Transmit a
|
||||
.B STOP
|
||||
character intended to make the remote device stop transmitting data.
|
||||
.TP
|
||||
.B tcflow(\fIfd\fP, TCION)
|
||||
Transmit a
|
||||
.B START
|
||||
character to restart the remote device.
|
||||
.SH "SEE ALSO"
|
||||
.BR stty (1),
|
||||
.BR tty (4).
|
||||
.SH DIAGNOSTICS
|
||||
All functions return 0 unless otherwise specified, and \-1 on error with
|
||||
.B errno
|
||||
set to indicate the type of error. The most notable errors are
|
||||
.B ENOTTY
|
||||
if
|
||||
.I fd
|
||||
does not refer to a terminal device, and
|
||||
.B EINTR
|
||||
if one of the functions waiting for output to drain is interrupted.
|
||||
.SH NOTES
|
||||
It may be interesting to know that the functions operating on the tty are
|
||||
directly translated into the following MINIX 3
|
||||
.B ioctl
|
||||
requests:
|
||||
.BR TCGETS ,
|
||||
.BR TCSETS
|
||||
(now),
|
||||
.BR TCSETSW
|
||||
(drain),
|
||||
.BR TCSETSF ,
|
||||
(flush),
|
||||
.BR TCSBRK ,
|
||||
.BR TCDRAIN ,
|
||||
.BR TCFLSH ,
|
||||
and
|
||||
.BR TCFLOW .
|
||||
You should only use this knowledge when trying to understand the tty driver
|
||||
code, of course.
|
||||
.SH BUGS
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
||||
|
||||
.\"
|
||||
.\" $PchId: termios.3,v 1.2 1996/04/11 06:41:24 philip Exp $
|
|
@ -1,121 +0,0 @@
|
|||
.TH TIME2POSIX 3
|
||||
.SH NAME
|
||||
time2posix, posix2time \- convert seconds since the Epoch
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <sys/types.h>
|
||||
.B #include <time.h>
|
||||
.PP
|
||||
.B time_t time2posix(t)
|
||||
.B time_t t
|
||||
.PP
|
||||
.B time_t posix2time(t)
|
||||
.B time_t t
|
||||
.PP
|
||||
.B cc ... -ltz
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
IEEE Standard 1003.1
|
||||
(POSIX)
|
||||
legislates that a time_t value of
|
||||
536457599 shall correspond to "Wed Dec 31 23:59:59 UTC 1986."
|
||||
This effectively implies that POSIX time_t's cannot include leap
|
||||
seconds and,
|
||||
therefore,
|
||||
that the system time must be adjusted as each leap occurs.
|
||||
.PP
|
||||
If the time package is configured with leap-second support
|
||||
enabled,
|
||||
however,
|
||||
no such adjustment is needed and
|
||||
time_t values continue to increase over leap events
|
||||
(as a true `seconds since...' value).
|
||||
This means that these values will differ from those required by POSIX
|
||||
by the net number of leap seconds inserted since the Epoch.
|
||||
.PP
|
||||
Typically this is not a problem as the type time_t is intended
|
||||
to be
|
||||
(mostly)
|
||||
opaque\(emtime_t values should only be obtained-from and
|
||||
passed-to functions such as
|
||||
.IR time(2) ,
|
||||
.IR localtime(3) ,
|
||||
.IR mktime(3) ,
|
||||
and
|
||||
.IR difftime(3) .
|
||||
However,
|
||||
POSIX gives an arithmetic
|
||||
expression for directly computing a time_t value from a given date/time,
|
||||
and the same relationship is assumed by some
|
||||
(usually older)
|
||||
applications.
|
||||
Any programs creating/dissecting time_t's
|
||||
using such a relationship will typically not handle intervals
|
||||
over leap seconds correctly.
|
||||
.PP
|
||||
The
|
||||
.I time2posix
|
||||
and
|
||||
.I posix2time
|
||||
functions are provided to address this time_t mismatch by converting
|
||||
between local time_t values and their POSIX equivalents.
|
||||
This is done by accounting for the number of time-base changes that
|
||||
would have taken place on a POSIX system as leap seconds were inserted
|
||||
or deleted.
|
||||
These converted values can then be used in lieu of correcting the older
|
||||
applications,
|
||||
or when communicating with POSIX-compliant systems.
|
||||
.PP
|
||||
.I Time2posix
|
||||
is single-valued.
|
||||
That is,
|
||||
every local time_t
|
||||
corresponds to a single POSIX time_t.
|
||||
.I Posix2time
|
||||
is less well-behaved:
|
||||
for a positive leap second hit the result is not unique,
|
||||
and for a negative leap second hit the corresponding
|
||||
POSIX time_t doesn't exist so an adjacent value is returned.
|
||||
Both of these are good indicators of the inferiority of the
|
||||
POSIX representation.
|
||||
.PP
|
||||
The following table summarizes the relationship between a time
|
||||
T and it's conversion to,
|
||||
and back from,
|
||||
the POSIX representation over the leap second inserted at the end of June,
|
||||
1993.
|
||||
.nf
|
||||
.ta \w'93/06/30 'u +\w'23:59:59 'u +\w'A+0 'u +\w'X=time2posix(T) 'u
|
||||
DATE TIME T X=time2posix(T) posix2time(X)
|
||||
93/06/30 23:59:59 A+0 B+0 A+0
|
||||
93/06/30 23:59:60 A+1 B+1 A+1 or A+2
|
||||
93/07/01 00:00:00 A+2 B+1 A+1 or A+2
|
||||
93/07/01 00:00:01 A+3 B+2 A+3
|
||||
|
||||
A leap second deletion would look like...
|
||||
|
||||
DATE TIME T X=time2posix(T) posix2time(X)
|
||||
??/06/30 23:59:58 A+0 B+0 A+0
|
||||
??/07/01 00:00:00 A+1 B+2 A+1
|
||||
??/07/01 00:00:01 A+2 B+3 A+2
|
||||
.sp
|
||||
.ce
|
||||
[Note: posix2time(B+1) => A+0 or A+1]
|
||||
.fi
|
||||
.PP
|
||||
If leap-second support is not enabled,
|
||||
local time_t's and
|
||||
POSIX time_t's are equivalent,
|
||||
and both
|
||||
.I time2posix
|
||||
and
|
||||
.I posix2time
|
||||
degenerate to the identity function.
|
||||
.SH SEE ALSO
|
||||
difftime(3),
|
||||
localtime(3),
|
||||
mktime(3),
|
||||
time(2)
|
||||
.\" @(#)time2posix.3 7.8
|
||||
.\" This file is in the public domain, so clarified as of
|
||||
.\" 1996-06-05 by Arthur David Olson.
|
|
@ -1,28 +0,0 @@
|
|||
.TH TTYNAME 3
|
||||
.SH NAME
|
||||
ttyname \- file descriptor to terminal device name
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#define _POSIX_SOURCE 1
|
||||
#include <unistd.h>
|
||||
|
||||
char *ttyname(int \fIfd\fP)
|
||||
.ft P
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Ttyname
|
||||
searches through the
|
||||
.B /dev
|
||||
directory for the terminal device file that is associated with file
|
||||
descriptor
|
||||
.IR fd .
|
||||
It returns the full path name of the terminal file if found, NULL is
|
||||
returned otherwise.
|
||||
.SH "SEE ALSO"
|
||||
.BR ttyslot (3).
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
||||
|
||||
.\"
|
||||
.\" $PchId: ttyname.3,v 1.2 1996/04/11 06:42:17 philip Exp $
|
|
@ -1,56 +0,0 @@
|
|||
.TH TTYSLOT 3
|
||||
.SH NAME
|
||||
ttyslot, fttyslot \- utmp slot number
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#define _MINIX_SOURCE 1
|
||||
#include <unistd.h>
|
||||
|
||||
int ttyslot(void)
|
||||
int fttyslot(int \fIfd\fP)
|
||||
.fi
|
||||
.ft P
|
||||
.SH DESCRIPTION
|
||||
.B Ttyslot()
|
||||
returns the index of the login terminal in the
|
||||
.B utmp
|
||||
file. It tries
|
||||
.B fttyslot()
|
||||
on file descriptors
|
||||
.BR 0,
|
||||
.BR 1,
|
||||
and
|
||||
.BR 2
|
||||
to find the index.
|
||||
.PP
|
||||
.B Fttyslot()
|
||||
returns the utmp index of the terminal associated with file descriptor
|
||||
.IR fd .
|
||||
First it tries to map
|
||||
.I fd
|
||||
to a terminal name with
|
||||
.BR ttyname (3),
|
||||
then it searches the
|
||||
.BR ttytab (5)
|
||||
database with the
|
||||
.BR getttyent (3)
|
||||
function for this terminal. This means that the utmp slot number is the
|
||||
same as the ttytab entry number counting from 1. The value 0 is returned if
|
||||
no slot number can be found for a file descriptor.
|
||||
.SH "SEE ALSO"
|
||||
.BR ttyname (3),
|
||||
.BR getttyent (3),
|
||||
.BR utmp (5),
|
||||
.BR ttytab (5),
|
||||
.BR init (8).
|
||||
.SH NOTES
|
||||
Since 0 is used as an error return this means that the first entry in the
|
||||
utmp file is not used.
|
||||
.PP
|
||||
.B Ttyslot()
|
||||
is often found in a UNIX implementation,
|
||||
.B fttyslot()
|
||||
is MINIX 3 specific.
|
||||
.SH AUTHOR
|
||||
Kees J. Bot (kjb@cs.vu.nl)
|
|
@ -1,41 +0,0 @@
|
|||
.\" @(#)ungetc.3s 6.1 (Berkeley) 5/15/85
|
||||
.\"
|
||||
.TH UNGETC 3 "May 15, 1985"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
ungetc \- push character back into input stream
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
|
||||
int ungetc(int \fIc\fP, FILE *\fIstream\fP)
|
||||
.ft R
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.B Ungetc
|
||||
pushes the character
|
||||
.I c
|
||||
back on an input stream. That character will be returned by the next
|
||||
.B getc
|
||||
call on that stream.
|
||||
.B Ungetc
|
||||
returns
|
||||
.IR c .
|
||||
.PP
|
||||
One character of pushback is guaranteed provided
|
||||
something has been read from the stream and the stream is actually buffered.
|
||||
Attempts to push EOF are rejected.
|
||||
.PP
|
||||
.BR Fseek (3)
|
||||
erases all memory of pushed back characters.
|
||||
.SH "SEE ALSO"
|
||||
.BR getc (3),
|
||||
.BR setbuf (3),
|
||||
.BR fseek (3).
|
||||
.SH DIAGNOSTICS
|
||||
.B Ungetc
|
||||
returns
|
||||
.SM
|
||||
.B EOF
|
||||
if it can't push a character back.
|
|
@ -1,7 +1,7 @@
|
|||
MAN= boot.cfg.5 configfile.5 crontab.5 dhcp.conf.5 dir.5 ethers.5 \
|
||||
fstab.5 hosts.5 httpd.conf.5 http_status.5 keymap.5 \
|
||||
passwd.5 resolv.conf.5 resolver.5 rhosts.5 statvfs.5 serv.access.5 \
|
||||
system.conf.5 syslog.conf.5 termcap.5 ttytab.5 TZ.5 tzfile.5 utmp.5 \
|
||||
system.conf.5 syslog.conf.5 termcap.5 ttytab.5 TZ.5 utmp.5 \
|
||||
whatis.5 pkg_install.conf.5 pkg_summary.5
|
||||
|
||||
MLINKS += passwd.5 group.5
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
.TH TZFILE 5
|
||||
.SH NAME
|
||||
tzfile \- time zone information
|
||||
.SH SYNOPSIS
|
||||
.B
|
||||
#include <tzfile.h>
|
||||
.SH DESCRIPTION
|
||||
The time zone information files used by
|
||||
.IR tzset (3)
|
||||
begin with the magic characters "TZif" to identify then as
|
||||
time zone information files,
|
||||
followed by sixteen bytes reserved for future use,
|
||||
followed by six four-byte values of type
|
||||
.BR long ,
|
||||
written in a ``standard'' byte order
|
||||
(the high-order byte of the value is written first).
|
||||
These values are,
|
||||
in order:
|
||||
.TP
|
||||
.I tzh_ttisgmtcnt
|
||||
The number of UTC/local indicators stored in the file.
|
||||
.TP
|
||||
.I tzh_ttisstdcnt
|
||||
The number of standard/wall indicators stored in the file.
|
||||
.TP
|
||||
.I tzh_leapcnt
|
||||
The number of leap seconds for which data is stored in the file.
|
||||
.TP
|
||||
.I tzh_timecnt
|
||||
The number of "transition times" for which data is stored
|
||||
in the file.
|
||||
.TP
|
||||
.I tzh_typecnt
|
||||
The number of "local time types" for which data is stored
|
||||
in the file (must not be zero).
|
||||
.TP
|
||||
.I tzh_charcnt
|
||||
The number of characters of "time zone abbreviation strings"
|
||||
stored in the file.
|
||||
.PP
|
||||
The above header is followed by
|
||||
.I tzh_timecnt
|
||||
four-byte values of type
|
||||
.BR long ,
|
||||
sorted in ascending order.
|
||||
These values are written in ``standard'' byte order.
|
||||
Each is used as a transition time (as returned by
|
||||
.IR time (2))
|
||||
at which the rules for computing local time change.
|
||||
Next come
|
||||
.I tzh_timecnt
|
||||
one-byte values of type
|
||||
.BR "unsigned char" ;
|
||||
each one tells which of the different types of ``local time'' types
|
||||
described in the file is associated with the same-indexed transition time.
|
||||
These values serve as indices into an array of
|
||||
.I ttinfo
|
||||
structures that appears next in the file;
|
||||
these structures are defined as follows:
|
||||
.in +.5i
|
||||
.sp
|
||||
.nf
|
||||
.ta .5i +\w'unsigned int\0\0'u
|
||||
struct ttinfo {
|
||||
long tt_gmtoff;
|
||||
int tt_isdst;
|
||||
unsigned int tt_abbrind;
|
||||
};
|
||||
.in -.5i
|
||||
.fi
|
||||
.sp
|
||||
Each structure is written as a four-byte value for
|
||||
.I tt_gmtoff
|
||||
of type
|
||||
.BR long ,
|
||||
in a standard byte order, followed by a one-byte value for
|
||||
.I tt_isdst
|
||||
and a one-byte value for
|
||||
.IR tt_abbrind .
|
||||
In each structure,
|
||||
.I tt_gmtoff
|
||||
gives the number of seconds to be added to UTC,
|
||||
.I tt_isdst
|
||||
tells whether
|
||||
.I tm_isdst
|
||||
should be set by
|
||||
.I localtime (3)
|
||||
and
|
||||
.I tt_abbrind
|
||||
serves as an index into the array of time zone abbreviation characters
|
||||
that follow the
|
||||
.I ttinfo
|
||||
structure(s) in the file.
|
||||
.PP
|
||||
Then there are
|
||||
.I tzh_leapcnt
|
||||
pairs of four-byte values, written in standard byte order;
|
||||
the first value of each pair gives the time
|
||||
(as returned by
|
||||
.IR time(2))
|
||||
at which a leap second occurs;
|
||||
the second gives the
|
||||
.I total
|
||||
number of leap seconds to be applied after the given time.
|
||||
The pairs of values are sorted in ascending order by time.
|
||||
.PP
|
||||
Then there are
|
||||
.I tzh_ttisstdcnt
|
||||
standard/wall indicators, each stored as a one-byte value;
|
||||
they tell whether the transition times associated with local time types
|
||||
were specified as standard time or wall clock time,
|
||||
and are used when a time zone file is used in handling POSIX-style
|
||||
time zone environment variables.
|
||||
.PP
|
||||
Finally there are
|
||||
.I tzh_ttisgmtcnt
|
||||
UTC/local indicators, each stored as a one-byte value;
|
||||
they tell whether the transition times associated with local time types
|
||||
were specified as UTC or local time,
|
||||
and are used when a time zone file is used in handling POSIX-style
|
||||
time zone environment variables.
|
||||
.PP
|
||||
.I Localtime
|
||||
uses the first standard-time
|
||||
.I ttinfo
|
||||
structure in the file
|
||||
(or simply the first
|
||||
.I ttinfo
|
||||
structure in the absence of a standard-time structure)
|
||||
if either
|
||||
.I tzh_timecnt
|
||||
is zero or the time argument is less than the first transition time recorded
|
||||
in the file.
|
||||
.SH SEE ALSO
|
||||
newctime(3)
|
||||
.\" @(#)tzfile.5 7.12
|
||||
.\" This file is in the public domain, so clarified as of
|
||||
.\" 1996-06-05 by Arthur David Olson.
|
|
@ -4,7 +4,6 @@ MAN= ascii.7 environ.7 hier.7 man.7 \
|
|||
\
|
||||
\
|
||||
\
|
||||
re_format.7 \
|
||||
pkgsrc.7
|
||||
|
||||
.include <bsd.man.mk>
|
||||
|
|
|
@ -1,269 +0,0 @@
|
|||
.\" Copyright (c) 1992, 1993, 1994 Henry Spencer.
|
||||
.\" Copyright (c) 1992, 1993, 1994
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" This code is derived from software contributed to Berkeley by
|
||||
.\" Henry Spencer.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)re_format.7 8.3 (Berkeley) 3/20/94
|
||||
.\"
|
||||
.TH RE_FORMAT 7 "March 20, 1994"
|
||||
.SH NAME
|
||||
re_format \- POSIX 1003.2 regular expressions
|
||||
.SH DESCRIPTION
|
||||
Regular expressions (``RE''s),
|
||||
as defined in POSIX 1003.2, come in two forms:
|
||||
modern REs (roughly those of
|
||||
.BR egrep ;
|
||||
1003.2 calls these ``extended'' REs)
|
||||
and obsolete REs (roughly those of
|
||||
.BR ed ;
|
||||
1003.2 ``basic'' REs).
|
||||
Obsolete REs mostly exist for backward compatibility in some old programs;
|
||||
they will be discussed at the end.
|
||||
1003.2 leaves some aspects of RE syntax and semantics open;
|
||||
`\(dg' marks decisions on these aspects that
|
||||
may not be fully portable to other 1003.2 implementations.
|
||||
.PP
|
||||
A (modern) RE is one\(dg or more non-empty\(dg \fIbranches\fR,
|
||||
separated by `|'.
|
||||
It matches anything that matches one of the branches.
|
||||
.PP
|
||||
A branch is one\(dg or more \fIpieces\fR, concatenated.
|
||||
It matches a match for the first, followed by a match for the second, etc.
|
||||
.PP
|
||||
A piece is an \fIatom\fR possibly followed
|
||||
by a single\(dg `*', `+', `?', or \fIbound\fR.
|
||||
An atom followed by `*' matches a sequence of 0 or more matches of the atom.
|
||||
An atom followed by `+' matches a sequence of 1 or more matches of the atom.
|
||||
An atom followed by `?' matches a sequence of 0 or 1 matches of the atom.
|
||||
.PP
|
||||
A \fIbound\fR is `{' followed by an unsigned decimal integer,
|
||||
possibly followed by `,'
|
||||
possibly followed by another unsigned decimal integer,
|
||||
always followed by `}'.
|
||||
The integers must lie between 0 and RE_DUP_MAX (255\(dg) inclusive,
|
||||
and if there are two of them, the first may not exceed the second.
|
||||
An atom followed by a bound containing one integer \fIi\fR
|
||||
and no comma matches
|
||||
a sequence of exactly \fIi\fR matches of the atom.
|
||||
An atom followed by a bound
|
||||
containing one integer \fIi\fR and a comma matches
|
||||
a sequence of \fIi\fR or more matches of the atom.
|
||||
An atom followed by a bound
|
||||
containing two integers \fIi\fR and \fIj\fR matches
|
||||
a sequence of \fIi\fR through \fIj\fR (inclusive) matches of the atom.
|
||||
.PP
|
||||
An atom is a regular expression enclosed in `()' (matching a match for the
|
||||
regular expression),
|
||||
an empty set of `()' (matching the null string)\(dg,
|
||||
a \fIbracket expression\fR (see below), `.'
|
||||
(matching any single character), `^' (matching the null string at the
|
||||
beginning of a line), `$' (matching the null string at the
|
||||
end of a line), a `\e' followed by one of the characters
|
||||
`^.[$()|*+?{\e'
|
||||
(matching that character taken as an ordinary character),
|
||||
a `\e' followed by any other character\(dg
|
||||
(matching that character taken as an ordinary character,
|
||||
as if the `\e' had not been present\(dg),
|
||||
or a single character with no other significance (matching that character).
|
||||
A `{' followed by a character other than a digit is an ordinary
|
||||
character, not the beginning of a bound\(dg.
|
||||
It is illegal to end an RE with `\e'.
|
||||
.PP
|
||||
A \fIbracket expression\fR is a list of characters enclosed in `[]'.
|
||||
It normally matches any single character from the list (but see below).
|
||||
If the list begins with `^',
|
||||
it matches any single character
|
||||
(but see below) \fInot\fR from the rest of the list.
|
||||
If two characters in the list are separated by `\-', this is shorthand
|
||||
for the full \fIrange\fR of characters between those two (inclusive) in the
|
||||
collating sequence,
|
||||
e.g. `[0-9]' in ASCII matches any decimal digit.
|
||||
It is illegal\(dg for two ranges to share an
|
||||
endpoint, e.g. `a-c-e'.
|
||||
Ranges are very collating-sequence-dependent,
|
||||
and portable programs should avoid relying on them.
|
||||
.PP
|
||||
To include a literal `]' in the list, make it the first character
|
||||
(following a possible `^').
|
||||
To include a literal `\-', make it the first or last character,
|
||||
or the second endpoint of a range.
|
||||
To use a literal `\-' as the first endpoint of a range,
|
||||
enclose it in `[.' and `.]' to make it a collating element (see below).
|
||||
With the exception of these and some combinations using `[' (see next
|
||||
paragraphs), all other special characters, including `\e', lose their
|
||||
special significance within a bracket expression.
|
||||
.PP
|
||||
Within a bracket expression, a collating element (a character,
|
||||
a multi-character sequence that collates as if it were a single character,
|
||||
or a collating-sequence name for either)
|
||||
enclosed in `[.' and `.]' stands for the
|
||||
sequence of characters of that collating element.
|
||||
The sequence is a single element of the bracket expression's list.
|
||||
A bracket expression containing a multi-character collating element
|
||||
can thus match more than one character,
|
||||
e.g. if the collating sequence includes a `ch' collating element,
|
||||
then the RE `[[.ch.]]*c' matches the first five characters
|
||||
of `chchcc'.
|
||||
.PP
|
||||
Within a bracket expression, a collating element enclosed in `[=' and
|
||||
`=]' is an equivalence class, standing for the sequences of characters
|
||||
of all collating elements equivalent to that one, including itself.
|
||||
(If there are no other equivalent collating elements,
|
||||
the treatment is as if the enclosing delimiters were `[.' and `.]'.)
|
||||
For example, if o and \o'o^' are the members of an equivalence class,
|
||||
then `[[=o=]]', `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous.
|
||||
An equivalence class may not\(dg be an endpoint
|
||||
of a range.
|
||||
.PP
|
||||
Within a bracket expression, the name of a \fIcharacter class\fR enclosed
|
||||
in `[:' and `:]' stands for the list of all characters belonging to that
|
||||
class.
|
||||
Standard character class names are:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
.ta 3c 6c 9c
|
||||
alnum digit punct
|
||||
alpha graph space
|
||||
blank lower upper
|
||||
cntrl print xdigit
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
These stand for the character classes defined in
|
||||
.BR ctype (3).
|
||||
A locale may provide others.
|
||||
A character class may not be used as an endpoint of a range.
|
||||
.PP
|
||||
There are two special cases\(dg of bracket expressions:
|
||||
the bracket expressions `[[:<:]]' and `[[:>:]]' match the null string at
|
||||
the beginning and end of a word respectively.
|
||||
A word is defined as a sequence of
|
||||
word characters
|
||||
which is neither preceded nor followed by
|
||||
word characters.
|
||||
A word character is an
|
||||
.B alnum
|
||||
character (as defined by
|
||||
.BR ctype (3))
|
||||
or an underscore.
|
||||
This is an extension,
|
||||
compatible with but not specified by POSIX 1003.2,
|
||||
and should be used with
|
||||
caution in software intended to be portable to other systems.
|
||||
.PP
|
||||
In the event that an RE could match more than one substring of a given
|
||||
string,
|
||||
the RE matches the one starting earliest in the string.
|
||||
If the RE could match more than one substring starting at that point,
|
||||
it matches the longest.
|
||||
Subexpressions also match the longest possible substrings, subject to
|
||||
the constraint that the whole match be as long as possible,
|
||||
with subexpressions starting earlier in the RE taking priority over
|
||||
ones starting later.
|
||||
Note that higher-level subexpressions thus take priority over
|
||||
their lower-level component subexpressions.
|
||||
.PP
|
||||
Match lengths are measured in characters, not collating elements.
|
||||
A null string is considered longer than no match at all.
|
||||
For example,
|
||||
`bb*' matches the three middle characters of `abbbc',
|
||||
`(wee|week)(knights|nights)' matches all ten characters of `weeknights',
|
||||
when `(.*).*' is matched against `abc' the parenthesized subexpression
|
||||
matches all three characters, and
|
||||
when `(a*)*' is matched against `bc' both the whole RE and the parenthesized
|
||||
subexpression match the null string.
|
||||
.PP
|
||||
If case-independent matching is specified,
|
||||
the effect is much as if all case distinctions had vanished from the
|
||||
alphabet.
|
||||
When an alphabetic that exists in multiple cases appears as an
|
||||
ordinary character outside a bracket expression, it is effectively
|
||||
transformed into a bracket expression containing both cases,
|
||||
e.g. `x' becomes `[xX]'.
|
||||
When it appears inside a bracket expression, all case counterparts
|
||||
of it are added to the bracket expression, so that (e.g.) `[x]'
|
||||
becomes `[xX]' and `[^x]' becomes `[^xX]'.
|
||||
.PP
|
||||
No particular limit is imposed on the length of REs\(dg.
|
||||
Programs intended to be portable should not employ REs longer
|
||||
than 256 bytes,
|
||||
as an implementation can refuse to accept such REs and remain
|
||||
POSIX-compliant.
|
||||
.PP
|
||||
Obsolete (``basic'') regular expressions differ in several respects.
|
||||
`|', `+', and `?' are ordinary characters and there is no equivalent
|
||||
for their functionality.
|
||||
The delimiters for bounds are `\e{' and `\e}',
|
||||
with `{' and `}' by themselves ordinary characters.
|
||||
The parentheses for nested subexpressions are `\e(' and `\e)',
|
||||
with `(' and `)' by themselves ordinary characters.
|
||||
`^' is an ordinary character except at the beginning of the
|
||||
RE or\(dg the beginning of a parenthesized subexpression,
|
||||
`$' is an ordinary character except at the end of the
|
||||
RE or\(dg the end of a parenthesized subexpression,
|
||||
and `*' is an ordinary character if it appears at the beginning of the
|
||||
RE or the beginning of a parenthesized subexpression
|
||||
(after a possible leading `^').
|
||||
Finally, there is one new type of atom, a \fIback reference\fR:
|
||||
`\e' followed by a non-zero decimal digit \fId\fR
|
||||
matches the same sequence of characters
|
||||
matched by the \fId\fRth parenthesized subexpression
|
||||
(numbering subexpressions by the positions of their opening parentheses,
|
||||
left to right),
|
||||
so that (e.g.) `\e([bc]\e)\e1' matches `bb' or `cc' but not `bc'.
|
||||
.SH SEE ALSO
|
||||
regex(3)
|
||||
.PP
|
||||
POSIX 1003.2, section 2.8 (Regular Expression Notation).
|
||||
.SH BUGS
|
||||
Having two kinds of REs is a botch.
|
||||
.PP
|
||||
The current 1003.2 spec says that `)' is an ordinary character in
|
||||
the absence of an unmatched `(';
|
||||
this was an unintentional result of a wording error,
|
||||
and change is likely.
|
||||
Avoid relying on it.
|
||||
.PP
|
||||
Back references are a dreadful botch,
|
||||
posing major problems for efficient implementations.
|
||||
They are also somewhat vaguely defined
|
||||
(does
|
||||
`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?).
|
||||
Avoid using them.
|
||||
.PP
|
||||
1003.2's specification of case-independent matching is vague.
|
||||
The ``one case implies all cases'' definition given above
|
||||
is current consensus among implementors as to the right interpretation.
|
||||
.PP
|
||||
The syntax for word boundaries is incredibly ugly.
|
|
@ -2,24 +2,57 @@
|
|||
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
|
||||
|
||||
.include <bsd.init.mk>
|
||||
|
||||
#.include <bsd.shlib.mk>
|
||||
#.include <bsd.gcc.mk>
|
||||
# Pull in <bsd.sys.mk> here so we can override its .c.o rule
|
||||
.include <bsd.sys.mk>
|
||||
|
||||
LIBISMODULE?= no
|
||||
LIBISPRIVATE?= no
|
||||
LIBISCXX?= no
|
||||
|
||||
##### Minix rule to make the "install" target depend on
|
||||
##### "all" and "depend" targets
|
||||
realinstall: realall
|
||||
realall: depend
|
||||
# Some tough Minix defaults
|
||||
MKPROFILE:= no
|
||||
MKSTATICLIB:= yes
|
||||
MKPIC:= no
|
||||
MKLINT:= no
|
||||
|
||||
_LIB_PREFIX= lib
|
||||
|
||||
.if ${LIBISMODULE} != "no"
|
||||
_LIB_PREFIX= # empty
|
||||
MKDEBUGLIB:= no
|
||||
MKLINT:= no
|
||||
MKPICINSTALL:= no
|
||||
MKPROFILE:= no
|
||||
MKSTATICLIB:= no
|
||||
.endif
|
||||
|
||||
.if ${LIBISPRIVATE} != "no"
|
||||
MKDEBUGLIB:= no
|
||||
MKLINT:= no
|
||||
MKPICINSTALL:= no
|
||||
. if defined(NOSTATICLIB) && ${MKPICLIB} != "no"
|
||||
MKSTATICLIB:= no
|
||||
. else
|
||||
MKPIC:= no
|
||||
. endif
|
||||
MKPROFILE:= no
|
||||
.endif
|
||||
|
||||
##### Basic targets
|
||||
.PHONY: libinstall
|
||||
realinstall: libinstall
|
||||
.PHONY: checkver libinstall
|
||||
realinstall: checkver libinstall
|
||||
clean: cleanlib
|
||||
|
||||
|
||||
##### LIB specific flags.
|
||||
# XXX: This is needed for programs that link with .a libraries
|
||||
# Perhaps a more correct solution is to always generate _pic.a
|
||||
# files or always have a shared library.
|
||||
.if defined(MKPIE) && (${MKPIE} != "no")
|
||||
CFLAGS+= ${PIE_CFLAGS}
|
||||
AFLAGS+= ${PIE_AFLAGS}
|
||||
.endif
|
||||
COPTS+= ${COPTS.lib${LIB}}
|
||||
CPPFLAGS+= ${CPPFLAGS.lib${LIB}}
|
||||
CXXFLAGS+= ${CXXFLAGS.lib${LIB}}
|
||||
|
@ -43,10 +76,151 @@ DPADD+= ${LIBDO.${_lib}}/lib${_lib}.so
|
|||
##### Build and install rules
|
||||
MKDEP_SUFFIXES?= .o .po .so .go .ln
|
||||
|
||||
# Use purely kernel private headers in rump builds
|
||||
.if !defined(RUMPKERNEL)
|
||||
.if empty(CPPFLAGS:M-nostdinc)
|
||||
CPPFLAGS+= ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include}
|
||||
.endif
|
||||
.if empty(CXXFLAGS:M-nostdinc++)
|
||||
CXXFLAGS+= ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++}
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE}) # {
|
||||
SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
|
||||
SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
|
||||
SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
|
||||
|
||||
DPADD+= ${SHLIB_VERSION_FILE}
|
||||
|
||||
# Check for higher installed library versions.
|
||||
.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
|
||||
exists(${NETBSDSRCDIR}/lib/checkver)
|
||||
checkver:
|
||||
@(cd ${.CURDIR} && \
|
||||
HOST_SH=${HOST_SH:Q} AWK=${TOOL_AWK:Q} \
|
||||
${HOST_SH} ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
|
||||
-d ${DESTDIR}${_LIBSODIR} ${LIB})
|
||||
.endif
|
||||
.endif # }
|
||||
|
||||
.if !target(checkver)
|
||||
checkver:
|
||||
.endif
|
||||
|
||||
print-shlib-major:
|
||||
.if defined(SHLIB_MAJOR) && ${MKPIC} != "no"
|
||||
@echo ${SHLIB_MAJOR}
|
||||
.else
|
||||
@false
|
||||
.endif
|
||||
|
||||
print-shlib-minor:
|
||||
.if defined(SHLIB_MINOR) && ${MKPIC} != "no"
|
||||
@echo ${SHLIB_MINOR}
|
||||
.else
|
||||
@false
|
||||
.endif
|
||||
|
||||
print-shlib-teeny:
|
||||
.if defined(SHLIB_TEENY) && ${MKPIC} != "no"
|
||||
@echo ${SHLIB_TEENY}
|
||||
.else
|
||||
@false
|
||||
.endif
|
||||
|
||||
.if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR) # {
|
||||
.if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
|
||||
.if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
|
||||
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
|
||||
.else
|
||||
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
|
||||
.endif
|
||||
.else
|
||||
SHLIB_FULLVERSION=${SHLIB_MAJOR}
|
||||
.endif
|
||||
.endif # }
|
||||
|
||||
# add additional suffixes not exported.
|
||||
# .po is used for profiling object files.
|
||||
# .so is used for PIC object files.
|
||||
.SUFFIXES: .out .a .ln .so .po .go .o .s .S .c .cc .cpp .cxx .C .m .F .f .r .y .l .cl .p .h
|
||||
.SUFFIXES: .sh .m4 .m
|
||||
|
||||
|
||||
# Set PICFLAGS to cc flags for producing position-independent code,
|
||||
# if not already set. Includes -DPIC, if required.
|
||||
|
||||
# Data-driven table using make variables to control how shared libraries
|
||||
# are built for different platforms and object formats.
|
||||
# OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
|
||||
# SHLIB_SOVERSION: version number to be compiled into a shared library
|
||||
# via -soname. Usualy ${SHLIB_MAJOR} on ELF.
|
||||
# NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
|
||||
# [.${SHLIB_TEENY}]]
|
||||
# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
|
||||
# with ELF, also set shared-lib version for ld.so.
|
||||
# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
|
||||
# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
|
||||
# FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects.
|
||||
# CPPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS}
|
||||
# CPICFLAGS: flags for ${CC} to compile .[cC] files to pic objects.
|
||||
# CSHLIBFLAGS: flags for ${CC} to compile .[cC] files to .so objects.
|
||||
# (usually includes ${CPICFLAGS})
|
||||
# CAPICFLAGS: flags for ${CC} to compiling .[Ss] files
|
||||
# (usually just ${CPPPICFLAGS} ${CPICFLAGS})
|
||||
# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects.
|
||||
|
||||
.if ${MACHINE_ARCH} == "alpha" # {
|
||||
|
||||
FPICFLAGS ?= -fPIC
|
||||
CPICFLAGS ?= -fPIC -DPIC
|
||||
CPPPICFLAGS?= -DPIC
|
||||
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
|
||||
APICFLAGS ?=
|
||||
|
||||
.elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \
|
||||
${OBJECT_FMT} == "ELF" # } {
|
||||
|
||||
# If you use -fPIC you need to define BIGPIC to turn on 32-bit
|
||||
# relocations in asm code
|
||||
FPICFLAGS ?= -fPIC
|
||||
CPICFLAGS ?= -fPIC -DPIC
|
||||
CPPPICFLAGS?= -DPIC -DBIGPIC
|
||||
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
|
||||
APICFLAGS ?= -KPIC
|
||||
|
||||
.else # } {
|
||||
|
||||
# Platform-independent flags for NetBSD shared libraries
|
||||
SHLIB_SOVERSION=${SHLIB_FULLVERSION}
|
||||
SHLIB_SHFLAGS=
|
||||
FPICFLAGS ?= -fPIC
|
||||
CPICFLAGS?= -fPIC -DPIC
|
||||
CPPPICFLAGS?= -DPIC
|
||||
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
|
||||
APICFLAGS?= -k
|
||||
|
||||
.endif # }
|
||||
|
||||
.if ${MKPICLIB} != "no"
|
||||
CSHLIBFLAGS+= ${CPICFLAGS}
|
||||
.endif
|
||||
|
||||
.if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS)
|
||||
MKSHLIBOBJS= yes
|
||||
.else
|
||||
MKSHLIBOBJS= no
|
||||
.endif
|
||||
|
||||
# Platform-independent linker flags for ELF shared libraries
|
||||
.if ${OBJECT_FMT} == "ELF"
|
||||
SHLIB_SOVERSION= ${SHLIB_MAJOR}
|
||||
SHLIB_SHFLAGS= -Wl,-soname,${_LIB_PREFIX}${LIB}.so.${SHLIB_SOVERSION}
|
||||
SHLIB_SHFLAGS+= -Wl,--warn-shared-textrel
|
||||
SHLIB_LDSTARTFILE?= ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGINS}
|
||||
SHLIB_LDENDFILE?= ${_GCC_CRTENDS} ${DESTDIR}/usr/lib/crtn.o
|
||||
.endif
|
||||
|
||||
CFLAGS+= ${COPTS}
|
||||
OBJCFLAGS+= ${OBJCOPTS}
|
||||
|
@ -56,30 +230,154 @@ FFLAGS+= ${FOPTS}
|
|||
.c.o:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
# .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
|
||||
# ${OBJCOPY} -x ${.TARGET}
|
||||
# .endif
|
||||
.if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
|
||||
${OBJCOPY} -x ${.TARGET}
|
||||
.endif
|
||||
|
||||
.c.po:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
|
||||
.if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
|
||||
${OBJCOPY} -X ${.TARGET}
|
||||
.endif
|
||||
|
||||
.c.go:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.c} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
|
||||
|
||||
.c.so:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
|
||||
.if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
|
||||
${OBJCOPY} -x ${.TARGET}
|
||||
.endif
|
||||
|
||||
.cc.o .cpp.o .cxx.o .C.o:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
# .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
|
||||
# ${OBJCOPY} -x ${.TARGET}
|
||||
# .endif
|
||||
.if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
|
||||
${OBJCOPY} -x ${.TARGET}
|
||||
.endif
|
||||
|
||||
.cc.po .cpp.po .cxx.po .C.po:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
|
||||
.if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
|
||||
${OBJCOPY} -X ${.TARGET}
|
||||
.endif
|
||||
|
||||
.cc.go .cpp.go .cxx.go .C.go:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.cc} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
|
||||
|
||||
.cc.so .cpp.so .cxx.so .C.so:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
|
||||
.if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
|
||||
${OBJCOPY} -x ${.TARGET}
|
||||
.endif
|
||||
|
||||
.f.o:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.f} ${.IMPSRC} -o ${.TARGET}
|
||||
.if !defined(FOPTS) || empty(FOPTS:M*-g*)
|
||||
${OBJCOPY} -x ${.TARGET}
|
||||
.endif
|
||||
|
||||
.f.po:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.f} ${PROFFLAGS} -pg ${.IMPSRC} -o ${.TARGET}
|
||||
.if !defined(FOPTS) || empty(FOPTS:M*-g*)
|
||||
${OBJCOPY} -X ${.TARGET}
|
||||
.endif
|
||||
|
||||
.f.go:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.f} ${DEBUGFLAGS} -g ${.IMPSRC} -o ${.TARGET}
|
||||
|
||||
.f.so:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
|
||||
.if !defined(FOPTS) || empty(FOPTS:M*-g*)
|
||||
${OBJCOPY} -x ${.TARGET}
|
||||
.endif
|
||||
|
||||
.f.ln:
|
||||
${_MKTARGET_COMPILE}
|
||||
@echo Skipping lint for Fortran libraries.
|
||||
|
||||
.m.o:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.m} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
.if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
|
||||
${OBJCOPY} -x ${.TARGET}
|
||||
.endif
|
||||
|
||||
.m.po:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.m} ${PROFFLAGS} -pg ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
.if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
|
||||
${OBJCOPY} -X ${.TARGET}
|
||||
.endif
|
||||
|
||||
.m.go:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.m} ${DEBUGFLAGS} -g ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
.if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
|
||||
${OBJCOPY} -X ${.TARGET}
|
||||
.endif
|
||||
|
||||
.m.so:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.m} ${CSHLIBFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
.if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
|
||||
${OBJCOPY} -x ${.TARGET}
|
||||
.endif
|
||||
|
||||
.s.o:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
# ${OBJCOPY} -x ${.TARGET}
|
||||
${OBJCOPY} -x ${.TARGET}
|
||||
|
||||
.S.o:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
# ${OBJCOPY} -x ${.TARGET}
|
||||
${OBJCOPY} -x ${.TARGET}
|
||||
|
||||
.s.po:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
${OBJCOPY} -X ${.TARGET}
|
||||
|
||||
.S.po:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
${OBJCOPY} -X ${.TARGET}
|
||||
|
||||
.s.go:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.s} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
|
||||
.S.go:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.S} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
|
||||
.s.so:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.s} ${CAPICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
${OBJCOPY} -x ${.TARGET}
|
||||
|
||||
.S.so:
|
||||
${_MKTARGET_COMPILE}
|
||||
${COMPILE.S} ${CAPICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
|
||||
${OBJCOPY} -x ${.TARGET}
|
||||
|
||||
.if defined(LIB) # {
|
||||
.if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|
||||
|| ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
|
||||
_LIBS=lib${LIB}.a
|
||||
.else
|
||||
_LIBS=
|
||||
.endif
|
||||
|
||||
OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
|
||||
|
@ -93,9 +391,56 @@ LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
|
|||
libinstall::
|
||||
.endif # ${LIBISPRIVATE} == "no" # {
|
||||
|
||||
ALLOBJS=
|
||||
.if ${MKDEBUGLIB} != "no"
|
||||
_LIBS+=lib${LIB}_g.a
|
||||
GOBJS+=${OBJS:.o=.go}
|
||||
DEBUGFLAGS?=-DDEBUG
|
||||
.endif
|
||||
|
||||
.if ${MKPROFILE} != "no"
|
||||
_LIBS+=lib${LIB}_p.a
|
||||
POBJS+=${OBJS:.o=.po}
|
||||
PROFFLAGS?=-DGPROF -DPROF
|
||||
.endif
|
||||
|
||||
.if ${MKPIC} != "no" # {
|
||||
.if ${MKPICLIB} == "no"
|
||||
.if ${MKSHLIBOBJS} != "no"
|
||||
# make _pic.a, which isn't really pic,
|
||||
# since it's needed for making shared lib.
|
||||
# but don't install it.
|
||||
SOLIB=lib${LIB}_pic.a
|
||||
SOBJS+=${OBJS:.o=.so}
|
||||
.else
|
||||
SOLIB=lib${LIB}.a
|
||||
.endif
|
||||
.else
|
||||
SOLIB=lib${LIB}_pic.a
|
||||
_LIBS+=${SOLIB}
|
||||
SOBJS+=${OBJS:.o=.so}
|
||||
.endif
|
||||
.if defined(SHLIB_FULLVERSION)
|
||||
_LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
|
||||
.endif
|
||||
.endif # }
|
||||
|
||||
.if ${MKLINT} != "no" && !empty(LOBJS)
|
||||
_LIBS+=llib-l${LIB}.ln
|
||||
.endif
|
||||
|
||||
ALLOBJS=
|
||||
.if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|
||||
|| ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
|
||||
ALLOBJS+=${STOBJS}
|
||||
.endif
|
||||
ALLOBJS+=${POBJS} ${SOBJS}
|
||||
.if ${MKLINT} != "no" && !empty(LOBJS)
|
||||
ALLOBJS+=${LOBJS}
|
||||
.endif
|
||||
.else # !defined(LIB) # } {
|
||||
LOBJS=
|
||||
SOBJS=
|
||||
.endif # !defined(LIB) # }
|
||||
|
||||
_YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
|
||||
|
||||
|
@ -105,20 +450,36 @@ realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
|
|||
|
||||
MKARZERO?=no
|
||||
|
||||
#_ARFL=crs
|
||||
_ARFL=cr
|
||||
|
||||
.if ${MKARZERO} == "yes"
|
||||
_ARFL=crsD
|
||||
_ARRANFL=sD
|
||||
_INSTRANLIB=
|
||||
.else
|
||||
_ARFL=crs
|
||||
_ARRANFL=s
|
||||
#_INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
|
||||
.endif
|
||||
|
||||
# If you change this, please consider reflecting the change in
|
||||
# the override in sys/rump/Makefile.rump.
|
||||
.if !target(__archivebuild)
|
||||
__archivebuild: .USE
|
||||
${_MKTARGET_BUILD}
|
||||
rm -f ${.TARGET}
|
||||
# ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
|
||||
${AR} ${_ARFL} ${.TARGET} ${.ALLSRC:M*o}
|
||||
.endif
|
||||
|
||||
.if !target(__archiveinstall)
|
||||
__archiveinstall: .USE
|
||||
${_MKTARGET_INSTALL}
|
||||
${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||
${_INSTRANLIB} ${.ALLSRC} ${.TARGET}
|
||||
.endif
|
||||
|
||||
__archivesymlinkpic: .USE
|
||||
${_MKTARGET_INSTALL}
|
||||
${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
|
||||
|
||||
DPSRCS+= ${_YLSRCS}
|
||||
CLEANFILES+= ${_YLSRCS}
|
||||
|
@ -127,31 +488,271 @@ ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
|
|||
|
||||
lib${LIB}.a:: ${STOBJS} __archivebuild
|
||||
|
||||
lib${LIB}_p.a:: ${POBJS} __archivebuild
|
||||
|
||||
lib${LIB}_pic.a:: ${SOBJS} __archivebuild
|
||||
|
||||
lib${LIB}_g.a:: ${GOBJS} __archivebuild
|
||||
|
||||
|
||||
_LIBLDOPTS=
|
||||
#.if ${SHLIBDIR} != "/usr/lib"
|
||||
#_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \
|
||||
# -R${SHLIBDIR} \
|
||||
# -L${DESTDIR}${SHLIBDIR}
|
||||
#.elif ${SHLIBINSTALLDIR} != "/usr/lib"
|
||||
#_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR}:${DESTDIR}/usr/lib \
|
||||
# -L${DESTDIR}${SHLIBINSTALLDIR}
|
||||
#.endif
|
||||
|
||||
# gcc -shared now adds -lc automatically. For libraries other than libc and
|
||||
# libgcc* we add as a dependency the installed shared libc. For libc and
|
||||
# libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that
|
||||
# -Xl,-nostdlib is not enough because we want to tell the compiler-driver not
|
||||
# to add standard libraries, not the linker.
|
||||
.if !defined(LIB)
|
||||
DPLIBC ?= ${DESTDIR}${LIBC_SO}
|
||||
.else
|
||||
.if ${LIB} != "c" && ${LIB:Mgcc*} == ""
|
||||
DPLIBC ?= ${DESTDIR}${LIBC_SO}
|
||||
.else
|
||||
LDLIBC ?= -nodefaultlibs
|
||||
.if ${LIB} == "c"
|
||||
LDADD+= -lgcc_pic
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${LIBISCXX} != "no"
|
||||
LIBCC:= ${CXX}
|
||||
.else
|
||||
LIBCC:= ${CC}
|
||||
.endif
|
||||
|
||||
lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} ${DPLIBC} \
|
||||
${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
|
||||
${_MKTARGET_BUILD}
|
||||
rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
|
||||
.if defined(DESTDIR)
|
||||
${LIBCC} ${LDLIBC} -Wl,-nostdlib -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \
|
||||
-Wl,-x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
|
||||
-Wl,--whole-archive ${SOLIB} \
|
||||
-Wl,--no-whole-archive ${LDADD} \
|
||||
${_LIBLDOPTS} ${LDFLAGS} \
|
||||
-L${_GCC_LIBGCCDIR}
|
||||
.else
|
||||
${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} \
|
||||
-o ${.TARGET} ${_LIBLDOPTS} \
|
||||
-Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${LDADD}
|
||||
.endif
|
||||
.if ${OBJECT_FMT} == "ELF"
|
||||
# We don't use INSTALL_SYMLINK here because this is just
|
||||
# happening inside the build directory/objdir. XXX Why does
|
||||
# this spend so much effort on libraries that aren't live??? XXX
|
||||
.if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
|
||||
"${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
|
||||
${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
|
||||
mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
|
||||
.endif
|
||||
${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
|
||||
mv -f lib${LIB}.so.tmp lib${LIB}.so
|
||||
.endif
|
||||
.if ${MKSTRIPIDENT} != "no"
|
||||
${OBJCOPY} -R .ident ${.TARGET}
|
||||
.endif
|
||||
|
||||
.if !empty(LOBJS) # {
|
||||
LLIBS?= -lc
|
||||
llib-l${LIB}.ln: ${LOBJS}
|
||||
${_MKTARGET_COMPILE}
|
||||
rm -f llib-l${LIB}.ln
|
||||
.if defined(DESTDIR)
|
||||
${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
|
||||
.else
|
||||
${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
|
||||
.endif
|
||||
.endif # }
|
||||
|
||||
lint: ${LOBJS}
|
||||
.if defined(LOBJS) && !empty(LOBJS)
|
||||
${LINT} ${LINTFLAGS} ${LOBJS}
|
||||
.endif
|
||||
|
||||
cleanlib: .PHONY
|
||||
rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
|
||||
rm -f lib${LIB}.a ${STOBJS}
|
||||
rm -f lib${LIB}_p.a ${POBJS}
|
||||
rm -f lib${LIB}_g.a ${GOBJS}
|
||||
rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
|
||||
rm -f ${STOBJS:=.tmp} ${POBJS:=.tmp} ${SOBJS:=.tmp} ${GOBJS:=.tmp}
|
||||
rm -f llib-l${LIB}.ln ${LOBJS}
|
||||
|
||||
|
||||
.if !target(libinstall) # {
|
||||
# Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
|
||||
libinstall::
|
||||
|
||||
.if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
|
||||
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
|
||||
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
|
||||
${_MKTARGET_INSTALL}
|
||||
${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||
${.ALLSRC} ${.TARGET}
|
||||
|
||||
.if ${MKUPDATE} == "no"
|
||||
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}.a! .MADE
|
||||
.endif
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}.a! lib${LIB}.a __archiveinstall
|
||||
.else
|
||||
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
|
||||
.endif
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${MKPROFILE} != "no"
|
||||
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
|
||||
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
|
||||
|
||||
.if ${MKUPDATE} == "no"
|
||||
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_p.a! .MADE
|
||||
.endif
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_p.a! lib${LIB}_p.a __archiveinstall
|
||||
.else
|
||||
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
|
||||
.endif
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${MKDEBUGLIB} != "no"
|
||||
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_g.a
|
||||
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_g.a
|
||||
|
||||
.if ${MKUPDATE} == "no"
|
||||
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_g.a)
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_g.a! .MADE
|
||||
.endif
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_g.a! lib${LIB}_g.a __archiveinstall
|
||||
.else
|
||||
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_g.a)
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_g.a: .MADE
|
||||
.endif
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_g.a: lib${LIB}_g.a __archiveinstall
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
|
||||
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
|
||||
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
|
||||
|
||||
.if ${MKUPDATE} == "no"
|
||||
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! .MADE
|
||||
.endif
|
||||
.if ${MKPICLIB} == "no"
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}.a __archivesymlinkpic
|
||||
.else
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}_pic.a __archiveinstall
|
||||
.endif
|
||||
.else
|
||||
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
|
||||
.endif
|
||||
.if ${MKPICLIB} == "no"
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}.a __archivesymlinkpic
|
||||
.else
|
||||
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
|
||||
_LIB_SO_TGT= ${DESTDIR}${_LIBSODIR}/${_LIB_PREFIX}${LIB}.so
|
||||
_LIB_SO_TGTLIBDIR= ${DESTDIR}${LIBDIR}/${_LIB_PREFIX}${LIB}.so
|
||||
|
||||
libinstall:: ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}
|
||||
.PRECIOUS: ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}
|
||||
|
||||
.if ${MKUPDATE} == "no"
|
||||
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
|
||||
${_LIB_SO_TGT}.${SHLIB_FULLVERSION}! .MADE
|
||||
.endif
|
||||
${_LIB_SO_TGT}.${SHLIB_FULLVERSION}! lib${LIB}.so.${SHLIB_FULLVERSION}
|
||||
.else
|
||||
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
|
||||
${_LIB_SO_TGT}.${SHLIB_FULLVERSION}: .MADE
|
||||
.endif
|
||||
${_LIB_SO_TGT}.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
|
||||
.endif
|
||||
${_MKTARGET_INSTALL}
|
||||
${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||
${.ALLSRC} ${.TARGET}
|
||||
.if ${_LIBSODIR} != ${LIBDIR}
|
||||
${INSTALL_SYMLINK} -l r \
|
||||
${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \
|
||||
${_LIB_SO_TGTLIBDIR}.${SHLIB_FULLVERSION}
|
||||
.endif
|
||||
.if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
|
||||
/sbin/ldconfig -m ${_LIBSODIR} ${LIBDIR}
|
||||
.endif
|
||||
.if ${OBJECT_FMT} == "ELF"
|
||||
.if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
|
||||
"${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
|
||||
${INSTALL_SYMLINK} \
|
||||
${_LIB_PREFIX}${LIB}.so.${SHLIB_FULLVERSION} \
|
||||
${_LIB_SO_TGT}.${SHLIB_MAJOR}
|
||||
.if ${_LIBSODIR} != ${LIBDIR}
|
||||
${INSTALL_SYMLINK} -l r \
|
||||
${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \
|
||||
${_LIB_SO_TGTLIBDIR}.${SHLIB_MAJOR}
|
||||
.endif
|
||||
.endif
|
||||
.if ${MKLINKLIB} != "no"
|
||||
${INSTALL_SYMLINK} \
|
||||
${_LIB_PREFIX}${LIB}.so.${SHLIB_FULLVERSION} \
|
||||
${_LIB_SO_TGT}
|
||||
.if ${_LIBSODIR} != ${LIBDIR}
|
||||
${INSTALL_SYMLINK} -l r \
|
||||
${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \
|
||||
${_LIB_SO_TGTLIBDIR}
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${MKLINT} != "no" && !empty(LOBJS)
|
||||
libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
|
||||
.PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
|
||||
|
||||
.if ${MKUPDATE} == "no"
|
||||
.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
|
||||
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! .MADE
|
||||
.endif
|
||||
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! llib-l${LIB}.ln
|
||||
.else
|
||||
.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
|
||||
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
|
||||
.endif
|
||||
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
|
||||
.endif
|
||||
${_MKTARGET_INSTALL}
|
||||
${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||
${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
|
||||
.endif
|
||||
.endif # !target(libinstall) # }
|
||||
|
||||
##### Pull in related .mk logic
|
||||
LINKSOWN?= ${LIBOWN}
|
||||
LINKSGRP?= ${LIBGRP}
|
||||
LINKSMODE?= ${LIBMODE}
|
||||
.include <bsd.man.mk>
|
||||
#.include <bsd.nls.mk>
|
||||
.include <bsd.files.mk>
|
||||
.include <bsd.inc.mk>
|
||||
.include <bsd.links.mk>
|
||||
.include <bsd.dep.mk>
|
||||
.include <minix.gcc.mk>
|
||||
|
||||
${TARGETS}: # ensure existence
|
||||
|
|
|
@ -3,44 +3,46 @@
|
|||
|
||||
.include <bsd.init.mk>
|
||||
|
||||
MKCATPAGES := no
|
||||
MKHTML := no
|
||||
|
||||
##### Basic targets
|
||||
.PHONY: maninstall manpages manlinks
|
||||
#.PHONY: catinstall maninstall catpages manpages catlinks manlinks
|
||||
#.PHONY: htmlinstall htmlpages htmllinks
|
||||
.PHONY: catinstall maninstall catpages manpages catlinks manlinks
|
||||
.PHONY: htmlinstall htmlpages htmllinks
|
||||
.if ${MKMANDOC} == "yes"
|
||||
.PHONY: lintmanpages
|
||||
.endif
|
||||
realinstall: ${MANINSTALL}
|
||||
|
||||
##### Default values
|
||||
# .if ${USETOOLS} == "yes"
|
||||
# TMACDEPDIR?= ${TOOLDIR}/share/groff/tmac
|
||||
# .else
|
||||
# TMACDEPDIR?= /usr/share/tmac
|
||||
# .endif
|
||||
.if ${USETOOLS} == "yes"
|
||||
TMACDEPDIR?= ${TOOLDIR}/share/groff/tmac
|
||||
.else
|
||||
TMACDEPDIR?= /usr/share/tmac
|
||||
.endif
|
||||
|
||||
# HTMLDIR?= ${DESTDIR}${MANDIR}
|
||||
# CATDEPS?= ${TMACDEPDIR}/andoc.tmac \
|
||||
# ${TMACDEPDIR}/doc.tmac \
|
||||
# ${TMACDEPDIR}/mdoc/doc-common \
|
||||
# ${TMACDEPDIR}/mdoc/doc-ditroff \
|
||||
# ${TMACDEPDIR}/mdoc/doc-nroff \
|
||||
# ${TMACDEPDIR}/mdoc/doc-syms
|
||||
# HTMLDEPS?= ${TMACDEPDIR}/doc2html.tmac
|
||||
# MANTARGET?= cat
|
||||
HTMLDIR?= ${DESTDIR}${MANDIR}
|
||||
CATDEPS?= ${TMACDEPDIR}/andoc.tmac \
|
||||
${TMACDEPDIR}/doc.tmac \
|
||||
${TMACDEPDIR}/mdoc/doc-common \
|
||||
${TMACDEPDIR}/mdoc/doc-ditroff \
|
||||
${TMACDEPDIR}/mdoc/doc-nroff \
|
||||
${TMACDEPDIR}/mdoc/doc-syms
|
||||
HTMLDEPS?= ${TMACDEPDIR}/doc2html.tmac
|
||||
MANTARGET?= cat
|
||||
|
||||
# MAN?=
|
||||
# MLINKS?=
|
||||
# _MNUMBERS= 1 2 3 4 5 6 7 8 9
|
||||
# .SUFFIXES: ${_MNUMBERS:@N@.$N@}
|
||||
MAN?=
|
||||
MLINKS?=
|
||||
_MNUMBERS= 1 2 3 4 5 6 7 8 9
|
||||
.SUFFIXES: ${_MNUMBERS:@N@.$N@}
|
||||
|
||||
# .if ${MKMANZ} == "no"
|
||||
# MANCOMPRESS?=
|
||||
# MANSUFFIX?=
|
||||
# .else
|
||||
# MANCOMPRESS?= gzip -ncf
|
||||
# MANSUFFIX?= .gz
|
||||
# .endif
|
||||
.if ${MKMANZ} == "no"
|
||||
MANCOMPRESS?=
|
||||
MANSUFFIX?=
|
||||
.else
|
||||
MANCOMPRESS?= gzip -ncf
|
||||
MANSUFFIX?= .gz
|
||||
.endif
|
||||
|
||||
# make MANCOMPRESS a filter, so it can be inserted on an as-needed basis
|
||||
.if !empty(MANCOMPRESS)
|
||||
|
@ -118,140 +120,140 @@ manlinks:: ${_t}
|
|||
.endfor
|
||||
.endif # ${MKMAN} != "no"
|
||||
|
||||
# ##### Build and install rules (plaintext pages)
|
||||
##### Build and install rules (plaintext pages)
|
||||
|
||||
# .if (${MKCATPAGES} != "no") && (${MKMAN} != "no")
|
||||
# catinstall: catpages catlinks
|
||||
# catpages:: # ensure target exists
|
||||
# CATPAGES= ${MAN:C/\.([1-9])$/.cat\1${MANSUFFIX}/}
|
||||
.if (${MKCATPAGES} != "no") && (${MKMAN} != "no")
|
||||
catinstall: catpages catlinks
|
||||
catpages:: # ensure target exists
|
||||
CATPAGES= ${MAN:C/\.([1-9])$/.cat\1${MANSUFFIX}/}
|
||||
|
||||
# realall: ${CATPAGES}
|
||||
# .NOPATH: ${CATPAGES}
|
||||
# .SUFFIXES: ${_MNUMBERS:@N@.cat$N${MANSUFFIX}@}
|
||||
# .MADE: ${CATDEPS}
|
||||
realall: ${CATPAGES}
|
||||
.NOPATH: ${CATPAGES}
|
||||
.SUFFIXES: ${_MNUMBERS:@N@.cat$N${MANSUFFIX}@}
|
||||
.MADE: ${CATDEPS}
|
||||
|
||||
# ${_MNUMBERS:@N@.$N.cat$N${MANSUFFIX}@}: ${CATDEPS} # build rule
|
||||
# ${_MKTARGET_FORMAT}
|
||||
# .if defined(USETBL)
|
||||
# ${TOOL_TBL} ${.IMPSRC} | ${TOOL_ROFF_ASCII} -mandoc ${MANCOMPRESS} \
|
||||
# > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
|
||||
# .elif ${MKMANDOC} == yes && !defined(NOMANDOC)
|
||||
# if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \
|
||||
# ${TOOL_MANDOC_ASCII} ${.IMPSRC} ${MANCOMPRESS} \
|
||||
# > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \
|
||||
# else \
|
||||
# ${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \
|
||||
# > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \
|
||||
# fi
|
||||
# .else
|
||||
# ${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \
|
||||
# > ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
|
||||
# .endif
|
||||
${_MNUMBERS:@N@.$N.cat$N${MANSUFFIX}@}: ${CATDEPS} # build rule
|
||||
${_MKTARGET_FORMAT}
|
||||
.if defined(USETBL)
|
||||
${TOOL_TBL} ${.IMPSRC} | ${TOOL_ROFF_ASCII} -mandoc ${MANCOMPRESS} \
|
||||
> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
|
||||
.elif ${MKMANDOC} == yes && !defined(NOMANDOC)
|
||||
if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \
|
||||
${TOOL_MANDOC_ASCII} ${.IMPSRC} ${MANCOMPRESS} \
|
||||
> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \
|
||||
else \
|
||||
${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \
|
||||
> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}; \
|
||||
fi
|
||||
.else
|
||||
${TOOL_ROFF_ASCII} -mandoc ${.IMPSRC} ${MANCOMPRESS} \
|
||||
> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
|
||||
.endif
|
||||
|
||||
# .for F in ${CATPAGES:S/${MANSUFFIX}$//:O:u}
|
||||
# _F:= ${DESTDIR}${MANDIR}/${F:T:E}${MANSUBDIR}/${F:R}.0${MANSUFFIX}
|
||||
.for F in ${CATPAGES:S/${MANSUFFIX}$//:O:u}
|
||||
_F:= ${DESTDIR}${MANDIR}/${F:T:E}${MANSUBDIR}/${F:R}.0${MANSUFFIX}
|
||||
|
||||
# .if ${MKUPDATE} == "no"
|
||||
# ${_F}! ${F}${MANSUFFIX} __installpage # install rule
|
||||
# .if !defined(BUILD) && !make(all) && !make(${F})
|
||||
# ${_F}! .MADE # no build at install
|
||||
# .endif
|
||||
# .else
|
||||
# ${_F}: ${F}${MANSUFFIX} __installpage # install rule
|
||||
# .if !defined(BUILD) && !make(all) && !make(${F})
|
||||
# ${_F}: .MADE # no build at install
|
||||
# .endif
|
||||
# .endif
|
||||
.if ${MKUPDATE} == "no"
|
||||
${_F}! ${F}${MANSUFFIX} __installpage # install rule
|
||||
.if !defined(BUILD) && !make(all) && !make(${F})
|
||||
${_F}! .MADE # no build at install
|
||||
.endif
|
||||
.else
|
||||
${_F}: ${F}${MANSUFFIX} __installpage # install rule
|
||||
.if !defined(BUILD) && !make(all) && !make(${F})
|
||||
${_F}: .MADE # no build at install
|
||||
.endif
|
||||
.endif
|
||||
|
||||
# catpages:: ${_F}
|
||||
# .PRECIOUS: ${_F} # keep if install fails
|
||||
# .endfor
|
||||
catpages:: ${_F}
|
||||
.PRECIOUS: ${_F} # keep if install fails
|
||||
.endfor
|
||||
|
||||
# catlinks:: # link install
|
||||
catlinks:: # link install
|
||||
|
||||
# .for _src _dst in ${MLINKS}
|
||||
# _l:=${DESTDIR}${MANDIR}/cat${_src:T:E}${MANSUBDIR}/${_src:R}.0${MANSUFFIX}
|
||||
# _t:=${DESTDIR}${MANDIR}/cat${_dst:T:E}${MANSUBDIR}/${_dst:R}.0${MANSUFFIX}
|
||||
.for _src _dst in ${MLINKS}
|
||||
_l:=${DESTDIR}${MANDIR}/cat${_src:T:E}${MANSUBDIR}/${_src:R}.0${MANSUFFIX}
|
||||
_t:=${DESTDIR}${MANDIR}/cat${_dst:T:E}${MANSUBDIR}/${_dst:R}.0${MANSUFFIX}
|
||||
|
||||
# # Handle case conflicts carefully, when _dst occurs
|
||||
# # more than once after case flattening
|
||||
# .if ${MKUPDATE} == "no" || ${MLINKS:tl:M${_dst:tl:Q}:[\#]} > 1
|
||||
# ${_t}! ${_l} __linkinstallpage
|
||||
# .else
|
||||
# ${_t}: ${_l} __linkinstallpage
|
||||
# .endif
|
||||
# Handle case conflicts carefully, when _dst occurs
|
||||
# more than once after case flattening
|
||||
.if ${MKUPDATE} == "no" || ${MLINKS:tl:M${_dst:tl:Q}:[\#]} > 1
|
||||
${_t}! ${_l} __linkinstallpage
|
||||
.else
|
||||
${_t}: ${_l} __linkinstallpage
|
||||
.endif
|
||||
|
||||
# catlinks:: ${_t}
|
||||
# .PRECIOUS: ${_t}
|
||||
# .endfor
|
||||
# .endif # (${MKCATPAGES} != "no") && (${MKMAN} != "no")
|
||||
catlinks:: ${_t}
|
||||
.PRECIOUS: ${_t}
|
||||
.endfor
|
||||
.endif # (${MKCATPAGES} != "no") && (${MKMAN} != "no")
|
||||
|
||||
# ##### Build and install rules (HTML pages)
|
||||
##### Build and install rules (HTML pages)
|
||||
|
||||
# .if (${MKHTML} != "no") && (${MKMAN} != "no") # {
|
||||
# htmlinstall: htmlpages htmllinks
|
||||
# htmlpages:: # ensure target exists
|
||||
# HTMLPAGES= ${MAN:C/\.([1-9])$/.html\1/}
|
||||
.if (${MKHTML} != "no") && (${MKMAN} != "no") # {
|
||||
htmlinstall: htmlpages htmllinks
|
||||
htmlpages:: # ensure target exists
|
||||
HTMLPAGES= ${MAN:C/\.([1-9])$/.html\1/}
|
||||
|
||||
# realall: ${HTMLPAGES}
|
||||
# .NOPATH: ${HTMLPAGES}
|
||||
# .SUFFIXES: ${_MNUMBERS:@N@.html$N@}
|
||||
# .MADE: ${HTMLDEPS}
|
||||
realall: ${HTMLPAGES}
|
||||
.NOPATH: ${HTMLPAGES}
|
||||
.SUFFIXES: ${_MNUMBERS:@N@.html$N@}
|
||||
.MADE: ${HTMLDEPS}
|
||||
|
||||
# ${_MNUMBERS:@N@.$N.html$N@}: ${HTMLDEPS} # build rule
|
||||
# ${_MKTARGET_FORMAT}
|
||||
# .if ${MKMANDOC} == "yes" && !defined(NOMANDOC)
|
||||
# if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \
|
||||
# ${TOOL_MANDOC_HTML} ${.IMPSRC} > ${.TARGET}.tmp && \
|
||||
# mv ${.TARGET}.tmp ${.TARGET}; \
|
||||
# else \
|
||||
# ${TOOL_ROFF_HTML} ${.IMPSRC} > ${.TARGET}.tmp && \
|
||||
# mv ${.TARGET}.tmp ${.TARGET}; \
|
||||
# fi
|
||||
# .else
|
||||
# ${TOOL_ROFF_HTML} ${.IMPSRC} > ${.TARGET}.tmp && \
|
||||
# mv ${.TARGET}.tmp ${.TARGET}
|
||||
# .endif
|
||||
${_MNUMBERS:@N@.$N.html$N@}: ${HTMLDEPS} # build rule
|
||||
${_MKTARGET_FORMAT}
|
||||
.if ${MKMANDOC} == "yes" && !defined(NOMANDOC)
|
||||
if test ""${NOMANDOC.${.IMPSRC:T}:tl:Q} != "yes"; then \
|
||||
${TOOL_MANDOC_HTML} ${.IMPSRC} > ${.TARGET}.tmp && \
|
||||
mv ${.TARGET}.tmp ${.TARGET}; \
|
||||
else \
|
||||
${TOOL_ROFF_HTML} ${.IMPSRC} > ${.TARGET}.tmp && \
|
||||
mv ${.TARGET}.tmp ${.TARGET}; \
|
||||
fi
|
||||
.else
|
||||
${TOOL_ROFF_HTML} ${.IMPSRC} > ${.TARGET}.tmp && \
|
||||
mv ${.TARGET}.tmp ${.TARGET}
|
||||
.endif
|
||||
|
||||
# .for F in ${HTMLPAGES:O:u}
|
||||
# # construct installed path
|
||||
# _F:= ${HTMLDIR}/${F:T:E}${MANSUBDIR}/${F:R:S-/index$-/x&-}.html
|
||||
.for F in ${HTMLPAGES:O:u}
|
||||
# construct installed path
|
||||
_F:= ${HTMLDIR}/${F:T:E}${MANSUBDIR}/${F:R:S-/index$-/x&-}.html
|
||||
|
||||
# .if ${MKUPDATE} == "no"
|
||||
# ${_F}! ${F} __installpage # install rule
|
||||
# .if !defined(BUILD) && !make(all) && !make(${F})
|
||||
# ${_F}! .MADE # no build at install
|
||||
# .endif
|
||||
# .else
|
||||
# ${_F}: ${F} __installpage # install rule
|
||||
# .if !defined(BUILD) && !make(all) && !make(${F})
|
||||
# ${_F}: .MADE # no build at install
|
||||
# .endif
|
||||
# .endif
|
||||
.if ${MKUPDATE} == "no"
|
||||
${_F}! ${F} __installpage # install rule
|
||||
.if !defined(BUILD) && !make(all) && !make(${F})
|
||||
${_F}! .MADE # no build at install
|
||||
.endif
|
||||
.else
|
||||
${_F}: ${F} __installpage # install rule
|
||||
.if !defined(BUILD) && !make(all) && !make(${F})
|
||||
${_F}: .MADE # no build at install
|
||||
.endif
|
||||
.endif
|
||||
|
||||
# htmlpages:: ${_F}
|
||||
# .PRECIOUS: ${_F} # keep if install fails
|
||||
# .endfor
|
||||
htmlpages:: ${_F}
|
||||
.PRECIOUS: ${_F} # keep if install fails
|
||||
.endfor
|
||||
|
||||
# htmllinks:: # link install
|
||||
htmllinks:: # link install
|
||||
|
||||
# .for _src _dst in ${MLINKS}
|
||||
# _l:=${HTMLDIR}/html${_src:T:E}${MANSUBDIR}/${_src:R:S-/index$-/x&-}.html
|
||||
# _t:=${HTMLDIR}/html${_dst:T:E}${MANSUBDIR}/${_dst:R:S-/index$-/x&-}.html
|
||||
.for _src _dst in ${MLINKS}
|
||||
_l:=${HTMLDIR}/html${_src:T:E}${MANSUBDIR}/${_src:R:S-/index$-/x&-}.html
|
||||
_t:=${HTMLDIR}/html${_dst:T:E}${MANSUBDIR}/${_dst:R:S-/index$-/x&-}.html
|
||||
|
||||
# # Handle case conflicts carefully, when _dst occurs
|
||||
# # more than once after case flattening
|
||||
# .if ${MKUPDATE} == "no" || ${MLINKS:tl:M${_dst:tl:Q}:[\#]} > 1
|
||||
# ${_t}! ${_l} __linkinstallpage
|
||||
# .else
|
||||
# ${_t}: ${_l} __linkinstallpage
|
||||
# .endif
|
||||
# Handle case conflicts carefully, when _dst occurs
|
||||
# more than once after case flattening
|
||||
.if ${MKUPDATE} == "no" || ${MLINKS:tl:M${_dst:tl:Q}:[\#]} > 1
|
||||
${_t}! ${_l} __linkinstallpage
|
||||
.else
|
||||
${_t}: ${_l} __linkinstallpage
|
||||
.endif
|
||||
|
||||
# htmllinks:: ${_t}
|
||||
# .PRECIOUS: ${_t}
|
||||
# .endfor
|
||||
htmllinks:: ${_t}
|
||||
.PRECIOUS: ${_t}
|
||||
.endfor
|
||||
|
||||
# .endif # }
|
||||
.endif # }
|
||||
|
||||
##### Clean rules
|
||||
.undef _F
|
||||
|
@ -275,10 +277,10 @@ cleanman: .PHONY
|
|||
.endif
|
||||
# (XXX ${CATPAGES:S...} cleans up old .catN files where .catN.gz now used)
|
||||
|
||||
# .if ${MKMANDOC} == "yes" && !empty(MANPAGES)
|
||||
# lintmanpages: ${MANPAGES}
|
||||
# ${TOOL_MANDOC_LINT} -Tlint -fstrict ${.ALLSRC}
|
||||
# .endif
|
||||
.if ${MKMANDOC} == "yes" && !empty(MANPAGES)
|
||||
lintmanpages: ${MANPAGES}
|
||||
${TOOL_MANDOC_LINT} -Tlint -fstrict ${.ALLSRC}
|
||||
.endif
|
||||
|
||||
##### Pull in related .mk logic
|
||||
.include <bsd.obj.mk>
|
||||
|
|
Loading…
Reference in a new issue