add a few man pages

master
leitner 21 years ago
parent 4eed466fbc
commit e0f6355a91

@ -4,7 +4,7 @@ fmt_long \- write an ASCII representation of a long integer
.SH SYNTAX
.B #include <fmt.h>
unsigned int \fBfmt_long\fP(char *\fIdest\fR,unsigned int \fIsource\fR);
unsigned int \fBfmt_long\fP(char *\fIdest\fR,long \fIsource\fR);
.SH DESCRIPTION
fmt_long writes an ASCII representation ('-' and '0' to '9', base 10) of
\fIsource\fR to \fIdest\fR and returns the number of bytes written.

@ -0,0 +1,20 @@
.TH fmt_longlong 3
.SH NAME
fmt_longlong \- write an ASCII representation of a long long integer
.SH SYNTAX
.B #include <fmt.h>
unsigned int \fBfmt_longlong\fP(char *\fIdest\fR,long long \fIsource\fR);
.SH DESCRIPTION
fmt_longlong writes an ASCII representation ('-' and '0' to '9', base 10) of
\fIsource\fR to \fIdest\fR and returns the number of bytes written.
fmt_longlong does not append \\0.
If \fIdest\fR equals FMT_LEN (i.e. is zero), fmt_longlong returns the number
of bytes it would have written.
For convenience, fmt.h defines the integer FMT_LONG to be big enough to
contain every possible fmt_longlong output plus \\0.
.SH "SEE ALSO"
scan_longlong(3)

@ -0,0 +1,20 @@
.TH fmt_ulonglong 3
.SH NAME
fmt_ulonglong \- write an ASCII representation of an unsigned long long integer
.SH SYNTAX
.B #include <fmt.h>
unsigned int \fBfmt_ulonglong\fP(char *\fIdest\fR,unsigned long long \fIsource\fR);
.SH DESCRIPTION
fmt_ulonglong writes an ASCII representation ('0' to '9', base 10) of
\fIsource\fR to \fIdest\fR and returns the number of bytes written.
fmt_ulonglong does not append \\0.
If \fIdest\fR equals FMT_LEN (i.e. is zero), fmt_ulonglong returns the
number of bytes it would have written.
For convenience, fmt.h defines the integer FMT_ULONG to be big enough to
contain every possible fmt_ulonglong output plus \\0.
.SH "SEE ALSO"
scan_ulonglong(3)

@ -0,0 +1,21 @@
.TH fmt_xlonglong 3
.SH NAME
fmt_xlonglong \- write a hexadecimal ASCII representation of an unsigned long long integer
.SH SYNTAX
.B #include <fmt.h>
unsigned int \fBfmt_xlonglong\fP(char *\fIdest\fR,unsigned long long \fIsource\fR);
.SH DESCRIPTION
fmt_xlonglong writes an ASCII representation ('0' to '9' and 'a' to 'f',
base 16) of \fIsource\fR to \fIdest\fR and returns the number of bytes
written.
fmt_xlonglong does not append \\0.
If \fIdest\fR equals FMT_LEN (i.e. is zero), fmt_xlonglong returns the
number of bytes it would have written.
For convenience, fmt.h defines the integer FMT_XLONG to be big enough to
contain every possible fmt_xlonglong output plus \\0.
.SH "SEE ALSO"
scan_xlonglong(3)

@ -24,4 +24,8 @@ int open_trunc(const char *filename);
* Return the file handle or -1 on error. */
int open_write(const char* filename);
/* open filename for reading and writing. Create file if not there.
* Return file handle or -1 on error. */
int open_rw(const char* filename);
#endif

@ -0,0 +1,14 @@
.TH open_rw 3
.SH NAME
open_rw \- open a file for reading and writing
.SH SYNTAX
.B #include <open.h>
extern int \fBopen_rw\fP(const char *\fIfilename\fR);
.SH DESCRIPTION
open_rw opens the file \fIfilename\fR for reading and writing use and
returns the file handle. If the file does not exist, it will be created
with mode 0644. If there was an error opening or creating the file,
open_rw returns -1 and sets errno accordingly.
.SH "SEE ALSO"
open(2)

@ -0,0 +1,11 @@
#include <unistd.h>
#include <fcntl.h>
#include "open.h"
#ifndef O_NDELAY
#define O_NDELAY 0
#endif
int open_rw(const char *filename) {
return open(filename,O_RDWR|O_CREAT|O_NDELAY,0644);
}

@ -1,6 +1,6 @@
.TH scan_longlong 3
.SH NAME
scan_longlong \- parse an long integer in decimal ASCII representation
scan_longlong \- parse a long integer in decimal ASCII representation
.SH SYNTAX
.B #include <scan.h>

@ -0,0 +1,13 @@
.TH scan_short 3
.SH NAME
scan_short \- parse an integer in decimal ASCII representation
.SH SYNTAX
.B #include <scan.h>
int \fBscan_short\fP(const char *\fIsrc\fR,short int *\fIdest\fR);
.SH DESCRIPTION
scan_short parses a short integer in decimal ASCII representation
from \fIsrc\fR and writes the result into \fIdest\fR. It returns the
number of bytes read from \fIsrc\fR.
.SH "SEE ALSO"
scan_int(3), scan_ushort(3), scan_xshort(3), scan_8short(3), fmt_short(3)

@ -0,0 +1,13 @@
.TH scan_ulonglong 3
.SH NAME
scan_ulonglong \- parse an unsigned long integer in decimal ASCII representation
.SH SYNTAX
.B #include <scan.h>
int \fBscan_ulonglong\fP(const char *\fIsrc\fR,unsigned long long *\fIdest\fR);
.SH DESCRIPTION
scan_ulonglong parses an unsigned long long integer in decimal ASCII representation
from \fIsrc\fR and writes the result into \fIdest\fR. It returns the
number of bytes read from \fIsrc\fR.
.SH "SEE ALSO"
scan_longlong(3), fmt_ulonglong(3)

@ -0,0 +1,17 @@
.TH scan_xlonglong 3
.SH NAME
scan_xlonglong \- parse an unsigned long long integer in hexadecimal ASCII representation
.SH SYNTAX
.B #include <scan.h>
int \fBscan_xlonglong\fP(const char *\fIsrc\fR,unsigned long long* \fIdest\fR);
.SH DESCRIPTION
scan_xlonglong parses an unsigned long long integer in hexadecimal ASCII
representation from \fIsrc\fR and writes the result into \fIdest\fR. It
returns the number of bytes read from \fIsrc\fR.
scan_xlonglong understands both upper and lower case letters.
scan_xlonglong does not expect or understand a "0x" prefix.
.SH "SEE ALSO"
fmt_xlonglong(3)

@ -0,0 +1,13 @@
#include "scan.h"
unsigned int scan_xlonglong(const char* src,unsigned long long* dest) {
register const char *tmp=src;
register int l=0;
register unsigned char c;
while ((c=scan_fromhex(*tmp))<16) {
l=(l<<4)+c;
++tmp;
}
*dest=l;
return tmp-src;
}
Loading…
Cancel
Save