Changeset 8984 for trunk/ippMonitor/generate
- Timestamp:
- Sep 26, 2006, 10:40:55 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippMonitor/generate (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/generate
r8980 r8984 2 2 3 3 $VERBOSE = 0; 4 4 5 if ($ARGV[0] eq "-v") { $VERBOSE = 1; shift @ARGV; } 5 6 if (@ARGV != 3) { die "generate (schema) (template) (output)\n"; } … … 18 19 close (FILE); 19 20 21 &init_key ("MENU"); 22 &init_key ("STYLE"); 20 23 &init_key ("TABLE"); 21 24 &init_key ("TITLE"); 22 25 &init_key ("FILE"); 26 23 27 &init_key ("FIELDS"); 24 28 … … 54 58 } 55 59 } 60 61 # check on keys 62 &check_key ("MENU", "ipp.menu.dat"); 63 &check_key ("STYLE", "ipp.css"); 64 &check_key ("TABLE", ""); 65 &check_key ("TITLE", ""); 66 &check_key ("FILE", ""); 67 56 68 # define query string, add to keypairs 57 69 &define_query_fields; … … 192 204 if ($value[$i] ne "") { die "key is multiply defined\n"; } 193 205 $value[$i] = $value; 206 if ($VERBOSE) { print STDERR "setting $key = $value\n"; } 194 207 return; 195 208 } 196 209 } 210 } 211 212 sub check_key { 213 my ($i); 214 my ($key) = $_[0]; 215 my ($default) = $_[1]; 216 217 for ($i = 0; $i < @key; $i++) { 218 if ($key eq $key[$i]) { 219 if ($VERBOSE) { print "found $key: $key[$i] -- $value[$i] (def: $default)\n"; } 220 if (($default eq "") && ($value[$i] eq "")) { die "missing value for required key $key[$i]\n"; } 221 if ($value[$i] eq "") { $value[$i] = $default; } 222 return; 223 } 224 } 225 die "unknown key $key\n"; 197 226 } 198 227 … … 200 229 my ($i); 201 230 for ($i = 0; $i < @key; $i++) { 202 #if ($VERBOSE) { print "$key[$i] -- $value[$i]\n"; }231 if ($VERBOSE) { print "$key[$i] -- $value[$i]\n"; } 203 232 if ($line =~ m|\$$key[$i]|) { 204 233 if ($value[$i] eq "") { die "missing value for required key $key[$i]\n"; }
Note:
See TracChangeset
for help on using the changeset viewer.
