Merged revisions 47398 via svnmerge from
authorJoshua Colp <jcolp@digium.com>
Thu, 9 Nov 2006 22:34:00 +0000 (22:34 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 9 Nov 2006 22:34:00 +0000 (22:34 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r47398 | file | 2006-11-09 17:32:30 -0500 (Thu, 09 Nov 2006) | 2 lines

Do conversion in a more easier to read and working way for \r, \n, and \t. (issue #8324 reported by johnlange)

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47399 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c

index 647170f..7ff75bc 100644 (file)
@@ -7512,13 +7512,17 @@ static int load_config(void)
                        tmpread = tmpwrite = emailbody;
                        while ((tmpwrite = strchr(tmpread,'\\'))) {
                                switch (tmpwrite[1]) {
+                               case 'r':
+                                       memmove(tmpwrite + 1, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
+                                       *tmpwrite = '\r';
+                                       break;
                                case 'n':
-                                       *tmpwrite++ = '\n';
-                                       memmove(tmpwrite, tmpwrite + 1, strlen(tmpwrite + 1) + 1);
+                                       memmove(tmpwrite + 1, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
+                                       *tmpwrite = '\n';
                                        break;
                                case 't':
-                                       *tmpwrite++ = '\t';
-                                       memmove(tmpwrite, tmpwrite + 1, strlen(tmpwrite + 1) + 1);
+                                       memmove(tmpwrite + 1, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
+                                       *tmpwrite = '\t';
                                        break;
                                default:
                                        ast_log(LOG_NOTICE, "Substitution routine does not support this character: %c\n", tmpwrite[1]);
@@ -7536,13 +7540,17 @@ static int load_config(void)
                        tmpread = tmpwrite = pagerbody;
                        while ((tmpwrite = strchr(tmpread, '\\'))) {
                                switch (tmpwrite[1]) {
+                               case 'r':
+                                       memmove(tmpwrite + 1, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
+                                       *tmpwrite = '\r';
+                                       break;
                                case 'n':
-                                       *tmpwrite++ = '\n';
-                                       memmove(tmpwrite, tmpwrite + 1, strlen(tmpwrite + 1) + 1);
+                                       memmove(tmpwrite + 1, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
+                                       *tmpwrite = '\n';
                                        break;
                                case 't':
-                                       *tmpwrite++ = '\t';
-                                       memmove(tmpwrite, tmpwrite + 1, strlen(tmpwrite + 1) + 1);
+                                       memmove(tmpwrite + 1, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
+                                       *tmpwrite = '\t';
                                        break;
                                default:
                                        ast_log(LOG_NOTICE, "Substitution routine does not support this character: %c\n", tmpwrite[1]);