1/**** REXX  ********   ZIP2EXE.CMD  **************  01/04/96 *********\
2|**  This exec will prepend the Info Zip unzipsfx.exe file to an    **|
3|**  existing ZIP file to create a self extracting zip.             **|
4|**                                                                 **|
5|**  The exec requires 1 argument, the name of the zip file to be   **|
6|**  acted upon.                                                    **|
7|**                                                                 **|
8|**  Put this exec into the path that contains your Info Zip        **|
9|**  executables.                                                   **|
10|**                                                                 **|
11\*********************************************************************/
12rc = 0
13/**  Start Argument processing  ** End Initialization               **/
14PARSE UPPER ARG zip_file
15IF zip_file = ""
16THEN
17  DO
18    SAY "You must specify the name of the file to be processed"
19    SAY "Please try again"
20    rc = 9
21    SIGNAL FINI
22  END
23IF POS(".ZIP",zip_file) = 0
24THEN
25  DO
26    sfx_file = zip_file||".EXE"
27    zip_file = zip_file||".ZIP"
28  END
29ELSE
30    sfx_file = SUBSTR(zip_file,1,LASTPOS(".",zip_file))||"EXE"
31zip_file = STREAM(zip_file,"C","QUERY EXISTS")
32IF zip_file = ""
33THEN
34  DO
35    SAY "The file "||ARG(1)||" Does not exist"
36    SAY "Processing terminated"
37    rc = 9
38    SIGNAL FINI
39  END
40/**  Start unzipsfx location    ** End Argument processing          **/
41PARSE UPPER SOURCE . . command_file
42unzipsfx = SUBSTR(command_file,1,LASTPOS("\",command_file))||,
43          "UNZIPSFX.EXE"
44IF STREAM(unzipsfx,"C","QUERY EXISTS") = ""
45THEN
46  DO
47    SAY "We are unable to locate the UNZIPSFX.EXE source"
48    SAY "Ensure that the ZIP2EXE command is in the directory",
49        "which contains UNZIPSFX.EXE"
50    rc = 9
51    SIGNAL FINI
52  END
53/**  Execute the command        ** End Argument processing          **/
54ADDRESS CMD "@COPY /b "||unzipsfx||"+"||zip_file,
55            sfx_file||" > NUL"
56IF rc = 0
57THEN
58  SAY sfx_file||" successfully created"
59ELSE
60  SAY sfx_file||" creation failed"
61FINI:
62  EXIT  rc
63