chiark / gitweb /
protogen: more consistent arg passing + fix login commands.
authorRichard Kettlewell <rjk@terraraq.org.uk>
Sat, 6 Aug 2011 15:46:57 +0000 (16:46 +0100)
committerRichard Kettlewell <rjk@terraraq.org.uk>
Sat, 6 Aug 2011 17:19:08 +0000 (18:19 +0100)
lib/client-stubs.c
scripts/protocol

index f995043..92dd3e2 100644 (file)
@@ -36,7 +36,7 @@ int disorder_allfiles(disorder_client *c, const char *dir, const char *re, char
 int disorder_confirm(disorder_client *c, const char *confirmation) {
   char *u;
   int rc;
-  if((rc = disorder_simple(c, &u, "confirm", confirmation  )))
+  if((rc = disorder_simple(c, &u, "confirm", confirmation, (char *)0)))
     return rc;
   c->user = u;
   return 0;
@@ -45,7 +45,7 @@ int disorder_confirm(disorder_client *c, const char *confirmation) {
 int disorder_cookie(disorder_client *c, const char *cookie) {
   char *u;
   int rc;
-  if((rc = disorder_simple(c, &u, "cookie", cookie  )))
+  if((rc = disorder_simple(c, &u, "cookie", cookie, (char *)0)))
     return rc;
   c->user = u;
   return 0;
index 6bf9126..0704942 100755 (executable)
@@ -218,24 +218,30 @@ sub simple {
             join(", ", "c", 0, "\"$cmd\"", @cargs, "(char *)0"),
             ");\n");
     } elsif($return->[0] eq 'string') {
-       push(@c, "  return dequote(disorder_simple(c, $return->[1]p, \"$cmd\"",
-            map(", $_", @cargs),
-            ", (char *)0), $return->[1]p);\n");
+       push(@c, "  return dequote(disorder_simple(",
+             join(", ", "c", "$return->[1]p", "\"$cmd\"",
+                  @cargs,
+                  "(char *)0"),
+             "), $return->[1]p);\n");
     } elsif($return->[0] eq 'boolean') {
        push(@c, "  char *v;\n",
             "  int rc;\n",
-            "  if((rc = disorder_simple(c, &v, \"$cmd\"",
-            map(", $_", @cargs),
-            ", (char *)0)))\n",
+            "  if((rc = disorder_simple(",
+             join(", ", "c", "&v", "\"$cmd\"",
+                  @cargs,
+                  "(char *)0"),
+             ")))\n",
             "    return rc;\n",
             "  return boolean(\"$cmd\", v, $return->[1]p);\n");
     } elsif($return->[0] eq 'integer') {
        push(@c, "  char *v;\n",
             "  int rc;\n",
             "\n",
-            "  if((rc = disorder_simple(c, &v, \"$cmd\"",
-            map(", $_", @cargs),
-            ", (char *)0)))\n",
+            "  if((rc = disorder_simple(",
+             join(", ", "c", "&v", "\"$cmd\"",
+                  @cargs,
+                  "(char *)0"),
+             ")))\n",
             "    return rc;\n",
             "  *$return->[1]p = atol(v);\n",
             "  xfree(v);\n",
@@ -243,23 +249,29 @@ sub simple {
     } elsif($return->[0] eq 'user') {
        push(@c, "  char *u;\n",
             "  int rc;\n",
-            "  if((rc = disorder_simple(c, &u, \"$cmd\"",
-            map(", $_", @cargs),
-            "  )))\n",
+            "  if((rc = disorder_simple(",
+             join(", ", "c", "&u", "\"$cmd\"",
+                  @cargs, "(char *)0"),
+             ")))\n",
             "    return rc;\n",
             "  c->user = u;\n",
             "  return 0;\n");
     } elsif($return->[0] eq 'body') {
-       push(@c, "  return disorder_simple_list(c, $return->[1]p, n$return->[1]p, \"$cmd\"",
-            map(", $_", @cargs),
-            ", (char *)0);\n");
+       push(@c, "  return disorder_simple_list(",
+             join(", ", "c", "$return->[1]p", "n$return->[1]p", "\"$cmd\"",
+                  @cargs,
+                  "(char *)0"),
+            ");\n");
     } elsif($return->[0] eq 'queue') {
        push(@c, "  return somequeue(c, \"$cmd\", $return->[1]p);\n");
     } elsif($return->[0] eq 'queue-one') {
        push(@c, "  return onequeue(c, \"$cmd\", $return->[1]p);\n");
     } elsif($return->[0] eq 'pair-list') {
-       push(@c, "  return pairlist(c, $return->[1]p, \"$cmd\"",
-            map(", $_", @cargs), ", (char *)0);\n");
+       push(@c, "  return pairlist(",
+             join(", ", "c", "$return->[1]p", "\"$cmd\"",
+                  @cargs,
+                  "(char *)0"),
+             ");\n");
     } else {
        die "$0: C API: unknown type '$return->[0]' for '$cmd'\n";
     }