chiark / gitweb /
Typos.
[disorder] / lib / client.c
index 09e542693b9e5fb7376106138d3f504c197eedf3..0ba9c86233b495c4380ec3aec15e3c26a541bca9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of DisOrder.
- * Copyright (C) 2004-2010 Richard Kettlewell
+ * Copyright (C) 2004-13 Richard Kettlewell
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include "common.h"
 
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/un.h>
-#include <unistd.h>
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#if HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+#if HAVE_SYS_UN_H
+# include <sys/un.h>
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 #include <errno.h>
-#include <netdb.h>
-#include <pcre.h>
+#if HAVE_NETDB_H
+# include <netdb.h>
+#endif
+#if HAVE_PCRE_H
+# include <pcre.h>
+#endif
 
 #include "log.h"
 #include "mem.h"
@@ -219,24 +231,25 @@ static int disorder_simple_v(disorder_client *c,
       } else if(arg == disorder__list) {
        char **list = va_arg(ap, char **);
        int nlist = va_arg(ap, int);
+        int n;
        if(nlist < 0) {
          for(nlist = 0; list[nlist]; ++nlist)
            ;
        }
-       for(int n = 0; n < nlist; ++n) {
+       for(n = 0; n < nlist; ++n) {
          dynstr_append(&d, ' ');
          dynstr_append_string(&d, quoteutf8(arg));
        }
       } else if(arg == disorder__integer) {
        long n = va_arg(ap, long);
        char buffer[16];
-       snprintf(buffer, sizeof buffer, "%ld", n);
+       byte_snprintf(buffer, sizeof buffer, "%ld", n);
        dynstr_append(&d, ' ');
        dynstr_append_string(&d, buffer);
       } else if(arg == disorder__time) {
        time_t n = va_arg(ap, time_t);
        char buffer[16];
-       snprintf(buffer, sizeof buffer, "%lld", (long long)n);
+       byte_snprintf(buffer, sizeof buffer, "%lld", (long long)n);
        dynstr_append(&d, ' ');
        dynstr_append_string(&d, buffer);
       } else {
@@ -251,10 +264,11 @@ static int disorder_simple_v(disorder_client *c,
       goto write_error;
     xfree(d.vec);
     if(has_body) {
+      int n;
       if(nbody < 0)
         for(nbody = 0; body[nbody]; ++nbody)
           ;
-      for(int n = 0; n < nbody; ++n) {
+      for(n = 0; n < nbody; ++n) {
         if(body[n][0] == '.')
           if(fputc('.', c->fpout) < 0)
             goto write_error;
@@ -556,7 +570,7 @@ int disorder_connect(disorder_client *c) {
  *
  * If @p cookie is NULL or does not work then we attempt to log in as
  * guest instead (so when the cookie expires only an extra round trip
- * is needed rathre than a complete new login).
+ * is needed rather than a complete new login).
  */
 int disorder_connect_cookie(disorder_client *c,
                            const char *cookie) {