Merged revisions 72806 via svnmerge from
[asterisk/asterisk.git] / pbx / pbx_realtime.c
index 3321eeb..9ee770c 100644 (file)
  * \arg See also: \ref AstARA
  */
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
 
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
 #include "asterisk/file.h"
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
@@ -97,7 +97,7 @@ static struct ast_variable *realtime_switch_common(const char *table, const char
        case MODE_MATCH:
        default:
                ematch = "exten";
-               strncpy(rexten, exten, sizeof(rexten) - 1);
+               ast_copy_string(rexten, exten, sizeof(rexten));
        }
        var = ast_load_realtime(table, ematch, rexten, "context", context, "priority", pri, NULL);
        if (!var) {
@@ -183,7 +183,7 @@ static int realtime_exec(struct ast_channel *chan, const char *context, const ch
 
                for (v = var; v ; v = v->next) {
                        if (!strcasecmp(v->name, "app"))
-                               strncpy(app, v->value, sizeof(app) -1 );
+                               ast_copy_string(app, v->value, sizeof(app));
                        else if (!strcasecmp(v->name, "appdata"))
                                tmp = ast_strdupa(v->value);
                }
@@ -234,33 +234,23 @@ static int realtime_matchmore(struct ast_channel *chan, const char *context, con
 static struct ast_switch realtime_switch =
 {
         name:                   "Realtime",
-        description:                   "Realtime Dialplan Switch",
+        description:                   "Realtime Dialplan Switch",
         exists:                 realtime_exists,
         canmatch:               realtime_canmatch,
         exec:                   realtime_exec,
         matchmore:              realtime_matchmore,
 };
 
-static const char *description(void)
-{
-       return "Realtime Switch";
-}
-
-static const char *key(void)
-{
-       return ASTERISK_GPL_KEY;
-}
-
-static int unload_module(void *mod)
+static int unload_module(void)
 {
        ast_unregister_switch(&realtime_switch);
        return 0;
 }
 
-static int load_module(void *mod)
+static int load_module(void)
 {
        ast_register_switch(&realtime_switch);
        return 0;
 }
 
-STD_MOD(MOD_1 | NO_USECOUNT | NO_UNLOAD, NULL, NULL, NULL);
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Realtime Switch");