Bool clear_all = True; Bool lock_keys = True;  if (dcslen != strlen(cp))  return;  if (*cp == '0') { cp++; } else if (*cp == '1') { cp++; clear_all = False; }  if (*cp == ';') cp++; else if (*cp != '|') return;  if (*cp == '0') { cp++; } else if (*cp == '1') { cp++; lock_keys = False; }  if (*cp++ != '|') return;  if (clear_all) reset_decudk();  while (*cp) { char *str = (char *)malloc(strlen(cp) + 2); int key = 0; int len = 0;  while (isdigit(*cp)) key = (key * 10) + (*cp++ - '0'); if (*cp == '/') { cp++; while (*cp != ';' && *cp != '\0') { int hi = hexvalue(*cp++); int lo = hexvalue(*cp++); if (hi >= 0 && lo >= 0) str[len++] = (hi << 4) | lo; else return; } } if (len > 0 && key < MAX_UDK) { if (user_keys[key].str != 0) free(user_keys[key].str); user_keys[key].str = str; user_keys[key].len = len; } else { free(str); } if (*cp == ';') cp++; } } }
do_dcs(Char *dcsbuf, size_t dcslen){	register TScreen *screen = &term->screen;	char *cp = (char *)dcsbuf;	if (*cp == '$') { /* DECRQSS */		char reply[BUFSIZ];		Bool okay = True;		cp++;		if (*cp++ == 'q') {			if (!strcmp(cp, "\"q")) {		/* DECSCA */				sprintf(reply, "%d%s",					(screen->protected_mode == DEC_PROTECT)					 && (term->flags & PROTECTED) ? 1 : 0,					cp);			} else if (!strcmp(cp, "\"p")) {	/* DECSCL */				sprintf(reply, "%d%s",					(screen->ansi_level ?					 screen->ansi_level : 1) + 60,					cp);			} else if (!strcmp(cp, "r")) {		/* DECSTBM */				sprintf(reply, "%d;%dr",					screen->top_marg + 1,					screen->bot_marg + 1);			} else if (!strcmp(cp, "m")) {		/* SGR */				strcpy(reply, "0");				if (term->flags & BOLD)					strcat(reply, ";1");				if (term->flags & UNDERLINE)					strcat(reply, ";4");				if (term->flags & BLINK)					strcat(reply, ";5");				if (term->flags & INVERSE)					strcat(reply, ";7");				if (term->flags & INVISIBLE)					strcat(reply, ";8");				if_OPT_ISO_COLORS(screen,{				if (term->flags & FG_COLOR)					sprintf(reply+strlen(reply),						";3%d", term->cur_foreground);				if (term->flags & BG_COLOR)					sprintf(reply+strlen(reply),						";4%d", term->cur_background);				})				strcat(reply, "m");			} else				okay = False;			unparseputc1(DCS, screen->respond);			unparseputc(okay ? '1' : '0', screen->respond);			unparseputc('$', screen->respond);			unparseputc('r', screen->respond);			if (okay)				cp = reply;			while (*cp != '\0')				unparseputc(*cp++, screen->respond);			unparseputc1(ST, screen->respond);		} else {			unparseputc(CAN, screen->respond);		}	} else { /* DECUDK */