xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/printf1.awk (revision e6d6c189fa3a95d7aa27bbe0aeacf7c1a6b57c8c)
1*e6d6c189SCody Peter Mello# Tue May 25 16:36:16 IDT 1999
2*e6d6c189SCody Peter Mello#
3*e6d6c189SCody Peter Mello# Test cases based on email from Andreas Schwab, schwab@gnu.org
4*e6d6c189SCody Peter Mello
5*e6d6c189SCody Peter MelloBEGIN {
6*e6d6c189SCody Peter Mello	fmt[1] = "%8.5d";	data[1] = 100
7*e6d6c189SCody Peter Mello	fmt[2] = "%#o";		data[2] = 0
8*e6d6c189SCody Peter Mello	fmt[3] = "%#.1o";	data[3] = 0
9*e6d6c189SCody Peter Mello	fmt[4] = "%#.0o";	data[4] = 0
10*e6d6c189SCody Peter Mello	fmt[5] = "%#x";		data[5] = 0
11*e6d6c189SCody Peter Mello	fmt[6] = "%.0d";	data[6] = 0
12*e6d6c189SCody Peter Mello	fmt[7] = "%5.0d";	data[7] = 0
13*e6d6c189SCody Peter Mello
14*e6d6c189SCody Peter Mello	for (i = 1; i <= 7; i++) {
15*e6d6c189SCody Peter Mello		format = "%s, %d --- |" fmt[i] "|\n"
16*e6d6c189SCody Peter Mello		printf(format, fmt[i], data[i], data[i])
17*e6d6c189SCody Peter Mello	}
18*e6d6c189SCody Peter Mello
19*e6d6c189SCody Peter Mello}
20