comparison mcabber/src/commands.c @ 1387:3067c096cfc4

Small code cleanup
author Mikael Berthe <mikael@lilotux.net>
date Sun, 02 Dec 2007 18:10:02 +0100
parents 40095d413da9
children e20ab87c4c4c
comparison
equal deleted inserted replaced
1386:8e763c2c331f 1387:3067c096cfc4
304 for (p1 = line ; *p1 == COMMAND_CHAR ; p1++) 304 for (p1 = line ; *p1 == COMMAND_CHAR ; p1++)
305 ; 305 ;
306 // Locate the end of the word 306 // Locate the end of the word
307 for (p2 = p1 ; *p2 && (*p2 != ' ') ; p2++) 307 for (p2 = p1 ; *p2 && (*p2 != ' ') ; p2++)
308 ; 308 ;
309 // Extract the word 309 // Extract the word and look for an alias in the list
310 word = g_strndup(p1, p2-p1); 310 word = g_strndup(p1, p2-p1);
311
312 // Look for an alias in the list
313 value = settings_get(SETTINGS_TYPE_ALIAS, (const char*)word); 311 value = settings_get(SETTINGS_TYPE_ALIAS, (const char*)word);
314 if (value) {
315 // There is an alias to expand
316 newline = g_new(char, strlen(value)+strlen(p2)+2);
317 *newline = COMMAND_CHAR;
318 strcpy(newline+1, value);
319 strcat(newline, p2);
320 }
321 g_free(word); 312 g_free(word);
313
314 if (value)
315 newline = g_strdup_printf("%c%s%s", COMMAND_CHAR, value, p2);
322 316
323 return newline; 317 return newline;
324 } 318 }
325 319
326 // cmd_get 320 // cmd_get