summaryrefslogtreecommitdiff
path: root/blasms.c
diff options
context:
space:
mode:
Diffstat (limited to 'blasms.c')
-rw-r--r--blasms.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/blasms.c b/blasms.c
index 639b902..e4380dc 100644
--- a/blasms.c
+++ b/blasms.c
@@ -28,8 +28,8 @@ void remtrailn(char* line) {
}
}
-/* Replace source[i] with str */
-void replacestr(char* source, int i, char* str) {
+/* Replace n characters in source with str at i */
+void replacestr(char* source, int i, int n, char* str) {
/* Temporary string for building */
char strtmp[1000];
@@ -37,7 +37,7 @@ void replacestr(char* source, int i, char* str) {
strxfrm(source, strtmp, i);
source[i] = '\0';
strcat(source, str);
- strcat(source, strtmp + i + 2);
+ strcat(source, strtmp + i + n);
}
/* Converts a string to lowercase */
@@ -262,23 +262,23 @@ int main(int argc, char *argv[]) {
switch (systemcmd[i+1]) {
case 'N':
setname(telnum);
- replacestr(systemcmd, i, telnum);
+ replacestr(systemcmd, i, 2, telnum);
break;
case 'n':
- replacestr(systemcmd, i, telnum);
+ replacestr(systemcmd, i, 2, telnum);
break;
case 'd':
- replacestr(systemcmd, i, argv[2]);
+ replacestr(systemcmd, i, 2, argv[2]);
break;
case 's':
- replacestr(systemcmd, i, sms + offset + 1);
+ replacestr(systemcmd, i, 2, sms + offset + 1);
break;
case 'P':
if (!match) {
settelnum(telnum, sms, &offset);
match = 1;
}
- replacestr(systemcmd, i, telnum);
+ replacestr(systemcmd, i, 2, telnum);
break;
}
}