tst.basics.d revision 178476
1251881Speter/* 2251881Speter * CDDL HEADER START 3251881Speter * 4251881Speter * The contents of this file are subject to the terms of the 5251881Speter * Common Development and Distribution License (the "License"). 6251881Speter * You may not use this file except in compliance with the License. 7251881Speter * 8251881Speter * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9251881Speter * or http://www.opensolaris.org/os/licensing. 10251881Speter * See the License for the specific language governing permissions 11251881Speter * and limitations under the License. 12251881Speter * 13251881Speter * When distributing Covered Code, include this CDDL HEADER in each 14251881Speter * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15251881Speter * If applicable, add the following below this CDDL HEADER, with the 16251881Speter * fields enclosed by brackets "[]" replaced with your own identifying 17251881Speter * information: Portions Copyright [yyyy] [name of copyright owner] 18251881Speter * 19251881Speter * CDDL HEADER END 20251881Speter */ 21251881Speter 22251881Speter/* 23251881Speter * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24251881Speter * Use is subject to license terms. 25251881Speter */ 26251881Speter 27251881Speter#pragma ident "%Z%%M% %I% %E% SMI" 28251881Speter 29251881Speter/* 30251881Speter * ASSERTION: 31251881Speter * Test the basics of all the format conversions in the printf dictionary. 32251881Speter * 33251881Speter * SECTION: Output Formatting/printf() 34251881Speter * 35251881Speter * NOTES: 36251881Speter * floats and wchar_t strings missing 37251881Speter */ 38251881Speter 39251881Speter#pragma D option quiet 40251881Speter 41251881SpeterBEGIN 42251881Speter{ 43251881Speter i = (int)'a'; 44251881Speter 45251881Speter printf("\n"); 46251881Speter 47251881Speter printf("%%a = %a\n", &`kmem_alloc); 48251881Speter printf("%%c = %c\n", i); 49251881Speter printf("%%d = %d\n", i); 50251881Speter printf("%%hd = %hd\n", (short)i); 51251881Speter printf("%%hi = %hi\n", (short)i); 52251881Speter printf("%%ho = %ho\n", (ushort_t)i); 53251881Speter printf("%%hu = %hu\n", (ushort_t)i); 54251881Speter printf("%%hx = %hx\n", (ushort_t)i); 55251881Speter printf("%%hX = %hX\n", (ushort_t)i); 56251881Speter printf("%%i = %i\n", i); 57251881Speter printf("%%lc = %lc\n", i); 58251881Speter printf("%%ld = %ld\n", (long)i); 59251881Speter printf("%%li = %li\n", (long)i); 60251881Speter printf("%%lo = %lo\n", (ulong_t)i); 61251881Speter printf("%%lu = %lu\n", (ulong_t)i); 62251881Speter printf("%%lx = %lx\n", (ulong_t)i); 63251881Speter printf("%%lX = %lX\n", (ulong_t)i); 64251881Speter printf("%%o = %o\n", (uint_t)i); 65251881Speter printf("%%p = %p\n", (void *)i); 66251881Speter printf("%%s = %s\n", "hello"); 67251881Speter printf("%%u = %u\n", (uint_t)i); 68251881Speter printf("%%wc = %wc\n", i); 69251881Speter printf("%%x = %x\n", (uint_t)i); 70251881Speter printf("%%X = %X\n", (uint_t)i); 71251881Speter 72251881Speter exit(0); 73251881Speter} 74251881Speter