1 XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
2 XCOMM $XConsortium: PipeTest.src /main/3 1996/04/23 20:18:30 drk $
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
10 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.
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
24 XCOMM Malloc space for the structure, and initialize the fields
25 call -F nop '@pipe_fds_ptr:{0,0}'
27 XCOMM Call the pipe(2) kernel intrinsic
30 XCOMM Print the values of the fields in the structure
31 call strprint pipe_fds_ptr $PIPE_FDS
35 XCOMM Repeat the test, to make sure we get different file descriptors
37 call -F nop '@pipe_fds_ptr:{0,0}'
41 call strprint pipe_fds_ptr $PIPE_FDS