home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
m
/
msh_ut11.zip
/
MYDEFS.ZIP
/
ARCHIVER.MSH
next >
Wrap
Text File
|
1992-05-09
|
8KB
|
194 lines
|┌────────────────────────────┬───────────────────────────────────┐
|│ This is file arjzip.msh │ Support for archive-file-panels │
|├────────────────────────────┼───────────────────────────────────┤
|│Supported archive-types: │ ARJ LZH ZIP │
|├────────────────────────────┼───────────────────────────────────┤
|│Supported archivers: │ pkzip/pkunzip (1.10) │
|│ │ arj (2.30) │
|│ │ lharc (2.13) │
|├────────────────────────────┴───────────────────────────────────┤
|│Original Code: Jean Michel, Additions: Jens Pirnay │
|└────────────────────────────────────────────────────────────────┘
(panel.pattern dirpart current.name&"\\*.*"&panel.pattern!)extension_arj!
(extension_arj)extension_zip!
(extension_arj)extension_lzh!
| Name of arc-file in next panel
(panel.pattern panel.type cutfirst drop panel.type&)arcname!
| Name of directory INSIDE an archive
(panel.pattern panel.type cutfirst swap drop dirpart dup
length dup 1>(2 swap substring)(drop drop "")ifelse
)arcdirname!
| Name of arc-file in next panel
(next_dir (panel.type)in_next_panel cutlast drop)next_dir_arc!
| Name of directory INSIDE archive in next panel
((arcdirname)in_next_panel)next_dir_name!
| Name of temporary directory (it's root)
(tmp_dir "#Z#" &) base_tmp!
| Name of temporary directory (root + archive-directory)
(base_tmp next_dir_name dup ("\\" swap & &)(drop)ifelse)tmp_dirname!
| Name of temporary (response-) file
(tmp_dir"tmp.$$$"&) tmp_filename!
| Name of work-directory for archivers
(tmp_dir unit_and_name drop " " &)tmpdir_arc! | working-dirs
| Make a response file, that is write all filenames
| to "tmp.$$$", prepend [top] for any filename.
| NB: Unix-style paths!! (C:\MSH = c:/msh)
(the_cmd! (the_cmd swap & nl &
("\\" cutfirst dup (dup)if)("/" swap & &)while || replace "\" by "/"
tmp_filename write)foreachselected)resp_file!
| Create all necessary temporary directories...
("mymkdir " tmp_dirname &(execute)with_nomagic)mktmpdir!
| ...and remove them again
("rm -rf " base_tmp &(execute)with_nomagic)rmtmpdir!
| Standard-Exit-procedure
(rmtmpdir tmp_filename unlink reread reread_next)exit_tmp_dir!
||
|| Here are the list of external commands, modify to your own needs
||
("pkzip -m -r -p " swap & " " & base_tmp & "\\*.*" & execute) mvzip!
("arj m -r -e1 " swap & " " & base_tmp & execute) mvarj!
(cwd the_cmd! base_tmp cwd! "lharc m -r -x " swap &" *.*"&execute
the_cmd cwd!) mvlzh!
("pkzip -u -r -p " swap & " " & base_tmp & "\\*.*" & execute) upmvzip!
("arj u -r -e1 " swap & " " & base_tmp & execute) upmvarj!
(cwd the_cmd! base_tmp cwd! "lharc u -r -x " swap &" *.*"&execute
the_cmd cwd!) upmvlzh!
("pkunzip -e "arcname&" "&tmp_dirname&" @"&tmp_filename&execute) tmp_unzip!
("arj e -ju "arcname&" "&tmp_dirname&" !"&tmp_filename&execute) tmp_unarj!
("lharc e "arcname&" "&tmp_dirname&" @"&tmp_filename&execute) tmp_unlzh!
("pkunzip -e "arcname&" "&next_dir&" @"&tmp_filename&execute) unzip!
("arj e -ju "arcname&" "&next_dir&" !"&tmp_filename&execute) unarj!
("lharc e "arcname&" "&next_dir&" !"&tmp_filename&execute) unlzh!
("pkzip -d -b"tmpdir_arc&arcname&" "&" @"&tmp_filename&execute) delzip!
("arj d -ju -w"tmpdir_arc&arcname&" "&" !"&tmp_filename&execute) delarj!
("lharc d -w"tmpdir_arc&arcname&" "&" @"&tmp_filename&execute) dellzh!
(next_dir_arc mvzip) cptmpzip!
(next_dir_arc mvarj) cptmparj!
(next_dir_arc mvlzh) cptmplzh!
|
( current.isdir
( panel.pattern dirpart
current.name ".." =
(dup length 1- 1 swap substring dirpart)
(current.name&)
ifelse
panel.pattern filepart makename
panel.pattern!
)
if
)cur_action.arj!
(cur_action.arj)cur_action.zip!
(cur_action.arj)cur_action.lzh!
|
( panel.pattern dirpart
dup length 1- 1 swap substring dirpart
panel.pattern filepart makename
panel.pattern!
)go_up.arj!
(go_up.arj)go_up.zip!
(go_up.arj)go_up.lzh!
|
(exec tmp_filename unlink reread)exec_unlink!
|
| Actions to delete files from archive
|
( "del" swap & arcdirname resp_file # tmp_filename unlink reread ) del_arc!
( "arj" del_arc ) delete.arj!
( "zip" del_arc ) delete.zip!
( "lzh" del_arc ) delete.lzh!
|
| Actions to view a file (archiver must have ability extract to stdout!)
|
( arcname&" "&arcdirname
current.name&&">"tmp_filename&&(exec)with_nomagic
| tmp_filename pager tmp_filename unlink
browser tmp_filename & execute tmp_filename unlink
)browse_arc!
( "arj p " browse_arc) browse.arj!
( "pkunzip -c -d " browse_arc)browse.zip!
( "lharc p " browse_arc) browse.lzh!
|
| Copy (=extract) from archive to directory
|
( arcdirname resp_file "un" swap & #
tmp_filename unlink reread_next
)copy_arc!
( "arj" copy_arc ) copy.arjto!
( "zip" copy_arc ) copy.zipto!
( "lzh" copy_arc ) copy.lzhto!
|
| Move (extract & delete) from archive to directory
|
( arcdirname resp_file
dup "un" swap & # "del" swap & #
tmp_filename unlink reread reread_next
)move_arc!
( "arj" move_arc ) move.arjto!
( "zip" move_arc ) move.zipto!
( "lzh" move_arc ) move.lzhto!
|| Now actions to bring files into arj-file.
|| We have to make some tricksing to bring the files
|| exactly to the place where want them to have.
( mktmpdir selected_list& " " & tmp_dirname & execute
"cptmp" swap & # exit_tmp_dir
)
copyto_arc!
( "arj" "cp -f " copyto_arc ) copyto.arj!
( "zip" "cp -f " copyto_arc ) copyto.zip!
( "lzh" "cp -f " copyto_arc ) copyto.lzh!
( "arj" "mv -f " copyto_arc ) moveto.arj!
( "zip" "mv -f " copyto_arc ) moveto.zip!
( "lzh" "mv -f " copyto_arc ) moveto.lzh!
|| Now inter-archive-operations alas for 2 archivers we have a lot
|| of variants so you may remove some if you don't need them
( | [top+1] source archive-type
| [top] destination archive-type
darc! sarc!
arcdirname resp_file || create a (Unix-style) response-file
mktmpdir "tmp_un" sarc & # "cptmp" darc & #
exit_tmp_dir
)
copy.them!
( | [top+1] source archive-type
| [top] destination archive-type
darc! sarc!
arcdirname resp_file || create a (Unix-style) response-file
mktmpdir "tmp_un" sarc & # "del" sarc & # "cptmp" darc & #
exit_tmp_dir
)
move.them!
( "arj" "arj" copy.them ) copy.arjto.arj!
( "arj" "zip" copy.them ) copy.arjto.zip!
( "arj" "lzh" copy.them ) copy.arjto.lzh!
( "zip" "zip" copy.them ) copy.zipto.zip!
( "zip" "arj" copy.them ) copy.zipto.arj!
( "zip" "lzh" copy.them ) copy.zipto.lzh!
( "lzh" "arj" copy.them ) copy.lzhto.arj!
( "lzh" "zip" copy.them ) copy.lzhto.zip!
( "lzh" "lzh" copy.them ) copy.lzhto.lzh!
( "arj" "arj" move.them ) move.arjto.arj!
( "arj" "zip" move.them ) move.arjto.zip!
( "arj" "lzh" move.them ) move.arjto.lzh!
( "zip" "zip" move.them ) move.zipto.zip!
( "zip" "arj" move.them ) move.zipto.arj!
( "zip" "lzh" move.them ) move.zipto.lzh!
|
| Now edit a file inside an archive
|
( "mymkdir " base_tmp & (execute)with_nomagic
arcname & " " & base_tmp & "\\ " &
arcdirname & current.name & execute
editor base_tmp & "\\" & arcdirname & current.name & execute
"upmv" swap & arcname swap # exit_tmp_dir
)edit_arc!
("arj" "arj x -y " edit_arc) edit.arj!
("zip" "pkunzip -d " edit_arc) edit.zip!
("lzh" "lharc x " edit_arc) edit.lzh!
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tmp_filename unlink rmtmpdir | make sure all is clean !
|| | tmp_dir should be defined, so move it's
|| | definition in "config.msh" to the top