Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
83
cde/programs/dtksh/ksh93/src/lib/libast/man/LIBAST.3
Normal file
83
cde/programs/dtksh/ksh93/src/lib/libast/man/LIBAST.3
Normal file
@@ -0,0 +1,83 @@
|
||||
.\" $XConsortium: LIBAST.3 /main/2 1996/10/29 15:06:40 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH LIBAST 3
|
||||
.UC 4
|
||||
.SH NAME
|
||||
libast \- introduction to the ast library
|
||||
.SH DESCRIPTION
|
||||
This section describes functions found in the
|
||||
Advanced Software Tecnology department
|
||||
.B libast
|
||||
library.
|
||||
.B libast
|
||||
serves three major purposes.
|
||||
First, it presents (a subset of) POSIX/ANSI standard headers and interfaces on
|
||||
non-compliant systems.
|
||||
Second, it provides a portable base of routines that implement concepts
|
||||
common to all UNIX system variants.
|
||||
Finally, it is a forum for
|
||||
modern implementations of features present (or lacking)
|
||||
in the standard C libraries.
|
||||
Features better provided by separate libraries are omitted from
|
||||
.BR libast .
|
||||
For example, most terminal driver interface issues are left for
|
||||
special purpose libraries such as
|
||||
.IR curses (3).
|
||||
.PP
|
||||
The
|
||||
.B libast
|
||||
related header files are installed in the directories
|
||||
.LR include/ast .
|
||||
Routines that do not advertize their own headers are prototyped in
|
||||
.LR <ast.h> .
|
||||
.L <ast.h>
|
||||
is ANSI, K&R and C++ compatible and includes or defines the equivalent of
|
||||
.LR <limits.h> ,
|
||||
.LR <stddef.h> ,
|
||||
.LR <stdlib.h> ,
|
||||
.LR <sys/types.h> ,
|
||||
.L <string.h>
|
||||
and
|
||||
.LR <unistd.h> .
|
||||
Other libraries that depend on
|
||||
.B libast
|
||||
may also have headers installed in the
|
||||
.L include/ast
|
||||
directories.
|
||||
.SH FILES
|
||||
.nf
|
||||
include/ast the \fBast\fP package header directory
|
||||
lib/libast.a the \fBlibast\fP library
|
||||
lib/libast-g.a the \fBlibast\fP library compiled for debugging
|
||||
lib/libast-pg.a the \fBlibast\fP library compiled for profiling
|
||||
lib/libast.so.4.0 the \fBlibast\fP shared library
|
||||
.fi
|
||||
.SH "SEE ALSO"
|
||||
intro(3),
|
||||
intro(2),
|
||||
cc(1)
|
||||
272
cde/programs/dtksh/ksh93/src/lib/libast/man/ast.3
Normal file
272
cde/programs/dtksh/ksh93/src/lib/libast/man/ast.3
Normal file
@@ -0,0 +1,272 @@
|
||||
.\" $XConsortium: ast.3 /main/2 1996/10/29 15:06:50 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH AST 3
|
||||
.SH NAME
|
||||
ast \- miscellaneous libast support
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <ast.h>
|
||||
|
||||
char* astconf(const char* \fIname\fP, const char* \fIpath\fP, const char* \fIvalue\fP);
|
||||
Ast_confdisc_t astconfdisc(Ast_confdisc_t new_notify);
|
||||
void astconflist(Sfio_t* stream, const char* path, int flags);
|
||||
off_t astcopy(int \fIrfd\fP, int \fIwfd\fP, off_t \fIn\fP);
|
||||
int astquery(int \fIfd\fP, const char* \fIformat\fP , ...);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
.L astconf
|
||||
is a string interface to the
|
||||
.IR confstr (2),
|
||||
.IR pathconf (2),
|
||||
and
|
||||
.IR sysconf (2)
|
||||
calls.
|
||||
If
|
||||
.I value
|
||||
is
|
||||
.L 0
|
||||
then the configuration parameter value for
|
||||
.I name
|
||||
is returned.
|
||||
Some
|
||||
.I name
|
||||
configuration parameters may consult the
|
||||
.I path
|
||||
argument.
|
||||
In this case if
|
||||
.I path
|
||||
is
|
||||
.L 0
|
||||
then
|
||||
\f5"/"\fP
|
||||
is used.
|
||||
Otherwise if
|
||||
.I path
|
||||
is not
|
||||
.L 0
|
||||
then it must exist.
|
||||
The string return value for
|
||||
.I name
|
||||
remains unchanged until the next
|
||||
.L astconf
|
||||
call on
|
||||
.IR name .
|
||||
If
|
||||
.I value
|
||||
is
|
||||
.L 0
|
||||
then a valid string is always returned;
|
||||
\f5""\fP
|
||||
is returned if
|
||||
.I name
|
||||
has no configuration value.
|
||||
This simplifies the programming interface:
|
||||
.EX
|
||||
if (!strcmp(astconf("PATH_RESOLVE", NiL, NiL), "logical"))
|
||||
/* the logical way ... */
|
||||
.EE
|
||||
If
|
||||
.I value
|
||||
is not
|
||||
.L 0
|
||||
then the configuration parameter value for
|
||||
.I name
|
||||
is set to
|
||||
.IR value .
|
||||
.L 0
|
||||
is returned if the value cannot be set.
|
||||
The paradigm is:
|
||||
.EX
|
||||
universe = astconf("UNIVERSE", 0, "att");
|
||||
\|.\|.\|.
|
||||
astconf("UNIVERSE", 0, universe);
|
||||
.EE
|
||||
The settable configuration names are:
|
||||
.TP
|
||||
.L FS_3D
|
||||
.L 1
|
||||
if
|
||||
.IR 3d (1)
|
||||
viewpathing is enabled,
|
||||
.L 0
|
||||
otherwise.
|
||||
This is an alternative to the
|
||||
.IR fs3d (3)
|
||||
interface.
|
||||
.TP
|
||||
.L PATH_RESOLVE
|
||||
.L logical
|
||||
if symbolic links are followed during file tree traversal,
|
||||
.L physical
|
||||
if symbolic links are not followed during file tree traversal,
|
||||
and
|
||||
.L metaphysical
|
||||
if symbolic links are followed at the top level during file tree traversal.
|
||||
These correspond to the generic
|
||||
.LR \-L ,
|
||||
.LR \-P ,
|
||||
and
|
||||
.L \-H
|
||||
command options.
|
||||
.TP
|
||||
.L UNIVERSE
|
||||
.L ucb
|
||||
for
|
||||
.I Berkeley
|
||||
style and
|
||||
.L att
|
||||
otherwise.
|
||||
This configuration parameter controls the
|
||||
.I universe
|
||||
setting on machines that support it (e.g., Pyramid).
|
||||
.L UNIVERSE
|
||||
also controls the behavior of some commands like
|
||||
.IR cat (1)
|
||||
and
|
||||
.IR echo (1).
|
||||
.PP
|
||||
User defined
|
||||
.I name
|
||||
values may also be set and queried, but these should probably have
|
||||
some form of vendor prefix to avoid being stomped by future standards.
|
||||
.PP
|
||||
.L astconfdisc
|
||||
registers a discipline function
|
||||
.EX
|
||||
int (*notify)(const char* \fIname\fP, const char* \fIpath\fP, const char* \fIvalue\fP);
|
||||
.EE
|
||||
that is called just before the configuration parameter
|
||||
.I name
|
||||
is set to
|
||||
.I value
|
||||
relative to
|
||||
.IR path .
|
||||
If
|
||||
.I notify
|
||||
returns
|
||||
.L 0
|
||||
then the configuration parameter value is not changed.
|
||||
.PP
|
||||
.L astconflist
|
||||
lists the current configuration names and values of
|
||||
.IR stream .
|
||||
If
|
||||
.I path
|
||||
is
|
||||
.L 0
|
||||
then \f5"/"\fP is used where appropriate.
|
||||
If
|
||||
.I flags
|
||||
is
|
||||
.L 0
|
||||
or
|
||||
.L R_OK|W_OK
|
||||
then all configuration parameters are listed.
|
||||
.L R_OK
|
||||
lists the readonly configuration parameters and
|
||||
.L W_OK
|
||||
lists the settable configuration parameters.
|
||||
.L X_OK
|
||||
lists the settable configuration parameters in a form that can be
|
||||
snarfed for input to the
|
||||
.IR getconf (1)
|
||||
command.
|
||||
.PP
|
||||
.L astcopy
|
||||
efficiently copies up to
|
||||
.I n
|
||||
bytes from the file descriptor
|
||||
.I rfd
|
||||
to the file descriptor
|
||||
.IR wfd .
|
||||
The actual number of bytes copied is returned; \-1 is returned on error.
|
||||
If
|
||||
.I n
|
||||
is 0 then an optimal number of bytes (with respect to both
|
||||
.I rfd
|
||||
and
|
||||
.IR wfd )
|
||||
is copied.
|
||||
.PP
|
||||
If possible
|
||||
.IR mmap (2)
|
||||
is used to do the transfer.
|
||||
Some implementations may bypass user buffer copies usually required by the
|
||||
.IR read (2)- write (2)
|
||||
paradigm.
|
||||
.PP
|
||||
.L astquery
|
||||
outputs an
|
||||
.IR sfprintf (3)
|
||||
prompt specified by
|
||||
.I "format, .\|.\|."
|
||||
to the controlling terminal and reads a response from the controlling terminal.
|
||||
Offirmative response returns
|
||||
.LR 0 ,
|
||||
.L EOF
|
||||
or quit response returns
|
||||
.LR \-1 ,
|
||||
otherwise
|
||||
.L 1
|
||||
is returned.
|
||||
If
|
||||
.I quit
|
||||
is greater than
|
||||
.L 0
|
||||
then
|
||||
.I exit(quit)
|
||||
is called on a quit response.
|
||||
The responses will eventually be locale specific.
|
||||
.PP
|
||||
.L astwinsize
|
||||
returns the number of rows in
|
||||
.I *rows
|
||||
and the number of columns
|
||||
.I *col
|
||||
for the terminal file descriptor
|
||||
.IR fd .
|
||||
If the number of rows or columns cannot be determined or if
|
||||
.I fd
|
||||
is not a terminal then
|
||||
.I *rows
|
||||
and
|
||||
.I *cols
|
||||
are set to
|
||||
.LR 0 .
|
||||
If
|
||||
.I ioctl (2)
|
||||
methods fail then the environment variable
|
||||
.L LINES
|
||||
is used to set
|
||||
.I *rows
|
||||
and the environment variable
|
||||
.L COLUMNS
|
||||
is used to set
|
||||
.IR *cols .
|
||||
.SH "SEE ALSO"
|
||||
getconf(1), confstr(2), mmap(2), pathconf(2), read(2), sysconf(2), write(2)
|
||||
121
cde/programs/dtksh/ksh93/src/lib/libast/man/chr.3
Normal file
121
cde/programs/dtksh/ksh93/src/lib/libast/man/chr.3
Normal file
@@ -0,0 +1,121 @@
|
||||
.\" $XConsortium: chr.3 /main/2 1996/10/29 15:07:02 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de LI
|
||||
.}S 5 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de IL
|
||||
.}S 3 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH CHR 3
|
||||
.SH NAME
|
||||
chr \- character constant conversion routines
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <ast.h>
|
||||
|
||||
int chresc(const char* \fIs\fP, char** \fIe\fP);
|
||||
int chrtoi(const char* \fIs\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
.L chresc
|
||||
converts and returns the next character constant in the 0-terminated string
|
||||
.IR s .
|
||||
If
|
||||
.I e
|
||||
is not 0 then
|
||||
.I *e
|
||||
is set to point to the next character in
|
||||
.I s
|
||||
on return.
|
||||
0 is returned and
|
||||
.I e
|
||||
is not modified when the end of
|
||||
.I s
|
||||
is reached.
|
||||
.PP
|
||||
.L chrtoi
|
||||
converts the 0-terminated string
|
||||
.I s
|
||||
to an
|
||||
.I int
|
||||
and returns the value.
|
||||
The characters in
|
||||
.I s
|
||||
are converted in order from the left and shifted into the
|
||||
.I int
|
||||
value until up to the number of characters in an
|
||||
.I int
|
||||
is reached.
|
||||
This operation is inherently machine-dependent,
|
||||
but at least its defined in one place.
|
||||
.PP
|
||||
The following
|
||||
.B \e
|
||||
escape sequences are recognized:
|
||||
.TP
|
||||
.LI \e ooo
|
||||
The character represented by the octal code
|
||||
.IR ooo .
|
||||
.TP
|
||||
.LI \ex xx
|
||||
The character represented by the hex code
|
||||
.IR xx .
|
||||
.TP
|
||||
.L \ea
|
||||
Alert (bell).
|
||||
.TP
|
||||
.L \eb
|
||||
Backspace.
|
||||
.TP
|
||||
.L \ef
|
||||
Formfeed.
|
||||
.TP
|
||||
.L \en
|
||||
Newline.
|
||||
.TP
|
||||
.L \er
|
||||
Carriage return.
|
||||
.TP
|
||||
.L \et
|
||||
Horizontal tab.
|
||||
.TP
|
||||
.L \ev
|
||||
Vertical tab.
|
||||
.TP
|
||||
.L \eE
|
||||
ESC (escape).
|
||||
.TP
|
||||
.L \e\e
|
||||
Backslash.
|
||||
.PP
|
||||
Other characters following
|
||||
.B \e
|
||||
are undefined (although for backwards compatibility they
|
||||
translate to themselves).
|
||||
.SH "SEE ALSO"
|
||||
str(3)
|
||||
92
cde/programs/dtksh/ksh93/src/lib/libast/man/compatibility.3
Normal file
92
cde/programs/dtksh/ksh93/src/lib/libast/man/compatibility.3
Normal file
@@ -0,0 +1,92 @@
|
||||
.\" $XConsortium: compatibility.3 /main/2 1996/10/29 15:07:11 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH COMPATIBILITY 3
|
||||
.SH NAME
|
||||
compatibility \- ast library compatibility routines
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <ast.h>
|
||||
|
||||
int atexit(void(*)(void));
|
||||
char* confstr(int);
|
||||
int dup2(int, int);
|
||||
long fpathconf(int, int);
|
||||
int getgroups(int, int*);
|
||||
char* getwd(char*);
|
||||
int killpg(int, int);
|
||||
int link(const char*, const char*);
|
||||
int lstat(const char*, struct stat*);
|
||||
int memcmp(const char*, const char*, unsigned int);
|
||||
char* memcpy(char*, const char*, int);
|
||||
char* memset(char*, char, int);
|
||||
int mkdir(const char*, mode_t);
|
||||
int mkfifo(const char*, mode_t);
|
||||
int mknod(const char*, mode_t);
|
||||
char* mktemp(char*);
|
||||
int mount(const char*, const char*, int);
|
||||
long pathconf(const char*, int);
|
||||
int perror(const char*);
|
||||
FILE* popen(const char*, const char*);
|
||||
int readlink(const char*, char*, int);
|
||||
int remove(const char*);
|
||||
int rename(const char*, const char*);
|
||||
int rmdir(const char*);
|
||||
int setpgid(pid_t, pid_t);
|
||||
int sigmask(int);
|
||||
int sigsetmask(long);
|
||||
int sigunblock(int);
|
||||
char* strchr(const char*, int);
|
||||
char* strrchr(const char*, int);
|
||||
double strtod(const char*, char**);
|
||||
long strtol(const char*, char**, int);
|
||||
int symlink(const char*, const char*);
|
||||
long sysconf(int);
|
||||
int system(const char*);
|
||||
char* tmpnam(char*);
|
||||
int unlink(const char*);
|
||||
int vfork(void);
|
||||
int waitpid(pid_t, int*, int);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
These routines are described in the ANSI C, POSIX, BSD and System V manual
|
||||
sections 2 and 3.
|
||||
The interfaces are preserved and present in all libast implementations.
|
||||
Where conflicts exist the POSIX syntax and semantics are implied.
|
||||
The appropriate error value is returned and
|
||||
.I errno
|
||||
is set to
|
||||
.L EINVAL
|
||||
when emulation is either too expensive or not possible.
|
||||
.SH CAVEAT
|
||||
If you
|
||||
.L "#undef foo"
|
||||
and then call
|
||||
.L foo
|
||||
you may end up with the local implementation of
|
||||
.LR foo ,
|
||||
and then you get what you payed for.
|
||||
272
cde/programs/dtksh/ksh93/src/lib/libast/man/error.3
Normal file
272
cde/programs/dtksh/ksh93/src/lib/libast/man/error.3
Normal file
@@ -0,0 +1,272 @@
|
||||
.\" $XConsortium: error.3 /main/2 1996/10/29 15:07:24 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH ERROR 3
|
||||
.SH NAME
|
||||
error \- error and debug trace message formatter
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <error.h>
|
||||
|
||||
Error_info_t error_info;
|
||||
|
||||
void error(int \fIlevel\fP, ...);
|
||||
void errorv(const char* \fIlibrary\fP, int \fIlevel\fP, va_alist \fIargs\fP);
|
||||
void liberror(const char* \fIlibrary\fP, int \fIlevel\fP, ...);
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
debug(\fIstatement\fP)
|
||||
message((int \fIlevel\fP, ...))
|
||||
libmessage((const char* \fIlibrary\fI, int \fIlevel\fP, ...))
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
.L error
|
||||
is the error and debug trace message formatter.
|
||||
.I level
|
||||
is the severity level.
|
||||
Messages with
|
||||
.I "level < error_info.trace"
|
||||
are suppressed.
|
||||
.I error_info.trace
|
||||
is initially
|
||||
.LR 0 .
|
||||
The remaining arguments are passed on to
|
||||
.LR printf .
|
||||
A
|
||||
.I newline
|
||||
is appended to the message text, so none should appear in the
|
||||
.L printf
|
||||
format.
|
||||
If
|
||||
.I error_info.id
|
||||
is not
|
||||
.L 0
|
||||
then messages with
|
||||
.I "level > 0"
|
||||
are prefixed by
|
||||
.IR error_info.id: .
|
||||
.PP
|
||||
Before the message text is output to standard error
|
||||
it is passed to the function
|
||||
.LR "char* ERROR_translate(const char* \fItext\fP, int \fIflag\fP)" .
|
||||
By default
|
||||
.L ERROR_translate
|
||||
returns the
|
||||
.L text
|
||||
argument, but on some systems it may do language translation via lookup
|
||||
on the original source text.
|
||||
.RL ( error
|
||||
calls
|
||||
.L ERROR_translate
|
||||
with a 0
|
||||
.L flag
|
||||
argument).
|
||||
.PP
|
||||
.I level
|
||||
may be one of:
|
||||
.TP
|
||||
.B <0
|
||||
Negative values are for debug tracing.
|
||||
Debug messages are prefixed with
|
||||
.BI debug level.
|
||||
If
|
||||
.I "errno != error_info.last_errno"
|
||||
then
|
||||
.I error_info.last_errno
|
||||
is set to
|
||||
.I errno
|
||||
and the error text for errno is appended to the message.
|
||||
.TP
|
||||
.B "ERROR_INFO [0]"
|
||||
Information only; no prefixes are added to the message.
|
||||
.TP
|
||||
.B "ERROR_WARNING [1]"
|
||||
.L "warning:"
|
||||
is added after
|
||||
.L error_info.id
|
||||
and
|
||||
.I error_info.warnings
|
||||
is incremented.
|
||||
.TP
|
||||
.I "ERROR_ERROR [2]"
|
||||
(soft error)
|
||||
.I error_info.errors
|
||||
is incremented.
|
||||
.TP
|
||||
.B ">= ERROR_FATAL [3]"
|
||||
(hard error)
|
||||
.I error_info.errors
|
||||
is incremented and
|
||||
.L exit(\fIlevel\fP\-2)
|
||||
is called after the message is emitted.
|
||||
.TP
|
||||
.B "ERROR_PANIC [77]"
|
||||
(unrecoverable internal error)
|
||||
.L "panic:"
|
||||
is added after
|
||||
.IR error_info.id .
|
||||
.PP
|
||||
The following may be inclusive-or'd into
|
||||
.I level
|
||||
for alternate behavior:
|
||||
.TP
|
||||
.L ERROR_SYSTEM
|
||||
The error text for
|
||||
.I errno
|
||||
is appended to the message.
|
||||
.TP
|
||||
.L ERROR_OUTPUT
|
||||
The next argument is the file descriptor where the error message
|
||||
should be emitted.
|
||||
.TP
|
||||
.L ERROR_SOURCE
|
||||
Then next two arguments are a file name and line number that are added
|
||||
to the message after
|
||||
.IR error_info.id .
|
||||
.TP
|
||||
.L ERROR_USAGE
|
||||
A usage message is emitted.
|
||||
.TP
|
||||
.L ERROR_PROMPT
|
||||
The trailing
|
||||
.I newline
|
||||
is suppressed.
|
||||
.TP
|
||||
.L ERROR_NOID
|
||||
The
|
||||
.I error_info.id
|
||||
prefix is suppressed.
|
||||
.TP
|
||||
.L ERROR_LIBRARY
|
||||
The message is from a library routine.
|
||||
.SH ENVIRONMENT
|
||||
The elements of the global struct
|
||||
.I error_info
|
||||
control error output and actions.
|
||||
Parts of
|
||||
.I error_info
|
||||
can be initialized from the
|
||||
.L ERROR_OPTIONS
|
||||
environment variable.
|
||||
.L ERROR_OPTIONS
|
||||
contains space separated
|
||||
.IR name [ =value ]
|
||||
options, described below.
|
||||
.TP
|
||||
.I "int core"
|
||||
If
|
||||
.I "error_info.core != 0"
|
||||
then
|
||||
.I "level >= error_info.core"
|
||||
generates a core dump.
|
||||
Initialized by
|
||||
.EX
|
||||
ERROR_OPTIONS="core=\fIlevel\fP"
|
||||
.EE
|
||||
where
|
||||
.I level
|
||||
can be a number or one of
|
||||
.LR error ,
|
||||
.LR fatal ,
|
||||
or
|
||||
.LR panic .
|
||||
.I error_info.core
|
||||
is a handy way to get a stack trace at the exact point of error.
|
||||
.TP
|
||||
.I "int error_info.trace"
|
||||
If
|
||||
.I "error_info.trace != 0"
|
||||
and
|
||||
.I "level < error_info.trace"
|
||||
then the error message text is suppressed.
|
||||
.L exit()
|
||||
may still be called if appropriate for
|
||||
.IR level .
|
||||
Initialized by
|
||||
.EX
|
||||
ERROR_OPTIONS="trace=\fIlevel\fP"
|
||||
.EE
|
||||
where
|
||||
.I error_info.trace
|
||||
is set to the negative of
|
||||
.IR level .
|
||||
.PP
|
||||
Library error messages, suppressed by default, are enabled by
|
||||
.EX
|
||||
ERROR_OPTIONS="library"
|
||||
.EE
|
||||
The system
|
||||
.I errno
|
||||
message text can be forced for each message by
|
||||
.EX
|
||||
ERROR_OPTIONS="system"
|
||||
.EE
|
||||
.SH "EXTENDED DESCRIPTION"
|
||||
.L "<debug.h>"
|
||||
provides debugging message macros when
|
||||
.L DEBUG
|
||||
or
|
||||
.L _TRACE_
|
||||
are defined
|
||||
.RL ( _TRACE_
|
||||
is defined by
|
||||
.I makerules
|
||||
when
|
||||
.L CCFLAGS
|
||||
contains
|
||||
.LR \-g ).
|
||||
All of the macros expand to nothing when both
|
||||
.L DEBUG
|
||||
and
|
||||
.L _TRACE_
|
||||
are not defined.
|
||||
Otherwise
|
||||
.L debug
|
||||
expands its arg and
|
||||
.L libmessage
|
||||
and
|
||||
.L message
|
||||
call
|
||||
.L liberror
|
||||
and
|
||||
.L error
|
||||
respectively if
|
||||
.IR "error_info.trace<0" .
|
||||
Notice that
|
||||
.L libmessage
|
||||
and
|
||||
.L message
|
||||
are macro hacks that require double parentheses ((...)) around the
|
||||
arguments.
|
||||
.SH EXAMPLE
|
||||
To enable debugging message level -3, library messages, and system
|
||||
.I errno
|
||||
text for all commands:
|
||||
.EX
|
||||
export ERROR_OPTIONS="trace=3 library system"
|
||||
.EE
|
||||
78
cde/programs/dtksh/ksh93/src/lib/libast/man/find.3
Normal file
78
cde/programs/dtksh/ksh93/src/lib/libast/man/find.3
Normal file
@@ -0,0 +1,78 @@
|
||||
.\" $XConsortium: find.3 /main/2 1996/10/29 15:07:34 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH FIND 3
|
||||
.SH NAME
|
||||
find \- fastfind algorithm interface
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <find.h>
|
||||
|
||||
void* findopen(const char* \fIpattern\fP);
|
||||
char* findnext(void* \fIhandle\fP);
|
||||
void findclose(void* \fIhandle\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
These routines access the data generated by the
|
||||
.I fastfind
|
||||
algorithm.
|
||||
The data itself is generated by a standalone program that is run daily
|
||||
via
|
||||
.I cron
|
||||
or
|
||||
.IR at .
|
||||
.PP
|
||||
.L findopen
|
||||
returns a handle to a
|
||||
.I fastfind
|
||||
stream for the
|
||||
.I ksh
|
||||
file pattern
|
||||
.IR pattern .
|
||||
.L findnext
|
||||
returns the next pathname that matches the pattern specified by
|
||||
.IR handle .
|
||||
.L findnext
|
||||
returns
|
||||
.L 0
|
||||
when no more pathnames match the pattern.
|
||||
Finally,
|
||||
.L findclose
|
||||
closes the
|
||||
.I fastfind
|
||||
stream for
|
||||
.IR handle .
|
||||
.SH BUGS
|
||||
These rotuines are only as good as the
|
||||
.I fastfind
|
||||
information which is in the system administration domain.
|
||||
.SH "SEE ALSO"
|
||||
tw(1),
|
||||
find(1),
|
||||
strmatch(3)
|
||||
.br
|
||||
James A. Woods, \fIFast Find Algorithm\fP, Usenix ;login:, February/March, 1983, p. 8
|
||||
199
cde/programs/dtksh/ksh93/src/lib/libast/man/fmt.3
Normal file
199
cde/programs/dtksh/ksh93/src/lib/libast/man/fmt.3
Normal file
@@ -0,0 +1,199 @@
|
||||
.\" $XConsortium: fmt.3 /main/2 1996/10/29 15:07:45 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH FMT 3
|
||||
.SH NAME
|
||||
fmt \- string formatting routines
|
||||
.SH SYNOPSIS
|
||||
#include <ast.h>
|
||||
#include <ls.h>
|
||||
|
||||
char* fmtbase(long \fInumber\fP, int \fIbase\fP, int \fIprefix\fP);
|
||||
char* fmtdev(struct stat* \fIst\fP);
|
||||
char* fmtelapsed(unsigned long \fIcount\fP, int \fIpersec\fP)
|
||||
char* fmterror(int \fIerrno\fP);
|
||||
char* fmtesc(const char* \fIstring\fP);
|
||||
char* fmtfs(struct stat* \fIst\fP);
|
||||
char* fmtgid(int \fIgid\fP);
|
||||
char* fmtmatch(const char* \fIre\fP);
|
||||
char* fmtmode(int \fImode\fP, int \fIexternal\fP);
|
||||
char* fmtperm(int \fIperm\fP);
|
||||
char* fmtre(const char* \fIpattern\fP);
|
||||
char* fmtsignal(int \fIsig\fP);
|
||||
char* fmttime(const char* \fIformat\fP, time_t \fItm\fP);
|
||||
char* fmtuid(int \fIuid\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
These routines return a pointer to a formatted string for various numeric
|
||||
and string entities.
|
||||
Some routines may cache information to speed up the next call.
|
||||
Most of the routines return a pointer to a private buffer, the
|
||||
contents of which are overwritten on the next call to that routine.
|
||||
Most
|
||||
.L fmt
|
||||
routines have a corresponding
|
||||
.L str
|
||||
routine that converts in the other direction.
|
||||
There is nothing spectacular about this collection other than that
|
||||
it provides a single place where the exact format is spelled out.
|
||||
.PP
|
||||
.L fmtbase
|
||||
formats a base
|
||||
.I base
|
||||
representation for
|
||||
.IR number .
|
||||
If
|
||||
.I "prefix != 0"
|
||||
then the base prefix is included in the formatted string.
|
||||
If
|
||||
.I "number == 0"
|
||||
or
|
||||
.I "base == 0"
|
||||
then the output is signed base 10.
|
||||
.PP
|
||||
.L fmtdev
|
||||
returns the device handle name specified by the
|
||||
.L stat
|
||||
structure
|
||||
.IR st .
|
||||
This is the device information displayed by
|
||||
.IR "ls \-l" .
|
||||
.PP
|
||||
.L fmtelapsed
|
||||
formats the elapsed time for
|
||||
.I (count/persec)
|
||||
seconds.
|
||||
The two largest time units are used, limiting the return value length
|
||||
to at most 6 characters.
|
||||
The units are:
|
||||
.TP
|
||||
.B s
|
||||
seconds
|
||||
.TP
|
||||
.B m
|
||||
minutes
|
||||
.TP
|
||||
.B h
|
||||
hours
|
||||
.TP
|
||||
.B days
|
||||
.TP
|
||||
.B weeks
|
||||
.TP
|
||||
.B M
|
||||
months
|
||||
.TP
|
||||
.B Y
|
||||
years
|
||||
.TP
|
||||
.B S
|
||||
scores
|
||||
.PP
|
||||
.L fmterror
|
||||
returns the system error message text for the error number
|
||||
.IR errno .
|
||||
.PP
|
||||
.L fmtesc
|
||||
formats non-ASCII characters in
|
||||
.I string
|
||||
into C-style
|
||||
.B \e
|
||||
sequences.
|
||||
These sequences are understood by
|
||||
.L chresc
|
||||
and
|
||||
.LR chrtoi .
|
||||
.PP
|
||||
.L fmtfs
|
||||
returns the file system type name corresponding to the
|
||||
.L stat
|
||||
structure
|
||||
.IR st .
|
||||
.PP
|
||||
.L fmtgid
|
||||
returns the group name for
|
||||
.IR gid .
|
||||
.PP
|
||||
.L fmtmatch
|
||||
returns the
|
||||
.L strmatch
|
||||
equivalent pattern for the regular expression pattern
|
||||
.IR re .
|
||||
0 is returned for invalid
|
||||
.IR re .
|
||||
.PP
|
||||
.L fmtmode
|
||||
returns the
|
||||
.I "ls \-l"
|
||||
mode string for the file mode bits in
|
||||
.IR mode .
|
||||
If
|
||||
.I "external != 0"
|
||||
then
|
||||
.I mode
|
||||
is
|
||||
.IR modecanon (3)
|
||||
canonical.
|
||||
.PP
|
||||
.L fmtperm
|
||||
returns the
|
||||
.I chmod
|
||||
permission string for the permission bits in
|
||||
.IR perm .
|
||||
.PP
|
||||
.L fmtre
|
||||
returns the regular expression
|
||||
equivalent pattern for the
|
||||
.L strmatch
|
||||
pattern
|
||||
.IR pattern .
|
||||
0 is returned for invalid
|
||||
.IR pattern .
|
||||
.PP
|
||||
.L fmtsignal
|
||||
returns the signal name, sans
|
||||
.LR SIG ,
|
||||
for the signal number
|
||||
.IR sig .
|
||||
If
|
||||
.I "sig < 0"
|
||||
then the description text for
|
||||
.I \-sig
|
||||
is returned.
|
||||
.PP
|
||||
.L fmttime
|
||||
returns the results of
|
||||
.I "tmfmt(buf,sizeof(buf),format,tm)"
|
||||
in the private buffer
|
||||
.IR buf .
|
||||
.PP
|
||||
.L fmtuid
|
||||
returns the user name for
|
||||
.IR uid .
|
||||
.SH "SEE ALSO"
|
||||
modecanon(3),
|
||||
str(3)
|
||||
133
cde/programs/dtksh/ksh93/src/lib/libast/man/fmtls.3
Normal file
133
cde/programs/dtksh/ksh93/src/lib/libast/man/fmtls.3
Normal file
@@ -0,0 +1,133 @@
|
||||
.\" $XConsortium: fmtls.3 /main/2 1996/10/29 15:07:55 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STRLS 3
|
||||
.SH NAME
|
||||
fmtls \- format file information in buffer
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <ls.h>
|
||||
|
||||
char* fmtls(char* \fIbuf\fP, char* \fIname\fP, struct stat* \fIst\fP,
|
||||
char* \fIinfo\fP, char* \fIlink\fP, int \fIflags\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
.L fmtls
|
||||
formats
|
||||
.IR ls (1)
|
||||
style file information into the buffer
|
||||
.IR buf .
|
||||
A pointer to the trailing 0 in
|
||||
.I buf
|
||||
is returned.
|
||||
.I name
|
||||
is the file name.
|
||||
.I st
|
||||
is a pointer to the
|
||||
.B "struct stat
|
||||
status information for
|
||||
.I name
|
||||
obtained from one of the
|
||||
.IR stat (2)
|
||||
routines.
|
||||
.I info
|
||||
is an additional string that will appear before
|
||||
.I name
|
||||
in
|
||||
.I buf
|
||||
and
|
||||
.I link
|
||||
is the name of the related hard or soft link file.
|
||||
Both
|
||||
.I info
|
||||
and
|
||||
.I link
|
||||
may be 0.
|
||||
.I flags
|
||||
controls the format style and may be a combination of the following:
|
||||
.PP
|
||||
.TP
|
||||
.B LS_ATIME
|
||||
Use
|
||||
.I st->st_atime
|
||||
rather than
|
||||
.I st->st_mtime
|
||||
for
|
||||
.BR LS_LONG .
|
||||
.TP
|
||||
.B LS_CTIME
|
||||
Use
|
||||
.I st->st_mtime
|
||||
rather than
|
||||
.I st->st_mtime
|
||||
for
|
||||
.BR LS_LONG .
|
||||
.TP
|
||||
.B LS_BLOCKS
|
||||
List the number of blocks.
|
||||
.TP
|
||||
.B LS_INUMBER
|
||||
List the file serial number (inode number).
|
||||
.TP
|
||||
.B LS_LONG
|
||||
List the file mode, link count, user and group name,
|
||||
size or major/minor device number, and date along with the
|
||||
file name.
|
||||
.TP
|
||||
.B LS_MARK
|
||||
The file name is appended with
|
||||
.L /
|
||||
for directories,
|
||||
.L @
|
||||
for symbolic links,
|
||||
and
|
||||
.L *
|
||||
for executable files.
|
||||
.TP
|
||||
.B LS_NOGROUP
|
||||
Omit the group name from
|
||||
.BR LS_LONG .
|
||||
.TP
|
||||
.B LS_NOUSER
|
||||
Omit the user name from
|
||||
.BR LS_LONG .
|
||||
.PP
|
||||
The user and group fields are each
|
||||
.B LS_W_NAME
|
||||
characters wide,
|
||||
the
|
||||
.B LS_INUMBER
|
||||
field is
|
||||
.BS LS_W_INUMBER
|
||||
characters wide,
|
||||
and the
|
||||
.B LS_BLOCKS
|
||||
field is
|
||||
.B LS_W_BLOCKS
|
||||
characters wide.
|
||||
.SH "SEE ALSO"
|
||||
ls(1), stat(2), strmode(3)
|
||||
81
cde/programs/dtksh/ksh93/src/lib/libast/man/fs3d.3
Normal file
81
cde/programs/dtksh/ksh93/src/lib/libast/man/fs3d.3
Normal file
@@ -0,0 +1,81 @@
|
||||
.\" $XConsortium: fs3d.3 /main/2 1996/10/29 15:08:06 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH FS3D 3
|
||||
.SH NAME
|
||||
fs3d \- 3D (nDFS) on/off switch
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <fs3d.h>
|
||||
|
||||
int fs3d(int \fIop\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
.L fs3d
|
||||
controls and queries the
|
||||
.B 3D
|
||||
file system
|
||||
.RB (aka nDFS )
|
||||
enable state.
|
||||
.L 0
|
||||
is returned if the current process cannot mount
|
||||
.B 3D
|
||||
files.
|
||||
.I op
|
||||
may be one of:
|
||||
.TP
|
||||
.B FS3D_TEST
|
||||
Returns
|
||||
.L "FS3D_ON [1]"
|
||||
if
|
||||
.B 3D
|
||||
is enabled,
|
||||
.L "FS3D_OFF [0]"
|
||||
otherwise.
|
||||
.TP
|
||||
.B FS3D_ON
|
||||
Enables
|
||||
.B 3D
|
||||
and returns the previous
|
||||
.L 3D
|
||||
state (either
|
||||
.B FS3D_ON
|
||||
or
|
||||
.BR FS3D_OFF ).
|
||||
.TP
|
||||
\fBFS3D_LIMIT(\fIlimit\fB)\fR
|
||||
Sets the viewpath level limit to
|
||||
.IR limit .
|
||||
The previous limit is returned.
|
||||
.TP
|
||||
.B FS3D_INIT
|
||||
Re-initialize the
|
||||
.B 3D
|
||||
tables.
|
||||
Used for debugging.
|
||||
.SH "SEE ALSO"
|
||||
3D(1)
|
||||
235
cde/programs/dtksh/ksh93/src/lib/libast/man/ftwalk.3
Normal file
235
cde/programs/dtksh/ksh93/src/lib/libast/man/ftwalk.3
Normal file
@@ -0,0 +1,235 @@
|
||||
.\" $XConsortium: ftwalk.3 /main/3 1995/11/01 17:44:44 rswiston $
|
||||
.TH FTWALK 3
|
||||
.SH NAME
|
||||
\fBftwalk\fR \- file tree walker
|
||||
.SH SYNOPSIS
|
||||
.ta .75i 1.5i 2.25i 3i 3.75i 4.5i 5.25i 6i
|
||||
.PP
|
||||
.nf
|
||||
\f5
|
||||
#include <ftwalk.h>
|
||||
|
||||
int ftwalk(char* path, int (*userf)(struct FTW* ftw), int options,
|
||||
int (*comparf)(struct FTW* ftw1, struct FTW* ftw2));
|
||||
|
||||
|
||||
int ftwflags(void);
|
||||
\fR
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fIFtwalk\fR traverses a directory hierarchy using depth-first search.
|
||||
Upon visiting each file or directory in the hierarchy, it calls
|
||||
the user function \fIuserf\fP to process that file or directory.
|
||||
On a directory object, \fIuserf\fR may be called twice, once in preorder
|
||||
and once in postorder.
|
||||
On a terminal object such as a file or an unreadable directory,
|
||||
\fIuserf\fP is called only once.
|
||||
Cycles due to hard links or symbolic links are detected
|
||||
to avoid infinite loops.
|
||||
.PP
|
||||
\fIPath\fR is the starting point of the search.
|
||||
It may be an absolute path name or a path name relative to
|
||||
the current directory.
|
||||
If \fIpath\fR is a null pointer or points to an empty string, it is treated
|
||||
as if it points to the current (dot) directory.
|
||||
.PP
|
||||
\fIOptions\fR consists of zero or more of the following bits:
|
||||
.IP
|
||||
FTW_CHILDREN:
|
||||
This implies preorder calls to \fIuserf\fR on directory objects.
|
||||
On such a call to \fIuserf\fR,
|
||||
the field \fIftw->link\fR (below) points to a link list of
|
||||
the children of the respective directory.
|
||||
Upon returning from \fIuserf\fP,
|
||||
if the field \fIftw->status\fR of any child object
|
||||
is set to FTW_SKIP (below), that child is pruned from the search.
|
||||
.IP
|
||||
FTW_DELAY: When \fBFTW_CHILDREN\fP is turned on,
|
||||
the fields \fIftw->statb\fP (\fIstruct stat\fP) of children objects
|
||||
remain undefined until these objects are visited.
|
||||
.IP
|
||||
FTW_DOT: Do not use \fIchdir\fR(2) during the traversal.
|
||||
Normally \fIchdir\fR is used so that
|
||||
the base name of the object about to be processed can be used
|
||||
in accessing its data.
|
||||
This can enhance \fIftwalk\fR efficiency but certain program effects
|
||||
such as core dumps may be generated in unexpected places
|
||||
or may not even be generated at all.
|
||||
Whenever \fIchdir\fR generates an error, if possible,
|
||||
the current directory is restored to the starting directory
|
||||
(see FTW_NAME and FTW_PATH).
|
||||
.IP
|
||||
FTW_MULTIPLE: The \fIpath\fP argument is treated as a \fIchar**\fP
|
||||
pointer to a null-terminated array of path names.
|
||||
All hierarchies rooted at these paths will be searched
|
||||
.IP
|
||||
FTW_POST: Calls to the user function are issued only in postorder.
|
||||
That is, \fIuserf\fP is called on a directory only after its descendants have
|
||||
been processed.
|
||||
The absence of this bit indicates that calls to the user functions
|
||||
are issued in preorder. That is, \fIuserf\fP is
|
||||
called on a directory before its descendants are processed.
|
||||
.IP
|
||||
FTW_PHYSICAL: Use \fIlstat\fR(2) instead of \fIstat\fR(2) to get
|
||||
file status and allow detection of symbolic links.
|
||||
In addition, if each component
|
||||
of the absolute path to the starting object has search permission,
|
||||
the absolute path is used for early detection of cycles.
|
||||
.IP
|
||||
FTW_META|FTW_PHYSICAL: Use \fIstat\fR(2) for top level file status and
|
||||
\fIlstat\fR(2) for all other files.
|
||||
Used to implement the POSIX
|
||||
.B \-H
|
||||
option for commands like
|
||||
.IR ls .
|
||||
.IP
|
||||
FTW_TWICE: Calls to the user function are issued in both preorder and postorder
|
||||
for directory objects.
|
||||
.IP
|
||||
FTW_USER: The first of 6 user defined option bits.
|
||||
These bits are ignored by \fIftwalk\fP.
|
||||
.PP
|
||||
\fIUserf\fR is a user supplied function that is
|
||||
called upon different visits of an object.
|
||||
If the return value of \fIuserf\fR is non-zero,
|
||||
\fIftwalk\fR returns immediately with the same value.
|
||||
The \fIuserf\fP prototype is:
|
||||
.PP
|
||||
.nf
|
||||
int userf(struct FTW* ftw)
|
||||
.fi
|
||||
.PP
|
||||
\fBstruct FTW\fP contains at least the following elements:
|
||||
.PP
|
||||
.nf
|
||||
struct FTW* link; /* link list of children */
|
||||
struct FTW* parent; /* parent object on the search path */
|
||||
union
|
||||
{
|
||||
long number; /* local number */
|
||||
void* pointer; /* local pointer */
|
||||
} local; /* user defined */
|
||||
struct stat statb; /* stat buffer of this object */
|
||||
char* path; /* full pathname */
|
||||
short pathlen; /* strlen(path) */
|
||||
unsigned short info; /* type of object */
|
||||
unsigned short status; /* status of object */
|
||||
short level; /* depth of object on the search path */
|
||||
short namelen; /* strlen(name) */
|
||||
char name[]; /* file name of object */
|
||||
.fi
|
||||
.PP
|
||||
The \fIlink\fR field is normally NULL.
|
||||
If the option FTW_CHILDREN was turned on,
|
||||
it points to the start of the list of children
|
||||
of the directory being visited in preorder.
|
||||
Finally, if the directory being visited causes a cycle,
|
||||
\fIlink\fR points to the object on the search path that is
|
||||
identical to this directory. Note that if FTW_PHYSICAL was turned on,
|
||||
this may point to a directory that is an ancestor of the starting
|
||||
object.
|
||||
.PP
|
||||
The \fIparent\fR field points to the parent object
|
||||
on the search path. For convenience, a parent object is also supplied for
|
||||
the starting object.
|
||||
In this case, except for the \fIlocal\fR field which is initialized
|
||||
to 0 and the \fIlevel\fR field which contains a negative number,
|
||||
the rest of the structure may be undefined.
|
||||
.PP
|
||||
The \fIinfo\fR field indicates the type of the object
|
||||
being visited and the type of the visit. The types are:
|
||||
.IP
|
||||
FTW_D: A directory being visited in preorder, i.e.,
|
||||
none of its children has been visited by the search.
|
||||
.IP
|
||||
FTW_DNX: A directory being visited in preorder that does not have
|
||||
search permission.
|
||||
.IP
|
||||
FTW_DP: A directory being visited in postorder, i.e., all of its
|
||||
descendants have been completely processed.
|
||||
.IP
|
||||
FTW_DC: A directory that causes cycles. This is a terminal object.
|
||||
.IP
|
||||
FTW_DNR: A directory that cannot be opened for reading. This is a terminal object.
|
||||
.IP
|
||||
FTW_F: An ordinary file.
|
||||
.IP
|
||||
FTW_SL: A symbolic link.
|
||||
Unless FTW_FOLLOW (below) is issued by the user function,
|
||||
this object is terminal.
|
||||
.IP
|
||||
FTW_NS: \fIStat\fR failed on this object.
|
||||
The stat buffer \fIstatb\fR is undefined.
|
||||
This object is terminal.
|
||||
.PP
|
||||
The \fIstatus\fR field of \fIstruct FTW\fR is used to communicate information
|
||||
between \fIftwalk\fR and \fIuserf\fR. On calls to \fIuserf\fR, it has one of
|
||||
two values:
|
||||
.IP
|
||||
FTW_NAME: The name of the object as defined in \fIftw->name\fR should be used for
|
||||
accessing its file information. This is because \fIchdir\fR(2) has been used
|
||||
to set the current directory to a suitable place (see FTW_CHDIR).
|
||||
.IP
|
||||
FTW_PATH: The argument \fIpath\fR of \fIuserf\fR should be used
|
||||
for accessing the file information of the object.
|
||||
.PP
|
||||
Upon returning, \fIuserf\fR may set the \fIstatus\fR field
|
||||
to one of the following values:
|
||||
.IP
|
||||
FTW_AGAIN: If this is a directory object being visited in postorder,
|
||||
it will be processed \fIagain\fR as if it had not been visited.
|
||||
.IP
|
||||
FTW_NOPOST: If this is a directory object being visited in preorder,
|
||||
the user function will not be called on its postorder visit.
|
||||
.IP
|
||||
FTW_SKIP: This object and its descendants are pruned from the search.
|
||||
.IP
|
||||
FTW_FOLLOW: If this object is a symbolic link,
|
||||
follow the link to its physical counterpart.
|
||||
.PP
|
||||
\fIComparf\fR, if not NULL, is a pointer to a function
|
||||
used to define a search ordering for children of a directory.
|
||||
If FTW_CHILDREN is turned on, the ordering of the children of
|
||||
a directory is done before the preorder call to \fIuserf\fR on that directory.
|
||||
Therefore, in that case, \fIftw->link\fR will point to the smallest child.
|
||||
.PP
|
||||
The \fIcomparf\fP prototype is:
|
||||
.PP
|
||||
.nf
|
||||
int comparf(struct FTW* ftw1, struct FTW* ftw2)
|
||||
.fi
|
||||
.PP
|
||||
\fIComparf\fR should return a value <0, 0, or >0 to indicate whether
|
||||
\fIftw1\fR is considered smaller, equal, or larger than \fIftw2\fR.
|
||||
.PP
|
||||
\fIFtwalk\fR normally returns 0.
|
||||
On hard errors such as running out of memory, it returns -1.
|
||||
\fIFtwalk\fR may also return other values as discussed with respect
|
||||
to \fIuserf\fR.
|
||||
.PP
|
||||
\fIFtwflags\fR returns a combination of \fB0, FTW_META, FTW_PHYSICAL\fR
|
||||
according to the
|
||||
preferences specified by
|
||||
\fBastconf("PATH_RESOLVE",0,0)\fR:
|
||||
.TP
|
||||
.B logical
|
||||
0
|
||||
.TP
|
||||
.B metaphysical
|
||||
.B "FTW_META|FTW_PHYSICAL"
|
||||
.TP
|
||||
.B physical
|
||||
.B FTW_PHYSICAL
|
||||
.SH HISTORY
|
||||
\fIFtwalk\fR performs similar functions as that of
|
||||
the routine \fIftw\fR provided in System V.
|
||||
However, it is more general than \fIftw\fR
|
||||
and suitable for use as a base in implementing
|
||||
popular tools such as \fIls, find, tar, du,\fR and \fIrm\fR.
|
||||
\fIFtwalk\fR also handles symbolic links and hard links gracefully.
|
||||
.SH AUTHORS
|
||||
Phong Vo, Glenn Fowler, Dave Korn
|
||||
.SH SEE ALSO
|
||||
find(1), rm(1), du(1), ls(1), tar(1), stat(2), symlink(2),
|
||||
astfeature(3), ftw(3), pathcd(3)
|
||||
56
cde/programs/dtksh/ksh93/src/lib/libast/man/getcwd.3
Normal file
56
cde/programs/dtksh/ksh93/src/lib/libast/man/getcwd.3
Normal file
@@ -0,0 +1,56 @@
|
||||
.\" $XConsortium: getcwd.3 /main/2 1996/10/29 15:08:16 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH GETCWD 3
|
||||
.SH NAME
|
||||
getcwd \- return absolute path to current directory
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <ast.h>
|
||||
|
||||
char* getcwd(char* \fIbuf\fP, size_t \fIlen\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
.L getcwd
|
||||
copies the absolute path name of the current directory info into
|
||||
.I buf
|
||||
of length
|
||||
.IR len .
|
||||
The return path may be longer than
|
||||
.LR PATH_MAX .
|
||||
If
|
||||
.I "buff == 0"
|
||||
then space is allocated via
|
||||
.IR malloc (3)
|
||||
and
|
||||
.I len
|
||||
extra characters are reserved after the generated path name.
|
||||
A pointer to the path name is returned,
|
||||
.L 0
|
||||
on error.
|
||||
.SH "SEE ALSO"
|
||||
pathcd(3)
|
||||
633
cde/programs/dtksh/ksh93/src/lib/libast/man/hash.3
Normal file
633
cde/programs/dtksh/ksh93/src/lib/libast/man/hash.3
Normal file
@@ -0,0 +1,633 @@
|
||||
.\" $XConsortium: hash.3 /main/3 1996/10/29 15:08:25 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH HASH 3
|
||||
.SH NAME
|
||||
hash \- hash table support
|
||||
.SH SYNOPSIS
|
||||
.L "#include <hash.h>"
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.I hash
|
||||
routines manipulate collections of dynamic, scoped hash tables.
|
||||
.PP
|
||||
A hash table provides an association between a
|
||||
.I key
|
||||
and its
|
||||
.IR value .
|
||||
A
|
||||
.I key
|
||||
is a sequence of
|
||||
.L char
|
||||
elements and a
|
||||
.I value
|
||||
is a user supplied pointer to the value.
|
||||
Each hash table has a dynamic number of slots,
|
||||
each pointing to the head of a forward linked
|
||||
.IR "collision chain" .
|
||||
.PP
|
||||
Hashing occurs as follows:
|
||||
a
|
||||
.I "hash function"
|
||||
takes a
|
||||
.I key
|
||||
as an argument and returns a non-negative index.
|
||||
The index modulo the table size produces a
|
||||
slot that points to a
|
||||
.IR "collision chain" .
|
||||
The collision chain is sequentially searched until a match is found for
|
||||
.IR key .
|
||||
The hash tables are automatically resized as new entries are added.
|
||||
.PP
|
||||
Each hash table has one key type.
|
||||
The default key type is a pointer to a null-terminated string.
|
||||
The alternate key type is a pointer to a fixed length byte buffer,
|
||||
declared for a given table by the
|
||||
.L hashalloc()
|
||||
function described below.
|
||||
.PP
|
||||
Hash table information is partitioned into two parts for efficient scoping.
|
||||
The
|
||||
.I root
|
||||
part contains fixed information that is shared among a set of related
|
||||
hash tables.
|
||||
The remaining information is maintained on a per-table basis.
|
||||
.PP
|
||||
These basic types are defined in the header file
|
||||
.B hash.h
|
||||
(alternate names are listed in parenthesis):
|
||||
.TP
|
||||
.L "Hash_table_t (HASHTABLE)"
|
||||
The per-table information.
|
||||
The readonly public elements are:
|
||||
.RS
|
||||
.TP
|
||||
.L "int buckets"
|
||||
The number of table entries.
|
||||
.TP
|
||||
.L "char* name"
|
||||
The hash table name.
|
||||
.TP
|
||||
.L "root"
|
||||
The root information.
|
||||
The public elements are:
|
||||
.RS
|
||||
.TP
|
||||
.L "int root->accesses"
|
||||
The number of lookups.
|
||||
.TP
|
||||
.L "int root->collisions"
|
||||
The number of lookup collisions.
|
||||
.RE
|
||||
.TP
|
||||
.L "Hash_table_t* scope"
|
||||
The table that this scope covers,
|
||||
.L NULL
|
||||
if the table is not a scope.
|
||||
.TP
|
||||
.L "int size"
|
||||
The current hash table size.
|
||||
.RE
|
||||
.TP
|
||||
.L "Hash_bucket_t (HASHBUCKET)"
|
||||
A collision chain hash bucket.
|
||||
The public structure elements are:
|
||||
.RS
|
||||
.TP
|
||||
.L "char* hashname(Hash_bucket_t*)"
|
||||
Returns a pointer to the hash bucket key given the bucket pointer.
|
||||
.TP
|
||||
.L "char* value"
|
||||
The value associated with the key.
|
||||
.RE
|
||||
.TP
|
||||
.L "Hash_header_t (HASHHEADER)"
|
||||
The hash bucket header that must be the first element in all user defined
|
||||
buckets.
|
||||
.L HASH_VALUE
|
||||
may not be used with user defined buckets.
|
||||
.TP
|
||||
.L "Hash_position_t (HASHPOSITION)"
|
||||
Stores the hash table position for
|
||||
.LR hashscan .
|
||||
The public elements are:
|
||||
.RS
|
||||
.TP
|
||||
.L "Hash_bucket_t* bucket"
|
||||
The current hash bucket pointer.
|
||||
.RE
|
||||
.PP
|
||||
The routines are:
|
||||
.TP
|
||||
.L "Hash_table_t* hashalloc(Hash_table_t* ref, int op, ...)"
|
||||
Creates a new hash table and returns a pointer to the table.
|
||||
.IR malloc (3)
|
||||
is used to allocate space for the table.
|
||||
.L NULL
|
||||
is returned if the table cannot be created.
|
||||
.L ref
|
||||
is a pointer to a reference hash table that provides
|
||||
default values for unspecified information.
|
||||
The new hash table and
|
||||
.L ref
|
||||
share the same root information.
|
||||
If
|
||||
.L ref
|
||||
is
|
||||
.L NULL
|
||||
then new root information is created for the new table.
|
||||
The remaining arguments appear in
|
||||
.I op-arg
|
||||
pairs, followed by a final
|
||||
.L 0
|
||||
argument.
|
||||
The
|
||||
.I op-arg
|
||||
pairs are:
|
||||
.RS
|
||||
.TP
|
||||
.L "HASH_alloc, (char(*)()) alloc"
|
||||
.L alloc
|
||||
is a function that is called to process
|
||||
.L Hash_bucket_t
|
||||
.L value
|
||||
assignments.
|
||||
The single argument is
|
||||
.L "char* value"
|
||||
and the processed
|
||||
.L char*
|
||||
value is returned.
|
||||
.TP
|
||||
.L "HASH_clear, int flags"
|
||||
.L flags
|
||||
are the
|
||||
.L ref
|
||||
flags to be cleared in the new hash table.
|
||||
See
|
||||
.L HASH_set
|
||||
below.
|
||||
.TP
|
||||
.L "HASH_compare, (int(*)()) compare"
|
||||
Specifies an alternate
|
||||
.I key
|
||||
comparison function.
|
||||
The arguments and return value for
|
||||
.L compare
|
||||
are the same as for
|
||||
.IR strncmp (3)
|
||||
if
|
||||
.L HASH_namesize
|
||||
is specified and
|
||||
.IR strcmp (3)
|
||||
otherwise.
|
||||
The first argument is the
|
||||
.I key
|
||||
from the current hash bucket on the
|
||||
.I "collision chain"
|
||||
and the second argument is the user supplied
|
||||
.IR key .
|
||||
.TP
|
||||
.L "HASH_free, (int(*)()) free"
|
||||
.L free
|
||||
is a function that is called when a hash bucket is freed.
|
||||
If
|
||||
.L HASH_BUCKET
|
||||
was set in
|
||||
.L hashalloc
|
||||
then the hash bucket pointer is passed, otherwise the bucket
|
||||
.L value
|
||||
pointer is passed.
|
||||
.TP
|
||||
.L "HASH_hash, (int(*)()) hash"
|
||||
Specifies an alternate
|
||||
.I key
|
||||
hash function.
|
||||
A
|
||||
.L char*
|
||||
key argument (and, if
|
||||
.L HASH_namesize
|
||||
is specified, an
|
||||
.L int
|
||||
key size argument) is passed to
|
||||
.LR hash .
|
||||
The return value must be a non-negative
|
||||
.LR int .
|
||||
.TP
|
||||
.L "HASH_meanchain, int meanchain"
|
||||
Specifies the mean collision chain length.
|
||||
The hash table is automatically resized when this value is exceeded.
|
||||
The default mean chain length is 2.
|
||||
.TP
|
||||
.L "HASH_name, char* name"
|
||||
Associates
|
||||
.L name
|
||||
with the hash table.
|
||||
Used by
|
||||
.LR hashdump) .
|
||||
.TP
|
||||
.L "HASH_namesize, int namesize"
|
||||
The fixed size in bytes for
|
||||
.I keys
|
||||
in the table.
|
||||
If
|
||||
.L namesize
|
||||
is 0 (the default) then the
|
||||
.I keys
|
||||
are interpreted as null-terminated strings.
|
||||
.TP
|
||||
.L "HASH_set, int flags"
|
||||
Changes the hash table flags by
|
||||
.IR or ing
|
||||
in
|
||||
.LR flags .
|
||||
The flags, which may be
|
||||
.IR or ed
|
||||
together, are:
|
||||
.RS
|
||||
.TP
|
||||
.L HASH_ALLOCATE
|
||||
Keys for new hash table entries are to be copied to data areas obtained from
|
||||
.IR malloc (3).
|
||||
.TP
|
||||
.L HASH_FIXED
|
||||
Fixes the hash table size, disabling any automatic table resizing.
|
||||
.TP
|
||||
.L HASH_SCOPE
|
||||
The new hash table is a scope that is to be pushed on top of
|
||||
.LR ref .
|
||||
.L ref
|
||||
must be
|
||||
.RL non- NULL .
|
||||
.RE
|
||||
.TP
|
||||
.L "HASH_va_list, va_list ap"
|
||||
.L ap
|
||||
is a
|
||||
.L va_list
|
||||
variable argument list pointer
|
||||
(see
|
||||
.LR <stdarg.h> ).
|
||||
.RE
|
||||
.TP
|
||||
.L "Hash_table_t* hashfree(Hash_table_t* tab)"
|
||||
The hash table
|
||||
.L tab
|
||||
is freed.
|
||||
The scope covered table pointer is returned,
|
||||
.L NULL
|
||||
if
|
||||
.L tab
|
||||
is not a scope.
|
||||
.TP
|
||||
.L "char* hashlook(Hash_table_t* tab, char* name, int flags, char* value)"
|
||||
Operates on the key
|
||||
.L name
|
||||
in the hash table
|
||||
.L tab
|
||||
according to
|
||||
.L flags
|
||||
and
|
||||
.LR value .
|
||||
A
|
||||
.L Hash_bucket_t
|
||||
pointer is returned unless otherwise noted.
|
||||
There are three basic lookup operations:
|
||||
.RS
|
||||
.TP
|
||||
.L HASH_CREATE
|
||||
.L name
|
||||
is entered into the top level scope if it does not already exist.
|
||||
If
|
||||
.L name
|
||||
also appears in a lower scope and
|
||||
.L HASH_ALLOC
|
||||
is set for the table then the new bucket will share the
|
||||
.L name
|
||||
field value with the lower scope.
|
||||
.TP
|
||||
.L HASH_DELETE
|
||||
.L name
|
||||
is deleted from the top level scope if it exists.
|
||||
.L NULL
|
||||
is returned.
|
||||
.TP
|
||||
.L HASH_LOOKUP
|
||||
The scopes are searched in order from top to bottom for
|
||||
.L name .
|
||||
The bucket pointer for the first occurrence is returned.
|
||||
.L NULL
|
||||
is returned if
|
||||
.L name
|
||||
is not found.
|
||||
.RE
|
||||
The basic operations may be qualified by the following
|
||||
(the qualifiers are restricted to the basic operations in
|
||||
the parenthesized list):
|
||||
.RS
|
||||
.TP
|
||||
.L "HASH_BUCKET (HASH_CREATE,HASH_DELETE,HASH_LOOKUP)"
|
||||
.L name
|
||||
is a pointer to a bucket that has already been entered into the table.
|
||||
.TP
|
||||
.L "HASH_FIXED (HASH_CREATE)"
|
||||
.L value
|
||||
is taken to be the size of the hash bucket to be created for
|
||||
.L name
|
||||
in the top level scope.
|
||||
The minimum bucket size is silently restricted to
|
||||
.LR sizeof(Hash_header_t) .
|
||||
.TP
|
||||
.L "HASH_INSTALL (HASH_CREATE)"
|
||||
.L name
|
||||
is a pointer to a bucket that has not been entered into the table.
|
||||
.TP
|
||||
.L "HASH_NOSCOPE (HASH_LOOKUP)"
|
||||
The lookup is restricted to the top level scope.
|
||||
.TP
|
||||
.L "HASH_OPAQUE (HASH_CREATE,HASH_DELETE)"
|
||||
Sets
|
||||
.L (HASH_CREATE)
|
||||
or clears
|
||||
.L (HASH_DELETE)
|
||||
the
|
||||
.I opaque
|
||||
property for the bucket.
|
||||
An opaque bucket is not visible in lower scopes.
|
||||
.TP
|
||||
.L "HASH_SCOPE (HASH_CREATE,HASH_DELETE)"
|
||||
All scopes are searched for the bucket.
|
||||
If the bucket is not found for
|
||||
.L HASH_CREATE
|
||||
then a new bucket is created in the lowest scope.
|
||||
.TP
|
||||
.L "HASH_VALUE (HASH_CREATE,HASH_LOOKUP)"
|
||||
For
|
||||
.L HASH_CREATE
|
||||
the bucket
|
||||
.L value
|
||||
field is set to
|
||||
.L value
|
||||
and the bucket
|
||||
.L name
|
||||
value is returned.
|
||||
For
|
||||
.L HASH_LOOKUP
|
||||
the bucket
|
||||
.L value
|
||||
field is returned,
|
||||
.L NULL
|
||||
if the bucket is not found.
|
||||
.RE
|
||||
If
|
||||
.L name
|
||||
.L NULL
|
||||
then the name from the most recent
|
||||
.L hashlook()
|
||||
is used, avoiding recomputation of some internal parameters.
|
||||
.TP
|
||||
.L "char* hashget(Hash_table_t* tab, char* name)"
|
||||
Returns the value
|
||||
associated with the key
|
||||
.L name
|
||||
in the hash table
|
||||
.LR tab .
|
||||
If
|
||||
.L name
|
||||
is
|
||||
.L NULL
|
||||
then the name from the most recent
|
||||
.L hashget()
|
||||
is used, avoiding recomputation of some internal parameters.
|
||||
.L NULL
|
||||
is returned if
|
||||
.L name
|
||||
is not in the table.
|
||||
All scope covered tables are searched.
|
||||
.TP
|
||||
.L "Hash_bucket_t* hashlast(Hash_table_t* tab)"
|
||||
Returns a pointer to the most recent hash bucket for
|
||||
.LR tab .
|
||||
The value is set by
|
||||
.LR hashlook() ,
|
||||
.L hashscan()
|
||||
and
|
||||
.LR hashwalk() .
|
||||
.TP
|
||||
.L "char* hashput(Hash_table_t* tab, char* name, char* value)"
|
||||
Set the value of the key
|
||||
.L name
|
||||
to
|
||||
.L value
|
||||
in the top level scope of the hash table
|
||||
.LR tab .
|
||||
.L name
|
||||
is entered into the top level scope if necessary.
|
||||
The (possibly re-allocated) key name pointer is returned
|
||||
(see
|
||||
.LR HASH_ALLOCATE ).
|
||||
If
|
||||
.L name
|
||||
is 0 then the most recent lookup
|
||||
.L name
|
||||
to
|
||||
.L hashlook()
|
||||
or
|
||||
.L hashget()
|
||||
is used.
|
||||
This eliminates a re-hash and re-lookup of
|
||||
.LR name .
|
||||
.TP
|
||||
.L "int hashwalk(Hash_table_t* tab, int flags, (int(*)()) walker, char* handle)"
|
||||
The function
|
||||
.L walker
|
||||
is applied to each entry (not covered by a scope starting at
|
||||
.LR tab )
|
||||
in the hash table
|
||||
.LR tab .
|
||||
If
|
||||
.L flags
|
||||
is
|
||||
.L HASH_NOSCOPE
|
||||
then only the top level hash table is used, otherwise the walk includes
|
||||
all scope covered tables.
|
||||
.L walker
|
||||
is called with
|
||||
.L char*
|
||||
.I key
|
||||
as the first argument,
|
||||
.L char*
|
||||
.I value
|
||||
as the second argument, and
|
||||
.L char*
|
||||
.I handle
|
||||
as the third argument.
|
||||
.I handle
|
||||
may be
|
||||
.LR 0 .
|
||||
The walk terminates after the last entry or when
|
||||
.L walker
|
||||
returns a negative value.
|
||||
The return value of the last call to
|
||||
.L walker
|
||||
is returned.
|
||||
Only one walk may be active within a collection of scoped tables.
|
||||
.TP
|
||||
.L "Hash_position_t* hashscan(Hash_table_t* tab, int flags)"
|
||||
Returns a
|
||||
.L Hash_position_t
|
||||
pointer for a sequential scan on the hash table
|
||||
.LR tab .
|
||||
If
|
||||
.L flags
|
||||
is
|
||||
.L HASH_NOSCOPE
|
||||
then only the top level hash table is used, otherwise the scan includes
|
||||
all scope covered tables.
|
||||
Only one scan may be active within a collection of scoped tables.
|
||||
.L hashdone()
|
||||
must be called to terminate the scan.
|
||||
.L 0
|
||||
is returned on error.
|
||||
.TP
|
||||
.L "Hash_bucket_t* hashnext(Hash_position_t* pos)"
|
||||
Returnes a pointer to the next bucket in the sequential scan set up by
|
||||
.L hashscan()
|
||||
on
|
||||
.LR pos .
|
||||
If no elements remain then
|
||||
.L 0
|
||||
is returned.
|
||||
.TP
|
||||
.L "void hashdone(Hash_position_t* pos)"
|
||||
Completes a scan initiated by
|
||||
.L hashscan()
|
||||
on
|
||||
.LR pos .
|
||||
.TP
|
||||
.L "int hashset(Hash_table_t* tab, int flags)"
|
||||
Sets the flags for the hash table
|
||||
.L tab
|
||||
by
|
||||
.IR or ing
|
||||
in
|
||||
.LR flags .
|
||||
Only
|
||||
.L HASH_ALLOCATE
|
||||
and
|
||||
.L HASH_FIXED
|
||||
may be set.
|
||||
.TP
|
||||
.L "int hashclear(Hash_table_t* tab, int flags)"
|
||||
Clears the flags for the hash table
|
||||
.L tab
|
||||
by masking out
|
||||
.LR flags .
|
||||
Only
|
||||
.L HASH_ALLOCATE
|
||||
and
|
||||
.L HASH_FIXED
|
||||
may be cleared.
|
||||
.TP
|
||||
.L "void hashdump(Hash_table_t* tab, int flags)"
|
||||
Dumps hash table accounting info to standard error.
|
||||
If
|
||||
.L tab
|
||||
is
|
||||
.L NULL
|
||||
then all allocated hash tables are dumped, otherwise only information on
|
||||
.L tab
|
||||
is dumped.
|
||||
If
|
||||
.L flags
|
||||
is
|
||||
.L HASH_BUCKET
|
||||
then the hash bucket
|
||||
.I key-value
|
||||
pairs for each collision chain are also dumped.
|
||||
.TP
|
||||
.L "void hashsize(Hash_table_t* tab, int size)"
|
||||
Changes the size of the hash table
|
||||
.L tab
|
||||
to
|
||||
.L size
|
||||
where
|
||||
.L size
|
||||
must be a power of 2.
|
||||
Explicit calls to this routine are not necessary as hash tables
|
||||
are automatically resized.
|
||||
.TP
|
||||
.L "int strhash(char* name)"
|
||||
Hashes the null terminated character string
|
||||
.L name
|
||||
using a linear congruent pseudo-random number generator algorithm
|
||||
and returns a non-negative
|
||||
.L int
|
||||
hash value.
|
||||
.TP
|
||||
.L "int memhash(char* buf, int siz)"
|
||||
Hashes the buffer
|
||||
.L buf
|
||||
of
|
||||
.L siz
|
||||
bytes using a linear congruent pseudo-random number generator algorithm
|
||||
and returns a non-negative
|
||||
.L int
|
||||
hash value.
|
||||
.TP
|
||||
.L "long strsum(char* name, long sum)"
|
||||
Returns a running 31-bit checksum of the string
|
||||
.L name
|
||||
where
|
||||
.L sum
|
||||
is
|
||||
.L 0
|
||||
on the first call and
|
||||
the return value from a previous
|
||||
.L memsum
|
||||
or
|
||||
.L strsum
|
||||
call otherwise.
|
||||
The checksum value is consistent across all implementations.
|
||||
.TP
|
||||
.L "long memsum(char* buf, int siz, long sum)"
|
||||
Returns a running 31-bit checksum of buffer
|
||||
.L buf
|
||||
of
|
||||
.L siz
|
||||
bytes where
|
||||
.L sum
|
||||
is
|
||||
.L 0
|
||||
on the first call and
|
||||
the return value from a previous
|
||||
.L memsum
|
||||
or
|
||||
.L strsum
|
||||
call otherwise.
|
||||
The checksum value is consistent across all implementations.
|
||||
.SH "SEE ALSO"
|
||||
sum(1)
|
||||
51
cde/programs/dtksh/ksh93/src/lib/libast/man/iblocks.3
Normal file
51
cde/programs/dtksh/ksh93/src/lib/libast/man/iblocks.3
Normal file
@@ -0,0 +1,51 @@
|
||||
.\" $XConsortium: iblocks.3 /main/2 1996/10/29 15:08:38 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH IBLOCKS 3
|
||||
.SH NAME
|
||||
iblocks \- compute number file blocks used
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <ls.h>
|
||||
|
||||
long _iblocks(struct stat* \fIst\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
.L _iblocks
|
||||
returns the number of blocks used by the file whose
|
||||
.IR stat (2)
|
||||
information is pointed to by
|
||||
.IR st .
|
||||
The count includes both data and indirect blocks.
|
||||
.PP
|
||||
This routine is used by
|
||||
.B <ls.h>
|
||||
on system without the
|
||||
.LI "struct stat" st_blocks
|
||||
field.
|
||||
.SH "SEE ALSO"
|
||||
ls(1), stat(2)
|
||||
60
cde/programs/dtksh/ksh93/src/lib/libast/man/int.3
Normal file
60
cde/programs/dtksh/ksh93/src/lib/libast/man/int.3
Normal file
@@ -0,0 +1,60 @@
|
||||
.\" $XConsortium: int.3 /main/2 1996/10/29 15:08:50 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de LI
|
||||
.}S 5 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH INT 3
|
||||
.SH NAME
|
||||
int \- integral type macros
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <int.h>
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
This header defines macros for the local integral types.
|
||||
.LR int_1 ,
|
||||
.LR int_2
|
||||
and
|
||||
.L int_4
|
||||
are always defined to integral types with a size of
|
||||
1, 2 and 4 bytes respectively.
|
||||
The macros
|
||||
.LI int_ n
|
||||
where
|
||||
.I n
|
||||
is a power of 2 greater than 4 are defined if the type is supported.
|
||||
.L int_max
|
||||
is defined to be the largest support integral type.
|
||||
.L int_swap
|
||||
is the
|
||||
.IR swap (3)
|
||||
operation that converts a local
|
||||
.L int
|
||||
to canonical big-endian representation.
|
||||
.SH "SEE ALSO"
|
||||
swap(3)
|
||||
472
cde/programs/dtksh/ksh93/src/lib/libast/man/magic.3
Normal file
472
cde/programs/dtksh/ksh93/src/lib/libast/man/magic.3
Normal file
@@ -0,0 +1,472 @@
|
||||
.\" $XConsortium: magic.3 /main/2 1996/10/29 15:09:03 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de LI
|
||||
.}S 5 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH MAGIC 3
|
||||
.SH NAME
|
||||
magic \- magic file interface
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <magic.h>
|
||||
|
||||
Magic_t* magicopen(unsigned long \fIflags\fP);
|
||||
void magicclose(Magic_t* \fImagic\fP);
|
||||
|
||||
int magicload(Magic_t* \fImagic\fP, const char* \fIpath\fP, unsigned long \fIflags\fP);
|
||||
int magiclist(Magic_t* \fImagic\fP, Sfio_t* \fIsp\fP);
|
||||
|
||||
char* magictype(Magic_t* \fImagic\fP, const char* \fIpath\fP, struct stat* \fIst\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
These routines provide an interface to the
|
||||
.IR file (1)
|
||||
command magic file.
|
||||
.L magicopen
|
||||
returns a magic session handle that is passed to all of the other routines.
|
||||
.I flags
|
||||
may be
|
||||
.TP
|
||||
.L MAGIC_PHYSICAL
|
||||
Don't follow symbolic links.
|
||||
.TP
|
||||
.L MAGIC_STAT
|
||||
The stat structure
|
||||
.I st
|
||||
passed to
|
||||
.I magictype
|
||||
will contain valid
|
||||
.I stat (2)
|
||||
information.
|
||||
See
|
||||
.L magictype
|
||||
below.
|
||||
.TP
|
||||
.L MAGIC_VERBOSE
|
||||
Enable verbose error messages.
|
||||
.PP
|
||||
.L magicclose
|
||||
closes the magic session.
|
||||
.PP
|
||||
.L magicload
|
||||
loads the magic file named by
|
||||
.I path
|
||||
into the magic session.
|
||||
.I flags
|
||||
are the same as with
|
||||
.LR magicopen .
|
||||
More than one magic file can be loaded into a session;
|
||||
the files are searched in load order.
|
||||
If
|
||||
.I path
|
||||
is
|
||||
.L 0
|
||||
then the default magic file is loaded.
|
||||
.PP
|
||||
.L magiclist
|
||||
lists the magic file contents on the
|
||||
.IR sfio (3)
|
||||
stream
|
||||
.IR sp .
|
||||
This is used for debugging magic entries.
|
||||
.PP
|
||||
.L magictype
|
||||
returns the type string for
|
||||
.I path
|
||||
with optional
|
||||
.IR stat (2)
|
||||
information
|
||||
.IR st .
|
||||
If
|
||||
.I "st == 0"
|
||||
then
|
||||
.L magictype
|
||||
calls
|
||||
.L stat
|
||||
on a private stat buffer,
|
||||
else if
|
||||
.L magicopen
|
||||
was called with the
|
||||
.L MAGIC_STAT
|
||||
flag then
|
||||
.I st
|
||||
is assumed to contain valid stat information, otherwise
|
||||
.L magictype
|
||||
calls
|
||||
.L stat
|
||||
on
|
||||
.IR st .
|
||||
.L magictype
|
||||
always returns a valid string.
|
||||
If errors are encounterd on
|
||||
.I path
|
||||
then the return value will contain information on those errors, e.g.,
|
||||
.LR "cannot stat" .
|
||||
.SH FORMAT
|
||||
The magic file format is a backwards compatible extension of an
|
||||
ancient System V file implementation.
|
||||
However, with the extended format it is possible to write a single
|
||||
magic file that works on all platforms.
|
||||
Most of the net magic files floating around work with
|
||||
.LR magic ,
|
||||
but they usually double up on
|
||||
.I le
|
||||
and
|
||||
.I be
|
||||
entries that are automatically handled by
|
||||
.LR magic .
|
||||
.PP
|
||||
A magic file entry describes a procedure for determining a single file type
|
||||
based on the file pathname,
|
||||
.I stat (2)
|
||||
information, and the file data.
|
||||
An entry is a sequence of lines, each line being a record of
|
||||
.I space
|
||||
separated fields.
|
||||
The general record format is:
|
||||
.EX
|
||||
[op]offset type [mask]expression description
|
||||
.EE
|
||||
.L #
|
||||
in the first column introduces a comment.
|
||||
The first record in an entry contains no
|
||||
.LR op ;
|
||||
the remaining records for an entry contain an
|
||||
.LR op .
|
||||
Integer constants are as in C:
|
||||
.L 0x*
|
||||
or
|
||||
.L 0X*
|
||||
for hexadecimal,
|
||||
.L 0*
|
||||
for octal and decimal otherwise.
|
||||
.PP
|
||||
The
|
||||
.L op
|
||||
field may be one of:
|
||||
.TP
|
||||
.L +
|
||||
The previous records must match but the current record is optional.
|
||||
.L >
|
||||
is an old-style synonym for
|
||||
.LR + .
|
||||
.TP
|
||||
.L &
|
||||
The previous and current records must match.
|
||||
.TP
|
||||
.L {
|
||||
Starts a nesting block that is terminated by
|
||||
.LR } .
|
||||
A nesting block pushes a new context for the
|
||||
.L +
|
||||
and
|
||||
.L &
|
||||
ops.
|
||||
The
|
||||
.L {
|
||||
and
|
||||
.L }
|
||||
records have no other fields.
|
||||
.TP
|
||||
\fIid\f5{\fR
|
||||
A function declaration and call for the single character identifier
|
||||
.IR id .
|
||||
The function return is a nesting block end record
|
||||
.LR } .
|
||||
Function may be redefined.
|
||||
Functions have no arguments or return value.
|
||||
.TP
|
||||
\fIid\f5()\fR
|
||||
A call to the function
|
||||
.IR id .
|
||||
.PP
|
||||
The
|
||||
.L offset
|
||||
field is either the offset into the data upon which the current entry operates
|
||||
or a file metadata identifier.
|
||||
Offsets are either integer constants or offset expressions.
|
||||
An offset expression is contained in (...) and is a combination of
|
||||
integral arithmetic operators and the
|
||||
.L @
|
||||
indirection operator.
|
||||
Indirections take the form
|
||||
.LI @ integer
|
||||
where integer is the data offset for the indirection value.
|
||||
The size of the indirection value is taken either from one of the suffixes
|
||||
.LR B (byte, 1 char),
|
||||
.LR H (short, 2 chars),
|
||||
.LR L (long, 4 chars),
|
||||
pr
|
||||
.LR Q (quead, 8 chars),
|
||||
or from the
|
||||
.L type
|
||||
field.
|
||||
Valid file metadata identifiers are:
|
||||
.TP
|
||||
.L atime
|
||||
The string representation of
|
||||
.LR stat.st_atime .
|
||||
.TP
|
||||
.L blocks
|
||||
.LR stat.st_blocks .
|
||||
.TP
|
||||
.L ctime
|
||||
The string representation of
|
||||
.LR stat.st_ctime .
|
||||
.TP
|
||||
.L fstype
|
||||
The string representation of
|
||||
.LR stat.st_fstype .
|
||||
.TP
|
||||
.L gid
|
||||
The string representation of
|
||||
.LR stat.st_gid .
|
||||
.TP
|
||||
The
|
||||
.L stat.st_mode
|
||||
file mode bits in
|
||||
.IR modecanon (3)
|
||||
canonical representation (i.e., the good old octal values).
|
||||
.TP
|
||||
.L mtime
|
||||
The string representation of
|
||||
.LR stat.st_mtime .
|
||||
.TP
|
||||
.L nlink
|
||||
.LR stat.st_nlink .
|
||||
.TP
|
||||
.L size
|
||||
.LR stat.st_size .
|
||||
.TP
|
||||
.L name
|
||||
The file path name sans directory.
|
||||
.TP
|
||||
.L uid
|
||||
The string representation of
|
||||
.LR stat.st_uid .
|
||||
.PP
|
||||
The
|
||||
.L type
|
||||
field specifies the type of the data at
|
||||
.LR offset .
|
||||
Integral types may be prefixed by
|
||||
.L le
|
||||
or
|
||||
.L be
|
||||
for specifying exact little-endian or big-endian representation,
|
||||
but the internal algorithm automatically loops through the
|
||||
standard representations to find integral matches,
|
||||
so representation prefixes are rarely used.
|
||||
However, this looping may cause some magic entry conflicts; use the
|
||||
.L le
|
||||
or
|
||||
.L be
|
||||
prefix in these cases.
|
||||
Only one representation is used for all the records in an entry.
|
||||
Valid types are:
|
||||
.TP
|
||||
.L byte
|
||||
A 1 byte integer.
|
||||
.TP
|
||||
.L short
|
||||
A 2 byte integer.
|
||||
.TP
|
||||
.L long
|
||||
A 4 byte integer.
|
||||
.TP
|
||||
.L quad
|
||||
An 8 byte integer.
|
||||
Tests on this type may fail is the local compiler does not support
|
||||
an 8 byte integral type and the corresponding value overflows 4 bytes.
|
||||
.TP
|
||||
.L date
|
||||
The data at
|
||||
.L offset
|
||||
is interpreted as a 4 byte seconds-since-the-epoch date and
|
||||
converted to a string.
|
||||
.TP
|
||||
.L edit
|
||||
The
|
||||
.L expression
|
||||
field is an
|
||||
.IR ed (1)
|
||||
style substitution expression
|
||||
\fIdel old del new del \fP [ \fI flags \fP ]
|
||||
where the substituted value is made available to the
|
||||
.L description
|
||||
field
|
||||
.L %s
|
||||
format.
|
||||
In addition to the
|
||||
.I flags
|
||||
supported by
|
||||
.IR ed (3)
|
||||
are
|
||||
.L l
|
||||
that converts the substituted value to lower case and
|
||||
.L u
|
||||
that converts the substituted value to upper case.
|
||||
If
|
||||
.I old
|
||||
does not match the string data at
|
||||
.L offset
|
||||
then the entry record fails.
|
||||
.TP
|
||||
.L match
|
||||
.L expression
|
||||
field is a
|
||||
.IR strmatch (3)
|
||||
pattern that is matched against the string data at
|
||||
.LR offset .
|
||||
.TP
|
||||
.L string
|
||||
The
|
||||
.L expression
|
||||
field is a string that is compared with the string data at
|
||||
.LR offset .
|
||||
.PP
|
||||
The optional
|
||||
.L mask
|
||||
field takes the form
|
||||
.LI & number
|
||||
where
|
||||
.I number
|
||||
is
|
||||
.I anded
|
||||
with the integral value at
|
||||
.L offset
|
||||
before the
|
||||
.L expression
|
||||
is applied.
|
||||
.PP
|
||||
The contents of the expression field depends on the
|
||||
.LR type .
|
||||
String type expression are described in the
|
||||
.L type
|
||||
field entries above.
|
||||
.L *
|
||||
means any value and applies to all types.
|
||||
Integral
|
||||
.L type
|
||||
expression take the form [\fIoperator\fP] \fIoperand\P where
|
||||
.I operand
|
||||
is compared with the data value at
|
||||
.L offset
|
||||
using
|
||||
.IR operator .
|
||||
.I operator
|
||||
may be one of
|
||||
.LR < .
|
||||
.LR <= ,
|
||||
.LR == ,
|
||||
.LR >=
|
||||
or
|
||||
.LR > .
|
||||
.I operator
|
||||
defaults to
|
||||
.L ==
|
||||
if omitted.
|
||||
.I operand
|
||||
may be an integral constant or one of the following builtin function calls:
|
||||
.TP
|
||||
.L magic()
|
||||
A recursive call to the magic algorithm starting with the data at
|
||||
.LR offset .
|
||||
.TP
|
||||
\f5loop(\fIfunction\fP,\fIoffset\fP,\fIincrement\fP)\fR
|
||||
Call
|
||||
.I function
|
||||
starting at
|
||||
.I offset
|
||||
and increment
|
||||
.I offset
|
||||
by
|
||||
.I increment
|
||||
after each iteration.
|
||||
Iteration continues until the description text does not change.
|
||||
.PP
|
||||
The
|
||||
.L description
|
||||
field is the most important because it is this field that is presented
|
||||
to the outside world.
|
||||
When constructing description
|
||||
fields one must be very careful to follow the style layed out in the
|
||||
magic file, lest yet another layer of inconsistency creep into the system.
|
||||
The description for each matching record in an entry are concatenated
|
||||
to form the complete magic type.
|
||||
If the previous matching description in the current entry does not end with
|
||||
.I space
|
||||
and the current description is not empty and does not start with
|
||||
.I comma ,
|
||||
.I dot
|
||||
or
|
||||
.I backspace
|
||||
then a
|
||||
.I space
|
||||
is placed between the descriptions
|
||||
(most optional descriptions start with
|
||||
.IR comma .)
|
||||
The data value at
|
||||
.L offset
|
||||
can be referenced in the description using
|
||||
.L %s
|
||||
for the string types and
|
||||
.L %ld
|
||||
or
|
||||
.L %lu
|
||||
for the integral types.
|
||||
.SH FILES
|
||||
.L ../lib/file/magic
|
||||
located on
|
||||
.L $PATH
|
||||
.SH EXAMPLES
|
||||
.EX
|
||||
0 long 0x020c0108 hp s200 executable, pure
|
||||
o{
|
||||
+36 long >0 , not stripped
|
||||
+4 short >0 , version %ld
|
||||
}
|
||||
|
||||
0 long 0x020c0107 hp s200 executable
|
||||
o()
|
||||
|
||||
0 long 0x020c010b hp s200 executable, demand-load
|
||||
o()
|
||||
.EE
|
||||
The function
|
||||
.LR o() ,
|
||||
shared by 3 entries,
|
||||
determines if the executable is stripped and also extracts the version number.
|
||||
.EX
|
||||
0 long 0407 bsd 386 executable
|
||||
&mode long &0111!=0
|
||||
+16 long >0 , not stripped
|
||||
.EE
|
||||
This entry requires that the file also has execute permission.
|
||||
.SH "SEE ALSO"
|
||||
file(1), tw(1), modecanon(3)
|
||||
87
cde/programs/dtksh/ksh93/src/lib/libast/man/mem.3
Normal file
87
cde/programs/dtksh/ksh93/src/lib/libast/man/mem.3
Normal file
@@ -0,0 +1,87 @@
|
||||
.\" $XConsortium: mem.3 /main/2 1996/10/29 15:09:15 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH MEM 3
|
||||
.SH NAME
|
||||
mem \- fixed string routines
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <ast.h>
|
||||
|
||||
void mematoe(void* \fIout\fP, const void* \fIin\fP, size_t \fIn\fP);
|
||||
void* memdup(const void* \fIbuf\fP, size_t \fIn\fP)
|
||||
void memetoa(void* \fIout\fP, const void* \fIin\fP, size_t \fIn\fP);
|
||||
void* memzero(void* \fIbuf\fP, size_t \fIn\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
.L mematoe
|
||||
converts
|
||||
.I n
|
||||
ASCII characters in
|
||||
.I in
|
||||
to EBCDIC characters in
|
||||
.IR out .
|
||||
.I in
|
||||
and
|
||||
.I out
|
||||
may be the same.
|
||||
.PP
|
||||
.L memdup
|
||||
copies the
|
||||
.I n
|
||||
byte buffer
|
||||
.I buf
|
||||
to a new location provided by
|
||||
.IR malloc (3)
|
||||
and returns a pointer to the new copy.
|
||||
0 is returned if
|
||||
.IR malloc (3)
|
||||
fails.
|
||||
.PP
|
||||
.L memetoa
|
||||
converts
|
||||
.I n
|
||||
EBCDIC characters in
|
||||
.I in
|
||||
to ASCII characters in
|
||||
.IR out .
|
||||
.I in
|
||||
and
|
||||
.I out
|
||||
may be the same.
|
||||
.PP
|
||||
.L memzero
|
||||
sets the first
|
||||
.I n
|
||||
bytes in
|
||||
.I buf
|
||||
to
|
||||
.IR 0 .
|
||||
.SH "SEE ALSO"
|
||||
Proposed Bell Laboratories ASCII/EBCDIC standard, April 16, 1979.
|
||||
.br
|
||||
str(3), vmalloc(3)
|
||||
96
cde/programs/dtksh/ksh93/src/lib/libast/man/modecanon.3
Normal file
96
cde/programs/dtksh/ksh93/src/lib/libast/man/modecanon.3
Normal file
@@ -0,0 +1,96 @@
|
||||
.\" $XConsortium: modecanon.3 /main/2 1996/10/29 15:09:25 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de LI
|
||||
.}S 5 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH MODECANON 3
|
||||
.SH NAME
|
||||
modecanon \- canonical file mode representation
|
||||
.SH SYNOPSIS
|
||||
#include <modex.h>
|
||||
|
||||
int modei(int \fIexternal\fP);
|
||||
int modex(int \fIinternal\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
POSIX threw out the file type bit macros and replaced them with
|
||||
function-like macros that test file type.
|
||||
This is bad in many ways, the worst of which is that it provides
|
||||
no way for a user program to synthesize file types in the mode bits.
|
||||
.IR pax (1),
|
||||
.IR tar (1)
|
||||
and
|
||||
.IR cpio (1)
|
||||
are examples of user programs that must convert between the internal mode
|
||||
representation and a private external representation.
|
||||
These routines provide a canonical external representation
|
||||
with macros to access and synthesize the bits in the external
|
||||
representation.
|
||||
.PP
|
||||
.L modei
|
||||
takes an external mode representation
|
||||
.I external
|
||||
and returns the equivalent internal representation.
|
||||
.PP
|
||||
.L modex
|
||||
takes an internal mode representation
|
||||
.I internal
|
||||
and returns the equivalent external representation.
|
||||
.PP
|
||||
The traditional bit access macro (\f5S_\fP prefix changes to \f5X_\fP) are:
|
||||
.L X_IFMT ,
|
||||
.L X_IFSOCK ,
|
||||
.L X_IFLNK ,
|
||||
.L X_IFCTG ,
|
||||
.L X_IFREG ,
|
||||
.L X_IFBLK ,
|
||||
.L X_IFDIR ,
|
||||
.L X_IFCHR ,
|
||||
.L X_IFIFO ,
|
||||
.L X_IPERM ,
|
||||
.L X_ISUID ,
|
||||
.L X_ISGID ,
|
||||
.L X_ISVTX ,
|
||||
.L X_IRUSR ,
|
||||
.L X_IWUSR ,
|
||||
.L X_IXUSR ,
|
||||
.L X_IRGRP ,
|
||||
.L X_IWGRP ,
|
||||
.L X_IXGRP ,
|
||||
.L X_IROTH ,
|
||||
.L X_IWOTH ,
|
||||
.L X_IXOTH ,
|
||||
.L X_IRWXU ,
|
||||
.L X_IRWXG
|
||||
and
|
||||
.L X_IRWXO .
|
||||
.LI X_ITYPE( mode )
|
||||
returns the type bits for
|
||||
.IR mode .
|
||||
.SH "SEE ALSO"
|
||||
pax(1), stat(2)
|
||||
42
cde/programs/dtksh/ksh93/src/lib/libast/man/optget.3
Normal file
42
cde/programs/dtksh/ksh93/src/lib/libast/man/optget.3
Normal file
@@ -0,0 +1,42 @@
|
||||
.\" $XConsortium: optget.3 /main/2 1996/10/29 15:09:39 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH OPTGET 3
|
||||
.SH NAME
|
||||
optget \- option parse assist
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <option.h>
|
||||
|
||||
Opt_info_t opt_info;
|
||||
|
||||
int optget(char** \fIargv\fP, const char* \fIopts\fP);
|
||||
int optjoin(char** \fIargv\fP, ... [int (*\fIoptfun\fP)(char** \fIargv\fP, int \fIlast\fP)]);
|
||||
char* optusage(const char* \fIopts\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
.SH "SEE ALSO"
|
||||
383
cde/programs/dtksh/ksh93/src/lib/libast/man/path.3
Normal file
383
cde/programs/dtksh/ksh93/src/lib/libast/man/path.3
Normal file
@@ -0,0 +1,383 @@
|
||||
.\" $XConsortium: path.3 /main/2 1996/10/29 15:09:52 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de LI
|
||||
.}S 5 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH PATH 3
|
||||
.SH NAME
|
||||
path \- file path routines
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <ast.h>
|
||||
|
||||
char* pathaccess(char* \fIpath\fP, const char* \fIdirs\fP, const char* \fIa\fP, const char* \fIb\fP, int \fImode\fP);
|
||||
char* pathbin(void);
|
||||
char* pathcanon(char* \fIpath\fP, int \fIflags\fP);
|
||||
char* pathcat(char* \fIpath\fP, const char* \fIdirs\fP, int \fIsep\fP, const char* \fIa\fP, const char* \fIb\fP);
|
||||
char* pathcd(char* \fIpath\fP, const char* \fIhome\fP);
|
||||
int pathcheck(const char* \fIpackage\fP, const char* \fItool\fP, Pathcheck_t* \fIpc\fP);
|
||||
int pathgetlink(const char* \fIname\fP, char* \fIbuf\fP, int \fIsiz\fP);
|
||||
char* pathkey(char* \fIkey\fP, char* \fIattr\fP, const char* \fIlang\fP, const char* \fIpath\fP);
|
||||
char* pathnext(char* \fIpath\fP, char* \fIextra\fP, long* \fIvisits\fP);
|
||||
char* pathpath(char* \fIpath\fP, const char* \fIp\fP, const char* \fIa\fP, int \fImode\fP);
|
||||
char* pathprobe(char* \fIpath\fP, char* \fIattr\fP, const char* \fIlang\fP, const char* \fItool\fP, const char* \fIproc\fP, int \fIop\fP);
|
||||
char* pathrepl(char* \fIpath\fP, const char* \fImatch\fP, const char* \fIreplace\fP);
|
||||
int pathsetlink(const char* \fItext\fP, char* \fIname\fP);
|
||||
char* pathshell(void);
|
||||
int pathstat(const char* \fIpath\fP, struct stat* \fIst\fP);
|
||||
char* pathtemp(char* \fIpath\fP, const char* \fIdir\fP, const char* \fIpfx\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
These routines operate on file path names.
|
||||
Path buffers are assumed to be of size
|
||||
.LR PATH_MAX .
|
||||
.L <ast.h>
|
||||
always defines
|
||||
.LR PATH_MAX ,
|
||||
even if it indeterminant on the local system.
|
||||
Yes, this was probably a bad choice, but it was made about 10 years ago.
|
||||
We will probably move to a <stk.h> based implementation.
|
||||
.PP
|
||||
.L pathaccess
|
||||
constructs a path in
|
||||
.L path
|
||||
to the file
|
||||
.L a/b
|
||||
with access
|
||||
.L mode
|
||||
using the
|
||||
.L :
|
||||
separated directories in
|
||||
.IR dirs .
|
||||
Both
|
||||
.I a
|
||||
and
|
||||
.I b
|
||||
may be
|
||||
.LR 0 .
|
||||
.L mode
|
||||
is the inclusive-or of:
|
||||
.TP
|
||||
.L F_OK
|
||||
File exists.
|
||||
.TP
|
||||
.L R_OK
|
||||
Read permission on file.
|
||||
.TP
|
||||
.L W_OK
|
||||
Write permission on file.
|
||||
.TP
|
||||
.L X_OK
|
||||
Execute permission on file.
|
||||
.TP
|
||||
.L PATH_REGULAR
|
||||
A regular file.
|
||||
.TP
|
||||
.L PATH_ABSOLUTE
|
||||
Generated path name is rooted at
|
||||
.LR / .
|
||||
.I path
|
||||
is returned, 0 on error.
|
||||
.PP
|
||||
.L pathbin
|
||||
returns a pointer to the
|
||||
.L :
|
||||
separated list of directories to search for executable commands.
|
||||
The
|
||||
.L PATH
|
||||
environment variable is first consulted.
|
||||
If not defined then
|
||||
.L confstr(_CS_PATH,...)
|
||||
is used.
|
||||
A valid string is always returned.
|
||||
.PP
|
||||
.L pathcanon
|
||||
canonicalizes the path
|
||||
.I path
|
||||
in place.
|
||||
A pointer to the trailing 0 in the canonicalized path is returned.
|
||||
A canonical path has:
|
||||
redundant
|
||||
.L .
|
||||
and
|
||||
.L /
|
||||
removed;
|
||||
.L ..
|
||||
moved to the front;
|
||||
.L /..
|
||||
preserved for super root hacks;
|
||||
.L ...
|
||||
resolved if
|
||||
.IR fs3d (3)
|
||||
is enabled.
|
||||
.I flags is the inclusive-or of:
|
||||
.TP
|
||||
.L PATH_DOTDOT
|
||||
Each
|
||||
.L ..
|
||||
is checked for access.
|
||||
.TP
|
||||
.L PATH_EXISTS
|
||||
Path must exist at each component.
|
||||
.TP
|
||||
.L PATH_PHYSICAL
|
||||
Symbolic links are resolved at each component.
|
||||
.PP
|
||||
0 is returned on error.
|
||||
If an error occurs and either of
|
||||
.L PATH_DOTDOT
|
||||
or
|
||||
.L PATH_EXISTS
|
||||
is set then
|
||||
.I path
|
||||
will contain the components following the failure point.
|
||||
.PP
|
||||
.L pathcat
|
||||
concatenates the first
|
||||
.I sep
|
||||
separated path component in
|
||||
.I dirs
|
||||
with the path components
|
||||
.I a
|
||||
and
|
||||
.I b
|
||||
into
|
||||
.LR path .
|
||||
The path is constructed in
|
||||
.I path
|
||||
by separating each path component with
|
||||
.IR / .
|
||||
Both
|
||||
.I a
|
||||
and
|
||||
.I b
|
||||
may be
|
||||
.LR 0 .
|
||||
A pointer to the next
|
||||
.I sep
|
||||
separated component in
|
||||
.I dirs
|
||||
is returned,
|
||||
.L 0
|
||||
when there are no more components.
|
||||
.L pathcat
|
||||
is used by
|
||||
.LR pathaccess .
|
||||
.PP
|
||||
.L pathcd
|
||||
sets the current working directory to
|
||||
.I path
|
||||
via
|
||||
.IR chdir (2).
|
||||
If
|
||||
.I path
|
||||
is longer than
|
||||
.L PATH_MAX
|
||||
then it is split up into a sequence of relative paths and
|
||||
.I chdir
|
||||
is called on each of these.
|
||||
For any given system, if you got to a directory, then
|
||||
.L pathcd
|
||||
can get you back, modulo permission and link changes.
|
||||
.PP
|
||||
.L pathcheck
|
||||
is a stub for license libraries.
|
||||
See
|
||||
.IR license (3).
|
||||
.PP
|
||||
.L pathgetlink
|
||||
returns the 0-terminated symbolic link text for
|
||||
.I path
|
||||
in the buffer
|
||||
.I bu
|
||||
of size
|
||||
.IR siz .
|
||||
The link text length is returned on success, \-1 on error.
|
||||
Weird
|
||||
.I universe (1)
|
||||
interactions with dynamic symbolic links are handled
|
||||
by converting non-standard dynamic link text to
|
||||
.LI .../$( UNIVERSE )/...
|
||||
.L pathsetsymlink
|
||||
converts in the other direction.
|
||||
.PP
|
||||
.L pathkey
|
||||
generates in
|
||||
.I key
|
||||
a 14 character lookup key (plus terminating 0) for the language
|
||||
.I lang
|
||||
processor in
|
||||
.IR path .
|
||||
A poihter to the key is returned, 0 on error.
|
||||
If
|
||||
.I "key == 0"
|
||||
then space is allocated via
|
||||
.IR malloc (3).
|
||||
Key specific attribute
|
||||
.I name=value
|
||||
pairs are copied into
|
||||
.I attr
|
||||
if
|
||||
.IR "attr != 0" .
|
||||
.PP
|
||||
.L pathpath
|
||||
constructs in
|
||||
.I path
|
||||
a path to
|
||||
.I p
|
||||
with
|
||||
.IR access (2)
|
||||
mode
|
||||
.I mode
|
||||
using the directories from
|
||||
.LR pathbin() .
|
||||
If \fIa != 0\fP then
|
||||
.IR a ,
|
||||
.IR argv [0]
|
||||
(if available via
|
||||
.IR optget (3)),
|
||||
and the
|
||||
.L _
|
||||
environment variable (set by
|
||||
.IR ksh (1) )
|
||||
are used for related root searching.
|
||||
If
|
||||
.I p
|
||||
also contains a
|
||||
.L /
|
||||
then
|
||||
.I ../p
|
||||
is searched for.
|
||||
.PP
|
||||
.L pathprobe
|
||||
generates in
|
||||
.I path
|
||||
the full path name of the
|
||||
.I tool
|
||||
specific
|
||||
.IR probe (1)
|
||||
information file for the
|
||||
.I lang
|
||||
langauge processor
|
||||
.IR proc .
|
||||
If
|
||||
.I "path == 0"
|
||||
then space is allocated via
|
||||
.IR malloc (3).
|
||||
Probe attribute
|
||||
.I name=value
|
||||
pairs are copied into
|
||||
.I attr
|
||||
if
|
||||
.IR "attr != 0" .
|
||||
.I op
|
||||
may be one of:
|
||||
.TP
|
||||
.B \-1
|
||||
return the path name with no access checks or generation
|
||||
.TP
|
||||
.B 0
|
||||
message emitted information must be generated via
|
||||
.IR probe (1)
|
||||
.TP
|
||||
.B 1
|
||||
no message emitted information must be probed via
|
||||
.IR probe (1)
|
||||
.PP
|
||||
0 is returned if the information does not exist and cannot be generated.
|
||||
.PP
|
||||
.L pathrepl
|
||||
does an in-place replacement of the first occurrence of
|
||||
.I /match/
|
||||
with
|
||||
.I /replace/
|
||||
in
|
||||
.IR path .
|
||||
.PP
|
||||
.L pathsetlink
|
||||
creates a symbolic link
|
||||
.I text
|
||||
in the path
|
||||
.IR name .
|
||||
See
|
||||
.L pathgetlink
|
||||
above for weird
|
||||
.IR universe (1)
|
||||
interactions hidden by this routine.
|
||||
.PP
|
||||
.L pathshell
|
||||
returns a pointer to the pathname for the shell for the current process.
|
||||
The
|
||||
.L SHELL
|
||||
environment variable is first consulted, but is rejected under suspicious
|
||||
ownership/setuid conditions of if it seems to point to
|
||||
.IR csh (1) ;
|
||||
otherwise
|
||||
.L confstr(_CS_SHELL,...)
|
||||
is used.
|
||||
A valid string is always returned.
|
||||
.PP
|
||||
.L pathstat
|
||||
first tries
|
||||
.LI stat( path,st )
|
||||
and if that fails it tries
|
||||
.LI lstat( path,st ).
|
||||
The
|
||||
.L stat
|
||||
or
|
||||
.L lstat
|
||||
return value is returned.
|
||||
.PP
|
||||
.L pathtemp
|
||||
generates in
|
||||
.I path
|
||||
a temporary file path name of the form
|
||||
.I dir/pfx<pid>.<suf>
|
||||
where the length of
|
||||
.IR pfx ,
|
||||
if !=0, is limited to 5, the length of
|
||||
.I <pid>
|
||||
(the base 64 representation of the current process id)
|
||||
is limited to 3, and
|
||||
.I <suf>
|
||||
(an internally generated suffix that avoid file confilicts)
|
||||
is limited to 3.
|
||||
The generated path name conforms to the classic UNIX 14 char and the DOS
|
||||
.LR 8.3
|
||||
limitations.
|
||||
Both
|
||||
.I dir
|
||||
and
|
||||
.I pfx
|
||||
may be
|
||||
.LR 0 .
|
||||
.IR access (2)
|
||||
is used to avoid file conflicts but the generated path name is not created,
|
||||
so you could lose in a race.
|
||||
.SH "SEE ALSO"
|
||||
3d(1), access(2), confstr(3), fs3d(3), lstat(2), stat(2)
|
||||
140
cde/programs/dtksh/ksh93/src/lib/libast/man/preroot.3
Normal file
140
cde/programs/dtksh/ksh93/src/lib/libast/man/preroot.3
Normal file
@@ -0,0 +1,140 @@
|
||||
.\" $XConsortium: preroot.3 /main/2 1996/10/29 15:10:08 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH PREROOT 3
|
||||
.SH NAME
|
||||
preroot \- preroot support
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <preroot.h>
|
||||
|
||||
char* getpreroot(char* \fIpath\fP, char* \fIcmd\fP);
|
||||
int ispreroot(char* \fIdir\fP);
|
||||
int realopen(char* \fIpath\fP, int \fImode\fP, int \fIperm\fP);
|
||||
void setpreroot(char** \fIargv\fP, char* \fIdir\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.I preroot
|
||||
routines manipulate the process preroot.
|
||||
.I preroot
|
||||
is a kernel supported per-process two level viewpath.
|
||||
All pathnames rooted at
|
||||
.L /
|
||||
are first searched for in the process preroot directory
|
||||
and then in the system root directory.
|
||||
Setting the process preroot is a priveleged operation controlled by the
|
||||
.IR /etc/preroot (1)
|
||||
command.
|
||||
.PP
|
||||
.L <preroot.h>
|
||||
defines the symbol
|
||||
.B FS_PREROOT
|
||||
for those systems that support preroot.
|
||||
The following routines are valid only when
|
||||
.B FS_PREROOT
|
||||
is defined:
|
||||
.TP
|
||||
.L getpreroot
|
||||
returns a pointer to the absolute pathname of the preroot directory
|
||||
for the executable
|
||||
.IR cmd .
|
||||
The result is placed in
|
||||
.IR path .
|
||||
If
|
||||
.I path
|
||||
is
|
||||
.B 0
|
||||
then
|
||||
.IR malloc (3)
|
||||
is used to allocate the pathname space.
|
||||
.B 0
|
||||
is returned if
|
||||
.I cmd
|
||||
has no preroot or if an error was encountered.
|
||||
In this case
|
||||
.I errno
|
||||
is set to indicate the error.
|
||||
.TP
|
||||
.L ispreroot
|
||||
Non-zero is returned if
|
||||
.I dir
|
||||
is the current process preroot.
|
||||
If
|
||||
.I dir
|
||||
is
|
||||
.B 0
|
||||
then non-zero is returned if the current process has a preroot.
|
||||
.TP
|
||||
.L realopen
|
||||
temporarily disables the process preroot and does an
|
||||
.IR open (3)
|
||||
relative to the system root directory.
|
||||
The return value from
|
||||
.I open
|
||||
is returned.
|
||||
If there is no preroot then
|
||||
.I realopen
|
||||
is equivalent to
|
||||
.IR open .
|
||||
.TP
|
||||
.L setpreroot
|
||||
calls
|
||||
.IR execvp (3)
|
||||
as
|
||||
.L "execvp(a\fIrgv\fP[0],\fIargv\fP)"
|
||||
with the process preroot set to
|
||||
.IR dir .
|
||||
.I argv
|
||||
must be a
|
||||
.BR 0 -terminated
|
||||
argument array.
|
||||
If
|
||||
.I argv
|
||||
is
|
||||
.B 0
|
||||
then the value of
|
||||
.I opt_argv
|
||||
from
|
||||
.IR optget (3)
|
||||
is used.
|
||||
.L setpreroot
|
||||
returns immediately if
|
||||
.I dir
|
||||
is already the process preroot.
|
||||
.SH "SEE ALSO"
|
||||
/etc/preroot(1)
|
||||
.SH BUGS
|
||||
Preroot semantics should be preserved when reading directories.
|
||||
The
|
||||
.I ast
|
||||
.IR directory (3)
|
||||
routines do this.
|
||||
.IR 3d (1)
|
||||
viewpathing does
|
||||
.I preroot
|
||||
the right way.
|
||||
308
cde/programs/dtksh/ksh93/src/lib/libast/man/proc.3
Normal file
308
cde/programs/dtksh/ksh93/src/lib/libast/man/proc.3
Normal file
@@ -0,0 +1,308 @@
|
||||
.\" $XConsortium: proc.3 /main/2 1996/10/29 15:10:21 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH PROC 3
|
||||
.SH NAME
|
||||
proc \- process control routines
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <proc.h>
|
||||
|
||||
Proc_t* procopen(const char* \fIcommand\fP, char** \fIargv\fP, char** \fIenvv\fP, long* \fIopv\fP, long \fIflags\fP);
|
||||
int procfree(Proc_t* \fIproc\fP);
|
||||
int procclose(Proc_t* \fIproc\fP);
|
||||
int procrun(const char* \fIcommand\fP, char** \fIargv\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
These routines provide a portable interface to process creation and execution.
|
||||
They work on systems with
|
||||
.IR fork (2)
|
||||
and
|
||||
.IR exec (2)
|
||||
as well as on systems with only
|
||||
.IR spawnve (2)
|
||||
or
|
||||
.IR spanwveg (3).
|
||||
.PP
|
||||
.L procopen
|
||||
runs
|
||||
.I command
|
||||
with arguments
|
||||
.IR argv ,
|
||||
environment modifications in
|
||||
.IR envv ,
|
||||
file descriptor, signal and process group operations in
|
||||
.I opv
|
||||
and flags in
|
||||
.IR flags .
|
||||
.PP
|
||||
.I command
|
||||
is searched for using the
|
||||
.L PATH
|
||||
environment variable from the calling environment.
|
||||
If
|
||||
.I command
|
||||
is
|
||||
.L 0
|
||||
then the current shell is used (see
|
||||
.IR pathshell (3)).
|
||||
If
|
||||
.I envv
|
||||
is not
|
||||
.L 0
|
||||
then it is a
|
||||
.L 0
|
||||
terminated vector of
|
||||
\fIname\fP[=\fIvalue\fP]
|
||||
strings that are added to the
|
||||
.I command
|
||||
environment using
|
||||
.IR setenviron (3).
|
||||
If
|
||||
.I name
|
||||
appears in the parent environment then its value is replaced with the new
|
||||
.IR value .
|
||||
If
|
||||
.RI = value
|
||||
is omitted then
|
||||
.I name
|
||||
is removed from the child environment.
|
||||
The
|
||||
.L _
|
||||
environment variable is set to contain the pathname for
|
||||
.I command
|
||||
and will appear at the top of the child environment.
|
||||
.PP
|
||||
If
|
||||
.I opv
|
||||
is not
|
||||
.L 0
|
||||
then it is a 0 terminaled vector of operations to perform.
|
||||
In the following
|
||||
.I context
|
||||
is a combination of
|
||||
.L PROC_FD_CHILD
|
||||
and
|
||||
.L PROC_FD_PARENT
|
||||
for the child and parent process context respectively.
|
||||
Valid operations are:
|
||||
.TP
|
||||
\f5PROC_FD_CLOSE(\fIfd\fP,\fIcontext\fP)\fR
|
||||
The file descriptor
|
||||
.I fd
|
||||
is closed in
|
||||
.IR context .
|
||||
.TP
|
||||
\f5PROC_FD_DUP(\fIfrom\fP,\fIto\fP,\fIcontext\fP)\fR
|
||||
The file descriptor
|
||||
.I from
|
||||
is
|
||||
.IR dup (2)'d
|
||||
into the file descriptor
|
||||
.I to
|
||||
in
|
||||
.IR context .
|
||||
.TP
|
||||
\f5PROC_SIG_DFL(\fIsig\fP)\fR
|
||||
The signal handler for
|
||||
.I sig
|
||||
is set to
|
||||
.L SIG_DFL
|
||||
in the child context.
|
||||
.TP
|
||||
\f5PROC_SIG_IGN(\fIsig\fP)\fR
|
||||
The signal handler for
|
||||
.I sig
|
||||
is set to
|
||||
.L SIG_IGN
|
||||
in the child context.
|
||||
.TP
|
||||
\f5PROC_SYS_PGRP(\fIpgid\fP)\fR
|
||||
The child process group is set to
|
||||
.IR pgid .
|
||||
.I pgid
|
||||
may have the following values:
|
||||
.TP
|
||||
.L <0
|
||||
The child process becomes a session leader.
|
||||
.TP
|
||||
.L 0
|
||||
The child process is in the parent process group.
|
||||
.TP
|
||||
.L 1
|
||||
The child process becomes a process group leader.
|
||||
.TP
|
||||
.L >1
|
||||
The child process joins the process group
|
||||
.IR pgid .
|
||||
.TP
|
||||
\f5PROC_SYS_UMASK(\fImask\fP)\fR
|
||||
The child process group file creation mask is set to
|
||||
.IR mask .
|
||||
.PP
|
||||
.I flags
|
||||
is the inclusive-or of the following:
|
||||
.TP
|
||||
.L PROC_ARGMOD
|
||||
.I "argv[-1]"
|
||||
and
|
||||
.I "argv[0]"
|
||||
may be modified.
|
||||
This is an optimization that avoids an environment vector
|
||||
.I realloc(3)
|
||||
when
|
||||
.I command
|
||||
is a shell script.
|
||||
.TP
|
||||
.L PROC_BACKGROUND
|
||||
Standard shell
|
||||
.L &
|
||||
setup is done for the child process.
|
||||
.TP
|
||||
.L PROC_CLEANUP
|
||||
Parent process redirection file discriptors are closed on error.
|
||||
.TP
|
||||
.L PROC_DAEMON
|
||||
Standard daemon setup is done for the child process.
|
||||
.TP
|
||||
.L PROC_ENVCLEAR
|
||||
The child environment is cleared before
|
||||
.I envv
|
||||
is added.
|
||||
.TP
|
||||
.L PROC_GID
|
||||
The child effective group id is set to the real group id.
|
||||
.TP
|
||||
.L PROC_IGNORE
|
||||
Parent pipe errors are ignored.
|
||||
.TP
|
||||
.L PROC_OVERLAY
|
||||
The current process is overlayed by
|
||||
.I command
|
||||
if possible
|
||||
(i.e., the
|
||||
.IR fork (2)
|
||||
call is omitted).
|
||||
.TP
|
||||
.L PROC_PARANOID
|
||||
Paranoid:
|
||||
.I command
|
||||
is searched using the default standard
|
||||
.LR PATH ;
|
||||
the child environment variable
|
||||
.L PATH
|
||||
is set to the default standard;
|
||||
the
|
||||
.L PROC_GID
|
||||
and
|
||||
.L PROC_UID
|
||||
modes are set;
|
||||
only
|
||||
.L /bin/sh
|
||||
is used to execute
|
||||
.I command
|
||||
if it is a shell script.
|
||||
.TP
|
||||
.L PROC_PRIVELEGED
|
||||
If the effective user id is
|
||||
.L 0
|
||||
then the child real user id is set to
|
||||
.L 0
|
||||
and the child real group id is set to the effective group id.
|
||||
.TP
|
||||
.L PROC_READ
|
||||
.I proc.rfd
|
||||
is connected to
|
||||
.IR command 's
|
||||
standard output.
|
||||
.TP
|
||||
.L PROC_SESSION
|
||||
The child process becomes a session group leader.
|
||||
(Equivalent to the
|
||||
.I opv
|
||||
entry
|
||||
.LR PROC_SYS_PGRP(-1) .)
|
||||
.TP
|
||||
.L PROC_UID
|
||||
The child effective user id is set to the real user id.
|
||||
.TP
|
||||
.L PROC_WRITE
|
||||
.I proc.wfd
|
||||
is connected to
|
||||
.IR commands 's
|
||||
standard input.
|
||||
.PP
|
||||
The return value is a pointer to a structure with the following members:
|
||||
.TP
|
||||
.L "pid_t \fIpid\fP"
|
||||
The child process id.
|
||||
.TP
|
||||
.L "pid_t \fIpgrp\fP"
|
||||
The child process group.
|
||||
.TP
|
||||
.L "int \fIrfd\fP"
|
||||
A read file descriptor connected to
|
||||
.IR command 's
|
||||
standard output.
|
||||
.TP
|
||||
.L "int \fIwfd\fP"
|
||||
A write file descriptor connected to
|
||||
.IR command 's
|
||||
standard input.
|
||||
.PP
|
||||
If an error occurs then
|
||||
.L 0
|
||||
is returned.
|
||||
.PP
|
||||
.L procclose
|
||||
waits for the process
|
||||
.I proc
|
||||
to complete and then closes the command stream
|
||||
.IR proc .
|
||||
The command exit status is returned.
|
||||
.L -1
|
||||
is returned if the child portion of
|
||||
.L procopen
|
||||
failed.
|
||||
.PP
|
||||
.L procfree
|
||||
frees the process stream without waiting for
|
||||
.I command
|
||||
to complete.
|
||||
Presumably some other mechanism will be used to wait for
|
||||
.IR proc.pid .
|
||||
.PP
|
||||
.L procrun
|
||||
combines
|
||||
.L procopen
|
||||
and
|
||||
.L procclose
|
||||
with the flags
|
||||
.L PROC_GID|PROC_UID
|
||||
and returns the command exit status.
|
||||
.SH "SEE ALSO"
|
||||
popen(3), sfpopen(3), spawnveg(3), system(3)
|
||||
206
cde/programs/dtksh/ksh93/src/lib/libast/man/re.3
Normal file
206
cde/programs/dtksh/ksh93/src/lib/libast/man/re.3
Normal file
@@ -0,0 +1,206 @@
|
||||
.\" $XConsortium: re.3 /main/3 1995/11/01 17:47:14 rswiston $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de LI
|
||||
.}S 5 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH RE 3
|
||||
.SH NAME
|
||||
recomp, reexec, ressub, refree, reerror \(mi regular expression library
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <re.h>
|
||||
|
||||
Re_program_t* recomp(char* \fIpattern\fP, int \fIflags\fP);
|
||||
int reexec(Re_program_t* \fIre\fP, char* \fIsource\fP);
|
||||
void ressub(Re_program_t* \fIre\fP, Sfio_t* \fIsp\fP, char* \fIold\fP, char* \fInew\fP, int \fIflags\fP);
|
||||
void reerror(char* \fImessage\fP);
|
||||
void refree(Re_program_t* \fIre\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
.L recomp
|
||||
compiles a regular expression in
|
||||
.I pattern
|
||||
and returns a pointer to the compiled regular expression.
|
||||
The space is allocated by
|
||||
.IR malloc (3)
|
||||
and may be released by
|
||||
.LR refree .
|
||||
Regular expressions are as in
|
||||
.IR egrep (1)
|
||||
except that newlines are treated as ordinary
|
||||
characters and
|
||||
.L $
|
||||
matches the end of a null-terminated string.
|
||||
.I flags
|
||||
may be
|
||||
.L RE_EDSTYLE
|
||||
which specifies
|
||||
.IR ed (1)
|
||||
style special characters,
|
||||
.LR \e( ,
|
||||
.LR \e) ,
|
||||
.LR \e? ,
|
||||
.L \e+
|
||||
and
|
||||
.L \e|
|
||||
for the
|
||||
.IR egrep (1)
|
||||
.LR ( ,
|
||||
.LR ) ,
|
||||
.LR ? ,
|
||||
.L +
|
||||
and
|
||||
.LR | ,
|
||||
respectively.
|
||||
.PP
|
||||
.L reexec
|
||||
matches the null-terminated
|
||||
.I source
|
||||
string against the compiled regular expression
|
||||
.I re
|
||||
from a previous call to
|
||||
.LR recomp .
|
||||
If it matches,
|
||||
.L reexec
|
||||
returns a non-zero value.
|
||||
If
|
||||
.I flags
|
||||
is
|
||||
.L RE_MATCH
|
||||
then the array
|
||||
.I re\->match
|
||||
is filled with character pointers to the substrings of
|
||||
.I source
|
||||
that correspond to the
|
||||
parenthesized subexpressions of
|
||||
.IR pattern :
|
||||
.I re\->match[i].sp
|
||||
points to the beginning and
|
||||
.I re\->match[i].ep
|
||||
points just beyond
|
||||
the end of substring
|
||||
.IR i .
|
||||
(Subexpression
|
||||
.I i
|
||||
begins at the
|
||||
.IR i th
|
||||
matched left parenthesis, counting from 1.)
|
||||
Pointers in
|
||||
.I re\->match[0]
|
||||
pick out the substring that corresponds to
|
||||
the entire regular expression.
|
||||
Unused elements of
|
||||
.I re\->match
|
||||
are filled with zeros.
|
||||
Matches involving
|
||||
.LR * ,
|
||||
.LR + ,
|
||||
and
|
||||
.L ?
|
||||
are extended as far as possible.
|
||||
A maximum of 9 subexpressions will be matched.
|
||||
The structure of elements of
|
||||
.I re\->match
|
||||
is:
|
||||
.nf
|
||||
.ta 8n
|
||||
typedef struct
|
||||
{
|
||||
char* sp;
|
||||
char* ep;
|
||||
} rematch;
|
||||
.fi
|
||||
.LP
|
||||
.L ressub
|
||||
places in the
|
||||
.IR sfio (3)
|
||||
stream
|
||||
.I sp
|
||||
a substitution instance of
|
||||
.I old
|
||||
to
|
||||
.I new
|
||||
in
|
||||
.I source
|
||||
in the context of the last
|
||||
.L reexec
|
||||
performed on
|
||||
.IR re\->match .
|
||||
Each instance of
|
||||
.LI \e n ,
|
||||
where
|
||||
.I n
|
||||
is a digit, is replaced by the
|
||||
string delimited by
|
||||
.LI re\->match[ n ].sp
|
||||
and
|
||||
.LI re\->match[ n ].ep .
|
||||
Each instance of
|
||||
.L &
|
||||
is replaced by the string delimited by
|
||||
.I re\->match[0].sp
|
||||
and
|
||||
.IR re\->match[0].ep .
|
||||
If
|
||||
.L RE_ALL
|
||||
is set in
|
||||
.I flags
|
||||
then all occurrences of
|
||||
.I old
|
||||
are replaced by
|
||||
.IR new .
|
||||
If
|
||||
.L RE_LOWER
|
||||
.RL [ RE_UPPER ]
|
||||
is set in
|
||||
.I flags
|
||||
then
|
||||
.I old
|
||||
is converted to lower [upper] case.
|
||||
.LP
|
||||
.L reerror,
|
||||
called whenever an error is detected in
|
||||
.L recomp,
|
||||
.L reexec,
|
||||
or
|
||||
.L ressub,
|
||||
writes the string
|
||||
.I msg
|
||||
on the standard error file and exits.
|
||||
.L reerror
|
||||
may be replaced to perform
|
||||
special error processing.
|
||||
.SH DIAGNOSTICS
|
||||
.L recomp
|
||||
returns 0 for an invalid expression or other failure.
|
||||
.L reexec
|
||||
returns 1 if
|
||||
.I source
|
||||
is accepted, 0 otherwise.
|
||||
.SH "SEE ALSO"
|
||||
ed(1), grep(1), expr(1)
|
||||
68
cde/programs/dtksh/ksh93/src/lib/libast/man/setenviron.3
Normal file
68
cde/programs/dtksh/ksh93/src/lib/libast/man/setenviron.3
Normal file
@@ -0,0 +1,68 @@
|
||||
.\" $XConsortium: setenviron.3 /main/2 1996/10/29 15:10:49 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH LIBAST 3
|
||||
.SH NAME
|
||||
setenviron \- set environment value
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <ast.h>
|
||||
|
||||
char* setenviron(const char* \fIkey\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
.L setenviron
|
||||
controls environment
|
||||
.I name=value
|
||||
pairs.
|
||||
.L setenviron("\fIname=value\fP")
|
||||
adds
|
||||
.I name
|
||||
to the environment and returns a pointer to a
|
||||
.IR strdup (3)
|
||||
copy of
|
||||
.IR name=value .
|
||||
.L setenviron("\fIname\fP")
|
||||
removes
|
||||
.I name
|
||||
from the environment and returns the empty string.
|
||||
.L setenviron(0)
|
||||
reserves a few slots in an internal array and is usually called by
|
||||
a parent process that expects many children.
|
||||
0 is returned on error.
|
||||
.L setenviron
|
||||
preserves the
|
||||
.IR ksh (1)
|
||||
convention of
|
||||
.L _
|
||||
as the first environment variable name.
|
||||
.SH "SEE ALSO"
|
||||
env(1), exec(2)
|
||||
.SH BUGS
|
||||
POSIX will eventually settle on an interface.
|
||||
It has already picked a few of the names we did in .2 drafts.
|
||||
This is about the third name change for ours.
|
||||
171
cde/programs/dtksh/ksh93/src/lib/libast/man/sfdisc.3
Normal file
171
cde/programs/dtksh/ksh93/src/lib/libast/man/sfdisc.3
Normal file
@@ -0,0 +1,171 @@
|
||||
.\" $XConsortium: sfdisc.3 /main/2 1996/10/29 15:10:58 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de LI
|
||||
.}S 5 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH SFDISC 3
|
||||
.SH NAME
|
||||
sfdisc \- some common sfio disciplines
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <sfdisc.h>
|
||||
|
||||
typedef int (*Sf_key_lookup_t)(void* \fIhandle\fP, const char* \fIname\fP, const char* \fIop\fP, int \fIcc\fP, char** str_\fIptr\fP, long* num_\fIptr\fP);
|
||||
typedef char* (*Sf_key_convert_t)(void* \fIhandle\fP, const char* \fIname\fP, const char* \fIop\fP, int \fIcc\fP, char* str_\fIvalue\fP, long num_\fIvalue\fP);
|
||||
|
||||
int sfkeyprintf(Sfio_t* \fIsp\fP, void* \fIhandle\fP, const char* \fIformat\fP, Sf_key_lookup_t \fIlookup\fP, Sf_key_convert_t \fIconvert\fP);
|
||||
|
||||
int sflowio(Sfio_t* \fIsp\fP);
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
.L sfkeyprintf
|
||||
provides support for
|
||||
.IR sfio (3)
|
||||
.LI %( keyword [[:;=] op ])
|
||||
printf formatting.
|
||||
Rather than getting format values from the next argument, the
|
||||
.L "%(...)"
|
||||
style gets the format value by doing a lookup on
|
||||
.LR keyword .
|
||||
Output is written to the
|
||||
.IR sfio (3)
|
||||
stream
|
||||
.I sp
|
||||
under control of the
|
||||
.L printf
|
||||
format string
|
||||
.IR format .
|
||||
.I handle
|
||||
is a user supplied pointer that is passed untouched to
|
||||
the user supplied routines
|
||||
.I lookup
|
||||
and
|
||||
.IR convert .
|
||||
.PP
|
||||
.I lookup
|
||||
determines the value for
|
||||
.I name
|
||||
with optional information
|
||||
.I op
|
||||
and places the value either in
|
||||
.I *str_ptr
|
||||
or
|
||||
.IR *num_ptr .
|
||||
.I cc
|
||||
is the
|
||||
.L printf
|
||||
conversion character
|
||||
(e.g.,
|
||||
.LR "'s'" ,
|
||||
.LR "'d'" ,
|
||||
etc.) and may provide a hint to the
|
||||
.I name
|
||||
lookup.
|
||||
.PP
|
||||
.I convert
|
||||
is called when an format unknown conversion character
|
||||
.I cc
|
||||
is encountered.
|
||||
.I name
|
||||
is the keyword name from the format specification,
|
||||
.I op
|
||||
is the optional operation string,
|
||||
.L 0
|
||||
if not specified,
|
||||
.I str_value
|
||||
is its string value,
|
||||
.L 0
|
||||
if it is not a string,
|
||||
and
|
||||
.I num_value
|
||||
is the numeric value if
|
||||
.IR "str_value == 0" .
|
||||
.I convert
|
||||
returns a pointer to the converted string,
|
||||
.L 0
|
||||
on error.
|
||||
.PP
|
||||
.L sfkeyprintf
|
||||
supplies two operations:
|
||||
.TP
|
||||
\f5:case:\fIpattern\d1\u\fP:\fIformat\d1\u\fP:...:\fIpattern\dn\u\fP:\fIformat\dn\u\fR
|
||||
.L case
|
||||
matches the string value of
|
||||
.L keyword
|
||||
against
|
||||
.I pattern\d1\u
|
||||
through
|
||||
.IR pattern\dn\u .
|
||||
using
|
||||
.IR strmatch (3) .
|
||||
.I format\di\u
|
||||
corresponding to the first matching pattern
|
||||
.I pattern\di\u
|
||||
from the left is pushed back on to the
|
||||
.L sfkeyprintf
|
||||
format input.
|
||||
If nothing matches then nothing is output to
|
||||
.IR sp .
|
||||
Any delimiter may appear after
|
||||
.LR case .
|
||||
.TP
|
||||
\f5:edit:\fIold\fP:\fInew\fP:\fIflags\fP[:...]
|
||||
Performs an
|
||||
.IR ed (1)-style
|
||||
substitution on the string value of
|
||||
.IR keyword .
|
||||
Multiple sets of
|
||||
.I old,new,flags
|
||||
may be specified; they are applied in order from left to right.
|
||||
In addition to the
|
||||
.I flags
|
||||
supported by
|
||||
.IR ed (3)
|
||||
are
|
||||
.L l
|
||||
that converts the substituted value to lower case and
|
||||
.L u
|
||||
that converts the substituted value to upper case.
|
||||
Any delimiter may appear after
|
||||
.LR edit .
|
||||
.PP
|
||||
.L sfslowio
|
||||
pushes an
|
||||
.IR sfio (3)
|
||||
discipline onto the stream
|
||||
.I sp
|
||||
that makes the stream interruptable.
|
||||
Read or write operations on
|
||||
.I sp
|
||||
fail with
|
||||
.I errno
|
||||
set to
|
||||
.L EINTR
|
||||
when interrupted.
|
||||
.SH "SEE ALSO"
|
||||
sfio(3)
|
||||
1362
cde/programs/dtksh/ksh93/src/lib/libast/man/sfio.3
Normal file
1362
cde/programs/dtksh/ksh93/src/lib/libast/man/sfio.3
Normal file
File diff suppressed because it is too large
Load Diff
64
cde/programs/dtksh/ksh93/src/lib/libast/man/sig.3
Normal file
64
cde/programs/dtksh/ksh93/src/lib/libast/man/sig.3
Normal file
@@ -0,0 +1,64 @@
|
||||
.\" $XConsortium: sig.3 /main/2 1996/10/29 15:11:08 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH SIG 3
|
||||
.SH NAME
|
||||
sig \- signal interface routines
|
||||
.SH SYNOPSIS
|
||||
.L "#include <ast.h>"
|
||||
.L "#include <sig.h>"
|
||||
.sp
|
||||
.L "int sigunblock(int sig);"
|
||||
.L "int sigcritical(int op);"
|
||||
.SH DESCRIPTION
|
||||
.L sigunblock
|
||||
is called to
|
||||
unblocks the signal
|
||||
.L sig
|
||||
from within a handler currently servicing
|
||||
.LR sig .
|
||||
.PP
|
||||
.L sigcritical
|
||||
controls a critical region for the
|
||||
.LR SIGINT ,
|
||||
.L SIGQUIT
|
||||
and
|
||||
.L SIGHUP
|
||||
signals.
|
||||
.L "op > 0"
|
||||
pushes the region,
|
||||
.L "op == 0"
|
||||
pops the region, and
|
||||
.L "op < 0"
|
||||
returns non-zero if any signals are being held in the current
|
||||
critical region.
|
||||
Signal critical regions may be nested.
|
||||
The current critical region level is returned,
|
||||
.L \-1
|
||||
on error.
|
||||
.SH "SEE ALSO"
|
||||
signal(2)
|
||||
89
cde/programs/dtksh/ksh93/src/lib/libast/man/spawnveg.3
Normal file
89
cde/programs/dtksh/ksh93/src/lib/libast/man/spawnveg.3
Normal file
@@ -0,0 +1,89 @@
|
||||
.\" $XConsortium: spawnveg.3 /main/2 1996/10/29 15:11:17 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de LI
|
||||
.}S 5 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH SPAWNVEG 3
|
||||
.SH NAME
|
||||
spawnveg \- process spawn with process group and session control
|
||||
.SH SYNOPSIS
|
||||
.L "#include <ast.h>"
|
||||
.sp
|
||||
.L "int spawnveg(const char* command, char** argv, char** envv, pid_t pgid);"
|
||||
.SH DESCRIPTION
|
||||
.L spwanveg
|
||||
combines
|
||||
.IR fork (2),
|
||||
.IR exec (2),
|
||||
.IR setpgid (2)
|
||||
and
|
||||
.IR setsid (2)
|
||||
into a single call.
|
||||
.PP
|
||||
.LR command ,
|
||||
.L argv
|
||||
and
|
||||
.L envv
|
||||
are as in
|
||||
.IR execve (2).
|
||||
.L pgid
|
||||
controls the new process group and session:
|
||||
.TP
|
||||
.L <0
|
||||
The new process becomes a session leader.
|
||||
is called in the child context.
|
||||
.TP
|
||||
.L 0
|
||||
The new process is in the callers process group.
|
||||
.TP
|
||||
.L 1
|
||||
The new process becomes a process group leader.
|
||||
.TP
|
||||
.L >1
|
||||
The new process joins the process group
|
||||
.IR pgid .
|
||||
.SH COMMENTS
|
||||
It is possible to code all process creation (except for
|
||||
.IR vfork (2)
|
||||
hack like in
|
||||
.IR csh (1))
|
||||
using
|
||||
.LR spawnveg .
|
||||
The
|
||||
.IR proc (3)
|
||||
routines and
|
||||
.IR ksh (1)
|
||||
do this on systems that don't support
|
||||
.IR fork (2).
|
||||
This makes porting to NT and Windows a snap: a simple
|
||||
.IR iffe (1)
|
||||
probe provides a
|
||||
.L spawnveg
|
||||
implementation using the NT or Windows process primitives.
|
||||
.SH "SEE ALSO"
|
||||
fork(2), exec(2), setpgid(2), setsid(2), spawnve(2)
|
||||
169
cde/programs/dtksh/ksh93/src/lib/libast/man/stak.3
Normal file
169
cde/programs/dtksh/ksh93/src/lib/libast/man/stak.3
Normal file
@@ -0,0 +1,169 @@
|
||||
.\" $XConsortium: stak.3 /main/3 1995/11/01 17:48:36 rswiston $
|
||||
.TH STAK 3
|
||||
.SH NAME
|
||||
\fBstak\fR \- data stack storage library \- obsolete \- use \fBstk\fR
|
||||
.SH SYNOPSIS
|
||||
.ta .75i 1.5i 2.25i 3i 3.75i 4.5i 5.25i 6i
|
||||
.PP
|
||||
.nf
|
||||
\f5
|
||||
#include <stak.h>
|
||||
|
||||
Stak_t *stakcreate(int \fIflags\fP);
|
||||
Stak_t *stakinstall(Stak_t *\fIstack\fP, char *(\fIoverflow\fP)(int));
|
||||
int stakdelete(Stak_t *\fIstack\fP);
|
||||
void staklink(Stak_t *\fIstack\fP)
|
||||
|
||||
char *stakalloc(unsigned \fIsize\fP);
|
||||
char *stakcopy(const char *\fIstring\fP);
|
||||
char *stakset(char *\fIaddress\fP, unsigned \fIoffset\fP);
|
||||
|
||||
char *stakseek(unsigned \fIoffset\fP);
|
||||
int stakputc(int \fIc\fP);
|
||||
int stakputs(const char *\fIstring\fP);
|
||||
int stakwrite(const char *\fIaddress\fP, unsigned \fIsize\fP);
|
||||
int staktell(void);
|
||||
char *stakptr(unsigned \fIoffset\fP);
|
||||
char *stakfreeze(unsigned \fIextra\fP);
|
||||
\fR
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\f5stak\fP is a package of routines designed to provide efficient
|
||||
stack oriented dynamic storage.
|
||||
A stack abstraction consists of an ordered list of contiguous
|
||||
memory regions, called stack frames, that can hold objects of
|
||||
arbitrary size.
|
||||
A stack is represented by the type \f5Stak_t\fP
|
||||
defined in header \f5<stak.h>\fP.
|
||||
At any instant there is one active stack.
|
||||
Variable size objects can be
|
||||
added to the active stack
|
||||
and programs can reference these objects directly with pointers.
|
||||
In addition, the last object on the stack
|
||||
(referred to here as the current object)
|
||||
can be built incrementally.
|
||||
The current object has an associated offset that determines its
|
||||
current size.
|
||||
While the current object is being built incrementally,
|
||||
its location might
|
||||
change so that it is necessary to reference the object with
|
||||
relative offsets ranging from zero to the current offset of the object.
|
||||
.PP
|
||||
There is a preset initial active stack.
|
||||
To use an additional stack, it is necessary to create it and to
|
||||
install it as the active stack.
|
||||
A stack is created with the \f5stakcreate\fP() function.
|
||||
A \fIflags\fP argument of \f5STAK_SMALL\fP indicates that unused
|
||||
space on the stack should be freed whenever this stack ceases
|
||||
to be the active stack.
|
||||
If successful,
|
||||
\f5stakcreate\fP() returns a pointer to a stack whose reference
|
||||
count is 1.
|
||||
Otherwise, \f5stakcreate\fP() returns a null pointer.
|
||||
The \f5staklink\fP() function increases the reference count for the
|
||||
given \fIstack\fP.
|
||||
The \f5stakinstall\fP() function
|
||||
makes the specified \fIstack\fP the active stack and returns a pointer
|
||||
to the previous active stack.
|
||||
When the \fIoverflow\fP argument is not null,
|
||||
it specifies a function that will
|
||||
be called whenever \f5malloc\fP(3) fails while trying to grow the
|
||||
stack.
|
||||
The \fIoverflow\fP function will be called with the size that was passed
|
||||
to \f5malloc\fP(3).
|
||||
The \fIoverflow\fP function can call \f5exit\fP(3), call \f5longjmp\fP(3)
|
||||
or return.
|
||||
If the \f5overflow\fP function returns,
|
||||
it must return a pointer to a memory region of the given size.
|
||||
The default action is to write an error to standard error and to
|
||||
call \f5exit\fP(2) with a non-zero exit value.
|
||||
When \fIstack\fP is a null pointer,
|
||||
the active stack is not changed
|
||||
but the \fIoverflow\fP function for the active stack can be changed
|
||||
and a pointer to the active stack is returned.
|
||||
The \f5stakdelete\fP() function decrements the reference count and
|
||||
frees the memory associated with
|
||||
the specified stack
|
||||
when the reference count is zero.
|
||||
The effect of subsequent references to objects
|
||||
on the stack are undefined.
|
||||
.PP
|
||||
The
|
||||
\f5stakalloc\fP() function returns an aligned pointer to space on the
|
||||
active stack that can be used to hold any object of the given \fIsize\fP.
|
||||
\f5stakalloc\fP() is similar to \f5malloc\fP(3) except that individual
|
||||
items returned by \f5stakalloc\fP() can not be freed.
|
||||
\f5stakalloc\fP() causes the offset of the current object to be set to
|
||||
zero.
|
||||
.PP
|
||||
The
|
||||
\f5stakcopy\fP() function copies the given string onto the stack
|
||||
and returns a pointer to the \fIstring\fP on the stack.
|
||||
\f5stakcopy\fP() causes the offset of the current object to be set to
|
||||
zero.
|
||||
.PP
|
||||
The \f5stakset\fP() function finds the frame containing the given
|
||||
\fIaddress\fP, frees all frames that were created after the one containing
|
||||
the given \fIaddress\fP, and sets the current object to the given
|
||||
\fIaddress\fP.
|
||||
The top of the current object is set to \fIoffset\fP bytes from
|
||||
current object.
|
||||
If \fIaddress\fP is not the address of an object on the
|
||||
stack the result is undefined.
|
||||
.PP
|
||||
The remaining functions are used to build the current object incrementally.
|
||||
An object that is built incrementally on the stack will
|
||||
always occupy contiguous memory within a stack frame but
|
||||
until \f5stakfreeze\fP() is called,
|
||||
the location in memory for the object can change.
|
||||
There is a current offset associated with the current object that
|
||||
determines where subsequent operations apply.
|
||||
Initially, this offset is zero, and the offset changes as a result
|
||||
of the operations you specify.
|
||||
The \f5stakseek\fP() function is used set the offset for the
|
||||
current object.
|
||||
The \fIoffset\fP argument to \f5stakseek\fP() specifies the new
|
||||
offset for the current object.
|
||||
The frame will be extended or moved
|
||||
if \f5offset\fP causes the new current offset to extend beyond the
|
||||
current frame.
|
||||
\f5stakseek\fP() returns a pointer to the beginning of the current object.
|
||||
The \f5staktell\fP() function gives the offset of the current object.
|
||||
.PP
|
||||
The \f5stakputc\fP() function adds a given character to the current object
|
||||
on the stack.
|
||||
The current offset is advanced by 1.
|
||||
The \f5stakputs\fP() function appends the given \fIstring\fP onto the current
|
||||
object in the stack and returns the length of the string.
|
||||
The current offset is advanced by the length of the string.
|
||||
The \f5stakwrite\fP() function appends the given \fIsize\fP byte memory
|
||||
region starting at \fIaddress\fP onto the current
|
||||
object in the stack and advances the current offset by \fIsize\fP.
|
||||
The current offset is returned.
|
||||
.PP
|
||||
The \f5stakptr\fP() function converts the given \f5offset\fP
|
||||
for the current object into a memory address on the stack.
|
||||
This address is only valid until another stack operation is given.
|
||||
The result is not defined if \fIoffset\fP exceeds the size of the current
|
||||
object.
|
||||
The \f5stakfreeze\fP()
|
||||
function terminates the current object on the
|
||||
stack and returns a pointer to the beginning of this object.
|
||||
If \fIextra\fP is non-zero, \fIextra\fP bytes are added to the stack
|
||||
before the current object is terminated. The first added byte will
|
||||
contain zero and the contents of the remaining bytes are undefined.
|
||||
.PP
|
||||
.SH HISTORY
|
||||
The
|
||||
\f5stak\fP
|
||||
interface was derived from similar routines in the KornShell code
|
||||
that is used for building parse trees and carrying out expansions.
|
||||
It provides an efficient mechanism for grouping dynamically allocated
|
||||
objects so that they can be freed all at once rather than individually.
|
||||
.SH AUTHOR
|
||||
David Korn
|
||||
.SH SEE ALSO
|
||||
\f5exit(2)\fP
|
||||
\f5longjmp(3)\fP
|
||||
\f5malloc(3)\fP
|
||||
160
cde/programs/dtksh/ksh93/src/lib/libast/man/stk.3
Normal file
160
cde/programs/dtksh/ksh93/src/lib/libast/man/stk.3
Normal file
@@ -0,0 +1,160 @@
|
||||
.\" $XConsortium: stk.3 /main/2 1996/10/29 15:11:36 drk $
|
||||
.TH STK 3
|
||||
.SH NAME
|
||||
\fBstk\fR \- data stack storage library
|
||||
.SH SYNOPSIS
|
||||
.ta .75i 1.5i 2.25i 3i 3.75i 4.5i 5.25i 6i
|
||||
.PP
|
||||
.nf
|
||||
\f5
|
||||
#include <stk.h>
|
||||
|
||||
Stk_t *stkopen(int \fIflags\fP);
|
||||
Stk_t *stkinstall(Stk_t *\fIstack\fP, char *(\fIoverflow\fP)(int));
|
||||
int stkclose(Stk_t *\fIstack\fP);
|
||||
void stklink(Stk_t *\fIstack\fP)
|
||||
|
||||
char *stkalloc(Stk_t *\fIstack\fP, unsigned \fIsize\fP);
|
||||
char *stkcopy(Stk_t *\fIstack\fP, const char *\fIstring\fP);
|
||||
char *stkset(Stk_t *\fIstack\fP, char *\fIaddress\fP, unsigned \fIoffset\fP);
|
||||
|
||||
char *stkseek(Stk_t *\fIstack\fP, unsigned \fIoffset\fP);
|
||||
int stktell(Stk_t *\fIstack\fP);
|
||||
char *stkptr(Stk_t *\fIstack\fP, unsigned \fIoffset\fP);
|
||||
char *stkfreeze(Stk_t *\fIstack\fP, unsigned \fIextra\fP);
|
||||
\fR
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\f5stk\fP is a package of routines designed to provide efficient
|
||||
stack oriented dynamic storage.
|
||||
A stack abstraction consists of an ordered list of contiguous
|
||||
memory regions, called stack frames, that can hold objects of
|
||||
arbitrary size.
|
||||
A stack is represented by the type \f5Stk_t\fP
|
||||
defined in header \f5<stk.h>\fP.
|
||||
The type \f5Stk_t\fP is compatible with the type \f5Sfio_t\fP
|
||||
defined by the \f5sfio\fP(3) library.
|
||||
At any instant there is one active stack which can be referenced
|
||||
by the constant \f5stkstd\fP.
|
||||
Variable size objects can be
|
||||
added to the active stack
|
||||
and programs can reference these objects directly with pointers.
|
||||
In addition, the last object on the stack
|
||||
(referred to here as the current object)
|
||||
can be built incrementally.
|
||||
The current object has an associated offset that determines its
|
||||
current size.
|
||||
While the current object is being built incrementally,
|
||||
its location might
|
||||
change so that it is necessary to reference the object with
|
||||
relative offsets ranging from zero to the current offset of the object.
|
||||
.PP
|
||||
There is a preset initial active stack.
|
||||
To use an additional stack, it is necessary to create it and to
|
||||
install it as the active stack.
|
||||
A stack is created with the \f5stkopen\fP() function.
|
||||
A \fIflags\fP argument of \f5STK_SMALL\fP indicates that unused
|
||||
space on the stack should be freed whenever this stack ceases
|
||||
to be the active stack.
|
||||
If successful,
|
||||
\f5stkopen\fP() returns a pointer to a stack whose reference
|
||||
count is 1.
|
||||
Otherwise, \f5stkopen\fP() returns a null pointer.
|
||||
The \f5stklink\fP() function increases the reference count for the
|
||||
given \fIstack\fP.
|
||||
The \f5stkinstall\fP() function
|
||||
makes the specified \fIstack\fP the active stack and returns a pointer
|
||||
to the previous active stack.
|
||||
When the \fIoverflow\fP argument is not null,
|
||||
it specifies a function that will
|
||||
be called whenever \f5malloc\fP(3) fails while trying to grow the
|
||||
stack.
|
||||
The \fIoverflow\fP function will be called with the size that was passed
|
||||
to \f5malloc\fP(3).
|
||||
The \fIoverflow\fP function can call \f5exit\fP(3), call \f5longjmp\fP(3)
|
||||
or return.
|
||||
If the \f5overflow\fP function returns,
|
||||
it must return a pointer to a memory region of the given size.
|
||||
The default action is to write an error to standard error and to
|
||||
call \f5exit\fP(2) with a non-zero exit value.
|
||||
When \fIstack\fP is a null pointer,
|
||||
the active stack is not changed
|
||||
but the \fIoverflow\fP function for the active stack can be changed
|
||||
and a pointer to the active stack is returned.
|
||||
The \f5stkclose\fP() function decrements the reference count and
|
||||
frees the memory associated with
|
||||
the specified stack
|
||||
when the reference count is zero.
|
||||
The effect of subsequent references to objects
|
||||
on the stack are undefined.
|
||||
.PP
|
||||
The
|
||||
\f5stkalloc\fP() function returns an aligned pointer to space on the
|
||||
active stack that can be used to hold any object of the given \fIsize\fP.
|
||||
\f5stkalloc\fP() is similar to \f5malloc\fP(3) except that individual
|
||||
items returned by \f5stkalloc\fP() can not be freed.
|
||||
\f5stkalloc\fP() causes the offset of the current object to be set to
|
||||
zero.
|
||||
.PP
|
||||
The
|
||||
\f5stkcopy\fP() function copies the given string onto the stack
|
||||
and returns a pointer to the \fIstring\fP on the stack.
|
||||
\f5stkcopy\fP() causes the offset of the current object to be set to
|
||||
zero.
|
||||
.PP
|
||||
The \f5stkset\fP() function finds the frame containing the given
|
||||
\fIaddress\fP, frees all frames that were created after the one containing
|
||||
the given \fIaddress\fP, and sets the current object to the given
|
||||
\fIaddress\fP.
|
||||
The top of the current object is set to \fIoffset\fP bytes from
|
||||
current object.
|
||||
If \fIaddress\fP is not the address of an object on the
|
||||
stack the result is undefined.
|
||||
.PP
|
||||
The \f5sfio\fP(3) output functions can be used to build
|
||||
current object incrementally.
|
||||
An object that is built incrementally on the stack will
|
||||
always occupy contiguous memory within a stack frame but
|
||||
until \f5stkfreeze\fP() is called,
|
||||
the location in memory for the object can change.
|
||||
There is a current offset associated with the current object that
|
||||
determines where subsequent operations apply.
|
||||
Initially, this offset is zero, and the offset changes as a result
|
||||
of the operations you specify.
|
||||
The \f5stkseek\fP() function is used set the offset for the
|
||||
current object.
|
||||
The \fIoffset\fP argument to \f5stkseek\fP() specifies the new
|
||||
offset for the current object.
|
||||
The frame will be extended or moved
|
||||
if \f5offset\fP causes the new current offset to extend beyond the
|
||||
current frame.
|
||||
\f5stkseek\fP() returns a pointer to the beginning of the current object.
|
||||
The \f5stktell\fP() function gives the offset of the current object.
|
||||
.PP
|
||||
The \f5stkptr\fP() function converts the given \f5offset\fP
|
||||
for the current object into a memory address on the stack.
|
||||
This address is only valid until another stack operation is given.
|
||||
The result is not defined if \fIoffset\fP exceeds the size of the current
|
||||
object.
|
||||
The \f5stkfreeze\fP()
|
||||
function terminates the current object on the
|
||||
stack and returns a pointer to the beginning of this object.
|
||||
If \fIextra\fP is non-zero, \fIextra\fP bytes are added to the stack
|
||||
before the current object is terminated. The first added byte will
|
||||
contain zero and the contents of the remaining bytes are undefined.
|
||||
.PP
|
||||
.SH HISTORY
|
||||
The
|
||||
\f5stk\fP
|
||||
interface was derived from similar routines in the KornShell code
|
||||
that is used for building parse trees and carrying out expansions.
|
||||
It provides an efficient mechanism for grouping dynamically allocated
|
||||
objects so that they can be freed all at once rather than individually.
|
||||
.SH AUTHOR
|
||||
David Korn
|
||||
.SH SEE ALSO
|
||||
\f5exit(2)\fP
|
||||
\f5longjmp(3)\fP
|
||||
\f5malloc(3)\fP
|
||||
\f5sfio(3)\fP
|
||||
43
cde/programs/dtksh/ksh93/src/lib/libast/man/strcopy.3
Normal file
43
cde/programs/dtksh/ksh93/src/lib/libast/man/strcopy.3
Normal file
@@ -0,0 +1,43 @@
|
||||
.\" $XConsortium: strcopy.3 /main/2 1996/10/29 15:11:48 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STRCOPY 3
|
||||
.SH NAME
|
||||
strcopy \- copy strings
|
||||
.SH SYNOPSIS
|
||||
.L "char* strcopy(char* a, char* b)"
|
||||
.SH DESCRIPTION
|
||||
.I strcopy
|
||||
copies the nul-terminated string
|
||||
.I b
|
||||
into
|
||||
.IR a .
|
||||
A pointer to the 0 character in
|
||||
.I a
|
||||
is returned.
|
||||
.SH "SEE ALSO"
|
||||
strcpy(3)
|
||||
44
cde/programs/dtksh/ksh93/src/lib/libast/man/strdup.3
Normal file
44
cde/programs/dtksh/ksh93/src/lib/libast/man/strdup.3
Normal file
@@ -0,0 +1,44 @@
|
||||
.\" $XConsortium: strdup.3 /main/2 1996/10/29 15:12:00 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STRDUP 3
|
||||
.SH NAME
|
||||
strdup \- duplicate nul-terminated string
|
||||
.SH SYNOPSIS
|
||||
.L "char* strdup(char* s)"
|
||||
.SH DESCRIPTION
|
||||
.I strdup
|
||||
copies the nul-terminated string
|
||||
.I s
|
||||
to a new location provided by
|
||||
.IR malloc (3)
|
||||
and returns a pointer to the new copy.
|
||||
0 is returned if
|
||||
.IR malloc (3)
|
||||
failed.
|
||||
.SH "SEE ALSO"
|
||||
malloc(3), memdup(3)
|
||||
66
cde/programs/dtksh/ksh93/src/lib/libast/man/strelapsed.3
Normal file
66
cde/programs/dtksh/ksh93/src/lib/libast/man/strelapsed.3
Normal file
@@ -0,0 +1,66 @@
|
||||
.\" $XConsortium: strelapsed.3 /main/2 1996/10/29 15:12:13 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STRELAPSED 3
|
||||
.SH NAME
|
||||
strelapsed \- parse elapsed time expression
|
||||
.SH SYNOPSIS
|
||||
.L "unsigned long strelapsed(char* buf, char** next, int persec)"
|
||||
.SH DESCRIPTION
|
||||
.I strelapsed
|
||||
returns a pointer to a string representation of the elapsed time for
|
||||
.L (count/persec)
|
||||
seconds.
|
||||
The two largest time units are used, limiting the return value length
|
||||
to at most 6 characters.
|
||||
The units are:
|
||||
.TP
|
||||
.B s
|
||||
seconds
|
||||
.TP
|
||||
.B m
|
||||
minutes
|
||||
.TP
|
||||
.B h
|
||||
hours
|
||||
.TP
|
||||
.B days
|
||||
.TP
|
||||
.B weeks
|
||||
.TP
|
||||
.B M
|
||||
months
|
||||
.TP
|
||||
.B Y
|
||||
years
|
||||
.TP
|
||||
.B S
|
||||
scores
|
||||
.SH "SEE ALSO"
|
||||
strelapsed(3)
|
||||
.SH CAVEATS
|
||||
The return value points to a static area that is overwritten on each call.
|
||||
45
cde/programs/dtksh/ksh93/src/lib/libast/man/strerror.3
Normal file
45
cde/programs/dtksh/ksh93/src/lib/libast/man/strerror.3
Normal file
@@ -0,0 +1,45 @@
|
||||
.\" $XConsortium: strerror.3 /main/2 1996/10/29 15:12:23 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de LI
|
||||
.}S 5 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STRERROR 3
|
||||
.SH NAME
|
||||
strerror \- return error message string given error number
|
||||
.SH SYNOPSIS
|
||||
.L "char* strerror(int err)"
|
||||
.SH DESCRIPTION
|
||||
.I strerror
|
||||
returns the error message string corresponding to the error message number
|
||||
.IR err .
|
||||
.BI "Error " nnn
|
||||
is returned if
|
||||
.I err
|
||||
is invalid.
|
||||
.SH "SEE ALSO"
|
||||
error(3)
|
||||
42
cde/programs/dtksh/ksh93/src/lib/libast/man/stresc.3
Normal file
42
cde/programs/dtksh/ksh93/src/lib/libast/man/stresc.3
Normal file
@@ -0,0 +1,42 @@
|
||||
.\" $XConsortium: stresc.3 /main/2 1996/10/29 15:12:36 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STRESC 3
|
||||
.SH NAME
|
||||
stresc \- convert character constants in string
|
||||
.SH SYNOPSIS
|
||||
.L "int stresc(char* s)"
|
||||
.SH DESCRIPTION
|
||||
.I stresc
|
||||
converts
|
||||
.N \e
|
||||
character constant expressions in the nul-terminated string
|
||||
.I s
|
||||
in place and returns the length of the converted
|
||||
.IR s .
|
||||
.SH "SEE ALSO"
|
||||
chresc(3), ctoi(3)
|
||||
72
cde/programs/dtksh/ksh93/src/lib/libast/man/streval.3
Normal file
72
cde/programs/dtksh/ksh93/src/lib/libast/man/streval.3
Normal file
@@ -0,0 +1,72 @@
|
||||
.\" $XConsortium: streval.3 /main/2 1996/10/29 15:12:48 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STREVAL 3
|
||||
.SH NAME
|
||||
streval \- long integer arithmetic expression evaluator
|
||||
.SH SYNOPSIS
|
||||
.L "long streval(char* s, char** e, long (*conv)(char* cs, char** ce))"
|
||||
.SH DESCRIPTION
|
||||
.I streval
|
||||
evaluates the long integer arithmetic expression in the nul-terminated string
|
||||
.I s
|
||||
and returns the result.
|
||||
If
|
||||
.I e
|
||||
is not 0 then
|
||||
.I *e
|
||||
is set to point to the first unknown character in the expression.
|
||||
.PP
|
||||
If
|
||||
.I conv
|
||||
is not 0 then it is called when an unknown token is encountered in
|
||||
.IR s .
|
||||
.I cs
|
||||
points to the beginning of the unknown token.
|
||||
The return value is the long integer value of the unknown token and
|
||||
.I ce
|
||||
must be set to point to the first character after the unknown token.
|
||||
If an expression syntax error is encountered the
|
||||
.I conv
|
||||
is called with
|
||||
.I cs
|
||||
set to 0 and
|
||||
.I *ce
|
||||
pointing to the error message text.
|
||||
.PP
|
||||
In addition to the normal C expressions and integer constant styles,
|
||||
numbers in any base
|
||||
.I b
|
||||
<= 2 <=36
|
||||
may be represented as
|
||||
.IR b # nnnn ,
|
||||
where the extra digits in
|
||||
.I nnnn
|
||||
are taken from
|
||||
.BR [A-Z] .
|
||||
.SH "SEE ALSO"
|
||||
strtol(3)
|
||||
42
cde/programs/dtksh/ksh93/src/lib/libast/man/strgid.3
Normal file
42
cde/programs/dtksh/ksh93/src/lib/libast/man/strgid.3
Normal file
@@ -0,0 +1,42 @@
|
||||
.\" $XConsortium: strgid.3 /main/2 1996/10/29 15:13:00 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STRGID 3
|
||||
.SH NAME
|
||||
strgid \- return group name given group number
|
||||
.SH SYNOPSIS
|
||||
.L "char* strgid(int gid)"
|
||||
.SH DESCRIPTION
|
||||
.I strgid
|
||||
returns the group id name string given the group number
|
||||
.IR gid .
|
||||
.I strgid
|
||||
maintains an internal cache to avoid repeated password database scans
|
||||
by the low level
|
||||
.IR getgrgid (3).
|
||||
.SH "SEE ALSO"
|
||||
getgrent(3)
|
||||
90
cde/programs/dtksh/ksh93/src/lib/libast/man/strmatch.3
Normal file
90
cde/programs/dtksh/ksh93/src/lib/libast/man/strmatch.3
Normal file
@@ -0,0 +1,90 @@
|
||||
.\" $XConsortium: strmatch.3 /main/2 1996/10/29 15:13:19 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STRMATCH 3
|
||||
.SH NAME
|
||||
strmatch \- match shell file patterns
|
||||
.SH SYNOPSIS
|
||||
.L "int strmatch(char* s, char* p)"
|
||||
.br
|
||||
.L "char* submatch(char* s, char* p, int m)"
|
||||
.SH DESCRIPTION
|
||||
.I strmatch
|
||||
compares the string
|
||||
.I s
|
||||
with the shell pattern
|
||||
.I p
|
||||
and returns 1 for match and 0 otherwise.
|
||||
.I submatch
|
||||
does a leading substring match of the shell pattern
|
||||
.I p
|
||||
with the string
|
||||
.IR s .
|
||||
If
|
||||
.I m
|
||||
is 0 then the match is minimal, otherwise a maximal match is done.
|
||||
A pointer to the first character after the matched substring is returned,
|
||||
.I 0
|
||||
if there is no match.
|
||||
.PP
|
||||
Except for
|
||||
.I &
|
||||
and
|
||||
.IR ! ,
|
||||
each shell pattern has an equivalent
|
||||
.IR egrep (1)
|
||||
construct.
|
||||
.EX
|
||||
\fBsh pattern egrep RE description\fP
|
||||
* .* 0 or more chars
|
||||
? . any single char
|
||||
[.] [.] char class
|
||||
[!.] [^.] negated char class
|
||||
*(.) (.)* 0 or more of
|
||||
+(.) (.)+ 1 or more of
|
||||
?(.) (.)? 0 or 1 of
|
||||
(.) (.) 1 of
|
||||
@(.) (.) 1 of
|
||||
a|b a|b a or b
|
||||
a&b a and b
|
||||
!(.) none of
|
||||
.EE
|
||||
.L \e
|
||||
is used to escape *, ?, (, |, &, ), [, and \e
|
||||
outside of [...].
|
||||
.SH "SEE ALSO"
|
||||
grep(1)
|
||||
.SH BUGS
|
||||
An unbalanced
|
||||
.L )
|
||||
terminates the top level pattern.
|
||||
.br
|
||||
Nested
|
||||
.L &
|
||||
and
|
||||
.L !
|
||||
constructs are non-intuitive and are computationally intensive.
|
||||
119
cde/programs/dtksh/ksh93/src/lib/libast/man/stropt.3
Normal file
119
cde/programs/dtksh/ksh93/src/lib/libast/man/stropt.3
Normal file
@@ -0,0 +1,119 @@
|
||||
.\" $XConsortium: stropt.3 /main/2 1996/10/29 15:13:38 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STROPT 3
|
||||
.SH NAME
|
||||
stropt \- table driven option expression evaluator
|
||||
.SH SYNOPSIS
|
||||
.L "#include <namval.h>"
|
||||
.br
|
||||
.L "int stropt(char* s, struct namval* tab,
|
||||
.br
|
||||
.L " int (*fun)(void* a, struct namval* p, int n, char* v),"
|
||||
.br
|
||||
.L " void* a)"
|
||||
.SH DESCRIPTION
|
||||
.I stropt
|
||||
parses option expressions in the nul-terminated string
|
||||
.I s
|
||||
using the option names in
|
||||
.IR tab .
|
||||
.I tab
|
||||
is an array of
|
||||
.B "struct namval"
|
||||
name value pairs:
|
||||
.EX
|
||||
char* name;
|
||||
int value;
|
||||
.EE
|
||||
The last entry must be followed by a sentinel with
|
||||
.B name
|
||||
set to 0.
|
||||
.PP
|
||||
An option expression contains 0 or more of [\fBno\fP]\fIname\fP[=\fIvalue\fP]
|
||||
separate by
|
||||
.B space
|
||||
or
|
||||
.BR tab ,
|
||||
where
|
||||
.I name
|
||||
must be one of the option names in
|
||||
.IR tab ,
|
||||
.I value
|
||||
is an optional value, and
|
||||
.B no
|
||||
is for Boolean options.
|
||||
Each option is passed to
|
||||
.I fun
|
||||
for processing.
|
||||
.I a
|
||||
is the
|
||||
.L void*
|
||||
pointer that is passed from the
|
||||
.I stropt
|
||||
call but is otherwise not interpreted.
|
||||
.I p
|
||||
points to the option name value pair from
|
||||
.IR tab .
|
||||
.I n
|
||||
is 0 if
|
||||
.B no
|
||||
preceeded the option
|
||||
.I name
|
||||
and
|
||||
.I v
|
||||
points to the beginning of the option
|
||||
.I value
|
||||
in
|
||||
.IR s .
|
||||
and
|
||||
If
|
||||
.I name
|
||||
is not found in
|
||||
.I tab
|
||||
then
|
||||
.I fun
|
||||
is called with
|
||||
.I p
|
||||
pointing to an internal
|
||||
.I namval
|
||||
entry with
|
||||
.I p\->name
|
||||
pointing to the unknown option and
|
||||
.I p\->value
|
||||
set to the
|
||||
.I value
|
||||
of the sentinel entry in
|
||||
.IR tab .
|
||||
.PP
|
||||
If
|
||||
.I fun
|
||||
returns non-zero then this value is returned and no further
|
||||
options are processed.
|
||||
Otherwise
|
||||
.I stropt
|
||||
returns 0 after processing all options.
|
||||
98
cde/programs/dtksh/ksh93/src/lib/libast/man/strperm.3
Normal file
98
cde/programs/dtksh/ksh93/src/lib/libast/man/strperm.3
Normal file
@@ -0,0 +1,98 @@
|
||||
.\" $XConsortium: strperm.3 /main/2 1996/10/29 15:13:58 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STRPERM 3
|
||||
.SH NAME
|
||||
strperm \- evaluate file permission expression
|
||||
.SH SYNOPSIS
|
||||
.L "int strperm(char* s, char** e, int p)"
|
||||
.SH DESCRIPTION
|
||||
.I strperm
|
||||
applies a file permission expression in the nul-terminated string
|
||||
.I s
|
||||
to the initial file permission mask
|
||||
.IR p .
|
||||
The new permission mask is returned.
|
||||
If
|
||||
.I e
|
||||
not 0 then
|
||||
.I *e
|
||||
is set to point to the first unrecognized character in
|
||||
.IR s .
|
||||
.PP
|
||||
A tape device specification is composed of one or more
|
||||
.I who-op-permission
|
||||
terms separated by
|
||||
.BR , .
|
||||
.I who
|
||||
selects portions of the permission bits and may be any combination of:
|
||||
.TP 3
|
||||
.B u
|
||||
the user permission bits;
|
||||
.TP
|
||||
.B g
|
||||
the group permission bits;
|
||||
.TP
|
||||
.B o
|
||||
the `other' permission bits;
|
||||
.TP
|
||||
.B a
|
||||
all permission bits.
|
||||
.PP
|
||||
If omitted, all permission bits are selected.
|
||||
.I op
|
||||
specifies how the original permission
|
||||
.I p
|
||||
is to be modified:
|
||||
.TP 3
|
||||
.B +
|
||||
.br
|
||||
.ns
|
||||
.B |
|
||||
the new bits are set in
|
||||
.IR p ;
|
||||
.TP 3
|
||||
.B \-
|
||||
the new bits are cleared in
|
||||
.IR p ;
|
||||
.TP
|
||||
.B &
|
||||
the new bits are and'd with
|
||||
.IR p ;
|
||||
.TP
|
||||
.B =
|
||||
the select bits in
|
||||
.I p
|
||||
are set equal to the new bits
|
||||
.PP
|
||||
A permission expression term may also be an octal number.
|
||||
Octal specifications are inherently non-portable.
|
||||
Refer to
|
||||
.IR chmod (1)
|
||||
for an explanation of this form.
|
||||
.SH "SEE ALSO"
|
||||
chmod(1), ls(1), strmode(3)
|
||||
45
cde/programs/dtksh/ksh93/src/lib/libast/man/strsignal.3
Normal file
45
cde/programs/dtksh/ksh93/src/lib/libast/man/strsignal.3
Normal file
@@ -0,0 +1,45 @@
|
||||
.\" $XConsortium: strsignal.3 /main/2 1996/10/29 15:14:16 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de LI
|
||||
.}S 5 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STRSIGNAL 3
|
||||
.SH NAME
|
||||
strsignal \- return signal description string given signal number
|
||||
.SH SYNOPSIS
|
||||
.L "char* strsignal(int sig)"
|
||||
.SH DESCRIPTION
|
||||
.I strsignal
|
||||
returns the signal description string corresponding to the signal number
|
||||
.IR sig .
|
||||
.BI "Signal " nnn
|
||||
is returned if
|
||||
.I sig
|
||||
is invalid.
|
||||
.SH "SEE ALSO"
|
||||
signal(2), sigvec(2)
|
||||
62
cde/programs/dtksh/ksh93/src/lib/libast/man/strsort.3
Normal file
62
cde/programs/dtksh/ksh93/src/lib/libast/man/strsort.3
Normal file
@@ -0,0 +1,62 @@
|
||||
.\" $XConsortium: strsort.3 /main/2 1996/10/29 15:14:44 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH HSORT 3
|
||||
.SH NAME
|
||||
hsort \- array heap sort
|
||||
.SH SYNOPSIS
|
||||
.EX
|
||||
#include <ast.h>
|
||||
|
||||
void strsort(char** \fIarray\fP, int \fIelements\fP, int (*\fIcompare\fP)(const char* \fIa\fP, const char* \fIb\fP));
|
||||
.EE
|
||||
.SH DESCRIPTION
|
||||
.L strsort
|
||||
does a heap sort on the array of pointers
|
||||
.I array
|
||||
with
|
||||
.I elements
|
||||
elements using the comparison function
|
||||
.IR compare .
|
||||
.I compare
|
||||
returns
|
||||
.L \-1
|
||||
if
|
||||
.I a
|
||||
is lexicographically less than
|
||||
.IR b ,
|
||||
.L 0
|
||||
if
|
||||
.I a
|
||||
is equal to
|
||||
.IR b ,
|
||||
and
|
||||
.L 1
|
||||
if
|
||||
.I a
|
||||
is lexicographically greater than
|
||||
.IR b .
|
||||
75
cde/programs/dtksh/ksh93/src/lib/libast/man/strtape.3
Normal file
75
cde/programs/dtksh/ksh93/src/lib/libast/man/strtape.3
Normal file
@@ -0,0 +1,75 @@
|
||||
.\" $XConsortium: strtape.3 /main/2 1996/10/29 15:15:09 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STRTAPE 3
|
||||
.SH NAME
|
||||
strtape \- convert string to tape device pathname
|
||||
.SH SYNOPSIS
|
||||
.L "char* strtape(char* s, char** e)"
|
||||
.SH DESCRIPTION
|
||||
.I strtape
|
||||
converts the generic tape device specification in the nul-terminated string
|
||||
.I s
|
||||
to a local tape device pathname.
|
||||
A pointer to the device pathname is returned.
|
||||
If
|
||||
.I e
|
||||
not 0 then
|
||||
.I *e
|
||||
is set to point to the first unrecognized character in
|
||||
.IR s .
|
||||
.PP
|
||||
A tape device specification is composed of
|
||||
.IR unit-density-rewind .
|
||||
All are optional.
|
||||
.I unit
|
||||
is a unit number in the range
|
||||
.BR [0-7] .
|
||||
The default unit is
|
||||
.BR 1 .
|
||||
Density may be one of:
|
||||
.TP 3
|
||||
.B l
|
||||
for low;
|
||||
.TP 3
|
||||
.B m
|
||||
for medium, and
|
||||
.TP
|
||||
.B h
|
||||
for high.
|
||||
.PP
|
||||
The default is
|
||||
.BR m .
|
||||
.I rewind
|
||||
is
|
||||
.B n
|
||||
for no-rewind on device close.
|
||||
The default is to rewind on device close.
|
||||
.SH "SEE ALSO"
|
||||
pax(1), tar(1)
|
||||
.SH CAVEATS
|
||||
The return value points to a static area that is overwritten on each call.
|
||||
86
cde/programs/dtksh/ksh93/src/lib/libast/man/strton.3
Normal file
86
cde/programs/dtksh/ksh93/src/lib/libast/man/strton.3
Normal file
@@ -0,0 +1,86 @@
|
||||
.\" $XConsortium: strton.3 /main/2 1996/10/29 15:15:29 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STRTON 3
|
||||
.SH NAME
|
||||
strton \- convert string to long integer
|
||||
.SH SYNOPSIS
|
||||
.L "long strton(char* s, char** e)"
|
||||
.SH DESCRIPTION
|
||||
.I strton
|
||||
converts the nul-terminated string
|
||||
.I s
|
||||
to a long integer.
|
||||
If
|
||||
.I e
|
||||
not 0 then
|
||||
.I *e
|
||||
is set to point to the first unrecognized character in
|
||||
.IR s .
|
||||
Leading spaces in
|
||||
.I s
|
||||
are ignored.
|
||||
.PP
|
||||
A number is composed of
|
||||
.IR sign-base-number-suffix .
|
||||
All but
|
||||
.I number
|
||||
are optional.
|
||||
.I sign
|
||||
may be \+ or \-.
|
||||
.I base
|
||||
may be:
|
||||
.TP
|
||||
.B 0x
|
||||
for hexadecimal;
|
||||
.TP
|
||||
.B 0
|
||||
for octal, or
|
||||
.TP
|
||||
.IR nn #
|
||||
for base
|
||||
2 \(le
|
||||
.I nn
|
||||
\(le 36.
|
||||
.PP
|
||||
For bases greater than 10 the additional digits are take from the set
|
||||
.BR [a-zA-Z] .
|
||||
The suffix multiplies the converted number and may be:
|
||||
.TP
|
||||
.B b
|
||||
block (512)
|
||||
.TP
|
||||
.B g
|
||||
giga (1024 * 1024 * 1024)
|
||||
.TP
|
||||
.B k
|
||||
kilo (1024)
|
||||
.TP
|
||||
.B m
|
||||
mega (1024 * 1024)
|
||||
.SH "SEE ALSO"
|
||||
atoi(3), scanf(3), strtod(3)
|
||||
42
cde/programs/dtksh/ksh93/src/lib/libast/man/struid.3
Normal file
42
cde/programs/dtksh/ksh93/src/lib/libast/man/struid.3
Normal file
@@ -0,0 +1,42 @@
|
||||
.\" $XConsortium: struid.3 /main/2 1996/10/29 15:15:43 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH STRUID 3
|
||||
.SH NAME
|
||||
struid \- return user name given user number
|
||||
.SH SYNOPSIS
|
||||
.L "char* struid(int uid)"
|
||||
.SH DESCRIPTION
|
||||
.I struid
|
||||
returns the user id name string given the user number
|
||||
.IR uid .
|
||||
.I struid
|
||||
maintains an internal cache to avoid repeated password database scans
|
||||
by the low level
|
||||
.IR getpwuid (3).
|
||||
.SH "SEE ALSO"
|
||||
getpwent(3)
|
||||
127
cde/programs/dtksh/ksh93/src/lib/libast/man/swap.3
Normal file
127
cde/programs/dtksh/ksh93/src/lib/libast/man/swap.3
Normal file
@@ -0,0 +1,127 @@
|
||||
.\" $XConsortium: swap.3 /main/2 1996/10/29 15:15:58 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH SWAP 3
|
||||
.SH NAME
|
||||
swap \- integral representation conversion routines
|
||||
.SH SYNOPSIS
|
||||
.L "#include <swap.h>"
|
||||
.sp
|
||||
.L "int swapop(const void* internal, const void* external, int width);
|
||||
.L "int_max swapget(int op, const void* from, int width);"
|
||||
.L "void* swapput(int op, void* to, int width, int_max value);"
|
||||
.L "void* swapmem(int op, const void* from, void* to, size_t n);"
|
||||
.SH DESCRIPTION
|
||||
These routines convert integral constants between internal and
|
||||
external representations.
|
||||
They are used to handle binary data generated by foreign programs.
|
||||
New binary data representations should use the compact canonical form
|
||||
provided by the
|
||||
.IR sfio (3)
|
||||
routines
|
||||
.L sfputu
|
||||
and
|
||||
.LR sgetu .
|
||||
.PP
|
||||
.L swapop
|
||||
returns the swap operation required to convert the
|
||||
.L width
|
||||
byte integer
|
||||
.L external
|
||||
to the
|
||||
.L width
|
||||
byte integer
|
||||
.LR internal .
|
||||
The swap operation is a bit mask:
|
||||
.TP
|
||||
.L 0
|
||||
No swapping necessary.
|
||||
.TP
|
||||
.L 1
|
||||
Swap byte
|
||||
.L 0
|
||||
with byte
|
||||
.LR 1 .
|
||||
.TP
|
||||
.L 2
|
||||
Swap bytes
|
||||
.L 0
|
||||
and
|
||||
.L 1
|
||||
with bytes
|
||||
.L 2
|
||||
and
|
||||
.LR 3 .
|
||||
.TP
|
||||
.L 4
|
||||
Swap bytes
|
||||
.L 0-3
|
||||
with bytes
|
||||
.LR 4-7 ,
|
||||
and so on.
|
||||
The largest native integral type is defined by the macro
|
||||
.L int_max
|
||||
in the header
|
||||
.L <int.h>
|
||||
described in
|
||||
.IR int (3).
|
||||
.PP
|
||||
.L swapget
|
||||
returns the
|
||||
.L width
|
||||
byte integer in the buffer
|
||||
.LR from ,
|
||||
swapped according to
|
||||
.LR op .
|
||||
.PP
|
||||
.L swapput
|
||||
copies the
|
||||
.L width
|
||||
byte integer
|
||||
.L value
|
||||
into the buffer
|
||||
.LR to ,
|
||||
swapped according to
|
||||
.LR op .
|
||||
.L to
|
||||
is returned.
|
||||
.PP
|
||||
.L swapmem
|
||||
swaps
|
||||
.L n
|
||||
bytes from the buffer
|
||||
.L from
|
||||
to the buffer
|
||||
.L to
|
||||
according to
|
||||
.LR op .
|
||||
.L to
|
||||
and
|
||||
.L from
|
||||
may be the same.
|
||||
.SH "SEE ALSO"
|
||||
int(3)
|
||||
63
cde/programs/dtksh/ksh93/src/lib/libast/man/tab.3
Normal file
63
cde/programs/dtksh/ksh93/src/lib/libast/man/tab.3
Normal file
@@ -0,0 +1,63 @@
|
||||
.\" $XConsortium: tab.3 /main/2 1996/10/29 15:16:15 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH TAB 3
|
||||
.SH NAME
|
||||
tab \- simple table lookup routines
|
||||
.SH SYNOPSIS
|
||||
.L "#include <ast.h>"
|
||||
.sp
|
||||
.L "int tabindex(const void* tab, int size, const char* name);"
|
||||
.L "void* tablook(const void* tab, int size, const char* name);"
|
||||
.SH DESCRIPTION
|
||||
These routines do linear lookups in
|
||||
.I small
|
||||
tables (on the order of 32 elements).
|
||||
Each table element has a size of
|
||||
.L size
|
||||
bytes and the beginning of the element points to a name that is
|
||||
matched by the lookup routines.
|
||||
.PP
|
||||
.L tabindex
|
||||
returns the index of the table element in
|
||||
.L tab
|
||||
that matches
|
||||
.LR name .
|
||||
If there is no match then
|
||||
.L \-1
|
||||
is returned.
|
||||
.PP
|
||||
.L tablook
|
||||
returns a pointer to the table element in
|
||||
.L tab
|
||||
that matches
|
||||
.LR name .
|
||||
If there is no match then
|
||||
.L 0
|
||||
is returned.
|
||||
.SH "SEE ALSO"
|
||||
hash(3)
|
||||
565
cde/programs/dtksh/ksh93/src/lib/libast/man/tm.3
Normal file
565
cde/programs/dtksh/ksh93/src/lib/libast/man/tm.3
Normal file
@@ -0,0 +1,565 @@
|
||||
.\" $XConsortium: tm.3 /main/3 1996/10/29 15:16:25 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH TM 3
|
||||
.SH NAME
|
||||
tm \- time conversion support
|
||||
.SH SYNOPSIS
|
||||
.L "#include <tm.h>"
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.I tm
|
||||
library supports conversion between
|
||||
string date specifications,
|
||||
.L time_t
|
||||
clock values and
|
||||
.L "struct tm"
|
||||
values.
|
||||
.L localtime()
|
||||
and
|
||||
.L gmtime()
|
||||
(see
|
||||
.IR ctime (3))
|
||||
are used to determine local time zone information.
|
||||
.PP
|
||||
.L time_t
|
||||
values are the number of seconds since the epoch,
|
||||
.BR "Jan 1 00:00:00 GMT 1970" ,
|
||||
with leap seconds omitted.
|
||||
.PP
|
||||
The global variable
|
||||
.L "int tm_info.flags"
|
||||
contains flags that allow all programs using the library
|
||||
to be controlled in a consistent manner.
|
||||
.L tm_info.flags
|
||||
is initialized by the
|
||||
.L tminit()
|
||||
routine described below, and may be explicitly reset after
|
||||
.L tminit()
|
||||
is called.
|
||||
The flags are:
|
||||
.TP
|
||||
.L TM_ADJUST
|
||||
Set by
|
||||
.L tminit()
|
||||
if
|
||||
.L localtime()
|
||||
and
|
||||
.L gmtime()
|
||||
do not compensate for leap seconds.
|
||||
.TP
|
||||
.L TM_LEAP
|
||||
.L time_t
|
||||
values are interpreted as if they include leap seconds.
|
||||
Set by
|
||||
.L tminit()
|
||||
if the
|
||||
.L leap
|
||||
option is set in the
|
||||
.L TM_OPTIONS
|
||||
environment variable.
|
||||
.TP
|
||||
.L TM_UTC
|
||||
Times are relative to
|
||||
.B UTC
|
||||
(universal coordinated time, i.e.,
|
||||
.BR GMT ).
|
||||
Otherwise times are relative to the local time zone.
|
||||
Set by
|
||||
.L tminit()
|
||||
if the time zone name matches one of
|
||||
.L tm_info.format[43]
|
||||
through
|
||||
.L tm_info.format[46]
|
||||
described below.
|
||||
If the time zone name is not determined by
|
||||
.L localtime()
|
||||
then the environment variables
|
||||
.L TZNAME
|
||||
(as described in BSD 4.3) and
|
||||
.L TZ
|
||||
(as described in System V)
|
||||
are checked, in order.
|
||||
If this fails then the time zone name is constructed using
|
||||
the local time zone offset.
|
||||
.PP
|
||||
The routines are:
|
||||
.TP
|
||||
.L "time_t tmdate(const char* date, char** end, time_t* clock)"
|
||||
Parses the date specification
|
||||
.L date
|
||||
using the
|
||||
.L tm_info.format
|
||||
string table (described below)
|
||||
and returns the equivalent
|
||||
.L time_t
|
||||
value.
|
||||
If
|
||||
.RL non- NULL ,
|
||||
.L end
|
||||
is set to the position of the first unrecognized character in
|
||||
.LR date .
|
||||
.L clock
|
||||
is used to provide default values for omitted components in
|
||||
.LR date .
|
||||
If
|
||||
.L clock
|
||||
is
|
||||
.L NULL
|
||||
then the current time is used.
|
||||
.TP
|
||||
.L "struct tm* tmfix(struct tm* tp)"
|
||||
Corrects any out of bounds fields in
|
||||
.L tp
|
||||
and returns
|
||||
.L tp
|
||||
as its value.
|
||||
The corrections start with
|
||||
.L tp->tm_sec
|
||||
and propagate down to
|
||||
.LR tp->tm_year .
|
||||
For example, if
|
||||
.L tp->tm_sec
|
||||
were 61 then it would change to 1 and
|
||||
.L tp->tm_min
|
||||
would be incremented by 1, and so on.
|
||||
.LR tp->tm_wday ,
|
||||
.LR tp->tm_yday
|
||||
and
|
||||
.L tp->tm_isdst
|
||||
are not changed as these can be computed from the other fields.
|
||||
.TP
|
||||
.L "char* tmfmt(char* buf, size_t len, const char* format, time_t* clock)"
|
||||
Formats the date pointed to by
|
||||
.L clock
|
||||
into the buffer
|
||||
.L buf
|
||||
with size
|
||||
.L len
|
||||
bytes according to the format specification
|
||||
.LR format .
|
||||
If
|
||||
.L format
|
||||
is
|
||||
.L NULL
|
||||
or empty then the string
|
||||
.L tm_info.format[40]
|
||||
is used.
|
||||
If
|
||||
.L clock
|
||||
is
|
||||
.L NULL
|
||||
then the current time is used.
|
||||
A pointer to the end of
|
||||
.L buf
|
||||
(i.e., the terminating
|
||||
.LR "'\e0'" )
|
||||
is returned.
|
||||
.RS
|
||||
.PP
|
||||
.L format
|
||||
is in the style of
|
||||
.IR printf (3),
|
||||
where
|
||||
.BI % field
|
||||
causes the corresponding fixed size field to be placed in
|
||||
.LR buf ,
|
||||
zero padded if necessary, and \e\fIc\fP and \e\fInnn\fP
|
||||
sequences are interpreted as in the C language.
|
||||
Otherwise invalid
|
||||
.BI % field
|
||||
specifications and all other characters in
|
||||
.L format
|
||||
are copied into
|
||||
.L buf
|
||||
without change.
|
||||
String field values are taken from the
|
||||
.L tm_info.format
|
||||
string table.
|
||||
The
|
||||
.I fields
|
||||
are:
|
||||
.TP
|
||||
.PD 0
|
||||
.B %
|
||||
.B %
|
||||
character.
|
||||
.TP
|
||||
.B a
|
||||
Abbreviated weekday name.
|
||||
.TP
|
||||
.B A
|
||||
Full weekday name.
|
||||
.TP
|
||||
.B b
|
||||
Abbreviated month name.
|
||||
.TP
|
||||
.B c
|
||||
.IR ctime (3)
|
||||
style date without the trailing
|
||||
.BR newline .
|
||||
.TP
|
||||
.B C
|
||||
.IR date (1)
|
||||
style date.
|
||||
.TP
|
||||
.B d
|
||||
Day of month number.
|
||||
.TP
|
||||
.B D
|
||||
Date as
|
||||
.IR mm / dd / yy .
|
||||
.TP
|
||||
.B e
|
||||
Blank padded day of month number.
|
||||
.TP
|
||||
.B E
|
||||
Unpadded day of month number.
|
||||
.TP
|
||||
.B h
|
||||
Abbreviated month name.
|
||||
.TP
|
||||
.B H
|
||||
24-hour clock hour.
|
||||
.TP
|
||||
.B i
|
||||
International
|
||||
.IR date (1)
|
||||
date that includes the time zone type name.
|
||||
.TP
|
||||
.B I
|
||||
12-hour clock hour.
|
||||
.TP
|
||||
.B j
|
||||
1-offset Julian date.
|
||||
.TP
|
||||
.B J
|
||||
0-offset Julian date.
|
||||
.TP
|
||||
.B l
|
||||
.IR ls (1)
|
||||
.B \-l
|
||||
date that lists recent dates with
|
||||
.IR hh : mm
|
||||
and distant dates with
|
||||
.IR yyyy .
|
||||
.TP
|
||||
.B m
|
||||
Month number.
|
||||
.TP
|
||||
.B M
|
||||
Minutes.
|
||||
.TP
|
||||
.B n
|
||||
.B newline
|
||||
character.
|
||||
.TP
|
||||
.B p
|
||||
Meridian (e.g.,
|
||||
.B AM
|
||||
or
|
||||
.BR PM ).
|
||||
.TP
|
||||
.B r
|
||||
12-hour time as
|
||||
.IR hh : mm : ss
|
||||
.IR meridian .
|
||||
.TP
|
||||
.B R
|
||||
24-hour time as
|
||||
.IR hh : mm .
|
||||
.TP
|
||||
.B S
|
||||
Seconds.
|
||||
.TP
|
||||
.B t
|
||||
.B tab
|
||||
character.
|
||||
.TP
|
||||
.B T
|
||||
24-hour time as
|
||||
.IR hh : mm : ss .
|
||||
.TP
|
||||
.B U
|
||||
Week number with Sunday as the first day.
|
||||
.TP
|
||||
.B w
|
||||
Weekday number.
|
||||
.TP
|
||||
.B W
|
||||
Week number with Monday as the first day.
|
||||
.TP
|
||||
.B x
|
||||
Local date style, using
|
||||
.LR tm_info.format[39] ,
|
||||
that includes the month, day and year.
|
||||
.TP
|
||||
.B X
|
||||
Local time style, using
|
||||
.LR tm_info.format[38] ,
|
||||
that includes the hours and minutes.
|
||||
.TP
|
||||
.B y
|
||||
2-digit year.
|
||||
.TP
|
||||
.B Y
|
||||
4-digit year.
|
||||
.TP
|
||||
.B z
|
||||
Time zone type name.
|
||||
.TP
|
||||
.B Z
|
||||
Time zone name.
|
||||
.TP
|
||||
.BI + flag
|
||||
.TP
|
||||
.BI \- flag
|
||||
Temporarily (until
|
||||
.L tmform()
|
||||
returns) sets (+) or clears (\-) the
|
||||
.L tm_info.flags
|
||||
flags specified by
|
||||
.IR flag :
|
||||
.RS
|
||||
.TP
|
||||
.B l
|
||||
.L TM_LEAP
|
||||
.TP
|
||||
.B u
|
||||
.L TM_UTC
|
||||
.RE
|
||||
.TP
|
||||
.B #
|
||||
Number of seconds since the epoch.
|
||||
.PD
|
||||
.RE
|
||||
.TP
|
||||
.L "void tminit(Tm_zone_t* zone)"
|
||||
Implicitly called by the other
|
||||
.I tm
|
||||
library routines to initialize global data, including the
|
||||
.L tm_info.format
|
||||
table and the
|
||||
.L tm_info.flags
|
||||
global flags.
|
||||
Global data should only be modified after an explicit call to
|
||||
.LR tminit .
|
||||
If
|
||||
.L "zone != 0"
|
||||
then it specifies a time zone other that the local time zone.
|
||||
.TP
|
||||
.L "void tmset(Tm_zone_t* zone);"
|
||||
.L tmset
|
||||
sets the reference timezoe to
|
||||
.LR zone .
|
||||
.L tm_info.local
|
||||
points to the local timezone and
|
||||
.L tm_info.zone
|
||||
points to the current reference timezone.
|
||||
.TP
|
||||
.L "time_t tmleap(time_t* clock)"
|
||||
Returns a
|
||||
.L time_t
|
||||
value for the time pointed to by
|
||||
.L clock
|
||||
with leap seconds adjusted for external
|
||||
routines that do not handle leap seconds.
|
||||
If
|
||||
.L clock
|
||||
is
|
||||
.L NULL
|
||||
then the current time is used.
|
||||
Adjustments are only done if the
|
||||
.L TM_ADJUST
|
||||
flag is set in
|
||||
.LR tm_info.flags .
|
||||
.TP
|
||||
.L "struct tm* tmmake(time_t* clock)"
|
||||
Returns a pointer to the
|
||||
.L tm
|
||||
struct corresponding to the time pointed to by
|
||||
.LR clock .
|
||||
If
|
||||
.L clock
|
||||
is
|
||||
.L NULL
|
||||
then the current time is used.
|
||||
.TP
|
||||
.L "time_t tmtime(struct tm* tp, int west)"
|
||||
Returns the
|
||||
.L time_t
|
||||
value corresponding to
|
||||
.LR tp .
|
||||
If
|
||||
.L west
|
||||
is
|
||||
.L TM_LOCALZONE
|
||||
then
|
||||
.L tm
|
||||
is relative to the local time zone,
|
||||
otherwise
|
||||
.L west
|
||||
is the number of minutes west of
|
||||
.B UTC
|
||||
with daylight savings time taken into account.
|
||||
.LR tp->tm_wday ,
|
||||
.LR tp->tm_yday
|
||||
and
|
||||
.L tp->tm_isdst
|
||||
are ignored in the conversion.
|
||||
.PP
|
||||
The library routines use a table of date strings pointed to by
|
||||
.LR "char** tm_info.format" .
|
||||
The indices in
|
||||
.L tm_info.format
|
||||
are fixed by category.
|
||||
.L tm_info.format
|
||||
may be changed to point to other tables
|
||||
according to local language and date conventions.
|
||||
The contents by index (showing the USA English values) are:
|
||||
.RS
|
||||
.TP
|
||||
.PD 0
|
||||
.B 0-11
|
||||
3-character abbreviated month names.
|
||||
.TP
|
||||
.B 12-23
|
||||
Full month names.
|
||||
.TP
|
||||
.B 24-30
|
||||
3-character abbreviated weekday names.
|
||||
.TP
|
||||
.B 31-37
|
||||
Full weekday names.
|
||||
.TP
|
||||
.B 38
|
||||
.L tmform()
|
||||
local time format used by the
|
||||
.B %X
|
||||
field.
|
||||
.TP
|
||||
.B 39
|
||||
.L tmform()
|
||||
local date format used by the
|
||||
.B %x
|
||||
field.
|
||||
.TP
|
||||
.B 40
|
||||
.L tmform()
|
||||
format used if the
|
||||
.L format
|
||||
argument is
|
||||
.L NULL
|
||||
or empty.
|
||||
.TP
|
||||
.B 41-42
|
||||
Meridian names: AM, PM.
|
||||
.TP
|
||||
.B 43-46
|
||||
.B UTC
|
||||
time zone names: GMT, UTC, UCT, CUT.
|
||||
.TP
|
||||
.B 47-50
|
||||
Daylight savings time suffix names: DST.
|
||||
.TP
|
||||
.B 51-54
|
||||
Suffixes to be ignored when matching strings in
|
||||
.LR tmform() .
|
||||
.TP
|
||||
.B 55-61
|
||||
Time part names: second, hour, minute, day, week, month, year.
|
||||
.TP
|
||||
.B 62-65
|
||||
Hours of the day names: midnight, morning, noon, evening.
|
||||
.TP
|
||||
.B 66-68
|
||||
Relative day names: yesterday, today, tomorrow.
|
||||
.TP
|
||||
.B 69-71
|
||||
Past relative time references: last, ago, past.
|
||||
.TP
|
||||
.B 72-75
|
||||
Current relative time references: this, now, current.
|
||||
.TP
|
||||
.B 75-77
|
||||
Future relative time references: next, hence, coming.
|
||||
.TP
|
||||
.B 78-80
|
||||
Exact relative time references: exactly.
|
||||
.TP
|
||||
.B 81-85
|
||||
Noise words to be ignored: at, in, on.
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
Low level support functions and data are described in
|
||||
.LR <tm.h> .
|
||||
.SH EXAMPLES
|
||||
.EX
|
||||
#include <tm.h>
|
||||
main() {
|
||||
int i;
|
||||
time_t t;
|
||||
char buf[128];
|
||||
struct {
|
||||
char* date;
|
||||
char* format;
|
||||
} x[] = {
|
||||
"now", "%i",
|
||||
"2 months ago", "%C",
|
||||
"this Wednesday noon", "%x %I:%M %p",
|
||||
"last December 25", "%A",
|
||||
0, 0
|
||||
};
|
||||
for (i = 0; x[i].date; i++) {
|
||||
t = tmdate(x[i].date, (char*)0, (time_t*)0);
|
||||
(void)tmform(buf, x[i].format, &t);
|
||||
puts(buf);
|
||||
}
|
||||
}
|
||||
.EE
|
||||
produces
|
||||
.EX
|
||||
Fri Sep 30 12:10:14 USA EDT 1988
|
||||
Fri Jul 1 00:00:00 EDT 1988
|
||||
10/05/88 12:00 PM
|
||||
Friday
|
||||
.EE
|
||||
.SH "SEE ALSO"
|
||||
date(1), time(2), ctime(3)
|
||||
.SH BUGS
|
||||
.L "struct tm"
|
||||
values may get clobbered by the
|
||||
.I tm
|
||||
library routines as the
|
||||
.IR ctime (3)
|
||||
routines typically return pointers to a single static
|
||||
.L "struct tm"
|
||||
area.
|
||||
.L tmdate()
|
||||
uses an internal international time zone name table that will
|
||||
probably always be incomplete.
|
||||
206
cde/programs/dtksh/ksh93/src/lib/libast/man/tok.3
Normal file
206
cde/programs/dtksh/ksh93/src/lib/libast/man/tok.3
Normal file
@@ -0,0 +1,206 @@
|
||||
.\" $XConsortium: tok.3 /main/2 1996/10/29 15:16:39 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH TOK 3
|
||||
.SH NAME
|
||||
tok \- space separated token stream routines
|
||||
.SH SYNOPSIS
|
||||
.L "#include <ast.h>"
|
||||
.sp
|
||||
.L "void* tokopen(char* string)"
|
||||
.L "char* tokread(void* tok)"
|
||||
.L "void tokclose(void* tok)"
|
||||
.sp
|
||||
.L "int tokscan(char* string, char** next, const char* format, ...);"
|
||||
.sp
|
||||
.L "Sfio_t* tokline(const char* input, int flags, int* line);"
|
||||
.SH DESCRIPTION
|
||||
.L tokopen
|
||||
returns a pointer to a space separated token stream on the 0 terminated
|
||||
string
|
||||
.LR string .
|
||||
.L tokread
|
||||
returns a pointer to the next
|
||||
space separated token in the token stream
|
||||
.L tok
|
||||
as returned by
|
||||
.LR tokopen .
|
||||
0 is returned when no tokens remain.
|
||||
.L tokread
|
||||
temporarily modifies
|
||||
.L string
|
||||
by inserting 0's to terminate each token.
|
||||
.L tokclose
|
||||
closes the token stream and restores
|
||||
.L string
|
||||
to its original state.
|
||||
.PP
|
||||
.L tokscan
|
||||
scans the string
|
||||
.L string
|
||||
for tokens specified in
|
||||
.LR format .
|
||||
It is a more forgiving
|
||||
.IR sscanf (3).
|
||||
If
|
||||
.L "next != 0"
|
||||
then it will point to the next unread character in
|
||||
.L string
|
||||
on return.
|
||||
The number of scanned tokens is returned.
|
||||
.L \-1
|
||||
is returned if
|
||||
.L string
|
||||
was not empty and
|
||||
.L format
|
||||
failed to match and tokens.
|
||||
.PP
|
||||
.I space
|
||||
in
|
||||
.L format
|
||||
matches 0 or more
|
||||
.I space
|
||||
or
|
||||
.I tab
|
||||
characters.
|
||||
.I newline
|
||||
in format eats the remainder of the current line in
|
||||
.LR string .
|
||||
"...", '...' and \e\fIcharacter\fP quotes are interpreted.
|
||||
A quoted
|
||||
.I carriage-return
|
||||
is converted to
|
||||
.IR newline .
|
||||
.I newline
|
||||
in
|
||||
.L string
|
||||
is equivalent to end of string except when quoted.
|
||||
.I \enewline
|
||||
is a line splice.
|
||||
.PP
|
||||
.L %
|
||||
in
|
||||
.L format
|
||||
prefixes format conversion characters; each conversion character
|
||||
corresponds to a
|
||||
.L tokscan
|
||||
argument following the
|
||||
.L format
|
||||
argument.
|
||||
The format conversions are:
|
||||
.TP
|
||||
.L %c
|
||||
A single
|
||||
.LR char .
|
||||
.TP
|
||||
.L "%hd %d %ld"
|
||||
[short, int, long] base 10 integer.
|
||||
.TP
|
||||
.L "%hn %n %ln"
|
||||
[short, int, long] C-style base integer.
|
||||
.TP
|
||||
.L "%ho %o %lo"
|
||||
[short, int, long] base 8 integer.
|
||||
.TP
|
||||
.L %s
|
||||
String.
|
||||
.TP
|
||||
.L "%hu %u %lu"
|
||||
[short, int, long] C-style base unsigned integer.
|
||||
.TP
|
||||
.L %v
|
||||
The next two arguments are a pointer to a
|
||||
.L char**
|
||||
argument vector and the maximum number of elements in the vector.
|
||||
.TP
|
||||
.L "%hx %x %lx"
|
||||
[short, int, long] base 16 integer.
|
||||
.PP
|
||||
.L %s
|
||||
and
|
||||
.L %v
|
||||
data may also be counted length strings of the form
|
||||
\f5(\fIcount\fP:\fIdata\fP)\fR
|
||||
where
|
||||
.I count
|
||||
is the number of characters in
|
||||
.I data
|
||||
and the terminating
|
||||
.L )
|
||||
may also be a
|
||||
.IR tab ,
|
||||
or the data may be
|
||||
.L (null)
|
||||
which represents the
|
||||
.L NULL
|
||||
string.
|
||||
.PP
|
||||
.L tokline
|
||||
returns an
|
||||
.IR sfio (3)
|
||||
stream to a file or string that splices
|
||||
.I \enewline
|
||||
into single lines,
|
||||
allows "..." and '...' to quotes to span
|
||||
.I newlines
|
||||
(done by translating quoted
|
||||
.I newline
|
||||
to
|
||||
.IR carriage-return ;
|
||||
.L tokscan
|
||||
above converts quoted
|
||||
.I carriage-return
|
||||
back to
|
||||
.IR newline ),
|
||||
and deletes
|
||||
.I "# ... newline"
|
||||
comments.
|
||||
This is done by pushing an
|
||||
.I sfio
|
||||
discipline onto a string or file stream.
|
||||
Seeks are disabled on the resulting stream.
|
||||
If
|
||||
.L "flags == SF_READ"
|
||||
then
|
||||
.L input
|
||||
is a file name;
|
||||
If
|
||||
.L "flags == SF_STRING"
|
||||
then
|
||||
.L input
|
||||
is a 0 terminated string;
|
||||
otherwise
|
||||
.L input
|
||||
is an open
|
||||
.L Sfio_t*
|
||||
stream.
|
||||
If
|
||||
.L "line != 0"
|
||||
then it points to a line count that is initialized to 0
|
||||
and is incremented for each input line.
|
||||
.SH "SEE ALSO"
|
||||
sfio(3)
|
||||
60
cde/programs/dtksh/ksh93/src/lib/libast/man/touch.3
Normal file
60
cde/programs/dtksh/ksh93/src/lib/libast/man/touch.3
Normal file
@@ -0,0 +1,60 @@
|
||||
.\" $XConsortium: touch.3 /main/2 1996/10/29 15:16:52 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de LI
|
||||
.}S 5 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH TOUCH 3
|
||||
.SH NAME
|
||||
touch \- set file access and modify times
|
||||
.SH SYNOPSIS
|
||||
.L "#include <ast.h>"
|
||||
.sp
|
||||
.L "int touch(const char* path, time_t atime, time_t mtime, int force);"
|
||||
.SH DESCRIPTION
|
||||
.L touch
|
||||
sets the access and modify times of the file named by
|
||||
.LR path .
|
||||
If
|
||||
.L "force != 0"
|
||||
then the file is created if it doesn't exist;
|
||||
otherwise the file is not created and
|
||||
.L \-1
|
||||
is returned.
|
||||
If
|
||||
.L "force < 0"
|
||||
then
|
||||
.L atime
|
||||
and
|
||||
.L mtime
|
||||
are taken verbatim; otherwise
|
||||
.L "(time_t)(-1)"
|
||||
retains the current value for the file and
|
||||
.L "(time_t)(0)"
|
||||
uses the current time.
|
||||
.SH CAVEAT
|
||||
By default the change time is always changed to the current time.
|
||||
118
cde/programs/dtksh/ksh93/src/lib/libast/man/vecargs.3
Normal file
118
cde/programs/dtksh/ksh93/src/lib/libast/man/vecargs.3
Normal file
@@ -0,0 +1,118 @@
|
||||
.\" $XConsortium: vecargs.3 /main/2 1996/10/29 15:17:08 drk $
|
||||
.de L \" literal font
|
||||
.ft 5
|
||||
.it 1 }N
|
||||
.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6
|
||||
..
|
||||
.de LR
|
||||
.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de LI
|
||||
.}S 5 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de RL
|
||||
.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6"
|
||||
..
|
||||
.de EX \" start example
|
||||
.ta 1i 2i 3i 4i 5i 6i
|
||||
.PP
|
||||
.RS
|
||||
.PD 0
|
||||
.ft 5
|
||||
.nf
|
||||
..
|
||||
.de EE \" end example
|
||||
.fi
|
||||
.ft
|
||||
.PD
|
||||
.RE
|
||||
.PP
|
||||
..
|
||||
.TH VECARGS 3
|
||||
.SH NAME
|
||||
vecargs \- command argument vector insertion routines
|
||||
.SH SYNOPSIS
|
||||
.L "#include <vecargs.h>"
|
||||
.sp
|
||||
.L "char** vecload(char* string);"
|
||||
.L "char** vecfile(const char* path);"
|
||||
.L "char** vecstring(const char* string);"
|
||||
.L "void vecfree(char**, int);"
|
||||
.L "int vecargs(char** vec, int* argcp, char*** argvp);"
|
||||
.SH DESCRIPTION
|
||||
.L vecload
|
||||
loads a string vector from lines in
|
||||
.LR string .
|
||||
.L string
|
||||
may be modified upon return.
|
||||
Each line in
|
||||
.L string
|
||||
is treated as a new vector element.
|
||||
Lines with
|
||||
.L #
|
||||
as the first character are comments.
|
||||
.I \enewline
|
||||
joins consecutive lines.
|
||||
A string vector pointer is returned, 0 on error.
|
||||
.PP
|
||||
.L vecfile
|
||||
constructs a string vector by calling
|
||||
.L vecload
|
||||
on the contents of the file named by
|
||||
.LR path .
|
||||
The string vector pointer is returned, 0 on error.
|
||||
.PP
|
||||
.L vecstring
|
||||
constructs a string vector by calling
|
||||
.L vecload
|
||||
on a copy of
|
||||
.LR string .
|
||||
The string vector pointer is returned, 0 on error.
|
||||
.PP
|
||||
.L vecfree
|
||||
frees a string vector allocated by
|
||||
.LR vecfile ,
|
||||
.L vecload
|
||||
or
|
||||
.LR vecstring .
|
||||
.PP
|
||||
.L vecargs
|
||||
inserts the string vector
|
||||
.L vec
|
||||
(as returned by
|
||||
.LR vecfile ,
|
||||
.L vecload
|
||||
or
|
||||
.LR vecstring )
|
||||
between
|
||||
.L "(*argvp)[0]"
|
||||
and
|
||||
.LR "(*argvp)[1]" ,
|
||||
sliding
|
||||
.L "(*argvp)[1] ..."
|
||||
over.
|
||||
NULL and empty string args in
|
||||
.L vec
|
||||
are not copied.
|
||||
.L "vecfree(vec)"
|
||||
is called before the return.
|
||||
.L \-1
|
||||
is returned if the insertion failed.
|
||||
.SH EXAMPLES
|
||||
.L vecargs
|
||||
is commonly used to modify command
|
||||
.L argv
|
||||
from fixed files.
|
||||
For example,
|
||||
.IR make (1)
|
||||
checks for the files
|
||||
.L ./Makeargs
|
||||
and
|
||||
.L ./makeargs
|
||||
to modify its arguments on startup.
|
||||
Its a handy way to override default options on a directory by directory basis
|
||||
without modify the standard control files
|
||||
(\f5Makefile\fP in this case.)
|
||||
.SH CAVEAT
|
||||
This paradigm is not recommended for all commands; only a few exceptions
|
||||
make sense.
|
||||
468
cde/programs/dtksh/ksh93/src/lib/libast/man/vmalloc.3
Normal file
468
cde/programs/dtksh/ksh93/src/lib/libast/man/vmalloc.3
Normal file
@@ -0,0 +1,468 @@
|
||||
.\" $XConsortium: vmalloc.3 /main/2 1996/10/29 15:17:30 drk $
|
||||
.de MW
|
||||
\f5\\$1\fP
|
||||
..
|
||||
.TH VMALLOC 3 "16 January 1994"
|
||||
.SH NAME
|
||||
vmalloc \- virtual memory allocation
|
||||
.SH SYNOPSIS
|
||||
.MW "#include <vmalloc.h>"
|
||||
.SS Regions
|
||||
.nf
|
||||
.MW "Vmalloc_t* vmopen(Vmdisc_t* disc, Vmethod_t* meth, int flags);"
|
||||
.MW "int vmclose(Vmalloc_t*);"
|
||||
.MW "int vmclear(Vmalloc_t*);"
|
||||
.MW "int vmcompact(Vmalloc_t* region);"
|
||||
.MW "int vmset(Vmalloc_t* region, int flags, int type);"
|
||||
.MW "Vmalloc_t* Vmheap;"
|
||||
.MW "Vmalloc_t* Vmregion;"
|
||||
.fi
|
||||
.SS "Allocation functions"
|
||||
.nf
|
||||
.MW "Void_t* vmalloc(Vmalloc_t* region, size_t size);"
|
||||
.MW "Void_t* vmalign(Vmalloc_t* region, size_t size, size_t align);"
|
||||
.MW "Void_t* vmresize(Vmalloc_t* region, Void_t* addr, size_t size, int type);"
|
||||
.MW "int vmfree(Vmalloc_t* region, Void_t* addr);"
|
||||
.fi
|
||||
.SS "Debugging"
|
||||
.nf
|
||||
.MW "int vmdbcheck(Vmalloc_t* vm);"
|
||||
.MW "int vmdbwatch(Void_t* addr);"
|
||||
.MW "static void vmdbwarn(Vmalloc_t*, char* mesg, int n);"
|
||||
.fi
|
||||
.SS "Profiling"
|
||||
.nf
|
||||
.MW "void vmprofile(Vmalloc_t* vm, int fd);"
|
||||
.fi
|
||||
.SS "Information and statistics"
|
||||
.nf
|
||||
.MW "Vmalloc_t* vmregion(Void_t* addr);"
|
||||
.MW "Void_t* vmsegment(Vmalloc_t* region, Void_t* addr);"
|
||||
.MW "long vmaddr(Vmalloc_t* region, Void_t* addr);"
|
||||
.MW "long vmsize(Vmalloc_t* region, Void_t* addr);"
|
||||
.MW "int vmstat(Vmalloc_t* vm, Vmstat_t* statb);"
|
||||
.MW "int vmtrace(int fd);"
|
||||
.fi
|
||||
.SS "Malloc-compatible functions"
|
||||
.nf
|
||||
.MW "Void_t* malloc(size_t size);"
|
||||
.MW "Void_t* realloc(Void_t* addr, size_t size);"
|
||||
.MW "Void_t* calloc(size_t n_obj, size_t s_obj);"
|
||||
.MW "int cfree(Void_t* addr);"
|
||||
.MW "void free(Void_t* addr);"
|
||||
.MW "Void_t* memalign(size_t align, size_t size);"
|
||||
.MW "Void_t* valloc(size_t size);"
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
These functions for dynamic storage allocation work in
|
||||
\fIregions\fP of memory.
|
||||
Each region has an \fIallocation method\fP
|
||||
for parceling out blocks of storage and a
|
||||
\fImemory discipline\fP for obtaining raw space.
|
||||
Automatic locking prevents interference by reentrant
|
||||
access to a region.
|
||||
.PP
|
||||
Pointers to space have type \f5Void_t*\fP
|
||||
where \f5Void_t\fP is \f5#define\fPd as \f5void\fP if possible, otherwise \f5char\fP.
|
||||
Space is counted in type \f5size_t\fP.
|
||||
|
||||
.ne 4
|
||||
.SS Regions
|
||||
Regions have type \f5Vmalloc_t\fP.
|
||||
Two predefined regions are pointed to by:
|
||||
.TP
|
||||
.MW Vmheap
|
||||
A general-purpose region, with best-fit
|
||||
allocation, and Unix memory discipline \f5Vmdcsbrk\fP.
|
||||
.TP
|
||||
.MW Vmregion
|
||||
The default region for malloc-compatible functions; initially
|
||||
the same as \f5Vmheap\fP.
|
||||
.PP
|
||||
These functions manipulate regions:
|
||||
.PP
|
||||
.I vmopen
|
||||
creates a region with memory discipline \fIdisc\fP,
|
||||
allocation method \fImeth\fP,
|
||||
and a setting for control \fIflags\fP.
|
||||
It returns a pointer to the region on success and \f5NULL\fP on failure.
|
||||
The flags, represented by bit values or-ed together, are:
|
||||
.TP
|
||||
.MW VM_TRUST
|
||||
Disable locking and consistency checks, except under method \f5Vmdebug\fP.
|
||||
.TP
|
||||
.MW VM_TRACE
|
||||
Place tracing messages for each allocation event
|
||||
on the tracing file established by \fIvmtrace\fP.
|
||||
This turns off \f5VM_TRUST\fP.
|
||||
.TP
|
||||
\f5VM_DBCHECK\fP, \f5VM_DBABORT\fP
|
||||
.br
|
||||
See \fBDebugging\fP below.
|
||||
.PP
|
||||
.I vmclose
|
||||
closes a \fIregion\fP and releases all associated memory
|
||||
according to the region's discipline.
|
||||
The first segment obtained from the discipline's
|
||||
\f5memoryf\fP function (see `Disciplines' below) will be the last released.
|
||||
\fIvmclose\fP returns \-1 on failure and a non-negative value otherwise.
|
||||
.PP
|
||||
.I vmclear
|
||||
frees all allocated blocks in \fIregion\fP regardless of methods.
|
||||
It returns \-1 on failure and a non-negative value otherwise.
|
||||
.PP
|
||||
.I vmcompact
|
||||
releases as much of a \fIregion\fP's
|
||||
free space to its discipline's \f5memoryf\fP
|
||||
function as possible.
|
||||
It returns a nonnegative value on success and \-1 on failure.
|
||||
.PP
|
||||
.I vmset
|
||||
adjusts and queries a \fIregion\fP's \fIflags\fP.
|
||||
The indicated flags are turned on if \fItype\fP is nonzero, off if zero.
|
||||
\fIvmset\fP returns the previous value of all flags.
|
||||
Thus, \f5vmset(region,0,0)\fP queries the flags without changing them.
|
||||
In addition to the settable flags, one of
|
||||
\f5VM_MTBEST\fP, \f5VM_MTDEBUG\fP, \f5VM_MTPROFILE\fP,
|
||||
\f5VM_MTPOOL\fP, or \f5VM_MTLAST\fP
|
||||
is returned to indicate the method used in creating the \fIregion\fP.
|
||||
|
||||
.SS "Allocation functions"
|
||||
.I vmalloc
|
||||
returns a pointer to a block of the requested \fIsize\fP
|
||||
in a \fIregion\fP, aligned to the \fIstrictest alignment\fP
|
||||
that is suitable for the needs of any basic data type.
|
||||
It returns \f5NULL\fP on failure.
|
||||
.PP
|
||||
.I vmalign
|
||||
works like \fIvmalloc\fP, but returns a block aligned to a common
|
||||
multiple of \fIalign\fP and the \fIstrictest alignment\fP.
|
||||
.PP
|
||||
.I vmresize
|
||||
attempts to change the length of the block pointed to by
|
||||
\fIaddr\fP to the specified \fIsize\fP.
|
||||
If that is impossible and \fItype\fP
|
||||
is not 0, a new block is allocated and the old block is freed.
|
||||
If, in addition, \fItype\fP is positive, the new block is initialized with
|
||||
as much of the old contents as will fit.
|
||||
\fIvmresize\fP
|
||||
returns a pointer to the final block, or \f5NULL\fP on failure.
|
||||
If \fIaddr\fP is \f5NULL\fP, \fIvmresize\fP behaves like \fIvmalloc\fP;
|
||||
otherwise, if \fIsize\fP is 0, it behaves like \fIvmfree\fP.
|
||||
.PP
|
||||
.I vmfree
|
||||
makes the currently allocated block pointed to by
|
||||
\fIaddr\fP available for future allocations in its \fIregion\fP.
|
||||
If \fIaddr\fP is \f5NULL\fP, \fIvmfree\fP does nothing.
|
||||
It returns \-1 on error, and nonnegative otherwise.
|
||||
|
||||
.SS "Memory disciplines"
|
||||
Memory disciplines have type \f5Vmdisc_t\fP,
|
||||
a structure with these members:
|
||||
.in +.5i
|
||||
.nf
|
||||
.MW "Void_t* (*memoryf)(Vmalloc_t *region, Void_t* obj,"
|
||||
.ti +.5i
|
||||
.MW "size_t csz, size_t nsz, Vmdisc_t *disc);"
|
||||
.MW "int (*exceptf)(Vmalloc_t *region, int type, Void_t* obj, Vmdisc_t *disc);"
|
||||
.MW "int round;"
|
||||
.fi
|
||||
.in -.5i
|
||||
.TP
|
||||
.MW round
|
||||
If this value is positive, all size arguments to the
|
||||
\f5memoryf\fP function will be multiples of it.
|
||||
.TP
|
||||
.MW memoryf
|
||||
Points to a function to get or release segments of space for the
|
||||
\fIregion\fP.
|
||||
.TP
|
||||
.MW exceptf
|
||||
If this pointer is not \f5NULL\fP,
|
||||
the function it points to is called to announce
|
||||
events in a \fIregion\fP.
|
||||
.PP
|
||||
There are two standard disciplines.
|
||||
In both,
|
||||
\f5round\fP is 0, and \f5exceptf\fP is \f5NULL\fP.
|
||||
.TP
|
||||
.MW Vmdcsbrk
|
||||
A discipline whose \f5memoryf\fP function gets space from \fIsbrk\fP(2).
|
||||
.br
|
||||
.ns
|
||||
.TP
|
||||
.MW Vmdcheap
|
||||
A discipline whose \f5memoryf\fP function gets space from the region \f5Vmheap\fP.
|
||||
A region with \f5Vmdcheap\fP discipline and \f5Vmlast\fP
|
||||
allocation is good for building throwaway data structures.
|
||||
.PP
|
||||
A \fImemoryf\fP
|
||||
function returns a pointer to a memory segment on success, and \f5NULL\fP on failure.
|
||||
If \fIcsz\fP is 0, the function returns a new segment of size \fInsz\fP.
|
||||
Otherwise, the function attempts to change the length of the segment
|
||||
pointed to by \fIaddr\fP from \fIcsz\fP to \fInsz\fP.
|
||||
If this is successful, \f5memoryf\fP should return \fIaddr\fP (even if \fInsz\fP is 0).
|
||||
.PP
|
||||
An \fIexceptf\fP
|
||||
function is called for events identified by \fItype\fP, which is coded thus:
|
||||
.TP
|
||||
.MW VM_OPEN
|
||||
A new region is being opened.
|
||||
If this region is to manipulate memory
|
||||
already initialized by a previous \fIvmopen\fP call
|
||||
(perhaps by a different process on persistent or shared memory),
|
||||
the \fIexceptf\fP function should return a positive value.
|
||||
In addition, the argument \f5(Void_t**)\fP\fIobj\fP should be used
|
||||
to return the initial segment.
|
||||
If \fIexceptf\fP returns a non-positive value or if \f5*(Void_t**)\fP\fIobj\fP
|
||||
is \f5NULL\fP, the region opening proceeds normally.
|
||||
.TP
|
||||
.MW VM_CLOSE
|
||||
The region is being closed.
|
||||
If the \fIexceptf\fP
|
||||
function returns a negative value, the close will fail.
|
||||
.TP
|
||||
.MW VM_NOMEM
|
||||
An attempt to extend the region by the amount
|
||||
\f5(size_t)\fP\fIobj\fP failed. The region is unlocked, so the
|
||||
\fIexceptf\fP function may free blocks.
|
||||
If the function returns a positive value the memory
|
||||
request will be repeated; if zero, the allocation method
|
||||
will again invoke \fImemoryf\fP to get space;
|
||||
if negative, the allocation request will fail.
|
||||
.TP
|
||||
.MW VM_BADADDR
|
||||
Address \fIobj\fP, given to \fIvmfree\fP or \fIvmresize\fP,
|
||||
does not point to an allocated block from the region.
|
||||
|
||||
.SS "Allocation methods"
|
||||
There are five methods, of type \f5Vmethod_t*\fP:
|
||||
.TP
|
||||
.MW Vmbest
|
||||
An approximately best-fit allocation strategy.
|
||||
.TP
|
||||
.MW Vmlast
|
||||
A strategy for building structures that are only deleted in whole.
|
||||
Only the latest allocated block can be freed or resized.
|
||||
This means that after a block \f5a\fP is allocated,
|
||||
all previously allocated blocks are frozen (see also \fIvmclear\fP)
|
||||
and only \f5a\fP can ever be freed or resized.
|
||||
.TP
|
||||
.MW Vmpool
|
||||
A strategy for blocks of one size,
|
||||
set by the first \fIvmalloc\fP call after \fIvmopen\fP or \fIvmclear\fP.
|
||||
.TP
|
||||
.MW Vmdebug
|
||||
An allocation strategy with extra-stringent checking and locking
|
||||
regardless of the \f5VM_TRUST\fP flag.
|
||||
It is useful for finding misuses of dynamically allocated
|
||||
memory, such as writing beyond the boundary of a block, or
|
||||
freeing a block twice.
|
||||
.ne 3
|
||||
.TP
|
||||
.MW Vmprofile
|
||||
An allocation method that records and prints summaries of memory usage.
|
||||
|
||||
.SS Debugging
|
||||
The method \f5Vmdebug\fP is used to debug common memory violation problems.
|
||||
When a problem is found,
|
||||
a warning message is written to file descriptor 2 (standard error).
|
||||
In addition, if flag \f5VM_DBABORT\fP is on,
|
||||
the program is terminated by calling \fIabort\fP(2).
|
||||
Each message is a line of self-explanatory fields separated by colons.
|
||||
The optional flag \f5-DVMFL\fP, if used during compilation,
|
||||
enables recording of file names and line numbers.
|
||||
The following functions work with method \f5Vmdebug\fP.
|
||||
.PP
|
||||
.I vmdbcheck
|
||||
checks an entire \fIregion\fP
|
||||
for block boundary violations and other inconsistencies. It calls
|
||||
\fIvmdbwarn\fP when errors are found.
|
||||
If flag \f5VM_DBCHECK\fP is on for the region,
|
||||
\fIvmdbcheck\fP is called at each invocation of
|
||||
\fIvmalloc\fP, \fIvmfree\fP, or \fIvmresize\fP.
|
||||
.PP
|
||||
.I vmdbwatch
|
||||
causes address \fIaddr\fP
|
||||
to be watched, and reported whenever met in
|
||||
\fIvmalloc\fP, \fIvmresize\fP or \fIvmfree\fP.
|
||||
The watch list has finite size and if it becomes full,
|
||||
watches will be removed in a first-in-first-out fashion.
|
||||
If \fIaddr\fP is \f5NULL\fP,
|
||||
all current watches are canceled.
|
||||
\fIvmdbwatch\fP returns the watch bumped out due to an insertion
|
||||
into a full list or \f5NULL\fP otherwise.
|
||||
.PP
|
||||
.I vmdbwarn
|
||||
is an internal function that processes
|
||||
warning messages for discovered errors.
|
||||
It can't be called from outside the \fIvmalloc\fP package,
|
||||
but is a good place to plant debugger traps because
|
||||
control goes there at every trouble.
|
||||
|
||||
.SS "Profiling"
|
||||
The method \f5Vmprofile\fP is used to profile memory usage.
|
||||
Profiling data are maintained in private memory of a process so
|
||||
\f5Vmprofile\fP should be avoided from regions manipulating
|
||||
persistent or shared memory.
|
||||
The optional flag \f5-DVMFL\fP, if used during compilation,
|
||||
enables recording of file names and line numbers.
|
||||
.PP
|
||||
.I vmprofile
|
||||
prints memory usage summary.
|
||||
The summary is restricted to region \fIvm\fP if \fIvm\fP is not \f5NULL\fP;
|
||||
otherwise, it is for all regions created with \f5Vmprofile\fP.
|
||||
Summary records are written to file descriptor \fIfd\fP as lines with
|
||||
colon-separated fields. Here are some of the fields:
|
||||
.TP
|
||||
.I n_alloc,n_free:
|
||||
Number of allocation and free calls respectively. Note that a resize
|
||||
operation is coded as a free and an allocation.
|
||||
.TP
|
||||
.I s_alloc,s_free:
|
||||
Total amounts allocated and freed. The difference between these numbers
|
||||
is the amount of space not yet freed.
|
||||
.TP
|
||||
.I max_busy, extent:
|
||||
These fields are only with the summary record for region.
|
||||
They show the maximum busy space at any time and the extent of the region.
|
||||
|
||||
.SS "Information and statistics"
|
||||
.I vmregion
|
||||
returns the region to which the block pointed to by
|
||||
\fIaddr\fP belongs.
|
||||
This works only in regions that allocate with
|
||||
\f5Vmbest\fP, \f5Vmdebug\fP or \f5Vmprofile\fP.
|
||||
If multiple regions manipulate the same segment of memory,
|
||||
\fIvmregion\fP returns the region that causes the creation that memory segment.
|
||||
.PP
|
||||
.I vmsegment
|
||||
finds if some segment of memory in \fIregion\fP
|
||||
contains the address \fIaddr\fP.
|
||||
It returns the address of a found segment or \f5NULL\fP if none found.
|
||||
.PP
|
||||
.I vmaddr
|
||||
checks whether \fIaddr\fP
|
||||
points to an address within some allocated block of the given region.
|
||||
If not, it returns \-1.
|
||||
If so, it returns the offset from the beginning of the block.
|
||||
The function does not work for a \f5Vmlast\fP region except
|
||||
on the latest allocated block.
|
||||
.PP
|
||||
.I vmsize
|
||||
returns the size of the allocated block pointed to by \fIaddr\fP.
|
||||
It returns \-1 if \fIaddr\fP
|
||||
does not point to a valid block in the region.
|
||||
Sizes may be padded beyond that requested; in
|
||||
particular no block has size 0.
|
||||
The function does not work for a \f5Vmlast\fP region except
|
||||
on the latest allocated block.
|
||||
.PP
|
||||
.I vmstat
|
||||
gathers statistics on the given \fIregion\fP and returns that
|
||||
information in the \f5Vmstat_t\fP structure pointed to by \fIstatb\fP.
|
||||
A \f5Vmstat_t\fP structure has at least these members:
|
||||
.in +.5i
|
||||
.nf
|
||||
.ta \w'\f5size_t \fP'u +\w'\f5extent \fP'u
|
||||
.MW "int n_busy; /* number of busy blocks */
|
||||
.MW "int n_free; /* number of free blocks */
|
||||
.MW "size_t s_busy; /* total busy space */
|
||||
.MW "size_t s_free; /* total free space */
|
||||
.MW "size_t m_busy; /* maximum size of busy block */
|
||||
.MW "size_t m_free; /* maximum size of free block */
|
||||
.MW "int n_seg; /* number of segments in region */
|
||||
.MW "size_t extent; /* total size of the region */
|
||||
.fi
|
||||
.in -.5i
|
||||
.PP
|
||||
Bookeeping overhead is counted in \f5extent\fP,
|
||||
but not in \f5s_busy\fP or \f5s_free\fP.
|
||||
.PP
|
||||
.I vmtrace
|
||||
establishes file descriptor \fIfd\fP
|
||||
as the trace file and returns
|
||||
the previous value of the trace file descriptor.
|
||||
The trace descriptor is initially invalid.
|
||||
Output is sent to the trace file by successful allocation
|
||||
events when flag \f5VM_TRACE\fP is on.
|
||||
.PP
|
||||
Tools for analyzing traces are described in \fImtreplay\fP(1).
|
||||
The trace record for an allocation event
|
||||
is a line with colon-separated fields, four numbers and one string.
|
||||
.TP
|
||||
.I old
|
||||
Zero for a fresh allocation;
|
||||
the address argument for freeing and resizing.
|
||||
.TP
|
||||
.I new
|
||||
Zero for freeing;
|
||||
the address returned by allocation or resizing.
|
||||
.TP
|
||||
.I size
|
||||
The size argument for allocation or resizing;
|
||||
the size freed by freeing.
|
||||
Sizes may differ due to padding for alignment.
|
||||
.TP
|
||||
.I region
|
||||
The address of the affected region.
|
||||
.TP
|
||||
.I method
|
||||
A string that tells the region's method:
|
||||
\f5best\fP, \f5last\fP, \f5pool\fP, \f5profile\fP, or \f5debug\fP.
|
||||
|
||||
.SS "Malloc-compatible functions"
|
||||
Functions in this set work in region \f5Vmregion\fP
|
||||
and provide the behaviors of \fImalloc\fP(3).
|
||||
The functions
|
||||
\fImemalign\fP and \fIvalloc\fP are like \fIvmalign\fP
|
||||
with the \fIregion\fP argument fixed to \f5Vmregion\fP;
|
||||
\fIvalloc\fP further restricts alignment to page boundaries.
|
||||
.PP
|
||||
The \fImalloc\fP functions are instrumented for run-time debugging,
|
||||
profiling and tracing.
|
||||
When these modes are enable, time and space performance will be affected.
|
||||
For accurate reporting of files and line numbers,
|
||||
code should include \f5vmalloc.h\fP and compile with \f5-DVMFL\fP.
|
||||
|
||||
The following environment variables drive different modes:
|
||||
.TP
|
||||
.I VMETHOD
|
||||
This defines the method to use for allocation.
|
||||
Its value should be one of the strings:
|
||||
\fIVmbest, Vmdebug, Vmprofile, Vmlast, Vmpool\fP.
|
||||
The 'V' can be in lower case.
|
||||
.TP
|
||||
.I VMDEBUG
|
||||
This is ignored if
|
||||
a method other than \f5Vmdebug\fP has been selected with \fIVMETHOD\fP.
|
||||
\fIVMDEBUG\fP can be any combination of `a',
|
||||
a decimal number and a list of hexadecimal numbers.
|
||||
`a' causes the program to abort on any discovered allocation error.
|
||||
A hexadecimal number starts with either \fI0x\fP or \fI0X\fP
|
||||
and defines an address to watch (see \fIvmdbwatch\fP).
|
||||
Any other number is taken to be decimal and defines a period \fIp\fP
|
||||
to check the arena for integrity. The default period is 1, ie, the
|
||||
arena is checked on every call to a \fImalloc\fP function.
|
||||
Other letters not part of the defined set are ignored.
|
||||
.TP
|
||||
.I VMPROFILE
|
||||
This is ignored if a method other than \f5Vmprofile\fP
|
||||
has been selected by \fIVMETHOD\fP or \fIVMDEBUG\fP.
|
||||
\fIVMPROFILE\fP defines a file name to store profile data.
|
||||
Each instance of the pattern `%p' found in \fIVMPROFILE\fP
|
||||
is transformed to the process id of the running process.
|
||||
If the file cannot be created, file descriptor 2 (standard error)
|
||||
is used for output.
|
||||
.TP
|
||||
.I VMTRACE
|
||||
If this defines a valid writable file, trace messages of all allocation calls
|
||||
are written to the given file (see \fIvmopen()\fP and \fIvmtrace()\fP).
|
||||
Similar to \fIVMPROFILE\fP, each instance of the pattern `%p' found
|
||||
in \fIVMTRACE\fP is turned to the process id of the running process.
|
||||
|
||||
.SH SEE ALSO
|
||||
\fImtreplay\fP(1), \fImalloc\fP(3).
|
||||
|
||||
.SH AUTHOR
|
||||
Kiem-Phong Vo, kpv@research.att.com, AT&T Bell Laboratories
|
||||
Reference in New Issue
Block a user