reindent-20030715
[openafs.git] / src / rx / rxperf.c
index a5848a8..90aca79 100644 (file)
@@ -62,8 +62,8 @@ RCSID("$Id$");
 #include <unistd.h>
 #include <signal.h>
 #ifdef HAVE_ERRX
-#include <err.h> /* not stricly right, but if we have a errx() there
-                 * is hopefully a err.h */
+#include <err.h>               /* not stricly right, but if we have a errx() there
+                                * is hopefully a err.h */
 #endif
 #include "rx.h"
 #include "rx_null.h"
@@ -85,12 +85,12 @@ warnx(const char *fmt, ...)
 
     va_start(args, fmt);
     fprintf(stderr, "%s: ", __progname);
-    vfprintf (stderr, fmt, args);
+    vfprintf(stderr, fmt, args);
     fprintf(stderr, "\n");
     va_end(args);
 }
 #endif /* !HAVE_WARNX */
-     
+
 #ifndef HAVE_ERRX
 static void
 errx(int eval, const char *fmt, ...)
@@ -99,7 +99,7 @@ errx(int eval, const char *fmt, ...)
 
     va_start(args, fmt);
     fprintf(stderr, "%s: ", __progname);
-    vfprintf (stderr, fmt, args);
+    vfprintf(stderr, fmt, args);
     fprintf(stderr, "\n");
     va_end(args);
 
@@ -116,15 +116,15 @@ warn(const char *fmt, ...)
 
     va_start(args, fmt);
     fprintf(stderr, "%s: ", __progname);
-    vfprintf (stderr, fmt, args);
+    vfprintf(stderr, fmt, args);
 
     errstr = strerror(errno);
-    
+
     fprintf(stderr, ": %s\n", errstr ? errstr : "unknown error");
     va_end(args);
 }
 #endif /* !HAVE_WARN */
-     
+
 #ifndef HAVE_ERR
 static void
 err(int eval, const char *fmt, ...)
@@ -134,10 +134,10 @@ err(int eval, const char *fmt, ...)
 
     va_start(args, fmt);
     fprintf(stderr, "%s: ", __progname);
-    vfprintf (stderr, fmt, args);
+    vfprintf(stderr, fmt, args);
 
     errstr = strerror(errno);
-    
+
     fprintf(stderr, ": %s\n", errstr ? errstr : "unknown error");
     va_end(args);
 
@@ -152,8 +152,9 @@ err(int eval, const char *fmt, ...)
 
 enum { RX_PERF_VERSION = 3 };
 enum { RX_SERVER_ID = 147 };
-enum { RX_PERF_UNKNOWN = -1, RX_PERF_SEND = 0, RX_PERF_RECV = 1, 
-       RX_PERF_RPC=3, RX_PERF_FILE=4 };
+enum { RX_PERF_UNKNOWN = -1, RX_PERF_SEND = 0, RX_PERF_RECV = 1,
+    RX_PERF_RPC = 3, RX_PERF_FILE = 4
+};
 
 enum { RXPERF_MAGIC_COOKIE = 0x4711 };
 
@@ -168,16 +169,16 @@ enum { RXPERF_MAGIC_COOKIE = 0x4711 };
 #endif
 
 static void
-sigusr1 (int foo)
+sigusr1(int foo)
 {
-    exit (2); /* XXX profiler */
+    exit(2);                   /* XXX profiler */
 }
 
 static void
-sigint (int foo)
+sigint(int foo)
 {
     rx_Finalize();
-    exit (2); /* XXX profiler */
+    exit(2);                   /* XXX profiler */
 }
 
 /*
@@ -189,10 +190,10 @@ static struct timeval timer_stop;
 static int timer_check = 0;
 
 static void
-start_timer (void)
+start_timer(void)
 {
     timer_check++;
-    gettimeofday (&timer_start, NULL);
+    gettimeofday(&timer_start, NULL);
 }
 
 /*
@@ -200,16 +201,16 @@ start_timer (void)
  */
 
 static void
-end_and_print_timer (char *str)
+end_and_print_timer(char *str)
 {
     long long start_l, stop_l;
 
-    timer_check--; 
-    assert (timer_check == 0);
+    timer_check--;
+    assert(timer_check == 0);
     gettimeofday(&timer_stop, NULL);
     start_l = timer_start.tv_sec * 1000000 + timer_start.tv_usec;
     stop_l = timer_stop.tv_sec * 1000000 + timer_stop.tv_usec;
-    printf("%s:\t%8llu msec\n", str, (stop_l-start_l)/1000);
+    printf("%s:\t%8llu msec\n", str, (stop_l - start_l) / 1000);
 }
 
 /*
@@ -217,7 +218,7 @@ end_and_print_timer (char *str)
  */
 
 static u_long
-str2addr (const char *s)
+str2addr(const char *s)
 {
     struct in_addr server;
     struct hostent *h;
@@ -226,10 +227,10 @@ str2addr (const char *s)
 #define INADDR_NONE 0xffffffff
 #endif
     if (inet_addr(s) != INADDR_NONE)
-        return inet_addr(s);
-    h = gethostbyname (s);
+       return inet_addr(s);
+    h = gethostbyname(s);
     if (h != NULL) {
-       memcpy (&server, h->h_addr_list[0], sizeof(server));
+       memcpy(&server, h->h_addr_list[0], sizeof(server));
        return server.s_addr;
     }
     return 0;
@@ -241,7 +242,7 @@ str2addr (const char *s)
  */
 
 static void
-get_sec(int serverp, struct rx_securityClass** sec, int *secureindex)
+get_sec(int serverp, struct rx_securityClass **sec, int *secureindex)
 {
     if (serverp) {
        *sec = rxnull_NewServerSecurityObject();
@@ -270,7 +271,7 @@ readbytes(struct rx_call *call, int32_t bytes)
        size = rxread_size;
        if (size > bytes)
            size = bytes;
-       if (rx_Read (call, somebuf, size) != size)
+       if (rx_Read(call, somebuf, size) != size)
            return 1;
        bytes -= size;
     }
@@ -286,7 +287,7 @@ sendbytes(struct rx_call *call, int32_t bytes)
        size = rxwrite_size;
        if (size > bytes)
            size = bytes;
-       if (rx_Write (call, somebuf, size) != size)
+       if (rx_Write(call, somebuf, size) != size)
            return 1;
        bytes -= size;
     }
@@ -306,28 +307,28 @@ rxperf_ExecuteRequest(struct rx_call *call)
     u_int32_t num;
     u_int32_t *readwrite;
     int i;
-    int readp=TRUE;
+    int readp = TRUE;
 
     DBFPRINT(("got a request\n"));
 
-    if (rx_Read (call, &version, 4) != 4) {
-       warn ("rx_Read failed to read version");
+    if (rx_Read(call, &version, 4) != 4) {
+       warn("rx_Read failed to read version");
        return -1;
     }
 
     if (htonl(RX_PERF_VERSION) != version) {
-       warnx ("client has wrong version");
+       warnx("client has wrong version");
        return -1;
     }
-       
-    if (rx_Read (call, &command, 4) != 4) {
-       warnx ("rx_Read failed to read command");
+
+    if (rx_Read(call, &command, 4) != 4) {
+       warnx("rx_Read failed to read command");
        return -1;
     }
     command = ntohl(command);
 
-    if (rx_Read (call, &data, 4) != 4) {
-       warnx ("rx_Read failed to read size");
+    if (rx_Read(call, &data, 4) != 4) {
+       warnx("rx_Read failed to read size");
        return -1;
     }
     rxread_size = ntohl(data);
@@ -336,8 +337,8 @@ rxperf_ExecuteRequest(struct rx_call *call)
        return -1;
     }
 
-    if (rx_Read (call, &data, 4) != 4) {
-       warnx ("rx_Read failed to write size");
+    if (rx_Read(call, &data, 4) != 4) {
+       warnx("rx_Read failed to write size");
        return -1;
     }
     rxwrite_size = ntohl(data);
@@ -350,8 +351,8 @@ rxperf_ExecuteRequest(struct rx_call *call)
     case RX_PERF_SEND:
        DBFPRINT(("got a send request\n"));
 
-       if (rx_Read (call, &bytes, 4) != 4) {
-           warnx ("rx_Read failed to read bytes");
+       if (rx_Read(call, &bytes, 4) != 4) {
+           warnx("rx_Read failed to read bytes");
            return -1;
        }
        bytes = ntohl(bytes);
@@ -360,8 +361,8 @@ rxperf_ExecuteRequest(struct rx_call *call)
        readbytes(call, bytes);
 
        data = htonl(RXPERF_MAGIC_COOKIE);
-       if (rx_Write (call, &data, 4) != 4) {
-           warnx ("rx_Write failed when sending back result");
+       if (rx_Write(call, &data, 4) != 4) {
+           warnx("rx_Write failed when sending back result");
            return -1;
        }
        DBFPRINT(("done\n"));
@@ -369,14 +370,14 @@ rxperf_ExecuteRequest(struct rx_call *call)
        break;
     case RX_PERF_RPC:
        DBFPRINT(("got a rpc request, reading commands\n"));
-       
-       if (rx_Read (call, &recvb, 4) != 4) {
-           warnx ("rx_Read failed to read recvbytes");
+
+       if (rx_Read(call, &recvb, 4) != 4) {
+           warnx("rx_Read failed to read recvbytes");
            return -1;
        }
        recvb = ntohl(recvb);
-       if (rx_Read (call, &sendb, 4) != 4) {
-           warnx ("rx_Read failed to read sendbytes");
+       if (rx_Read(call, &sendb, 4) != 4) {
+           warnx("rx_Read failed to read sendbytes");
            return -1;
        }
        sendb = ntohl(sendb);
@@ -391,52 +392,52 @@ rxperf_ExecuteRequest(struct rx_call *call)
            warnx("sendbytes failed");
            return -1;
        }
-       
+
        DBFPRINT(("done\n"));
 
        data = htonl(RXPERF_MAGIC_COOKIE);
-       if (rx_Write (call, &data, 4) != 4) {
-           warnx ( "rx_Write failed when sending back magic cookie");
+       if (rx_Write(call, &data, 4) != 4) {
+           warnx("rx_Write failed when sending back magic cookie");
            return -1;
        }
 
        break;
     case RX_PERF_FILE:
-       if (rx_Read (call, &data, 4) != 4)
-           errx (1, "failed to read num from client");
+       if (rx_Read(call, &data, 4) != 4)
+           errx(1, "failed to read num from client");
        num = ntohl(data);
 
-       readwrite = malloc(num*sizeof(u_int32_t));
-       if(readwrite == NULL)
+       readwrite = malloc(num * sizeof(u_int32_t));
+       if (readwrite == NULL)
            err(1, "malloc");
 
-       if (rx_Read (call, readwrite, num*sizeof(u_int32_t)) !=
-           num*sizeof(u_int32_t))
-           errx (1, "failed to read recvlist from client");
+       if (rx_Read(call, readwrite, num * sizeof(u_int32_t)) !=
+           num * sizeof(u_int32_t))
+           errx(1, "failed to read recvlist from client");
 
-           for(i=0; i < num; i++) {
-               if(readwrite[i] == 0) {
-                   DBFPRINT(("readp %d", readwrite[i] ));
-                   readp = !readp;
-               }
+       for (i = 0; i < num; i++) {
+           if (readwrite[i] == 0) {
+               DBFPRINT(("readp %d", readwrite[i]));
+               readp = !readp;
+           }
 
-               bytes = ntohl(readwrite[i])*sizeof(u_int32_t);
+           bytes = ntohl(readwrite[i]) * sizeof(u_int32_t);
 
-               if(readp) {
-                   DBFPRINT(("read\n"));
-                   readbytes(call, bytes);
-               } else {
-                   sendbytes(call, bytes);
-                   DBFPRINT(("send\n"));
-               }
+           if (readp) {
+               DBFPRINT(("read\n"));
+               readbytes(call, bytes);
+           } else {
+               sendbytes(call, bytes);
+               DBFPRINT(("send\n"));
            }
+       }
 
        break;
     case RX_PERF_RECV:
        DBFPRINT(("got a recv request\n"));
 
-       if (rx_Read (call, &bytes, 4) != 4) {
-           warnx ("rx_Read failed to read bytes");
+       if (rx_Read(call, &bytes, 4) != 4) {
+           warnx("rx_Read failed to read bytes");
            return -1;
        }
        bytes = ntohl(bytes);
@@ -445,15 +446,15 @@ rxperf_ExecuteRequest(struct rx_call *call)
        sendbytes(call, bytes);
 
        data = htonl(RXPERF_MAGIC_COOKIE);
-       if (rx_Write (call, &data, 4) != 4) {
-           warnx ("rx_Write failed when sending back result");
+       if (rx_Write(call, &data, 4) != 4) {
+           warnx("rx_Write failed when sending back result");
            return -1;
        }
        DBFPRINT(("done\n"));
 
        break;
     default:
-       warnx ("client sent a unsupported command");
+       warnx("client sent a unsupported command");
        return -1;
     }
     DBFPRINT(("done with command\n"));
@@ -466,29 +467,26 @@ rxperf_ExecuteRequest(struct rx_call *call)
  */
 
 static void
-do_server (int port)
+do_server(int port)
 {
     struct rx_service *service;
     struct rx_securityClass *secureobj;
     int secureindex;
     int ret;
 
-    ret = rx_Init (port);
+    ret = rx_Init(port);
     if (ret)
-       errx (1, "rx_Init failed");
+       errx(1, "rx_Init failed");
 
     get_sec(1, &secureobj, &secureindex);
-    
-    service = rx_NewService (0,
-                            RX_SERVER_ID,
-                            "rxperf", 
-                            &secureobj, 
-                            secureindex, 
-                            rxperf_ExecuteRequest);
-    if (service == NULL) 
+
+    service =
+       rx_NewService(0, RX_SERVER_ID, "rxperf", &secureobj, secureindex,
+                     rxperf_ExecuteRequest);
+    if (service == NULL)
        errx(1, "Cant create server");
 
-    rx_StartServer(1) ;
+    rx_StartServer(1);
     abort();
 }
 
@@ -497,48 +495,48 @@ do_server (int port)
  */
 
 static void
-readfile(const char *filename, u_int32_t **readwrite, u_int32_t *size)
+readfile(const char *filename, u_int32_t ** readwrite, u_int32_t * size)
 {
     FILE *f;
-    u_int32_t len=16;
-    u_int32_t num=0;
+    u_int32_t len = 16;
+    u_int32_t num = 0;
     u_int32_t data;
     char *ptr;
     char buf[RXPERF_BUFSIZE];
 
-    *readwrite = malloc(sizeof(u_int32_t)*len);
+    *readwrite = malloc(sizeof(u_int32_t) * len);
 
-    if(*readwrite == NULL)
+    if (*readwrite == NULL)
        err(1, "malloc");
 
-    f=fopen(filename, "r");
-    if(f==NULL)
+    f = fopen(filename, "r");
+    if (f == NULL)
        err(1, "fopen");
 
-    while(fgets(buf, sizeof(buf), f) != NULL) {
-       if(num >= len) {
-           len=len*2;
-           *readwrite = realloc(*readwrite, len*sizeof(u_int32_t));
-           if(*readwrite == NULL)
+    while (fgets(buf, sizeof(buf), f) != NULL) {
+       if (num >= len) {
+           len = len * 2;
+           *readwrite = realloc(*readwrite, len * sizeof(u_int32_t));
+           if (*readwrite == NULL)
                err(1, "realloc");
        }
 
-       if(*buf != '\n') {
-           data = htonl(strtol (buf, &ptr, 0));
+       if (*buf != '\n') {
+           data = htonl(strtol(buf, &ptr, 0));
            if (ptr && ptr == buf)
-               errx (1, "can't resolve number of bytes to transfer");
+               errx(1, "can't resolve number of bytes to transfer");
        } else {
            data = 0;
        }
-       
-       (*readwrite)[num] =data;
+
+       (*readwrite)[num] = data;
        num++;
     }
 
     *size = num;
 
-    
-    if(fclose(f) == -1)
+
+    if (fclose(f) == -1)
        err(1, "fclose");
 }
 
@@ -548,9 +546,8 @@ readfile(const char *filename, u_int32_t **readwrite, u_int32_t *size)
  */
 
 static void
-do_client (const char *server, int port, char *filename,
-          int32_t command, int32_t times, 
-          int32_t bytes, int32_t sendtimes, int32_t recvtimes)
+do_client(const char *server, int port, char *filename, int32_t command,
+         int32_t times, int32_t bytes, int32_t sendtimes, int32_t recvtimes)
 {
     struct rx_connection *conn;
     struct rx_call *call;
@@ -567,62 +564,59 @@ do_client (const char *server, int port, char *filename,
 
     u_int32_t *readwrite;
 
-    ret = rx_Init (0);
+    ret = rx_Init(0);
     if (ret)
-       errx (1, "rx_Init failed");
+       errx(1, "rx_Init failed");
 
     get_sec(0, &secureobj, &secureindex);
 
-    conn = rx_NewConnection(addr, 
-                           port, 
-                           RX_SERVER_ID,
-                           secureobj,
-                           secureindex);
+    conn = rx_NewConnection(addr, port, RX_SERVER_ID, secureobj, secureindex);
     if (conn == NULL)
-       errx (1, "failed to contact server");
+       errx(1, "failed to contact server");
 
-    sprintf (stamp, "send\t%d times\t%d writes\t%d reads", times, sendtimes, recvtimes);
+    sprintf(stamp, "send\t%d times\t%d writes\t%d reads", times, sendtimes,
+           recvtimes);
     start_timer();
 
-    for(i=0; i < times ; i++) {
+    for (i = 0; i < times; i++) {
 
        DBFPRINT(("starting command "));
 
-       call = rx_NewCall (conn);
+       call = rx_NewCall(conn);
        if (call == NULL)
-           errx (1, "rx_NewCall failed");
-       
+           errx(1, "rx_NewCall failed");
+
        data = htonl(RX_PERF_VERSION);
-       if (rx_Write (call, &data, 4) != 4)
-           errx (1, "rx_Write failed to send version");
-       
+       if (rx_Write(call, &data, 4) != 4)
+           errx(1, "rx_Write failed to send version");
+
        data = htonl(command);
-       if (rx_Write (call, &data, 4) != 4)
-           errx (1, "rx_Write failed to send command");
+       if (rx_Write(call, &data, 4) != 4)
+           errx(1, "rx_Write failed to send command");
 
        data = htonl(rxread_size);
-       if (rx_Write (call, &data, 4) != 4)
-           errx (1, "rx_Write failed to send read size");
+       if (rx_Write(call, &data, 4) != 4)
+           errx(1, "rx_Write failed to send read size");
        data = htonl(rxwrite_size);
-       if (rx_Write (call, &data, 4) != 4)
-           errx (1, "rx_Write failed to send write read");
+       if (rx_Write(call, &data, 4) != 4)
+           errx(1, "rx_Write failed to send write read");
 
 
        switch (command) {
        case RX_PERF_RECV:
            DBFPRINT(("command "));
 
-           data = htonl (bytes);
-           if (rx_Write (call, &data, 4) != 4)
-               errx (1, "rx_Write failed to send size");           
-           
+           data = htonl(bytes);
+           if (rx_Write(call, &data, 4) != 4)
+               errx(1, "rx_Write failed to send size");
+
            DBFPRINT(("sending(%d) ", bytes));
            if (readbytes(call, bytes))
                errx(1, "sendbytes");
 
-           if (rx_Read (call, &data, 4) != 4)
-               errx (1, "failed to read result from server");
-           
+           if (rx_Read(call, &data, 4) != 4)
+               errx(1, "failed to read result from server");
+
            if (data != htonl(RXPERF_MAGIC_COOKIE))
                warn("server send wrong magic cookie in responce");
 
@@ -632,17 +626,17 @@ do_client (const char *server, int port, char *filename,
        case RX_PERF_SEND:
            DBFPRINT(("command "));
 
-           data = htonl (bytes);
-           if (rx_Write (call, &data, 4) != 4)
-               errx (1, "rx_Write failed to send size");           
-           
+           data = htonl(bytes);
+           if (rx_Write(call, &data, 4) != 4)
+               errx(1, "rx_Write failed to send size");
+
            DBFPRINT(("sending(%d) ", bytes));
            if (sendbytes(call, bytes))
                errx(1, "sendbytes");
 
-           if (rx_Read (call, &data, 4) != 4)
-               errx (1, "failed to read result from server");
-           
+           if (rx_Read(call, &data, 4) != 4)
+               errx(1, "failed to read result from server");
+
            if (data != htonl(RXPERF_MAGIC_COOKIE))
                warn("server send wrong magic cookie in responce");
 
@@ -654,21 +648,21 @@ do_client (const char *server, int port, char *filename,
 
            data = htonl(sendtimes);
            if (rx_Write(call, &data, 4) != 4)
-               errx (1, "rx_Write failed to send command");
-           
+               errx(1, "rx_Write failed to send command");
+
            data = htonl(recvtimes);
-           if (rx_Write (call, &data, 4) != 4)
-               errx (1, "rx_Write failed to send command");
-           
+           if (rx_Write(call, &data, 4) != 4)
+               errx(1, "rx_Write failed to send command");
+
            DBFPRINT(("send(%d) ", sendtimes));
            sendbytes(call, sendtimes);
-           
+
            DBFPRINT(("recv(%d) ", recvtimes));
            readbytes(call, recvtimes);
-           
-           if (rx_Read (call, &bytes, 4) != 4)
-               errx (1, "failed to read result from server");
-           
+
+           if (rx_Read(call, &bytes, 4) != 4)
+               errx(1, "failed to read result from server");
+
            if (bytes != htonl(RXPERF_MAGIC_COOKIE))
                warn("server send wrong magic cookie in responce");
 
@@ -680,19 +674,19 @@ do_client (const char *server, int port, char *filename,
 
            data = htonl(num);
            if (rx_Write(call, &data, sizeof(data)) != 4)
-               errx (1, "rx_Write failed to send size");
+               errx(1, "rx_Write failed to send size");
 
-           if (rx_Write(call, readwrite, num*sizeof(u_int32_t)) 
-               != num*sizeof(u_int32_t))
-               errx (1, "rx_Write failed to send list");
+           if (rx_Write(call, readwrite, num * sizeof(u_int32_t))
+               != num * sizeof(u_int32_t))
+               errx(1, "rx_Write failed to send list");
 
-           for(i=0; i < num; i++) {
-               if(readwrite[i] == 0)
+           for (i = 0; i < num; i++) {
+               if (readwrite[i] == 0)
                    readp = !readp;
 
-               size = ntohl(readwrite[i])*sizeof(u_int32_t);
+               size = ntohl(readwrite[i]) * sizeof(u_int32_t);
 
-               if(readp) {
+               if (readp) {
                    readbytes(call, size);
                    DBFPRINT(("read\n"));
                } else {
@@ -705,10 +699,10 @@ do_client (const char *server, int port, char *filename,
            abort();
        }
 
-       rx_EndCall (call, 0);
+       rx_EndCall(call, 0);
     }
 
-    end_and_print_timer (stamp);
+    end_and_print_timer(stamp);
     DBFPRINT(("done for good\n"));
 
     rx_Finalize();
@@ -719,17 +713,16 @@ usage()
 {
 #define COMMON ""
 
-    fprintf(stderr, "usage: %s client -c send -b <bytes>\n",
-           __progname);
-    fprintf(stderr, "usage: %s client -c recv -b <bytes>\n",
-           __progname);
-    fprintf(stderr, "usage: %s client -c rpc  -S <sendbytes> -R <recvbytes>\n",
+    fprintf(stderr, "usage: %s client -c send -b <bytes>\n", __progname);
+    fprintf(stderr, "usage: %s client -c recv -b <bytes>\n", __progname);
+    fprintf(stderr,
+           "usage: %s client -c rpc  -S <sendbytes> -R <recvbytes>\n",
            __progname);
-    fprintf(stderr, "usage: %s client -c file -f filename\n", 
+    fprintf(stderr, "usage: %s client -c file -f filename\n", __progname);
+    fprintf(stderr,
+           "%s: usage: common option to the client "
+           "-w <write-bytes> -r <read-bytes> -T times -p port -s server\n",
            __progname);
-    fprintf (stderr, "%s: usage:       common option to the client "
-            "-w <write-bytes> -r <read-bytes> -T times -p port -s server\n",
-            __progname);
     fprintf(stderr, "usage: %s server -p port\n", __progname);
 #undef COMMMON
     exit(1);
@@ -740,9 +733,9 @@ usage()
  */
 
 static int
-rxperf_server (int argc, char **argv)
+rxperf_server(int argc, char **argv)
 {
-    int port      = DEFAULT_PORT;
+    int port = DEFAULT_PORT;
     char *ptr;
     int ch;
 
@@ -760,23 +753,23 @@ rxperf_server (int argc, char **argv)
        case 'r':
            rxread_size = strtol(optarg, &ptr, 0);
            if (ptr != 0 && ptr[0] != '\0')
-               errx (1, "can't resolve readsize");
+               errx(1, "can't resolve readsize");
            if (rxread_size > sizeof(somebuf))
-             errx(1, "%d > sizeof(somebuf) (%d)",
-                  rxread_size, sizeof(somebuf));
+               errx(1, "%d > sizeof(somebuf) (%d)", rxread_size,
+                    sizeof(somebuf));
            break;
        case 'p':
            port = strtol(optarg, &ptr, 0);
            if (ptr != 0 && ptr[0] != '\0')
-               errx (1, "can't resolve portname");
+               errx(1, "can't resolve portname");
            break;
        case 'w':
            rxwrite_size = strtol(optarg, &ptr, 0);
            if (ptr != 0 && ptr[0] != '\0')
-               errx (1, "can't resolve writesize");
+               errx(1, "can't resolve writesize");
            if (rxwrite_size > sizeof(somebuf))
-               errx(1, "%d > sizeof(somebuf) (%d)",
-                    rxwrite_size, sizeof(somebuf));
+               errx(1, "%d > sizeof(somebuf) (%d)", rxwrite_size,
+                    sizeof(somebuf));
            break;
        default:
            usage();
@@ -785,8 +778,8 @@ rxperf_server (int argc, char **argv)
 
     if (optind != argc)
        usage();
-    
-    do_server (htons(port));
+
+    do_server(htons(port));
 
     return 0;
 }
@@ -796,11 +789,11 @@ rxperf_server (int argc, char **argv)
  */
 
 static int
-rxperf_client (int argc, char **argv)
+rxperf_client(int argc, char **argv)
 {
-    char *host    = DEFAULT_HOST;
-    int bytes     = DEFAULT_BYTES;
-    int port      = DEFAULT_PORT;
+    char *host = DEFAULT_HOST;
+    int bytes = DEFAULT_BYTES;
+    int port = DEFAULT_PORT;
     char *filename = NULL;
     int32_t cmd;
     int sendtimes = 3;
@@ -810,17 +803,17 @@ rxperf_client (int argc, char **argv)
     int ch;
 
     cmd = RX_PERF_UNKNOWN;
-    
-    while ((ch  = getopt(argc, argv, "T:S:R:b:c:d:p:r:s:w:f:")) != -1) {
+
+    while ((ch = getopt(argc, argv, "T:S:R:b:c:d:p:r:s:w:f:")) != -1) {
        switch (ch) {
        case 'b':
-           bytes = strtol (optarg, &ptr, 0);
+           bytes = strtol(optarg, &ptr, 0);
            if (ptr && *ptr != '\0')
-               errx (1, "can't resolve number of bytes to transfer");
+               errx(1, "can't resolve number of bytes to transfer");
            break;
        case 'c':
            if (strcasecmp(optarg, "send") == 0)
-             cmd = RX_PERF_SEND;
+               cmd = RX_PERF_SEND;
            else if (strcasecmp(optarg, "recv") == 0)
                cmd = RX_PERF_RECV;
            else if (strcasecmp(optarg, "rpc") == 0)
@@ -842,15 +835,15 @@ rxperf_client (int argc, char **argv)
        case 'p':
            port = strtol(optarg, &ptr, 0);
            if (ptr != 0 && ptr[0] != '\0')
-               errx (1, "can't resolve portname");
+               errx(1, "can't resolve portname");
            break;
        case 'r':
            rxread_size = strtol(optarg, &ptr, 0);
            if (ptr != 0 && ptr[0] != '\0')
-               errx (1, "can't resolve readsize");
+               errx(1, "can't resolve readsize");
            if (rxread_size > sizeof(somebuf))
-               errx(1, "%d > sizeof(somebuf) (%d)",
-                    rxread_size, sizeof(somebuf));
+               errx(1, "%d > sizeof(somebuf) (%d)", rxread_size,
+                    sizeof(somebuf));
            break;
        case 's':
            host = strdup(optarg);
@@ -860,25 +853,25 @@ rxperf_client (int argc, char **argv)
        case 'w':
            rxwrite_size = strtol(optarg, &ptr, 0);
            if (ptr != 0 && ptr[0] != '\0')
-               errx (1, "can't resolve writesize");
+               errx(1, "can't resolve writesize");
            if (rxwrite_size > sizeof(somebuf))
-               errx(1, "%d > sizeof(somebuf) (%d)",
-                    rxwrite_size, sizeof(somebuf));
+               errx(1, "%d > sizeof(somebuf) (%d)", rxwrite_size,
+                    sizeof(somebuf));
            break;
        case 'T':
-           times = strtol (optarg, &ptr, 0);
+           times = strtol(optarg, &ptr, 0);
            if (ptr && *ptr != '\0')
-               errx (1, "can't resolve number of bytes to transfer");
+               errx(1, "can't resolve number of bytes to transfer");
            break;
        case 'S':
-           sendtimes = strtol (optarg, &ptr, 0);
+           sendtimes = strtol(optarg, &ptr, 0);
            if (ptr && *ptr != '\0')
-               errx (1, "can't resolve number of bytes to transfer");
+               errx(1, "can't resolve number of bytes to transfer");
            break;
        case 'R':
-           recvtimes = strtol (optarg, &ptr, 0);
+           recvtimes = strtol(optarg, &ptr, 0);
            if (ptr && *ptr != '\0')
-               errx (1, "can't resolve number of bytes to transfer");
+               errx(1, "can't resolve number of bytes to transfer");
            break;
        case 'f':
            filename = optarg;
@@ -890,13 +883,13 @@ rxperf_client (int argc, char **argv)
 
     if (optind != argc)
        usage();
-    
+
     if (cmd == RX_PERF_UNKNOWN)
        errx(1, "no command given to the client");
-    
-    do_client(host, htons(port), filename, cmd, times, bytes, 
-             sendtimes, recvtimes);
-    
+
+    do_client(host, htons(port), filename, cmd, times, bytes, sendtimes,
+             recvtimes);
+
     return 0;
 }
 
@@ -911,14 +904,14 @@ main(int argc, char **argv)
 
     __progname = strrchr(argv[0], '/');
     if (__progname == 0)
-      __progname = argv[0];
+       __progname = argv[0];
 
-    signal (SIGUSR1, sigusr1);
-    signal (SIGINT, sigint);
+    signal(SIGUSR1, sigusr1);
+    signal(SIGINT, sigint);
 
-    LWP_InitializeProcessSupport (LWP_NORMAL_PRIORITY, &pid);
-    
-    memset (somebuf, 0, sizeof(somebuf));
+    LWP_InitializeProcessSupport(LWP_NORMAL_PRIORITY, &pid);
+
+    memset(somebuf, 0, sizeof(somebuf));
 
     if (argc >= 2 && strcmp(argv[1], "server") == 0)
        rxperf_server(argc - 1, argv + 1);
@@ -928,4 +921,3 @@ main(int argc, char **argv)
        usage();
     return 0;
 }
-