1e64fe029SMartin Matuska.\"- 2*bd66c1b4SMartin Matuska.\" SPDX-License-Identifier: BSD-2-Clause 3*bd66c1b4SMartin Matuska.\" 4e64fe029SMartin Matuska.\" Copyright (c) 2007-2008 Dag-Erling Smørgrav 5e64fe029SMartin Matuska.\" All rights reserved. 6e64fe029SMartin Matuska.\" 764884e0dSMartin Matuska.Dd June 27, 2023 8e64fe029SMartin Matuska.Dt BSDUNZIP 1 9e64fe029SMartin Matuska.Os 10e64fe029SMartin Matuska.Sh NAME 11e64fe029SMartin Matuska.Nm bsdunzip 12e64fe029SMartin Matuska.Nd extract files from a ZIP archive 13e64fe029SMartin Matuska.Sh SYNOPSIS 14e64fe029SMartin Matuska.Nm 15e64fe029SMartin Matuska.Op Fl aCcfjLlnopqtuvy 1664884e0dSMartin Matuska.Op { Fl O | Fl I No } Ar encoding 17e64fe029SMartin Matuska.Op Fl d Ar dir 18e64fe029SMartin Matuska.Op Fl x Ar pattern 19e64fe029SMartin Matuska.Op Fl P Ar password 20e64fe029SMartin Matuska.Ar zipfile 21e64fe029SMartin Matuska.Op Ar member ... 22e64fe029SMartin Matuska.Sh DESCRIPTION 23e64fe029SMartin Matuska.\" ... 24e64fe029SMartin MatuskaThe following options are available: 25e64fe029SMartin Matuska.Bl -tag -width Fl 26e64fe029SMartin Matuska.It Fl a 27e64fe029SMartin MatuskaWhen extracting a text file, convert DOS-style line endings to 28e64fe029SMartin MatuskaUnix-style line endings. 29e64fe029SMartin Matuska.It Fl C 30e64fe029SMartin MatuskaMatch file names case-insensitively. 31e64fe029SMartin Matuska.It Fl c 32e64fe029SMartin MatuskaExtract to stdout/screen. 33e64fe029SMartin MatuskaWhen extracting files from the zipfile, they are written to stdout. 34e64fe029SMartin MatuskaThis is similar to 35e64fe029SMartin Matuska.Fl p , 36e64fe029SMartin Matuskabut does not suppress normal output. 37e64fe029SMartin Matuska.It Fl d Ar dir 38e64fe029SMartin MatuskaExtract files into the specified directory rather than the current 39e64fe029SMartin Matuskadirectory. 40e64fe029SMartin Matuska.It Fl f 41e64fe029SMartin MatuskaUpdate existing. 42e64fe029SMartin MatuskaExtract only files from the zipfile if a file with the same name 43e64fe029SMartin Matuskaalready exists on disk and is older than the former. 44e64fe029SMartin MatuskaOtherwise, the file is silently skipped. 4564884e0dSMartin Matuska.It Fl I Ar encoding 4664884e0dSMartin Matuska.It Fl O Ar encoding 4764884e0dSMartin MatuskaConvert filenames from the specified encoding. 48e64fe029SMartin Matuska.It Fl j 49e64fe029SMartin MatuskaIgnore directories stored in the zipfile; instead, extract all files 50e64fe029SMartin Matuskadirectly into the extraction directory. 51e64fe029SMartin Matuska.It Fl L 52e64fe029SMartin MatuskaConvert the names of the extracted files and directories to lowercase. 53e64fe029SMartin Matuska.It Fl l 54e64fe029SMartin MatuskaList, rather than extract, the contents of the zipfile. 55e64fe029SMartin Matuska.It Fl n 56e64fe029SMartin MatuskaNo overwrite. 57e64fe029SMartin MatuskaWhen extracting a file from the zipfile, if a file with the same name 58e64fe029SMartin Matuskaalready exists on disk, the file is silently skipped. 59e64fe029SMartin Matuska.It Fl o 60e64fe029SMartin MatuskaOverwrite. 61e64fe029SMartin MatuskaWhen extracting a file from the zipfile, if a file with the same name 62e64fe029SMartin Matuskaalready exists on disk, the existing file is replaced with the file 63e64fe029SMartin Matuskafrom the zipfile. 64e64fe029SMartin Matuska.It Fl p 65e64fe029SMartin MatuskaExtract to stdout. 66e64fe029SMartin MatuskaWhen extracting files from the zipfile, they are written to stdout. 67e64fe029SMartin MatuskaThe normal output is suppressed as if 68e64fe029SMartin Matuska.Fl q 69e64fe029SMartin Matuskawas specified. 70e64fe029SMartin Matuska.It Fl P Ar password 71e64fe029SMartin MatuskaExtract encrypted files using a password. 72e64fe029SMartin MatuskaPutting a password on the command line using this option can be 73e64fe029SMartin Matuskainsecure. 74e64fe029SMartin Matuska.It Fl q 75e64fe029SMartin MatuskaQuiet: print less information while extracting. 76e64fe029SMartin Matuska.It Fl t 77e64fe029SMartin MatuskaTest: do not extract anything, but verify the checksum of every file 78e64fe029SMartin Matuskain the archive. 79e64fe029SMartin Matuska.It Fl u 80e64fe029SMartin MatuskaUpdate. 81e64fe029SMartin MatuskaWhen extracting a file from the zipfile, if a file with the same name 82e64fe029SMartin Matuskaalready exists on disk, the existing file is replaced with the file 83e64fe029SMartin Matuskafrom the zipfile if and only if the latter is newer than the former. 84e64fe029SMartin MatuskaOtherwise, the file is silently skipped. 85e64fe029SMartin Matuska.It Fl v 86e64fe029SMartin MatuskaList verbosely, rather than extract, the contents of the zipfile. 87e64fe029SMartin MatuskaThis differs from 88e64fe029SMartin Matuska.Fl l 89e64fe029SMartin Matuskaby using the long listing. 90e64fe029SMartin MatuskaNote that most of the data is currently fake and does not reflect the 91e64fe029SMartin Matuskacontent of the archive. 92e64fe029SMartin Matuska.It Fl x Ar pattern 93e64fe029SMartin MatuskaExclude files matching the pattern 94e64fe029SMartin Matuska.Ar pattern . 95e64fe029SMartin Matuska.It Fl y 96e64fe029SMartin MatuskaPrint four digit years in listings instead of two. 97e64fe029SMartin Matuska.It Fl Z Ar mode 98e64fe029SMartin MatuskaEmulate 99e64fe029SMartin Matuska.Xr zipinfo 1L 100e64fe029SMartin Matuskamode. 101e64fe029SMartin MatuskaEnabling 102e64fe029SMartin Matuska.Xr zipinfo 1L 103e64fe029SMartin Matuskamode changes the way in which additional arguments are parsed. 104e64fe029SMartin MatuskaCurrently only 105e64fe029SMartin Matuska.Xr zipinfo 1L 106e64fe029SMartin Matuskamode 1 is supported, which lists the file names one per line. 107e64fe029SMartin Matuska.It Ar [member ...] 108e64fe029SMartin MatuskaOptional list of members to extract from the zipfile. 10964884e0dSMartin MatuskaCan include patterns, e.g., 110e64fe029SMartin Matuska.Ar 'memberdir/*' 111e64fe029SMartin Matuskawill extract all files and dirs below memberdir. 112e64fe029SMartin Matuska.El 113e64fe029SMartin Matuska.Pp 114e64fe029SMartin MatuskaNote that only one of 115e64fe029SMartin Matuska.Fl n , 116e64fe029SMartin Matuska.Fl o , 117e64fe029SMartin Matuskaand 118e64fe029SMartin Matuska.Fl u 119e64fe029SMartin Matuskamay be specified. 120e64fe029SMartin MatuskaIf specified filename is 121e64fe029SMartin Matuska.Qq - , 122e64fe029SMartin Matuskathen data is read from 123e64fe029SMartin Matuska.Va stdin . 124e64fe029SMartin Matuska.Sh ENVIRONMENT 125e64fe029SMartin MatuskaIf the 126e64fe029SMartin Matuska.Ev UNZIP_DEBUG 127e64fe029SMartin Matuskaenvironment variable is defined, the 128e64fe029SMartin Matuska.Fl q 129e64fe029SMartin Matuskacommand-line option has no effect, and additional debugging 130e64fe029SMartin Matuskainformation will be printed to 131e64fe029SMartin Matuska.Va stderr . 132e64fe029SMartin Matuska.Sh COMPATIBILITY 133e64fe029SMartin MatuskaThe 134e64fe029SMartin Matuska.Nm 135e64fe029SMartin Matuskautility aims to be sufficiently compatible with other implementations 136e64fe029SMartin Matuskato serve as a drop-in replacement in the context of the 137e64fe029SMartin Matuska.Xr ports 7 138e64fe029SMartin Matuskasystem. 139e64fe029SMartin MatuskaNo attempt has been made to replicate functionality which is not 140e64fe029SMartin Matuskarequired for that purpose. 141e64fe029SMartin Matuska.Pp 142e64fe029SMartin MatuskaFor compatibility reasons, command-line options will be recognized if 143e64fe029SMartin Matuskathey are listed not only before but also after the name of the 144e64fe029SMartin Matuskazipfile. 145e64fe029SMartin Matuska.Pp 146e64fe029SMartin MatuskaNormally, the 147e64fe029SMartin Matuska.Fl a 148e64fe029SMartin Matuskaoption should only affect files which are marked as text files in the 149e64fe029SMartin Matuskazipfile's central directory. 150e64fe029SMartin MatuskaSince the 151e64fe029SMartin Matuska.Xr archive 3 152e64fe029SMartin Matuskalibrary does not provide access to that information, it is not available 153e64fe029SMartin Matuskato the 154e64fe029SMartin Matuska.Nm 155e64fe029SMartin Matuskautility. 156e64fe029SMartin MatuskaInstead, the 157e64fe029SMartin Matuska.Nm 158e64fe029SMartin Matuskautility will assume that a file is a text file if no non-ASCII 159e64fe029SMartin Matuskacharacters are present within the first block of data decompressed for 160e64fe029SMartin Matuskathat file. 161e64fe029SMartin MatuskaIf non-ASCII characters appear in subsequent blocks of data, a warning 162e64fe029SMartin Matuskawill be issued. 163e64fe029SMartin Matuska.Pp 164e64fe029SMartin MatuskaThe 165e64fe029SMartin Matuska.Nm 166e64fe029SMartin Matuskautility is only able to process ZIP archives handled by 167e64fe029SMartin Matuska.Xr libarchive 3 . 168e64fe029SMartin MatuskaDepending on the installed version of 169e64fe029SMartin Matuska.Xr libarchive 3 , 170e64fe029SMartin Matuskathis may or may not include self-extracting or ZIPX archives. 171e64fe029SMartin Matuska.Sh SEE ALSO 172e64fe029SMartin Matuska.Xr libarchive 3 173e64fe029SMartin Matuska.Sh HISTORY 174e64fe029SMartin MatuskaThe 175e64fe029SMartin Matuska.Nm 176e64fe029SMartin Matuskautility appeared in 177e64fe029SMartin Matuska.Fx 8.0 . 178e64fe029SMartin Matuska.Sh AUTHORS 179e64fe029SMartin MatuskaThe 180e64fe029SMartin Matuska.Nm 181e64fe029SMartin Matuskautility and this manual page were written by 182e64fe029SMartin Matuska.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . 183e64fe029SMartin MatuskaIt uses the 184e64fe029SMartin Matuska.Xr archive 3 185e64fe029SMartin Matuskalibrary developed by 186e64fe029SMartin Matuska.An Tim Kientzle Aq Mt kientzle@FreeBSD.org . 187e64fe029SMartin Matuska.Sh CAVEATS 188e64fe029SMartin MatuskaThe 189e64fe029SMartin Matuska.Nm 190e64fe029SMartin Matuskautility performs two scans of the command-line for arguments before 191e64fe029SMartin Matuskaand after the archive name, so as to maintain compatibility with 192e64fe029SMartin MatuskaInfo-ZIP unzip. 193e64fe029SMartin MatuskaAs a result, the POSIX 194e64fe029SMartin Matuska.Ql -- 195e64fe029SMartin Matuskadouble-dash string used to separate options from arguments will need to 196e64fe029SMartin Matuskabe repeated. 197e64fe029SMartin MatuskaFor example, to extract a "-a.jpg" from "-b.zip" with overwrite, one 198e64fe029SMartin Matuskawould need to invoke 199e64fe029SMartin Matuska.Dl bsdunzip -o -- -a.jpg -- -b.zip 200