Arachne mime.cfg secrets

Arachne understands five basic file types: HTM, GIF, BMP, IKN and TXT.
Only GIF, IKN and BMP can be inlined using <IMG> tag.
If the file has different extension than these and in the following conversion table there's no corresponding action defined, Arachne offers moving of downloaded file from CACHE directory (or of local file) to DOWNLOAD directory.
IKN, HTM, TXT and GIF is hardcoded into Arachne, and it can't be changed by external programs.

For conversion to supported format the macro "extension1>extension2|command" is used.
For calling external viewer macro "extension|command" is used.
"extension|command>$2" is used for converting into HTML if the program prints to the screen (must use stdout).

Syntax of MIME.CFG

A command starts with one of the following:

In command arguments you can use following macros.
Instead of $1, $2, etc. (as Unix scripts has) you can use %1, %2 (as DOS batch files has).
These are in some sort of alpabetical order to make it easier to see what each one does.

 
MacroExplanationDetails
$1Full input filenameThe file Arachne is trying to "launch"
$2Full output filenameThe file where Arachne should write to (in cache)
Used for internal purposes by Arachne.
Should be added to all commands that convert something to a known format.
$aPath to cacheTypicaly CACHE\
$bFull name of bookmarksTypicaly HOTLIST.HTM
$cFull name of cache indexTypicaly CACHE.IDX
$dFileftp://ftp.vse.cz/pub/msdos/Arachne/ -> /pub/msdos/Arachne/
$ePath to executable filesThe directory where CORE.EXE, INSIGHT.EXE, etc is located
$gIP address of first gatewayAccording to ARACHNE.CFG
$hFull name of history fileTypicaly HISTORY.LST
$iYour IP address
$lLast visited documentFilename (ex. home.htm)
$mPath to mail directoryTypicaly MAIL\
$nIP address of first nameserverAccording to ARACHNE.CFG
$pHosttelnet://cyberspace.org -> cyberspace.org
$qFile with query stringcreated only when using this macro
$rScreen resolution(639, 799 or 1023)
$sCGI compatible query stringMax. 80 characters
$tPath for temporary files(either CACHE\ or %TEMP% - see Cache2TEMP)
$uURL of documentEx. file://c:/arachne/home.htm
$wDownload path(typicaly DOWNLOAD\)
$xNetmaskAccording to ARACHNE.CFG
\nEnd of lineThis won't work for "|[nn]" style commands
%%% characterIf you need a % in the command
$$$ characterIf you need a $ in the command
\\\ characterUsefull if you need to specify directories

 

Examples of use in mime.cfg

Comments before we start

You can leave out the spaces in the commands if you want too, but they will be harder to read so I will not do like that.
You can type the commands in either in lower or UPPER case (atleast in the DOS version).

To be able to read .1st files off-line

Add the line file/.1st TXT
file/ specifies that it's for off-line mode.
.1st that it's for files with the extemsion .1st (or *.1st if you prefer that)
TXT specifies what Arachne should interpret the file as.

Let's say you have a program that converts a .1st file to a .htm file

(No I don't have one so I can't mail it to you.)
Add the line file/.1st > HTM|1st2htm.exe $1 > $2
file/ and .1st was explained earlier.
But what does the '>' mean? Is it a redirection (as in the DOS command type file.txt > file2.txt or Linux cat file.txt > file2.txt).
No it isn't, it's a was to let Arachne know that it should convert .1st files into the next word.
HTM Specifies the type that .1st should be read as (just as it earlier was read as TXT). Do not use something that isn't declared in mime.cfg (ex. XYZ isn't declared).
'|' means that the command starts afterwards.
1st2htm.exe is the name of the program that is launched.
$1Tells 1st2htm.exe the name of the file.
This '>' is a "normal" one and is part of the command.
$2 is the name of the cache file.
The program must write to stdout (if you aren't a programmer it means that it must write to the screen - but not use some "smart" way to do that.)

What if the program doesn't write to stdout but to a file?

Change the line to file/.1st 1ST>HTM|1st2htm $1 $2
1ST>HTM shows that the output will be a file that was declared earlier as HTM.
Since $2 isn't redirected this time the program takes it as it's second parameter and writes to it.

What you should be aware off

If you declare ex. file/.c all others that start with 'c' must come before that line in mime.cfg
Every mime type declared (file/ isn't a standard mime type) will save that file with the correct extension.
$2 name is always set by Arachne internally and you can't change more then the extension (by selecting what extension it should have).
You MUST use '\\' to get a '\' if you need to write directory statments (ex: c:\\dos\\edit.com)

Performance tips

Remove all commented lines (those starting with ';')
Switch positions so the items most often used are at the top (APM added lines are always last if they don't change a previous setting).

This file was made by Bernhard "Bernie" Eriksson by using some of the information from (at-least older) mime.cfg, information from Michael Polak and several hours of experimenting with the file ;)

This document is always under construction, last change: 99-05-31

© Bernhard "Bernie" Eriksson 1999, 2006.