=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/roff_escape.c,v retrieving revision 1.4 retrieving revision 1.5 diff -c -r1.4 -r1.5 *** src/usr.bin/mandoc/roff_escape.c 2022/05/31 18:08:02 1.4 --- src/usr.bin/mandoc/roff_escape.c 2022/05/31 20:21:40 1.5 *************** *** 1,4 **** ! /* $OpenBSD: roff_escape.c,v 1.4 2022/05/31 18:08:02 schwarze Exp $ */ /* * Copyright (c) 2011, 2012, 2013, 2014, 2015, 2017, 2018, 2020, 2022 * Ingo Schwarze --- 1,4 ---- ! /* $OpenBSD: roff_escape.c,v 1.5 2022/05/31 20:21:40 schwarze Exp $ */ /* * Copyright (c) 2011, 2012, 2013, 2014, 2015, 2017, 2018, 2020, 2022 * Ingo Schwarze *************** *** 73,78 **** --- 73,79 ---- int maxl; /* expected length of the argument */ int argl; /* actual length of the argument */ int c, i; /* for \[char...] parsing */ + int valid_A; /* for \A parsing */ enum mandoc_esc rval; /* return value */ enum mandocerr err; /* diagnostic code */ char esc_name; *************** *** 181,192 **** /* Quoted arguments */ case 'B': case 'w': rval = ESCAPE_EXPAND; term = '\b'; break; - case 'A': case 'D': case 'H': case 'L': --- 182,193 ---- /* Quoted arguments */ + case 'A': case 'B': case 'w': rval = ESCAPE_EXPAND; term = '\b'; break; case 'D': case 'H': case 'L': *************** *** 301,306 **** --- 302,308 ---- /* Advance to the end of the argument. */ + valid_A = 1; iendarg = iarg; while (maxl > 0) { if (buf[iendarg] == '\0') { *************** *** 319,329 **** break; } if (buf[iendarg] == buf[iesc]) { ! if (roff_escape(buf, ln, iendarg, ! &sesc, &sarg, &sendarg, &send) == ESCAPE_EXPAND) goto out_sub; iendarg = iend = send; } else { if (maxl != INT_MAX) maxl--; iend = ++iendarg; --- 321,340 ---- break; } if (buf[iendarg] == buf[iesc]) { ! switch (roff_escape(buf, ln, iendarg, ! &sesc, &sarg, &sendarg, &send)) { ! case ESCAPE_EXPAND: goto out_sub; + case ESCAPE_UNDEF: + break; + default: + valid_A = 0; + break; + } iendarg = iend = send; } else { + if (buf[iendarg] == ' ' || buf[iendarg] == '\t') + valid_A = 0; if (maxl != INT_MAX) maxl--; iend = ++iendarg; *************** *** 341,346 **** --- 352,361 ---- if (resc == NULL && argl == 2 && buf[iarg] == '.' && buf[iarg + 1] == 'T') rval = ESCAPE_DEVICE; + break; + case 'A': + if (valid_A == 0) + iendarg = iarg; break; case 'O': switch (buf[iarg]) {