chiark / gitweb /
regress: Rename Tensurerecordfile to Tensuresetup
[adns.git] / regress / hplayback.c.m4
index 18cbd0f2dcdbee54a45afdba2b0f9eef99776962..e0aba98543f8b8d97aeaf53b7120bc9b91419005 100644 (file)
@@ -105,7 +105,7 @@ void T_gettimeofday_hook(void) {
   FR_WRITE(delta);
 }
 
-void Tensurerecordfile(void) {
+void Tensuresetup(void) {
   int fd;
   int chars;
   unsigned long sec, usec;
@@ -195,16 +195,19 @@ static void Pfdset(fd_set *set, int max) {
   
   if (vb2.buf[vb2.used++] != hm_squote[hm_squote) Psyntax("fd set start not [");
   FD_ZERO(set);
-  if (vb2.buf[vb2.used] == hm_squote]hm_squote) { vb2.used++; return; }
-  for (;;) {
-    ul= strtoul(vb2.buf+vb2.used,&ep,10);
-    if (ul>=max) Psyntax("fd set member > max");
-    if (ep == (char*)vb2.buf+vb2.used) Psyntax("empty entry in fd set");
-    FD_SET(ul,set);
-    vb2.used= ep - (char*)vb2.buf;
-    c= vb2.buf[vb2.used++];
-    if (c == hm_squote]hm_squote) break;
-    if (c != hm_squote,hm_squote) Psyntax("fd set separator not ,");
+  if (vb2.buf[vb2.used] == hm_squote]hm_squote) {
+    vb2.used++;
+  } else {
+    for (;;) {
+      ul= strtoul(vb2.buf+vb2.used,&ep,10);
+      if (ul>=max) Psyntax("fd set member > max");
+      if (ep == (char*)vb2.buf+vb2.used) Psyntax("empty entry in fd set");
+      FD_SET(ul,set);
+      vb2.used= ep - (char*)vb2.buf;
+      c= vb2.buf[vb2.used++];
+      if (c == hm_squote]hm_squote) break;
+      if (c != hm_squote,hm_squote) Psyntax("fd set separator not ,");
+    }
   }
 
   uint16_t accum;
@@ -288,6 +291,14 @@ static void Paddr(struct sockaddr *addr, int *lenr) {
   if (*ep && *ep != ' ') Psyntax("invalid port (bad syntax)");
   if (ul >= 65536) Psyntax("port too large");
 
+  if (Tfuzzrawfile) {
+    int tl = strlen(p);
+    FR_WRITE(tl);
+    FR_write(p,tl);
+    uint16_t port16 = ul;
+    FR_WRITE(port16);
+  }
+
   a.len= sizeof(a.addr);
   err= adns_text2addr(p, (int)ul, 0, &a.addr.sa,&a.len);
   if (err) Psyntax("invalid address");
@@ -327,7 +338,7 @@ static int Pbytes(byte *buf, int maxlen) {
 void Q_vb(void) {
   const char *nl;
 
-  Tensurerecordfile();
+  Tensuresetup();
   if (!adns__vbuf_ensure(&vb2,vb.used+2)) Tnomem();
   fread(vb2.buf,1,vb.used+2,Tinputfile);
   if (feof(Tinputfile)) {