convert all Imakefile LinuxDistribution to LinuxArchitecture.
[oweals/cde.git] / cde / programs / dtksh / examples / PipeTest.src
1 XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
2 XCOMM  $XConsortium: PipeTest.src /main/3 1996/04/23 20:18:30 drk $
3
4 XCOMM #########################################################################
5 XCOMM   (c) Copyright 1993, 1994 Hewlett-Packard Company        
6 XCOMM   (c) Copyright 1993, 1994 International Business Machines Corp.
7 XCOMM   (c) Copyright 1993, 1994 Sun Microsystems, Inc.
8 XCOMM   (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
9 XCOMM       Novell, Inc.
10 XCOMM #########################################################################
11
12
13 XCOMM 
14 XCOMM  This sample shell script demonstrates some of the more advanced features
15 XCOMM  of dtksh.  It shows how a structure can be defined and accessed, and
16 XCOMM  how a C library function can be called.
17 XCOMM 
18
19 XCOMM  Define a structure made up of 2 integer fields: pipe_in and pipe_out
20 struct pipe_fds pipe_in:int pipe_out:int
21 typedef 'struct pipe_fds *' pipe_fds_ptr
22
23 echo "Test 1"
24 XCOMM  Malloc space for the structure, and initialize the fields
25 call -F nop '@pipe_fds_ptr:{0,0}'
26 PIPE_FDS=$RET
27 XCOMM  Call the pipe(2) kernel intrinsic
28 call pipe $PIPE_FDS
29 RESULT=$RET
30 XCOMM  Print the values of the fields in the structure
31 call strprint pipe_fds_ptr $PIPE_FDS
32 echo RESULT = $RESULT
33 echo
34
35 XCOMM  Repeat the test, to make sure we get different file descriptors
36 echo "Test 2"
37 call -F nop '@pipe_fds_ptr:{0,0}'
38 PIPE_FDS=$RET
39 call pipe $PIPE_FDS
40 RESULT=$RET
41 call strprint pipe_fds_ptr $PIPE_FDS
42 echo RESULT = $RESULT
43 echo