From 753b1450742a24dae5072b5c628dc74ed6405890 Mon Sep 17 00:00:00 2001
From: Etienne Brateau <etienne.brateau@ensiie.fr>
Date: Fri, 25 Jan 2019 01:13:47 +0100
Subject: [PATCH] reintent utils/misc

---
 src/utils/misc.c | 94 ++++++++++++++++++++++++------------------------
 1 file changed, 47 insertions(+), 47 deletions(-)

diff --git a/src/utils/misc.c b/src/utils/misc.c
index ab82e37..5a3c267 100644
--- a/src/utils/misc.c
+++ b/src/utils/misc.c
@@ -11,22 +11,22 @@
 
 void misc_getioerrmsg(char *s, long i)
 {
-  sprintf(s, "misc_getioerrmsg Error number %ld", i);
+	sprintf(s, "misc_getioerrmsg Error number %ld", i);
 }
 
 #if defined __FreeBSD__ || defined __bsdi__
 
 char *cuserid(char *s)
 {
-   char *sp;
-   static char sbuf[L_cuserid + 1];
+	char *sp;
+	static char sbuf[L_cuserid + 1];
 
-   if ((sp = getenv("USER")) == NULL) {
-     if (s != NULL)
-       s[0] = '\0';
-     return NULL;
-   }
-   return strncpy(s != NULL ? s : sbuf, sp, L_cuserid);
+	if ((sp = getenv("USER")) == NULL) {
+		if (s != NULL)
+			s[0] = '\0';
+		return NULL;
+	}
+	return strncpy(s != NULL ? s : sbuf, sp, L_cuserid);
 }
 
 #endif
@@ -40,33 +40,33 @@ char *cuserid(char *s)
  */
 char *tilde_expand(char *s)
 {
-char *name;
-char *ret = NULL;
-size_t len = 0;
-struct passwd *pw;
+	char *name;
+	char *ret = NULL;
+	size_t len = 0;
+	struct passwd *pw;
 
-  if (*s == '~') {
-    if (strlen(s) > 1)
-      len = strcspn(s+1, "/");
-    if (len > 0) {
-      name = (char *) Malloc(len + 1);
-      strncpy(name, s+1, len);
-      name[len] = '\0';
-      pw = getpwnam(name);
-      Free(name);
-    } else {
-      pw = getpwuid( geteuid() );
-    }
-    if (pw != NULL) {
-      ret = (char *) Malloc(strlen(pw->pw_dir) + strlen(s) - len);
-      strcpy(ret,pw->pw_dir);
-      if (strlen(s) > len + 1)
-        strcat(ret, s + len + 1);
-    }
-  }
-  if (ret == NULL)
-    ret = strdup(s);
-  return ret;
+	if (*s == '~') {
+		if (strlen(s) > 1)
+			len = strcspn(s+1, "/");
+		if (len > 0) {
+			name = (char *) Malloc(len + 1);
+			strncpy(name, s+1, len);
+			name[len] = '\0';
+			pw = getpwnam(name);
+			Free(name);
+		} else {
+			pw = getpwuid( geteuid() );
+		}
+		if (pw != NULL) {
+			ret = (char *) Malloc(strlen(pw->pw_dir) + strlen(s) - len);
+			strcpy(ret,pw->pw_dir);
+			if (strlen(s) > len + 1)
+				strcat(ret, s + len + 1);
+		}
+	}
+	if (ret == NULL)
+		ret = strdup(s);
+	return ret;
 }
 
 #else
@@ -76,19 +76,19 @@ struct passwd *pw;
  */
 char *tilde_expand(char *s)
 {
-char *hp;
-char *ret = NULL;
+	char *hp;
+	char *ret = NULL;
 
-  if (*s == '~' && (hp = getenv("HOME")) != NULL) {
-    if ((ret = (char *) Malloc(strlen(hp) + strlen(s))) != NULL) {
-      strcpy(ret, hp);
-      if (strlen(s) > 1)
-        strcat(ret, s + 1);
-    }
-  }
-  if (ret == NULL)
-    ret = strdup(s);
-  return ret;
+	if (*s == '~' && (hp = getenv("HOME")) != NULL) {
+		if ((ret = (char *) Malloc(strlen(hp) + strlen(s))) != NULL) {
+			strcpy(ret, hp);
+			if (strlen(s) > 1)
+				strcat(ret, s + 1);
+		}
+	}
+	if (ret == NULL)
+		ret = strdup(s);
+	return ret;
 }
 
 #endif
-- 
GitLab