+ /*
+ * VT340/VT420 sequence DECSLPP, DEC only allows values
+ * 24/25/36/48/72/144 other emulators (eg dtterm) use
+ * illegal values (eg first arg 1..9) for window changing
+ * and reports.
+ */
+ compatibility(VT340TEXT);
+ if (esc_nargs<=1 && (esc_args[0]<1 || esc_args[0]>=24)) {
+ unsigned int newrows = def(esc_args[0], 24);
+ /* Hack: prevent big-resize DoS attack. */
+ if (newrows > max(512, cfg.height))
+ newrows = max(512, cfg.height);
+ request_resize (cols, newrows, 0);
+ deselect();
+ }
+ break;
+ case ANSI('|', '*'):
+ /* VT420 sequence DECSNLS
+ * Set number of lines on screen
+ * VT420 uses VGA like hardware and can support any size in
+ * reasonable range (24..49 AIUI) with no default specified.
+ */
+ compatibility(VT420);
+ if (esc_nargs==1 && esc_args[0]>=24) {
+ unsigned int newrows = def(esc_args[0], cfg.height);
+ /* Hack: prevent big-resize DoS attack. */
+ if (newrows > max(512, cfg.height))
+ newrows = max(512, cfg.height);
+ request_resize (cols, newrows, 0);
+ deselect();
+ }
+ break;
+ case ANSI('|', '$'):
+ /* VT340/VT420 sequence DECSCPP
+ * Set number of columns per page
+ * Docs imply range is only 80 or 132, but I'll allow any.
+ */
+ compatibility(VT340TEXT);
+ if (esc_nargs<=1) {
+ unsigned int newcols = def(esc_args[0], cfg.width);
+ /* Hack: prevent big-resize DoS attack. */
+ if (newcols > max(512, cfg.width))
+ newcols = max(512, cfg.width);
+ request_resize (newcols, rows, 0);
+ deselect();
+ }