summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-03-09 18:04:49 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-03-09 18:04:49 (GMT)
commitdc8a2b19dbb32bfe49b1ff6640cc609238b392ca (patch)
tree2103c99baeb3b792bc82fc3db28bd16ecf72b70e /src/common
parentf8f804cf7ff9a62404b843cf303c762101572784 (diff)
Stored and loaded panels attributes using the global configuration.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/extstr.c27
-rw-r--r--src/common/extstr.h7
2 files changed, 34 insertions, 0 deletions
diff --git a/src/common/extstr.c b/src/common/extstr.c
index 9986ec1..ed5b971 100644
--- a/src/common/extstr.c
+++ b/src/common/extstr.c
@@ -220,6 +220,33 @@ char *strrpl(char *haystack, const char *needle1, const char *needle2)
/******************************************************************************
* *
+* Paramètres : str = chaîne de caractères à manipuler. [OUT] *
+* *
+* Description : Bascule toute une chaîne de caractères en (min|maj)uscules. *
+* *
+* Retour : Pointeur sur la chaîne fournie. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+char *_strxxx(char *str, int (* fn) (int))
+{
+ size_t max; /* Empleur du parcours */
+ size_t i; /* Boucle de parcours */
+
+ max = strlen(str);
+
+ for (i = 0; i < max; i++)
+ str[i] = fn(str[i]);
+
+ return str;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : str = chaîne de caractères à traiter. *
* delim = séparateur entre les mots. *
* count = nombre de mots trouvés. [OUT] *
diff --git a/src/common/extstr.h b/src/common/extstr.h
index 6542d2f..e1d784d 100644
--- a/src/common/extstr.h
+++ b/src/common/extstr.h
@@ -25,6 +25,7 @@
#define _COMMON_EXTSTR_H
+#include <ctype.h>
#include <sys/types.h>
@@ -44,6 +45,12 @@ int strrcmp(const char *, const char *);
/* Remplace des éléments d'une chaîne par d'autres. */
char *strrpl(char *, const char *, const char *);
+/* Bascule toute une chaîne de caractères en (min|maj)uscules. */
+char *_strxxx(char *, int (* fn) (int));
+
+#define strlower(str) _strxxx(str, tolower)
+#define strupper(str) _strxxx(str, toupper)
+
/* Extrait une liste de mots d'une chaîne. */
char **strtoka(const char *, const char *, size_t *);