aboutsummaryrefslogtreecommitdiffstats
path: root/funcs/func_sha1.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-12 04:28:58 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-12 04:28:58 +0000
commit5d9ed5739aab2b302efc178d21e6c75672369db3 (patch)
tree5c4270c1ac3d265b96361d98722a75b947f2f8c6 /funcs/func_sha1.c
parent9f87dd693e9e74816b913a157fdcdefa3d7a2e56 (diff)
major dialplan functions update
deprecate LANGUAGE() and MUSICCLASS(), in favor of CHANNEL() git-svn-id: http://svn.digium.com/svn/asterisk/trunk@9674 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_sha1.c')
-rw-r--r--funcs/func_sha1.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/funcs/func_sha1.c b/funcs/func_sha1.c
index 9600d20c5..c9805d2a3 100644
--- a/funcs/func_sha1.c
+++ b/funcs/func_sha1.c
@@ -37,22 +37,26 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/app.h"
-static char *sha1(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int sha1(struct ast_channel *chan, char *cmd, char *data,
+ char *buf, size_t len)
{
+ *buf = '\0';
+
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Syntax: SHA1(<data>) - missing argument!\n");
- return NULL;
+ return -1;
}
if (len >= 41)
ast_sha1_hash(buf, data);
else {
- ast_log(LOG_ERROR, "Insufficient space to produce SHA1 hash result (%d < 41)\n", len);
- *buf = '\0';
+ ast_log(LOG_ERROR,
+ "Insufficient space to produce SHA1 hash result (%d < 41)\n",
+ len);
}
- return buf;
-}
+ return 0;
+}
static struct ast_custom_function sha1_function = {
.name = "SHA1",
@@ -60,21 +64,21 @@ static struct ast_custom_function sha1_function = {
.syntax = "SHA1(<data>)",
.read = sha1,
.desc = "Generate a SHA1 digest via the SHA1 algorythm.\n"
- " Example: Set(sha1hash=${SHA1(junky)})\n"
- " Sets the asterisk variable sha1hash to the string '60fa5675b9303eb62f99a9cd47f9f5837d18f9a0'\n"
- " which is known as his hash\n",
+ " Example: Set(sha1hash=${SHA1(junky)})\n"
+ " Sets the asterisk variable sha1hash to the string '60fa5675b9303eb62f99a9cd47f9f5837d18f9a0'\n"
+ " which is known as his hash\n",
};
static char *tdesc = "SHA-1 computation dialplan function";
int unload_module(void)
{
- return ast_custom_function_unregister(&sha1_function);
+ return ast_custom_function_unregister(&sha1_function);
}
int load_module(void)
{
- return ast_custom_function_register(&sha1_function);
+ return ast_custom_function_register(&sha1_function);
}
char *description(void)