From 1a3d6ebe8e4a4a8e05a01c3a72a1871b50f62189 Mon Sep 17 00:00:00 2001 From: leitner Date: Mon, 5 Feb 2001 18:08:57 +0000 Subject: [PATCH] add routines to put number in buffer. --- buffer.h | 5 +++++ buffer/buffer_put8long.c | 8 ++++++++ buffer/buffer_putlong.c | 8 ++++++++ buffer/buffer_putulong.c | 8 ++++++++ buffer/buffer_putxlong.c | 8 ++++++++ socket/socket_listen.c | 5 +++++ 6 files changed, 42 insertions(+) create mode 100644 buffer/buffer_put8long.c create mode 100644 buffer/buffer_putlong.c create mode 100644 buffer/buffer_putulong.c create mode 100644 buffer/buffer_putxlong.c create mode 100644 socket/socket_listen.c diff --git a/buffer.h b/buffer.h index 5b4da28..32fd51d 100644 --- a/buffer.h +++ b/buffer.h @@ -47,6 +47,11 @@ extern void buffer_seek(buffer* b,unsigned int len); extern int buffer_copy(buffer* out,buffer* in); +int buffer_putulong(buffer *b,unsigned long l); +int buffer_put8long(buffer *b,unsigned long l); +int buffer_putxlong(buffer *b,unsigned long l); +int buffer_putlong(buffer *b,unsigned long l); + extern buffer *buffer_0; extern buffer *buffer_0small; extern buffer *buffer_1; diff --git a/buffer/buffer_put8long.c b/buffer/buffer_put8long.c new file mode 100644 index 0000000..8ee0a7b --- /dev/null +++ b/buffer/buffer_put8long.c @@ -0,0 +1,8 @@ +#include "buffer.h" +#include "fmt.h" + +int buffer_put8long(buffer *b,unsigned long l) { + char buf[FMT_8LONG]; + return buffer_put(b,buf,fmt_8long(buf,l)); +} + diff --git a/buffer/buffer_putlong.c b/buffer/buffer_putlong.c new file mode 100644 index 0000000..1d11527 --- /dev/null +++ b/buffer/buffer_putlong.c @@ -0,0 +1,8 @@ +#include "buffer.h" +#include "fmt.h" + +int buffer_putlong(buffer *b,unsigned long l) { + char buf[FMT_ULONG]; + return buffer_put(b,buf,fmt_long(buf,l)); +} + diff --git a/buffer/buffer_putulong.c b/buffer/buffer_putulong.c new file mode 100644 index 0000000..0e6da90 --- /dev/null +++ b/buffer/buffer_putulong.c @@ -0,0 +1,8 @@ +#include "buffer.h" +#include "fmt.h" + +int buffer_putulong(buffer *b,unsigned long l) { + char buf[FMT_ULONG]; + return buffer_put(b,buf,fmt_ulong(buf,l)); +} + diff --git a/buffer/buffer_putxlong.c b/buffer/buffer_putxlong.c new file mode 100644 index 0000000..7938646 --- /dev/null +++ b/buffer/buffer_putxlong.c @@ -0,0 +1,8 @@ +#include "buffer.h" +#include "fmt.h" + +int buffer_putxlong(buffer *b,unsigned long l) { + char buf[FMT_XLONG]; + return buffer_put(b,buf,fmt_xlong(buf,l)); +} + diff --git a/socket/socket_listen.c b/socket/socket_listen.c new file mode 100644 index 0000000..7bca292 --- /dev/null +++ b/socket/socket_listen.c @@ -0,0 +1,5 @@ +#include + +int socket_listen(int s,unsigned int backlog) { + return listen(s, backlog); +}