[BACK]Return to zopen.3 CVS log [TXT][DIR] Up to [local] / src / usr.bin / compress

Annotation of src/usr.bin/compress/zopen.3, Revision 1.5

1.5     ! aaron       1: .\"    $OpenBSD: zopen.3,v 1.4 1997/01/19 17:25:12 millert Exp $
1.1       deraadt     2: .\"    $NetBSD: zopen.3,v 1.3 1995/03/26 09:44:49 glass Exp $
                      3: .\"
                      4: .\" Copyright (c) 1992, 1993
                      5: .\"    The Regents of the University of California.  All rights reserved.
                      6: .\"
                      7: .\" Redistribution and use in source and binary forms, with or without
                      8: .\" modification, are permitted provided that the following conditions
                      9: .\" are met:
                     10: .\" 1. Redistributions of source code must retain the above copyright
                     11: .\"    notice, this list of conditions and the following disclaimer.
                     12: .\" 2. Redistributions in binary form must reproduce the above copyright
                     13: .\"    notice, this list of conditions and the following disclaimer in the
                     14: .\"    documentation and/or other materials provided with the distribution.
                     15: .\" 3. All advertising materials mentioning features or use of this software
                     16: .\"    must display the following acknowledgement:
                     17: .\"    This product includes software developed by the University of
                     18: .\"    California, Berkeley and its contributors.
                     19: .\" 4. Neither the name of the University nor the names of its contributors
                     20: .\"    may be used to endorse or promote products derived from this software
                     21: .\"    without specific prior written permission.
                     22: .\"
                     23: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     24: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     25: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     26: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     27: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     28: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     29: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     30: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     31: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     32: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     33: .\" SUCH DAMAGE.
                     34: .\"
                     35: .\"    @(#)zopen.3     8.1 (Berkeley) 6/9/93
                     36: .\"
                     37: .Dd June 9, 1993
                     38: .Dt ZOPEN 3
                     39: .Os
                     40: .Sh NAME
                     41: .Nm zopen
                     42: .Nd compressed stream open function
                     43: .Sh SYNOPSIS
                     44: .Fd #include <stdio.h>
                     45: .Ft FILE *
                     46: .Fn zopen "const char *path" "const char *mode" "int bits"
1.3       tholo      47: .Ft FILE *
                     48: .Fn zdopen "int fd" "const char *mode" "int bits"
1.1       deraadt    49: .Sh DESCRIPTION
                     50: The
                     51: .Fn zopen
                     52: function
                     53: opens the compressed file whose name is the string pointed to by
                     54: .Fa path
                     55: and associates a stream with it.
                     56: .Pp
1.3       tholo      57: The
                     58: .Fn zdopen
                     59: function
                     60: opens the compressed file whose file descriptor is given in
                     61: .Fa fd
                     62: and associates a stream with it.
                     63: .Pp
1.1       deraadt    64: The argument
                     65: .Fa mode
                     66: points to one of the following one-character strings:
                     67: .Bl -tag -width indent
                     68: .It Dq Li r
                     69: Open compressed file for reading.
                     70: The stream is positioned at the beginning of the file.
                     71: .It Dq Li w
                     72: Truncate file to zero length or create compressed file for writing.
                     73: The stream is positioned at the beginning of the file.
                     74: .El
                     75: .Pp
                     76: Any created files will have mode
                     77: .Pf \\*q Dv S_IRUSR
                     78: \&|
                     79: .Dv S_IWUSR
                     80: \&|
                     81: .Dv S_IRGRP
                     82: \&|
                     83: .Dv S_IWGRP
                     84: \&|
                     85: .Dv S_IROTH
                     86: \&|
                     87: .Dv S_IWOTH Ns \\*q
                     88: .Pq Li 0666 ,
                     89: as modified by the process'
                     90: umask value (see
                     91: .Xr umask 2 ) .
                     92: .Pp
                     93: Files may only be read or written.
                     94: Seek operations are not allowed.
                     95: .Pp
                     96: The
                     97: .Fa bits
                     98: argument, if non-zero, is set to the bits code limit.
                     99: If zero, the default is 16.
                    100: See
                    101: .Fn compress 1
                    102: for more information.
                    103: .Sh RETURN VALUES
                    104: Upon successful completion
                    105: .Fn zopen
                    106: returns a
1.5     ! aaron     107: .Dv FILE
1.1       deraadt   108: pointer.
                    109: Otherwise,
                    110: .Dv NULL
                    111: is returned and the global variable
                    112: .Va errno
                    113: is set to indicate the error.
                    114: .Sh ERRORS
                    115: .Bl -tag -width [EINVAL]
                    116: .It Bq Er EINVAL
                    117: The
                    118: .Fa mode
                    119: or
                    120: .Fa bits
                    121: arguments specified to
                    122: .Fn zopen
                    123: were invalid.
                    124: .It Bq Er EFTYPE
                    125: The compressed file starts with an invalid header, or the compressed
                    126: file is compressed with more bits than can be handled.
                    127: .El
                    128: .Pp
                    129: The
                    130: .Fn zopen
                    131: function may also fail and set
                    132: .Va errno
                    133: for any of the errors specified for the routines
                    134: .Xr fopen 3
                    135: or
                    136: .Xr funopen 3 .
                    137: .Sh SEE ALSO
                    138: .Xr compress 1 ,
                    139: .Xr fopen 3 ,
                    140: .Xr funopen 3
                    141: .Sh HISTORY
                    142: The
                    143: .Nm zopen
                    144: function
1.4       millert   145: first appeared in
                    146: .Bx 4.4 .
1.1       deraadt   147: .Sh BUGS
                    148: The
                    149: .Fn zopen
1.3       tholo     150: and
                    151: .Fn zdopen
                    152: functions
1.1       deraadt   153: may not be portable to systems other than
                    154: .Bx .