-/* $OpenBSD: ex.c,v 1.22 2022/02/20 19:45:51 tb Exp $ */
+/* $OpenBSD: ex.c,v 1.23 2023/06/23 15:06:45 millert Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
LF_INIT(FL_ISSET(ecp->iflags, E_C_HASH | E_C_LIST | E_C_PRINT));
if (!LF_ISSET(E_C_HASH | E_C_LIST | E_C_PRINT | E_NOAUTO) &&
!F_ISSET(sp, SC_EX_GLOBAL) &&
- O_ISSET(sp, O_AUTOPRINT) && F_ISSET(ecp, E_AUTOPRINT))
- LF_INIT(E_C_PRINT);
+ O_ISSET(sp, O_AUTOPRINT) && F_ISSET(ecp, E_AUTOPRINT)) {
+
+ /* Honor the number option if autoprint is set. */
+ if (F_ISSET(ecp, E_OPTNUM))
+ LF_INIT(E_C_HASH);
+ else
+ LF_INIT(E_C_PRINT);
+ }
if (LF_ISSET(E_C_HASH | E_C_LIST | E_C_PRINT)) {
cur.lno = sp->lno;
-/* $OpenBSD: ex_subst.c,v 1.30 2017/04/18 01:45:35 deraadt Exp $ */
+/* $OpenBSD: ex_subst.c,v 1.31 2023/06/23 15:06:45 millert Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
goto lquit;
}
} else {
- if (ex_print(sp, cmdp, &from, &to, 0) ||
+ const int flags =
+ O_ISSET(sp, O_NUMBER) ? E_C_HASH : 0;
+ if (ex_print(sp, cmdp, &from, &to, flags) ||
ex_scprint(sp, &from, &to))
goto lquit;
if (ex_txt(sp, &tiq, 0, TXT_CR))