tst.UnDefineNameWithCPP.d.ksh revision 285830
196126Sobrien#!/bin/ksh -p 296340Sobrien# 397433Speter# CDDL HEADER START 497433Speter# 596340Sobrien# The contents of this file are subject to the terms of the 697433Speter# Common Development and Distribution License (the "License"). 797433Speter# You may not use this file except in compliance with the License. 897433Speter# 997433Speter# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 1096340Sobrien# or http://www.opensolaris.org/os/licensing. 1196340Sobrien# See the License for the specific language governing permissions 1296340Sobrien# and limitations under the License. 1396340Sobrien# 1496340Sobrien# When distributing Covered Code, include this CDDL HEADER in each 1596340Sobrien# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1696340Sobrien# If applicable, add the following below this CDDL HEADER, with the 1796340Sobrien# fields enclosed by brackets "[]" replaced with your own identifying 1896340Sobrien# information: Portions Copyright [yyyy] [name of copyright owner] 1996340Sobrien# 2097433Speter# CDDL HEADER END 2197433Speter# 2296340Sobrien 2396340Sobrien# 2496462Sru# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 2597433Speter# Use is subject to license terms. 2696340Sobrien# 2796340Sobrien 28#ident "%Z%%M% %I% %E% SMI" 29 30## 31# 32# ASSERTION: 33# The -D option can be used to define a name when used in conjunction 34# with the -C option. The -U option can be used to undefine a name in 35# conjunction with the -C option. 36# 37# SECTION: dtrace Utility/-C Option; 38# dtrace Utility/-D Option; 39# dtrace Utility/-U Option 40# 41## 42 43script() 44{ 45 $dtrace -C -D VALUE=40 -U VALUE -s /dev/stdin <<EOF 46 #pragma D option quiet 47 48 BEGIN 49 { 50 printf("Value of VALUE: %d\n", VALUE); 51 exit(0); 52 } 53EOF 54} 55 56if [ $# != 1 ]; then 57 echo expected one argument: '<'dtrace-path'>' 58 exit 2 59fi 60 61dtrace=$1 62 63script 64status=$? 65 66if [ "$status" -ne 0 ]; then 67 exit 0 68fi 69 70echo $tst: dtrace failed 71exit $status 72