strcpy(p, "@MAG("); strcat(p, wrd_event2string(wrd_args[0])); strcat(p, ","); for(i = 1; i < 3; i++) 
snprintf(p, MIN_MBLOCK_SIZE-1, "@MAG(%s", wrd_event2string(wrd_args[0])); p[MIN_MBLOCK_SIZE-1] = '\0'; /* fail safe */ for(i = 1; i < 5; i++) 
static void wrdt_apply(int cmd, int wrd_argc, int wrd_args[]){    char *p;    char *text;    int i, len;    static int txtclr_preserve=0;#if 0    if(inkey_flag)	printf("* ");#endif    switch(cmd)    {      case WRD_LYRIC:	p = wrd_event2string(wrd_args[0]);	len = strlen(p);	text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len));	/*This must be not good thing,but as far as I know no wrd file 	  written in EUC-JP code found*/	code_convert(p, text, SAFE_CONVERT_LENGTH(len), "SJIS", (char *)-1);	printf("%s",text);	fflush(stdout);	reuse_mblock(&tmpbuffer);	break;      case WRD_NL: /* Newline (Ignored) */	putchar('\n');	break;      case WRD_COLOR:	txtclr_preserve=wrd_args[0];	if(16 <= txtclr_preserve && txtclr_preserve <= 23)	    txtclr_preserve = wrd_color_remap[txtclr_preserve - 16] + 30;	printf("\033[%dm", txtclr_preserve);	break;      case WRD_END: /* Never call */	break;      case WRD_ESC:	printf("\033[%s", wrd_event2string(wrd_args[0]));	break;      case WRD_EXEC:	/*I don't spaun another program*/	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@EXEC(%s)", wrd_event2string(wrd_args[0]));	break;      case WRD_FADE:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@FADE(%d,%d,%d)", wrd_args[0], wrd_args[1], wrd_args[2]);	break;      case WRD_FADESTEP:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@FADESTEP(%d/%d)", wrd_args[0], WRD_MAXFADESTEP);	break;      case WRD_GCIRCLE:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@GCIRCLE(%d,%d,%d,%d,%d,%d)",		  wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3],		  wrd_args[4], wrd_args[5]);	break;      case WRD_GCLS:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@GCLS(%d)", wrd_args[0]);	break;      case WRD_GINIT:	ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@GINIT()");	break;      case WRD_GLINE:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@GLINE(%d,%d,%d,%d,%d,%d,%d)",	       wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4],	       wrd_args[5], wrd_args[6]);	fflush(stdout);	break;      case WRD_GMODE:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@GMODE(%d)", wrd_args[0]);	break;      case WRD_GMOVE:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@GMOVE(%d,%d,%d,%d,%d,%d,%d)",	       wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3], wrd_args[4],	       wrd_args[5], wrd_args[6], wrd_args[7], wrd_args[8]);	break;      case WRD_GON:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@GON(%d)", wrd_args[0]);	break;      case WRD_GSCREEN:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@GSCREEN(%d,%d)", wrd_args[0], wrd_args[1]);	break;      case WRD_INKEY:	inkey_flag = 1;	ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@INKEY - begin");	break;      case WRD_OUTKEY:	inkey_flag = 0;	ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@INKEY - end");	break;      case WRD_LOCATE:	printf("\033[%d;%dH", wrd_args[1], wrd_args[0]);	break;      case WRD_LOOP: /* Never call */	break;      case WRD_MAG:	p = (char *)new_segment(&tmpbuffer, MIN_MBLOCK_SIZE);	strcpy(p, "@MAG(");	strcat(p, wrd_event2string(wrd_args[0]));	strcat(p, ",");	for(i = 1; i < 3; i++)	{	    if(wrd_args[i] == WRD_NOARG)		strcat(p, "*,");	    else		sprintf(p + strlen(p), "%d,", wrd_args[i]);	}	sprintf(p + strlen(p), "%d,%d)", wrd_args[3], wrd_args[4]);	ctl->cmsg(CMSG_INFO, VERB_DEBUG, "%s", p);	reuse_mblock(&tmpbuffer);	break;      case WRD_MIDI: /* Never call */	break;      case WRD_OFFSET: /* Never call */	break;      case WRD_PAL:	p = (char *)new_segment(&tmpbuffer, MIN_MBLOCK_SIZE);	sprintf(p, "@PAL(%03x", wrd_args[0]);	for(i = 1; i < 17; i++)	    sprintf(p + strlen(p), ",%03x", wrd_args[i]);	strcat(p, ")");	ctl->cmsg(CMSG_INFO, VERB_DEBUG, "%s", p);	reuse_mblock(&tmpbuffer);	break;      case WRD_PALCHG:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@PALCHG(%s)", wrd_event2string(wrd_args[0]));	break;      case WRD_PALREV:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@PALREV(%d)", wrd_args[0]);	break;      case WRD_PATH:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@PATH(%s)", wrd_event2string(wrd_args[0]));	break;      case WRD_PLOAD:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@PLOAD(%s)", wrd_event2string(wrd_args[0]));	break;      case WRD_REM:	p = wrd_event2string(wrd_args[0]);	len = strlen(p);	text = (char *)new_segment(&tmpbuffer, SAFE_CONVERT_LENGTH(len));	code_convert(p, text, SAFE_CONVERT_LENGTH(len), NULL, NULL);	ctl->cmsg(CMSG_INFO, VERB_DEBUG, "@REM %s", text);	reuse_mblock(&tmpbuffer);	break;      case WRD_REMARK:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@REMARK(%s)", wrd_event2string(wrd_args[0]));	break;      case WRD_REST: /* Never call */	break;      case WRD_SCREEN: /* Not supported */	break;      case WRD_SCROLL:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@SCROLL(%d,%d,%d,%d,%d,%d,%d)",		  wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3],		  wrd_args[4], wrd_args[5], wrd_args[6]);	break;      case WRD_STARTUP:	inkey_flag = 0;	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@STARTUP(%d)", wrd_args[0]);	printf("\033[0m\033[H\033[J");	fflush(stdout);	break;      case WRD_STOP: /* Never call */	break;      case WRD_TCLS:	{	  char fillbuf[1024];	  fillbuf[0]=0x1b;	  fillbuf[1]='7';	  fillbuf[2]=0;	  printf(fillbuf);	  /* 0-7: normal, 8-16: reverse */	  if(wrd_args[4] <= 7)	      wrd_args[4] += 30;	  else	      wrd_args[4] += 32;	  printf("\033[%dm",wrd_args[4]);	  memset(fillbuf,wrd_args[5],wrd_args[2]-wrd_args[0]);/*X2-X1*/	  fillbuf[wrd_args[2]-wrd_args[0]]=0;	  for(i=wrd_args[1];i<=wrd_args[3];i++)/*Y1 to Y2*/	    printf("\033[%d;%dH%s",i,wrd_args[0],fillbuf);/*X1to....*/	  fillbuf[0]=0x1b;	  fillbuf[1]='8';	  fillbuf[2]=0;	  printf(fillbuf);	  printf("\033[%dm",txtclr_preserve);	  fflush(stdout);	}#if 0	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@TCLS(%d,%d,%d,%d,%d,%d,%d)",		  wrd_args[0], wrd_args[1], wrd_args[2], wrd_args[3],		  wrd_args[4], wrd_args[5]);#endif	break;      case WRD_TON:	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "@TON(%d)", wrd_args[0]);	break;      case WRD_WAIT: /* Never call */	break;      case WRD_WMODE: /* Never call */	break;	/* Ensyutsukun */      case WRD_eFONTM:	break;      case WRD_eFONTP:	break;      case WRD_eFONTR:	break;      case WRD_eGSC:	break;      case WRD_eLINE:	break;      case WRD_ePAL:	break;      case WRD_eREGSAVE:	break;      case WRD_eSCROLL:	break;      case WRD_eTEXTDOT:	break;      case WRD_eTMODE:	break;      case WRD_eTSCRL:	break;      case WRD_eVCOPY:	break;      case WRD_eVSGET:	break;      case WRD_eVSRES:	break;      case WRD_eXCOPY:	break;      default:	break;    }    wrd_argc = 0;}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/361cc5df1e14516b0a3eef7766539860da9a9721/wrdt_tty.c/buggy/interface/wrdt_tty.c