xref: /illumos-gate/usr/src/cmd/dtrace/test/tst/common/funcs/tst.lltostrbase.d (revision 0250c53ad267726f2438e3c6556199a0bbf588a2)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright (c) 2011, Joyent, Inc. All rights reserved.
24  */
25 
26 #pragma D option quiet
27 
28 int64_t val[int];
29 
30 BEGIN
31 {
32 	base = -2;
33 	i = 0;
34 	val[i++] = -10;
35 	val[i++] = -1;
36 	val[i++] = 0;
37 	val[i++] = 10;
38 	val[i++] = 100;
39 	val[i++] = 1000;
40 	val[i++] = (1LL << 62);
41 	maxval = i;
42 	i = 0;
43 }
44 
45 tick-1ms
46 /i < maxval/
47 {
48 	printf("base %2d of %20d:  ", base, val[i]);
49 }
50 
51 tick-1ms
52 /i < maxval/
53 {
54 	printf("  %s\n", lltostr(val[i], base));
55 }
56 
57 ERROR
58 {
59 	printf("  <error>\n");
60 }
61 
62 tick-1ms
63 /i < maxval/
64 {
65 	i++;
66 }
67 
68 tick-1ms
69 /i == maxval/
70 {
71 	i = 0;
72 	base++;
73 }
74 
75 tick-1ms
76 /base > 40/
77 {
78 	exit(0);
79 }
80 
81