Copy Link
Add to Bookmark
Report
Saxonia Issue 03 Part 026
Some small bonustools
By Rumrunner/VOID
l
When you are working on big projects, whether it's coding, painting, music
or driving rallycross for that matter, it's always nice to have some small
projects that doesn't take too much out of you to work with on the side.
In my case regarding coding, I have come up with an excellent solution as to
what to do when you have problems or lack inspiration or whatever. It's
quite easy, just make some small utilities, for instance some cli-tools.
Have you ever become tired of typing 1 type file_id.diz0 over and over again
usually missing some keys and then having to retype it? I know I have. So
what I did to start with was making a little script (even though it's not
much used on Amiga, there's a lot of useful scripts you can make, I have one
that lists all my scenestuff so I can spread this list to my contacts. All
I have to do is type in one single command). This script would just check
if there was a file named file_id.diz in the current directory, and if so,
display it using type. But as a coder, I wasn't fully satisfied with this
solution. First, you had to run the script, even though you don't have to
use execute first if you set the s bit. Then, the script would check for
the file, load type which again would have to load the file_id.diz and
finally display the lines.
So what did I do? I loaded up Asm-One, and wrote a little program that
works much faster than the abovementioned script. It simply tries to do
a lock on file_id.diz, and if succeeded, makes a fileinfoblock to get the
size of the file. If the lock fails, it's exit as the file isn't present.
Allocate memory is the only thing needed before a load and then a write to
screen followed by freeing the memory is the solution. You can find this
tool in the Saxonia 3 archive, under the name of fidr.lha.
l
I have found the grep command in Unix to be useful sometimes, you know, the
opportunity to list the lines in a file containing a searchstring. So I
found out that I should code such a utility on Amiga, you can find it in
this archive, the filename is finfile.lha. This tool loads the file in and
scans through the lines in each file for the specified searchstring. If
found, it searches to the start of the line and display from here to end of
line. Then it searches the rest of the file. No big thing this, but it can
be useful in some cases. Especially when looking through files where you
have a bad overview, I have found it useful. And perhaps you want to list
all the lines in your code that contains the lea command? Well, now you
atleast have the opportunity to do so in cli.