ptr += len; *ptr = ':'; *(ptr + 1) = ' '; if(LOG_WIDTH - len - 2 > 0) { strncpy(ptr + 2, text2, LOG_WIDTH - len - 2);
if(len < LOG_WIDTH) { ptr += len; *ptr = ':'; ++len; if(LOG_WIDTH - len > 0) { strncpy(ptr + 1, text2, LOG_WIDTH - len); } } else { len = 0;
ircc_text_output(struct ircc_state *s, char *text1, char *text2){  char *ptr;  int len, len2;    if(text1 == NULL) {    text1 = "";  }    if(text2 == NULL) {    text2 = "";  }    /* Scroll previous entries upwards */  memcpy(log, &log[LOG_WIDTH], LOG_WIDTH * (LOG_HEIGHT - 1));  ptr = &log[LOG_WIDTH * (LOG_HEIGHT - 1)];  len = strlen(text1);  memset(ptr, 0, LOG_WIDTH);  strncpy(ptr, text1, LOG_WIDTH);  ptr += len;  *ptr = ':';  *(ptr + 1) = ' ';  if(LOG_WIDTH - len - 2 > 0) {    strncpy(ptr + 2, text2, LOG_WIDTH - len - 2);  }  len2 = strlen(text2);  if(len2 > LOG_WIDTH - len - 2) {    memcpy(log, &log[LOG_WIDTH], LOG_WIDTH * (LOG_HEIGHT - 1));    strncpy(&log[LOG_WIDTH * (LOG_HEIGHT - 1)],	    text2 + LOG_WIDTH - 2 - len, LOG_WIDTH);  }  CTK_WIDGET_REDRAW(&loglabel);  }