File:  [LON-CAPA] / doc / loncapafiles / sanitycheck.piml
Revision 1.3: download - view: text, annotated - select for diffs
Wed Jul 17 17:55:07 2002 UTC (21 years, 9 months ago) by albertel
Branches: MAIN
CVS tags: version_0_5_1, version_0_5, HEAD
- sanitycehcking of the hosts.tab supports the new option 6th colum and allows spaces in it.
- reverted develpment hosts.tab
- (BUG#570)

    1: <!-- sanitycheck.piml -->
    2: <!-- Scott Harrison -->
    3: 
    4: <!-- $Id: sanitycheck.piml,v 1.3 2002/07/17 17:55:07 albertel Exp $ -->
    5: 
    6: <!--
    7: 
    8: This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    9: 
   10: LON-CAPA is free software; you can redistribute it and/or modify
   11: it under the terms of the GNU General Public License as published by
   12: the Free Software Foundation; either version 2 of the License, or
   13: (at your option) any later version.
   14: 
   15: LON-CAPA is distributed in the hope that it will be useful,
   16: but WITHOUT ANY WARRANTY; without even the implied warranty of
   17: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18: GNU General Public License for more details.
   19: 
   20: You should have received a copy of the GNU General Public License
   21: along with LON-CAPA; if not, write to the Free Software
   22: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   23: 
   24: /home/httpd/html/adm/gpl.txt
   25: 
   26: http://www.lon-capa.org/
   27: 
   28: -->
   29: 
   30: <piml>
   31: <targetroot>/</targetroot>
   32: <files>
   33: <file>
   34: <target dist='default'>/etc/httpd/conf/loncapa.conf</target>
   35: <perlscript mode='fg'>
   36: open IN, "&lt;<TARGET />";
   37: my $hbug=-1;
   38: my $dbug=-1;
   39: while (&lt;IN&gt;) {
   40:  if (/PerlSetVar\s+lonHostID\s+(\S+)/) {
   41:   my $v=$1;
   42:   $hbug=0;
   43:   $hbug=1 if $v=~/\W/;
   44:   $hbug=1 if $v=~/\_/;
   45:  }
   46:  if (/PerlSetVar\s+lonDefDomain\s+(\S+)/) {
   47:   my $v=$1;
   48:   $dbug=0;
   49:   $dbug=1 if $v=~/\W/;
   50:   $dbug=1 if $v=~/\_/;
   51:  }
   52: }
   53: if ($hbug) {
   54:   print "**** ERROR **** <TARGET /> has invalid lonHostID\n";
   55: }
   56: if ($dbug) {
   57:   print "**** ERROR **** <TARGET /> has invalid lonDefDomain\n";
   58: }
   59: </perlscript>
   60: </file>
   61: <file>
   62: <target dist='default'>/home/httpd/lonTabs/hosts.tab</target>
   63: open IN, "&lt;<TARGET />";
   64: my $rbug=0;
   65: my $dbug=0;
   66: my $sbug=0;
   67: my $fbug=0;
   68: while (&lt;IN&gt;) {
   69:  if (/\S/) {
   70:   $rbug=1 if /\r/;
   71:   my @a=split(/\:/,$_);
   72:   $dbug=1 if $a[0]=~/\W/;
   73:   $dbug=1 if $a[0]=~/\_/;
   74:   $dbug=1 if $a[1]=~/\_/;
   75:   $dbug=1 if $a[1]=~/\W/;
   76:   $fbug=1 if (@a<5 || @a>6);
   77:   my $expr='\s.+$';
   78:   $sbug=1 if ($a[0] =~ /$expr/ ||
   79: 	      $a[1] =~ /$expr/ ||
   80: 	      $a[2] =~ /$expr/ ||
   81: 	      $a[3] =~ /$expr/ ||
   82: 	      $a[4] =~ /$expr/ )
   83: ;
   84:  }
   85: }
   86: close IN;
   87: if ($rbug) {
   88:   print "**** ERROR **** <TARGET /> is DOS-formatted\n";
   89: }
   90: if ($dbug) {
   91:   print "**** ERROR **** <TARGET /> has invalid host id or domain id\n";
   92: }
   93: if ($fbug) {
   94:   print "**** ERROR **** <TARGET /> is lacking 5 or 6 columns for every row\n";
   95: }
   96: if ($sbug) {
   97:   print "**** ERROR **** <TARGET /> has illegal whitespace character\n";
   98: }
   99: </file>
  100: <file>
  101: <target dist='default'>/home/httpd/lonTabs/spare.tab</target>
  102: open IN, "&lt;<TARGET />";
  103: my $rbug=0;
  104: my $dbug=0;
  105: my $sbug=0;
  106: while (&lt;IN&gt;) {
  107:  if (/\S/) {
  108:   $rbug=1 if /\r/;
  109:   $dbug=1 if $_=~/\W.*\n$/;
  110:   $dbug=1 if $_=~/\_/;
  111:   $sbug=1 if /\s.+$/;
  112:  }
  113: }
  114: close IN;
  115: if ($rbug) {
  116:   print "**** ERROR **** <TARGET /> is DOS-formatted\n";
  117: }
  118: if ($dbug) {
  119:   print "**** ERROR **** <TARGET /> has invalid host id\n";
  120: }
  121: if ($sbug) {
  122:   print "**** ERROR **** <TARGET /> has illegal whitespace character\n";
  123: }
  124: </file>
  125: </files>
  126: </piml>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>