View | Details | Raw Unified | Return to bug 229641 | Differences between
and this patch

Collapse All | Expand All

(-)usr.bin/printf/printf.c (-4 / +8 lines)
Lines 1-6 Link Here
1
/*-
1
/*-
2
 * SPDX-License-Identifier: BSD-3-Clause
2
 * SPDX-License-Identifier: BSD-3-Clause
3
 *
3
 *
4
 * Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
4
 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
5
 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
5
 * Copyright 2010 Nexenta Systems, Inc.  All rights reserved.
6
 * Copyright 2010 Nexenta Systems, Inc.  All rights reserved.
6
 * Copyright (c) 1989, 1993
7
 * Copyright (c) 1989, 1993
Lines 375-390 Link Here
375
		char *p;
376
		char *p;
376
		int getout;
377
		int getout;
377
378
378
		p = strdup(getstr());
379
		/* Convert "b" to "s" for output. */
379
		if (p == NULL) {
380
		start[strlen(start) - 1] = 's';
381
		if ((p = strdup(getstr())) == NULL) {
380
			warnx("%s", strerror(ENOMEM));
382
			warnx("%s", strerror(ENOMEM));
381
			return (NULL);
383
			return (NULL);
382
		}
384
		}
383
		getout = escape(p, 0, &len);
385
		getout = escape(p, 0, &len);
384
		fputs(p, stdout);
386
		PF(start, p);
387
385
		free(p);
388
		free(p);
389
		/* Restore format for next loop. */
386
		if (getout)
390
		if (getout)
387
			return (end_fmt);
391
			exit(*rval);
388
		break;
392
		break;
389
	}
393
	}
390
	case 'c': {
394
	case 'c': {
(-)usr.bin/printf/tests/Makefile (+1 lines)
Lines 5-10 Link Here
5
TAP_TESTS_SH=	legacy_test
5
TAP_TESTS_SH=	legacy_test
6
6
7
${PACKAGE}FILES+=		regress.b.out
7
${PACKAGE}FILES+=		regress.b.out
8
${PACKAGE}FILES+=		regress.bwidth.out
8
${PACKAGE}FILES+=		regress.d.out
9
${PACKAGE}FILES+=		regress.d.out
9
${PACKAGE}FILES+=		regress.f.out
10
${PACKAGE}FILES+=		regress.f.out
10
${PACKAGE}FILES+=		regress.l1.out
11
${PACKAGE}FILES+=		regress.l1.out
(-)usr.bin/printf/tests/regress.bwidth.out (+1 lines)
Line 0 Link Here
1
      a
(-)usr.bin/printf/tests/regress.sh (-1 / +2 lines)
Lines 2-8 Link Here
2
2
3
REGRESSION_START($1)
3
REGRESSION_START($1)
4
4
5
echo '1..23'
5
echo '1..24'
6
6
7
REGRESSION_TEST(`b', `printf "abc%b%b" "def\n" "\cghi"')
7
REGRESSION_TEST(`b', `printf "abc%b%b" "def\n" "\cghi"')
8
REGRESSION_TEST(`d', `printf "%d,%5d,%.5d,%0*d,%.*d\n" 123 123 123 5 123 5 123')
8
REGRESSION_TEST(`d', `printf "%d,%5d,%.5d,%0*d,%.*d\n" 123 123 123 5 123 5 123')
Lines 27-31 Link Here
27
REGRESSION_TEST(`missingpos1', `printf "%1\$*2\$.*s" 1 1 1 2>&1')
27
REGRESSION_TEST(`missingpos1', `printf "%1\$*2\$.*s" 1 1 1 2>&1')
28
REGRESSION_TEST(`missingpos1', `printf "%*1\$.*2\$s" 1 1 1 2>&1')
28
REGRESSION_TEST(`missingpos1', `printf "%*1\$.*2\$s" 1 1 1 2>&1')
29
REGRESSION_TEST(`missingpos1', `printf "%1\$*.*2\$s" 1 1 1 2>&1')
29
REGRESSION_TEST(`missingpos1', `printf "%1\$*.*2\$s" 1 1 1 2>&1')
30
REGRESSION_TEST(`bwidth', `printf "%8.2b" "a\nb\n"')
30
31
31
REGRESSION_END()
32
REGRESSION_END()

Return to bug 229641