Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/screen.c @ 1314:248e3f69dd9e
Fix a bug in the nick_colors variable parsing
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 20 Sep 2007 21:41:06 +0200 |
parents | 0dda8238af21 |
children | e30a9d907105 |
comparison
equal
deleted
inserted
replaced
1313:d1d12a09b04a | 1314:248e3f69dd9e |
---|---|
515 init_pair(i, color_fg_to_color(i), FindColor(background)); | 515 init_pair(i, color_fg_to_color(i), FindColor(background)); |
516 if (i >= COLOR_BLACK_BOLD_FG) | 516 if (i >= COLOR_BLACK_BOLD_FG) |
517 COLOR_ATTRIB[i] = A_BOLD; | 517 COLOR_ATTRIB[i] = A_BOLD; |
518 } | 518 } |
519 if (!nickcols) { | 519 if (!nickcols) { |
520 char *ncolors = g_strdup(settings_opt_get("nick_colors")), | 520 char *ncolors = g_strdup(settings_opt_get("nick_colors")); |
521 *ncolor_start = ncolors; | |
522 if (ncolors) { | 521 if (ncolors) { |
523 while (*ncolors) { | 522 char *ncolor_start, *ncolor_end; |
523 ncolor_start = ncolor_end = ncolors; | |
524 | |
525 while (*ncolor_end) | |
526 ncolor_end++; | |
527 | |
528 while (ncolors < ncolor_end && *ncolors) { | |
524 if ((*ncolors == ' ') || (*ncolors == '\t')) { | 529 if ((*ncolors == ' ') || (*ncolors == '\t')) { |
525 ncolors ++; | 530 ncolors++; |
526 } else { | 531 } else { |
527 char *end = ncolors; | 532 char *end = ncolors; |
528 bool ended = false; | 533 int cl; |
529 while (*end && (*end != ' ') && (*end != '\t')) | 534 while (*end && (*end != ' ') && (*end != '\t')) |
530 end++; | 535 end++; |
531 if (!end) | |
532 ended = true; | |
533 *end = '\0'; | 536 *end = '\0'; |
534 int cl = get_user_color(ncolors); | 537 cl = get_user_color(ncolors); |
535 if (cl < 0) { | 538 if (cl < 0) { |
536 scr_LogPrint(LPRINT_NORMAL, "Unknown color %s", ncolors); | 539 scr_LogPrint(LPRINT_NORMAL, "Unknown color %s", ncolors); |
537 } else { | 540 } else { |
538 nickcols = g_realloc(nickcols, (++nickcolcount) * sizeof *nickcols); | 541 nickcols = g_realloc(nickcols, (++nickcolcount) * sizeof *nickcols); |
539 nickcols[nickcolcount-1] = cl; | 542 nickcols[nickcolcount-1] = cl; |
540 } | 543 } |
541 if (ended) | 544 ncolors = end+1; |
542 ncolors = NULL; | |
543 else | |
544 ncolors = end+1; | |
545 } | 545 } |
546 } | 546 } |
547 g_free(ncolor_start); | 547 g_free(ncolor_start); |
548 } | 548 } |
549 if (!nickcols) {//Fallback to have something | 549 if (!nickcols) {//Fallback to have something |