12633Sahl#!/bin/ksh -p
22633Sahl#
32633Sahl# CDDL HEADER START
42633Sahl#
52633Sahl# The contents of this file are subject to the terms of the
62633Sahl# Common Development and Distribution License (the "License").
72633Sahl# You may not use this file except in compliance with the License.
82633Sahl#
92633Sahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
102633Sahl# or http://www.opensolaris.org/os/licensing.
112633Sahl# See the License for the specific language governing permissions
122633Sahl# and limitations under the License.
132633Sahl#
142633Sahl# When distributing Covered Code, include this CDDL HEADER in each
152633Sahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
162633Sahl# If applicable, add the following below this CDDL HEADER, with the
172633Sahl# fields enclosed by brackets "[]" replaced with your own identifying
182633Sahl# information: Portions Copyright [yyyy] [name of copyright owner]
192633Sahl#
202633Sahl# CDDL HEADER END
212633Sahl#
222633Sahl
232633Sahl#
242633Sahl# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
252633Sahl# Use is subject to license terms.
262633Sahl#
272633Sahl
282633Sahl#ident	"%Z%%M%	%I%	%E% SMI"
292633Sahl
302633Sahl############################################################################
312633Sahl# ASSERTION:
322633Sahl#	Pass 10 arguments and try to print them.
332633Sahl#
342633Sahl# SECTION: Scripting
352633Sahl#
362633Sahl############################################################################
372633Sahl
38*2804Stomeeif [ $# != 1 ]; then
39*2804Stomee	echo expected one argument: '<'dtrace-path'>'
40*2804Stomee	exit 2
41*2804Stomeefi
42*2804Stomee
43*2804Stomeedtrace=$1
44*2804Stomee
452633Sahlbname=`/bin/basename $0`
462633Sahl
472633Sahldfilename=/var/tmp/$bname.$$
482633Sahl
492633Sahl
502633Sahl## Create .d file
512633Sahl##########################################################################
522633Sahlcat > $dfilename <<-EOF
53*2804Stomee#!$dtrace -qs
542633Sahl
552633Sahl
562633SahlBEGIN
572633Sahl{
582633Sahl	printf("%d %d %d %d %d %d %d %d %d %d", \$1, \$2, \$3, \$4, \$5, \$6,
592633Sahl		\$7, \$8, \$9, \$10);
602633Sahl	exit(0);
612633Sahl}
622633SahlEOF
632633Sahl##########################################################################
642633Sahl
652633Sahl
662633Sahl#Call dtrace -C -s <.d>
672633Sahl
682633Sahlchmod 555 $dfilename
692633Sahl
702633Sahl
712633Sahloutput=`$dfilename 1 2 3 4 5 6 7 8 9 10 2>/dev/null`
72*2804Stomee
732633Sahlif [ $? -ne 0 ]; then
742633Sahl	print -u2 "Error in executing $dfilename"
752633Sahl	exit 1
762633Sahlfi
772633Sahl
782633Sahlset -A outarray $output
792633Sahl
802633Sahlif [[ ${outarray[0]} != 1 || ${outarray[1]} != 2 || ${outarray[2]} != 3 || \
812633Sahl	${outarray[3]} != 4 || ${outarray[4]} != 5 || ${outarray[5]} != 6 || \
822633Sahl	${outarray[6]} != 7 || ${outarray[7]} != 8 || ${outarray[8]} != 9 || \
832633Sahl	${outarray[9]} != 10 ]]; then
842633Sahl	print -u2 "Error in output by $dfilename"
852633Sahl	exit 1
862633Sahlfi
872633Sahl
882633Sahl/usr/bin/rm -f $dfilename
892633Sahlexit 0
902633Sahl
91