vfs: check userland buffers before reading them.
[haiku.git] / src / tests / kits / net / ufunc.c
blobfbaa794d88c5b84d8f6ebc1aa20e9a74c5f7855e
1 /* Utility functions for the test apps */
3 #include <stdio.h>
4 #include <kernel/OS.h>
5 #include <string.h>
6 #include <sys/time.h>
7 #include <malloc.h>
9 #include "sys/socket.h"
10 #include "netinet/in.h"
11 #include "arpa/inet.h"
12 #include "sys/select.h"
14 #include "ufunc.h"
16 void err(int error, char *msg)
18 printf("Error: %s\n", msg);
19 printf("Code: %d\n", error);
20 printf("Desc: %s\n", strerror(error));
21 exit(-1);
24 void test_banner(char *msg)
26 int sl = strlen(msg);
27 char *buf = (char*)malloc(sl + 5);
29 memset(buf, '=', sl + 4);
30 printf("%s\n", buf);
31 buf[1] = buf[sl + 2] = ' ';
32 memcpy(&buf[2], msg, sl);
33 printf("%s\n", buf);
34 memset(buf, '=', sl + 4);
35 printf("%s\n", buf);