Changeset a52d13a
- Timestamp:
- Jul 15, 2009, 11:39:02 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 130633c
- Parents:
- 3e8ff1e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
zwrite.c
r69f89c7 ra52d13a 9 9 int owl_zwrite_create_from_line(owl_zwrite *z, char *line) 10 10 { 11 int argc, badargs, myargc ;11 int argc, badargs, myargc, i, len; 12 12 char **argv, **myargv; 13 char *msg = NULL; 13 14 14 15 badargs=0; … … 91 92 myargv++; 92 93 myargc--; 93 z->message = owl_strdup(""); 94 len = 0; 95 for (i=0;i<myargc;i++) { 96 len += strlen(myargv[i-1]) + 1; 97 } 98 msg = owl_malloc(len); 99 msg[0] = '\0'; 94 100 while (myargc) { 95 z->message=owl_realloc(z->message, strlen(z->message)+strlen(myargv[0])+5); 96 strcat(z->message, myargv[0]); 97 strcat(z->message, " "); 98 myargc--; 99 myargv++; 100 } 101 z->message[strlen(z->message)-1]='\0'; /* remove last space */ 101 strcat(msg, myargv[0]); 102 strcat(msg, " "); 103 myargc--; 104 myargv++; 105 } 106 msg[strlen(msg)-1] = '\0'; 102 107 break; 103 108 } else if (!strcmp(myargv[0], "-C")) { … … 136 141 if (z->opcode==NULL) z->opcode=owl_strdup(""); 137 142 /* z->message is allowed to stay NULL */ 138 143 144 if(msg) { 145 owl_zwrite_set_message(z, msg); 146 owl_free(msg); 147 } 148 139 149 return(0); 140 150 } … … 222 232 int i, j; 223 233 char *toline = NULL; 224 char *tmp = NULL ;234 char *tmp = NULL, *tmp2; 225 235 226 236 if (z->message) owl_free(z->message); … … 240 250 } 241 251 tmp = owl_validate_utf8(msg); 242 z->message=owl_sprintf("%s\n%s", toline, tmp); 252 tmp2 = owl_text_expand_tabs(tmp); 253 z->message=owl_sprintf("%s\n%s", toline, tmp2); 243 254 owl_free(toline); 255 owl_free(tmp); 256 owl_free(tmp2); 244 257 } else { 245 z->message=owl_validate_utf8(msg); 246 } 247 if (tmp) owl_free(tmp); 258 tmp=owl_validate_utf8(msg); 259 z->message=owl_text_expand_tabs(tmp); 260 owl_free(tmp); 261 } 248 262 } 249 263
Note: See TracChangeset
for help on using the changeset viewer.