-------------------------------------------------------------------------------
Command : ViewNDel
Function : Run upto 2 commands over a file before asking wether to delete
or not. Useful from DOpus type programs for 'Pruning'
directories of archives, pictures etc etc.
Author : James Sleeman
Language : C
Compiled : SAS/C 6.51
DESCRIPTION
I had a large directory of archive which I had gathered up over a
while for various BBS's and the like, but of course I had no-idea which
ones were of importance to me anymore and which I was able to delete. So
since I had just got SAS/C 6.51 and was teaching myself 'C' I thought it
would be a good idea to write a small program which took a filename as an
argument and then showed the contents of the file (archive) before asking
if you wanted to delete it. Of course this could have been done from a
script .. but I need the practise in 'C'. After I had whipped up a small
hack to do this (5 mins or so) and used it from DOPUS to prune my archives
directory (by making a button that called this program with each filename
that was selected in turn) I set to generalise the program and came up with
'ViewNDel'.
USAGE
Usage is from CLI only, and it only accepts 5 arguments, The first one is
either T or F, if it is T then the program will ask if you want to delete
the file or not, if it is F (or anything else for that matter) it will not
ask you if you want to delete the file and neither will it delete the file
at all. The second argument is the file (including path of course) to
actually do the operations on. The third and fourth arguments are 2
commands to run on the file, both are optional, but if you only have one
then you can't use the 5th argument (else the fifth argument will be used
as the 4th .. just cause I am lazy and can't be bothered putting in
argument specifiers, or using ReadArgs for that matter). The Fifth
argument is pretty trivial, it prints out the commands (incorporated with
filename) that the program executes, there is nothing specific yuo have to
put for this argument, the mere fact that it exists will be sufficient to
turn the option on.
EXAMPLES
--> ViewNDel T S:Startup-Sequence Type "Type >Speak:"
this will first Type the file S:Startup-Sequence, and then speak the
startup-sequence (actually type to the speak: device, but you knew that
already), and finnaly ask you if you want to delete the file (if you press
Y or y then it will be deleted using C:Delete - this is specified in the
source, if you want it to delete it using some other method just edit the
source and re-compile, or email me and ask me to update the program to
accept another parameter for the delete command and I will do so.
--> ViewNDel F S:Startup-Sequence Type "Type >Speak:" Debug
This will do thew same as above, except that it will not ask if you want to
delete the file (and it won't delete it either), and before it executes the
commands it will print them out for you to see.
--> ViewNDel T sys:ViewNDel.lha "lha v"
This will view the archive "sys:ViewNDel.lha" and then ask if you want to
delete it.
IMPORTANT
The first 2 arguments MUST be specified, this is just because I am Lazy
though and can't be bothered to add argument specifiers at 12:47am on a
Friday night .. if you have some strange desire to have them added lemme
know and I will do so for you.
WARRANTY
None, use at your own risk. There should be nothing that can harm your
system though as long as you supply the arguments as I have said.
DISTRIBUTION
Email-Ware, if you use it send me some EMAIL, since this is my first 'C'
program for real I am releasing the surce to anyone that want's it to, just
drop me a line and I'll email it too you.
CONTACT
j_slee00@tpnet.co.nz
sleemanj@voyager.co.nz
|