tst.basics.d revision 178477
1193323Sed/* 2193323Sed * CDDL HEADER START 3193323Sed * 4193323Sed * The contents of this file are subject to the terms of the 5193323Sed * Common Development and Distribution License (the "License"). 6193323Sed * You may not use this file except in compliance with the License. 7193323Sed * 8193323Sed * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9193323Sed * or http://www.opensolaris.org/os/licensing. 10193323Sed * See the License for the specific language governing permissions 11193323Sed * and limitations under the License. 12193323Sed * 13193323Sed * When distributing Covered Code, include this CDDL HEADER in each 14193323Sed * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15193323Sed * If applicable, add the following below this CDDL HEADER, with the 16193323Sed * fields enclosed by brackets "[]" replaced with your own identifying 17193323Sed * information: Portions Copyright [yyyy] [name of copyright owner] 18249423Sdim * 19193323Sed * CDDL HEADER END 20198090Srdivacky */ 21249423Sdim 22198090Srdivacky/* 23193323Sed * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24193323Sed * Use is subject to license terms. 25193323Sed */ 26193323Sed 27193323Sed#pragma ident "%Z%%M% %I% %E% SMI" 28193323Sed 29193323Sed/* 30193323Sed * ASSERTION: 31193323Sed * Test the basics of all the format conversions in the printf dictionary. 32193323Sed * 33193323Sed * SECTION: Output Formatting/printf() 34193323Sed * 35193323Sed * NOTES: 36193323Sed * floats and wchar_t strings missing 37193323Sed */ 38193323Sed 39193323Sed#pragma D option quiet 40193323Sed 41193323SedBEGIN 42193323Sed{ 43193323Sed i = (int)'a'; 44193323Sed 45193323Sed printf("\n"); 46193323Sed 47193323Sed printf("%%a = %a\n", &`kmem_alloc); 48193323Sed printf("%%c = %c\n", i); 49193323Sed printf("%%d = %d\n", i); 50193323Sed printf("%%hd = %hd\n", (short)i); 51193323Sed printf("%%hi = %hi\n", (short)i); 52193323Sed printf("%%ho = %ho\n", (ushort_t)i); 53193323Sed printf("%%hu = %hu\n", (ushort_t)i); 54193323Sed printf("%%hx = %hx\n", (ushort_t)i); 55193323Sed printf("%%hX = %hX\n", (ushort_t)i); 56193323Sed printf("%%i = %i\n", i); 57193323Sed printf("%%lc = %lc\n", i); 58193323Sed printf("%%ld = %ld\n", (long)i); 59193323Sed printf("%%li = %li\n", (long)i); 60193323Sed printf("%%lo = %lo\n", (ulong_t)i); 61193323Sed printf("%%lu = %lu\n", (ulong_t)i); 62193323Sed printf("%%lx = %lx\n", (ulong_t)i); 63193323Sed printf("%%lX = %lX\n", (ulong_t)i); 64193323Sed printf("%%o = %o\n", (uint_t)i); 65193323Sed printf("%%p = %p\n", (void *)i); 66193323Sed printf("%%s = %s\n", "hello"); 67193323Sed printf("%%u = %u\n", (uint_t)i); 68193323Sed printf("%%wc = %wc\n", i); 69193323Sed printf("%%x = %x\n", (uint_t)i); 70193323Sed printf("%%X = %X\n", (uint_t)i); 71193323Sed 72193323Sed exit(0); 73193323Sed} 74263508Sdim