From 3f914a21d14c6d18b985229dd29d3e21dae91d0e Mon Sep 17 00:00:00 2001
From: Etienne Brateau <etienne.brateau@ensiie.fr>
Date: Mon, 4 Feb 2019 21:56:00 +0100
Subject: [PATCH] move strwordx into strings file

---
 include/log.h           |  1 -
 include/utils/strings.h |  1 +
 src/log.c               | 25 -------------------------
 src/utils/strings.c     | 26 ++++++++++++++++++++++++++
 4 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/include/log.h b/include/log.h
index 15e5be7..330eb6f 100644
--- a/include/log.h
+++ b/include/log.h
@@ -10,7 +10,6 @@
 void pen();
 void report(int num, char *s);
 void log_setmode(const char *s);
-void strwordx(char *buf, char *wrd);
 long getint(char *s, long def);
 void sortshints(short *x, short *y);
 long glowcol(log_nrec *n, long def);
diff --git a/include/utils/strings.h b/include/utils/strings.h
index 85c32b3..5fd6bdb 100644
--- a/include/utils/strings.h
+++ b/include/utils/strings.h
@@ -51,6 +51,7 @@ void strcomment (char *s, char* bracket);
 void strcompress (char *s, char *chars, int all);
 void strdispose (char **sp);
 void strchange (char** sp, char *);
+void strwordx(char *buf, char *wrd);
 
 /**
  * \deprecated
diff --git a/src/log.c b/src/log.c
index af72f37..677165b 100644
--- a/src/log.c
+++ b/src/log.c
@@ -427,31 +427,6 @@ void log_setmode(const char *s)
 		drawstr2(across + menux3, line2, modename);
 }
 
-void strwordx(char *buf, char *wrd)
-{
-	size_t i;
-	char *str1;
-	char *str2;
-
-	str1 = malloc(strlen(buf) + 1);
-	str2 = malloc(strlen(buf) + 1);
-	strcpy(str1, strltrim(strrtrim(strcpy(str2, buf))));
-	strcpy(buf, str1);
-	free(str1);
-	free(str2);
-
-	if (*buf != '"')
-	{
-		strword(buf, wrd);
-		return;
-	}
-	i = strposc(buf, '"', 2L);
-	if (i == 0)
-		i = strlen(buf) + 1;
-	strpart(wrd, buf, 2, i - 1);
-	strcpy_overlap(buf, buf + i);
-}
-
 static void unprobe()
 {
 	gg.probenode = NULL;
diff --git a/src/utils/strings.c b/src/utils/strings.c
index ef91bd9..8397f5c 100644
--- a/src/utils/strings.c
+++ b/src/utils/strings.c
@@ -564,3 +564,29 @@ char *strcpy_overlap(char *dst, char *src)
 	} while (1);
 	return dst;
 }
+
+void strwordx(char *buf, char *wrd)
+{
+	size_t i;
+	char *str1;
+	char *str2;
+
+	str1 = malloc(strlen(buf) + 1);
+	str2 = malloc(strlen(buf) + 1);
+	strcpy(str1, strltrim(strrtrim(strcpy(str2, buf))));
+	strcpy(buf, str1);
+	free(str1);
+	free(str2);
+
+	if (*buf != '"')
+	{
+		strword(buf, wrd);
+		return;
+	}
+	i = strposc(buf, '"', 2L);
+	if (i == 0)
+		i = strlen(buf) + 1;
+	strpart(wrd, buf, 2, i - 1);
+	strcpy_overlap(buf, buf + i);
+}
+
-- 
GitLab