home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
100-199
/
ff183.lzh
/
Mklib
/
Edlib
/
Edlib.man
< prev
next >
Wrap
Text File
|
1989-02-26
|
19KB
|
741 lines
Here are the man pages for the library functions:
This is for edlib version 1.0 04/08/88
BINTOINT(3) Library Functions BINTOINT(3)
NAME
bintoint - give the binary value of a string of binary digits
SYNOPSIS
#include <edlib.h>
int bintoint(number)
char *number;
DESCRIPTION
Bintoint takes a string that may have been read in with scanf(3)
or from the console, and treats it as if it were a binary number.
The integer value of the binary number is returned. Bintoint
stops at the first character that is not a '1' or a '0'. If the
first character in the string is not a binary digit, then a value
of 0 is returned.
AUTHOR
Edwin Hoogerbeets 01/08/88
SEE ALSO
dectoint(3), hextoint(3), toint(3)
GETOPT(3) Library Functions GETOPT(3)
NAME
getopt - get option letter from argv
SYNOPSIS
#include <edlib.h>
int getopt(argc, argv, optstring)
inta argc;
char **optstring;
extern char *optarg;
extern int optind;
DESCRIPTION
Getopt returns the next option letter in argv that matches a
letter in optstring. Optstring is a string of recognized
option letters; if a letter is followed by a colon, the
option is expected to have an argument that may or may not
be separated from it by white space. Optarg is set to point
to the start of the option argument on return from getopt.
Getopt places in optind the argv index of the next argument
to be processed. Because optind is external, it is normally
initialized to zero automatically before the first call to
getopt.
When an option that is not in the list occurs, a NULL is
returned and the optarg pointer is set to point to the
first character of the null terminated string. This is done
so that options may be specified with other parameters
interspersed between them.
DIAGNOSTICS
Getopt prints an error message on stderr and returns a ques-
tion mark (?) when it encounters an option letter not
included in optstring.
EXAMPLE
The following code fragment shows how one might process the
arguments for a command that can take the mutually exclusive
options a and b, and the options f and o, both of which
require arguments:
main(argc, argv)
int argc;
char **argv;
{
int c;
extern int optind;
extern char *optarg;
.
.
.
while ((c = getopt(argc, argv, "abf:o:")) != EOF)
switch (c) {
case `a':
if (bflg)
errflg++;
else
aflg++;
break;
case `b':
if (aflg)
errflg++;
else
bproc();
break;
case `f':
ifile = optarg;
break;
case `o':
ofile = optarg;
break;
case `?':
default:
errflg++;
break;
}
if (errflg) {
fprintf(stderr, "Usage: ...");
exit(2);
}
for (; optind < argc; optind++) {
.
.
.
}
.
.
.
}
HISTORY
Written by Henry Spencer, working from a Bell Labs manual
page. Modified by Keith Bostic to behave more like the Sys-
tem V version. Ported to the Amiga and modified to take
options anywhere by Edwin (Deepthot) Hoogerbeets.
BUGS
It is not obvious how `-' standing alone should be treated;
this version treats it as a non-option argument, which is
not always right.
Option arguments are allowed to begin with `-'; this is rea-
sonable but reduces the amount of error checking possible.
Getopt is quite flexible but the obvious price must be paid:
there is much it could do that it doesn't, like checking
mutually exclusive options, checking type of option argu-
ments, etc.
DECTOINT(3) Library Functions DECTOINT(3)
NAME
dectoint - give the decimal value of a string of decimal digits
SYNOPSIS
#include <edlib.h>
int dectoint(number)
char *number;
DESCRIPTION
Dectoint takes a string that may have been read in with scanf(3)
or from the console, and treats it as if it were a decimal number.
The integer value of the decimal number is returned. Dectoint
stops at the first character that is not a decimal digit. If the
first character in the string is not a decimal digit, then a value
of 0 is returned.
AUTHOR
Edwin Hoogerbeets 01/08/88
SEE ALSO
bintoint(3), hextoint(3), toint(3)
HEXTOINT(3) Library Functions HEXTOINT(3)
NAME
hextoint - give the decimal value of a string of decimal digits
SYNOPSIS
#include <edlib.h>
int hextoint(number)
char *number;
DESCRIPTION
Hextoint takes a string that may have been read in with scanf(3)
or from the console, and treats it as if it were a hexadecimal
number. The integer value of the hexadecimal number is returned.
Hextoint stops at the first character that is not a hexadecimal
digit. If the first character in the string is not a hexadecimal
digit, then a value of 0 is returned.
AUTHOR
Edwin Hoogerbeets 01/08/88
SEE ALSO
bintoint(3), dectoint(3), toint(3)
ISBDIGIT(3) Library Functions ISBDIGIT(3)
NAME
isbdigit - tell whether given character is a binary digit
SYNOPSIS
#include <edlib.h>
int isbdigit(c)
char c;
DESCRIPTION
Isbdigit returns a 1 if the given characters is either a '1'
or a '0'. Isbdigit returns a 0 for all other characters.
AUTHOR
Edwin Hoogerbeets 01/08/88
SEE ALSO
isdigit(3), isodigit(3), isxdigit(3)
ISCSYM(3) Library Functions ISCSYM(3)
NAME
iscsym - tell whether given character could be found in a C
symbol
SYNOPSIS
#include <edlib.h>
int iscsym(c)
char c;
DESCRIPTION
Iscsym tells whether it is possible that the given character
could appear in a C symbol. A C symbol might be the name of a
variable, structure, reserved word or a function. Not all
characters that are valid in a C symbol may be the first
character of an identifier in most implementations of C. In
most versions, the characters allowed after the first character
are the upper and lower case alphabetic characters, the digits
'0' to '9' and the underscore (_).
AUTHOR
Edwin Hoogerbeets 01/08/88
SEE ALSO
iscsymf(3)
BUGS
This function depends on the C compiler used, and thus the
characters that are valid in a C symbol may be different, even
on the same machine.
ISCSYMF(3) Library Functions ISCSYMF(3)
NAME
iscsymf - tell whether given character could be found as the
first character of a C symbol
SYNOPSIS
#include <edlib.h>
int iscsymf(c)
char c;
DESCRIPTION
Iscsymf tells whether it is possible that the given character
could appear as the first character of a C symbol. A C symbol
might be the the name of a variable, structure, reserved word
or a functions. Not all characters that are valid in a C symbol
may be the first character of an identifier in most implementations
of C. In most versions, the characters allowed as the first
character are the upper and lower case alphbetic characters and
the underscore (_).
AUTHOR
Edwin Hoogerbeets 01/08/88
SEE ALSO
iscsym(3)
BUGS
This function depends on the C compiler used, and thus the
characters that are valid as the intial character in a C symbol
may be different, even on the same machine.
ISODIGIT(3) Library Functions ISODIGIT(3)
NAME
isodigit - tell whether given character is an octal digit
SYNOPSIS
#include <edlib.h>
int isodigit(c)
char c;
DESCRIPTION
Isodigit returns a 1 if the given characters is an octal digit.
Isodigit returns a 0 for all other characters.
AUTHOR
Edwin Hoogerbeets 01/08/88
SEE ALSO
isdigit(3), isbdigit(3), isxdigit(3)
STOUPPER(3) Library Functions STOUPPER(3)
NAME
stoupper - convert a string to only upper case characters
SYNOPSIS
#include <edlib.h>
char *stoupper(str)
char *str;
DESCRIPTION
Stoupper takes a pointer to a null terminated string and
converts each lower case character into its upper case
equivalent. All other characters are left untouched.
AUTHOR
Edwin Hoogerbeets 01/08/88
SEE ALSO
stolower(3)
STOLOWER(3) Library Functions STOLOWER(3)
NAME
stolower - convert a string to only lower case characters
SYNOPSIS
char *stolower(str)
char *str;
DESCRIPTION
Stolower takes a pointer to a null terminated string and
converts each upper case character into its lower case
equivalent. All other characters are left untouched.
AUTHOR
Edwin Hoogerbeets 01/08/88
SEE ALSO
stoupper(3)
STRCSPN(3) Library Functions STRCSPN(3)
NAME
strcspn - find the length of the longest intial segment of a
string that consists of characters not from a certain set.
SYNOPSIS
#include <edlib.h>
int strcspn(str, charset)
char *str, *charset;
DESCRIPTION
Strcspn searches the null terminated string 'str' for characters
in the set 'charset'. The length of the longest intial string
that consists of characters not from 'charset' is returned. If no
characters of 'str' are also members of 'charset', then the
length of 'str' is returned. If 'charset' is null then this
will also cause the full length of 'str' to be returned.
This function is also known as instr.
AUTHOR
Daniel J. Barrett.
barrett@cs.jhu.edu or ins_adjb@jhunix.UUCP
SEE ALSO
strspn(3)
STRICMP(3) Library Functions STRICMP(3)
NAME
stricmp - compare two strings with case insensitivity
SYNOPSIS
#include <edlib.h>
int stricmp(str1,str2)
char *str1,*str2;
DESCRIPTION
Stricmp lexographically compares the two null terminated strings.
It returns a number less than zero if the first differing
character of str1 is less than that of str2, zero if the two
strings are equal, and a number greater than zero if the
first differing character in str1 is greater than the
corresponding character of str2. Stricmp works like strcmp(3)
except that all alphabetic characters are treated as lower case
for the purposes of the comparison.
AUTHOR
Edwin Hoogerbeets 01/08/88
SEE ALSO
strcmp(3), strncmp(3), strnicmp(3)
STRNICMP(3) Library Functions STRNICMP(3)
NAME
strnicmp - compare two strings with case insensitivity up to
a certain length
SYNOPSIS
#include <edlib.h>
int strnicmp(str1,str2,len)
char *str1,*str2;
int len;
DESCRIPTION
Strnicmp lexographically compares the two null terminated
strings up to the length 'len'. It returns a number less than
zero if the first differing character of str1 is less than that
of str2, zero if the two strings are equal, and a number greater
than zero if the first differing character in str1 is greater
than the corresponding character of str2. Strnicmp works like
strncmp(3) except that all alphabetic characters are treated as
lower case for the purposes of the comparison.
AUTHOR
Edwin Hoogerbeets 01/08/88
SEE ALSO
strcmp(3), strncmp(3), stricmp(3)
STRPBRK(3) Library Functions STRPBRK(3)
NAME
strpbrk - find the first occurance of a character of a set in
a string
SYNOPSIS
#include <edlib.h>
char *strpbrk(str, charset)
char *str, *charset;
DESCRIPTION
Strpbrk searches forwards through the null terminated string
'str' for occurances of a character included in the character
set 'charset'. The 'charset' variable is null terminated string
that is treated as a character set. Therefore, repetition and
order are ignored. Strpbrk returns a pointer to the first
character of 'charset' that is found in 'str'.
DIAGNOSTICS
If no character in 'charset' is found in 'str', then a null
pointer (NULL) is returned.
AUTHOR
Daniel J. Barrett.
barrett@cs.jhu.edu or ins_adjb@jhunix.UUCP
SEE ALSO
strrpbrk(3), strcspn(3), strspn(3)
STRPOS(3) Library Functions STRPOS(3)
NAME
strpos - give the first position of a character withing a string
SYNOPSIS
#include <edlib.h>
int strpos(string,key)
char *string;
char key;
DESCRIPTION
Strpos searches the null terminated string 'string' for the
first occurance of the character 'key'. The position of this
character is returned. The terminating null character is
considered to be part of the string for the purposes of this
search. Thus, using strpos to find the null will give the
same result as a strlen(3).
Some implementations of C use a variant called scnstr.
DIAGNOSTICS
Strpos returns a -1 if the character is not found in the string.
AUTHOR
Edwin Hoogerbeets 01/08/88
SEE ALSO
strrpos(3)
STRRPBRK(3) Library Functions STRRPBRK(3)
NAME
strrpbrk - find the last occurance of a character of a set in
a string
SYNOPSIS
#include <edlib.h>
char *strrpbrk(str, charset)
char *str, *charset;
DESCRIPTION
Strrpbrk searches backwards through the null terminated string
'str' for occurances of a character included in the character
set 'charset'. The 'charset' variable is null terminated string
that is treated as a character set. Therefore, repetition and
order are ignored. Strrpbrk returns a pointer to the last
character of 'charset' that is found in 'str'.
DIAGNOSTICS
If no character in 'charset' is found in 'str', then a null
pointer (NULL) is returned.
AUTHOR
Edwin Hoogerbeets 01/08/88 modified from strpbrk(3) by:
Daniel J. Barrett.
barrett@cs.jhu.edu or ins_adjb@jhunix.UUCP
SEE ALSO
strpbrk(3), strcspn(3), strspn(3)
STRRPOS(3) Library Functions STRRPOS(3)
NAME
strrpos - give the last position of a character withing a string
SYNOPSIS
#include <edlib.h>
int strrpos(string,key)
char *string;
char key;
DESCRIPTION
Strrpos searches the null terminated string 'string' for the
last occurance of the character 'key'. The position of this
character is returned. The terminating null character is
considered to be part of the string for the purposes of this
search. Thus, using strrpos to find the null will give the
same result as a strlen(3).
DIAGNOSTICS
Strrpos returns a -1 if the character is not found in the
string.
AUTHOR
Edwin Hoogerbeets 01/08/88
SEE ALSO
strpos(3)
STRSPN(3) Library Functions STRSPN(3)
NAME
strspn - find the length of the longest intial segment
of a string that consists of characters from a certain set.
SYNOPSIS
#include <edlib.h>
int strspn(str, charset)
char *str, *charset;
DESCRIPTION
Strspn searches the null terminated string 'str' for characters
in the set 'charset'. The length of the longest intial string
that consists of characters from 'charset' is returned. If all
characters of 'str' are also members of 'charset', then the
length of 'str' is returned. If 'charset' is null then this
function will return a zero as none of the characters in 'str'
could possibly be in the set.
This function is also known as notstr.
AUTHOR
Daniel J. Barrett.
barrett@cs.jhu.edu or ins_adjb@jhunix.UUCP
SEE ALSO
strcspn(3)
STRTOK(3) Library Functions STRTOK(3)
NAME
strtok - search a string for tokens delimited by characters
from a set
SYNOPSIS
#include <edlib.h>
char *strtok(buf, separators)
char *buf, *separators;
DESCRIPTION
Strtok searches the null terminated string 'buf' for tokens
delimited by characters from the character set 'separators'.
The null terminated string 'separators' is treated as a set.
Thus, repetition and order are ignored. Strtok replaces the
separator character with a null byte and returns a pointer to
the beginning of the token, effectively singling out the first
token. Subsequent calls to strtok with the parameter 'buf' set
to NULL returns the next token after the previous one using the
same string as previous invocations. The character set
'separators' may be different at each invocation.
DIAGNOSTICS
If no token is found, a NULL pointer is returned.
EXAMPLE
Here is an example program demonstrating strtok(3).
#include <stdio.h>
extern char *strtok();
char tokesep[] = " \n\t\rx";
main()
{
char buf[BUFSIZ], *tokep;
while (fgets(buf, sizeof(buf), stdin)) {
tokep = strtok(buf, tokesep);
do {
printf("Token is %s\n", tokep);
tokep = strtok((char *)NULL, tokesep);
}while (tokep);
}
}
AUTHOR
Daniel J. Barrett.
barrett@cs.jhu.edu or ins_adjb@jhunix.UUCP
TOINT(3) Library Functions TOINT(3)
NAME
toint - return the hexadecimal value of a character
SYNOPSIS
#include <edlib.h>
int toint(c)
char c;
DESCRIPTION
Toint treats the character 'c' as a hexadecimal character and
returns its integer equivalent.
DIAGNOSTICS
returned.
AUTHOR
Edwin Hoogerbeets 01/08/88