"mrtgmk" by Iulian Radu (iulian_r@starnets.ro) [v2.0]

"mrtgmk" is giftware. It is my contribution to mrtg package.

"mrtgmk" is a program that scan a .cfg file and generate a mrtg.cfg
style file + a .html file with links to the .html files generated
by mrtg. 

You can use the sources for your inspiration, can change them, BUT
you are not allowed to sell them.

Cfg file structure:
-------------------
The .cfg file can contain any of the next row types. n meens any
integer positive (>0):

0 COMMENT		- mark a block of rows as a comment, /**/ c like :)
0 ENDCOMMENT

0 XDEBUG on|off		- print/don't print the line readed and executed from 
			  cfgfile

0 INCLUDE cfgfile	- execute de commands from the cfgfile

0 DEFHOST hostname fcfgname port	- define a name 'hostname' for the pair
			  'fcfgname port'. 'fcfgname' is the name of a file
			  precedently generated by cfgmaker. The resolved
			  name for a defined host can be get from HOST_hostname
			  alias when CHECK4ALIAS is on.

0 MRTG.CFG cfgpathdst cfgpathsrc	- define the name of a generated mrtg.cfg
			  (cfgpathdst) and the name of a source mrtg.cfg. If
			  the two names are the same, then all the new entries
			  in 'cfgpathdst' will be appended, else will be created
			  a new mrtg.cfg file with the initial contains took
			  from 'cfgpathsrc'
0 HTMLFILE filepath	- where will be write the html code

0 HTMLCODE code inserted in html	- insert code in the generated html file;
					  not <BR> nor <P> added
0 HTMLLINK link text	- insert a link in the html page, making no identation;
			  not <BR> nor <P> added
0 LINK2DH host text	- insert a link in the html page, making no identation;
			  not <BR> nor <P> added 
			  
0 MRTGTEXT text inserted in mrtg.cfg	- insert text in the generated mrtg.cfg

0 CFGDIR cfg_path	- append cfg_path in the front of .cfg files generated
			  by cfgmaker
0 NOCFGDIR 		- not any more cfg_path used

0 TITLE txt		- text used between TITLE tags

0 BODY body arguments	- define the arguments inserted with BODY tag in the
			  html code
0 NOBODY		- erase all arguments for BODY tag

0 BASE url		- append this url in front of all references at html
			  pages and gifs
0 NOBASE		- use what the user has been wrote in .cfg file

0 EXEC cmd		- exec a command in shell

0 GIFD link host	- day gif
0 GIFW link host	- week gif
0 GIFM link host	- month gif
0 GIFY link host	- year gif
    - 0 GIFx link host  -> <A HREF=link><IMG SRC=base/host-x.gif></IMG></A>
    - 0 GIFx # host     -> <A HREF=base/host.html><IMG SRC=base/host-x.gif></IMG></A>
    - 0 GIFx link #     -> <A HREF=base/link.html><IMG SRC=base/link-x.gif></IMG></A>
    - 0 GIFx # #        -> illegal
			- host-x.gif means that it is searched in defined 
			  hosts list for the name cfgmaker assign to that host 
			  and append the right extension (e.g. -day.gif) to it

0 ALIAS alias_name alias_body		- define an alias named alias_name and
					  that will be used as %alias_name% and
					  CHECK4ALIAS yes
0 DELALIAS alias_name	- erase the alias :]
0 CHECK4ALIAS yes|no	- if yes, then all input string will be checked for
			 aliases. An alias is a name between %s (%alias_name% :)

0 MSG msg		- display the message msg on screen

0 MKLINK dir host path	- create a directory 'dir' that contain links through
			  a host page, located in path. If exist old links,
			  theses will be erased

			- create a htmlfile with day, week, month or year
			  gifs and links through appropiate html file.
			  Theses commandes MUST be done before any 0 DEFHOST
			  commands relative to host from fcfg.
0 MKD fcfg htmlfilename	
0 MKW fcfg htmlfilename
0 MKM fcfg htmlfilename
0 MKY fcfg htmlfilename

0 CHNGTRGNAME yes|no	- change (or not) the name of the target html files
			if change, then the name will be the defhost declared
			name, otherwise will be the name declared in .cfg file
			by cfgmaker

0 CONVIP2NAME mrtg_out_path/	- change the name of the already existent files 
			from an ip style (somename.x where x is the snmp index)
			into a defhost style
			- 0 CHNGTRGNAME yes is required

0 CONVNAME2IP mrtg_out_path/	- change the name of the already existent files 
			from a defhost style into ip style (somename.x where x 
			is the snmp index)
			- 0 CHNGTRGNAME no is required

			- mrtg_out_path must be the path where mrtg create
			the htmls, gifs and logs files and must end with a
			slash ('/')
			- must to be present before the definitions of the
			hosts for with I intend to change the file name;
			once switched to this action, exist not any way
			to fall back

n HTMLCODE html code	- insert code in the html page, making identation;
			  not <BR> nor <P> added but surrounded by <LI></LI>
n HTMLLINK link text	- insert a link in the html page, making identation;
			  not <BR> nor <P> added but surrounded by <LI></LI>
n LINK2DH host text	- insert a link in the html page, making identation;
			  not <BR> nor <P> added but surrounded by <LI></LI>
n DATA host text	- insert a link through a page genetrated by mrtg, 
			  making identation; surrounded by <LI></LI>

# or \n			- treated as a comment

If you expand the code, please notify me.

"mkm" call the gcc to produce the exec "mrtgmk" from mrtgmk.c .
"smrtgmk" is an example of calling "mrtgmk".

Iulian Radu (iulian_r@starnets.ro).
28th September 1999 12:00pm Romanian time
