-/* $OpenBSD: wsemul_sun.c,v 1.36 2023/03/06 20:34:35 miod Exp $ */
+/* $OpenBSD: wsemul_sun.c,v 1.37 2023/07/24 17:03:32 miod Exp $ */
/* $NetBSD: wsemul_sun.c,v 1.11 2000/01/05 11:19:36 drochner Exp $ */
/*
break;
case ';': /* argument terminator */
- edp->nargs++;
+ if (edp->nargs < SUN_EMUL_NARGS)
+ edp->nargs++;
break;
default: /* end of escape sequence */
- oargs = edp->nargs++;
- if (edp->nargs > SUN_EMUL_NARGS)
- edp->nargs = SUN_EMUL_NARGS;
+ oargs = edp->nargs;
+ if (edp->nargs < SUN_EMUL_NARGS)
+ edp->nargs++;
rc = wsemul_sun_control(edp, instate);
if (rc != 0) {
/* undo nargs progress */
-/* $OpenBSD: wsemul_vt100.c,v 1.45 2023/03/06 20:34:35 miod Exp $ */
+/* $OpenBSD: wsemul_vt100.c,v 1.46 2023/07/24 17:03:32 miod Exp $ */
/* $NetBSD: wsemul_vt100.c,v 1.13 2000/04/28 21:56:16 mycroft Exp $ */
/*
(instate->inchar - '0');
break;
case ';': /* argument terminator */
- edp->nargs++;
+ if (edp->nargs < VT100_EMUL_NARGS)
+ edp->nargs++;
break;
default:
- edp->nargs++;
- if (edp->nargs > VT100_EMUL_NARGS) {
-#ifdef VT100_DEBUG
- printf("vt100: too many arguments\n");
-#endif
- edp->nargs = VT100_EMUL_NARGS;
- }
+ if (edp->nargs < VT100_EMUL_NARGS)
+ edp->nargs++;
newstate = VT100_EMUL_STATE_STRING;
switch (instate->inchar) {
case '$':
(instate->inchar - '0');
break;
case ';': /* argument terminator */
- edp->nargs++;
+ if (edp->nargs < VT100_EMUL_NARGS)
+ edp->nargs++;
break;
case '?': /* DEC specific */
case '>': /* DA query */
edp->modif2 = (char)instate->inchar;
break;
default: /* end of escape sequence */
- oargs = edp->nargs++;
- if (edp->nargs > VT100_EMUL_NARGS) {
-#ifdef VT100_DEBUG
- printf("vt100: too many arguments\n");
-#endif
- edp->nargs = VT100_EMUL_NARGS;
- }
+ oargs = edp->nargs;
+ if (edp->nargs < VT100_EMUL_NARGS)
+ edp->nargs++;
rc = wsemul_vt100_handle_csi(edp, instate);
if (rc != 0) {
edp->nargs = oargs;