blob: f1a2fd1ae5a91ed87efee3e2db16df06868cdb65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include <stdio.h>
#include "uip.h"
/* easier to copy/paste this tiny function from uip.c
than it would be to rebuild all of uIP for use in
this program! Also don't want to bloat fujiconf by
linking uip.a, even if it would link without a
recompile. */
/*
u16_t local_htons(u16_t val) {
return HTONS(val);
}
*/
/* this version's half the size */
static u16_t local_htons(u16_t val) {
__AX__ = val;
asm("sta tmp1");
asm("txa");
asm("ldx tmp1");
}
static char ipbuf[20];
char *format_ip(uip_ipaddr_t *ip) {
u16_t *ipaddr = (u16_t *)ip;
sprintf(ipbuf, "%d.%d.%d.%d",
local_htons(ipaddr[0]) >> 8,
local_htons(ipaddr[0]) & 0xff,
local_htons(ipaddr[1]) >> 8,
local_htons(ipaddr[1]) & 0xff);
return ipbuf;
}
|