Bladeren bron

use sys/poll.h instead of poll.h for iopause

scan_ip6 returned 1 for "::"
master
Felix von Leitner 18 jaren geleden
bovenliggende
commit
623f2afe51
4 gewijzigde bestanden met toevoegingen van 19 en 8 verwijderingen
  1. +1
    -0
      CHANGES
  2. +1
    -1
      iopause.h2
  3. +8
    -7
      socket/scan_ip6.c
  4. +9
    -0
      t.c

+ 1
- 0
CHANGES Bestand weergeven

@@ -5,6 +5,7 @@
extended uudecode test. See comment at top for details.
fix #include in ndelay*.3 (Hynek Schlawack)
add stralloc_diff and stralloc_diffs (my invention)
scan_ip6 returned 1 for "::" (Uwe Ohse)

0.14:
avoid bus errors in byte_copy


+ 1
- 1
iopause.h2 Bestand weergeven

@@ -5,7 +5,7 @@
#define IOPAUSE_POLL

#include <sys/types.h>
#include <poll.h>
#include <sys/poll.h>

typedef struct pollfd iopause_fd;
#define IOPAUSE_READ POLLIN


+ 8
- 7
socket/scan_ip6.c Bestand weergeven

@@ -27,13 +27,13 @@ unsigned int scan_ip6(const char *s,char ip[16])
for (i=0; i<16; i++) ip[i]=0;
for (;;) {
if (*s == ':') {
len++;
if (s[1] == ':') { /* Found "::", skip to part 2 */
s+=2;
len++;
++len;
++s;
if (*s == ':') { /* Found "::", skip to part 2 */
++len;
++s;
break;
}
s++;
}
i = scan_xlong(s,&u);
if (!i) return 0;
@@ -59,11 +59,12 @@ unsigned int scan_ip6(const char *s,char ip[16])
break;
s++;
len++;
} else if (suffixlen!=0)
} else if (suffixlen)
break;
i = scan_xlong(s,&u);
if (!i) {
len--;
if (suffixlen)
--len;
break;
}
if (suffixlen+prefixlen<=12 && s[i]=='.') {


+ 9
- 0
t.c Bestand weergeven

@@ -7,6 +7,7 @@
#include "socket.h"
#include "buffer.h"
#include "ip4.h"
#include "ip6.h"
#include "mmap.h"
#include "open.h"
#include "byte.h"
@@ -22,6 +23,12 @@
__asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx")

int main(int argc,char* argv[]) {
char ip[16];
char buf[32];
printf("%d (expect 2)\n",scan_ip6("::",ip));
printf("%d (expect 3)\n",scan_ip6("::1",ip));
printf("%d (expect 16)\n",scan_ip6("fec0:0:0:ffff::1/0",ip));
printf("%.*s\n",fmt_ip6(buf,ip),buf);
#if 0
static stralloc s,t;
stralloc_copys(&s,"fnord");
@@ -31,6 +38,7 @@ int main(int argc,char* argv[]) {
stralloc_copys(&t,"fnordh"); printf("%d\n",stralloc_diff(&s,&t));
stralloc_copys(&t,"hausen"); printf("%d\n",stralloc_diff(&s,&t));
#endif
#if 0
static stralloc s;
stralloc_copys(&s,"fnord");
printf("%d\n",stralloc_diffs(&s,"abc"));
@@ -38,6 +46,7 @@ int main(int argc,char* argv[]) {
printf("%d\n",stralloc_diffs(&s,"fnord"));
printf("%d\n",stralloc_diffs(&s,"fnordh"));
printf("%d\n",stralloc_diffs(&s,"hausen"));
#endif
#if 0
printf("%d\n",case_starts("fnordhausen","FnOrD"));
printf("%d\n",case_starts("fnordhausen","blah"));


Laden…
Annuleren
Opslaan