aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_string.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-07-31 03:48:09 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2006-07-31 03:48:09 +0000
commit8a89eeab079decfc4c312438c67d4fc51b8de3c1 (patch)
treea86b6f002c007cb57dd07af2a37621683e59a003 /plugin_string.c
parent16fabe7b64a6e40008403da5d1107ade8f43eb3b (diff)
downloadlcd4linux-8a89eeab079decfc4c312438c67d4fc51b8de3c1.tar.gz
[lcd4linux @ 2006-07-31 03:48:09 by reinelt]
preparations for scrolling git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@680 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'plugin_string.c')
-rw-r--r--plugin_string.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/plugin_string.c b/plugin_string.c
index 7684f67..1aeb478 100644
--- a/plugin_string.c
+++ b/plugin_string.c
@@ -1,4 +1,4 @@
-/* $Id: plugin_string.c,v 1.10 2006/07/30 11:29:02 lfcorreia Exp $
+/* $Id: plugin_string.c,v 1.11 2006/07/31 03:48:09 reinelt Exp $
*
* string plugin
*
@@ -23,6 +23,9 @@
*
*
* $Log: plugin_string.c,v $
+ * Revision 1.11 2006/07/31 03:48:09 reinelt
+ * preparations for scrolling
+ *
* Revision 1.10 2006/07/30 11:29:02 lfcorreia
* Make changes suggested by Michael, only one init function is needed
*
@@ -77,6 +80,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <ctype.h>
#include "debug.h"
#include "plugin.h"
@@ -89,29 +93,17 @@ static void my_strlen(RESULT * result, RESULT * arg1)
}
/* 'upcase' function (shamelessly stolen from plugin_sample.c)*/
-/* takes one argument, a string */
/* returns the string in upper case letters */
-
-static void my_upcase(RESULT * result, RESULT * arg1)
+static void my_strupper(RESULT * result, RESULT * arg1)
{
char *value, *p;
- /* create a local copy of the argument */
- /* Do *NOT* try to modify the original string! */
value = strdup(R2S(arg1));
- /* process the string */
for (p = value; *p != '\0'; p++)
*p = toupper(*p);
- /* store result */
- /* when called with R_STRING, it assumes the */
- /* next parameter to be a pointer to a string */
- /* 'value' is already a char*, so use 'value', not '&value' */
SetResult(&result, R_STRING, value);
-
- /* free local copy again */
- /* Note that SetResult() makes its own string copy */
free(value);
}
@@ -120,14 +112,11 @@ int plugin_init_string(void)
/* register some basic string functions */
AddFunction("strlen", 1, my_strlen);
-
- /* register my UPPERCASE transforming function */
- AddFunction("strupper", 1, my_upcase);
-
+ AddFunction("strupper", 1, my_strupper);
return 0;
}
void plugin_exit_string(void)
{
/* empty */
-} \ No newline at end of file
+}