extern int inet_aton(const char *__cp, struct in_addr *__inp);
extern in_addr_t inet_addr(const char *__cp);
extern in_addr_t inet_network(const char *__cp);
-/* Awkward - struct argument .. may need hacks for 6502 ?? */
-extern char *inet_ntoa(struct in_addr __in);
+/* Awkward - struct argument .. hacks needed */
+extern char *_inet_ntoa(uint32_t a);
+#define inet_ntoa(x) (_inet_ntoa((x).s_addr))
/* Modern APIs */
extern const char *inet_ntop(int __af, const void *__src, char *__dst,
#ifndef _NETINET_IN_H
#define _NETINET_IN_H
+#include <sys/socket.h>
+
typedef uint16_t in_port_t;
typedef uint32_t in_addr_t;
-CC = sdcc
+CC = fcc
ASM = sdasz80
AR = sdar
LINKER = sdldz80
PLATFORM =
export PLATFORM
#CC_OPT = -mz80 -c --opt-code-size --std-c99 --max-allocs-per-node 2000000 -I../include
-CC_OPT = -mz80 --std-c99 -c --opt-code-size --max-allocs-per-node 20000 -I../include
+#CC_OPT = -mz80 --std-c99 -c --opt-code-size --max-allocs-per-node 20000 -I../include -I../../Kernel/include
# for stuff that gives sdcc nightmares
-CC_NOOPT = -mz80 --std-c99 -c --opt-code-size --max-allocs-per-node 1000 -I../include
+#CC_NOOPT = -mz80 --std-c99 -c --opt-code-size --max-allocs-per-node 1000 -I../include
+CC_OPT = -O2 -c
+CC_NOOPT = -c
ASM_OPT = -l -o -s
LINKER_OPT = -m -i -o
SRC_CRT0 = crt0$(PLATFORM).s
SRC_C += getenv.c __getgrent.c getgrgid.c getgrnam.c getloadavg.c getlogin.c
SRC_C += getopt.c
SRC_C += getpw.c __getpwent.c getpwnam.c getpwuid.c gets.c gettimeofday.c
-SRC_C += getw.c gmtime.c gmtime_r.c grent.c index.c isatty.c killpg.c
+SRC_C += getw.c gmtime.c gmtime_r.c grent.c
+SRC_C += inet_addr.c inet_aton.c inet_network.c inet_ntoa.c inet_ntop.c inet_pton.c
+SRC_C += index.c isatty.c killpg.c
SRC_C += libintl.c
SRC_C += localtim.c localtim_r.c lseek.c lsearch.c lstat.c ltoa.c ltostr.c
SRC_C += malloc.c mkfifo.c mkstemps.c nanosleep.c opendir.c opendir_r.c
*/
int inet_aton(const char *cp, struct in_addr *addr)
{
- u_int32_t val;
+ uint32_t val;
int base, n;
char c;
unsigned int parts[4];
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <string.h>
#include <stdlib.h>
-char *inet_ntoa(struct in_addr in)
+char *_inet_ntoa(uint32_t in)
{
static char b[18];
- uint8_t *p = (uint8_t)∈
- uint8_t *o = b;
+ uint8_t *p = (uint8_t *)∈
+ char *o = b;
- while(p != ((uint8_t *)&in) + 3)
+ while(p != ((uint8_t *)&in) + 3) {
strcpy(o, _itoa(*p++));
o += strlen(o);
*o++ = '.';
#include <sys/types.h>
#include <netinet/in.h>
-#include <arap/inet.h>
+#include <arpa/inet.h>
+#include <string.h>
#include <errno.h>
const char *inet_ntop(int af, const void *src, char *dst, socklen_t size)
/* This isn't strictly correct because it means we are not
re-entrant. Really we need to rework _itoa() to have a re-entrant
base form, then rework inet_ntoa to use inet_ntop FIXME */
- return strcpy(dst, inet_ntoa(*(uint32_t *)src);
+ return strcpy(dst, _inet_ntoa(*(uint32_t *)src));
}
/* Unlike the legacy interfaces this one requires decimal and four
dotted quads */
- src = quad(src, *p++);
- src = quad(src, *p++);
- src = quad(src, *p++);
- src = quad(src, *p);
+ src = quad(src, p++);
+ src = quad(src, p++);
+ src = quad(src, p++);
+ src = quad(src, p);
if (src == NULL || *src)
return 0;
return 1;