1UNZIPSFX(1L) UNZIPSFX(1L) 2 3NAME 4 unzipsfx - self-extracting stub for prepending to ZIP archives 5 6SYNOPSIS 7 <name of unzipsfx+archive combo> [-cfptuz[ajnoqsCLV$]] [file(s) ... 8 [-x xfile(s) ...]] 9 10DESCRIPTION 11 unzipsfx is a modified version of unzip(1L) designed to be prepended to 12 existing ZIP archives in order to form self-extracting archives. 13 Instead of taking its first non-flag argument to be the zipfile(s) to 14 be extracted, unzipsfx seeks itself under the name by which it was 15 invoked and tests or extracts the contents of the appended archive. 16 Because the executable stub adds bulk to the archive (the whole purpose 17 of which is to be as small as possible), a number of the less-vital 18 capabilities in regular unzip have been removed. Among these are the 19 usage (or help) screen, the listing and diagnostic functions (-l and 20 -v), the ability to decompress older compression formats (the 21 ``reduce,'' ``shrink'' and ``implode'' methods). The ability to 22 extract to a directory other than the current one can be selected as a 23 compile-time option, which is now enabled by default since UnZipSFX 24 version 5.5. Similarly, decryption is supported as a compile-time 25 option but should be avoided unless the attached archive contains 26 encrypted files. Starting with release 5.5, another compile-time option 27 adds a simple ``run command after extraction'' feature. This feature 28 is currently incompatible with the ``extract to different directory'' 29 feature and remains disabled by default. 30 31 Note that self-extracting archives made with unzipsfx are no more (or 32 less) portable across different operating systems than is the unzip 33 executable itself. In general a self-extracting archive made on a par- 34 ticular Unix system, for example, will only self-extract under the same 35 flavor of Unix. Regular unzip may still be used to extract the embed- 36 ded archive as with any normal zipfile, although it will generate a 37 harmless warning about extra bytes at the beginning of the zipfile. 38 Despite this, however, the self-extracting archive is technically not a 39 valid ZIP archive, and PKUNZIP may be unable to test or extract it. 40 This limitation is due to the simplistic manner in which the archive is 41 created; the internal directory structure is not updated to reflect the 42 extra bytes prepended to the original zipfile. 43 44ARGUMENTS 45 [file(s)] 46 An optional list of archive members to be processed. Regular 47 expressions (wildcards) similar to those in Unix egrep(1) may be 48 used to match multiple members. These wildcards may contain: 49 50 * matches a sequence of 0 or more characters 51 52 ? matches exactly 1 character 53 54 [...] matches any single character found inside the brackets; 55 ranges are specified by a beginning character, a hyphen, 56 and an ending character. If an exclamation point or a 57 caret (`!' or `^') follows the left bracket, then the 58 range of characters within the brackets is complemented 59 (that is, anything except the characters inside the 60 brackets is considered a match). 61 62 (Be sure to quote any character that might otherwise be inter- 63 preted or modified by the operating system, particularly under 64 Unix and VMS.) 65 66 [-x xfile(s)] 67 An optional list of archive members to be excluded from process- 68 ing. Since wildcard characters match directory separators 69 (`/'), this option may be used to exclude any files that are in 70 subdirectories. For example, ``foosfx *.[ch] -x */*'' would 71 extract all C source files in the main directory, but none in 72 any subdirectories. Without the -x option, all C source files 73 in all directories within the zipfile would be extracted. 74 75 If unzipsfx is compiled with SFX_EXDIR defined, the following option is 76 also enabled: 77 78 [-d exdir] 79 An optional directory to which to extract files. By default, 80 all files and subdirectories are recreated in the current direc- 81 tory; the -d option allows extraction in an arbitrary directory 82 (always assuming one has permission to write to the directory). 83 The option and directory may be concatenated without any white 84 space between them, but note that this may cause normal shell 85 behavior to be suppressed. In particular, ``-d ~'' (tilde) is 86 expanded by Unix C shells into the name of the user's home 87 directory, but ``-d~'' is treated as a literal subdirectory 88 ``~'' of the current directory. 89 90OPTIONS 91 unzipsfx supports the following unzip(1L) options: -c and -p (extract 92 to standard output/screen), -f and -u (freshen and update existing 93 files upon extraction), -t (test archive) and -z (print archive com- 94 ment). All normal listing options (-l, -v and -Z) have been removed, 95 but the testing option (-t) may be used as a ``poor man's'' listing. 96 Alternatively, those creating self-extracting archives may wish to 97 include a short listing in the zipfile comment. 98 99 See unzip(1L) for a more complete description of these options. 100 101MODIFIERS 102 unzipsfx currently supports all unzip(1L) modifiers: -a (convert text 103 files), -n (never overwrite), -o (overwrite without prompting), -q 104 (operate quietly), -C (match names case-insensitively), -L (convert 105 uppercase-OS names to lowercase), -j (junk paths) and -V (retain ver- 106 sion numbers); plus the following operating-system specific options: 107 -X (restore VMS owner/protection info), -s (convert spaces in filenames 108 to underscores [DOS, OS/2, NT]) and -$ (restore volume label [DOS, 109 OS/2, NT, Amiga]). 110 111 (Support for regular ASCII text-conversion may be removed in future 112 versions, since it is simple enough for the archive's creator to ensure 113 that text files have the appropriate format for the local OS. EBCDIC 114 conversion will of course continue to be supported since the zipfile 115 format implies ASCII storage of text files.) 116 117 See unzip(1L) for a more complete description of these modifiers. 118 119ENVIRONMENT OPTIONS 120 unzipsfx uses the same environment variables as unzip(1L) does, 121 although this is likely to be an issue only for the person creating and 122 testing the self-extracting archive. See unzip(1L) for details. 123 124DECRYPTION 125 Decryption is supported exactly as in unzip(1L); that is, interactively 126 with a non-echoing prompt for the password(s). See unzip(1L) for 127 details. Once again, note that if the archive has no encrypted files 128 there is no reason to use a version of unzipsfx with decryption sup- 129 port; that only adds to the size of the archive. 130 131AUTORUN COMMAND 132 When unzipsfx was compiled with CHEAP_SFX_AUTORUN defined, a simple 133 ``command autorun'' feature is supported. You may enter a command into 134 the Zip archive comment, using the following format: 135 136 $AUTORUN$>[command line string] 137 138 When unzipsfx recognizes the ``$AUTORUN$>'' token at the beginning of 139 the Zip archive comment, the remainder of the first line of the comment 140 (until the first newline character) is passed as a shell command to the 141 operating system using the C rtl ``system'' function. Before executing 142 the command, unzipsfx displays the command on the console and prompts 143 the user for confirmation. When the user has switched off prompting by 144 specifying the -q option, autorun commands are never executed. 145 146 In case the archive comment contains additional lines of text, the 147 remainder of the archive comment following the first line is displayed 148 normally, unless quiet operation was requested by supplying a -q 149 option. 150 151EXAMPLES 152 To create a self-extracting archive letters from a regular zipfile let- 153 ters.zip and change the new archive's permissions to be world-exe- 154 cutable under Unix: 155 156 cat unzipsfx letters.zip > letters 157 chmod 755 letters 158 zip -A letters 159 160 To create the same archive under MS-DOS, OS/2 or NT (note the use of 161 the /b [binary] option to the copy command): 162 163 copy /b unzipsfx.exe+letters.zip letters.exe 164 zip -A letters.exe 165 166 Under VMS: 167 168 copy unzipsfx.exe,letters.zip letters.exe 169 letters == "$currentdisk:[currentdir]letters.exe" 170 zip -A letters.exe 171 172 (The VMS append command may also be used. The second command installs 173 the new program as a ``foreign command'' capable of taking arguments. 174 The third line assumes that Zip is already installed as a foreign com- 175 mand.) Under AmigaDOS: 176 177 MakeSFX letters letters.zip UnZipSFX 178 179 (MakeSFX is included with the UnZip source distribution and with Amiga 180 binary distributions. ``zip -A'' doesn't work on Amiga self-extracting 181 archives.) To test (or list) the newly created self-extracting 182 archive: 183 184 letters -t 185 186 To test letters quietly, printing only a summary message indicating 187 whether the archive is OK or not: 188 189 letters -tqq 190 191 To extract the complete contents into the current directory, recreating 192 all files and subdirectories as necessary: 193 194 letters 195 196 To extract all *.txt files (in Unix quote the `*'): 197 198 letters *.txt 199 200 To extract everything except the *.txt files: 201 202 letters -x *.txt 203 204 To extract only the README file to standard output (the screen): 205 206 letters -c README 207 208 To print only the zipfile comment: 209 210 letters -z 211 212LIMITATIONS 213 The principle and fundamental limitation of unzipsfx is that it is not 214 portable across architectures or operating systems, and therefore nei- 215 ther are the resulting archives. For some architectures there is lim- 216 ited portability, however (e.g., between some flavors of Intel-based 217 Unix). 218 219 Another problem with the current implementation is that any archive 220 with ``junk'' prepended to the beginning technically is no longer a 221 zipfile (unless zip(1) is used to adjust the zipfile offsets appropri- 222 ately, as noted above). unzip(1) takes note of the prepended bytes and 223 ignores them since some file-transfer protocols, notably MacBinary, are 224 also known to prepend junk. But PKWARE's archiver suite may not be 225 able to deal with the modified archive unless its offsets have been 226 adjusted. 227 228 unzipsfx has no knowledge of the user's PATH, so in general an archive 229 must either be in the current directory when it is invoked, or else a 230 full or relative path must be given. If a user attempts to extract the 231 archive from a directory in the PATH other than the current one, 232 unzipsfx will print a warning to the effect, ``can't find myself.'' 233 This is always true under Unix and may be true in some cases under MS- 234 DOS, depending on the compiler used (Microsoft C fully qualifies the 235 program name, but other compilers may not). Under OS/2 and NT there 236 are operating-system calls available that provide the full path name, 237 so the archive may be invoked from anywhere in the user's path. The 238 situation is not known for AmigaDOS, Atari TOS, MacOS, etc. 239 240 As noted above, a number of the normal unzip(1L) functions have been 241 removed in order to make unzipsfx smaller: usage and diagnostic info, 242 listing functions and extraction to other directories. Also, only 243 stored and deflated files are supported. The latter limitation is 244 mainly relevant to those who create SFX archives, however. 245 246 VMS users must know how to set up self-extracting archives as foreign 247 commands in order to use any of unzipsfx's options. This is not neces- 248 sary for simple extraction, but the command to do so then becomes, 249 e.g., ``run letters'' (to continue the examples given above). 250 251 unzipsfx on the Amiga requires the use of a special program, MakeSFX, 252 in order to create working self-extracting archives; simple concatena- 253 tion does not work. (For technically oriented users, the attached 254 archive is defined as a ``debug hunk.'') There may be compatibility 255 problems between the ROM levels of older Amigas and newer ones. 256 257 All current bugs in unzip(1L) exist in unzipsfx as well. 258 259DIAGNOSTICS 260 unzipsfx's exit status (error level) is identical to that of unzip(1L); 261 see the corresponding man page. 262 263SEE ALSO 264 funzip(1L), unzip(1L), zip(1L), zipcloak(1L), zipgrep(1L), zipinfo(1L), 265 zipnote(1L), zipsplit(1L) 266 267URL 268 The Info-ZIP home page is currently at 269 http://www.info-zip.org/pub/infozip/ 270 or 271 ftp://ftp.info-zip.org/pub/infozip/ . 272 273AUTHORS 274 Greg Roelofs was responsible for the basic modifications to UnZip nec- 275 essary to create UnZipSFX. See unzip(1L) for the current list of Zip- 276 Bugs authors, or the file CONTRIBS in the UnZip source distribution for 277 the full list of Info-ZIP contributors. 278 279Info-ZIP 20 April 2009 (v6.0) UNZIPSFX(1L) 280