4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 #pragma ident "%Z%%M% %I% %E% SMI"
38 extern int pkread(), pkwrite();
39 extern void pkclose();
41 static int grdblk(char *, int);
42 static int gwrblk(char *, int);
44 extern int packsize
, xpacksize
;
46 jmp_buf Getjbuf
, Gfailbuf
;
48 static void (*gsig
)();
55 signal(SIGALRM
, galarm
);
68 struct pack
*pkopen();
71 gsig
=signal(SIGALRM
, galarm
);
74 Pk
= pkopen(Ifn
, Ofn
);
86 (void) signal(SIGALRM
, gsig
);
95 char bufr
[BUFSIZ
], *s
;
107 len
= strlen(bufr
) + 1;
108 if ((i
= len
% xpacksize
) != 0) {
109 len
= len
+ xpacksize
- i
;
110 bufr
[len
- 1] = '\0';
127 len
= pkread(str
, packsize
);
131 if (*(str
- 1) == '\0')
153 while ((len
= read( fd1
, bufr
, BUFSIZ
)) > 0) {
156 ret
= gwrblk(bufr
, len
);
163 ret
= gwrblk(bufr
, 0);
183 len
= grdblk(bufr
, BUFSIZ
);
189 if ( ret
== SUCCESS
&& write( fd2
, bufr
, len
) != len
) {
191 DEBUG(7, "grddata: write to file failed, errno %d\n", errno
);
207 for (i
= 0; i
< len
; i
+= ret
) {
208 ret
= pkread(blk
, len
- i
);
223 return(pkwrite(blk
, len
));