###############################################################################ã### PistolGrip's BAJA Examplesã###############################################################################ã### Note:  This file is an example only, it is by no means supposed to work orã###        or do anything other than hopefully help some people get startedã###        with BAJA programming.  This code is not tested or thought-out veryã###        well, it is only intended to show some basic concepts and commonã###        tasks useful when coding custom modules.ã###ã###        Pistolgripã###############################################################################ã### Required Include Files for SBBS Definitions, and our File I/O Functionsã###############################################################################ã!include sbbsdefs.incã!include file_io.incã###############################################################################ã### Defines Global or Constant Variablesã###############################################################################ã!define USER _USERON.ALIASã!define MAXIMUM_VALUE 100ã###############################################################################ã### Define our Integer variablesã###############################################################################ãint cfg_fileãint max_valueãint access_lvlãã###############################################################################ã### Define our String variablesã###############################################################################ãstr reg_nameãã###############################################################################ã###ã### When executing a BAJA module the command line argumentsã### (for example "MYMOD.BIN MAINTENANCE")ã### are available from the default String variable named 'str' in BAJA.ã###ã###############################################################################ã### Copies the command line arguments for use later.ã###############################################################################ãtruncsp strãcopy cmd_line strãstrupr cmd_lineã###############################################################################ã### Used for debuggingã###############################################################################ã#printf "%sp" cmd_lineãã###############################################################################ã### Two things to notice about this next section:ã### 1.) The "%n" in the path is a Synchronet Command Line Specifier that isã###     translated into your NODE directory as configured in SCFG.  Refer toã###     the Sysop Documentation appendix section on these, they are helpfulã###     to the BAJA programmer.ã### 2.) The forward slashes "/" in the path. This ensures Linux compatibilityã###ã###############################################################################ã### Open our modules config file for readingã###############################################################################ãfopen cfg_file O_RDONLY "%n../baja/mymod/mymod.cfg"ã   if_falseã     print "\r\n\r\nnError Loading Configuration File - MYMOD.CFG"ã     returnã   end_ifã###############################################################################ã### Now we'll read our config file one line at a time and set the appropriateã### variables to the correct values for our CONFIG.ã###############################################################################ãfread_line cfg_file reg_nameãtruncsp reg_nameã###############################################################################ã###ã### Note: On these next two lines read-in, we read in a string value and thenã###       convert it to an integer when we use the copy command.ã###ãfread_line cfg_file strãtruncsp strãcopy max_value strããfread_line cfg_file strãtruncsp strãcopy access_lvl strã###############################################################################ã### Close our config file  (IMPORTANT)ã###############################################################################ãfclose cfg_fileã###############################################################################ã### Note: You can use this technique to fairly easily create complexã###       configuration and customization options of your programs.ã###############################################################################ãã###############################################################################ã### Here's were we will see what argurments were passed to module upon exec.ã###############################################################################ãcompare cmd_line "maintenance"ãif_trueã   goto maintenanceãend_ifãã###############################################################################ã###############################################################################ã###ã### Main Entry Pointã###ã###############################################################################ã###############################################################################ãcompare _USERON.LEVEL access_lvlã  if_lessã     print "\r\nSorry, your access is insufficient for this program.\1p"ã     returnã   end_ifãã### More stuff here for your programããreturnã###############################################################################ã##### End Main Program Sectionã###############################################################################ãã###############################################################################ã###############################################################################ã### This is where we go if called with the maintenance parameterã###############################################################################ã:maintenanceãã### More stuff here for your programããreturnã###############################################################################ã###############################################################################ã### End of Sample BAJA Sourceã###############################################################################ãã---ã þ Synchronet þ WasteLand BBS þ 
telnet://wasteland.darktech.org ã