wnew->screen.terminal_id = request->screen.terminal_id;
wnew->screen.term_id = request->screen.term_id; for (s = request->screen.term_id; *s; s++) { if (!isalpha(*s)) break; } wnew->screen.terminal_id = atoi(s);
static void VTInitialize (	Widget wrequest,	Widget new_arg,	ArgList args GCC_UNUSED,	Cardinal *num_args GCC_UNUSED){   XtermWidget request = (XtermWidget) wrequest;   XtermWidget wnew    = (XtermWidget) new_arg;   int i;#if OPT_ISO_COLORS   Boolean color_ok;#endif   /* Zero out the entire "screen" component of "wnew" widget, then do    * field-by-field assigment of "screen" fields that are named in the    * resource list.    */   bzero ((char *) &wnew->screen, sizeof(wnew->screen));   /* dummy values so that we don't try to Realize the parent shell with height    * or width of 0, which is illegal in X.  The real size is computed in the    * xtermWidget's Realize proc, but the shell's Realize proc is called first,    * and must see a valid size.    */   wnew->core.height = wnew->core.width = 1;   /*    * The definition of -rv now is that it changes the definition of    * XtDefaultForeground and XtDefaultBackground.  So, we no longer    * need to do anything special.    */   wnew->screen.display = wnew->core.screen->display;   /*    * We use the default foreground/background colors to compare/check if a    * color-resource has been set.    */#define MyBlackPixel(dpy) BlackPixel(dpy,DefaultScreen(dpy))#define MyWhitePixel(dpy) WhitePixel(dpy,DefaultScreen(dpy))   if (request->misc.re_verse) {	wnew->dft_foreground = MyWhitePixel(wnew->screen.display);	wnew->dft_background = MyBlackPixel(wnew->screen.display);   } else {	wnew->dft_foreground = MyBlackPixel(wnew->screen.display);	wnew->dft_background = MyWhitePixel(wnew->screen.display);   }   wnew->screen.mouse_button = -1;   wnew->screen.mouse_row = -1;   wnew->screen.mouse_col = -1;   wnew->screen.c132 = request->screen.c132;   wnew->screen.curses = request->screen.curses;   wnew->screen.hp_ll_bc = request->screen.hp_ll_bc;#if OPT_XMC_GLITCH   wnew->screen.xmc_glitch = request->screen.xmc_glitch;   wnew->screen.xmc_attributes = request->screen.xmc_attributes;   wnew->screen.xmc_inline = request->screen.xmc_inline;   wnew->screen.move_sgr_ok = request->screen.move_sgr_ok;#endif   wnew->screen.foreground = request->screen.foreground;   wnew->screen.cursorcolor = request->screen.cursorcolor;#if OPT_BLINK_CURS   wnew->screen.cursor_blink = request->screen.cursor_blink;#endif   wnew->screen.border = request->screen.border;   wnew->screen.jumpscroll = request->screen.jumpscroll;   wnew->screen.old_fkeys = request->screen.old_fkeys;#ifdef ALLOWLOGGING   wnew->screen.logfile = request->screen.logfile;#endif   wnew->screen.marginbell = request->screen.marginbell;   wnew->screen.mousecolor = request->screen.mousecolor;   wnew->screen.mousecolorback = request->screen.mousecolorback;   wnew->screen.multiscroll = request->screen.multiscroll;   wnew->screen.nmarginbell = request->screen.nmarginbell;   wnew->screen.savelines = request->screen.savelines;   wnew->screen.scrolllines = request->screen.scrolllines;   wnew->screen.scrollttyoutput = request->screen.scrollttyoutput;   wnew->screen.scrollkey = request->screen.scrollkey;   wnew->screen.terminal_id = request->screen.terminal_id;   if (wnew->screen.terminal_id < MIN_DECID)       wnew->screen.terminal_id = MIN_DECID;   if (wnew->screen.terminal_id > MAX_DECID)       wnew->screen.terminal_id = MAX_DECID;   wnew->screen.ansi_level = (wnew->screen.terminal_id / 100);   wnew->screen.visualbell = request->screen.visualbell;#if OPT_TEK4014   wnew->screen.TekEmu = request->screen.TekEmu;#endif   wnew->misc.re_verse = request->misc.re_verse;   wnew->screen.multiClickTime = request->screen.multiClickTime;   wnew->screen.bellSuppressTime = request->screen.bellSuppressTime;   wnew->screen.charClass = request->screen.charClass;   wnew->screen.cutNewline = request->screen.cutNewline;   wnew->screen.cutToBeginningOfLine = request->screen.cutToBeginningOfLine;   wnew->screen.highlight_selection = request->screen.highlight_selection;   wnew->screen.always_highlight = request->screen.always_highlight;   wnew->screen.pointer_cursor = request->screen.pointer_cursor;   wnew->screen.printer_command = request->screen.printer_command;   wnew->screen.printer_autoclose = request->screen.printer_autoclose;   wnew->screen.printer_extent = request->screen.printer_extent;   wnew->screen.printer_formfeed = request->screen.printer_formfeed;   wnew->screen.printer_controlmode = request->screen.printer_controlmode;#ifdef OPT_PRINT_COLORS   wnew->screen.print_attributes = request->screen.print_attributes;#endif   wnew->screen.input_eight_bits = request->screen.input_eight_bits;   wnew->screen.output_eight_bits = request->screen.output_eight_bits;   wnew->screen.control_eight_bits = request->screen.control_eight_bits;   wnew->screen.backarrow_key = request->screen.backarrow_key;   wnew->screen.allowSendEvents = request->screen.allowSendEvents;#ifndef NO_ACTIVE_ICON   wnew->screen.fnt_icon = request->screen.fnt_icon;#endif /* NO_ACTIVE_ICON */   wnew->misc.titeInhibit = request->misc.titeInhibit;   wnew->misc.dynamicColors = request->misc.dynamicColors;   for (i = fontMenu_font1; i <= fontMenu_lastBuiltin; i++) {       wnew->screen.menu_font_names[i] = request->screen.menu_font_names[i];   }   /* set default in realize proc */   wnew->screen.menu_font_names[fontMenu_fontdefault] = NULL;   wnew->screen.menu_font_names[fontMenu_fontescape] = NULL;   wnew->screen.menu_font_names[fontMenu_fontsel] = NULL;   wnew->screen.menu_font_number = fontMenu_fontdefault;#if OPT_ISO_COLORS   wnew->screen.boldColors    = request->screen.boldColors;   wnew->screen.colorAttrMode = request->screen.colorAttrMode;   wnew->screen.colorBDMode   = request->screen.colorBDMode;   wnew->screen.colorBLMode   = request->screen.colorBLMode;   wnew->screen.colorMode     = request->screen.colorMode;   wnew->screen.colorULMode   = request->screen.colorULMode;   for (i = 0, color_ok = False; i < MAXCOLORS; i++) {       wnew->screen.Acolors[i] = request->screen.Acolors[i];       if (wnew->screen.Acolors[i] != wnew->dft_foreground        && wnew->screen.Acolors[i] != request->screen.foreground        && wnew->screen.Acolors[i] != request->core.background_pixel)	   color_ok = True;   }   /* If none of the colors are anything other than the foreground or    * background, we'll assume this isn't color, no matter what the colorMode    * resource says.  (There doesn't seem to be any good way to determine if    * the resource lookup failed versus the user having misconfigured this).    */   if (!color_ok)	wnew->screen.colorMode = False;   wnew->num_ptrs = wnew->screen.colorMode ? 3 : 2;   wnew->sgr_foreground = -1;#endif /* OPT_ISO_COLORS */#if OPT_HIGHLIGHT_COLOR   wnew->screen.highlightcolor = request->screen.highlightcolor;#endif#if OPT_DEC_CHRSET   wnew->num_ptrs = 5;#endif   wnew->screen.underline = request->screen.underline;   wnew->cur_foreground = 0;   wnew->cur_background = 0;   wnew->keyboard.flags = MODE_SRM;   if (wnew->screen.backarrow_key)	   wnew->keyboard.flags |= MODE_DECBKM;   /* look for focus related events on the shell, because we need    * to care about the shell's border being part of our focus.    */   XtAddEventHandler(XtParent(wnew), EnterWindowMask, FALSE,		HandleEnterWindow, (Opaque)NULL);   XtAddEventHandler(XtParent(wnew), LeaveWindowMask, FALSE,		HandleLeaveWindow, (Opaque)NULL);   XtAddEventHandler(XtParent(wnew), FocusChangeMask, FALSE,		HandleFocusChange, (Opaque)NULL);   XtAddEventHandler((Widget)wnew, 0L, TRUE,		VTNonMaskableEvent, (Opaque)NULL);   XtAddEventHandler((Widget)wnew, PropertyChangeMask, FALSE,		     HandleBellPropertyChange, (Opaque)NULL);#if OPT_ZICONBEEP   /* Flag icon name with "***"  on window output when iconified.    * Put in a handler that will tell us when we get Map/Unmap events.    */   if ( zIconBeep )       XtAddEventHandler(XtParent(wnew), StructureNotifyMask, FALSE,			 HandleMapUnmap, (Opaque)NULL);#endif /* OPT_ZICONBEEP */   wnew->screen.bellInProgress = FALSE;   set_character_class (wnew->screen.charClass);   /* create it, but don't realize it */   ScrollBarOn (wnew, TRUE, FALSE);   /* make sure that the resize gravity acceptable */   if ( wnew->misc.resizeGravity != NorthWestGravity &&        wnew->misc.resizeGravity != SouthWestGravity) {       Cardinal nparams = 1;       XtAppWarningMsg(app_con, "rangeError", "resizeGravity", "XTermError",		       "unsupported resizeGravity resource value (%d)",		       (String *) &(wnew->misc.resizeGravity), &nparams);       wnew->misc.resizeGravity = SouthWestGravity;   }#ifndef NO_ACTIVE_ICON   wnew->screen.whichVwin = &wnew->screen.fullVwin;#if OPT_TEK4014   wnew->screen.whichTwin = &wnew->screen.fullTwin;#endif#endif /* NO_ACTIVE_ICON */   return;}