# # SMArT # # Configuration file code # # Copyright 2001 Wilmer van der Gaast (lintux@lintux.cx) # # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # my( @info, @conf, $l ); $info[1] = 'Volume'; $info[2] = 'Server name'; $info[3] = 'Internal network'; $info[4] = 'IPX device'; $info[5] = 'Device flags'; $info[6] = 'Version spoofing'; $info[7] = 'Password handling'; $info[8] = 'Login/security flags'; $info[9] = 'creat() modes'; $info[10] = 'Guest group'; $info[11] = 'Guest user'; $info[12] = 'Supervisor login'; $info[13] = 'User login'; $info[15] = 'Automatic login mapping'; $info[16] = 'Startup tests'; $info[17] = 'Bindery/user flags'; $info[18] = 'Queue flags'; $info[21] = 'Print queue'; $info[22] = 'Print server'; $info[30] = 'Burst mode'; $info[40] = 'Volume cache'; $info[41] = 'Share/lock files'; $info[42] = 'Spool dir'; $info[45] = 'Bindery files'; $info[46] = 'Attribute files'; $info[47] = 'Trustee files'; $info[50] = 'Conversion tables'; $info[60] = 'MAX_CONNECTIONS'; $info[61] = 'MAX_NW_VOLS'; $info[63] = 'MAX_DIR_BASE_ENTRIES'; $info[68] = 'USE_MMAP'; $info[69] = 'HANDLE_ALL_SAP_TYPS'; $info[70] = 'NETWORK_SERIAL_NMBR'; $info[71] = 'NETWORK_APPL_NMBR'; $info[80] = 'max_dir_search_handles'; $info[100] = 'Debug IPX kernel'; $info[101] = 'Debug NWSERV'; $info[102] = 'Debug NCPSERV'; $info[103] = 'Debug NWCONN'; $info[104] = 'Debug NWCLIENT'; $info[105] = 'Debug NWBIND'; $info[106] = 'Debug NWROUTED'; $info[200] = 'Daemon mode'; $info[201] = 'Log file'; $info[202] = 'Log mode'; $info[210] = 'Shutdown timing'; $info[211] = 'Shutdown warnings'; $info[300] = 'Routing info'; $info[301] = 'Routing log'; $info[302] = 'Routing log flags'; $info[310] = 'Watchdogs'; $info[400] = 'nwserv.stations file'; $info[401] = 'Reply to nearest server requests'; $info[402] = 'Reply to connect requests'; open( CONF, '<' . $mars_config ); @conf = (); while( $l = ) { $l =~ s/[\r\n]//g; $l =~ s/[\t ]+/ /g; $l =~ s/#.*//; $l =~ s/^[\t ]*//; $l =~ s/[\t ]*$//; if( $l ne '' ) { unshift( @conf, $l ); } } close( CONF ); sortconfig(); sub sortconfig() { @conf = sort( { $a cmp $b } @conf ); @conf = sort( { ( split( ' ', $a ) )[0] <=> ( split( ' ', $b ) )[0] } @conf ); } sub getconfigline( $ ) { my( @c, $c ); @c = getconfig( @_ ); $c = $c[0]; $c =~ s/^[0-9]* //; return( $c ); } sub getconfig( $ ) { my( @c ); @c = grep( /^$_[0] /i, @conf ); return( @c ); } sub addconfigline( $ ) { unshift( @conf, $_[0] ); } sub delconfigline( $ ) { @conf = grep( !/^$_[0] /i, grep( !/^$_[0]$/i, @conf ) ); } sub writeconfig() { my( $i, $l ); sortconfig(); open( CONF, '>' . $mars_config ); $l = ( getconfig( '1 SYS' ) )[0]; delconfigline( '1 SYS' ); addconfigline( $l ); foreach $i ( @conf ) { $l = $i; $l =~ s/ .*//; printf( CONF "%-50s # %s\n", $i, $info[$l] ); } close( CONF ); }