From 9c449ef358699140d8e4e9f384f9a55c898b203a Mon Sep 17 00:00:00 2001
From: Danny Auble <da@llnl.gov>
Date: Tue, 1 Dec 2009 20:42:11 +0000
Subject: [PATCH] fixed formatting issues with white space.

---
 contribs/lua/proctrack.lua            |  148 +-
 contribs/skilling.c                   |   92 +-
 src/common/cbuf.c                     | 2580 ++++++++++++-------------
 src/common/checkpoint.c               |   29 +-
 src/common/fd.c                       |  236 +--
 src/common/hostlist.c                 |  298 +--
 src/common/list.c                     |  968 +++++-----
 src/common/node_select.c              |   46 +-
 src/common/slurm_accounting_storage.c |   16 +-
 src/common/slurm_auth.c               |    6 +-
 src/common/slurm_cred.c               |  252 +--
 src/common/slurm_jobacct_gather.c     |    6 +-
 src/common/slurm_jobcomp.c            |    8 +-
 src/common/slurm_priority.c           |    6 +-
 src/common/slurm_protocol_api.c       |   58 +-
 src/common/slurm_protocol_defs.c      |  216 +--
 src/common/slurm_protocol_pack.c      |   50 +-
 src/common/slurm_step_layout.c        |   14 +-
 src/common/slurm_topology.c           |    4 +-
 src/common/util-net.c                 |  428 ++--
 src/srun/allocate.c                   |   10 +-
 21 files changed, 2737 insertions(+), 2734 deletions(-)

diff --git a/contribs/lua/proctrack.lua b/contribs/lua/proctrack.lua
index 0c6b7a900c0..61e6b45f979 100644
--- a/contribs/lua/proctrack.lua
+++ b/contribs/lua/proctrack.lua
@@ -241,80 +241,80 @@ end
 --
 function cpumap_create ()
 
-       function cpuset_list_create (s)
-               local cpus = {}
-               for c in s:gmatch ('[^,]+') do
-                       local s, e = c:match ('([%d]+)-?([%d]*)')
-                       if e == "" then e = s end
-                       for cpu = s, e do
-                               table.insert (cpus, cpu)
-                       end
-               end
-               return cpus
-       end
-
-       function read_cpu_topology_member (id, name)
-               local val
-               local cpudir = "/sys/devices/system/cpu"
-               local path = string.format ("%s/cpu%d/topology/%s", cpudir, id, name)
-               local f, err = io.open (path, "r")
-               if f == nil then
-                       print (err)
-                   return f, err
-               end
-               val = f:read ("*all")
-               f:close()
-               return val
-       end
-
-       function cpu_info_create (id)
-               local cpuinfo = {}
-               local cpudir = "/sys/devices/system/cpu"
-               cpuinfo.id = id
-               cpuinfo.pkgid  = read_cpu_topology_member (id, "physical_package_id")
-               cpuinfo.coreid = read_cpu_topology_member (id, "core_id")
-               return cpuinfo
-       end
-
-       function list_id (self, i)
-               return self.cpu_list[i+1].id
-       end
-
-       local function cmp_cpu_info (a,b)
-               if a.pkgid == b.pkgid then
-                       return a.coreid < b.coreid
-               else
-                       return a.pkgid < b.pkgid
-               end
-       end
-
-       local function convert_cpu_ids (self, s)
-               local l = {}
-               for i, id in ipairs (cpuset_list_create (s)) do
-                       table.insert (l, list_id (self, id))
-               end
-               return table.concat (l, ",")
-       end
-
-       local cpu_map = {
-               cpu_list =    {},
-               ncpus =       0,
-               get_id =      list_id,
-               convert_ids = convert_cpu_ids
-       }
-
-       for i, dir in ipairs (posix.dir ("/sys/devices/system/cpu")) do
-               local id = string.match (dir, 'cpu([%d]+)')
-               if id then
-                       table.insert (cpu_map.cpu_list, cpu_info_create (id))
-               end
-       end
-
-       cpu_map.ncpus = #cpu_map.cpu_list
-
-       table.sort (cpu_map.cpu_list, cmp_cpu_info)
-
-       return cpu_map
+    function cpuset_list_create (s)
+        local cpus = {}
+        for c in s:gmatch ('[^,]+') do
+            local s, e = c:match ('([%d]+)-?([%d]*)')
+            if e == "" then e = s end
+            for cpu = s, e do
+                table.insert (cpus, cpu)
+            end
+        end
+        return cpus
+    end
+
+    function read_cpu_topology_member (id, name)
+        local val
+        local cpudir = "/sys/devices/system/cpu"
+        local path = string.format ("%s/cpu%d/topology/%s", cpudir, id, name)
+        local f, err = io.open (path, "r")
+        if f == nil then
+            print (err)
+            return f, err
+        end
+        val = f:read ("*all")
+        f:close()
+        return val
+    end
+
+    function cpu_info_create (id)
+        local cpuinfo = {}
+        local cpudir = "/sys/devices/system/cpu"
+        cpuinfo.id = id
+        cpuinfo.pkgid  = read_cpu_topology_member (id, "physical_package_id")
+        cpuinfo.coreid = read_cpu_topology_member (id, "core_id")
+        return cpuinfo
+    end
+
+    function list_id (self, i)
+        return self.cpu_list[i+1].id
+    end
+
+    local function cmp_cpu_info (a,b)
+        if a.pkgid == b.pkgid then
+            return a.coreid < b.coreid
+        else
+            return a.pkgid < b.pkgid
+        end
+    end
+
+    local function convert_cpu_ids (self, s)
+        local l = {}
+        for i, id in ipairs (cpuset_list_create (s)) do
+            table.insert (l, list_id (self, id))
+        end
+        return table.concat (l, ",")
+    end
+
+    local cpu_map = {
+        cpu_list =    {},
+        ncpus =       0,
+        get_id =      list_id,
+        convert_ids = convert_cpu_ids
+    }
+
+    for i, dir in ipairs (posix.dir ("/sys/devices/system/cpu")) do
+        local id = string.match (dir, 'cpu([%d]+)')
+        if id then
+            table.insert (cpu_map.cpu_list, cpu_info_create (id))
+        end
+    end
+
+    cpu_map.ncpus = #cpu_map.cpu_list
+
+    table.sort (cpu_map.cpu_list, cmp_cpu_info)
+
+    return cpu_map
 end
 
 function v_log_msg (l, fmt, ...)
diff --git a/contribs/skilling.c b/contribs/skilling.c
index a6ff3b0deea..dae77202c06 100644
--- a/contribs/skilling.c
+++ b/contribs/skilling.c
@@ -35,57 +35,57 @@
 typedef unsigned int coord_t; // char,short,int for up to 8,16,32 bits per word
 
 static void TransposetoAxes(
-coord_t* X,            // I O  position   [n]
-int      b,            // I    # bits
-int      n)            // I    dimension
+	coord_t* X,            // I O  position   [n]
+	int      b,            // I    # bits
+	int      n)            // I    dimension
 {
-    coord_t  M, P, Q, t;
-    int      i;
+	coord_t  M, P, Q, t;
+	int      i;
 
 // Gray decode by  H ^ (H/2)
-    t = X[n-1] >> 1;
-    for( i = n-1; i; i-- )
-        X[i] ^= X[i-1];
-    X[0] ^= t;
+	t = X[n-1] >> 1;
+	for( i = n-1; i; i-- )
+		X[i] ^= X[i-1];
+	X[0] ^= t;
 
 // Undo excess work
-    M = 2 << (b - 1);
-    for( Q = 2; Q != M; Q <<= 1 )
-    {
-        P = Q - 1;
-        for( i = n-1; i; i-- )
-            if( X[i] & Q ) X[0] ^= P;                              // invert
-            else{ t = (X[0] ^ X[i]) & P;  X[0] ^= t;  X[i] ^= t; } // exchange
-        if( X[0] & Q ) X[0] ^= P;                                  // invert
-    }
+	M = 2 << (b - 1);
+	for( Q = 2; Q != M; Q <<= 1 )
+	{
+		P = Q - 1;
+		for( i = n-1; i; i-- )
+			if( X[i] & Q ) X[0] ^= P;                              // invert
+			else{ t = (X[0] ^ X[i]) & P;  X[0] ^= t;  X[i] ^= t; } // exchange
+		if( X[0] & Q ) X[0] ^= P;                                  // invert
+	}
 } 
 static void AxestoTranspose(
-coord_t* X,            // I O  position   [n]
-int      b,            // I    # bits
-int      n)            // I    dimension
+	coord_t* X,            // I O  position   [n]
+	int      b,            // I    # bits
+	int      n)            // I    dimension
 {
-    coord_t  P, Q, t;
-    int      i;
+	coord_t  P, Q, t;
+	int      i;
 
 // Inverse undo
-    for( Q = 1 << (b - 1); Q > 1; Q >>= 1 )
-    {
-        P = Q - 1;
-        if( X[0] & Q ) X[0] ^= P;                                  // invert
-        for( i = 1; i < n; i++ )
-            if( X[i] & Q ) X[0] ^= P;                              // invert
-            else{ t = (X[0] ^ X[i]) & P;  X[0] ^= t;  X[i] ^= t; } // exchange
-    }
+	for( Q = 1 << (b - 1); Q > 1; Q >>= 1 )
+	{
+		P = Q - 1;
+		if( X[0] & Q ) X[0] ^= P;                                  // invert
+		for( i = 1; i < n; i++ )
+			if( X[i] & Q ) X[0] ^= P;                              // invert
+			else{ t = (X[0] ^ X[i]) & P;  X[0] ^= t;  X[i] ^= t; } // exchange
+	}
 
 // Gray encode (inverse of decode)
-    for( i = 1; i < n; i++ )
-        X[i] ^= X[i-1];
-    t = X[n-1];
-    for( i = 1; i < b; i <<= 1 )
-        X[n-1] ^= X[n-1] >> i;
-    t ^= X[n-1];
-    for( i = n-2; i >= 0; i-- )
-        X[i] ^= t;
+	for( i = 1; i < n; i++ )
+		X[i] ^= X[i-1];
+	t = X[n-1];
+	for( i = 1; i < b; i <<= 1 )
+		X[n-1] ^= X[n-1] >> i;
+	t ^= X[n-1];
+	for( i = n-2; i >= 0; i-- )
+		X[i] ^= t;
 }
 
 /* This is an sample use of Skilling's functions above.
@@ -107,14 +107,14 @@ main(int argc, char **argv)
 
 	AxestoTranspose(X, BITS, DIMS); // Hilbert transpose for 5 bits and 3 dimensions
 	H = ((X[2]>>0 & 1) <<  0) + ((X[1]>>0 & 1) <<  1) + ((X[0]>>0 & 1) <<  2) +
-	    ((X[2]>>1 & 1) <<  3) + ((X[1]>>1 & 1) <<  4) + ((X[0]>>1 & 1) <<  5) +
-	    ((X[2]>>2 & 1) <<  6) + ((X[1]>>2 & 1) <<  7) + ((X[0]>>2 & 1) <<  8) +
-	    ((X[2]>>3 & 1) <<  9) + ((X[1]>>3 & 1) << 10) + ((X[0]>>3 & 1) << 11) +
-	    ((X[2]>>4 & 1) << 12) + ((X[1]>>4 & 1) << 13) + ((X[0]>>4 & 1) << 14);
+		((X[2]>>1 & 1) <<  3) + ((X[1]>>1 & 1) <<  4) + ((X[0]>>1 & 1) <<  5) +
+		((X[2]>>2 & 1) <<  6) + ((X[1]>>2 & 1) <<  7) + ((X[0]>>2 & 1) <<  8) +
+		((X[2]>>3 & 1) <<  9) + ((X[1]>>3 & 1) << 10) + ((X[0]>>3 & 1) << 11) +
+		((X[2]>>4 & 1) << 12) + ((X[1]>>4 & 1) << 13) + ((X[0]>>4 & 1) << 14);
 	printf("Hilbert integer  = %d (%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d)\n", H,
-		X[0]>>4 & 1, X[1]>>4 & 1, X[2]>>4 & 1, X[0]>>3 & 1, X[1]>>3 & 1,
-		X[2]>>3 & 1, X[0]>>2 & 1, X[1]>>2 & 1, X[2]>>2 & 1, X[0]>>1 & 1,
-		X[1]>>1 & 1, X[2]>>1 & 1, X[0]>>0 & 1, X[1]>>0 & 1, X[2]>>0 & 1);
+	       X[0]>>4 & 1, X[1]>>4 & 1, X[2]>>4 & 1, X[0]>>3 & 1, X[1]>>3 & 1,
+	       X[2]>>3 & 1, X[0]>>2 & 1, X[1]>>2 & 1, X[2]>>2 & 1, X[0]>>1 & 1,
+	       X[1]>>1 & 1, X[2]>>1 & 1, X[0]>>0 & 1, X[1]>>0 & 1, X[2]>>0 & 1);
 
 #if 0
 	/* Used for validation purposes */
diff --git a/src/common/cbuf.c b/src/common/cbuf.c
index 1f2744c1049..dfb50ad4144 100644
--- a/src/common/cbuf.c
+++ b/src/common/cbuf.c
@@ -60,17 +60,17 @@
 
 #ifdef WITH_LSD_FATAL_ERROR_FUNC
 #  undef lsd_fatal_error
-   extern void lsd_fatal_error(char *file, int line, char *mesg);
+extern void lsd_fatal_error(char *file, int line, char *mesg);
 #else /* !WITH_LSD_FATAL_ERROR_FUNC */
 #  ifndef lsd_fatal_error
 #    include <errno.h>
 #    include <stdio.h>
 #    include <string.h>
-#    define lsd_fatal_error(file, line, mesg)                                 \
-       do {                                                                   \
-           fprintf(stderr, "ERROR: [%s:%d] %s: %s\n",                         \
-                   file, line, mesg, strerror(errno));                        \
-       } while (0)
+#    define lsd_fatal_error(file, line, mesg)			\
+	do {							\
+		fprintf(stderr, "ERROR: [%s:%d] %s: %s\n",	\
+			file, line, mesg, strerror(errno));	\
+	} while (0)
 #  endif /* !lsd_fatal_error */
 #endif /* !WITH_LSD_FATAL_ERROR_FUNC */
 
@@ -81,7 +81,7 @@
 
 #ifdef WITH_LSD_NOMEM_ERROR_FUNC
 #  undef lsd_nomem_error
-   extern void * lsd_nomem_error(char *file, int line, char *mesg);
+extern void * lsd_nomem_error(char *file, int line, char *mesg);
 #else /* !WITH_LSD_NOMEM_ERROR_FUNC */
 #  ifndef lsd_nomem_error
 #    define lsd_nomem_error(file, line, mesg) (NULL)
@@ -105,24 +105,24 @@
 struct cbuf {
 
 #ifndef NDEBUG
-    unsigned long       magic;          /* cookie for asserting validity     */
+	unsigned long       magic;          /* cookie for asserting validity     */
 #endif /* !NDEBUG */
 
 #ifdef WITH_PTHREADS
-    pthread_mutex_t     mutex;          /* mutex to protect access to cbuf   */
+	pthread_mutex_t     mutex;          /* mutex to protect access to cbuf   */
 #endif /* WITH_PTHREADS */
 
-    int                 alloc;          /* num bytes malloc'd/realloc'd      */
-    int                 minsize;        /* min bytes of data to allocate     */
-    int                 maxsize;        /* max bytes of data to allocate     */
-    int                 size;           /* num bytes of data allocated       */
-    int                 used;           /* num bytes of unread data          */
-    cbuf_overwrite_t    overwrite;      /* overwrite option behavior         */
-    int                 got_wrap;       /* true if data has wrapped          */
-    int                 i_in;           /* index to where data is written in */
-    int                 i_out;          /* index to where data is read out   */
-    int                 i_rep;          /* index to where data is replayable */
-    unsigned char      *data;           /* ptr to circular buffer of data    */
+	int                 alloc;          /* num bytes malloc'd/realloc'd      */
+	int                 minsize;        /* min bytes of data to allocate     */
+	int                 maxsize;        /* max bytes of data to allocate     */
+	int                 size;           /* num bytes of data allocated       */
+	int                 used;           /* num bytes of unread data          */
+	cbuf_overwrite_t    overwrite;      /* overwrite option behavior         */
+	int                 got_wrap;       /* true if data has wrapped          */
+	int                 i_in;           /* index to where data is written in */
+	int                 i_out;          /* index to where data is read out   */
+	int                 i_rep;          /* index to where data is replayable */
+	unsigned char      *data;           /* ptr to circular buffer of data    */
 };
 
 typedef int (*cbuf_iof) (void *cbuf_data, void *arg, int len);
@@ -145,7 +145,7 @@ static int cbuf_dropper (cbuf_t cb, int len);
 static int cbuf_reader (cbuf_t src, int len, cbuf_iof putf, void *dst);
 static int cbuf_replayer (cbuf_t src, int len, cbuf_iof putf, void *dst);
 static int cbuf_writer (cbuf_t dst, int len, cbuf_iof getf, void *src,
-       int *ndropped);
+			int *ndropped);
 
 static int cbuf_grow (cbuf_t cb, int n);
 static int cbuf_shrink (cbuf_t cb);
@@ -169,48 +169,48 @@ static int cbuf_is_valid (cbuf_t cb);
 
 #ifdef WITH_PTHREADS
 
-#  define cbuf_mutex_init(cb)                                                 \
-     do {                                                                     \
-         int e = pthread_mutex_init(&cb->mutex, NULL);                        \
-         if (e) {                                                             \
-             errno = e;                                                       \
-             lsd_fatal_error(__FILE__, __LINE__, "cbuf mutex init");          \
-             abort();                                                         \
-         }                                                                    \
-     } while (0)
-
-#  define cbuf_mutex_lock(cb)                                                 \
-     do {                                                                     \
-         int e = pthread_mutex_lock(&cb->mutex);                              \
-         if (e) {                                                             \
-             errno = e;                                                       \
-             lsd_fatal_error(__FILE__, __LINE__, "cbuf mutex lock");          \
-             abort();                                                         \
-         }                                                                    \
-     } while (0)
-
-#  define cbuf_mutex_unlock(cb)                                               \
-     do {                                                                     \
-         int e = pthread_mutex_unlock(&cb->mutex);                            \
-         if (e) {                                                             \
-             errno = e;                                                       \
-             lsd_fatal_error(__FILE__, __LINE__, "cbuf mutex unlock");        \
-             abort();                                                         \
-         }                                                                    \
-     } while (0)
-
-#  define cbuf_mutex_destroy(cb)                                              \
-     do {                                                                     \
-         int e = pthread_mutex_destroy(&cb->mutex);                           \
-         if (e) {                                                             \
-             errno = e;                                                       \
-             lsd_fatal_error(__FILE__, __LINE__, "cbuf mutex destroy");       \
-             abort();                                                         \
-         }                                                                    \
-     } while (0)
+#  define cbuf_mutex_init(cb)						\
+	do {								\
+		int e = pthread_mutex_init(&cb->mutex, NULL);		\
+		if (e) {						\
+			errno = e;					\
+			lsd_fatal_error(__FILE__, __LINE__, "cbuf mutex init");	\
+			abort();					\
+		}							\
+	} while (0)
+
+#  define cbuf_mutex_lock(cb)						\
+	do {								\
+		int e = pthread_mutex_lock(&cb->mutex);			\
+		if (e) {						\
+			errno = e;					\
+			lsd_fatal_error(__FILE__, __LINE__, "cbuf mutex lock");	\
+			abort();					\
+		}							\
+	} while (0)
+
+#  define cbuf_mutex_unlock(cb)						\
+	do {								\
+		int e = pthread_mutex_unlock(&cb->mutex);		\
+		if (e) {						\
+			errno = e;					\
+			lsd_fatal_error(__FILE__, __LINE__, "cbuf mutex unlock"); \
+			abort();					\
+		}							\
+	} while (0)
+
+#  define cbuf_mutex_destroy(cb)					\
+	do {								\
+		int e = pthread_mutex_destroy(&cb->mutex);		\
+		if (e) {						\
+			errno = e;					\
+			lsd_fatal_error(__FILE__, __LINE__, "cbuf mutex destroy"); \
+			abort();					\
+		}							\
+	} while (0)
 
 #  ifndef NDEBUG
-     static int cbuf_mutex_is_locked (cbuf_t cb);
+static int cbuf_mutex_is_locked (cbuf_t cb);
 #  endif /* !NDEBUG */
 
 #else /* !WITH_PTHREADS */
@@ -231,161 +231,161 @@ static int cbuf_is_valid (cbuf_t cb);
 cbuf_t
 cbuf_create (int minsize, int maxsize)
 {
-    cbuf_t cb;
-
-    if (minsize <= 0) {
-        errno = EINVAL;
-        return(NULL);
-    }
-    if (!(cb = malloc(sizeof(struct cbuf)))) {
-        errno = ENOMEM;
-        return(lsd_nomem_error(__FILE__, __LINE__, "cbuf struct"));
-    }
-    /*  Circular buffer is empty when (i_in == i_out),
-     *    so reserve 1 byte for this sentinel.
-     */
-    cb->alloc = minsize + 1;
+	cbuf_t cb;
+
+	if (minsize <= 0) {
+		errno = EINVAL;
+		return(NULL);
+	}
+	if (!(cb = malloc(sizeof(struct cbuf)))) {
+		errno = ENOMEM;
+		return(lsd_nomem_error(__FILE__, __LINE__, "cbuf struct"));
+	}
+	/*  Circular buffer is empty when (i_in == i_out),
+	 *    so reserve 1 byte for this sentinel.
+	 */
+	cb->alloc = minsize + 1;
 #ifndef NDEBUG
-    /*  Reserve space for the magic cookies used to protect the
-     *    cbuf data[] array from underflow and overflow.
-     */
-    cb->alloc += 2 * CBUF_MAGIC_LEN;
+	/*  Reserve space for the magic cookies used to protect the
+	 *    cbuf data[] array from underflow and overflow.
+	 */
+	cb->alloc += 2 * CBUF_MAGIC_LEN;
 #endif /* !NDEBUG */
 
-    if (!(cb->data = malloc(cb->alloc))) {
-        free(cb);
-        errno = ENOMEM;
-        return(lsd_nomem_error(__FILE__, __LINE__, "cbuf data"));
-    }
-    cbuf_mutex_init(cb);
-    cb->minsize = minsize;
-    cb->maxsize = (maxsize > minsize) ? maxsize : minsize;
-    cb->size = minsize;
-    cb->used = 0;
-    cb->overwrite = CBUF_WRAP_MANY;
-    cb->got_wrap = 0;
-    cb->i_in = cb->i_out = cb->i_rep = 0;
+	if (!(cb->data = malloc(cb->alloc))) {
+		free(cb);
+		errno = ENOMEM;
+		return(lsd_nomem_error(__FILE__, __LINE__, "cbuf data"));
+	}
+	cbuf_mutex_init(cb);
+	cb->minsize = minsize;
+	cb->maxsize = (maxsize > minsize) ? maxsize : minsize;
+	cb->size = minsize;
+	cb->used = 0;
+	cb->overwrite = CBUF_WRAP_MANY;
+	cb->got_wrap = 0;
+	cb->i_in = cb->i_out = cb->i_rep = 0;
 
 #ifndef NDEBUG
-    /*  C is for cookie, that's good enough for me, yeah!
-     *  The magic cookies are only defined during DEBUG code.
-     *  The first "magic" cookie is at the top of the structure.
-     *  Magic cookies are also placed at the top & bottom of the
-     *  cbuf data[] array to catch buffer underflow & overflow errors.
-     */
-    cb->data += CBUF_MAGIC_LEN;         /* jump forward past underflow magic */
-    cb->magic = CBUF_MAGIC;
-    /*
-     *  Must use memcpy since overflow cookie may not be word-aligned.
-     */
-    memcpy(cb->data - CBUF_MAGIC_LEN, (void *) &cb->magic, CBUF_MAGIC_LEN);
-    memcpy(cb->data + cb->size + 1, (void *) &cb->magic, CBUF_MAGIC_LEN);
-
-    cbuf_mutex_lock(cb);
-    assert(cbuf_is_valid(cb));
-    cbuf_mutex_unlock(cb);
+	/*  C is for cookie, that's good enough for me, yeah!
+	 *  The magic cookies are only defined during DEBUG code.
+	 *  The first "magic" cookie is at the top of the structure.
+	 *  Magic cookies are also placed at the top & bottom of the
+	 *  cbuf data[] array to catch buffer underflow & overflow errors.
+	 */
+	cb->data += CBUF_MAGIC_LEN;         /* jump forward past underflow magic */
+	cb->magic = CBUF_MAGIC;
+	/*
+	 *  Must use memcpy since overflow cookie may not be word-aligned.
+	 */
+	memcpy(cb->data - CBUF_MAGIC_LEN, (void *) &cb->magic, CBUF_MAGIC_LEN);
+	memcpy(cb->data + cb->size + 1, (void *) &cb->magic, CBUF_MAGIC_LEN);
+
+	cbuf_mutex_lock(cb);
+	assert(cbuf_is_valid(cb));
+	cbuf_mutex_unlock(cb);
 #endif /* !NDEBUG */
 
-    return(cb);
+	return(cb);
 }
 
 
 void
 cbuf_destroy (cbuf_t cb)
 {
-    assert(cb != NULL);
-    cbuf_mutex_lock(cb);
-    assert(cbuf_is_valid(cb));
+	assert(cb != NULL);
+	cbuf_mutex_lock(cb);
+	assert(cbuf_is_valid(cb));
 
 #ifndef NDEBUG
-    /*  The moon sometimes looks like a C, but you can't eat that.
-     *  Munch the magic cookies before freeing memory.
-     */
-    cb->magic = ~CBUF_MAGIC;            /* the anti-cookie! */
-    memcpy(cb->data - CBUF_MAGIC_LEN, (void *) &cb->magic, CBUF_MAGIC_LEN);
-    memcpy(cb->data + cb->size + 1, (void *) &cb->magic, CBUF_MAGIC_LEN);
-    cb->data -= CBUF_MAGIC_LEN;         /* jump back to what malloc returned */
+	/*  The moon sometimes looks like a C, but you can't eat that.
+	 *  Munch the magic cookies before freeing memory.
+	 */
+	cb->magic = ~CBUF_MAGIC;            /* the anti-cookie! */
+	memcpy(cb->data - CBUF_MAGIC_LEN, (void *) &cb->magic, CBUF_MAGIC_LEN);
+	memcpy(cb->data + cb->size + 1, (void *) &cb->magic, CBUF_MAGIC_LEN);
+	cb->data -= CBUF_MAGIC_LEN;         /* jump back to what malloc returned */
 #endif /* !NDEBUG */
 
-    free(cb->data);
-    cbuf_mutex_unlock(cb);
-    cbuf_mutex_destroy(cb);
-    free(cb);
-    return;
+	free(cb->data);
+	cbuf_mutex_unlock(cb);
+	cbuf_mutex_destroy(cb);
+	free(cb);
+	return;
 }
 
 
 void
 cbuf_flush (cbuf_t cb)
 {
-    assert(cb != NULL);
-    cbuf_mutex_lock(cb);
-    assert(cbuf_is_valid(cb));
-    /*
-     *  FIXME: Shrink buffer back to minimum size.
-     */
-    cb->used = 0;
-    cb->got_wrap = 0;
-    cb->i_in = cb->i_out = cb->i_rep = 0;
-    assert(cbuf_is_valid(cb));
-    cbuf_mutex_unlock(cb);
-    return;
+	assert(cb != NULL);
+	cbuf_mutex_lock(cb);
+	assert(cbuf_is_valid(cb));
+	/*
+	 *  FIXME: Shrink buffer back to minimum size.
+	 */
+	cb->used = 0;
+	cb->got_wrap = 0;
+	cb->i_in = cb->i_out = cb->i_rep = 0;
+	assert(cbuf_is_valid(cb));
+	cbuf_mutex_unlock(cb);
+	return;
 }
 
 
 int
 cbuf_size (cbuf_t cb)
 {
-    int size;
-
-    assert(cb != NULL);
-    cbuf_mutex_lock(cb);
-    assert(cbuf_is_valid(cb));
-    size = cb->maxsize;
-    cbuf_mutex_unlock(cb);
-    return(size);
+	int size;
+
+	assert(cb != NULL);
+	cbuf_mutex_lock(cb);
+	assert(cbuf_is_valid(cb));
+	size = cb->maxsize;
+	cbuf_mutex_unlock(cb);
+	return(size);
 }
 
 
 int
 cbuf_free (cbuf_t cb)
 {
-    int nfree;
-
-    assert(cb != NULL);
-    cbuf_mutex_lock(cb);
-    assert(cbuf_is_valid(cb));
-    nfree = cb->maxsize - cb->used;
-    cbuf_mutex_unlock(cb);
-    return(nfree);
+	int nfree;
+
+	assert(cb != NULL);
+	cbuf_mutex_lock(cb);
+	assert(cbuf_is_valid(cb));
+	nfree = cb->maxsize - cb->used;
+	cbuf_mutex_unlock(cb);
+	return(nfree);
 }
 
 
 int
 cbuf_used (cbuf_t cb)
 {
-    int used;
-
-    assert(cb != NULL);
-    cbuf_mutex_lock(cb);
-    assert(cbuf_is_valid(cb));
-    used = cb->used;
-    cbuf_mutex_unlock(cb);
-    return(used);
+	int used;
+
+	assert(cb != NULL);
+	cbuf_mutex_lock(cb);
+	assert(cbuf_is_valid(cb));
+	used = cb->used;
+	cbuf_mutex_unlock(cb);
+	return(used);
 }
 
 
 int
 cbuf_lines_used (cbuf_t cb)
 {
-    int lines = -1;
-
-    assert(cb != NULL);
-    cbuf_mutex_lock(cb);
-    assert(cbuf_is_valid(cb));
-    cbuf_find_unread_line(cb, cb->size, &lines);
-    cbuf_mutex_unlock(cb);
-    return(lines);
+	int lines = -1;
+
+	assert(cb != NULL);
+	cbuf_mutex_lock(cb);
+	assert(cbuf_is_valid(cb));
+	cbuf_find_unread_line(cb, cb->size, &lines);
+	cbuf_mutex_unlock(cb);
+	return(lines);
 }
 
 
@@ -398,727 +398,727 @@ cbuf_reused (cbuf_t cb)
  *    n = (O - 0) + ((S+1) - R).
  *  (S+1) is used since data[] contains 'size' bytes + a 1-byte sentinel.
  */
-    int reused;
-
-    assert(cb != NULL);
-    cbuf_mutex_lock(cb);
-    assert(cbuf_is_valid(cb));
-    reused = (cb->i_out - cb->i_rep + (cb->size + 1)) % (cb->size + 1);
-    cbuf_mutex_unlock(cb);
-    return(reused);
+	int reused;
+
+	assert(cb != NULL);
+	cbuf_mutex_lock(cb);
+	assert(cbuf_is_valid(cb));
+	reused = (cb->i_out - cb->i_rep + (cb->size + 1)) % (cb->size + 1);
+	cbuf_mutex_unlock(cb);
+	return(reused);
 }
 
 
 int
 cbuf_lines_reused (cbuf_t cb)
 {
-    int lines = -1;
-
-    assert(cb != NULL);
-    cbuf_mutex_lock(cb);
-    assert(cbuf_is_valid(cb));
-    cbuf_find_replay_line(cb, cb->size, &lines, NULL);
-    cbuf_mutex_unlock(cb);
-    return(lines);
+	int lines = -1;
+
+	assert(cb != NULL);
+	cbuf_mutex_lock(cb);
+	assert(cbuf_is_valid(cb));
+	cbuf_find_replay_line(cb, cb->size, &lines, NULL);
+	cbuf_mutex_unlock(cb);
+	return(lines);
 }
 
 
 int
 cbuf_is_empty (cbuf_t cb)
 {
-    int used;
-
-    assert(cb != NULL);
-    cbuf_mutex_lock(cb);
-    assert(cbuf_is_valid(cb));
-    used = cb->used;
-    cbuf_mutex_unlock(cb);
-    return(used == 0);
+	int used;
+
+	assert(cb != NULL);
+	cbuf_mutex_lock(cb);
+	assert(cbuf_is_valid(cb));
+	used = cb->used;
+	cbuf_mutex_unlock(cb);
+	return(used == 0);
 }
 
 
 int
 cbuf_opt_get (cbuf_t cb, cbuf_opt_t name, int *value)
 {
-    int rc = 0;
-
-    assert(cb != NULL);
-
-    if (value == NULL) {
-        errno = EINVAL;
-        return(-1);
-    }
-    cbuf_mutex_lock(cb);
-    assert(cbuf_is_valid(cb));
-    if (name == CBUF_OPT_OVERWRITE) {
-        *value = cb->overwrite;
-    }
-    else {
-        errno = EINVAL;
-        rc = -1;
-    }
-    cbuf_mutex_unlock(cb);
-    return(rc);
+	int rc = 0;
+
+	assert(cb != NULL);
+
+	if (value == NULL) {
+		errno = EINVAL;
+		return(-1);
+	}
+	cbuf_mutex_lock(cb);
+	assert(cbuf_is_valid(cb));
+	if (name == CBUF_OPT_OVERWRITE) {
+		*value = cb->overwrite;
+	}
+	else {
+		errno = EINVAL;
+		rc = -1;
+	}
+	cbuf_mutex_unlock(cb);
+	return(rc);
 }
 
 
 int
 cbuf_opt_set (cbuf_t cb, cbuf_opt_t name, int value)
 {
-    int rc = 0;
-
-    assert(cb != NULL);
-
-    cbuf_mutex_lock(cb);
-    assert(cbuf_is_valid(cb));
-    if (name == CBUF_OPT_OVERWRITE) {
-        if  (  (value == CBUF_NO_DROP)
-            || (value == CBUF_WRAP_ONCE)
-            || (value == CBUF_WRAP_MANY) ) {
-            cb->overwrite = value;
-        }
-        else {
-            errno = EINVAL;
-            rc = -1;
-        }
-    }
-    else {
-        errno = EINVAL;
-        rc = -1;
-    }
-    assert(cbuf_is_valid(cb));
-    cbuf_mutex_unlock(cb);
-    return(rc);
+	int rc = 0;
+
+	assert(cb != NULL);
+
+	cbuf_mutex_lock(cb);
+	assert(cbuf_is_valid(cb));
+	if (name == CBUF_OPT_OVERWRITE) {
+		if  (  (value == CBUF_NO_DROP)
+		       || (value == CBUF_WRAP_ONCE)
+		       || (value == CBUF_WRAP_MANY) ) {
+			cb->overwrite = value;
+		}
+		else {
+			errno = EINVAL;
+			rc = -1;
+		}
+	}
+	else {
+		errno = EINVAL;
+		rc = -1;
+	}
+	assert(cbuf_is_valid(cb));
+	cbuf_mutex_unlock(cb);
+	return(rc);
 }
 
 
 int
 cbuf_drop (cbuf_t src, int len)
 {
-    assert(src != NULL);
-
-    if (len < -1) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (len == 0) {
-        return(0);
-    }
-    cbuf_mutex_lock(src);
-    assert(cbuf_is_valid(src));
-
-    if (len == -1) {
-        len = src->used;
-    }
-    else {
-        len = MIN(len, src->used);
-    }
-    if (len > 0) {
-        cbuf_dropper(src, len);
-    }
-    assert(cbuf_is_valid(src));
-    cbuf_mutex_unlock(src);
-    return(len);
+	assert(src != NULL);
+
+	if (len < -1) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (len == 0) {
+		return(0);
+	}
+	cbuf_mutex_lock(src);
+	assert(cbuf_is_valid(src));
+
+	if (len == -1) {
+		len = src->used;
+	}
+	else {
+		len = MIN(len, src->used);
+	}
+	if (len > 0) {
+		cbuf_dropper(src, len);
+	}
+	assert(cbuf_is_valid(src));
+	cbuf_mutex_unlock(src);
+	return(len);
 }
 
 
 int
 cbuf_peek (cbuf_t src, void *dstbuf, int len)
 {
-    int n;
-
-    assert(src != NULL);
-
-    if ((dstbuf == NULL) || (len < 0)) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (len == 0) {
-        return(0);
-    }
-    cbuf_mutex_lock(src);
-    assert(cbuf_is_valid(src));
-    n = cbuf_reader(src, len, (cbuf_iof) cbuf_put_mem, &dstbuf);
-    assert(cbuf_is_valid(src));
-    cbuf_mutex_unlock(src);
-    return(n);
+	int n;
+
+	assert(src != NULL);
+
+	if ((dstbuf == NULL) || (len < 0)) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (len == 0) {
+		return(0);
+	}
+	cbuf_mutex_lock(src);
+	assert(cbuf_is_valid(src));
+	n = cbuf_reader(src, len, (cbuf_iof) cbuf_put_mem, &dstbuf);
+	assert(cbuf_is_valid(src));
+	cbuf_mutex_unlock(src);
+	return(n);
 }
 
 
 int
 cbuf_read (cbuf_t src, void *dstbuf, int len)
 {
-    int n;
-
-    assert(src != NULL);
-
-    if ((dstbuf == NULL) || (len < 0)) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (len == 0) {
-        return(0);
-    }
-    cbuf_mutex_lock(src);
-    assert(cbuf_is_valid(src));
-    n = cbuf_reader(src, len, (cbuf_iof) cbuf_put_mem, &dstbuf);
-    if (n > 0) {
-        cbuf_dropper(src, n);
-    }
-    assert(cbuf_is_valid(src));
-    cbuf_mutex_unlock(src);
-    return(n);
+	int n;
+
+	assert(src != NULL);
+
+	if ((dstbuf == NULL) || (len < 0)) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (len == 0) {
+		return(0);
+	}
+	cbuf_mutex_lock(src);
+	assert(cbuf_is_valid(src));
+	n = cbuf_reader(src, len, (cbuf_iof) cbuf_put_mem, &dstbuf);
+	if (n > 0) {
+		cbuf_dropper(src, n);
+	}
+	assert(cbuf_is_valid(src));
+	cbuf_mutex_unlock(src);
+	return(n);
 }
 
 
 int
 cbuf_replay (cbuf_t src, void *dstbuf, int len)
 {
-    int n;
-
-    assert(src != NULL);
-
-    if ((dstbuf == NULL) || (len < 0)) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (len == 0) {
-        return(0);
-    }
-    cbuf_mutex_lock(src);
-    assert(cbuf_is_valid(src));
-    n = cbuf_replayer(src, len, (cbuf_iof) cbuf_put_mem, &dstbuf);
-    assert(cbuf_is_valid(src));
-    cbuf_mutex_unlock(src);
-    return(n);
+	int n;
+
+	assert(src != NULL);
+
+	if ((dstbuf == NULL) || (len < 0)) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (len == 0) {
+		return(0);
+	}
+	cbuf_mutex_lock(src);
+	assert(cbuf_is_valid(src));
+	n = cbuf_replayer(src, len, (cbuf_iof) cbuf_put_mem, &dstbuf);
+	assert(cbuf_is_valid(src));
+	cbuf_mutex_unlock(src);
+	return(n);
 }
 
 
 int
 cbuf_rewind (cbuf_t src, int len)
 {
-    int reused;
-
-    assert(src != NULL);
-
-    if (len < -1) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (len == 0) {
-        return(0);
-    }
-    cbuf_mutex_lock(src);
-    assert(cbuf_is_valid(src));
-
-    reused = (src->i_out - src->i_rep + (src->size + 1)) % (src->size + 1);
-    if (len == -1) {
-        len = reused;
-    }
-    else {
-        len = MIN(len, reused);
-    }
-    if (len > 0) {
-        src->used += len;
-        src->i_out = (src->i_out - len + (src->size + 1)) % (src->size + 1);
-    }
-    assert(cbuf_is_valid(src));
-    cbuf_mutex_unlock(src);
-    return(len);
+	int reused;
+
+	assert(src != NULL);
+
+	if (len < -1) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (len == 0) {
+		return(0);
+	}
+	cbuf_mutex_lock(src);
+	assert(cbuf_is_valid(src));
+
+	reused = (src->i_out - src->i_rep + (src->size + 1)) % (src->size + 1);
+	if (len == -1) {
+		len = reused;
+	}
+	else {
+		len = MIN(len, reused);
+	}
+	if (len > 0) {
+		src->used += len;
+		src->i_out = (src->i_out - len + (src->size + 1)) % (src->size + 1);
+	}
+	assert(cbuf_is_valid(src));
+	cbuf_mutex_unlock(src);
+	return(len);
 }
 
 
 int
 cbuf_write (cbuf_t dst, void *srcbuf, int len, int *ndropped)
 {
-    int n;
-
-    assert(dst != NULL);
-
-    if (ndropped) {
-        *ndropped = 0;
-    }
-    if ((srcbuf == NULL) || (len < 0)) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (len == 0) {
-        return(0);
-    }
-    cbuf_mutex_lock(dst);
-    assert(cbuf_is_valid(dst));
-    n = cbuf_writer(dst, len, (cbuf_iof) cbuf_get_mem, &srcbuf, ndropped);
-    assert(cbuf_is_valid(dst));
-    cbuf_mutex_unlock(dst);
-    return(n);
+	int n;
+
+	assert(dst != NULL);
+
+	if (ndropped) {
+		*ndropped = 0;
+	}
+	if ((srcbuf == NULL) || (len < 0)) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (len == 0) {
+		return(0);
+	}
+	cbuf_mutex_lock(dst);
+	assert(cbuf_is_valid(dst));
+	n = cbuf_writer(dst, len, (cbuf_iof) cbuf_get_mem, &srcbuf, ndropped);
+	assert(cbuf_is_valid(dst));
+	cbuf_mutex_unlock(dst);
+	return(n);
 }
 
 
 int
 cbuf_drop_line (cbuf_t src, int len, int lines)
 {
-    int n;
-
-    assert(src != NULL);
-
-    if ((len < 0) || (lines < -1)) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (lines == 0) {
-        return(0);
-    }
-    cbuf_mutex_lock(src);
-    assert(cbuf_is_valid(src));
-
-    n = cbuf_find_unread_line(src, len, &lines);
-    if (n > 0) {
-        cbuf_dropper(src, n);
-    }
-    assert(cbuf_is_valid(src));
-    cbuf_mutex_unlock(src);
-    return(n);
+	int n;
+
+	assert(src != NULL);
+
+	if ((len < 0) || (lines < -1)) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (lines == 0) {
+		return(0);
+	}
+	cbuf_mutex_lock(src);
+	assert(cbuf_is_valid(src));
+
+	n = cbuf_find_unread_line(src, len, &lines);
+	if (n > 0) {
+		cbuf_dropper(src, n);
+	}
+	assert(cbuf_is_valid(src));
+	cbuf_mutex_unlock(src);
+	return(n);
 }
 
 
 int
 cbuf_peek_line (cbuf_t src, char *dstbuf, int len, int lines)
 {
-    int n, m, l;
-    char *pdst;
-
-    assert(src != NULL);
-
-    if ((dstbuf == NULL) || (len < 0) || (lines < -1)) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (lines == 0) {
-        return(0);
-    }
-    cbuf_mutex_lock(src);
-    assert(cbuf_is_valid(src));
-    n = cbuf_find_unread_line(src, len - 1, &lines);
-    if (n > 0) {
-        if (len > 0) {
-            m = MIN(n, len - 1);
-            if (m > 0) {
-                pdst = dstbuf;
-                l = cbuf_reader(src, m, (cbuf_iof) cbuf_put_mem, &pdst);
-                assert(l == m);
-            }
-            assert(m < len);
-            dstbuf[m] = '\0';
-        }
-    }
-    assert(cbuf_is_valid(src));
-    cbuf_mutex_unlock(src);
-    return(n);
+	int n, m, l;
+	char *pdst;
+
+	assert(src != NULL);
+
+	if ((dstbuf == NULL) || (len < 0) || (lines < -1)) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (lines == 0) {
+		return(0);
+	}
+	cbuf_mutex_lock(src);
+	assert(cbuf_is_valid(src));
+	n = cbuf_find_unread_line(src, len - 1, &lines);
+	if (n > 0) {
+		if (len > 0) {
+			m = MIN(n, len - 1);
+			if (m > 0) {
+				pdst = dstbuf;
+				l = cbuf_reader(src, m, (cbuf_iof) cbuf_put_mem, &pdst);
+				assert(l == m);
+			}
+			assert(m < len);
+			dstbuf[m] = '\0';
+		}
+	}
+	assert(cbuf_is_valid(src));
+	cbuf_mutex_unlock(src);
+	return(n);
 }
 
 
 int
 cbuf_read_line (cbuf_t src, char *dstbuf, int len, int lines)
 {
-    int n, m, l;
-    char *pdst;
-
-    assert(src != NULL);
-
-    if ((dstbuf == NULL) || (len < 0) || (lines < -1)) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (lines == 0) {
-        return(0);
-    }
-    cbuf_mutex_lock(src);
-    assert(cbuf_is_valid(src));
-    n = cbuf_find_unread_line(src, len - 1, &lines);
-    if (n > 0) {
-        if (len > 0) {
-            m = MIN(n, len - 1);
-            if (m > 0) {
-                pdst = dstbuf;
-                l = cbuf_reader(src, m, (cbuf_iof) cbuf_put_mem, &pdst);
-                assert(l == m);
-            }
-            assert(m < len);
-            dstbuf[m] = '\0';
-        }
-        cbuf_dropper(src, n);
-    }
-    assert(cbuf_is_valid(src));
-    cbuf_mutex_unlock(src);
-    return(n);
+	int n, m, l;
+	char *pdst;
+
+	assert(src != NULL);
+
+	if ((dstbuf == NULL) || (len < 0) || (lines < -1)) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (lines == 0) {
+		return(0);
+	}
+	cbuf_mutex_lock(src);
+	assert(cbuf_is_valid(src));
+	n = cbuf_find_unread_line(src, len - 1, &lines);
+	if (n > 0) {
+		if (len > 0) {
+			m = MIN(n, len - 1);
+			if (m > 0) {
+				pdst = dstbuf;
+				l = cbuf_reader(src, m, (cbuf_iof) cbuf_put_mem, &pdst);
+				assert(l == m);
+			}
+			assert(m < len);
+			dstbuf[m] = '\0';
+		}
+		cbuf_dropper(src, n);
+	}
+	assert(cbuf_is_valid(src));
+	cbuf_mutex_unlock(src);
+	return(n);
 }
 
 
 int
 cbuf_replay_line (cbuf_t src, char *dstbuf, int len, int lines)
 {
-    int n, m, l;
-    int nl;
-    char *pdst;
-
-    assert(src != NULL);
-
-    if ((dstbuf == NULL) || (len < 0) || (lines < -1)) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (lines == 0) {
-        return(0);
-    }
-    cbuf_mutex_lock(src);
-    assert(cbuf_is_valid(src));
-    n = cbuf_find_replay_line(src, len - 1, &lines, &nl);
-    if (n > 0) {
-        if (len > 0) {
-            assert((nl == 0) || (nl == 1));
-            m = MIN(n, len - 1 - nl);
-            m = MAX(m, 0);
-            if (m > 0) {
-                pdst = dstbuf;
-                l = cbuf_replayer(src, m, (cbuf_iof) cbuf_put_mem, &pdst);
-                assert(l == m);
-            }
-            /*  Append newline if needed and space allows.
-             */
-            if ((nl) && (len > 1)) {
-                dstbuf[m++] = '\n';
-            }
-            assert(m < len);
-            dstbuf[m] = '\0';
-            n += nl;
-        }
-    }
-    assert(cbuf_is_valid(src));
-    cbuf_mutex_unlock(src);
-    return(n);
+	int n, m, l;
+	int nl;
+	char *pdst;
+
+	assert(src != NULL);
+
+	if ((dstbuf == NULL) || (len < 0) || (lines < -1)) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (lines == 0) {
+		return(0);
+	}
+	cbuf_mutex_lock(src);
+	assert(cbuf_is_valid(src));
+	n = cbuf_find_replay_line(src, len - 1, &lines, &nl);
+	if (n > 0) {
+		if (len > 0) {
+			assert((nl == 0) || (nl == 1));
+			m = MIN(n, len - 1 - nl);
+			m = MAX(m, 0);
+			if (m > 0) {
+				pdst = dstbuf;
+				l = cbuf_replayer(src, m, (cbuf_iof) cbuf_put_mem, &pdst);
+				assert(l == m);
+			}
+			/*  Append newline if needed and space allows.
+			 */
+			if ((nl) && (len > 1)) {
+				dstbuf[m++] = '\n';
+			}
+			assert(m < len);
+			dstbuf[m] = '\0';
+			n += nl;
+		}
+	}
+	assert(cbuf_is_valid(src));
+	cbuf_mutex_unlock(src);
+	return(n);
 }
 
 
 int
 cbuf_rewind_line (cbuf_t src, int len, int lines)
 {
-    int n;
-
-    assert(src != NULL);
-
-    if ((len < 0) || (lines < -1)) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (lines == 0) {
-        return(0);
-    }
-    cbuf_mutex_lock(src);
-    assert(cbuf_is_valid(src));
-
-    n = cbuf_find_replay_line(src, len, &lines, NULL);
-    if (n > 0) {
-        src->used += n;
-        src->i_out = (src->i_out - n + (src->size + 1)) % (src->size + 1);
-    }
-    assert(cbuf_is_valid(src));
-    cbuf_mutex_unlock(src);
-    return(n);
+	int n;
+
+	assert(src != NULL);
+
+	if ((len < 0) || (lines < -1)) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (lines == 0) {
+		return(0);
+	}
+	cbuf_mutex_lock(src);
+	assert(cbuf_is_valid(src));
+
+	n = cbuf_find_replay_line(src, len, &lines, NULL);
+	if (n > 0) {
+		src->used += n;
+		src->i_out = (src->i_out - n + (src->size + 1)) % (src->size + 1);
+	}
+	assert(cbuf_is_valid(src));
+	cbuf_mutex_unlock(src);
+	return(n);
 }
 
 
 int
 cbuf_write_line (cbuf_t dst, char *srcbuf, int *ndropped)
 {
-    int len;
-    int nfree, ncopy, n;
-    int ndrop = 0, d;
-    char *psrc = srcbuf;
-    char *newline = "\n";
-
-    assert(dst != NULL);
-
-    if (ndropped) {
-        *ndropped = 0;
-    }
-    if (srcbuf == NULL) {
-        errno = EINVAL;
-        return(-1);
-    }
-    /*  Compute number of bytes to effectively copy to dst cbuf.
-     *  Reserve space for the trailing newline if needed.
-     */
-    len = ncopy = strlen(srcbuf);
-    if ((len == 0) || (srcbuf[len - 1] != '\n')) {
-        len++;
-    }
-    cbuf_mutex_lock(dst);
-    assert(cbuf_is_valid(dst));
-    /*
-     *  Attempt to grow dst cbuf if necessary.
-     */
-    nfree = dst->size - dst->used;
-    if ((len > nfree) && (dst->size < dst->maxsize)) {
-        nfree += cbuf_grow(dst, len - nfree);
-    }
-    /*  Determine if src will fit (or be made to fit) in dst cbuf.
-     */
-    if (dst->overwrite == CBUF_NO_DROP) {
-        if (len > dst->size - dst->used) {
-            errno = ENOSPC;
-            len = -1;                   /* cannot return while mutex locked */
-        }
-    }
-    else if (dst->overwrite == CBUF_WRAP_ONCE) {
-        if (len > dst->size) {
-            errno = ENOSPC;
-            len = -1;                   /* cannot return while mutex locked */
-        }
-    }
-    if (len > 0) {
-        /*
-         *  Discard data that won't fit in dst cbuf.
-         */
-        if (len > dst->size) {
-            ndrop += len - dst->size;
-            ncopy -= ndrop;
-            psrc += ndrop;
-        }
-        /*  Copy data from src string to dst cbuf.
-         */
-        if (ncopy > 0) {
-            n = cbuf_writer(dst, ncopy, (cbuf_iof) cbuf_get_mem, &psrc, &d);
-            assert(n == ncopy);
-            ndrop += d;
-        }
-        /*  Append newline if needed.
-         */
-        if (srcbuf[len - 1] != '\n') {
-            n = cbuf_writer(dst, 1, (cbuf_iof) cbuf_get_mem, &newline, &d);
-            assert(n == 1);
-            ndrop += d;
-        }
-    }
-    assert(cbuf_is_valid(dst));
-    cbuf_mutex_unlock(dst);
-    if (ndropped) {
-        *ndropped = ndrop;
-    }
-    return(len);
+	int len;
+	int nfree, ncopy, n;
+	int ndrop = 0, d;
+	char *psrc = srcbuf;
+	char *newline = "\n";
+
+	assert(dst != NULL);
+
+	if (ndropped) {
+		*ndropped = 0;
+	}
+	if (srcbuf == NULL) {
+		errno = EINVAL;
+		return(-1);
+	}
+	/*  Compute number of bytes to effectively copy to dst cbuf.
+	 *  Reserve space for the trailing newline if needed.
+	 */
+	len = ncopy = strlen(srcbuf);
+	if ((len == 0) || (srcbuf[len - 1] != '\n')) {
+		len++;
+	}
+	cbuf_mutex_lock(dst);
+	assert(cbuf_is_valid(dst));
+	/*
+	 *  Attempt to grow dst cbuf if necessary.
+	 */
+	nfree = dst->size - dst->used;
+	if ((len > nfree) && (dst->size < dst->maxsize)) {
+		nfree += cbuf_grow(dst, len - nfree);
+	}
+	/*  Determine if src will fit (or be made to fit) in dst cbuf.
+	 */
+	if (dst->overwrite == CBUF_NO_DROP) {
+		if (len > dst->size - dst->used) {
+			errno = ENOSPC;
+			len = -1;                   /* cannot return while mutex locked */
+		}
+	}
+	else if (dst->overwrite == CBUF_WRAP_ONCE) {
+		if (len > dst->size) {
+			errno = ENOSPC;
+			len = -1;                   /* cannot return while mutex locked */
+		}
+	}
+	if (len > 0) {
+		/*
+		 *  Discard data that won't fit in dst cbuf.
+		 */
+		if (len > dst->size) {
+			ndrop += len - dst->size;
+			ncopy -= ndrop;
+			psrc += ndrop;
+		}
+		/*  Copy data from src string to dst cbuf.
+		 */
+		if (ncopy > 0) {
+			n = cbuf_writer(dst, ncopy, (cbuf_iof) cbuf_get_mem, &psrc, &d);
+			assert(n == ncopy);
+			ndrop += d;
+		}
+		/*  Append newline if needed.
+		 */
+		if (srcbuf[len - 1] != '\n') {
+			n = cbuf_writer(dst, 1, (cbuf_iof) cbuf_get_mem, &newline, &d);
+			assert(n == 1);
+			ndrop += d;
+		}
+	}
+	assert(cbuf_is_valid(dst));
+	cbuf_mutex_unlock(dst);
+	if (ndropped) {
+		*ndropped = ndrop;
+	}
+	return(len);
 }
 
 
 int
 cbuf_peek_to_fd (cbuf_t src, int dstfd, int len)
 {
-    int n = 0;
-
-    assert(src != NULL);
-
-    if ((dstfd < 0) || (len < -1)) {
-        errno = EINVAL;
-        return(-1);
-    }
-    cbuf_mutex_lock(src);
-    assert(cbuf_is_valid(src));
-    if (len == -1) {
-        len = src->used;
-    }
-    if (len > 0) {
-        n = cbuf_reader(src, len, (cbuf_iof) cbuf_put_fd, &dstfd);
-    }
-    assert(cbuf_is_valid(src));
-    cbuf_mutex_unlock(src);
-    return(n);
+	int n = 0;
+
+	assert(src != NULL);
+
+	if ((dstfd < 0) || (len < -1)) {
+		errno = EINVAL;
+		return(-1);
+	}
+	cbuf_mutex_lock(src);
+	assert(cbuf_is_valid(src));
+	if (len == -1) {
+		len = src->used;
+	}
+	if (len > 0) {
+		n = cbuf_reader(src, len, (cbuf_iof) cbuf_put_fd, &dstfd);
+	}
+	assert(cbuf_is_valid(src));
+	cbuf_mutex_unlock(src);
+	return(n);
 }
 
 
 int
 cbuf_read_to_fd (cbuf_t src, int dstfd, int len)
 {
-    int n = 0;
-
-    assert(src != NULL);
-
-    if ((dstfd < 0) || (len < -1)) {
-        errno = EINVAL;
-        return(-1);
-    }
-    cbuf_mutex_lock(src);
-    assert(cbuf_is_valid(src));
-    if (len == -1) {
-        len = src->used;
-    }
-    if (len > 0) {
-        n = cbuf_reader(src, len, (cbuf_iof) cbuf_put_fd, &dstfd);
-        if (n > 0) {
-            cbuf_dropper(src, n);
-        }
-    }
-    assert(cbuf_is_valid(src));
-    cbuf_mutex_unlock(src);
-    return(n);
+	int n = 0;
+
+	assert(src != NULL);
+
+	if ((dstfd < 0) || (len < -1)) {
+		errno = EINVAL;
+		return(-1);
+	}
+	cbuf_mutex_lock(src);
+	assert(cbuf_is_valid(src));
+	if (len == -1) {
+		len = src->used;
+	}
+	if (len > 0) {
+		n = cbuf_reader(src, len, (cbuf_iof) cbuf_put_fd, &dstfd);
+		if (n > 0) {
+			cbuf_dropper(src, n);
+		}
+	}
+	assert(cbuf_is_valid(src));
+	cbuf_mutex_unlock(src);
+	return(n);
 }
 
 
 int
 cbuf_replay_to_fd (cbuf_t src, int dstfd, int len)
 {
-    int n = 0;
-
-    assert(src != NULL);
-
-    if ((dstfd < 0) || (len < -1)) {
-        errno = EINVAL;
-        return(-1);
-    }
-    cbuf_mutex_lock(src);
-    assert(cbuf_is_valid(src));
-    if (len == -1) {
-        len = src->size - src->used;
-    }
-    if (len > 0) {
-        n = cbuf_replayer(src, len, (cbuf_iof) cbuf_put_fd, &dstfd);
-    }
-    assert(cbuf_is_valid(src));
-    cbuf_mutex_unlock(src);
-    return(n);
+	int n = 0;
+
+	assert(src != NULL);
+
+	if ((dstfd < 0) || (len < -1)) {
+		errno = EINVAL;
+		return(-1);
+	}
+	cbuf_mutex_lock(src);
+	assert(cbuf_is_valid(src));
+	if (len == -1) {
+		len = src->size - src->used;
+	}
+	if (len > 0) {
+		n = cbuf_replayer(src, len, (cbuf_iof) cbuf_put_fd, &dstfd);
+	}
+	assert(cbuf_is_valid(src));
+	cbuf_mutex_unlock(src);
+	return(n);
 }
 
 
 int
 cbuf_write_from_fd (cbuf_t dst, int srcfd, int len, int *ndropped)
 {
-    int n = 0;
-
-    assert(dst != NULL);
-
-    if (ndropped) {
-        *ndropped = 0;
-    }
-    if ((srcfd < 0) || (len < -1)) {
-        errno = EINVAL;
-        return(-1);
-    }
-    cbuf_mutex_lock(dst);
-    assert(cbuf_is_valid(dst));
-    if (len == -1) {
-        /*
-         *  Try to use all of the free buffer space available for writing.
-         *    If it is all in use, try to grab another chunk.
-         */
-        len = dst->size - dst->used;
-        if (len == 0) {
-            len = CBUF_CHUNK;
-        }
-    }
-    if (len > 0) {
-        n = cbuf_writer(dst, len, (cbuf_iof) cbuf_get_fd, &srcfd, ndropped);
-    }
-    assert(cbuf_is_valid(dst));
-    cbuf_mutex_unlock(dst);
-    return(n);
+	int n = 0;
+
+	assert(dst != NULL);
+
+	if (ndropped) {
+		*ndropped = 0;
+	}
+	if ((srcfd < 0) || (len < -1)) {
+		errno = EINVAL;
+		return(-1);
+	}
+	cbuf_mutex_lock(dst);
+	assert(cbuf_is_valid(dst));
+	if (len == -1) {
+		/*
+		 *  Try to use all of the free buffer space available for writing.
+		 *    If it is all in use, try to grab another chunk.
+		 */
+		len = dst->size - dst->used;
+		if (len == 0) {
+			len = CBUF_CHUNK;
+		}
+	}
+	if (len > 0) {
+		n = cbuf_writer(dst, len, (cbuf_iof) cbuf_get_fd, &srcfd, ndropped);
+	}
+	assert(cbuf_is_valid(dst));
+	cbuf_mutex_unlock(dst);
+	return(n);
 }
 
 
 int
 cbuf_copy (cbuf_t src, cbuf_t dst, int len, int *ndropped)
 {
-    int n = 0;
-
-    assert(src != NULL);
-    assert(dst != NULL);
-
-    if (ndropped) {
-        *ndropped = 0;
-    }
-    if (src == dst) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (len < -1) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (len == 0) {
-        return(0);
-    }
-    /*  Lock cbufs in order of lowest memory address to prevent deadlock.
-     */
-    if (src < dst) {
-        cbuf_mutex_lock(src);
-        cbuf_mutex_lock(dst);
-    }
-    else {
-        cbuf_mutex_lock(dst);
-        cbuf_mutex_lock(src);
-    }
-    assert(cbuf_is_valid(src));
-    assert(cbuf_is_valid(dst));
-
-    if (len == -1) {
-        len = src->used;
-    }
-    if (len > 0) {
-        n = cbuf_copier(src, dst, len, ndropped);
-    }
-    assert(cbuf_is_valid(src));
-    assert(cbuf_is_valid(dst));
-    cbuf_mutex_unlock(src);
-    cbuf_mutex_unlock(dst);
-    return(n);
+	int n = 0;
+
+	assert(src != NULL);
+	assert(dst != NULL);
+
+	if (ndropped) {
+		*ndropped = 0;
+	}
+	if (src == dst) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (len < -1) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (len == 0) {
+		return(0);
+	}
+	/*  Lock cbufs in order of lowest memory address to prevent deadlock.
+	 */
+	if (src < dst) {
+		cbuf_mutex_lock(src);
+		cbuf_mutex_lock(dst);
+	}
+	else {
+		cbuf_mutex_lock(dst);
+		cbuf_mutex_lock(src);
+	}
+	assert(cbuf_is_valid(src));
+	assert(cbuf_is_valid(dst));
+
+	if (len == -1) {
+		len = src->used;
+	}
+	if (len > 0) {
+		n = cbuf_copier(src, dst, len, ndropped);
+	}
+	assert(cbuf_is_valid(src));
+	assert(cbuf_is_valid(dst));
+	cbuf_mutex_unlock(src);
+	cbuf_mutex_unlock(dst);
+	return(n);
 }
 
 
 int
 cbuf_move (cbuf_t src, cbuf_t dst, int len, int *ndropped)
 {
-    int n = 0;
-
-    assert(src != NULL);
-    assert(dst != NULL);
-
-    if (ndropped) {
-        *ndropped = 0;
-    }
-    if (src == dst) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (len < -1) {
-        errno = EINVAL;
-        return(-1);
-    }
-    if (len == 0) {
-        return(0);
-    }
-    /*  Lock cbufs in order of lowest memory address to prevent deadlock.
-     */
-    if (src < dst) {
-        cbuf_mutex_lock(src);
-        cbuf_mutex_lock(dst);
-    }
-    else {
-        cbuf_mutex_lock(dst);
-        cbuf_mutex_lock(src);
-    }
-    assert(cbuf_is_valid(src));
-    assert(cbuf_is_valid(dst));
-
-    if (len == -1) {
-        len = src->used;
-    }
-    if (len > 0) {
-        n = cbuf_copier(src, dst, len, ndropped);
-        if (n > 0) {
-            cbuf_dropper(src, n);
-        }
-    }
-    assert(cbuf_is_valid(src));
-    assert(cbuf_is_valid(dst));
-    cbuf_mutex_unlock(src);
-    cbuf_mutex_unlock(dst);
-    return(n);
+	int n = 0;
+
+	assert(src != NULL);
+	assert(dst != NULL);
+
+	if (ndropped) {
+		*ndropped = 0;
+	}
+	if (src == dst) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (len < -1) {
+		errno = EINVAL;
+		return(-1);
+	}
+	if (len == 0) {
+		return(0);
+	}
+	/*  Lock cbufs in order of lowest memory address to prevent deadlock.
+	 */
+	if (src < dst) {
+		cbuf_mutex_lock(src);
+		cbuf_mutex_lock(dst);
+	}
+	else {
+		cbuf_mutex_lock(dst);
+		cbuf_mutex_lock(src);
+	}
+	assert(cbuf_is_valid(src));
+	assert(cbuf_is_valid(dst));
+
+	if (len == -1) {
+		len = src->used;
+	}
+	if (len > 0) {
+		n = cbuf_copier(src, dst, len, ndropped);
+		if (n > 0) {
+			cbuf_dropper(src, n);
+		}
+	}
+	assert(cbuf_is_valid(src));
+	assert(cbuf_is_valid(dst));
+	cbuf_mutex_unlock(src);
+	cbuf_mutex_unlock(dst);
+	return(n);
 }
 
 
@@ -1136,84 +1136,84 @@ cbuf_find_replay_line (cbuf_t cb, int chars, int *nlines, int *nl)
  *  Sets the value-result parameter [nlines] to the number of lines found.
  *  Sets [nl] to '1' if a newline is required to terminate the replay data.
  */
-    int i, n, m, l;
-    int lines;
-
-    assert(cb != NULL);
-    assert(nlines != NULL);
-    assert(*nlines >= -1);
-    assert(cbuf_mutex_is_locked(cb));
-
-    n = m = l = 0;
-    lines = *nlines;
-    *nlines = 0;
-
-    if (nl) {
-        *nl = 0;                        /* init in case of early return */
-    }
-    if ((lines == 0) || ((lines <= -1) && (chars <= 0))) {
-        return(0);
-    }
-    if (cb->i_out == cb->i_rep) {
-        return(0);                      /* no replay data available */
-    }
-    if (lines > 0) {
-        chars = -1;                     /* chars parm not used if lines > 0 */
-    }
-    else {
-        ++chars;                        /* incr to allow for preceding '\n' */
-    }
-    /*  Since the most recent line of replay data is considered implicitly
-     *    terminated, decrement the char count to account for the newline
-     *    if one is not present, or increment the line count if one is.
-     *  Note: cb->data[(O - 1 + (S+1)) % (S+1)] is the last replayable char.
-     */
-    if (cb->data[(cb->i_out + cb->size) % (cb->size + 1)] != '\n') {
-        if (nl) {
-            *nl = 1;
-        }
-        --chars;
-    }
-    else {
-        if (lines > 0) {
-            ++lines;
-        }
-        --l;
-    }
-    i = cb->i_out;
-    while (i != cb->i_rep) {
-        i = (i + cb->size) % (cb->size + 1); /* (i - 1 + (S+1)) % (S+1) */
-        ++n;
-        if (chars > 0) {
-            --chars;
-        }
-        /*  Complete lines are identified by a preceding newline.
-         */
-        if (cb->data[i] == '\n') {
-            if (lines > 0) {
-                --lines;
-            }
-            m = n - 1;                  /* do not include preceding '\n' */
-            ++l;
-        }
-        if ((chars == 0) || (lines == 0)) {
-            break;
-        }
-    }
-    /*  But the first line written in does not need a preceding newline.
-     */
-    if ((!cb->got_wrap) && ((chars > 0) || (lines > 0))) {
-        if (lines > 0) {
-            --lines;
-        }
-        m = n;
-        ++l;
-    }
-    if (lines > 0) {
-        return(0);                      /* all or none, and not enough found */
-    }
-    *nlines = l;
-    return(m);
+	int i, n, m, l;
+	int lines;
+
+	assert(cb != NULL);
+	assert(nlines != NULL);
+	assert(*nlines >= -1);
+	assert(cbuf_mutex_is_locked(cb));
+
+	n = m = l = 0;
+	lines = *nlines;
+	*nlines = 0;
+
+	if (nl) {
+		*nl = 0;                        /* init in case of early return */
+	}
+	if ((lines == 0) || ((lines <= -1) && (chars <= 0))) {
+		return(0);
+	}
+	if (cb->i_out == cb->i_rep) {
+		return(0);                      /* no replay data available */
+	}
+	if (lines > 0) {
+		chars = -1;                     /* chars parm not used if lines > 0 */
+	}
+	else {
+		++chars;                        /* incr to allow for preceding '\n' */
+	}
+	/*  Since the most recent line of replay data is considered implicitly
+	 *    terminated, decrement the char count to account for the newline
+	 *    if one is not present, or increment the line count if one is.
+	 *  Note: cb->data[(O - 1 + (S+1)) % (S+1)] is the last replayable char.
+	 */
+	if (cb->data[(cb->i_out + cb->size) % (cb->size + 1)] != '\n') {
+		if (nl) {
+			*nl = 1;
+		}
+		--chars;
+	}
+	else {
+		if (lines > 0) {
+			++lines;
+		}
+		--l;
+	}
+	i = cb->i_out;
+	while (i != cb->i_rep) {
+		i = (i + cb->size) % (cb->size + 1); /* (i - 1 + (S+1)) % (S+1) */
+		++n;
+		if (chars > 0) {
+			--chars;
+		}
+		/*  Complete lines are identified by a preceding newline.
+		 */
+		if (cb->data[i] == '\n') {
+			if (lines > 0) {
+				--lines;
+			}
+			m = n - 1;                  /* do not include preceding '\n' */
+			++l;
+		}
+		if ((chars == 0) || (lines == 0)) {
+			break;
+		}
+	}
+	/*  But the first line written in does not need a preceding newline.
+	 */
+	if ((!cb->got_wrap) && ((chars > 0) || (lines > 0))) {
+		if (lines > 0) {
+			--lines;
+		}
+		m = n;
+		++l;
+	}
+	if (lines > 0) {
+		return(0);                      /* all or none, and not enough found */
+	}
+	*nlines = l;
+	return(m);
 }
 
 
@@ -1228,50 +1228,50 @@ cbuf_find_unread_line (cbuf_t cb, int chars, int *nlines)
  *  Only complete lines (ie, those terminated by a newline) are counted.
  *  Sets the value-result parameter [nlines] to the number of lines found.
  */
-    int i, n, m, l;
-    int lines;
-
-    assert(cb != NULL);
-    assert(nlines != NULL);
-    assert(*nlines >= -1);
-    assert(cbuf_mutex_is_locked(cb));
-
-    n = m = l = 0;
-    lines = *nlines;
-    *nlines = 0;
-
-    if ((lines == 0) || ((lines <= -1) && (chars <= 0))) {
-        return(0);
-    }
-    if (cb->used == 0) {
-        return(0);                      /* no unread data available */
-    }
-    if (lines > 0) {
-        chars = -1;                     /* chars parm not used if lines > 0 */
-    }
-    i = cb->i_out;
-    while (i != cb->i_in) {
-        ++n;
-        if (chars > 0) {
-            --chars;
-        }
-        if (cb->data[i] == '\n') {
-            if (lines > 0) {
-                --lines;
-            }
-            m = n;
-            ++l;
-        }
-        if ((chars == 0) || (lines == 0)) {
-            break;
-        }
-        i = (i + 1) % (cb->size + 1);
-    }
-    if (lines > 0) {
-        return(0);                      /* all or none, and not enough found */
-    }
-    *nlines = l;
-    return(m);
+	int i, n, m, l;
+	int lines;
+
+	assert(cb != NULL);
+	assert(nlines != NULL);
+	assert(*nlines >= -1);
+	assert(cbuf_mutex_is_locked(cb));
+
+	n = m = l = 0;
+	lines = *nlines;
+	*nlines = 0;
+
+	if ((lines == 0) || ((lines <= -1) && (chars <= 0))) {
+		return(0);
+	}
+	if (cb->used == 0) {
+		return(0);                      /* no unread data available */
+	}
+	if (lines > 0) {
+		chars = -1;                     /* chars parm not used if lines > 0 */
+	}
+	i = cb->i_out;
+	while (i != cb->i_in) {
+		++n;
+		if (chars > 0) {
+			--chars;
+		}
+		if (cb->data[i] == '\n') {
+			if (lines > 0) {
+				--lines;
+			}
+			m = n;
+			++l;
+		}
+		if ((chars == 0) || (lines == 0)) {
+			break;
+		}
+		i = (i + 1) % (cb->size + 1);
+	}
+	if (lines > 0) {
+		return(0);                      /* all or none, and not enough found */
+	}
+	*nlines = l;
+	return(m);
 }
 
 
@@ -1282,17 +1282,17 @@ cbuf_get_fd (void *dstbuf, int *psrcfd, int len)
  *    pointed at by [psrcfd] into cbuf's [dstbuf].
  *  Returns the number of bytes read from the fd, 0 on EOF, or -1 on error.
  */
-    int n;
+	int n;
 
-    assert(dstbuf != NULL);
-    assert(psrcfd != NULL);
-    assert(*psrcfd >= 0);
-    assert(len > 0);
+	assert(dstbuf != NULL);
+	assert(psrcfd != NULL);
+	assert(*psrcfd >= 0);
+	assert(len > 0);
 
-    do {
-        n = read(*psrcfd, dstbuf, len);
-    } while ((n < 0) && (errno == EINTR));
-    return(n);
+	do {
+		n = read(*psrcfd, dstbuf, len);
+	} while ((n < 0) && (errno == EINTR));
+	return(n);
 }
 
 
@@ -1302,14 +1302,14 @@ cbuf_get_mem (void *dstbuf, unsigned char **psrcbuf, int len)
 /*  Copies data from the buffer pointed at by [psrcbuf] into cbuf's [dstbuf].
  *  Returns the number of bytes copied.
  */
-    assert(dstbuf != NULL);
-    assert(psrcbuf != NULL);
-    assert(*psrcbuf != NULL);
-    assert(len > 0);
-
-    memcpy(dstbuf, *psrcbuf, len);
-    *psrcbuf += len;
-    return(len);
+	assert(dstbuf != NULL);
+	assert(psrcbuf != NULL);
+	assert(*psrcbuf != NULL);
+	assert(len > 0);
+
+	memcpy(dstbuf, *psrcbuf, len);
+	*psrcbuf += len;
+	return(len);
 }
 
 
@@ -1320,17 +1320,17 @@ cbuf_put_fd (void *srcbuf, int *pdstfd, int len)
  *    by the file descriptor pointed at by [pdstfd].
  *  Returns the number of bytes written to the fd, or -1 on error.
  */
-    int n;
+	int n;
 
-    assert(srcbuf != NULL);
-    assert(pdstfd != NULL);
-    assert(*pdstfd >= 0);
-    assert(len > 0);
+	assert(srcbuf != NULL);
+	assert(pdstfd != NULL);
+	assert(*pdstfd >= 0);
+	assert(len > 0);
 
-    do {
-        n = write(*pdstfd, srcbuf, len);
-    } while ((n < 0) && (errno == EINTR));
-    return(n);
+	do {
+		n = write(*pdstfd, srcbuf, len);
+	} while ((n < 0) && (errno == EINTR));
+	return(n);
 }
 
 
@@ -1340,14 +1340,14 @@ cbuf_put_mem (void *srcbuf, unsigned char **pdstbuf, int len)
 /*  Copies data from cbuf's [srcbuf] into the buffer pointed at by [pdstbuf].
  *  Returns the number of bytes copied.
  */
-    assert(srcbuf != NULL);
-    assert(pdstbuf != NULL);
-    assert(*pdstbuf != NULL);
-    assert(len > 0);
-
-    memcpy(*pdstbuf, srcbuf, len);
-    *pdstbuf += len;
-    return(len);
+	assert(srcbuf != NULL);
+	assert(pdstbuf != NULL);
+	assert(*pdstbuf != NULL);
+	assert(len > 0);
+
+	memcpy(*pdstbuf, srcbuf, len);
+	*pdstbuf += len;
+	return(len);
 }
 
 
@@ -1358,82 +1358,82 @@ cbuf_copier (cbuf_t src, cbuf_t dst, int len, int *ndropped)
  *  Returns the number of bytes copied, or -1 on error (with errno set).
  *  Sets [ndropped] (if not NULL) to the number of [dst] bytes overwritten.
  */
-    int ncopy, nfree, nleft, nrepl, n;
-    int i_src, i_dst;
-
-    assert(src != NULL);
-    assert(dst != NULL);
-    assert(len > 0);
-    assert(cbuf_mutex_is_locked(src));
-    assert(cbuf_mutex_is_locked(dst));
-
-    /*  Bound len by the number of bytes available.
-     */
-    len = MIN(len, src->used);
-    if (len == 0) {
-        return(0);
-    }
-    /*  Attempt to grow dst cbuf if necessary.
-     */
-    nfree = dst->size - dst->used;
-    if ((len > nfree) && (dst->size < dst->maxsize)) {
-        nfree += cbuf_grow(dst, len - nfree);
-    }
-    /*  Compute number of bytes to effectively copy to dst cbuf.
-     */
-    if (dst->overwrite == CBUF_NO_DROP) {
-        len = MIN(len, dst->size - dst->used);
-        if (len == 0) {
-            errno = ENOSPC;
-            return(-1);
-        }
-    }
-    else if (dst->overwrite == CBUF_WRAP_ONCE) {
-        len = MIN(len, dst->size);
-    }
-    /*  Compute number of bytes that will be overwritten in dst cbuf.
-     */
-    if (ndropped) {
-        *ndropped = MAX(0, len - dst->size + dst->used);
-    }
-    /*  Compute number of bytes to physically copy to dst cbuf.  This prevents
-     *    copying data that will overwritten if the cbuf wraps multiple times.
-     */
-    ncopy = len;
-    i_src = src->i_out;
-    i_dst = dst->i_in;
-    if (ncopy > dst->size) {
-        n = ncopy - dst->size;
-        i_src = (i_src + n) % (src->size + 1);
-        ncopy -= n;
-    }
-    /*  Copy data from src cbuf to dst cbuf.
-     */
-    nleft = ncopy;
-    while (nleft > 0) {
-        n = MIN(((src->size + 1) - i_src), ((dst->size + 1) - i_dst));
-        n = MIN(n, nleft);
-        memcpy(&dst->data[i_dst], &src->data[i_src], n);
-        i_src = (i_src + n) % (src->size + 1);
-        i_dst = (i_dst + n) % (dst->size + 1);
-        nleft -= n;
-    }
-    /*  Update dst cbuf metadata.
-     */
-    if (ncopy > 0) {
-        nrepl = (dst->i_out - dst->i_rep + (dst->size + 1)) % (dst->size + 1);
-        dst->used = MIN(dst->used + ncopy, dst->size);
-        assert(i_dst == (dst->i_in + ncopy) % (dst->size + 1));
-        dst->i_in = i_dst;
-        if (ncopy > nfree - nrepl) {
-            dst->got_wrap = 1;
-            dst->i_rep = (dst->i_in + 1) % (dst->size + 1);
-        }
-        if (ncopy > nfree) {
-            dst->i_out = dst->i_rep;
-        }
-    }
-    return(len);
+	int ncopy, nfree, nleft, nrepl, n;
+	int i_src, i_dst;
+
+	assert(src != NULL);
+	assert(dst != NULL);
+	assert(len > 0);
+	assert(cbuf_mutex_is_locked(src));
+	assert(cbuf_mutex_is_locked(dst));
+
+	/*  Bound len by the number of bytes available.
+	 */
+	len = MIN(len, src->used);
+	if (len == 0) {
+		return(0);
+	}
+	/*  Attempt to grow dst cbuf if necessary.
+	 */
+	nfree = dst->size - dst->used;
+	if ((len > nfree) && (dst->size < dst->maxsize)) {
+		nfree += cbuf_grow(dst, len - nfree);
+	}
+	/*  Compute number of bytes to effectively copy to dst cbuf.
+	 */
+	if (dst->overwrite == CBUF_NO_DROP) {
+		len = MIN(len, dst->size - dst->used);
+		if (len == 0) {
+			errno = ENOSPC;
+			return(-1);
+		}
+	}
+	else if (dst->overwrite == CBUF_WRAP_ONCE) {
+		len = MIN(len, dst->size);
+	}
+	/*  Compute number of bytes that will be overwritten in dst cbuf.
+	 */
+	if (ndropped) {
+		*ndropped = MAX(0, len - dst->size + dst->used);
+	}
+	/*  Compute number of bytes to physically copy to dst cbuf.  This prevents
+	 *    copying data that will overwritten if the cbuf wraps multiple times.
+	 */
+	ncopy = len;
+	i_src = src->i_out;
+	i_dst = dst->i_in;
+	if (ncopy > dst->size) {
+		n = ncopy - dst->size;
+		i_src = (i_src + n) % (src->size + 1);
+		ncopy -= n;
+	}
+	/*  Copy data from src cbuf to dst cbuf.
+	 */
+	nleft = ncopy;
+	while (nleft > 0) {
+		n = MIN(((src->size + 1) - i_src), ((dst->size + 1) - i_dst));
+		n = MIN(n, nleft);
+		memcpy(&dst->data[i_dst], &src->data[i_src], n);
+		i_src = (i_src + n) % (src->size + 1);
+		i_dst = (i_dst + n) % (dst->size + 1);
+		nleft -= n;
+	}
+	/*  Update dst cbuf metadata.
+	 */
+	if (ncopy > 0) {
+		nrepl = (dst->i_out - dst->i_rep + (dst->size + 1)) % (dst->size + 1);
+		dst->used = MIN(dst->used + ncopy, dst->size);
+		assert(i_dst == (dst->i_in + ncopy) % (dst->size + 1));
+		dst->i_in = i_dst;
+		if (ncopy > nfree - nrepl) {
+			dst->got_wrap = 1;
+			dst->i_rep = (dst->i_in + 1) % (dst->size + 1);
+		}
+		if (ncopy > nfree) {
+			dst->i_out = dst->i_rep;
+		}
+	}
+	return(len);
 }
 
 
@@ -1443,23 +1443,23 @@ cbuf_dropper (cbuf_t cb, int len)
 /*  Discards exactly [len] bytes of unread data from [cb].
  *  Returns the number of bytes dropped.
  */
-    assert(cb != NULL);
-    assert(len > 0);
-    assert(len <= cb->used);
-    assert(cbuf_mutex_is_locked(cb));
-
-    cb->used -= len;
-    cb->i_out = (cb->i_out + len) % (cb->size + 1);
-
-    /*  Attempt to shrink cbuf if possible.
-     */
-    if ((cb->size - cb->used > CBUF_CHUNK) && (cb->size > cb->minsize)) {
-        cbuf_shrink(cb);
-    }
-    /*  Don't call me clumsy, don't call me a fool.
-     *  When things fall down on me, I'm following the rule.
-     */
-    return(len);
+	assert(cb != NULL);
+	assert(len > 0);
+	assert(len <= cb->used);
+	assert(cbuf_mutex_is_locked(cb));
+
+	cb->used -= len;
+	cb->i_out = (cb->i_out + len) % (cb->size + 1);
+
+	/*  Attempt to shrink cbuf if possible.
+	 */
+	if ((cb->size - cb->used > CBUF_CHUNK) && (cb->size > cb->minsize)) {
+		cbuf_shrink(cb);
+	}
+	/*  Don't call me clumsy, don't call me a fool.
+	 *  When things fall down on me, I'm following the rule.
+	 */
+	return(len);
 }
 
 
@@ -1472,50 +1472,50 @@ cbuf_reader (cbuf_t src, int len, cbuf_iof putf, void *dst)
  *  Note that [dst] is a value-result parameter and will be "moved forward"
  *    by the number of bytes written into it.
  */
-    int nleft, n, m;
-    int i_src;
-
-    assert(src != NULL);
-    assert(len > 0);
-    assert(putf != NULL);
-    assert(dst != NULL);
-    assert(cbuf_mutex_is_locked(src));
-
-    /*  Bound len by the number of bytes available.
-     */
-    len = MIN(len, src->used);
-    if (len == 0) {
-        return(0);
-    }
-    /*  Copy data from src cbuf to dst obj.  Do the cbuf hokey-pokey and
-     *    wrap-around the buffer at most once.  Break out if putf() returns
-     *    either an ERR or a short count.
-     */
-    i_src = src->i_out;
-    nleft = len;
-    m = 0;
-    while (nleft > 0) {
-        n = MIN(nleft, (src->size + 1) - i_src);
-        m = putf(&src->data[i_src], dst, n);
-        if (m > 0) {
-            nleft -= m;
-            i_src = (i_src + m) % (src->size + 1);
-        }
-        if (n != m) {
-            break;                      /* got ERR or "short" putf() */
-        }
-    }
-    /*  Compute number of bytes written to dst obj.
-     */
-    n = len - nleft;
-    assert((n >= 0) && (n <= len));
-    /*
-     *  If no data has been written, return the ERR reported by putf().
-     */
-    if (n == 0) {
-        return(m);
-    }
-    return(n);
+	int nleft, n, m;
+	int i_src;
+
+	assert(src != NULL);
+	assert(len > 0);
+	assert(putf != NULL);
+	assert(dst != NULL);
+	assert(cbuf_mutex_is_locked(src));
+
+	/*  Bound len by the number of bytes available.
+	 */
+	len = MIN(len, src->used);
+	if (len == 0) {
+		return(0);
+	}
+	/*  Copy data from src cbuf to dst obj.  Do the cbuf hokey-pokey and
+	 *    wrap-around the buffer at most once.  Break out if putf() returns
+	 *    either an ERR or a short count.
+	 */
+	i_src = src->i_out;
+	nleft = len;
+	m = 0;
+	while (nleft > 0) {
+		n = MIN(nleft, (src->size + 1) - i_src);
+		m = putf(&src->data[i_src], dst, n);
+		if (m > 0) {
+			nleft -= m;
+			i_src = (i_src + m) % (src->size + 1);
+		}
+		if (n != m) {
+			break;                      /* got ERR or "short" putf() */
+		}
+	}
+	/*  Compute number of bytes written to dst obj.
+	 */
+	n = len - nleft;
+	assert((n >= 0) && (n <= len));
+	/*
+	 *  If no data has been written, return the ERR reported by putf().
+	 */
+	if (n == 0) {
+		return(m);
+	}
+	return(n);
 }
 
 
@@ -1528,51 +1528,51 @@ cbuf_replayer (cbuf_t src, int len, cbuf_iof putf, void *dst)
  *  Note that [dst] is a value-result parameter and will be "moved forward"
  *    by the number of bytes written into it.
  */
-    int nleft, n, m;
-    int i_src;
-
-    assert(src != NULL);
-    assert(len > 0);
-    assert(putf != NULL);
-    assert(dst != NULL);
-    assert(cbuf_mutex_is_locked(src));
-
-    /*  Bound len by the number of bytes available.
-     */
-    n = (src->i_out - src->i_rep + (src->size + 1)) % (src->size + 1);
-    len = MIN(len, n);
-    if (len == 0) {
-        return(0);
-    }
-    /*  Copy data from src cbuf to dst obj.  Do the cbuf hokey-pokey and
-     *    wrap-around the buffer at most once.  Break out if putf() returns
-     *    either an ERR or a short count.
-     */
-    i_src = (src->i_out - len + (src->size + 1)) % (src->size + 1);
-    nleft = len;
-    m = 0;
-    while (nleft > 0) {
-        n = MIN(nleft, (src->size + 1) - i_src);
-        m = putf(&src->data[i_src], dst, n);
-        if (m > 0) {
-            nleft -= m;
-            i_src = (i_src + m) % (src->size + 1);
-        }
-        if (n != m) {
-            break;                      /* got ERR or "short" putf() */
-        }
-    }
-    /*  Compute number of bytes written to dst obj.
-     */
-    n = len - nleft;
-    assert((n >= 0) && (n <= len));
-    /*
-     *  If no data has been written, return the ERR reported by putf().
-     */
-    if (n == 0) {
-        return(m);
-    }
-    return(n);
+	int nleft, n, m;
+	int i_src;
+
+	assert(src != NULL);
+	assert(len > 0);
+	assert(putf != NULL);
+	assert(dst != NULL);
+	assert(cbuf_mutex_is_locked(src));
+
+	/*  Bound len by the number of bytes available.
+	 */
+	n = (src->i_out - src->i_rep + (src->size + 1)) % (src->size + 1);
+	len = MIN(len, n);
+	if (len == 0) {
+		return(0);
+	}
+	/*  Copy data from src cbuf to dst obj.  Do the cbuf hokey-pokey and
+	 *    wrap-around the buffer at most once.  Break out if putf() returns
+	 *    either an ERR or a short count.
+	 */
+	i_src = (src->i_out - len + (src->size + 1)) % (src->size + 1);
+	nleft = len;
+	m = 0;
+	while (nleft > 0) {
+		n = MIN(nleft, (src->size + 1) - i_src);
+		m = putf(&src->data[i_src], dst, n);
+		if (m > 0) {
+			nleft -= m;
+			i_src = (i_src + m) % (src->size + 1);
+		}
+		if (n != m) {
+			break;                      /* got ERR or "short" putf() */
+		}
+	}
+	/*  Compute number of bytes written to dst obj.
+	 */
+	n = len - nleft;
+	assert((n >= 0) && (n <= len));
+	/*
+	 *  If no data has been written, return the ERR reported by putf().
+	 */
+	if (n == 0) {
+		return(m);
+	}
+	return(n);
 }
 
 
@@ -1586,80 +1586,80 @@ cbuf_writer (cbuf_t dst, int len, cbuf_iof getf, void *src, int *ndropped)
  *  Note that [src] is a value-result parameter and will be "moved forward"
  *    by the number of bytes read from it.
  */
-    int nfree, nleft, nrepl, n, m;
-    int i_dst;
-
-    assert(dst != NULL);
-    assert(len > 0);
-    assert(getf != NULL);
-    assert(src != NULL);
-    assert(cbuf_mutex_is_locked(dst));
-
-    /*  Attempt to grow dst cbuf if necessary.
-     */
-    nfree = dst->size - dst->used;
-    if ((len > nfree) && (dst->size < dst->maxsize)) {
-        nfree += cbuf_grow(dst, len - nfree);
-    }
-    /*  Compute number of bytes to write to dst cbuf.
-     */
-    if (dst->overwrite == CBUF_NO_DROP) {
-        len = MIN(len, dst->size - dst->used);
-        if (len == 0) {
-            errno = ENOSPC;
-            return(-1);
-        }
-    }
-    else if (dst->overwrite == CBUF_WRAP_ONCE) {
-        len = MIN(len, dst->size);
-    }
-    /*  Copy data from src obj to dst cbuf.  Do the cbuf hokey-pokey and
-     *    wrap-around the buffer as needed.  Break out if getf() returns
-     *    either an EOF/ERR or a short count.
-     */
-    i_dst = dst->i_in;
-    nleft = len;
-    m = 0;
-    while (nleft > 0) {
-        n = MIN(nleft, (dst->size + 1) - i_dst);
-        m = getf(&dst->data[i_dst], src, n);
-        if (m > 0) {
-            nleft -= m;
-            i_dst = (i_dst + m) % (dst->size + 1);
-        }
-        if (n != m) {
-            break;                      /* got EOF/ERR or "short" getf() */
-        }
-    }
-    /*  Compute number of bytes written to dst cbuf.
-     */
-    n = len - nleft;
-    assert((n >= 0) && (n <= len));
-    /*
-     *  If no data has been written, return the EOF/ERR reported by getf().
-     */
-    if (n == 0) {
-        return(m);
-    }
-    /*  Update dst cbuf metadata.
-     */
-    if (n > 0) {
-        nrepl = (dst->i_out - dst->i_rep + (dst->size + 1)) % (dst->size + 1);
-        dst->used = MIN(dst->used + n, dst->size);
-        assert(i_dst == (dst->i_in + n) % (dst->size + 1));
-        dst->i_in = i_dst;
-        if (n > nfree - nrepl) {
-            dst->got_wrap = 1;
-            dst->i_rep = (dst->i_in + 1) % (dst->size + 1);
-        }
-        if (n > nfree) {
-            dst->i_out = dst->i_rep;
-        }
-    }
-    if (ndropped) {
-        *ndropped = MAX(0, n - nfree);
-    }
-    return(n);
+	int nfree, nleft, nrepl, n, m;
+	int i_dst;
+
+	assert(dst != NULL);
+	assert(len > 0);
+	assert(getf != NULL);
+	assert(src != NULL);
+	assert(cbuf_mutex_is_locked(dst));
+
+	/*  Attempt to grow dst cbuf if necessary.
+	 */
+	nfree = dst->size - dst->used;
+	if ((len > nfree) && (dst->size < dst->maxsize)) {
+		nfree += cbuf_grow(dst, len - nfree);
+	}
+	/*  Compute number of bytes to write to dst cbuf.
+	 */
+	if (dst->overwrite == CBUF_NO_DROP) {
+		len = MIN(len, dst->size - dst->used);
+		if (len == 0) {
+			errno = ENOSPC;
+			return(-1);
+		}
+	}
+	else if (dst->overwrite == CBUF_WRAP_ONCE) {
+		len = MIN(len, dst->size);
+	}
+	/*  Copy data from src obj to dst cbuf.  Do the cbuf hokey-pokey and
+	 *    wrap-around the buffer as needed.  Break out if getf() returns
+	 *    either an EOF/ERR or a short count.
+	 */
+	i_dst = dst->i_in;
+	nleft = len;
+	m = 0;
+	while (nleft > 0) {
+		n = MIN(nleft, (dst->size + 1) - i_dst);
+		m = getf(&dst->data[i_dst], src, n);
+		if (m > 0) {
+			nleft -= m;
+			i_dst = (i_dst + m) % (dst->size + 1);
+		}
+		if (n != m) {
+			break;                      /* got EOF/ERR or "short" getf() */
+		}
+	}
+	/*  Compute number of bytes written to dst cbuf.
+	 */
+	n = len - nleft;
+	assert((n >= 0) && (n <= len));
+	/*
+	 *  If no data has been written, return the EOF/ERR reported by getf().
+	 */
+	if (n == 0) {
+		return(m);
+	}
+	/*  Update dst cbuf metadata.
+	 */
+	if (n > 0) {
+		nrepl = (dst->i_out - dst->i_rep + (dst->size + 1)) % (dst->size + 1);
+		dst->used = MIN(dst->used + n, dst->size);
+		assert(i_dst == (dst->i_in + n) % (dst->size + 1));
+		dst->i_in = i_dst;
+		if (n > nfree - nrepl) {
+			dst->got_wrap = 1;
+			dst->i_rep = (dst->i_in + 1) % (dst->size + 1);
+		}
+		if (n > nfree) {
+			dst->i_out = dst->i_rep;
+		}
+	}
+	if (ndropped) {
+		*ndropped = MAX(0, n - nfree);
+	}
+	return(n);
 }
 
 
@@ -1670,71 +1670,71 @@ cbuf_grow (cbuf_t cb, int n)
  *  Returns the number of bytes by which the buffer has grown (which may be
  *    less-than, equal-to, or greater-than the number of bytes requested).
  */
-    unsigned char *data;
-    int size_old, size_meta;
-    int m;
-
-    assert(cb != NULL);
-    assert(n > 0);
-    assert(cbuf_mutex_is_locked(cb));
-
-    if (cb->size == cb->maxsize) {
-        return(0);
-    }
-    size_old = cb->size;
-    size_meta = cb->alloc - cb->size;   /* size of sentinel & magic cookies */
-    assert(size_meta > 0);
-
-    /*  Attempt to grow data buffer by multiples of the chunk-size.
-     */
-    m = cb->alloc + n;
-    m = m + (CBUF_CHUNK - (m % CBUF_CHUNK));
-    m = MIN(m, (cb->maxsize + size_meta));
-    assert(m > cb->alloc);
-
-    data = cb->data;
+	unsigned char *data;
+	int size_old, size_meta;
+	int m;
+
+	assert(cb != NULL);
+	assert(n > 0);
+	assert(cbuf_mutex_is_locked(cb));
+
+	if (cb->size == cb->maxsize) {
+		return(0);
+	}
+	size_old = cb->size;
+	size_meta = cb->alloc - cb->size;   /* size of sentinel & magic cookies */
+	assert(size_meta > 0);
+
+	/*  Attempt to grow data buffer by multiples of the chunk-size.
+	 */
+	m = cb->alloc + n;
+	m = m + (CBUF_CHUNK - (m % CBUF_CHUNK));
+	m = MIN(m, (cb->maxsize + size_meta));
+	assert(m > cb->alloc);
+
+	data = cb->data;
 #ifndef NDEBUG
-    data -= CBUF_MAGIC_LEN;             /* jump back to what malloc returned */
+	data -= CBUF_MAGIC_LEN;             /* jump back to what malloc returned */
 #endif /* !NDEBUG */
 
-    if (!(data = realloc(data, m))) {
-        /*
-         *  XXX: Set flag or somesuch to prevent regrowing when out of memory?
-         */
-        return(0);                      /* unable to grow data buffer */
-    }
-    cb->data = data;
-    cb->alloc = m;
-    cb->size = m - size_meta;
+	if (!(data = realloc(data, m))) {
+		/*
+		 *  XXX: Set flag or somesuch to prevent regrowing when out of memory?
+		 */
+		return(0);                      /* unable to grow data buffer */
+	}
+	cb->data = data;
+	cb->alloc = m;
+	cb->size = m - size_meta;
 
 #ifndef NDEBUG
-    /*  A round cookie with one bite out of it looks like a C.
-     *  The underflow cookie will have been copied by realloc() if needed.
-     *    But the overflow cookie must be rebaked.
-     *  Must use memcpy since overflow cookie may not be word-aligned.
-     */
-    cb->data += CBUF_MAGIC_LEN;         /* jump forward past underflow magic */
-    memcpy(cb->data + cb->size + 1, (void *) &cb->magic, CBUF_MAGIC_LEN);
+	/*  A round cookie with one bite out of it looks like a C.
+	 *  The underflow cookie will have been copied by realloc() if needed.
+	 *    But the overflow cookie must be rebaked.
+	 *  Must use memcpy since overflow cookie may not be word-aligned.
+	 */
+	cb->data += CBUF_MAGIC_LEN;         /* jump forward past underflow magic */
+	memcpy(cb->data + cb->size + 1, (void *) &cb->magic, CBUF_MAGIC_LEN);
 #endif /* !NDEBUG */
 
-    /*  The memory containing replay and unread data must be contiguous modulo
-     *    the buffer size.  Additional memory must be inserted between where
-     *    new data is written in (i_in) and where replay data starts (i_rep).
-     *  If replay data wraps-around the old buffer, move it to the new end
-     *    of the buffer so it wraps-around in the same manner.
-     */
-    if (cb->i_rep > cb->i_in) {
-        n = (size_old + 1) - cb->i_rep;
-        m = (cb->size + 1) - n;
-        memmove(cb->data + m, cb->data + cb->i_rep, n);
-
-        if (cb->i_out >= cb->i_rep) {
-            cb->i_out += m - cb->i_rep;
-        }
-        cb->i_rep = m;
-    }
-    assert(cbuf_is_valid(cb));
-    return(cb->size - size_old);
+	/*  The memory containing replay and unread data must be contiguous modulo
+	 *    the buffer size.  Additional memory must be inserted between where
+	 *    new data is written in (i_in) and where replay data starts (i_rep).
+	 *  If replay data wraps-around the old buffer, move it to the new end
+	 *    of the buffer so it wraps-around in the same manner.
+	 */
+	if (cb->i_rep > cb->i_in) {
+		n = (size_old + 1) - cb->i_rep;
+		m = (cb->size + 1) - n;
+		memmove(cb->data + m, cb->data + cb->i_rep, n);
+
+		if (cb->i_out >= cb->i_rep) {
+			cb->i_out += m - cb->i_rep;
+		}
+		cb->i_rep = m;
+	}
+	assert(cbuf_is_valid(cb));
+	return(cb->size - size_old);
 }
 
 
@@ -1743,20 +1743,20 @@ cbuf_shrink (cbuf_t cb)
 {
 /*  XXX: DOCUMENT ME.
  */
-    assert(cb != NULL);
-    assert(cbuf_mutex_is_locked(cb));
-    assert(cbuf_is_valid(cb));
-
-    if (cb->size == cb->minsize) {
-        return(0);
-    }
-    if (cb->size - cb->used <= CBUF_CHUNK) {
-        return(0);
-    }
-    /*  FIXME: NOT IMPLEMENTED.
-     */
-    assert(cbuf_is_valid(cb));
-    return(0);
+	assert(cb != NULL);
+	assert(cbuf_mutex_is_locked(cb));
+	assert(cbuf_is_valid(cb));
+
+	if (cb->size == cb->minsize) {
+		return(0);
+	}
+	if (cb->size - cb->used <= CBUF_CHUNK) {
+		return(0);
+	}
+	/*  FIXME: NOT IMPLEMENTED.
+	 */
+	assert(cbuf_is_valid(cb));
+	return(0);
 }
 
 
@@ -1767,11 +1767,11 @@ cbuf_mutex_is_locked (cbuf_t cb)
 {
 /*  Returns true if the mutex is locked; o/w, returns false.
  */
-    int rc;
+	int rc;
 
-    assert(cb != NULL);
-    rc = pthread_mutex_trylock(&cb->mutex);
-    return(rc == EBUSY ? 1 : 0);
+	assert(cb != NULL);
+	rc = pthread_mutex_trylock(&cb->mutex);
+	return(rc == EBUSY ? 1 : 0);
 }
 #endif /* WITH_PTHREADS */
 #endif /* !NDEBUG */
@@ -1784,49 +1784,49 @@ cbuf_is_valid (cbuf_t cb)
 /*  Validates the data structure.  All invariants should be tested here.
  *  Returns true if everything is valid; o/w, aborts due to assertion failure.
  */
-    int nfree;
-
-    assert(cb != NULL);
-    assert(cbuf_mutex_is_locked(cb));
-    assert(cb->data != NULL);
-    assert(cb->magic == CBUF_MAGIC);
-    /*
-     *  Must use memcmp since overflow cookie may not be word-aligned.
-     */
-    assert(memcmp(cb->data - CBUF_MAGIC_LEN,
-        (void *) &cb->magic, CBUF_MAGIC_LEN) == 0);
-    assert(memcmp(cb->data + cb->size + 1,
-        (void *) &cb->magic, CBUF_MAGIC_LEN) == 0);
-
-    assert(cb->alloc > 0);
-    assert(cb->alloc > cb->size);
-    assert(cb->size > 0);
-    assert(cb->size >= cb->minsize);
-    assert(cb->size <= cb->maxsize);
-    assert(cb->minsize > 0);
-    assert(cb->maxsize > 0);
-    assert(cb->used >= 0);
-    assert(cb->used <= cb->size);
-    assert(cb->overwrite == CBUF_NO_DROP
-        || cb->overwrite == CBUF_WRAP_ONCE
-        || cb->overwrite == CBUF_WRAP_MANY);
-    assert(cb->got_wrap || !cb->i_rep); /* i_rep = 0 if data has not wrapped */
-    assert(cb->i_in >= 0);
-    assert(cb->i_in <= cb->size);
-    assert(cb->i_out >= 0);
-    assert(cb->i_out <= cb->size);
-    assert(cb->i_rep >= 0);
-    assert(cb->i_rep <= cb->size);
-
-    if (cb->i_in >= cb->i_out) {
-        assert((cb->i_rep > cb->i_in) || (cb->i_rep <= cb->i_out));
-    }
-    else /* if (cb->in < cb->i_out) */ {
-        assert((cb->i_rep > cb->i_in) && (cb->i_rep <= cb->i_out));
-    }
-    nfree = (cb->i_out - cb->i_in - 1 + (cb->size + 1)) % (cb->size + 1);
-    assert(cb->size - cb->used == nfree);
-
-    return(1);
+	int nfree;
+
+	assert(cb != NULL);
+	assert(cbuf_mutex_is_locked(cb));
+	assert(cb->data != NULL);
+	assert(cb->magic == CBUF_MAGIC);
+	/*
+	 *  Must use memcmp since overflow cookie may not be word-aligned.
+	 */
+	assert(memcmp(cb->data - CBUF_MAGIC_LEN,
+		      (void *) &cb->magic, CBUF_MAGIC_LEN) == 0);
+	assert(memcmp(cb->data + cb->size + 1,
+		      (void *) &cb->magic, CBUF_MAGIC_LEN) == 0);
+
+	assert(cb->alloc > 0);
+	assert(cb->alloc > cb->size);
+	assert(cb->size > 0);
+	assert(cb->size >= cb->minsize);
+	assert(cb->size <= cb->maxsize);
+	assert(cb->minsize > 0);
+	assert(cb->maxsize > 0);
+	assert(cb->used >= 0);
+	assert(cb->used <= cb->size);
+	assert(cb->overwrite == CBUF_NO_DROP
+	       || cb->overwrite == CBUF_WRAP_ONCE
+	       || cb->overwrite == CBUF_WRAP_MANY);
+	assert(cb->got_wrap || !cb->i_rep); /* i_rep = 0 if data has not wrapped */
+	assert(cb->i_in >= 0);
+	assert(cb->i_in <= cb->size);
+	assert(cb->i_out >= 0);
+	assert(cb->i_out <= cb->size);
+	assert(cb->i_rep >= 0);
+	assert(cb->i_rep <= cb->size);
+
+	if (cb->i_in >= cb->i_out) {
+		assert((cb->i_rep > cb->i_in) || (cb->i_rep <= cb->i_out));
+	}
+	else /* if (cb->in < cb->i_out) */ {
+		assert((cb->i_rep > cb->i_in) && (cb->i_rep <= cb->i_out));
+	}
+	nfree = (cb->i_out - cb->i_in - 1 + (cb->size + 1)) % (cb->size + 1);
+	assert(cb->size - cb->used == nfree);
+
+	return(1);
 }
 #endif /* !NDEBUG */
diff --git a/src/common/checkpoint.c b/src/common/checkpoint.c
index a7c855df1a8..8751148e307 100644
--- a/src/common/checkpoint.c
+++ b/src/common/checkpoint.c
@@ -65,8 +65,10 @@ typedef struct slurm_checkpoint_ops {
 			    uint32_t *error_code, char **error_msg);
 	int	(*ckpt_comp) (struct step_record * step_ptr, time_t event_time,
 			      uint32_t error_code, char *error_msg);
-	int	(*ckpt_task_comp) (struct step_record * step_ptr, uint32_t task_id,
-				   time_t event_time, uint32_t error_code, char *error_msg);
+	int	(*ckpt_task_comp) (struct step_record * step_ptr, 
+				   uint32_t task_id,
+				   time_t event_time, uint32_t error_code,
+				   char *error_msg);
 
 	int	(*ckpt_alloc_jobinfo) (check_jobinfo_t *jobinfo);
 	int	(*ckpt_free_jobinfo) (check_jobinfo_t jobinfo);
@@ -132,7 +134,7 @@ _slurm_checkpoint_context_destroy( slurm_checkpoint_context_t c )
 	 */
 	if ( c->plugin_list ) {
 		if ( plugrack_destroy( c->plugin_list ) != SLURM_SUCCESS ) {
-			 rc = SLURM_ERROR;
+			rc = SLURM_ERROR;
 		}
 	} else {
 		plugin_unload(c->cur_plugin);
@@ -242,7 +244,7 @@ checkpoint_init(char *checkpoint_type)
 	}
 	verbose("Checkpoint plugin loaded: %s", checkpoint_type);
 
-  done:
+done:
 	slurm_mutex_unlock( &context_lock );
 	return retval;
 }
@@ -274,10 +276,11 @@ checkpoint_op(uint32_t job_id, uint32_t step_id,
 
 	slurm_mutex_lock( &context_lock );
 	if ( g_context ) {
-		retval = (*(g_context->ops.ckpt_op))(job_id, step_id, 
-					(struct step_record *) step_ptr,
-					op, data, image_dir, 
-					event_time, error_code, error_msg);
+		retval = (*(g_context->ops.ckpt_op))(
+			job_id, step_id, 
+			(struct step_record *) step_ptr,
+			op, data, image_dir, 
+			event_time, error_code, error_msg);
 	} else {
 		error ("slurm_checkpoint plugin context not initialized");
 		retval = ENOENT;
@@ -332,7 +335,7 @@ extern int checkpoint_alloc_jobinfo(check_jobinfo_t *jobinfo)
 	slurm_mutex_lock( &context_lock );
 	if ( g_context )
 		retval = (*(g_context->ops.ckpt_alloc_jobinfo))(
-				jobinfo);
+			jobinfo);
 	else {
 		error ("slurm_checkpoint plugin context not initialized");
 		retval = ENOENT;
@@ -349,7 +352,7 @@ extern int checkpoint_free_jobinfo(check_jobinfo_t jobinfo)
 	slurm_mutex_lock( &context_lock );
 	if ( g_context )
 		retval = (*(g_context->ops.ckpt_free_jobinfo))(
-				jobinfo);
+			jobinfo);
 	else {
 		error ("slurm_checkpoint plugin context not initialized");
 		retval = ENOENT;
@@ -366,7 +369,7 @@ extern int  checkpoint_pack_jobinfo  (check_jobinfo_t jobinfo, Buf buffer)
 	slurm_mutex_lock( &context_lock );
 	if ( g_context )
 		retval = (*(g_context->ops.ckpt_pack_jobinfo))(
-				jobinfo, buffer);
+			jobinfo, buffer);
 	else {
 		error ("slurm_checkpoint plugin context not initialized");
 		retval = ENOENT;
@@ -382,7 +385,7 @@ extern int  checkpoint_unpack_jobinfo  (check_jobinfo_t jobinfo, Buf buffer)
 	slurm_mutex_lock( &context_lock );
 	if ( g_context )
 		retval = (*(g_context->ops.ckpt_unpack_jobinfo))(
-				jobinfo, buffer);
+			jobinfo, buffer);
 	else {
 		error ("slurm_checkpoint plugin context not initialized");
 		retval = ENOENT;
@@ -451,7 +454,7 @@ extern int checkpoint_tasks (uint32_t job_id, uint32_t step_id,
 	slurm_msg_t_init(&req_msg);
 	ckpt_req.job_id		= job_id;
 	ckpt_req.job_step_id 	= step_id;
-	ckpt_req.timestamp	= begin_time,
+	ckpt_req.timestamp	= begin_time;
 	ckpt_req.image_dir	= image_dir;
 	req_msg.msg_type	= REQUEST_CHECKPOINT_TASKS;
 	req_msg.data		= &ckpt_req;
diff --git a/src/common/fd.c b/src/common/fd.c
index 681b35a8322..7f77486ccf2 100644
--- a/src/common/fd.c
+++ b/src/common/fd.c
@@ -67,212 +67,212 @@ static pid_t fd_test_lock(int fd, int type);
 
 void fd_set_close_on_exec(int fd)
 {
-    assert(fd >= 0);
+	assert(fd >= 0);
 
-    if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0)
-        error("fcntl(F_SETFD) failed: %m");
-    return;
+	if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0)
+		error("fcntl(F_SETFD) failed: %m");
+	return;
 }
 
 void fd_set_noclose_on_exec(int fd)
 {
-    assert(fd >= 0);
+	assert(fd >= 0);
 
-    if (fcntl(fd, F_SETFD, 0) < 0)
-        error("fcntl(F_SETFD) failed: %m");
-    return;
+	if (fcntl(fd, F_SETFD, 0) < 0)
+		error("fcntl(F_SETFD) failed: %m");
+	return;
 }
 
 int fd_is_blocking(int fd)
 {
-    int val = 0;
+	int val = 0;
 
-    assert(fd >= 0);
+	assert(fd >= 0);
 
-    if ((val = fcntl(fd, F_GETFL, 0)) < 0)
-	error("fnctl(F_GET_FL) failed: %m");
-    return (val & O_NONBLOCK) ? 0 : 1;
+	if ((val = fcntl(fd, F_GETFL, 0)) < 0)
+		error("fnctl(F_GET_FL) failed: %m");
+	return (val & O_NONBLOCK) ? 0 : 1;
 }
 
 void fd_set_nonblocking(int fd)
 {
-    int fval;
+	int fval;
 
-    assert(fd >= 0);
+	assert(fd >= 0);
 
-    if ((fval = fcntl(fd, F_GETFL, 0)) < 0)
-        error("fcntl(F_GETFL) failed: %m");
-    if (fcntl(fd, F_SETFL, fval | O_NONBLOCK) < 0)
-        error("fcntl(F_SETFL) failed: %m");
-    return;
+	if ((fval = fcntl(fd, F_GETFL, 0)) < 0)
+		error("fcntl(F_GETFL) failed: %m");
+	if (fcntl(fd, F_SETFL, fval | O_NONBLOCK) < 0)
+		error("fcntl(F_SETFL) failed: %m");
+	return;
 }
 
 void fd_set_blocking(int fd)
 {
-    int fval;
+	int fval;
 
-    assert(fd >= 0);
+	assert(fd >= 0);
 
-    if ((fval = fcntl(fd, F_GETFL, 0)) < 0)
-	    error("fcntl(F_GETFL) failed: %m");
-    if (fcntl(fd, F_SETFL, fval & ~O_NONBLOCK) < 0)
-	    error("fcntl(F_SETFL) failed: %m");
-    return;
+	if ((fval = fcntl(fd, F_GETFL, 0)) < 0)
+		error("fcntl(F_GETFL) failed: %m");
+	if (fcntl(fd, F_SETFL, fval & ~O_NONBLOCK) < 0)
+		error("fcntl(F_SETFL) failed: %m");
+	return;
 }
 
 
 int fd_get_read_lock(int fd)
 {
-    return(fd_get_lock(fd, F_SETLK, F_RDLCK));
+	return(fd_get_lock(fd, F_SETLK, F_RDLCK));
 }
 
 
 int fd_get_readw_lock(int fd)
 {
-    return(fd_get_lock(fd, F_SETLKW, F_RDLCK));
+	return(fd_get_lock(fd, F_SETLKW, F_RDLCK));
 }
 
 
 int fd_get_write_lock(int fd)
 {
-    return(fd_get_lock(fd, F_SETLK, F_WRLCK));
+	return(fd_get_lock(fd, F_SETLK, F_WRLCK));
 }
 
 
 int fd_get_writew_lock(int fd)
 {
-    return(fd_get_lock(fd, F_SETLKW, F_WRLCK));
+	return(fd_get_lock(fd, F_SETLKW, F_WRLCK));
 }
 
 
 int fd_release_lock(int fd)
 {
-    return(fd_get_lock(fd, F_SETLK, F_UNLCK));
+	return(fd_get_lock(fd, F_SETLK, F_UNLCK));
 }
 
 
 pid_t fd_is_read_lock_blocked(int fd)
 {
-    return(fd_test_lock(fd, F_RDLCK));
+	return(fd_test_lock(fd, F_RDLCK));
 }
 
 
 pid_t fd_is_write_lock_blocked(int fd)
 {
-    return(fd_test_lock(fd, F_WRLCK));
+	return(fd_test_lock(fd, F_WRLCK));
 }
 
 
 static int fd_get_lock(int fd, int cmd, int type)
 {
-    struct flock lock;
+	struct flock lock;
 
-    assert(fd >= 0);
+	assert(fd >= 0);
 
-    lock.l_type = type;
-    lock.l_start = 0;
-    lock.l_whence = SEEK_SET;
-    lock.l_len = 0;
+	lock.l_type = type;
+	lock.l_start = 0;
+	lock.l_whence = SEEK_SET;
+	lock.l_len = 0;
 
-    return(fcntl(fd, cmd, &lock));
+	return(fcntl(fd, cmd, &lock));
 }
 
 
 static pid_t fd_test_lock(int fd, int type)
 {
-    struct flock lock;
+	struct flock lock;
 
-    assert(fd >= 0);
+	assert(fd >= 0);
 
-    lock.l_type = type;
-    lock.l_start = 0;
-    lock.l_whence = SEEK_SET;
-    lock.l_len = 0;
-    lock.l_pid = 0;	/* avoid valgrind error */
+	lock.l_type = type;
+	lock.l_start = 0;
+	lock.l_whence = SEEK_SET;
+	lock.l_len = 0;
+	lock.l_pid = 0;	/* avoid valgrind error */
 
-    if (fcntl(fd, F_GETLK, &lock) < 0)
-        error("Unable to test for file lock: %m");
-    if (lock.l_type == F_UNLCK)
-        return(0);
-    return(lock.l_pid);
+	if (fcntl(fd, F_GETLK, &lock) < 0)
+		error("Unable to test for file lock: %m");
+	if (lock.l_type == F_UNLCK)
+		return(0);
+	return(lock.l_pid);
 }
 
 
 ssize_t fd_read_n(int fd, void *buf, size_t n)
 {
-    size_t nleft;
-    ssize_t nread;
-    unsigned char *p;
-
-    p = buf;
-    nleft = n;
-    while (nleft > 0) {
-        if ((nread = read(fd, p, nleft)) < 0) {
-            if (errno == EINTR)
-                continue;
-            else
-                return(-1);
-        }
-        else if (nread == 0) {          /* EOF */
-            break;
-        }
-        nleft -= nread;
-        p += nread;
-    }
-    return(n - nleft);
+	size_t nleft;
+	ssize_t nread;
+	unsigned char *p;
+
+	p = buf;
+	nleft = n;
+	while (nleft > 0) {
+		if ((nread = read(fd, p, nleft)) < 0) {
+			if (errno == EINTR)
+				continue;
+			else
+				return(-1);
+		}
+		else if (nread == 0) {          /* EOF */
+			break;
+		}
+		nleft -= nread;
+		p += nread;
+	}
+	return(n - nleft);
 }
 
 
 ssize_t fd_write_n(int fd, void *buf, size_t n)
 {
-    size_t nleft;
-    ssize_t nwritten;
-    unsigned char *p;
-
-    p = buf;
-    nleft = n;
-    while (nleft > 0) {
-        if ((nwritten = write(fd, p, nleft)) < 0) {
-            if (errno == EINTR)
-                continue;
-            else
-                return(-1);
-        }
-        nleft -= nwritten;
-        p += nwritten;
-    }
-    return(n);
+	size_t nleft;
+	ssize_t nwritten;
+	unsigned char *p;
+
+	p = buf;
+	nleft = n;
+	while (nleft > 0) {
+		if ((nwritten = write(fd, p, nleft)) < 0) {
+			if (errno == EINTR)
+				continue;
+			else
+				return(-1);
+		}
+		nleft -= nwritten;
+		p += nwritten;
+	}
+	return(n);
 }
 
 
 ssize_t fd_read_line(int fd, void *buf, size_t maxlen)
 {
-    ssize_t n, rc;
-    unsigned char c, *p;
-
-    n = 0;
-    p = buf;
-    while (n < maxlen - 1) {            /* reserve space for NUL-termination */
-
-        if ((rc = read(fd, &c, 1)) == 1) {
-            n++;
-            *p++ = c;
-            if (c == '\n')
-                break;                  /* store newline, like fgets() */
-        }
-        else if (rc == 0) {
-            if (n == 0)                 /* EOF, no data read */
-                return(0);
-            else                        /* EOF, some data read */
-                break;
-        }
-        else {
-            if (errno == EINTR)
-                continue;
-            return(-1);
-        }
-    }
-
-    *p = '\0';                          /* NUL-terminate, like fgets() */
-    return(n);
+	ssize_t n, rc;
+	unsigned char c, *p;
+
+	n = 0;
+	p = buf;
+	while (n < maxlen - 1) {            /* reserve space for NUL-termination */
+
+		if ((rc = read(fd, &c, 1)) == 1) {
+			n++;
+			*p++ = c;
+			if (c == '\n')
+				break;                  /* store newline, like fgets() */
+		}
+		else if (rc == 0) {
+			if (n == 0)                 /* EOF, no data read */
+				return(0);
+			else                        /* EOF, some data read */
+				break;
+		}
+		else {
+			if (errno == EINTR)
+				continue;
+			return(-1);
+		}
+	}
+
+	*p = '\0';                          /* NUL-terminate, like fgets() */
+	return(n);
 }
diff --git a/src/common/hostlist.c b/src/common/hostlist.c
index d7583ceffc3..0009dde0a80 100644
--- a/src/common/hostlist.c
+++ b/src/common/hostlist.c
@@ -122,14 +122,14 @@ strong_alias(hostset_nth,		slurm_hostset_nth);
  */
 #ifdef WITH_LSD_FATAL_ERROR_FUNC
 #  undef lsd_fatal_error
-   extern void lsd_fatal_error(char *file, int line, char *mesg);
+extern void lsd_fatal_error(char *file, int line, char *mesg);
 #else /* !WITH_LSD_FATAL_ERROR_FUNC */
 #  ifndef lsd_fatal_error
-#    define lsd_fatal_error(file, line, mesg)                                \
-       do {                                                                  \
-           fprintf(stderr, "ERROR: [%s:%d] %s: %s\n",                        \
-           file, line, mesg, strerror(errno));                               \
-       } while (0)
+#    define lsd_fatal_error(file, line, mesg)			\
+	do {							\
+		fprintf(stderr, "ERROR: [%s:%d] %s: %s\n",	\
+			file, line, mesg, strerror(errno));	\
+	} while (0)
 #  endif /* !lsd_fatal_error */
 #endif /* !WITH_LSD_FATAL_ERROR_FUNC */
 
@@ -138,7 +138,7 @@ strong_alias(hostset_nth,		slurm_hostset_nth);
  */
 #ifdef WITH_LSD_NOMEM_ERROR_FUNC
 #  undef lsd_nomem_error
-   extern void * lsd_nomem_error(char *file, int line, char *mesg);
+extern void * lsd_nomem_error(char *file, int line, char *mesg);
 #else /* !WITH_LSD_NOMEM_ERROR_FUNC */
 #  ifndef lsd_nomem_error
 #    define lsd_nomem_error(file, line, mesg) (NULL)
@@ -150,12 +150,12 @@ strong_alias(hostset_nth,		slurm_hostset_nth);
  *  Automatically call lsd_nomem_error with appropriate args
  *  and set errno to ENOMEM
  */
-#define out_of_memory(mesg)                                                  \
-    do {                                                                     \
-        fatal("malloc failure");                                             \
-        errno = ENOMEM;                                                      \
-        return(lsd_nomem_error(__FILE__, __LINE__, mesg));                   \
-    } while (0)
+#define out_of_memory(mesg)						\
+	do {								\
+		fatal("malloc failure");				\
+		errno = ENOMEM;						\
+		return(lsd_nomem_error(__FILE__, __LINE__, mesg));	\
+	} while (0)
 
 /* 
  * Some constants and tunables:
@@ -180,30 +180,30 @@ strong_alias(hostset_nth,		slurm_hostset_nth);
 
 /* hostname type: A convenience structure used in parsing single hostnames */
 struct hostname_components {
-    char *hostname;         /* cache of initialized hostname        */
-    char *prefix;           /* hostname prefix                      */
-    unsigned long num;      /* numeric suffix                       */
+	char *hostname;         /* cache of initialized hostname        */
+	char *prefix;           /* hostname prefix                      */
+	unsigned long num;      /* numeric suffix                       */
 
-    /* string representation of numeric suffix
-     * points into `hostname'                                       */
-    char *suffix;
+	/* string representation of numeric suffix
+	 * points into `hostname'                                       */
+	char *suffix;
 };
 
 typedef struct hostname_components *hostname_t;
 
 /* hostrange type: A single prefix with `hi' and `lo' numeric suffix values */
 struct hostrange_components {
-    char *prefix;        /* alphanumeric prefix: */
+	char *prefix;        /* alphanumeric prefix: */
 
-    /* beginning (lo) and end (hi) of suffix range */
-    unsigned long lo, hi;
+	/* beginning (lo) and end (hi) of suffix range */
+	unsigned long lo, hi;
 
-    /* width of numeric output format
-     * (pad with zeros up to this width) */
-    int width;
+	/* width of numeric output format
+	 * (pad with zeros up to this width) */
+	int width;
 
-    /* If singlehost is 1, `lo' and `hi' are invalid */
-    unsigned singlehost:1;
+	/* If singlehost is 1, `lo' and `hi' are invalid */
+	unsigned singlehost:1;
 };
 
 typedef struct hostrange_components *hostrange_t;
@@ -212,53 +212,53 @@ typedef struct hostrange_components *hostrange_t;
 struct hostlist {
 #ifndef NDEBUG
 #define HOSTLIST_MAGIC    57005
-    int magic;
+	int magic;
 #endif
 #if    WITH_PTHREADS
-    pthread_mutex_t mutex;
+	pthread_mutex_t mutex;
 #endif                /* WITH_PTHREADS */
 
-    /* current number of elements available in array */
-    int size;
+	/* current number of elements available in array */
+	int size;
 
-    /* current number of ranges stored in array */
-    int nranges;
+	/* current number of ranges stored in array */
+	int nranges;
 
-    /* current number of hosts stored in hostlist */
-    int nhosts;
+	/* current number of hosts stored in hostlist */
+	int nhosts;
 
-    /* pointer to hostrange array */
-    hostrange_t *hr;
+	/* pointer to hostrange array */
+	hostrange_t *hr;
 
-    /* list of iterators */
-    struct hostlist_iterator *ilist;
+	/* list of iterators */
+	struct hostlist_iterator *ilist;
 
 };
 
 
 /* a hostset is a wrapper around a hostlist */
 struct hostset {
-    hostlist_t hl;
+	hostlist_t hl;
 };
 
 struct hostlist_iterator {
 #ifndef NDEBUG
-    int magic;
+	int magic;
 #endif
-    /* hostlist we are traversing */
-    hostlist_t hl;
+	/* hostlist we are traversing */
+	hostlist_t hl;
 
-    /* current index of iterator in hl->hr[] */
-    int idx;
+	/* current index of iterator in hl->hr[] */
+	int idx;
 
-    /* current hostrange object in list hl, i.e. hl->hr[idx] */
-    hostrange_t hr;
+	/* current hostrange object in list hl, i.e. hl->hr[idx] */
+	hostrange_t hr;
 
-    /* current depth we've traversed into range hr */
-    int depth;
+	/* current depth we've traversed into range hr */
+	int depth;
 
-    /* next ptr for lists of iterators */
-    struct hostlist_iterator *next;
+	/* next ptr for lists of iterators */
+	struct hostlist_iterator *next;
 };
 
 struct _range {
@@ -348,7 +348,7 @@ static int           hostname_suffix_width(hostname_t);
 static hostrange_t   hostrange_new(void);
 static hostrange_t   hostrange_create_single(const char *);
 static hostrange_t   hostrange_create(char *, unsigned long, unsigned long,
-				int);
+				      int);
 static unsigned long hostrange_count(hostrange_t);
 static hostrange_t   hostrange_copy(hostrange_t);
 static void          hostrange_destroy(hostrange_t);
@@ -364,7 +364,7 @@ static int           hostrange_join(hostrange_t, hostrange_t);
 static hostrange_t   hostrange_intersect(hostrange_t, hostrange_t);
 static int           hostrange_hn_within(hostrange_t, hostname_t);
 static size_t        hostrange_to_string(hostrange_t hr, size_t, char *, 
-				char *);
+					 char *);
 static size_t        hostrange_numstr(hostrange_t, size_t, char *);
 
 static hostlist_t  hostlist_new(void);
@@ -392,44 +392,44 @@ static int hostset_find_host(hostset_t, const char *);
 /* ------[ macros ]------ */
 
 #ifdef WITH_PTHREADS
-#  define mutex_init(mutex)                                                  \
-	do {                                                                    \
-		int e = pthread_mutex_init(mutex, NULL);                             \
-		if (e) {                                                             \
-			errno = e;                                                       \
-			lsd_fatal_error(__FILE__, __LINE__, "hostlist mutex init:");     \
-			abort();                                                         \
-		}                                                                    \
+#  define mutex_init(mutex)						\
+	do {								\
+		int e = pthread_mutex_init(mutex, NULL);		\
+		if (e) {						\
+			errno = e;					\
+			lsd_fatal_error(__FILE__, __LINE__, "hostlist mutex init:"); \
+			abort();					\
+		}							\
 	} while (0)
 
-#  define mutex_lock(mutex)                                                  \
-	do {                                                                    \
- 		int e = pthread_mutex_lock(mutex);                                   \
-		if (e) {                                                             \
-			errno = e;                                                        \
-			lsd_fatal_error(__FILE__, __LINE__, "hostlist mutex lock:");      \
- 			abort();                                                          \
-		}                                                                    \
+#  define mutex_lock(mutex)						\
+	do {								\
+ 		int e = pthread_mutex_lock(mutex);			\
+		if (e) {						\
+			errno = e;					\
+			lsd_fatal_error(__FILE__, __LINE__, "hostlist mutex lock:"); \
+ 			abort();					\
+		}							\
 	} while (0)
 
-#  define mutex_unlock(mutex)                                                \
-	do {                                                                    \
-		int e = pthread_mutex_unlock(mutex);                                 \
-		if (e) {                                                             \
-			errno = e;                                                       \
-			lsd_fatal_error(__FILE__, __LINE__, "hostlist mutex unlock:");   \
-			abort();                                                         \
-		}                                                                    \
+#  define mutex_unlock(mutex)						\
+	do {								\
+		int e = pthread_mutex_unlock(mutex);			\
+		if (e) {						\
+			errno = e;					\
+			lsd_fatal_error(__FILE__, __LINE__, "hostlist mutex unlock:"); \
+			abort();					\
+		}							\
 	} while (0)
 
-#  define mutex_destroy(mutex)                                               \
-	do {                                                                    \
-		int e = pthread_mutex_destroy(mutex);                                \
-		if (e) {                                                             \
-			errno = e;                                                       \
-			lsd_fatal_error(__FILE__, __LINE__, "hostlist mutex destroy:");  \
-			abort();                                                         \
-		}                                                                    \
+#  define mutex_destroy(mutex)						\
+	do {								\
+		int e = pthread_mutex_destroy(mutex);			\
+		if (e) {						\
+			errno = e;					\
+			lsd_fatal_error(__FILE__, __LINE__, "hostlist mutex destroy:");	\
+			abort();					\
+		}							\
 	} while (0)
 
 #else                /* !WITH_PTHREADS */
@@ -441,22 +441,22 @@ static int hostset_find_host(hostset_t, const char *);
 
 #endif                /* WITH_PTHREADS */
 
-#define LOCK_HOSTLIST(_hl)                                                   \
-	do {                                                                   \
-		assert(_hl != NULL);                                               \
-		mutex_lock(&(_hl)->mutex);                                         \
-		assert((_hl)->magic == HOSTLIST_MAGIC);                            \
+#define LOCK_HOSTLIST(_hl)				\
+	do {						\
+		assert(_hl != NULL);			\
+		mutex_lock(&(_hl)->mutex);		\
+		assert((_hl)->magic == HOSTLIST_MAGIC);	\
 	} while (0)
 
-#define UNLOCK_HOSTLIST(_hl)                                                 \
-	do {                                                                   \
-		mutex_unlock(&(_hl)->mutex);                                       \
+#define UNLOCK_HOSTLIST(_hl)			\
+	do {					\
+		mutex_unlock(&(_hl)->mutex);	\
 	} while (0)                       
 
-#define seterrno_ret(_errno, _rc)                                            \
-	do {                                                                   \
-		errno = _errno;                                                    \
-		return _rc;                                                        \
+#define seterrno_ret(_errno, _rc)		\
+	do {					\
+		errno = _errno;			\
+		return _rc;			\
 	} while (0)
 
 /* ------[ Function Definitions ]------ */
@@ -758,9 +758,9 @@ static hostrange_t hostrange_create_single(const char *prefix)
 
 	return new;
 
-  error2:
+error2:
 	free(new);
-  error1:
+error1:
 	out_of_memory("hostrange create single");
 }
 
@@ -788,9 +788,9 @@ hostrange_create(char *prefix, unsigned long lo, unsigned long hi, int width)
 
 	return new;
 
-  error2:
+error2:
 	free(new);
-  error1:
+error1:
 	out_of_memory("hostrange create");
 }
 
@@ -816,7 +816,7 @@ static hostrange_t hostrange_copy(hostrange_t hr)
 		return hostrange_create_single(hr->prefix);
 	else
 		return hostrange_create(hr->prefix, hr->lo, hr->hi,
-			hr->width);
+					hr->width);
 }
 
 
@@ -1023,7 +1023,7 @@ static char *hostrange_shift(hostrange_t hr)
 		}
 #else		
 		snprintf(host, size, "%s%0*lu", hr->prefix,
-			hr->width, hr->lo++);
+			 hr->width, hr->lo++);
 #endif
 	}
 
@@ -1091,8 +1091,8 @@ static hostrange_t hostrange_intersect(hostrange_t h1, hostrange_t h2)
 	assert(hostrange_cmp(h1, h2) <= 0);
 
 	if ((hostrange_prefix_cmp(h1, h2) == 0)
-	&& (h1->hi > h2->lo) 
-	&& (hostrange_width_combine(h1, h2))) {
+	    && (h1->hi > h2->lo) 
+	    && (hostrange_width_combine(h1, h2))) {
 
 		if (!(new = hostrange_copy(h1)))
 			return NULL;
@@ -1144,8 +1144,8 @@ static int hostrange_hn_within(hostrange_t hr, hostname_t hn)
 	 *   falls within the range of [hr].
 	 */
 	if (hn->num <= hr->hi && hn->num >= hr->lo) {
-			int width = hostname_suffix_width(hn);
-			int num = hn->num;
+		int width = hostname_suffix_width(hn);
+		int num = hn->num;
 		return (_width_equiv(hr->lo, &hr->width, num, &width));
 	}
 
@@ -1306,9 +1306,9 @@ static hostlist_t hostlist_new(void)
 	new->ilist = NULL;
 	return new;
 
-  fail2:
+fail2:
 	free(new);
-  fail1:
+fail1:
 	out_of_memory("hostlist_create");
 }
 
@@ -1384,7 +1384,7 @@ static int hostlist_push_range(hostlist_t hl, hostrange_t hr)
 
 	return retval;
 
-  error:
+error:
 	UNLOCK_HOSTLIST(hl);
 	return -1;
 }
@@ -1396,7 +1396,7 @@ static int hostlist_push_range(hostlist_t hl, hostrange_t hr)
  */
 static int
 hostlist_push_hr(hostlist_t hl, char *prefix, unsigned long lo,
-	unsigned long hi, int width)
+		 unsigned long hi, int width)
 {
 	hostrange_t hr = hostrange_create(prefix, lo, hi, width);
 	int retval = hostlist_push_range(hl, hr);
@@ -1613,7 +1613,7 @@ hostlist_t _hostlist_create(const char *hostlist, char *sep, char *r_op)
 		error = 0;
 	}
 
-  done:
+done:
 	if(orig)
 		free(orig);
 
@@ -1677,7 +1677,7 @@ static int _parse_box_range(char *str, struct _range *ranges,
 	fatal("Unsupported dimensions count %d", SYSTEM_DIMENSIONS);
 	return 0;
 #endif
- }
+}
 
 /* Grab a single range from str 
  * returns 1 if str contained a valid number or range,
@@ -1890,7 +1890,7 @@ _hostlist_create_bracketed(const char *hostlist, char *sep, char *r_op)
 	free(orig);
 	return new;
 
-  error:
+error:
 	err = errno = EINVAL;
 	hostlist_destroy(new);
 	free(orig);
@@ -1925,7 +1925,7 @@ hostlist_t hostlist_copy(const hostlist_t hl)
 	for (i = 0; i < hl->nranges; i++)
 		new->hr[i] = hostrange_copy(hl->hr[i]);
 
-  done:
+done:
 	UNLOCK_HOSTLIST(hl);
 	return new;
 }
@@ -2143,7 +2143,7 @@ char *hostlist_shift_range(hostlist_t hl)
 		hostlist_push_range(hltmp, hl->hr[i]);
 		hostrange_destroy(hl->hr[i]);
 	} while ( (++i < hl->nranges) 
-		&& hostrange_within_range(hltmp->hr[0], hl->hr[i]) );
+		  && hostrange_within_range(hltmp->hr[0], hl->hr[i]) );
 
 	hostlist_shift_iterators(hl, i, 0, hltmp->nranges);
 
@@ -2289,7 +2289,7 @@ int hostlist_delete_nth(hostlist_t hl, int n)
 
 	}
 
-  done:
+done:
 	UNLOCK_HOSTLIST(hl);
 	hl->nhosts--;
 	return 1;
@@ -2330,7 +2330,7 @@ int hostlist_find(hostlist_t hl, const char *hostname)
 			count += hostrange_count(hl->hr[i]);
 	}
 
-  done:
+done:
 	UNLOCK_HOSTLIST(hl);
 	hostname_destroy(hn);
 	return ret;
@@ -2422,8 +2422,8 @@ static void hostlist_coalesce(hostlist_t hl)
 
 			while (new->lo <= new->hi) {
 				hostrange_t hr = hostrange_create( new->prefix,
-					new->lo, new->lo,
-					new->width );
+								   new->lo, new->lo,
+								   new->width );
 
 				if (new->lo > hprev->hi)
 					hostlist_insert_range(hl, hr, j++);
@@ -2858,11 +2858,11 @@ _set_box_in_grid(int dim, int curr, int start[SYSTEM_DIMENSIONS],
 }
 
 static int _add_box_ranges(int dim,  int curr,
-			    int start[SYSTEM_DIMENSIONS],
-			    int end[SYSTEM_DIMENSIONS], 
-			    int pos[SYSTEM_DIMENSIONS],
-			    struct _range *ranges,
-			    int len, int *count)
+			   int start[SYSTEM_DIMENSIONS],
+			   int end[SYSTEM_DIMENSIONS], 
+			   int pos[SYSTEM_DIMENSIONS],
+			   struct _range *ranges,
+			   int len, int *count)
 {
 	int i;
 	int start_curr = curr;
@@ -3246,7 +3246,7 @@ char *hostlist_next(hostlist_iterator_t i)
 		}
 #else
 		snprintf(buf + len, MAXHOSTNAMELEN + 15 - len, "%0*lu",
-			i->hr->width, i->hr->lo + i->depth);
+			 i->hr->width, i->hr->lo + i->depth);
 #endif
 	}
 	UNLOCK_HOSTLIST(i->hl);
@@ -3292,7 +3292,7 @@ int hostlist_remove(hostlist_iterator_t i)
 	} else if (hostrange_empty(i->hr)) {
 		hostlist_delete_range(i->hl, i->idx);
 		/* i->hr = i->hl->hr[i->idx];
-		i->depth = -1; */
+		   i->depth = -1; */
 	} else
 		i->depth--;
 
@@ -3317,9 +3317,9 @@ hostset_t hostset_create(const char *hostlist)
 	hostlist_uniq(new->hl);
 	return new;
 
-  error2:
+error2:
 	free(new);
-  error1:
+error1:
 	return NULL;
 }
 
@@ -3333,9 +3333,9 @@ hostset_t hostset_copy(const hostset_t set)
 		goto error2;
 
 	return new;
-  error2:
+error2:
 	free(new);
-  error1:
+error1:
 	return NULL;
 }
 
@@ -3435,7 +3435,7 @@ static int hostset_find_host(hostset_t set, const char *host)
 			goto done;
 		}
 	}
-  done:
+done:
 	UNLOCK_HOSTLIST(set->hl);
 	hostname_destroy(hn);
 	return retval;
@@ -3474,7 +3474,7 @@ int hostset_within(hostset_t set, const char *hosts)
 	assert(set->hl->magic == HOSTLIST_MAGIC);
 
 	if (!(hl = hostlist_create(hosts)))
-        return (0);
+		return (0);
 	nhosts = hostlist_count(hl);
 	nfound = 0;
 
@@ -3609,27 +3609,27 @@ int main(int ac, char **av)
 	hostset_t set, set1;
 	hostlist_iterator_t iter, iter2;
 
-    if (ac < 2)
-        printf("Recommended usage: %s [hostlist]\n\n", av[0]);
+	if (ac < 2)
+		printf("Recommended usage: %s [hostlist]\n\n", av[0]);
 
 	if (!(hl1 = hostlist_create(ac > 1 ? av[1] : NULL))) {
 		perror("hostlist_create");
-        exit(1);
-    }
-
-    /* build a temporary hostlist, remove duplicates, 
-     * use it to make the hostset */
-    if (!(hl2 = hostlist_create(ac > 1 ? av[1] : NULL))) {
-        perror("hostlist_create");
-        exit(1);
-    }
-    hostlist_uniq(hl2);
-    hostlist_ranged_string(hl2, 102400, buf);
+		exit(1);
+	}
+
+	/* build a temporary hostlist, remove duplicates, 
+	 * use it to make the hostset */
+	if (!(hl2 = hostlist_create(ac > 1 ? av[1] : NULL))) {
+		perror("hostlist_create");
+		exit(1);
+	}
+	hostlist_uniq(hl2);
+	hostlist_ranged_string(hl2, 102400, buf);
 	if (!(set = hostset_create(buf))) {
 		perror("hostset_create");
-        exit(1);
-    }
-    hostlist_destroy(hl2);
+		exit(1);
+	}
+	hostlist_destroy(hl2);
 
 	hl3 = hostlist_create("f[0-5]");
 	hostlist_delete(hl3, "f[1-3]");
diff --git a/src/common/list.c b/src/common/list.c
index 3162fe01286..26492f0d176 100644
--- a/src/common/list.c
+++ b/src/common/list.c
@@ -57,7 +57,7 @@
 /*
 ** Define slurm-specific aliases for use by plugins, see slurm_xlator.h 
 ** for details. 
- */
+*/
 strong_alias(list_create,	slurm_list_create);
 strong_alias(list_destroy,	slurm_list_destroy);
 strong_alias(list_is_empty,	slurm_list_is_empty);
@@ -91,17 +91,17 @@ strong_alias(list_install_fork_handlers, slurm_list_install_fork_handlers);
 #include <unistd.h>
 #ifdef WITH_LSD_FATAL_ERROR_FUNC
 #  undef lsd_fatal_error
-   extern void lsd_fatal_error(char *file, int line, char *mesg);
+extern void lsd_fatal_error(char *file, int line, char *mesg);
 #else /* !WITH_LSD_FATAL_ERROR_FUNC */
 #  ifndef lsd_fatal_error
 #    include <errno.h>
 #    include <stdio.h>
 #    include <string.h>
-#    define lsd_fatal_error(file, line, mesg)                                 \
-       do {                                                                   \
-           fprintf(stderr, "ERROR: [%s:%d] %s: %s\n",                         \
-                   file, line, mesg, strerror(errno));                        \
-       } while (0)
+#    define lsd_fatal_error(file, line, mesg)			\
+	do {							\
+		fprintf(stderr, "ERROR: [%s:%d] %s: %s\n",	\
+			file, line, mesg, strerror(errno));	\
+	} while (0)
 #  endif /* !lsd_fatal_error */
 #endif /* !WITH_LSD_FATAL_ERROR_FUNC */
 
@@ -112,7 +112,7 @@ strong_alias(list_install_fork_handlers, slurm_list_install_fork_handlers);
 
 #ifdef WITH_LSD_NOMEM_ERROR_FUNC
 #  undef lsd_nomem_error
-   extern void * lsd_nomem_error(char *file, int line, char *mesg);
+extern void * lsd_nomem_error(char *file, int line, char *mesg);
 #else /* !WITH_LSD_NOMEM_ERROR_FUNC */
 #  ifndef lsd_nomem_error
 #    define lsd_nomem_error(file, line, mesg) (NULL)
@@ -152,31 +152,31 @@ strong_alias(list_install_fork_handlers, slurm_list_install_fork_handlers);
  ****************/
 
 struct listNode {
-    void                 *data;         /* node's data                       */
-    struct listNode      *next;         /* next node in list                 */
+	void                 *data;         /* node's data                       */
+	struct listNode      *next;         /* next node in list                 */
 };
 
 struct listIterator {
-    struct list          *list;         /* the list being iterated           */
-    struct listNode      *pos;          /* the next node to be iterated      */
-    struct listNode     **prev;         /* addr of 'next' ptr to prv It node */
-    struct listIterator  *iNext;        /* iterator chain for list_destroy() */
+	struct list          *list;         /* the list being iterated           */
+	struct listNode      *pos;          /* the next node to be iterated      */
+	struct listNode     **prev;         /* addr of 'next' ptr to prv It node */
+	struct listIterator  *iNext;        /* iterator chain for list_destroy() */
 #ifndef NDEBUG
-    unsigned int          magic;        /* sentinel for asserting validity   */
+	unsigned int          magic;        /* sentinel for asserting validity   */
 #endif /* !NDEBUG */
 };
 
 struct list {
-    struct listNode      *head;         /* head of the list                  */
-    struct listNode     **tail;         /* addr of last node's 'next' ptr    */
-    struct listIterator  *iNext;        /* iterator chain for list_destroy() */
-    ListDelF              fDel;         /* function to delete node data      */
-    int                   count;        /* number of nodes in list           */
+	struct listNode      *head;         /* head of the list                  */
+	struct listNode     **tail;         /* addr of last node's 'next' ptr    */
+	struct listIterator  *iNext;        /* iterator chain for list_destroy() */
+	ListDelF              fDel;         /* function to delete node data      */
+	int                   count;        /* number of nodes in list           */
 #ifdef WITH_PTHREADS
-    pthread_mutex_t       mutex;        /* mutex to protect access to list   */
+	pthread_mutex_t       mutex;        /* mutex to protect access to list   */
 #endif /* WITH_PTHREADS */
 #ifndef NDEBUG
-    unsigned int          magic;        /* sentinel for asserting validity   */
+	unsigned int          magic;        /* sentinel for asserting validity   */
 #endif /* !NDEBUG */
 };
 
@@ -218,48 +218,48 @@ static pthread_mutex_t list_free_lock = PTHREAD_MUTEX_INITIALIZER;
 
 #ifdef WITH_PTHREADS
 
-#  define list_mutex_init(mutex)                                              \
-     do {                                                                     \
-         int e = pthread_mutex_init(mutex, NULL);                             \
-         if (e != 0) {                                                        \
-             errno = e;                                                       \
-             lsd_fatal_error(__FILE__, __LINE__, "list mutex init");          \
-             abort();                                                         \
-         }                                                                    \
-     } while (0)
-
-#  define list_mutex_lock(mutex)                                              \
-     do {                                                                     \
-         int e = pthread_mutex_lock(mutex);                                   \
-         if (e != 0) {                                                        \
-             errno = e;                                                       \
-             lsd_fatal_error(__FILE__, __LINE__, "list mutex lock");          \
-             abort();                                                         \
-         }                                                                    \
-     } while (0)
-
-#  define list_mutex_unlock(mutex)                                            \
-     do {                                                                     \
-         int e = pthread_mutex_unlock(mutex);                                 \
-         if (e != 0) {                                                        \
-             errno = e;                                                       \
-             lsd_fatal_error(__FILE__, __LINE__, "list mutex unlock");        \
-             abort();                                                         \
-         }                                                                    \
-     } while (0)
-
-#  define list_mutex_destroy(mutex)                                           \
-     do {                                                                     \
-         int e = pthread_mutex_destroy(mutex);                                \
-         if (e != 0) {                                                        \
-             errno = e;                                                       \
-             lsd_fatal_error(__FILE__, __LINE__, "list mutex destroy");       \
-             abort();                                                         \
-         }                                                                    \
-     } while (0)
+#  define list_mutex_init(mutex)					\
+	do {								\
+		int e = pthread_mutex_init(mutex, NULL);		\
+		if (e != 0) {						\
+			errno = e;					\
+			lsd_fatal_error(__FILE__, __LINE__, "list mutex init");	\
+			abort();					\
+		}							\
+	} while (0)
+
+#  define list_mutex_lock(mutex)					\
+	do {								\
+		int e = pthread_mutex_lock(mutex);			\
+		if (e != 0) {						\
+			errno = e;					\
+			lsd_fatal_error(__FILE__, __LINE__, "list mutex lock");	\
+			abort();					\
+		}							\
+	} while (0)
+
+#  define list_mutex_unlock(mutex)					\
+	do {								\
+		int e = pthread_mutex_unlock(mutex);			\
+		if (e != 0) {						\
+			errno = e;					\
+			lsd_fatal_error(__FILE__, __LINE__, "list mutex unlock"); \
+			abort();					\
+		}							\
+	} while (0)
+
+#  define list_mutex_destroy(mutex)					\
+	do {								\
+		int e = pthread_mutex_destroy(mutex);			\
+		if (e != 0) {						\
+			errno = e;					\
+			lsd_fatal_error(__FILE__, __LINE__, "list mutex destroy"); \
+			abort();					\
+		}							\
+	} while (0)
 
 #  ifndef NDEBUG
-     static int list_mutex_is_locked (pthread_mutex_t *mutex);
+static int list_mutex_is_locked (pthread_mutex_t *mutex);
 #  endif /* !NDEBUG */
 
 #else /* !WITH_PTHREADS */
@@ -280,249 +280,249 @@ static pthread_mutex_t list_free_lock = PTHREAD_MUTEX_INITIALIZER;
 List
 list_create (ListDelF f)
 {
-    List l;
+	List l;
 
-    if (!(l = list_alloc()))
-        return(lsd_nomem_error(__FILE__, __LINE__, "list create"));
-    l->head = NULL;
-    l->tail = &l->head;
-    l->iNext = NULL;
-    l->fDel = f;
-    l->count = 0;
-    list_mutex_init(&l->mutex);
-    assert(l->magic = LIST_MAGIC);      /* set magic via assert abuse */
-    return(l);
+	if (!(l = list_alloc()))
+		return(lsd_nomem_error(__FILE__, __LINE__, "list create"));
+	l->head = NULL;
+	l->tail = &l->head;
+	l->iNext = NULL;
+	l->fDel = f;
+	l->count = 0;
+	list_mutex_init(&l->mutex);
+	assert(l->magic = LIST_MAGIC);      /* set magic via assert abuse */
+	return(l);
 }
 
 
 void
 list_destroy (List l)
 {
-    ListIterator i, iTmp;
-    ListNode p, pTmp;
-
-    assert(l != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    i = l->iNext;
-    while (i) {
-        assert(i->magic == LIST_MAGIC);
-        iTmp = i->iNext;
-        assert(i->magic = ~LIST_MAGIC); /* clear magic via assert abuse */
-        list_iterator_free(i);
-        i = iTmp;
-    }
-    p = l->head;
-    while (p) {
-        pTmp = p->next;
-        if (p->data && l->fDel)
-            l->fDel(p->data);
-        list_node_free(p);
-        p = pTmp;
-    }
-    assert(l->magic = ~LIST_MAGIC);     /* clear magic via assert abuse */
-    list_mutex_unlock(&l->mutex);
-    list_mutex_destroy(&l->mutex);
-    list_free(l);
-    return;
+	ListIterator i, iTmp;
+	ListNode p, pTmp;
+
+	assert(l != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	i = l->iNext;
+	while (i) {
+		assert(i->magic == LIST_MAGIC);
+		iTmp = i->iNext;
+		assert(i->magic = ~LIST_MAGIC); /* clear magic via assert abuse */
+		list_iterator_free(i);
+		i = iTmp;
+	}
+	p = l->head;
+	while (p) {
+		pTmp = p->next;
+		if (p->data && l->fDel)
+			l->fDel(p->data);
+		list_node_free(p);
+		p = pTmp;
+	}
+	assert(l->magic = ~LIST_MAGIC);     /* clear magic via assert abuse */
+	list_mutex_unlock(&l->mutex);
+	list_mutex_destroy(&l->mutex);
+	list_free(l);
+	return;
 }
 
 
 int
 list_is_empty (List l)
 {
-    int n;
+	int n;
 
-    assert(l != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    n = l->count;
-    list_mutex_unlock(&l->mutex);
-    return(n == 0);
+	assert(l != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	n = l->count;
+	list_mutex_unlock(&l->mutex);
+	return(n == 0);
 }
 
 
 int
 list_count (List l)
 {
-    int n;
+	int n;
 
-    assert(l != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    n = l->count;
-    list_mutex_unlock(&l->mutex);
-    return(n);
+	assert(l != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	n = l->count;
+	list_mutex_unlock(&l->mutex);
+	return(n);
 }
 
 
 void *
 list_append (List l, void *x)
 {
-    void *v;
+	void *v;
 
-    assert(l != NULL);
-    assert(x != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    v = list_node_create(l, l->tail, x);
-    list_mutex_unlock(&l->mutex);
-    return(v);
+	assert(l != NULL);
+	assert(x != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	v = list_node_create(l, l->tail, x);
+	list_mutex_unlock(&l->mutex);
+	return(v);
 }
 
 
 int
 list_append_list (List l, List sub)
 {
-    ListIterator itr;
-    void *v;
-    int n = 0;
+	ListIterator itr;
+	void *v;
+	int n = 0;
     
-    assert(l != NULL);
-    assert(l->fDel == NULL);
-    assert(sub != NULL);
-    itr = list_iterator_create(sub);
-    while((v = list_next(itr))) {
-        if(list_append(l, v))
-	    n++;
-	else 
-	    break;
-    }
-    list_iterator_destroy(itr);
+	assert(l != NULL);
+	assert(l->fDel == NULL);
+	assert(sub != NULL);
+	itr = list_iterator_create(sub);
+	while((v = list_next(itr))) {
+		if(list_append(l, v))
+			n++;
+		else 
+			break;
+	}
+	list_iterator_destroy(itr);
     
-    return n;
+	return n;
 }
 
 int
 list_transfer (List l, List sub)
 {
-    void *v;
-    int n = 0;
+	void *v;
+	int n = 0;
     
-    assert(l != NULL);
-    assert(sub != NULL);
-    assert(l->fDel == sub->fDel);
-    while((v = list_pop(sub))) {
-        if(list_append(l, v))
-	    n++;
-	else {
-	    if(l->fDel)
-		l->fDel(v);
-	    break;
+	assert(l != NULL);
+	assert(sub != NULL);
+	assert(l->fDel == sub->fDel);
+	while((v = list_pop(sub))) {
+		if(list_append(l, v))
+			n++;
+		else {
+			if(l->fDel)
+				l->fDel(v);
+			break;
+		}
 	}
-    }
     
-    return n;
+	return n;
 }
 
 void *
 list_prepend (List l, void *x)
 {
-    void *v;
+	void *v;
 
-    assert(l != NULL);
-    assert(x != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    v = list_node_create(l, &l->head, x);
-    list_mutex_unlock(&l->mutex);
-    return(v);
+	assert(l != NULL);
+	assert(x != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	v = list_node_create(l, &l->head, x);
+	list_mutex_unlock(&l->mutex);
+	return(v);
 }
 
 
 void *
 list_find_first (List l, ListFindF f, void *key)
 {
-    ListNode p;
-    void *v = NULL;
-
-    assert(l != NULL);
-    assert(f != NULL);
-    assert(key != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    for (p=l->head; p; p=p->next) {
-        if (f(p->data, key)) {
-            v = p->data;
-            break;
-        }
-    }
-    list_mutex_unlock(&l->mutex);
-    return(v);
+	ListNode p;
+	void *v = NULL;
+
+	assert(l != NULL);
+	assert(f != NULL);
+	assert(key != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	for (p=l->head; p; p=p->next) {
+		if (f(p->data, key)) {
+			v = p->data;
+			break;
+		}
+	}
+	list_mutex_unlock(&l->mutex);
+	return(v);
 }
 
 
 int
 list_delete_all (List l, ListFindF f, void *key)
 {
-    ListNode *pp;
-    void *v;
-    int n = 0;
-
-    assert(l != NULL);
-    assert(f != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    pp = &l->head;
-    while (*pp) {
-        if (f((*pp)->data, key)) {
-            if ((v = list_node_destroy(l, pp))) {
-                if (l->fDel)
-                    l->fDel(v);
-                n++;
-            }
-        }
-        else {
-            pp = &(*pp)->next;
-        }
-    }
-    list_mutex_unlock(&l->mutex);
-    return(n);
+	ListNode *pp;
+	void *v;
+	int n = 0;
+
+	assert(l != NULL);
+	assert(f != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	pp = &l->head;
+	while (*pp) {
+		if (f((*pp)->data, key)) {
+			if ((v = list_node_destroy(l, pp))) {
+				if (l->fDel)
+					l->fDel(v);
+				n++;
+			}
+		}
+		else {
+			pp = &(*pp)->next;
+		}
+	}
+	list_mutex_unlock(&l->mutex);
+	return(n);
 }
 
 
 int
 list_for_each (List l, ListForF f, void *arg)
 {
-    ListNode p;
-    int n = 0;
-
-    assert(l != NULL);
-    assert(f != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    for (p=l->head; p; p=p->next) {
-        n++;
-        if (f(p->data, arg) < 0) {
-            n = -n;
-            break;
-        }
-    }
-    list_mutex_unlock(&l->mutex);
-    return(n);
+	ListNode p;
+	int n = 0;
+
+	assert(l != NULL);
+	assert(f != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	for (p=l->head; p; p=p->next) {
+		n++;
+		if (f(p->data, arg) < 0) {
+			n = -n;
+			break;
+		}
+	}
+	list_mutex_unlock(&l->mutex);
+	return(n);
 }
 
 
 int
 list_flush (List l)
 {
-    ListNode *pp;
-    void *v;
-    int n = 0;
-
-    assert(l != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    pp = &l->head;
-    while (*pp) {
-        if ((v = list_node_destroy(l, pp))) {
-            if (l->fDel)
-                l->fDel(v);
-	    n++;
+	ListNode *pp;
+	void *v;
+	int n = 0;
+
+	assert(l != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	pp = &l->head;
+	while (*pp) {
+		if ((v = list_node_destroy(l, pp))) {
+			if (l->fDel)
+				l->fDel(v);
+			n++;
+		}
 	}
-    }
-    list_mutex_unlock(&l->mutex);
-    return(n);
+	list_mutex_unlock(&l->mutex);
+	return(n);
 }
 
 
@@ -531,252 +531,252 @@ list_sort (List l, ListCmpF f)
 {
 /*  Note: Time complexity O(n^2).
  */
-    ListNode *pp, *ppPrev, *ppPos, pTmp;
-    ListIterator i;
-
-    assert(l != NULL);
-    assert(f != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    if (l->count > 1) {
-        ppPrev = &l->head;
-        pp = &(*ppPrev)->next;
-        while (*pp) {
-            if (f((*pp)->data, (*ppPrev)->data) < 0) {
-                ppPos = &l->head;
-                while (f((*pp)->data, (*ppPos)->data) >= 0)
-                    ppPos = &(*ppPos)->next;
-                pTmp = (*pp)->next;
-                (*pp)->next = *ppPos;
-                *ppPos = *pp;
-                *pp = pTmp;
-                if (ppPrev == ppPos)
-                    ppPrev = &(*ppPrev)->next;
-            }
-            else {
-                ppPrev = pp;
-                pp = &(*pp)->next;
-            }
-        }
-        l->tail = pp;
-
-        for (i=l->iNext; i; i=i->iNext) {
-            assert(i->magic == LIST_MAGIC);
-            i->pos = i->list->head;
-            i->prev = &i->list->head;
-        }
-    }
-    list_mutex_unlock(&l->mutex);
-    return;
+	ListNode *pp, *ppPrev, *ppPos, pTmp;
+	ListIterator i;
+
+	assert(l != NULL);
+	assert(f != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	if (l->count > 1) {
+		ppPrev = &l->head;
+		pp = &(*ppPrev)->next;
+		while (*pp) {
+			if (f((*pp)->data, (*ppPrev)->data) < 0) {
+				ppPos = &l->head;
+				while (f((*pp)->data, (*ppPos)->data) >= 0)
+					ppPos = &(*ppPos)->next;
+				pTmp = (*pp)->next;
+				(*pp)->next = *ppPos;
+				*ppPos = *pp;
+				*pp = pTmp;
+				if (ppPrev == ppPos)
+					ppPrev = &(*ppPrev)->next;
+			}
+			else {
+				ppPrev = pp;
+				pp = &(*pp)->next;
+			}
+		}
+		l->tail = pp;
+
+		for (i=l->iNext; i; i=i->iNext) {
+			assert(i->magic == LIST_MAGIC);
+			i->pos = i->list->head;
+			i->prev = &i->list->head;
+		}
+	}
+	list_mutex_unlock(&l->mutex);
+	return;
 }
 
 void *
 list_push (List l, void *x)
 {
-    void *v;
+	void *v;
 
-    assert(l != NULL);
-    assert(x != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    v = list_node_create(l, &l->head, x);
-    list_mutex_unlock(&l->mutex);
-    return(v);
+	assert(l != NULL);
+	assert(x != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	v = list_node_create(l, &l->head, x);
+	list_mutex_unlock(&l->mutex);
+	return(v);
 }
 
 
 void *
 list_pop (List l)
 {
-    void *v;
+	void *v;
 
-    assert(l != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    v = list_node_destroy(l, &l->head);
-    list_mutex_unlock(&l->mutex);
-    return(v);
+	assert(l != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	v = list_node_destroy(l, &l->head);
+	list_mutex_unlock(&l->mutex);
+	return(v);
 }
 
 
 void *
 list_peek (List l)
 {
-    void *v;
+	void *v;
 
-    assert(l != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    v = (l->head) ? l->head->data : NULL;
-    list_mutex_unlock(&l->mutex);
-    return(v);
+	assert(l != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	v = (l->head) ? l->head->data : NULL;
+	list_mutex_unlock(&l->mutex);
+	return(v);
 }
 
 
 void *
 list_enqueue (List l, void *x)
 {
-    void *v;
+	void *v;
 
-    assert(l != NULL);
-    assert(x != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    v = list_node_create(l, l->tail, x);
-    list_mutex_unlock(&l->mutex);
-    return(v);
+	assert(l != NULL);
+	assert(x != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	v = list_node_create(l, l->tail, x);
+	list_mutex_unlock(&l->mutex);
+	return(v);
 }
 
 
 void *
 list_dequeue (List l)
 {
-    void *v;
+	void *v;
 
-    assert(l != NULL);
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    v = list_node_destroy(l, &l->head);
-    list_mutex_unlock(&l->mutex);
-    return(v);
+	assert(l != NULL);
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	v = list_node_destroy(l, &l->head);
+	list_mutex_unlock(&l->mutex);
+	return(v);
 }
 
 
 ListIterator
 list_iterator_create (List l)
 {
-    ListIterator i;
+	ListIterator i;
 
-    assert(l != NULL);
-    if (!(i = list_iterator_alloc()))
-        return(lsd_nomem_error(__FILE__, __LINE__, "list iterator create"));
-    i->list = l;
-    list_mutex_lock(&l->mutex);
-    assert(l->magic == LIST_MAGIC);
-    i->pos = l->head;
-    i->prev = &l->head;
-    i->iNext = l->iNext;
-    l->iNext = i;
-    assert(i->magic = LIST_MAGIC);      /* set magic via assert abuse */
-    list_mutex_unlock(&l->mutex);
-    return(i);
+	assert(l != NULL);
+	if (!(i = list_iterator_alloc()))
+		return(lsd_nomem_error(__FILE__, __LINE__, "list iterator create"));
+	i->list = l;
+	list_mutex_lock(&l->mutex);
+	assert(l->magic == LIST_MAGIC);
+	i->pos = l->head;
+	i->prev = &l->head;
+	i->iNext = l->iNext;
+	l->iNext = i;
+	assert(i->magic = LIST_MAGIC);      /* set magic via assert abuse */
+	list_mutex_unlock(&l->mutex);
+	return(i);
 }
 
 
 void
 list_iterator_reset (ListIterator i)
 {
-    assert(i != NULL);
-    assert(i->magic == LIST_MAGIC);
-    list_mutex_lock(&i->list->mutex);
-    assert(i->list->magic == LIST_MAGIC);
-    i->pos = i->list->head;
-    i->prev = &i->list->head;
-    list_mutex_unlock(&i->list->mutex);
-    return;
+	assert(i != NULL);
+	assert(i->magic == LIST_MAGIC);
+	list_mutex_lock(&i->list->mutex);
+	assert(i->list->magic == LIST_MAGIC);
+	i->pos = i->list->head;
+	i->prev = &i->list->head;
+	list_mutex_unlock(&i->list->mutex);
+	return;
 }
 
 
 void
 list_iterator_destroy (ListIterator i)
 {
-    ListIterator *pi;
-
-    assert(i != NULL);
-    assert(i->magic == LIST_MAGIC);
-    list_mutex_lock(&i->list->mutex);
-    assert(i->list->magic == LIST_MAGIC);
-    for (pi=&i->list->iNext; *pi; pi=&(*pi)->iNext) {
-        assert((*pi)->magic == LIST_MAGIC);
-        if (*pi == i) {
-            *pi = (*pi)->iNext;
-            break;
-        }
-    }
-    list_mutex_unlock(&i->list->mutex);
-    assert(i->magic = ~LIST_MAGIC);     /* clear magic via assert abuse */
-    list_iterator_free(i);
-    return;
+	ListIterator *pi;
+
+	assert(i != NULL);
+	assert(i->magic == LIST_MAGIC);
+	list_mutex_lock(&i->list->mutex);
+	assert(i->list->magic == LIST_MAGIC);
+	for (pi=&i->list->iNext; *pi; pi=&(*pi)->iNext) {
+		assert((*pi)->magic == LIST_MAGIC);
+		if (*pi == i) {
+			*pi = (*pi)->iNext;
+			break;
+		}
+	}
+	list_mutex_unlock(&i->list->mutex);
+	assert(i->magic = ~LIST_MAGIC);     /* clear magic via assert abuse */
+	list_iterator_free(i);
+	return;
 }
 
 
 void *
 list_next (ListIterator i)
 {
-    ListNode p;
+	ListNode p;
 
-    assert(i != NULL);
-    assert(i->magic == LIST_MAGIC);
-    list_mutex_lock(&i->list->mutex);
-    assert(i->list->magic == LIST_MAGIC);
-    if ((p = i->pos))
-        i->pos = p->next;
-    if (*i->prev != p)
-        i->prev = &(*i->prev)->next;
-    list_mutex_unlock(&i->list->mutex);
-    return(p ? p->data : NULL);
+	assert(i != NULL);
+	assert(i->magic == LIST_MAGIC);
+	list_mutex_lock(&i->list->mutex);
+	assert(i->list->magic == LIST_MAGIC);
+	if ((p = i->pos))
+		i->pos = p->next;
+	if (*i->prev != p)
+		i->prev = &(*i->prev)->next;
+	list_mutex_unlock(&i->list->mutex);
+	return(p ? p->data : NULL);
 }
 
 
 void *
 list_insert (ListIterator i, void *x)
 {
-    void *v;
+	void *v;
 
-    assert(i != NULL);
-    assert(x != NULL);
-    assert(i->magic == LIST_MAGIC);
-    list_mutex_lock(&i->list->mutex);
-    assert(i->list->magic == LIST_MAGIC);
-    v = list_node_create(i->list, i->prev, x);
-    list_mutex_unlock(&i->list->mutex);
-    return(v);
+	assert(i != NULL);
+	assert(x != NULL);
+	assert(i->magic == LIST_MAGIC);
+	list_mutex_lock(&i->list->mutex);
+	assert(i->list->magic == LIST_MAGIC);
+	v = list_node_create(i->list, i->prev, x);
+	list_mutex_unlock(&i->list->mutex);
+	return(v);
 }
 
 
 void *
 list_find (ListIterator i, ListFindF f, void *key)
 {
-    void *v;
+	void *v;
 
-    assert(i != NULL);
-    assert(f != NULL);
-    assert(key != NULL);
-    assert(i->magic == LIST_MAGIC);
-    while ((v=list_next(i)) && !f(v,key)) {;}
-    return(v);
+	assert(i != NULL);
+	assert(f != NULL);
+	assert(key != NULL);
+	assert(i->magic == LIST_MAGIC);
+	while ((v=list_next(i)) && !f(v,key)) {;}
+	return(v);
 }
 
 
 void *
 list_remove (ListIterator i)
 {
-    void *v = NULL;
+	void *v = NULL;
 
-    assert(i != NULL);
-    assert(i->magic == LIST_MAGIC);
-    list_mutex_lock(&i->list->mutex);
-    assert(i->list->magic == LIST_MAGIC);
-    if (*i->prev != i->pos)
-        v = list_node_destroy(i->list, i->prev);
-    list_mutex_unlock(&i->list->mutex);
-    return(v);
+	assert(i != NULL);
+	assert(i->magic == LIST_MAGIC);
+	list_mutex_lock(&i->list->mutex);
+	assert(i->list->magic == LIST_MAGIC);
+	if (*i->prev != i->pos)
+		v = list_node_destroy(i->list, i->prev);
+	list_mutex_unlock(&i->list->mutex);
+	return(v);
 }
 
 
 int
 list_delete_item (ListIterator i)
 {
-    void *v;
+	void *v;
 
-    assert(i != NULL);
-    assert(i->magic == LIST_MAGIC);
-    if ((v = list_remove(i))) {
-        if (i->list->fDel)
-            i->list->fDel(v);
-        return(1);
-    }
-    return(0);
+	assert(i != NULL);
+	assert(i->magic == LIST_MAGIC);
+	if ((v = list_remove(i))) {
+		if (i->list->fDel)
+			i->list->fDel(v);
+		return(1);
+	}
+	return(0);
 }
 
 
@@ -788,30 +788,30 @@ list_node_create (List l, ListNode *pp, void *x)
  *  Returns a ptr to data [x], or NULL if insertion fails.
  *  This routine assumes the list is already locked upon entry.
  */
-    ListNode p;
-    ListIterator i;
-
-    assert(l != NULL);
-    assert(l->magic == LIST_MAGIC);
-    assert(list_mutex_is_locked(&l->mutex));
-    assert(pp != NULL);
-    assert(x != NULL);
-    if (!(p = list_node_alloc()))
-        return(lsd_nomem_error(__FILE__, __LINE__, "list node create"));
-    p->data = x;
-    if (!(p->next = *pp))
-        l->tail = &p->next;
-    *pp = p;
-    l->count++;
-    for (i=l->iNext; i; i=i->iNext) {
-        assert(i->magic == LIST_MAGIC);
-        if (i->prev == pp)
-            i->prev = &p->next;
-        else if (i->pos == p->next)
-            i->pos = p;
-        assert((i->pos == *i->prev) || (i->pos == (*i->prev)->next));
-    }
-    return(x);
+	ListNode p;
+	ListIterator i;
+
+	assert(l != NULL);
+	assert(l->magic == LIST_MAGIC);
+	assert(list_mutex_is_locked(&l->mutex));
+	assert(pp != NULL);
+	assert(x != NULL);
+	if (!(p = list_node_alloc()))
+		return(lsd_nomem_error(__FILE__, __LINE__, "list node create"));
+	p->data = x;
+	if (!(p->next = *pp))
+		l->tail = &p->next;
+	*pp = p;
+	l->count++;
+	for (i=l->iNext; i; i=i->iNext) {
+		assert(i->magic == LIST_MAGIC);
+		if (i->prev == pp)
+			i->prev = &p->next;
+		else if (i->pos == p->next)
+			i->pos = p;
+		assert((i->pos == *i->prev) || (i->pos == (*i->prev)->next));
+	}
+	return(x);
 }
 
 
@@ -824,75 +824,75 @@ list_node_destroy (List l, ListNode *pp)
  *    or NULL if [*pp] points to the NULL element.
  *  This routine assumes the list is already locked upon entry.
  */
-    void *v;
-    ListNode p;
-    ListIterator i;
-
-    assert(l != NULL);
-    assert(l->magic == LIST_MAGIC);
-    assert(list_mutex_is_locked(&l->mutex));
-    assert(pp != NULL);
-    if (!(p = *pp))
-        return(NULL);
-    v = p->data;
-    if (!(*pp = p->next))
-        l->tail = pp;
-    l->count--;
-    for (i=l->iNext; i; i=i->iNext) {
-        assert(i->magic == LIST_MAGIC);
-        if (i->pos == p)
-            i->pos = p->next, i->prev = pp;
-        else if (i->prev == &p->next)
-            i->prev = pp;
-        assert((i->pos == *i->prev) || (i->pos == (*i->prev)->next));
-    }
-    list_node_free(p);
-    return(v);
+	void *v;
+	ListNode p;
+	ListIterator i;
+
+	assert(l != NULL);
+	assert(l->magic == LIST_MAGIC);
+	assert(list_mutex_is_locked(&l->mutex));
+	assert(pp != NULL);
+	if (!(p = *pp))
+		return(NULL);
+	v = p->data;
+	if (!(*pp = p->next))
+		l->tail = pp;
+	l->count--;
+	for (i=l->iNext; i; i=i->iNext) {
+		assert(i->magic == LIST_MAGIC);
+		if (i->pos == p)
+			i->pos = p->next, i->prev = pp;
+		else if (i->prev == &p->next)
+			i->prev = pp;
+		assert((i->pos == *i->prev) || (i->pos == (*i->prev)->next));
+	}
+	list_node_free(p);
+	return(v);
 }
 
 
 static List
 list_alloc (void)
 {
-    return(list_alloc_aux(sizeof(struct list), &list_free_lists));
+	return(list_alloc_aux(sizeof(struct list), &list_free_lists));
 }
 
 
 static void
 list_free (List l)
 {
-    list_free_aux(l, &list_free_lists);
-    return;
+	list_free_aux(l, &list_free_lists);
+	return;
 }
 
 
 static ListNode
 list_node_alloc (void)
 {
-    return(list_alloc_aux(sizeof(struct listNode), &list_free_nodes));
+	return(list_alloc_aux(sizeof(struct listNode), &list_free_nodes));
 }
 
 
 static void
 list_node_free (ListNode p)
 {
-    list_free_aux(p, &list_free_nodes);
-    return;
+	list_free_aux(p, &list_free_nodes);
+	return;
 }
 
 
 static ListIterator
 list_iterator_alloc (void)
 {
-    return(list_alloc_aux(sizeof(struct listIterator), &list_free_iterators));
+	return(list_alloc_aux(sizeof(struct listIterator), &list_free_iterators));
 }
 
 
 static void
 list_iterator_free (ListIterator i)
 {
-    list_free_aux(i, &list_free_iterators);
-    return;
+	list_free_aux(i, &list_free_iterators);
+	return;
 }
 
 
@@ -903,30 +903,30 @@ list_alloc_aux (int size, void *pfreelist)
  *  Memory is added to the freelist in chunks of size LIST_ALLOC.
  *  Returns a ptr to the object, or NULL if the memory request fails.
  */
-    void **px;
-    void **pfree = pfreelist;
-    void **plast;
-
-    assert(sizeof(char) == 1);
-    assert(size >= sizeof(void *));
-    assert(pfreelist != NULL);
-    assert(LIST_ALLOC > 0);
-    list_mutex_lock(&list_free_lock);
-    if (!*pfree) {
-        if ((*pfree = xmalloc(LIST_ALLOC * size))) {
-            px = *pfree;
-            plast = (void **) ((char *) *pfree + ((LIST_ALLOC - 1) * size));
-            while (px < plast)
-                *px = (char *) px + size, px = *px;
-            *plast = NULL;
-        }
-    }
-    if ((px = *pfree))
-        *pfree = *px;
-    else
-        errno = ENOMEM;
-    list_mutex_unlock(&list_free_lock);
-    return(px);
+	void **px;
+	void **pfree = pfreelist;
+	void **plast;
+
+	assert(sizeof(char) == 1);
+	assert(size >= sizeof(void *));
+	assert(pfreelist != NULL);
+	assert(LIST_ALLOC > 0);
+	list_mutex_lock(&list_free_lock);
+	if (!*pfree) {
+		if ((*pfree = xmalloc(LIST_ALLOC * size))) {
+			px = *pfree;
+			plast = (void **) ((char *) *pfree + ((LIST_ALLOC - 1) * size));
+			while (px < plast)
+				*px = (char *) px + size, px = *px;
+			*plast = NULL;
+		}
+	}
+	if ((px = *pfree))
+		*pfree = *px;
+	else
+		errno = ENOMEM;
+	list_mutex_unlock(&list_free_lock);
+	return(px);
 }
 
 
@@ -936,19 +936,19 @@ list_free_aux (void *x, void *pfreelist)
 /*  Frees the object [x], returning it to the freelist [*pfreelist].
  */
 #ifdef MEMORY_LEAK_DEBUG
-    xfree(x);
+	xfree(x);
 #else
-    void **px = x;
-    void **pfree = pfreelist;
-
-    assert(x != NULL);
-    assert(pfreelist != NULL);
-    list_mutex_lock(&list_free_lock);
-    *px = *pfree;
-    *pfree = px;
-    list_mutex_unlock(&list_free_lock);
+	void **px = x;
+	void **pfree = pfreelist;
+
+	assert(x != NULL);
+	assert(pfreelist != NULL);
+	list_mutex_lock(&list_free_lock);
+	*px = *pfree;
+	*pfree = px;
+	list_mutex_unlock(&list_free_lock);
 #endif
-    return;
+	return;
 }
 
 #ifdef WITH_PTHREADS
@@ -979,11 +979,11 @@ list_mutex_is_locked (pthread_mutex_t *mutex)
 {
 /*  Returns true if the mutex is locked; o/w, returns false.
  */
-    int rc;
+	int rc;
 
-    assert(mutex != NULL);
-    rc = pthread_mutex_trylock(mutex);
-    return(rc == EBUSY ? 1 : 0);
+	assert(mutex != NULL);
+	rc = pthread_mutex_trylock(mutex);
+	return(rc == EBUSY ? 1 : 0);
 }
 #endif /* WITH_PTHREADS */
 #endif /* !NDEBUG */
diff --git a/src/common/node_select.c b/src/common/node_select.c
index 1c2cfee571f..b68e7621299 100644
--- a/src/common/node_select.c
+++ b/src/common/node_select.c
@@ -62,8 +62,8 @@
 /* Define select_jobinfo_t below to avoid including extraneous slurm headers */
 #ifndef __select_jobinfo_t_defined
 #  define  __select_jobinfo_t_defined
-   typedef struct select_jobinfo select_jobinfo_t;     /* opaque data type */
-   typedef struct select_nodeinfo select_nodeinfo_t;     /* opaque data type */
+typedef struct select_jobinfo select_jobinfo_t;     /* opaque data type */
+typedef struct select_nodeinfo select_nodeinfo_t;     /* opaque data type */
 #endif
 
 /*
@@ -150,7 +150,7 @@ typedef struct slurm_select_context {
 
 static slurm_select_context_t * g_select_context = NULL;
 static pthread_mutex_t		g_select_context_lock = 
-					PTHREAD_MUTEX_INITIALIZER;
+	PTHREAD_MUTEX_INITIALIZER;
 
 #ifdef HAVE_CRAY_XT		/* node selection specific logic */
 #  define JOBINFO_MAGIC 0x8cb3
@@ -244,7 +244,7 @@ static slurm_select_ops_t * _select_get_ops(slurm_select_context_t *c)
 	c->cur_plugin = plugrack_use_by_type( c->plugin_list, c->select_type );
 	if ( c->cur_plugin == PLUGIN_INVALID_HANDLE ) {
 		error( "cannot find node selection plugin for %s", 
-			c->select_type );
+		       c->select_type );
 		return NULL;
 	}
 
@@ -496,7 +496,7 @@ extern int node_select_block_info_msg_unpack(
 	safe_unpack32(&(buf->record_count), buffer);
 	safe_unpack_time(&(buf->last_update), buffer);
 	buf->block_array = xmalloc(sizeof(block_info_t) * 
-		buf->record_count);
+				   buf->record_count);
 	for(i=0; i<buf->record_count; i++) {
 		if (_unpack_block_info(&(buf->block_array[i]), buffer)) 
 			goto unpack_error;
@@ -528,7 +528,7 @@ extern int slurm_select_init(void)
 	g_select_context = _select_context_create(select_type);
 	if ( g_select_context == NULL ) {
 		error( "cannot create node selection context for %s",
-			 select_type );
+		       select_type );
 		retval = SLURM_ERROR;
 		goto done;
 	}
@@ -540,7 +540,7 @@ extern int slurm_select_init(void)
 		retval = SLURM_ERROR;
 	}
 
- done:
+done:
 	slurm_mutex_unlock( &g_select_context_lock );
 	xfree(select_type);
 	return retval;
@@ -785,11 +785,11 @@ extern int select_g_select_nodeinfo_get(select_nodeinfo_t *nodeinfo,
 					enum node_states state,
 					void *data)
 {
-       if (slurm_select_init() < 0)
-               return SLURM_ERROR;
+	if (slurm_select_init() < 0)
+		return SLURM_ERROR;
 
-       return (*(g_select_context->ops.nodeinfo_get))
-	       (nodeinfo, dinfo, state, data);
+	return (*(g_select_context->ops.nodeinfo_get))
+		(nodeinfo, dinfo, state, data);
 }
 
 /* OK since the Cray XT could be done with either linear or cons_res
@@ -1206,10 +1206,10 @@ extern char *select_g_select_jobinfo_xstrdup(
  */
 extern int select_g_update_block (update_block_msg_t *block_desc_ptr)
 {
-       if (slurm_select_init() < 0)
-               return SLURM_ERROR;
+	if (slurm_select_init() < 0)
+		return SLURM_ERROR;
 
-       return (*(g_select_context->ops.update_block))(block_desc_ptr);
+	return (*(g_select_context->ops.update_block))(block_desc_ptr);
 }
 
 /* 
@@ -1218,10 +1218,10 @@ extern int select_g_update_block (update_block_msg_t *block_desc_ptr)
  */
 extern int select_g_update_sub_node (update_block_msg_t *block_desc_ptr)
 {
-       if (slurm_select_init() < 0)
-               return SLURM_ERROR;
+	if (slurm_select_init() < 0)
+		return SLURM_ERROR;
 
-       return (*(g_select_context->ops.update_sub_node))(block_desc_ptr);
+	return (*(g_select_context->ops.update_sub_node))(block_desc_ptr);
 }
 
 /* 
@@ -1234,11 +1234,11 @@ extern int select_g_get_info_from_plugin (enum select_plugindata_info dinfo,
 					  struct job_record *job_ptr,
 					  void *data)
 {
-       if (slurm_select_init() < 0)
-               return SLURM_ERROR;
+	if (slurm_select_init() < 0)
+		return SLURM_ERROR;
 
-       return (*(g_select_context->ops.get_info_from_plugin))
-	       (dinfo, job_ptr, data);
+	return (*(g_select_context->ops.get_info_from_plugin))
+		(dinfo, job_ptr, data);
 }
 
 /*
@@ -1265,7 +1265,7 @@ extern int select_g_update_node_config (int index)
 extern int select_g_update_node_state (int index, uint16_t state)
 {
 	if (slurm_select_init() < 0)
-               return SLURM_ERROR;
+		return SLURM_ERROR;
 
 	return (*(g_select_context->ops.update_node_state))(index, state);
 }
@@ -1277,7 +1277,7 @@ extern int select_g_update_node_state (int index, uint16_t state)
 extern int select_g_alter_node_cnt (enum select_node_cnt type, void *data)
 {
 	if (slurm_select_init() < 0)
-               return SLURM_ERROR;
+		return SLURM_ERROR;
 
 	if (type == SELECT_GET_NODE_SCALING) {
 		/* default to one, so most plugins don't have to */
diff --git a/src/common/slurm_accounting_storage.c b/src/common/slurm_accounting_storage.c
index 0cc1b6dcd69..712226e6304 100644
--- a/src/common/slurm_accounting_storage.c
+++ b/src/common/slurm_accounting_storage.c
@@ -2842,7 +2842,7 @@ extern void pack_acct_reservation_rec(void *in, uint16_t rpc_version,
 }
 
 extern int unpack_acct_reservation_rec(void **object, uint16_t rpc_version,
-				      Buf buffer)
+				       Buf buffer)
 {
 	uint32_t uint32_tmp;
 	acct_reservation_rec_t *object_ptr = 
@@ -4370,7 +4370,7 @@ extern void pack_acct_association_cond(void *in, uint16_t rpc_version,
 		if(object->parent_acct_list 
 		   && list_count(object->parent_acct_list)) 
 			packstr(list_peek(object->parent_acct_list), 
-			       buffer);
+				buffer);
 		else 
 			packnull(buffer);
 
@@ -6225,7 +6225,7 @@ unpack_error:
 }
 
 extern void pack_acct_reservation_cond(void *in, uint16_t rpc_version,
-				      Buf buffer)
+				       Buf buffer)
 {
 	acct_reservation_cond_t *object = (acct_reservation_cond_t *)in;
 	uint32_t count = NO_VAL;
@@ -6292,7 +6292,7 @@ extern void pack_acct_reservation_cond(void *in, uint16_t rpc_version,
 }
 
 extern int unpack_acct_reservation_cond(void **object, uint16_t rpc_version,
-				      Buf buffer)
+					Buf buffer)
 {
 	uint32_t uint32_tmp, count;
 	int i = 0;
@@ -7197,7 +7197,7 @@ extern void pack_acct_archive_cond(void *in, uint16_t rpc_version, Buf buffer)
 }
 
 extern int unpack_acct_archive_cond(void **object, uint16_t rpc_version,
-				   Buf buffer)
+				    Buf buffer)
 {
 	uint32_t uint32_tmp;
 	acct_archive_cond_t *object_ptr = 
@@ -8067,7 +8067,7 @@ extern int acct_storage_g_add_wckeys(void *db_conn, uint32_t uid,
 }
 
 extern int acct_storage_g_add_reservation(void *db_conn,
-					   acct_reservation_rec_t *resv)
+					  acct_reservation_rec_t *resv)
 {
 	if (slurm_acct_storage_init(NULL) < 0)
 		return NO_VAL;
@@ -8137,7 +8137,7 @@ extern List acct_storage_g_modify_wckeys(void *db_conn, uint32_t uid,
 }
 
 extern int acct_storage_g_modify_reservation(void *db_conn,
-					   acct_reservation_rec_t *resv)
+					     acct_reservation_rec_t *resv)
 {
 	if (slurm_acct_storage_init(NULL) < 0)
 		return NO_VAL;
@@ -8289,7 +8289,7 @@ extern List acct_storage_g_get_wckeys(void *db_conn, uint32_t uid,
 }
 
 extern List acct_storage_g_get_reservations(void *db_conn, uint32_t uid, 
-				      acct_reservation_cond_t *resv_cond)
+					    acct_reservation_cond_t *resv_cond)
 {
 	if (slurm_acct_storage_init(NULL) < 0)
 		return NULL;
diff --git a/src/common/slurm_auth.c b/src/common/slurm_auth.c
index c8121908040..873f63acb5b 100644
--- a/src/common/slurm_auth.c
+++ b/src/common/slurm_auth.c
@@ -150,7 +150,7 @@ slurm_auth_get_ops( slurm_auth_context_t c )
 	      "looking at all files",
 	      c->auth_type);
 	
-       /* Get the plugin list, if needed. */
+	/* Get the plugin list, if needed. */
         if ( c->plugin_list == NULL ) {
 		char *plugin_dir;
                 c->plugin_list = plugrack_create();
@@ -334,13 +334,13 @@ slurm_auth_init( char *auth_type )
         
         if ( slurm_auth_get_ops( g_context ) == NULL ) {
                 error( "cannot resolve %s plugin operations", 
-				auth_type );
+		       auth_type );
                 _slurm_auth_context_destroy( g_context );
                 g_context = NULL;
                 retval = SLURM_ERROR;
         }
 
- done:
+done:
 	xfree(auth_type_local);
         slurm_mutex_unlock( &context_lock );
         return retval;
diff --git a/src/common/slurm_cred.c b/src/common/slurm_cred.c
index 260863d58b8..2c55de2914a 100644
--- a/src/common/slurm_cred.c
+++ b/src/common/slurm_cred.c
@@ -68,7 +68,7 @@
 
 #ifndef __sbcast_cred_t_defined
 #  define  __sbcast_cred_t_defined
-   typedef struct sbcast_cred sbcast_cred_t;		/* opaque data type */
+typedef struct sbcast_cred sbcast_cred_t;		/* opaque data type */
 #endif
 
 /* 
@@ -308,7 +308,7 @@ _slurm_crypto_context_destroy( slurm_crypto_context_t *c )
 	 */
 	if ( c->plugin_list ) {
 		if ( plugrack_destroy( c->plugin_list ) != SLURM_SUCCESS ) {
-			 rc = SLURM_ERROR;
+			rc = SLURM_ERROR;
 		}
 	} else {
 		plugin_unload(c->cur_plugin);
@@ -351,7 +351,7 @@ _slurm_crypto_get_ops( slurm_crypto_context_t *c )
 	      "looking at all files",
 	      c->crypto_type);
 	
-       /* Get the plugin list, if needed. */
+	/* Get the plugin list, if needed. */
         if ( c->plugin_list == NULL ) {
 		char *plugin_dir;
                 c->plugin_list = plugrack_create();
@@ -415,7 +415,7 @@ static int _slurm_crypto_init(void)
 		retval = SLURM_ERROR;
 	}
 
-  done:
+done:
 	slurm_mutex_unlock( &g_crypto_context_lock );
 	xfree(crypto_type);
 
@@ -463,7 +463,7 @@ slurm_cred_creator_ctx_create(const char *path)
 	slurm_mutex_unlock(&ctx->mutex);
 	return ctx;
 
-    fail:
+fail:
 	slurm_mutex_unlock(&ctx->mutex);
 	slurm_cred_ctx_destroy(ctx);
 	error("Can not open data encryption key file %s", path);
@@ -493,7 +493,7 @@ slurm_cred_verifier_ctx_create(const char *path)
 	slurm_mutex_unlock(&ctx->mutex);
 	return ctx;
 
-    fail:
+fail:
 	slurm_mutex_unlock(&ctx->mutex);
 	slurm_cred_ctx_destroy(ctx);
 	error("Can not open data encryption key file %s", path);
@@ -626,29 +626,29 @@ slurm_cred_create(slurm_cred_ctx_t ctx, slurm_cred_arg_t *arg)
 	cred->job_mem = arg->job_mem;
 	cred->nodes  = xstrdup(arg->hostlist);
 #ifndef HAVE_BG
-{
-	int i, sock_recs = 0;
-	xassert(arg->job_nhosts);
-	for (i=0; i<arg->job_nhosts; i++) {
-		sock_recs += arg->sock_core_rep_count[i];
-		if (sock_recs >= arg->job_nhosts)
-			break;
+	{
+		int i, sock_recs = 0;
+		xassert(arg->job_nhosts);
+		for (i=0; i<arg->job_nhosts; i++) {
+			sock_recs += arg->sock_core_rep_count[i];
+			if (sock_recs >= arg->job_nhosts)
+				break;
+		}
+		i++;
+		cred->core_bitmap = bit_copy(arg->core_bitmap);
+		cred->core_array_size = i;
+		cred->cores_per_socket = xmalloc(sizeof(uint16_t) * i);
+		memcpy(cred->cores_per_socket, arg->cores_per_socket,
+		       (sizeof(uint16_t) * i));
+		cred->sockets_per_node = xmalloc(sizeof(uint16_t) * i);
+		memcpy(cred->sockets_per_node, arg->sockets_per_node,
+		       (sizeof(uint16_t) * i));
+		cred->sock_core_rep_count = xmalloc(sizeof(uint32_t) * i);
+		memcpy(cred->sock_core_rep_count, arg->sock_core_rep_count,
+		       (sizeof(uint32_t) * i));
+		cred->job_nhosts = arg->job_nhosts;
+		cred->job_hostlist = xstrdup(arg->job_hostlist);
 	}
-	i++;
-	cred->core_bitmap = bit_copy(arg->core_bitmap);
-	cred->core_array_size = i;
-	cred->cores_per_socket = xmalloc(sizeof(uint16_t) * i);
-	memcpy(cred->cores_per_socket, arg->cores_per_socket,
-	       (sizeof(uint16_t) * i));
-	cred->sockets_per_node = xmalloc(sizeof(uint16_t) * i);
-	memcpy(cred->sockets_per_node, arg->sockets_per_node,
-	       (sizeof(uint16_t) * i));
-	cred->sock_core_rep_count = xmalloc(sizeof(uint32_t) * i);
-	memcpy(cred->sock_core_rep_count, arg->sock_core_rep_count,
-	       (sizeof(uint32_t) * i));
-	cred->job_nhosts = arg->job_nhosts;
-	cred->job_hostlist = xstrdup(arg->job_hostlist);
-}
 #endif
 	cred->ctime  = time(NULL);
 
@@ -663,7 +663,7 @@ slurm_cred_create(slurm_cred_ctx_t ctx, slurm_cred_arg_t *arg)
 
 	return cred;
 
-    fail:
+fail:
 	slurm_mutex_unlock(&ctx->mutex);
 	slurm_mutex_unlock(&cred->mutex);
 	slurm_cred_destroy(cred);
@@ -735,28 +735,28 @@ slurm_cred_faker(slurm_cred_arg_t *arg)
 	cred->job_mem  = arg->job_mem;
 	cred->nodes    = xstrdup(arg->hostlist);
 #ifndef HAVE_BG
-{
-	int i, sock_recs = 0;
-	for (i=0; i<arg->job_nhosts; i++) {
-		sock_recs += arg->sock_core_rep_count[i];
-		if (sock_recs >= arg->job_nhosts)
-			break;
+	{
+		int i, sock_recs = 0;
+		for (i=0; i<arg->job_nhosts; i++) {
+			sock_recs += arg->sock_core_rep_count[i];
+			if (sock_recs >= arg->job_nhosts)
+				break;
+		}
+		i++;
+		cred->core_bitmap = bit_copy(arg->core_bitmap);
+		cred->core_array_size = i;
+		cred->cores_per_socket = xmalloc(sizeof(uint16_t) * i);
+		memcpy(cred->cores_per_socket, arg->cores_per_socket,
+		       (sizeof(uint16_t) * i));
+		cred->sockets_per_node = xmalloc(sizeof(uint16_t) * i);
+		memcpy(cred->sockets_per_node, arg->sockets_per_node,
+		       (sizeof(uint16_t) * i));
+		cred->sock_core_rep_count = xmalloc(sizeof(uint32_t) * i);
+		memcpy(cred->sock_core_rep_count, arg->sock_core_rep_count,
+		       (sizeof(uint32_t) * i));
+		cred->job_nhosts = arg->job_nhosts;
+		cred->job_hostlist = xstrdup(arg->job_hostlist);
 	}
-	i++;
-	cred->core_bitmap = bit_copy(arg->core_bitmap);
-	cred->core_array_size = i;
-	cred->cores_per_socket = xmalloc(sizeof(uint16_t) * i);
-	memcpy(cred->cores_per_socket, arg->cores_per_socket,
-	       (sizeof(uint16_t) * i));
-	cred->sockets_per_node = xmalloc(sizeof(uint16_t) * i);
-	memcpy(cred->sockets_per_node, arg->sockets_per_node,
-	       (sizeof(uint16_t) * i));
-	cred->sock_core_rep_count = xmalloc(sizeof(uint32_t) * i);
-	memcpy(cred->sock_core_rep_count, arg->sock_core_rep_count,
-	       (sizeof(uint32_t) * i));
-	cred->job_nhosts = arg->job_nhosts;
-	cred->job_hostlist = xstrdup(arg->job_hostlist);
-}
 #endif
 	cred->ctime  = time(NULL);
 	cred->siglen = SLURM_IO_KEY_SIZE;
@@ -923,7 +923,7 @@ slurm_cred_verify(slurm_cred_ctx_t ctx, slurm_cred_t *cred,
 
 	return SLURM_SUCCESS;
 
-    error:
+error:
 	errnum = slurm_get_errno();
 	slurm_mutex_unlock(&ctx->mutex);
 	slurm_mutex_unlock(&cred->mutex);
@@ -1055,7 +1055,7 @@ slurm_cred_revoke(slurm_cred_ctx_t ctx, uint32_t jobid, time_t time)
 	slurm_mutex_unlock(&ctx->mutex);
 	return SLURM_SUCCESS;
 
-    error:
+error:
 	slurm_mutex_unlock(&ctx->mutex);
 	return SLURM_FAILURE;
 }
@@ -1093,7 +1093,7 @@ slurm_cred_begin_expiration(slurm_cred_ctx_t ctx, uint32_t jobid)
 	slurm_mutex_unlock(&ctx->mutex);
 	return SLURM_SUCCESS;
 
-    error:
+error:
 	slurm_mutex_unlock(&ctx->mutex);
 	return SLURM_ERROR;
 }
@@ -1222,30 +1222,30 @@ slurm_cred_unpack(Buf buffer)
 	safe_unpackstr_xmalloc( &cred->nodes, &len,   buffer);
 	safe_unpack_time(       &cred->ctime,         buffer);
 #ifndef HAVE_BG
-{
-	uint32_t tot_core_cnt;
-	safe_unpack32(          &tot_core_cnt,        buffer);
-	safe_unpackstr_xmalloc( &bit_fmt,     &len,   buffer);
-	cred->core_bitmap = bit_alloc((bitoff_t) tot_core_cnt);
-	if (bit_unfmt(cred->core_bitmap, bit_fmt))
-		goto unpack_error;
-	xfree(bit_fmt);
-	safe_unpack16(          &cred->core_array_size, buffer);
-	if (cred->core_array_size) {
-                safe_unpack16_array(&cred->cores_per_socket, &len,  buffer);
-		if (len != cred->core_array_size)
-			goto unpack_error;
-                safe_unpack16_array(&cred->sockets_per_node, &len,  buffer);
-		if (len != cred->core_array_size)
-			goto unpack_error;
-                safe_unpack32_array(&cred->sock_core_rep_count, &len,  
-				    buffer);
-		if (len != cred->core_array_size)
+	{
+		uint32_t tot_core_cnt;
+		safe_unpack32(          &tot_core_cnt,        buffer);
+		safe_unpackstr_xmalloc( &bit_fmt,     &len,   buffer);
+		cred->core_bitmap = bit_alloc((bitoff_t) tot_core_cnt);
+		if (bit_unfmt(cred->core_bitmap, bit_fmt))
 			goto unpack_error;
+		xfree(bit_fmt);
+		safe_unpack16(          &cred->core_array_size, buffer);
+		if (cred->core_array_size) {
+			safe_unpack16_array(&cred->cores_per_socket, &len,  buffer);
+			if (len != cred->core_array_size)
+				goto unpack_error;
+			safe_unpack16_array(&cred->sockets_per_node, &len,  buffer);
+			if (len != cred->core_array_size)
+				goto unpack_error;
+			safe_unpack32_array(&cred->sock_core_rep_count, &len,  
+					    buffer);
+			if (len != cred->core_array_size)
+				goto unpack_error;
+		}
+		safe_unpack32(          &cred->job_nhosts,           buffer);
+		safe_unpackstr_xmalloc( &cred->job_hostlist, &len,   buffer);
 	}
-	safe_unpack32(          &cred->job_nhosts,           buffer);
-	safe_unpackstr_xmalloc( &cred->job_hostlist, &len,   buffer);
-}
 #endif
 	/* "sigp" must be last */
 	sigp = (char **) &cred->signature;
@@ -1256,7 +1256,7 @@ slurm_cred_unpack(Buf buffer)
 	slurm_mutex_unlock(&cred->mutex);
 	return cred;
 
-    unpack_error:
+unpack_error:
 	xfree(bit_fmt);
 	slurm_mutex_unlock(&cred->mutex);
 	slurm_cred_destroy(cred);
@@ -1313,21 +1313,21 @@ slurm_cred_print(slurm_cred_t *cred)
 	info("Cred: ctime         %s",  ctime(&cred->ctime) );
 	info("Cred: siglen        %u",  cred->siglen        );
 #ifndef HAVE_BG
-{
-	int i;
-	char str[128];
-	info("Cred: core_bitmap   %s", 
-	     bit_fmt(str, sizeof(str), cred->core_bitmap));
-	info("Cred: sockets_per_node, cores_per_socket, rep_count");
-	for (i=0; i<cred->core_array_size; i++) {
-		info("      socks:%u cores:%u reps:%u", 
-		     cred->sockets_per_node[i],
-		     cred->cores_per_socket[i],
-		     cred->sock_core_rep_count[i]);
+	{
+		int i;
+		char str[128];
+		info("Cred: core_bitmap   %s", 
+		     bit_fmt(str, sizeof(str), cred->core_bitmap));
+		info("Cred: sockets_per_node, cores_per_socket, rep_count");
+		for (i=0; i<cred->core_array_size; i++) {
+			info("      socks:%u cores:%u reps:%u", 
+			     cred->sockets_per_node[i],
+			     cred->cores_per_socket[i],
+			     cred->sock_core_rep_count[i]);
+		}
+		info("Cred: job_nhosts   %u",   cred->job_nhosts    );
+		info("Cred: job_hostlist %s",   cred->job_hostlist  );
 	}
-	info("Cred: job_nhosts   %u",   cred->job_nhosts    );
-	info("Cred: job_hostlist %s",   cred->job_hostlist  );
-}
 #endif
 	slurm_mutex_unlock(&cred->mutex);
 
@@ -1479,8 +1479,8 @@ _slurm_cred_sign(slurm_cred_ctx_t ctx, slurm_cred_t *cred)
 	buffer = init_buf(4096);
 	_pack_cred(cred, buffer);
 	rc = (*(g_crypto_context->ops.crypto_sign))(ctx->key, 
-			get_buf_data(buffer), get_buf_offset(buffer), 
-			&cred->signature, &cred->siglen);
+						    get_buf_data(buffer), get_buf_offset(buffer), 
+						    &cred->signature, &cred->siglen);
 	free_buf(buffer);
 
 	if (rc) {
@@ -1502,12 +1502,12 @@ _slurm_cred_verify_signature(slurm_cred_ctx_t ctx, slurm_cred_t *cred)
 	_pack_cred(cred, buffer);
 
 	rc = (*(g_crypto_context->ops.crypto_verify_sign))(ctx->key, 
-			get_buf_data(buffer), get_buf_offset(buffer),
-			cred->signature, cred->siglen);
+							   get_buf_data(buffer), get_buf_offset(buffer),
+							   cred->signature, cred->siglen);
 	if (rc && _exkey_is_valid(ctx)) {
 		rc = (*(g_crypto_context->ops.crypto_verify_sign))(ctx->exkey, 
-			get_buf_data(buffer), get_buf_offset(buffer),
-			cred->signature, cred->siglen);
+								   get_buf_data(buffer), get_buf_offset(buffer),
+								   cred->signature, cred->siglen);
 	}
 	free_buf(buffer);
 
@@ -1532,23 +1532,23 @@ _pack_cred(slurm_cred_t *cred, Buf buffer)
 	packstr(cred->nodes,   buffer);
 	pack_time(cred->ctime, buffer);
 #ifndef HAVE_BG
-{
-	uint32_t tot_core_cnt;
-	tot_core_cnt = bit_size(cred->core_bitmap);
-	pack32(tot_core_cnt, buffer);
-	pack_bit_fmt(cred->core_bitmap, buffer);
-	pack16(cred->core_array_size, buffer);
-	if (cred->core_array_size) {
-		pack16_array(cred->cores_per_socket, cred->core_array_size, 
-			     buffer);
-		pack16_array(cred->sockets_per_node, cred->core_array_size, 
-			     buffer);
-		pack32_array(cred->sock_core_rep_count, cred->core_array_size,
-			     buffer);
+	{
+		uint32_t tot_core_cnt;
+		tot_core_cnt = bit_size(cred->core_bitmap);
+		pack32(tot_core_cnt, buffer);
+		pack_bit_fmt(cred->core_bitmap, buffer);
+		pack16(cred->core_array_size, buffer);
+		if (cred->core_array_size) {
+			pack16_array(cred->cores_per_socket, cred->core_array_size, 
+				     buffer);
+			pack16_array(cred->sockets_per_node, cred->core_array_size, 
+				     buffer);
+			pack32_array(cred->sock_core_rep_count, cred->core_array_size,
+				     buffer);
+		}
+		pack32(cred->job_nhosts,    buffer);
+		packstr(cred->job_hostlist, buffer);
 	}
-	pack32(cred->job_nhosts,    buffer);
-	packstr(cred->job_hostlist, buffer);
-}
 #endif
 }
 
@@ -1588,7 +1588,7 @@ _credential_replayed(slurm_cred_ctx_t ctx, slurm_cred_t *cred)
 #ifdef DISABLE_LOCALTIME
 extern char * timestr (const time_t *tp, char *buf, size_t n)
 #else
-static char * timestr (const time_t *tp, char *buf, size_t n)
+	static char * timestr (const time_t *tp, char *buf, size_t n)
 #endif
 {
 	char fmt[] = "%y%m%d%H%M%S";
@@ -1738,7 +1738,7 @@ _clear_expired_job_states(slurm_cred_ctx_t ctx)
 			t3[0] = '\0';
 		}
 		debug3("job state %u: ctime:%s%s%s",
-		        j->jobid, timestr(&j->ctime, t1, 64), t2, t3);
+		       j->jobid, timestr(&j->ctime, t1, 64), t2, t3);
 
 		if (j->revoked && (now > j->expiration)) {
 			list_delete_item(i);
@@ -1816,7 +1816,7 @@ _cred_state_unpack_one(Buf buffer)
 	safe_unpack_time(&s->expiration, buffer);
 	return s;
 
-   unpack_error:
+unpack_error:
 	_cred_state_destroy(s);
 	return NULL;
 }
@@ -1866,7 +1866,7 @@ _job_state_unpack_one(Buf buffer)
 
 	return j;
 
-    unpack_error:
+unpack_error:
 	_job_state_destroy(j);
 	return NULL;
 }
@@ -1907,7 +1907,7 @@ _cred_state_unpack(slurm_cred_ctx_t ctx, Buf buffer)
 
 	return;
 
-    unpack_error:
+unpack_error:
 	error("Unable to unpack job credential state information");
 	return;
 }
@@ -1953,7 +1953,7 @@ _job_state_unpack(slurm_cred_ctx_t ctx, Buf buffer)
 
 	return;
 
-    unpack_error:
+unpack_error:
 	error("Unable to unpack job state information");
 	return;
 }
@@ -1975,7 +1975,7 @@ static void _pack_sbcast_cred(sbcast_cred_t *sbcast_cred, Buf buffer)
  *	including digital signature.
  * RET the sbcast credential or NULL on error */
 sbcast_cred_t *create_sbcast_cred(slurm_cred_ctx_t ctx, 
-				 uint32_t job_id, char *nodes)
+				  uint32_t job_id, char *nodes)
 {
 	Buf buffer;
 	int rc;
@@ -1995,8 +1995,8 @@ sbcast_cred_t *create_sbcast_cred(slurm_cred_ctx_t ctx,
 	buffer = init_buf(4096);
 	_pack_sbcast_cred(sbcast_cred, buffer);
 	rc = (*(g_crypto_context->ops.crypto_sign))(ctx->key,
-			get_buf_data(buffer), get_buf_offset(buffer),
-                        &sbcast_cred->signature, &sbcast_cred->siglen);
+						    get_buf_data(buffer), get_buf_offset(buffer),
+						    &sbcast_cred->signature, &sbcast_cred->siglen);
 	free_buf(buffer);
 
 	if (rc) {
@@ -2070,8 +2070,8 @@ int extract_sbcast_cred(slurm_cred_ctx_t ctx,
 		/* NOTE: the verification checks that the credential was 
 		 * created by SlurmUser or root */
 		rc = (*(g_crypto_context->ops.crypto_verify_sign))(ctx->key,
-				get_buf_data(buffer), get_buf_offset(buffer),
-     	                   sbcast_cred->signature, sbcast_cred->siglen);
+								   get_buf_data(buffer), get_buf_offset(buffer),
+								   sbcast_cred->signature, sbcast_cred->siglen);
 		free_buf(buffer);
 
 		if (rc) {
@@ -2084,7 +2084,7 @@ int extract_sbcast_cred(slurm_cred_ctx_t ctx,
 		 * and reduces the possibility of a duplicate value */
 		for (i=0; i<sbcast_cred->siglen; i+=2) {
 			sig_num += (sbcast_cred->signature[i] << 8) +
-				    sbcast_cred->signature[i+1];
+				sbcast_cred->signature[i+1];
 		}
 		/* add to cache */
 		for (i=0; i<SBCAST_CACHE_SIZE; i++) {
@@ -2105,13 +2105,13 @@ int extract_sbcast_cred(slurm_cred_ctx_t ctx,
 
 			/* overwrite the oldest */
 			cache_expire[oldest_cache_inx] = sbcast_cred->
-							 expiration;
+				expiration;
 			cache_value[oldest_cache_inx]  = sig_num;
 		}
 	} else {
 		for (i=0; i<sbcast_cred->siglen; i+=2) {
 			sig_num += (sbcast_cred->signature[i] << 8) +
-				    sbcast_cred->signature[i+1];
+				sbcast_cred->signature[i+1];
 		}
 		for (i=0; i<SBCAST_CACHE_SIZE; i++) {
 			if ((cache_expire[i] == sbcast_cred->expiration) &&
diff --git a/src/common/slurm_jobacct_gather.c b/src/common/slurm_jobacct_gather.c
index 96d7ebe5769..98810b0c3a7 100644
--- a/src/common/slurm_jobacct_gather.c
+++ b/src/common/slurm_jobacct_gather.c
@@ -150,7 +150,7 @@ _slurm_jobacct_gather_context_destroy( slurm_jobacct_gather_context_t *c )
 	 */
 	if ( c->plugin_list ) {
 		if ( plugrack_destroy( c->plugin_list ) != SLURM_SUCCESS ) {
-			 rc = SLURM_ERROR;
+			rc = SLURM_ERROR;
 		}
 	} else {
 		plugin_unload(c->cur_plugin);
@@ -205,7 +205,7 @@ _slurm_jobacct_gather_get_ops( slurm_jobacct_gather_context_t *c )
 	      "looking at all files",
 	      c->jobacct_gather_type);
 	
-       /* Get the plugin list, if needed. */
+	/* Get the plugin list, if needed. */
         if ( c->plugin_list == NULL ) {
 		char *plugin_dir;
                 c->plugin_list = plugrack_create();
@@ -274,7 +274,7 @@ static int _slurm_jobacct_gather_init(void)
 		retval = SLURM_ERROR;
 	}
 
-  done:
+done:
 	slurm_mutex_unlock( &g_jobacct_gather_context_lock );
 	xfree(jobacct_gather_type);
 
diff --git a/src/common/slurm_jobcomp.c b/src/common/slurm_jobcomp.c
index 9f6755d5544..1815a0cb829 100644
--- a/src/common/slurm_jobcomp.c
+++ b/src/common/slurm_jobcomp.c
@@ -126,7 +126,7 @@ _slurm_jobcomp_context_destroy( slurm_jobcomp_context_t c )
 	 */
 	if ( c->plugin_list ) {
 		if ( plugrack_destroy( c->plugin_list ) != SLURM_SUCCESS ) {
-			 rc = SLURM_ERROR;
+			rc = SLURM_ERROR;
 		}
 	} else {
 		plugin_unload(c->cur_plugin);
@@ -259,7 +259,7 @@ g_slurm_jobcomp_init( char *jobcomp_loc )
 		retval = SLURM_ERROR;
 	}
 
-  done:
+done:
 	if ( g_context )
 		retval = (*(g_context->ops.set_loc))(jobcomp_loc);
 	slurm_mutex_unlock( &context_lock );
@@ -277,7 +277,7 @@ g_slurm_jobcomp_fini(void)
 	_slurm_jobcomp_context_destroy ( g_context );
 	g_context = NULL;
 
-  done:
+done:
 	slurm_mutex_unlock( &context_lock );
 	return SLURM_SUCCESS;
 }
@@ -305,7 +305,7 @@ g_slurm_jobcomp_errno(void)
 
 	slurm_mutex_lock( &context_lock );
 	if ( g_context )
-		 retval = (*(g_context->ops.sa_errno))();
+		retval = (*(g_context->ops.sa_errno))();
 	else {
 		error ("slurm_jobcomp plugin context not initialized");
 		retval = ENOENT;
diff --git a/src/common/slurm_priority.c b/src/common/slurm_priority.c
index 093718973fd..bbf3eeb8eba 100644
--- a/src/common/slurm_priority.c
+++ b/src/common/slurm_priority.c
@@ -48,7 +48,7 @@ typedef struct slurm_priority_ops {
 	int      (*set_max_usage)  (uint32_t procs, uint32_t half_life);
 	void     (*set_assoc_usage)(acct_association_rec_t *assoc);
 	List	 (*get_priority_factors)
-				   (priority_factors_request_msg_t *req_msg);
+	(priority_factors_request_msg_t *req_msg);
 
 } slurm_priority_ops_t;
 
@@ -263,8 +263,8 @@ extern void priority_g_set_assoc_usage(acct_association_rec_t *assoc)
 	if (slurm_priority_init() < 0)
 		return;
 
-       (*(g_priority_context->ops.set_assoc_usage))(assoc);
-       return;
+	(*(g_priority_context->ops.set_assoc_usage))(assoc);
+	return;
 }
 
 extern List priority_g_get_priority_factors_list(
diff --git a/src/common/slurm_protocol_api.c b/src/common/slurm_protocol_api.c
index 341e4957233..3eba3f44d41 100644
--- a/src/common/slurm_protocol_api.c
+++ b/src/common/slurm_protocol_api.c
@@ -174,7 +174,7 @@ int slurm_api_set_default_config(void)
 	}
 	proto_conf = &proto_conf_default;
 
-      cleanup:
+cleanup:
 	slurm_conf_unlock();
 	return rc;
 }
@@ -1077,9 +1077,9 @@ int slurm_get_is_association_based_accounting(void)
 	} else {
 		conf = slurm_conf_lock();
 		if(!strcasecmp(conf->accounting_storage_type, 
-			      "accounting_storage/slurmdbd")
+			       "accounting_storage/slurmdbd")
 		   || !strcasecmp(conf->accounting_storage_type,
-				 "accounting_storage/mysql")) 
+				  "accounting_storage/mysql")) 
 			enforce = 1;
 		slurm_conf_unlock();
 	}
@@ -1877,8 +1877,8 @@ slurm_fd slurm_open_controller_conn_spec(enum controller_id dest)
 void slurm_get_controller_addr_spec(enum controller_id dest, slurm_addr *addr)
 {
 	addr = (dest == PRIMARY_CONTROLLER) ? 
-		  &proto_conf->primary_controller : 
-		  &proto_conf->secondary_controller;
+		&proto_conf->primary_controller : 
+		&proto_conf->secondary_controller;
 } 
 
 /* In the bsd implmentation maps directly to a accept call 
@@ -1970,7 +1970,7 @@ int slurm_receive_msg(slurm_fd fd, slurm_msg_t *msg, int timeout)
 		slurm_get_peer_addr(fd, &resp_addr);
 		slurm_print_slurm_addr(&resp_addr, addr_str, sizeof(addr_str));
 		error("Invalid Protocol Version %u from uid=%d at %s", 
-			header.version, uid, addr_str);
+		      header.version, uid, addr_str);
 		free_buf(buffer);
 		rc = SLURM_PROTOCOL_VERSION_ERROR;
 		goto total_return;
@@ -1993,7 +1993,7 @@ int slurm_receive_msg(slurm_fd fd, slurm_msg_t *msg, int timeout)
 	
 	if ((auth_cred = g_slurm_auth_unpack(buffer)) == NULL) {
 		error( "authentication: %s ",
-			g_slurm_auth_errstr(g_slurm_auth_errno(NULL)));
+		       g_slurm_auth_errstr(g_slurm_auth_errno(NULL)));
 		free_buf(buffer);
 		rc = ESLURM_PROTOCOL_INCOMPLETE_PACKET;
 		goto total_return;
@@ -2136,7 +2136,7 @@ List slurm_receive_msgs(slurm_fd fd, int steps, int timeout)
 		slurm_get_peer_addr(fd, &resp_addr);
 		slurm_print_slurm_addr(&resp_addr, addr_str, sizeof(addr_str));
 		error("Invalid Protocol Version %u from uid=%d at %s", 
-			header.version, uid, addr_str);
+		      header.version, uid, addr_str);
 		free_buf(buffer);
 		rc = SLURM_PROTOCOL_VERSION_ERROR;
 		goto total_return;
@@ -2159,7 +2159,7 @@ List slurm_receive_msgs(slurm_fd fd, int steps, int timeout)
 	
 	if((auth_cred = g_slurm_auth_unpack(buffer)) == NULL) {
 		error( "authentication: %s ",
-			g_slurm_auth_errstr(g_slurm_auth_errno(NULL)));
+		       g_slurm_auth_errstr(g_slurm_auth_errno(NULL)));
 		free_buf(buffer);
 		rc = ESLURM_PROTOCOL_INCOMPLETE_PACKET;
 		goto total_return;
@@ -2323,7 +2323,7 @@ int slurm_receive_msg_and_forward(slurm_fd fd, slurm_addr *orig_addr,
 		slurm_get_peer_addr(fd, &resp_addr);
 		slurm_print_slurm_addr(&resp_addr, addr_str, sizeof(addr_str));
 		error("Invalid Protocol Version %u from uid=%d at %s", 
-			header.version, uid, addr_str);
+		      header.version, uid, addr_str);
 		free_buf(buffer);
 		rc = SLURM_PROTOCOL_VERSION_ERROR;
 		goto total_return;
@@ -2389,7 +2389,7 @@ int slurm_receive_msg_and_forward(slurm_fd fd, slurm_addr *orig_addr,
 	
 	if ((auth_cred = g_slurm_auth_unpack(buffer)) == NULL) {
 		error( "authentication: %s ",
-			g_slurm_auth_errstr(g_slurm_auth_errno(NULL)));
+		       g_slurm_auth_errstr(g_slurm_auth_errno(NULL)));
 		free_buf(buffer);
 		rc = ESLURM_PROTOCOL_INCOMPLETE_PACKET;
 		goto total_return;
@@ -2494,7 +2494,7 @@ int slurm_send_node_msg(slurm_fd fd, slurm_msg_t * msg)
 		auth_cred = g_slurm_auth_create(NULL, 2, NULL);
 	if (auth_cred == NULL) {
 		error("authentication: %s",
-		       g_slurm_auth_errstr(g_slurm_auth_errno(NULL)) );
+		      g_slurm_auth_errstr(g_slurm_auth_errno(NULL)) );
 		slurm_seterrno_ret(SLURM_PROTOCOL_AUTHENTICATION_ERROR);
 	}
 
@@ -2519,7 +2519,7 @@ int slurm_send_node_msg(slurm_fd fd, slurm_msg_t * msg)
 	(void) g_slurm_auth_destroy(auth_cred);
 	if (rc) {
 		error("authentication: %s",
-		       g_slurm_auth_errstr(g_slurm_auth_errno(auth_cred)));
+		      g_slurm_auth_errstr(g_slurm_auth_errno(auth_cred)));
 		free_buf(buffer);
 		slurm_seterrno_ret(SLURM_PROTOCOL_AUTHENTICATION_ERROR);
 	}
@@ -2846,7 +2846,7 @@ void slurm_pack_slurm_addr_array(slurm_addr * slurm_address,
  * returns		- SLURM error code
  */
 int slurm_unpack_slurm_addr_array(slurm_addr ** slurm_address,
-			    uint32_t * size_val, Buf buffer)
+				  uint32_t * size_val, Buf buffer)
 {
 	int i = 0;
 	uint32_t nl;
@@ -3071,7 +3071,7 @@ int slurm_send_recv_controller_msg(slurm_msg_t *req, slurm_msg_t *resp)
 			break;
 	}
 			
-      cleanup:
+cleanup:
 	if (rc != 0) 
  		_remap_slurmctld_errno(); 
 		
@@ -3136,7 +3136,7 @@ int slurm_send_only_controller_msg(slurm_msg_t *req)
 		}
 	}
 
-      cleanup:
+cleanup:
 	if (rc != SLURM_SUCCESS)
 		_remap_slurmctld_errno();
 	return rc;
@@ -3203,20 +3203,20 @@ List slurm_send_recv_msgs(const char *nodelist, slurm_msg_t *msg,
 	}
 	
 #ifdef HAVE_FRONT_END
-{
-        char *name = NULL;
-	/* only send to the front end node */
-	name = nodelist_nth_host(nodelist, 0);
-	if (!name) {
-		error("slurm_send_recv_msgs: "
-		      "can't get the first name out of %s",
-		      nodelist);
-		return NULL;
-	}
+	{
+		char *name = NULL;
+		/* only send to the front end node */
+		name = nodelist_nth_host(nodelist, 0);
+		if (!name) {
+			error("slurm_send_recv_msgs: "
+			      "can't get the first name out of %s",
+			      nodelist);
+			return NULL;
+		}
 /* 	info("got %s and %s", nodelist, name); */
-	hl = hostlist_create(name);
-	free(name);
-}
+		hl = hostlist_create(name);
+		free(name);
+	}
 #else
 /* 	info("total sending to %s",nodelist); */
 	hl = hostlist_create(nodelist);
diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c
index 9df019e770c..7137790ed13 100644
--- a/src/common/slurm_protocol_defs.c
+++ b/src/common/slurm_protocol_defs.c
@@ -288,19 +288,19 @@ void slurm_free_job_info_request_msg(job_info_request_msg_t *msg)
 }
 
 void slurm_free_job_step_info_request_msg(
-		job_step_info_request_msg_t *msg)
+	job_step_info_request_msg_t *msg)
 {
 	xfree(msg);
 }
 
 void inline slurm_free_node_info_request_msg(
-		node_info_request_msg_t *msg)
+	node_info_request_msg_t *msg)
 {
 	xfree(msg);
 }
 
 void inline slurm_free_part_info_request_msg(
-		part_info_request_msg_t *msg)
+	part_info_request_msg_t *msg)
 {
 	xfree(msg);
 }
@@ -764,56 +764,56 @@ void inline slurm_free_suspend_msg(suspend_msg_t *msg)
 extern char *job_reason_string(enum job_state_reason inx)
 {
 	switch (inx) {
-		case WAIT_NO_REASON:
-			return "None";
-		case WAIT_PRIORITY:
-			return "Priority";
-		case WAIT_DEPENDENCY:
-			return "Dependency";
-		case WAIT_RESOURCES:
-			return "Resources";
-		case WAIT_PART_NODE_LIMIT:
-			return "PartitionNodeLimit";
-		case WAIT_PART_TIME_LIMIT:
-			return "PartitionTimeLimit";
-		case WAIT_PART_STATE:
-			return "PartitionDown";
-		case WAIT_HELD:
-			return "JobHeld";
-		case WAIT_TIME:
-			return "BeginTime";
-		case WAIT_LICENSES:
-			return "Licenses";
-		case WAIT_ASSOC_JOB_LIMIT:
-			return "AssociationJobLimit";
-		case WAIT_ASSOC_RESOURCE_LIMIT:
-			return "AssociationResourceLimit";
-		case WAIT_ASSOC_TIME_LIMIT:
-			return "AssociationTimeLimit";
-		case WAIT_RESERVATION:
-			return "Reservation";
-		case WAIT_NODE_NOT_AVAIL:
-			return "ReqNodeNotAvail";
-		case FAIL_DOWN_PARTITION:
-			return "PartitionDown";
-		case FAIL_DOWN_NODE:
-			return "NodeDown";
-		case FAIL_BAD_CONSTRAINTS:
-			return "BadConstraints";
-		case FAIL_SYSTEM:
-			return "SystemFailure";
-		case FAIL_LAUNCH:
-			return "JobLaunchFailure";
-		case FAIL_EXIT_CODE:
-			return "NonZeroExitCode";
-		case FAIL_TIMEOUT:
-			return "TimeLimit";
-		case FAIL_INACTIVE_LIMIT:
-			return "InactiveLimit";
-		case FAIL_BANK_ACCOUNT:
-			return "InvalidBankAccount";
-		default:
-			return "?";
+	case WAIT_NO_REASON:
+		return "None";
+	case WAIT_PRIORITY:
+		return "Priority";
+	case WAIT_DEPENDENCY:
+		return "Dependency";
+	case WAIT_RESOURCES:
+		return "Resources";
+	case WAIT_PART_NODE_LIMIT:
+		return "PartitionNodeLimit";
+	case WAIT_PART_TIME_LIMIT:
+		return "PartitionTimeLimit";
+	case WAIT_PART_STATE:
+		return "PartitionDown";
+	case WAIT_HELD:
+		return "JobHeld";
+	case WAIT_TIME:
+		return "BeginTime";
+	case WAIT_LICENSES:
+		return "Licenses";
+	case WAIT_ASSOC_JOB_LIMIT:
+		return "AssociationJobLimit";
+	case WAIT_ASSOC_RESOURCE_LIMIT:
+		return "AssociationResourceLimit";
+	case WAIT_ASSOC_TIME_LIMIT:
+		return "AssociationTimeLimit";
+	case WAIT_RESERVATION:
+		return "Reservation";
+	case WAIT_NODE_NOT_AVAIL:
+		return "ReqNodeNotAvail";
+	case FAIL_DOWN_PARTITION:
+		return "PartitionDown";
+	case FAIL_DOWN_NODE:
+		return "NodeDown";
+	case FAIL_BAD_CONSTRAINTS:
+		return "BadConstraints";
+	case FAIL_SYSTEM:
+		return "SystemFailure";
+	case FAIL_LAUNCH:
+		return "JobLaunchFailure";
+	case FAIL_EXIT_CODE:
+		return "NonZeroExitCode";
+	case FAIL_TIMEOUT:
+		return "TimeLimit";
+	case FAIL_INACTIVE_LIMIT:
+		return "InactiveLimit";
+	case FAIL_BANK_ACCOUNT:
+		return "InvalidBankAccount";
+	default:
+		return "?";
 	}
 }
 
@@ -845,24 +845,24 @@ char *job_state_string(uint16_t inx)
 
 	/* Process JOB_STATE_BASE */
 	switch (inx & JOB_STATE_BASE) {
-		case JOB_PENDING:
-			return "PENDING";
-		case JOB_RUNNING:
-			return "RUNNING";
-		case JOB_SUSPENDED:
-			return "SUSPENDED";
-		case JOB_COMPLETE:
-			return "COMPLETED";
-		case JOB_CANCELLED:
-			return "CANCELLED";
-		case JOB_FAILED:
-			return "FAILED";
-		case JOB_TIMEOUT:
-			return "TIMEOUT";
-		case JOB_NODE_FAIL:
-			return "NODE_FAIL";
-		default:
-			return "?";
+	case JOB_PENDING:
+		return "PENDING";
+	case JOB_RUNNING:
+		return "RUNNING";
+	case JOB_SUSPENDED:
+		return "SUSPENDED";
+	case JOB_COMPLETE:
+		return "COMPLETED";
+	case JOB_CANCELLED:
+		return "CANCELLED";
+	case JOB_FAILED:
+		return "FAILED";
+	case JOB_TIMEOUT:
+		return "TIMEOUT";
+	case JOB_NODE_FAIL:
+		return "NODE_FAIL";
+	default:
+		return "?";
 	}
 }
 
@@ -876,24 +876,24 @@ char *job_state_string_compact(uint16_t inx)
 
 	/* Process JOB_STATE_BASE */
 	switch (inx & JOB_STATE_BASE) {
-		case JOB_PENDING:
-			return "PD";
-		case JOB_RUNNING:
-			return "R";
-		case JOB_SUSPENDED:
-			return "S";
-		case JOB_COMPLETE:
-			return "CD";
-		case JOB_CANCELLED:
-			return "CA";
-		case JOB_FAILED:
-			return "F";
-		case JOB_TIMEOUT:
-			return "TO";
-		case JOB_NODE_FAIL:
-			return "NF";
-		default:
-			return "?";
+	case JOB_PENDING:
+		return "PD";
+	case JOB_RUNNING:
+		return "R";
+	case JOB_SUSPENDED:
+		return "S";
+	case JOB_COMPLETE:
+		return "CD";
+	case JOB_CANCELLED:
+		return "CA";
+	case JOB_FAILED:
+		return "F";
+	case JOB_TIMEOUT:
+		return "TO";
+	case JOB_NODE_FAIL:
+		return "NF";
+	default:
+		return "?";
 	}
 }
 
@@ -1299,24 +1299,24 @@ extern char *bg_block_state_string(uint16_t state)
 #ifdef HAVE_BG
 	switch ((rm_partition_state_t)state) {
 #ifdef HAVE_BGL
-		case RM_PARTITION_BUSY: 
-			return "BUSY";
+	case RM_PARTITION_BUSY: 
+		return "BUSY";
 #else
-		case RM_PARTITION_REBOOTING: 
-			return "REBOOTING";
+	case RM_PARTITION_REBOOTING: 
+		return "REBOOTING";
 #endif
-		case RM_PARTITION_CONFIGURING:
-			return "CONFIG";
-		case RM_PARTITION_DEALLOCATING:
-			return "DEALLOC";
-		case RM_PARTITION_ERROR:
-			return "ERROR";
-		case RM_PARTITION_FREE:
-			return "FREE";
-		case RM_PARTITION_NAV:
-			return "NAV";
-		case RM_PARTITION_READY:
-			return "READY";
+	case RM_PARTITION_CONFIGURING:
+		return "CONFIG";
+	case RM_PARTITION_DEALLOCATING:
+		return "DEALLOC";
+	case RM_PARTITION_ERROR:
+		return "ERROR";
+	case RM_PARTITION_FREE:
+		return "FREE";
+	case RM_PARTITION_NAV:
+		return "NAV";
+	case RM_PARTITION_READY:
+		return "READY";
 	}
 #endif
 
@@ -1331,7 +1331,7 @@ extern char *bg_block_state_string(uint16_t state)
  * NOTE: buffer is loaded by slurm_allocate_resources
  */
 void slurm_free_resource_allocation_response_msg ( 
-				resource_allocation_response_msg_t * msg)
+	resource_allocation_response_msg_t * msg)
 {
 	if (msg) {
 		select_g_select_jobinfo_free(msg->select_jobinfo);
@@ -1384,7 +1384,7 @@ void slurm_free_job_alloc_info_response_msg(job_alloc_info_response_msg_t *msg)
  * NOTE: buffer is loaded by slurm_job_step_create
  */
 void slurm_free_job_step_create_response_msg(
-		job_step_create_response_msg_t * msg)
+	job_step_create_response_msg_t * msg)
 {
 	if (msg) {
 		xfree(msg->resv_ports);
@@ -1755,7 +1755,7 @@ extern void slurm_free_stat_jobacct_msg(stat_jobacct_msg_t *msg)
 }
 
 void inline slurm_free_block_info_request_msg(
-                block_info_request_msg_t *msg)
+	block_info_request_msg_t *msg)
 {
 	xfree(msg);
 }
diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c
index 76a5c4e43cf..51d0987bda0 100644
--- a/src/common/slurm_protocol_pack.c
+++ b/src/common/slurm_protocol_pack.c
@@ -186,9 +186,9 @@ static int _unpack_launch_tasks_request_msg(launch_tasks_request_msg_t **
 
 
 static void _pack_task_user_managed_io_stream_msg(task_user_managed_io_msg_t *
-					   msg, Buf buffer);
+						  msg, Buf buffer);
 static int _unpack_task_user_managed_io_stream_msg(task_user_managed_io_msg_t **
-					    msg_ptr, Buf buffer);
+						   msg_ptr, Buf buffer);
 
 static void _pack_cancel_tasks_msg(kill_tasks_msg_t * msg, Buf buffer);
 static int _unpack_cancel_tasks_msg(kill_tasks_msg_t ** msg_ptr, Buf buffer);
@@ -237,9 +237,9 @@ static int _unpack_job_info_request_msg(job_info_request_msg_t**
 					msg, Buf buffer);
 
 static void _pack_block_info_req_msg(block_info_request_msg_t *
-					   msg, Buf buffer);
+				     msg, Buf buffer);
 static int _unpack_block_info_req_msg(block_info_request_msg_t **
-					    msg, Buf buffer);
+				      msg, Buf buffer);
 
 static void _pack_job_step_info_req_msg(job_step_info_request_msg_t * msg,
 					Buf buffer);
@@ -320,7 +320,7 @@ static int  _unpack_srun_step_missing_msg(srun_step_missing_msg_t ** msg_ptr,
 
 static void _pack_srun_timeout_msg(srun_timeout_msg_t * msg, Buf buffer);
 static int  _unpack_srun_timeout_msg(srun_timeout_msg_t ** msg_ptr, 
-					Buf buffer);
+				     Buf buffer);
 
 static void _pack_srun_user_msg(srun_user_msg_t * msg, Buf buffer);
 static int  _unpack_srun_user_msg(srun_user_msg_t ** msg_ptr, Buf buffer);
@@ -389,7 +389,7 @@ static int  _unpack_resv_name_msg(reservation_name_msg_t ** msg, Buf buffer);
 
 static void _pack_topo_info_msg(topo_info_response_msg_t *msg, Buf buffer);
 static int  _unpack_topo_info_msg(topo_info_response_msg_t **msg,
-				 Buf buffer);
+				  Buf buffer);
 
 static void _pack_job_sbcast_cred_msg(job_sbcast_cred_msg_t *msg, Buf buffer);
 static int  _unpack_job_sbcast_cred_msg(job_sbcast_cred_msg_t **msg, 
@@ -587,7 +587,7 @@ pack_msg(slurm_msg_t const *msg, Buf buffer)
 	case REQUEST_DELETE_RESERVATION:
 	case RESPONSE_CREATE_RESERVATION:
 		_pack_resv_name_msg((reservation_name_msg_t *) msg->
-				     data, buffer);
+				    data, buffer);
 		break;
 	case REQUEST_UPDATE_BLOCK:
 		node_select_pack_block_info((block_info_t *)msg->data, buffer);
@@ -655,7 +655,7 @@ pack_msg(slurm_msg_t const *msg, Buf buffer)
 		break;
 	case RESPONSE_STEP_LAYOUT:
 		pack_slurm_step_layout((slurm_step_layout_t *)msg->data, 
-					buffer);
+				       buffer);
 		break;
 	case REQUEST_SIGNAL_JOB:
 		_pack_signal_job_msg((signal_job_msg_t *) msg->data, buffer);
@@ -753,7 +753,7 @@ pack_msg(slurm_msg_t const *msg, Buf buffer)
 		break;
 	case REQUEST_CHECKPOINT_TASK_COMP:
 		_pack_checkpoint_task_comp((checkpoint_task_comp_msg_t *)msg->data, 
-				      buffer);
+					   buffer);
 		break;
 	case RESPONSE_CHECKPOINT:
 	case RESPONSE_CHECKPOINT_COMP:
@@ -970,7 +970,7 @@ unpack_msg(slurm_msg_t * msg, Buf buffer)
 	case REQUEST_DELETE_RESERVATION:
 	case RESPONSE_CREATE_RESERVATION:
 		rc = _unpack_resv_name_msg((reservation_name_msg_t **)
-					     &(msg->data), buffer);
+					   &(msg->data), buffer);
 		break;
 	case REQUEST_UPDATE_BLOCK:
 		rc = node_select_unpack_block_info(
@@ -978,7 +978,7 @@ unpack_msg(slurm_msg_t * msg, Buf buffer)
 		break;
 	case RESPONSE_RESERVATION_INFO:
 		rc = _unpack_reserve_info_msg((reserve_info_msg_t **)
-					     &(msg->data), buffer);
+					      &(msg->data), buffer);
 		break;
 	case REQUEST_LAUNCH_TASKS:
 		rc = _unpack_launch_tasks_request_msg(
@@ -1140,7 +1140,7 @@ unpack_msg(slurm_msg_t * msg, Buf buffer)
 		break;
 	case SRUN_STEP_MISSING:
 		rc = _unpack_srun_step_missing_msg((srun_step_missing_msg_t **)
-						    & msg->data, buffer);
+						   & msg->data, buffer);
 		break;
 	case SRUN_TIMEOUT:
 		rc = _unpack_srun_timeout_msg((srun_timeout_msg_t **)
@@ -1148,7 +1148,7 @@ unpack_msg(slurm_msg_t * msg, Buf buffer)
 		break;
 	case SRUN_USER_MSG:
 		rc = _unpack_srun_user_msg((srun_user_msg_t **)
-						& msg->data, buffer);
+					   & msg->data, buffer);
 		break;
 	case REQUEST_CHECKPOINT:
 		rc = _unpack_checkpoint_msg((checkpoint_msg_t **)
@@ -1228,11 +1228,11 @@ unpack_msg(slurm_msg_t * msg, Buf buffer)
 	case REQUEST_TRIGGER_SET:
 	case REQUEST_TRIGGER_CLEAR:
 		rc = _unpack_trigger_msg((trigger_info_msg_t **) 
-					  &msg->data, buffer);
+					 &msg->data, buffer);
 		break;
 	case RESPONSE_SLURMD_STATUS:
 		rc = _unpack_slurmd_status((slurmd_status_t **)
-					&msg->data, buffer);
+					   &msg->data, buffer);
 		break;
 	case REQUEST_JOB_NOTIFY:
 		rc =  _unpack_job_notify((job_notify_msg_t **)
@@ -1598,7 +1598,7 @@ unpack_error:
 
 static void
 _pack_priority_factors_response_msg(priority_factors_response_msg_t * msg,
-						Buf buffer)
+				    Buf buffer)
 {
 	ListIterator itr = NULL;
 	priority_factors_object_t *factors = NULL;
@@ -1623,7 +1623,7 @@ static void _priority_factors_resp_list_del(void *x)
 
 static int
 _unpack_priority_factors_response_msg(priority_factors_response_msg_t ** msg,
-						  Buf buffer)
+				      Buf buffer)
 {
 	uint32_t count = NO_VAL;
 	int i = 0;
@@ -3601,7 +3601,7 @@ _pack_job_alloc_info_msg(job_alloc_info_msg_t * job_desc_ptr, Buf buffer)
 
 static int
 _unpack_job_alloc_info_msg(job_alloc_info_msg_t **
-			 job_desc_buffer_ptr, Buf buffer)
+			   job_desc_buffer_ptr, Buf buffer)
 {
 	job_alloc_info_msg_t *job_desc_ptr;
 
@@ -4360,7 +4360,7 @@ _pack_block_info_req_msg(block_info_request_msg_t *msg, Buf buffer)
 
 static int
 _unpack_block_info_req_msg(block_info_request_msg_t **msg, 
-				 Buf buffer)
+			   Buf buffer)
 {
 	block_info_request_msg_t *node_sel_info;
 
@@ -5193,17 +5193,17 @@ static int  _unpack_trigger_msg(trigger_info_msg_t ** msg_ptr , Buf buffer)
 
 	safe_unpack32  (&msg->record_count, buffer);
 	msg->trigger_array = xmalloc(sizeof(trigger_info_t) *
-			msg->record_count);
+				     msg->record_count);
 	for (i=0; i<msg->record_count; i++) {
 		safe_unpack32(&msg->trigger_array[i].trig_id,   buffer);
 		safe_unpack16(&msg->trigger_array[i].res_type,  buffer);
 		safe_unpackstr_xmalloc(&msg->trigger_array[i].res_id, 
-				&uint32_tmp, buffer);
+				       &uint32_tmp, buffer);
 		safe_unpack16(&msg->trigger_array[i].trig_type, buffer);
 		safe_unpack16(&msg->trigger_array[i].offset,    buffer);
 		safe_unpack32(&msg->trigger_array[i].user_id,   buffer);
 		safe_unpackstr_xmalloc(&msg->trigger_array[i].program, 
-				&uint32_tmp, buffer);
+				       &uint32_tmp, buffer);
 	}
 	*msg_ptr = msg; 
 	return SLURM_SUCCESS;
@@ -5293,7 +5293,7 @@ static int  _unpack_kvs_data(struct kvs_comm_set **msg_ptr, Buf buffer)
 
 	safe_unpack16(&msg->host_cnt, buffer);
 	msg->kvs_host_ptr = xmalloc(sizeof(struct kvs_hosts) *
-			msg->host_cnt);
+				    msg->host_cnt);
 	for (i=0; i<msg->host_cnt; i++) {
 		if (_unpack_kvs_host_rec(&msg->kvs_host_ptr[i], buffer))
 			goto unpack_error;
@@ -5511,7 +5511,7 @@ _unpack_set_debug_level_msg(set_debug_level_msg_t ** msg_ptr, Buf buffer)
 	safe_unpack32(&msg->debug_level, buffer);
 	return SLURM_SUCCESS;
 	
- unpack_error:
+unpack_error:
 	slurm_free_set_debug_level_msg(msg);
 	*msg_ptr = NULL;
 	return SLURM_ERROR;
@@ -5571,7 +5571,7 @@ _unpack_will_run_response_msg(will_run_response_msg_t ** msg_ptr, Buf buffer)
 	*msg_ptr = msg;
 	return SLURM_SUCCESS;
 
-  unpack_error:
+unpack_error:
 	slurm_free_will_run_response_msg(msg);
 	*msg_ptr = NULL;
 	return SLURM_ERROR;
diff --git a/src/common/slurm_step_layout.c b/src/common/slurm_step_layout.c
index f4def08324a..3fbcd3d8fe4 100644
--- a/src/common/slurm_step_layout.c
+++ b/src/common/slurm_step_layout.c
@@ -66,7 +66,7 @@ static int _task_layout_block(slurm_step_layout_t *step_layout,
 static int _task_layout_cyclic(slurm_step_layout_t *step_layout, 
 			       uint16_t *cpus);
 static int _task_layout_plane(slurm_step_layout_t *step_layout,
-			       uint16_t *cpus);
+			      uint16_t *cpus);
 #ifndef HAVE_FRONT_END
 static int _task_layout_hostfile(slurm_step_layout_t *step_layout,
 				 const char *arbitrary_nodes);
@@ -665,13 +665,13 @@ static int _task_layout_cyclic(slurm_step_layout_t *step_layout,
  *                     12 13 14 15  etc.
  */
 static int _task_layout_plane(slurm_step_layout_t *step_layout,
-			       uint16_t *cpus)
+			      uint16_t *cpus)
 {
 	int i, j, k, taskid = 0;
 
 	debug3("_task_layout_plane plane_size %u node_cnt %u task_cnt %u",
-		step_layout->plane_size,
-		step_layout->node_cnt, step_layout->task_cnt);
+	       step_layout->plane_size,
+	       step_layout->node_cnt, step_layout->task_cnt);
 
 	if (step_layout->plane_size <= 0)
 	        return SLURM_ERROR;
@@ -681,7 +681,7 @@ static int _task_layout_plane(slurm_step_layout_t *step_layout,
 
 	for (i=0; i<step_layout->node_cnt; i++) {
 		step_layout->tids[i] = xmalloc(sizeof(uint32_t)
-						* step_layout->task_cnt);
+					       * step_layout->task_cnt);
 	}
 
 	taskid = 0;
@@ -743,8 +743,8 @@ extern char *slurm_step_layout_type_name(task_dist_states_t task_dist)
 		return "Plane";
 		break;
 	case SLURM_DIST_CYCLIC_CYCLIC:/* distribute tasks 1 per node:
-				   round robin: same for lowest
-				   level of logical processor (lllp) */
+					 round robin: same for lowest
+					 level of logical processor (lllp) */
 		return "CCyclic";
 		break;
 	case SLURM_DIST_CYCLIC_BLOCK: /* cyclic for node and block for lllp  */
diff --git a/src/common/slurm_topology.c b/src/common/slurm_topology.c
index 08317b6b61b..f50059acca5 100644
--- a/src/common/slurm_topology.c
+++ b/src/common/slurm_topology.c
@@ -207,7 +207,7 @@ slurm_topo_init( void )
 	g_topo_context = slurm_topo_context_create( topo_type );
 	if ( g_topo_context == NULL ) {
 		error( "cannot create topology context for %s",
-			 topo_type );
+		       topo_type );
 		retval = SLURM_ERROR;
 		goto done;
 	}
@@ -219,7 +219,7 @@ slurm_topo_init( void )
 		retval = SLURM_ERROR;
 	}
 
- done:
+done:
 	slurm_mutex_unlock( &g_topo_context_lock );
 	xfree(topo_type);
 	return retval;
diff --git a/src/common/util-net.c b/src/common/util-net.c
index 370227df03c..a2e8e66d40e 100644
--- a/src/common/util-net.c
+++ b/src/common/util-net.c
@@ -68,144 +68,144 @@ static pthread_mutex_t hostentLock = PTHREAD_MUTEX_INITIALIZER;
 static int copy_hostent(const struct hostent *src, char *dst, int len);
 #ifndef NDEBUG
 static int validate_hostent_copy(
-    const struct hostent *src, const struct hostent *dst);
+	const struct hostent *src, const struct hostent *dst);
 #endif /* !NDEBUG */
 
 
 struct hostent * get_host_by_name(const char *name,
-    void *buf, int buflen, int *h_err)
+				  void *buf, int buflen, int *h_err)
 {
 /*  gethostbyname() is not thread-safe, and there is no frelling standard
  *    for gethostbyname_r() -- the arg list varies from system to system!
  */
-    struct hostent *hptr;
-    int n = 0;
-
-    assert(name != NULL);
-    assert(buf != NULL);
-
-    slurm_mutex_lock(&hostentLock);
-    if ((hptr = gethostbyname(name)))
-        n = copy_hostent(hptr, buf, buflen);
-    if (h_err)
-        *h_err = h_errno;
-    slurm_mutex_unlock(&hostentLock);
-
-    if (n < 0) {
-        errno = ERANGE;
-        return(NULL);
-    }
-    return(hptr ? (struct hostent *) buf : NULL);
+	struct hostent *hptr;
+	int n = 0;
+
+	assert(name != NULL);
+	assert(buf != NULL);
+
+	slurm_mutex_lock(&hostentLock);
+	if ((hptr = gethostbyname(name)))
+		n = copy_hostent(hptr, buf, buflen);
+	if (h_err)
+		*h_err = h_errno;
+	slurm_mutex_unlock(&hostentLock);
+
+	if (n < 0) {
+		errno = ERANGE;
+		return(NULL);
+	}
+	return(hptr ? (struct hostent *) buf : NULL);
 }
 
 
 struct hostent * get_host_by_addr(const char *addr, int len, int type,
-    void *buf, int buflen, int *h_err)
+				  void *buf, int buflen, int *h_err)
 {
 /*  gethostbyaddr() is not thread-safe, and there is no frelling standard
  *    for gethostbyaddr_r() -- the arg list varies from system to system!
  */
-    struct hostent *hptr;
-    int n = 0;
-
-    assert(addr != NULL);
-    assert(buf != NULL);
-
-    slurm_mutex_lock(&hostentLock);
-    if ((hptr = gethostbyaddr(addr, len, type)))
-        n = copy_hostent(hptr, buf, buflen);
-    if (h_err)
-        *h_err = h_errno;
-    slurm_mutex_unlock(&hostentLock);
-
-    if (n < 0) {
-        errno = ERANGE;
-        return(NULL);
-    }
-    return(hptr ? (struct hostent *) buf : NULL);
+	struct hostent *hptr;
+	int n = 0;
+
+	assert(addr != NULL);
+	assert(buf != NULL);
+
+	slurm_mutex_lock(&hostentLock);
+	if ((hptr = gethostbyaddr(addr, len, type)))
+		n = copy_hostent(hptr, buf, buflen);
+	if (h_err)
+		*h_err = h_errno;
+	slurm_mutex_unlock(&hostentLock);
+
+	if (n < 0) {
+		errno = ERANGE;
+		return(NULL);
+	}
+	return(hptr ? (struct hostent *) buf : NULL);
 }
 
 
 const char * host_strerror(int h_err)
 {
-    if (h_err == HOST_NOT_FOUND)
-        return("Unknown host");
-    else if (h_err == TRY_AGAIN)
-        return("Transient host name lookup failure");
-    else if (h_err == NO_RECOVERY)
-        return("Unknown server error");
-    else if ((h_err == NO_ADDRESS) || (h_err == NO_DATA))
-        return("No address associated with name");
-    return("Unknown error");
+	if (h_err == HOST_NOT_FOUND)
+		return("Unknown host");
+	else if (h_err == TRY_AGAIN)
+		return("Transient host name lookup failure");
+	else if (h_err == NO_RECOVERY)
+		return("Unknown server error");
+	else if ((h_err == NO_ADDRESS) || (h_err == NO_DATA))
+		return("No address associated with name");
+	return("Unknown error");
 }
 
 
 int host_name_to_addr4(const char *name, struct in_addr *addr)
 {
-    struct hostent *hptr;
-    unsigned char buf[HOSTENT_SIZE];
-
-    assert(name != NULL);
-    assert(addr != NULL);
-
-    if (!(hptr = get_host_by_name(name, buf, sizeof(buf), NULL)))
-        return(-1);
-    if (hptr->h_length > 4) {
-        errno = ERANGE;
-        return(-1);
-    }
-    memcpy(addr, hptr->h_addr_list[0], hptr->h_length);
-    return(0);
+	struct hostent *hptr;
+	unsigned char buf[HOSTENT_SIZE];
+
+	assert(name != NULL);
+	assert(addr != NULL);
+
+	if (!(hptr = get_host_by_name(name, buf, sizeof(buf), NULL)))
+		return(-1);
+	if (hptr->h_length > 4) {
+		errno = ERANGE;
+		return(-1);
+	}
+	memcpy(addr, hptr->h_addr_list[0], hptr->h_length);
+	return(0);
 }
 
 
 char * host_addr4_to_name(const struct in_addr *addr, char *dst, int dstlen)
 {
-    struct hostent *hptr;
-    unsigned char buf[HOSTENT_SIZE];
-
-    assert(addr != NULL);
-    assert(dst != NULL);
-
-    if (!(hptr = get_host_by_addr((char *) addr, 4, AF_INET,
-      buf, sizeof(buf), NULL)))
-        return(NULL);
-    if (strlen(hptr->h_name) >= dstlen) {
-        errno = ERANGE;
-        return(NULL);
-    }
-    strcpy(dst, hptr->h_name);
-    return(dst);
+	struct hostent *hptr;
+	unsigned char buf[HOSTENT_SIZE];
+
+	assert(addr != NULL);
+	assert(dst != NULL);
+
+	if (!(hptr = get_host_by_addr((char *) addr, 4, AF_INET,
+				      buf, sizeof(buf), NULL)))
+		return(NULL);
+	if (strlen(hptr->h_name) >= dstlen) {
+		errno = ERANGE;
+		return(NULL);
+	}
+	strcpy(dst, hptr->h_name);
+	return(dst);
 }
 
 
 char * host_name_to_cname(const char *src, char *dst, int dstlen)
 {
-    struct hostent *hptr;
-    unsigned char buf[HOSTENT_SIZE];
-    struct in_addr addr;
-
-    assert(src != NULL);
-    assert(dst != NULL);
-
-    if (!(hptr = get_host_by_name(src, buf, sizeof(buf), NULL)))
-        return(NULL);
-    /*
-     *  If 'src' is an ip-addr string, it will simply be copied to h_name.
-     *    So, we need to perform a reverse query based on the in_addr
-     *    in order to obtain the canonical name of the host.
-     *  Besides, this additional query helps protect against DNS spoofing.
-     */
-    memcpy(&addr, hptr->h_addr_list[0], hptr->h_length);
-    if (!(hptr = get_host_by_addr((char *) &addr, 4, AF_INET,
-      buf, sizeof(buf), NULL)))
-        return(NULL);
-    if (strlen(hptr->h_name) >= dstlen) {
-        errno = ERANGE;
-        return(NULL);
-    }
-    strcpy(dst, hptr->h_name);
-    return(dst);
+	struct hostent *hptr;
+	unsigned char buf[HOSTENT_SIZE];
+	struct in_addr addr;
+
+	assert(src != NULL);
+	assert(dst != NULL);
+
+	if (!(hptr = get_host_by_name(src, buf, sizeof(buf), NULL)))
+		return(NULL);
+	/*
+	 *  If 'src' is an ip-addr string, it will simply be copied to h_name.
+	 *    So, we need to perform a reverse query based on the in_addr
+	 *    in order to obtain the canonical name of the host.
+	 *  Besides, this additional query helps protect against DNS spoofing.
+	 */
+	memcpy(&addr, hptr->h_addr_list[0], hptr->h_length);
+	if (!(hptr = get_host_by_addr((char *) &addr, 4, AF_INET,
+				      buf, sizeof(buf), NULL)))
+		return(NULL);
+	if (strlen(hptr->h_name) >= dstlen) {
+		errno = ERANGE;
+		return(NULL);
+	}
+	strcpy(dst, hptr->h_name);
+	return(dst);
 }
 
 
@@ -220,100 +220,100 @@ static int copy_hostent(const struct hostent *src, char *buf, int len)
  *    in such a way as to ensure everything is properly word-aligned.
  *    There is a method to the madness.
  */
-    struct hostent *dst;
-    int n;
-    char **p, **q;
-
-    assert(src != NULL);
-    assert(buf != NULL);
-
-    dst = (struct hostent *) buf;
-    if ((len -= sizeof(struct hostent)) < 0)
-        return(-1);
-    dst->h_addrtype = src->h_addrtype;
-    dst->h_length = src->h_length;
-    buf += sizeof(struct hostent);
-
-    /*  Reserve space for h_aliases[].
-     */
-    dst->h_aliases = (char **) buf;
-    for (p=src->h_aliases, q=dst->h_aliases, n=0; *p; p++, q++, n++) {;}
-    if ((len -= ++n * sizeof(char *)) < 0)
-        return(-1);
-    buf = (char *) (q + 1);
-
-    /*  Reserve space for h_addr_list[].
-     */
-    dst->h_addr_list = (char **) buf;
-    for (p=src->h_addr_list, q=dst->h_addr_list, n=0; *p; p++, q++, n++) {;}
-    if ((len -= ++n * sizeof(char *)) < 0)
-        return(-1);
-    buf = (char *) (q + 1);
-
-    /*  Copy h_addr_list[] in_addr structs.
-     */
-    for (p=src->h_addr_list, q=dst->h_addr_list; *p; p++, q++) {
-        if ((len -= src->h_length) < 0)
-            return(-1);
-        memcpy(buf, *p, src->h_length);
-        *q = buf;
-        buf += src->h_length;
-    }
-    *q = NULL;
-
-    /*  Copy h_aliases[] strings.
-     */
-    for (p=src->h_aliases, q=dst->h_aliases; *p; p++, q++) {
-        n = strlcpy(buf, *p, len);
-        *q = buf;
-        buf += ++n;                     /* allow for trailing NUL char */
-        if ((len -= n) < 0)
-            return(-1);
-    }
-    *q = NULL;
-
-    /*  Copy h_name string.
-     */
-    dst->h_name = buf;
-    n = strlcpy(buf, src->h_name, len);
-    buf += ++n;                         /* allow for trailing NUL char */
-    if ((len -= n) < 0)
-        return(-1);
-
-    assert(validate_hostent_copy(src, dst) >= 0);
-    return(0);
+	struct hostent *dst;
+	int n;
+	char **p, **q;
+
+	assert(src != NULL);
+	assert(buf != NULL);
+
+	dst = (struct hostent *) buf;
+	if ((len -= sizeof(struct hostent)) < 0)
+		return(-1);
+	dst->h_addrtype = src->h_addrtype;
+	dst->h_length = src->h_length;
+	buf += sizeof(struct hostent);
+
+	/*  Reserve space for h_aliases[].
+	 */
+	dst->h_aliases = (char **) buf;
+	for (p=src->h_aliases, q=dst->h_aliases, n=0; *p; p++, q++, n++) {;}
+	if ((len -= ++n * sizeof(char *)) < 0)
+		return(-1);
+	buf = (char *) (q + 1);
+
+	/*  Reserve space for h_addr_list[].
+	 */
+	dst->h_addr_list = (char **) buf;
+	for (p=src->h_addr_list, q=dst->h_addr_list, n=0; *p; p++, q++, n++) {;}
+	if ((len -= ++n * sizeof(char *)) < 0)
+		return(-1);
+	buf = (char *) (q + 1);
+
+	/*  Copy h_addr_list[] in_addr structs.
+	 */
+	for (p=src->h_addr_list, q=dst->h_addr_list; *p; p++, q++) {
+		if ((len -= src->h_length) < 0)
+			return(-1);
+		memcpy(buf, *p, src->h_length);
+		*q = buf;
+		buf += src->h_length;
+	}
+	*q = NULL;
+
+	/*  Copy h_aliases[] strings.
+	 */
+	for (p=src->h_aliases, q=dst->h_aliases; *p; p++, q++) {
+		n = strlcpy(buf, *p, len);
+		*q = buf;
+		buf += ++n;                     /* allow for trailing NUL char */
+		if ((len -= n) < 0)
+			return(-1);
+	}
+	*q = NULL;
+
+	/*  Copy h_name string.
+	 */
+	dst->h_name = buf;
+	n = strlcpy(buf, src->h_name, len);
+	buf += ++n;                         /* allow for trailing NUL char */
+	if ((len -= n) < 0)
+		return(-1);
+
+	assert(validate_hostent_copy(src, dst) >= 0);
+	return(0);
 }
 
 
 #ifndef NDEBUG
 static int validate_hostent_copy(
-    const struct hostent *src, const struct hostent *dst)
+	const struct hostent *src, const struct hostent *dst)
 {
 /*  Validates the src hostent struct has been successfully copied into dst.
  *  Returns 0 if the copy is good; o/w, returns -1.
  */
-    char **p, **q;
-
-    assert(src != NULL);
-    assert(dst != NULL);
-
-    if (!dst->h_name)
-        return(-1);
-    if (src->h_name == dst->h_name)
-        return(-1);
-    if (strcmp(src->h_name, dst->h_name))
-        return(-1);
-    if (src->h_addrtype != dst->h_addrtype)
-        return(-1);
-    if (src->h_length != dst->h_length)
-        return(-1);
-    for (p=src->h_aliases, q=dst->h_aliases; *p; p++, q++)
-        if ((!q) || (p == q) || (strcmp(*p, *q)))
-            return(-1);
-    for (p=src->h_addr_list, q=dst->h_addr_list; *p; p++, q++)
-        if ((!q) || (p == q) || (memcmp(*p, *q, src->h_length)))
-            return(-1);
-    return(0);
+	char **p, **q;
+
+	assert(src != NULL);
+	assert(dst != NULL);
+
+	if (!dst->h_name)
+		return(-1);
+	if (src->h_name == dst->h_name)
+		return(-1);
+	if (strcmp(src->h_name, dst->h_name))
+		return(-1);
+	if (src->h_addrtype != dst->h_addrtype)
+		return(-1);
+	if (src->h_length != dst->h_length)
+		return(-1);
+	for (p=src->h_aliases, q=dst->h_aliases; *p; p++, q++)
+		if ((!q) || (p == q) || (strcmp(*p, *q)))
+			return(-1);
+	for (p=src->h_addr_list, q=dst->h_addr_list; *p; p++, q++)
+		if ((!q) || (p == q) || (memcmp(*p, *q, src->h_length)))
+			return(-1);
+	return(0);
 }
 #endif /* !NDEBUG */
 
@@ -323,22 +323,22 @@ int inet_pton(int family, const char *str, void *addr)
 {
 /*  cf. Stevens UNPv1 p72.
  */
-    struct in_addr tmpaddr;
+	struct in_addr tmpaddr;
 
-    if (family != AF_INET) {
-        errno = EAFNOSUPPORT;
-        return(-1);
-    }
+	if (family != AF_INET) {
+		errno = EAFNOSUPPORT;
+		return(-1);
+	}
 #ifdef HAVE_INET_ATON
-    if (!inet_aton(str, &tmpaddr))
-        return(0);
+	if (!inet_aton(str, &tmpaddr))
+		return(0);
 #else /* !HAVE_INET_ATON */
-    if ((tmpaddr.s_addr = inet_addr(str)) == -1)
-        return(0);
+	if ((tmpaddr.s_addr = inet_addr(str)) == -1)
+		return(0);
 #endif /* !HAVE_INET_ATON */
 
-    memcpy(addr, &tmpaddr, sizeof(struct in_addr));
-    return(1);
+	memcpy(addr, &tmpaddr, sizeof(struct in_addr));
+	return(1);
 }
 #endif /* !HAVE_INET_PTON */
 
@@ -348,21 +348,21 @@ const char * inet_ntop(int family, const void *addr, char *str, size_t len)
 {
 /*  cf. Stevens UNPv1 p72.
  */
-    const unsigned char *p = (const unsigned char *) addr;
-    char tmpstr[INET_ADDRSTRLEN];
-
-    assert(str != NULL);
-
-    if (family != AF_INET) {
-        errno = EAFNOSUPPORT;
-        return(NULL);
-    }
-    snprintf(tmpstr, sizeof(tmpstr), "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
-    if (strlen(tmpstr) >= len) {
-        errno = ENOSPC;
-        return(NULL);
-    }
-    strcpy(str, tmpstr);
-    return(str);
+	const unsigned char *p = (const unsigned char *) addr;
+	char tmpstr[INET_ADDRSTRLEN];
+
+	assert(str != NULL);
+
+	if (family != AF_INET) {
+		errno = EAFNOSUPPORT;
+		return(NULL);
+	}
+	snprintf(tmpstr, sizeof(tmpstr), "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
+	if (strlen(tmpstr) >= len) {
+		errno = ENOSPC;
+		return(NULL);
+	}
+	strcpy(str, tmpstr);
+	return(str);
 }
 #endif /* !HAVE_INET_NTOP */
diff --git a/src/srun/allocate.c b/src/srun/allocate.c
index e2e763c4f84..75d99e6f99f 100644
--- a/src/srun/allocate.c
+++ b/src/srun/allocate.c
@@ -99,7 +99,7 @@ static void  _intr_handler(int signo);
 #ifdef HAVE_BG
 #define POLL_SLEEP 3			/* retry interval in seconds  */
 static int _wait_bluegene_block_ready(
-			resource_allocation_response_msg_t *alloc);
+	resource_allocation_response_msg_t *alloc);
 static int _blocks_dealloc(void);
 #endif
 
@@ -179,7 +179,7 @@ static bool _retry(void)
 {
 	static int  retries = 0;
 	static char *msg = "Slurm controller not responding, "
-		           "sleeping and retrying.";
+		"sleeping and retrying.";
 
 	if (errno == ESLURM_ERROR_ON_DESC_TO_RECORD_COPY) {
 		if (retries == 0)
@@ -239,7 +239,7 @@ static int _wait_bluegene_block_ready(resource_allocation_response_msg_t *alloc)
 	for (i=0; (cur_delay < max_delay); i++) {
 		if (i == 1)
 			debug("Waiting for block %s to become ready for job",
-			     block_id);
+			      block_id);
 		if (i) {
 			sleep(POLL_SLEEP);
 			rc = _blocks_dealloc();
@@ -474,7 +474,7 @@ existing_allocation(void)
                         error ("SLURM job %u has expired.", old_job_id);
                 else
                         error ("Unable to confirm allocation for job %u: %m",
-                              old_job_id);
+			       old_job_id);
                 info ("Check SLURM_JOB_ID environment variable "
                       "for expired or invalid job.");
                 exit(error_exit);
@@ -758,7 +758,7 @@ create_job_step(srun_job_t *job, bool use_all_cpus)
 		break;
 	default:
 		job->ctx_params.task_dist = (job->ctx_params.task_count <= 
-			job->ctx_params.node_count) 
+					     job->ctx_params.node_count) 
 			? SLURM_DIST_CYCLIC : SLURM_DIST_BLOCK;
 		opt.distribution = job->ctx_params.task_dist;
 		break;
-- 
GitLab