Browse Source

Lots of good clean-ups from Jukka Zitting!

master
Felix von Leitner 19 years ago
parent
commit
d9ce04f950
  1. 1
      fmt.h
  2. 4
      fmt/fmt_long.3
  3. 12
      fmt/fmt_strn.c
  4. 2
      fmt/fmt_ulong0.c
  5. 2
      ip6.h
  6. 4
      socket/socket_send6.3
  7. 2
      str/str_diffn.3
  8. 2
      str/str_start.c
  9. 4
      uint/uint16_pack.3
  10. 5
      uint/uint16_pack_big.3
  11. 2
      uint/uint16_unpack.3
  12. 2
      uint/uint16_unpack_big.3
  13. 4
      uint/uint32_pack.3
  14. 5
      uint/uint32_pack_big.3
  15. 2
      uint/uint32_unpack.3
  16. 2
      uint/uint32_unpack_big.3
  17. 2
      uint16.h

1
fmt.h

@ -1,6 +1,7 @@
#ifndef FMT_H
#define FMT_H
#define FMT_LONG 41 /* enough space to hold -2^127 in decimal, plus \0 */
#define FMT_ULONG 40 /* enough space to hold 2^128 - 1 in decimal, plus \0 */
#define FMT_8LONG 44 /* enough space to hold 2^128 - 1 in octal, plus \0 */
#define FMT_XLONG 33 /* enough space to hold 2^128 - 1 in hexadecimal, plus \0 */

4
fmt/fmt_long.3

@ -14,7 +14,7 @@ fmt_long does not append \\0.
If \fIdest\fR equals FMT_LEN (i.e. is zero), fmt_long 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_ulong output plus \\0.
For convenience, fmt.h defines the integer FMT_LONG to be big enough to
contain every possible fmt_long output plus \\0.
.SH "SEE ALSO"
scan_long(3)

12
fmt/fmt_strn.c

@ -3,12 +3,12 @@
unsigned int fmt_strn(char *out,const char *in,unsigned int limit) {
register char* s=out;
register const char* t=in;
register const char* u=out+limit;
register const char* u=in+limit;
for (;;) {
if (!*t) break; *s=*t; if (s==u) break; ++s; ++t;
if (!*t) break; *s=*t; if (s==u) break; ++s; ++t;
if (!*t) break; *s=*t; if (s==u) break; ++s; ++t;
if (!*t) break; *s=*t; if (s==u) break; ++s; ++t;
if (!*t) break; if (s) { *s=*t; ++s; } if (t==u) break; ++t;
if (!*t) break; if (s) { *s=*t; ++s; } if (t==u) break; ++t;
if (!*t) break; if (s) { *s=*t; ++s; } if (t==u) break; ++t;
if (!*t) break; if (s) { *s=*t; ++s; } if (t==u) break; ++t;
}
return s-out;
return t-in;
}

2
fmt/fmt_ulong0.c

@ -8,7 +8,7 @@ unsigned int fmt_ulong0(char *dest,unsigned long i,unsigned int pad) {
/* now see if we need to pad */
if (dest) {
while (len<pad) { *dest='0'; ++dest; ++len; }
fmt_uint(dest,i);
fmt_ulong(dest,i);
return len;
} else
return (len<pad?pad:len);

2
ip6.h

@ -1,6 +1,8 @@
#ifndef IP6_H
#define IP6_H
#include "byte.h"
extern unsigned int scan_ip6(const char *src,char *ip);
extern unsigned int fmt_ip6(char *dest,const char *ip);

4
socket/socket_send6.3

@ -11,8 +11,8 @@ socket_send6 sends \fIlen\fR bytes starting at \fIbuf\fR in a UDP
datagram over the socket \fIs\fR to UDP port \fIport\fR on IP address
\fIip\fR.
You can call socket_send6 without calling socket_bind4. This has the
effect as first calling socket_bind4 with IP address :: and port 0.
You can call socket_send6 without calling socket_bind6. This has the
effect as first calling socket_bind6 with IP address :: and port 0.
The meaning of \fIscope_id\fR is dependent on the implementation and
IPv6 IP. On link-local IPv6 addresses it specifies the outgoing

2
str/str_diffn.3

@ -11,7 +11,7 @@ string \fIa\fR[0], \fIa\fR[1], ..., \fIa\fR[n]=='\\0' is
lexicographically smaller than, equal to, or greater than the string
\fIb\fR[0], \fIb\fR[1], ..., \fIb\fR[m-1]=='\\0'.
If the strings are different, str_diff does not read bytes past the
If the strings are different, str_diffn does not read bytes past the
first difference. The strings will be considered equal if the first
\fIlimit\fR characters match.
.SH "SEE ALSO"

2
str/str_start.c

@ -1,4 +1,4 @@
#include "byte.h"
#include "str.h"
/* str_start returns 1 if the b is a prefix of a, 0 otherwise */
int str_start(const char* a, const char* b) {

4
uint/uint16_pack.3

@ -11,8 +11,8 @@ void \fBuint16_pack\fP(char \fIs\fR[2],uint16 \fIu\fR);
uint16 is a 16-bit unsigned integer type, normally either unsigned int
or unsigned long.
uint16_unpack portably reads a uint16 as stored on a little-endian
architecture from \fIs\fR and writes it info \fIr\fR in the native byte order.
uint16_pack portably writes a uint16 \fIu\fR to \fIs\fR in
little-endian byte order.
.SH "SEE ALSO"
uint16_unpack(3), uint16_pack_big(3)

5
uint/uint16_pack_big.3

@ -11,9 +11,8 @@ void \fBuint16_pack_big\fP(char \fIs\fR[2],uint16 \fIu\fR);
uint16 is a 16-bit unsigned integer type, normally either unsigned int
or unsigned long.
uint16_unpack_big portably reads a uint16 as stored on a big-endian
architecture (i.e. in network byte order) from \fIs\fR and writes it
info \fIr\fR in the native byte order.
uint16_pack_big portably writes a uint16 \fIu\fR to \fIs\fR in
big-endian (i.e. network) byte order.
.SH "SEE ALSO"
uint16_unpack_big(3), uint16_pack(3)

2
uint/uint16_unpack.3

@ -12,7 +12,7 @@ uint16 is a 16-bit unsigned integer type, normally either unsigned int
or unsigned long.
uint16_unpack portably reads a uint16 as stored on a little-endian
architecture from \fIs\fR and writes it info \fIr\fR in the native byte order.
architecture from \fIs\fR and writes it info \fIu\fR in the native byte order.
.SH "SEE ALSO"
uint16_pack(3), uint16_unpack_big(3)

2
uint/uint16_unpack_big.3

@ -13,7 +13,7 @@ or unsigned long.
uint16_unpack_big portably reads a uint16 as stored on a big-endian
architecture (i.e. in network byte order) from \fIs\fR and writes it
info \fIr\fR in the native byte order.
info \fIu\fR in the native byte order.
.SH "SEE ALSO"
uint16_pack_big(3), uint16_unpack(3)

4
uint/uint32_pack.3

@ -11,8 +11,8 @@ void \fBuint32_pack\fP(char \fIs\fR[4],uint32 \fIu\fR);
uint32 is a 32-bit unsigned integer type, normally either unsigned int
or unsigned long.
uint32_unpack portably reads a uint32 as stored on a little-endian
architecture from \fIs\fR and writes it info \fIr\fR in the native byte order.
uint32_pack portably writes a uint32 \fIu\fR to \fIs\fR in
little-endian byte order.
.SH "SEE ALSO"
uint32_unpack(3), uint32_pack_big(3)

5
uint/uint32_pack_big.3

@ -11,9 +11,8 @@ void \fBuint32_pack_big\fP(char \fIs\fR[4],uint32 \fIu\fR);
uint32 is a 32-bit unsigned integer type, normally either unsigned int
or unsigned long.
uint32_unpack_big portably reads a uint32 as stored on a big-endian
architecture (i.e. in network byte order) from \fIs\fR and writes it
info \fIr\fR in the native byte order.
uint32_pack_big portably writes a uint16 \fIu\fR to \fIs\fR in
big-endian (i.e. network) byte order.
.SH "SEE ALSO"
uint32_unpack_big(3), uint32_pack(3)

2
uint/uint32_unpack.3

@ -12,7 +12,7 @@ uint32 is a 32-bit unsigned integer type, normally either unsigned int
or unsigned long.
uint32_unpack portably reads a uint32 as stored on a little-endian
architecture from \fIs\fR and writes it info \fIr\fR in the native byte order.
architecture from \fIs\fR and writes it info \fIu\fR in the native byte order.
.SH "SEE ALSO"
uint32_pack(3), uint32_unpack_big(3)

2
uint/uint32_unpack_big.3

@ -13,7 +13,7 @@ or unsigned long.
uint32_unpack_big portably reads a uint32 as stored on a big-endian
architecture (i.e. in network byte order) from \fIs\fR and writes it
info \fIr\fR in the native byte order.
info \fIu\fR in the native byte order.
.SH "SEE ALSO"
uint32_pack_big(3), uint32_unpack(3)

2
uint16.h

@ -1,8 +1,6 @@
#ifndef UINT16_H
#define UINT16_H
#include <sys/cdefs.h>
typedef unsigned short uint16;
#if defined(__i386__) && !defined(NO_UINT16_MACROS)

Loading…
Cancel
Save