/[webpac]/trunk/all2xml.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/all2xml.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 105 by dpavlin, Mon Jul 14 10:55:35 2003 UTC revision 106 by dpavlin, Mon Jul 14 17:09:36 2003 UTC
# Line 328  print STDERR "using: $type...\n"; Line 328  print STDERR "using: $type...\n";
328                  $import2cp = Text::Iconv->new($config->{isis_codepage},$codepage);                  $import2cp = Text::Iconv->new($config->{isis_codepage},$codepage);
329                  my $db = OpenIsis::open( $isis_db );                  my $db = OpenIsis::open( $isis_db );
330    
331                    # check if .txt database for OpenIsis is zero length,
332                    # if so, erase it and re-open database
333                    sub check_txt_db {
334                            my $isis_db = shift || die "need isis database name";
335                            if (-e $isis_db.".TXT") {
336                                    print STDERR "WARNING: removing .txt OpenIsis database...\n";
337                                    unlink $isis_db.".TXT" || warn "unlink error on '$isis_db.TXT': $!";
338                                    my $db = OpenIsis::open( $isis_db );
339                                    return $db;
340                            }
341                    }
342    
343                    # EOF error
344                    if ($db == -1) {
345                            $db = check_txt_db($isis_db);
346                            if (! $db) {
347                                    print STDERR "FATAL: OpenIsis can't open zero size file $isis_db\n";
348                                    next;
349                            }
350                    }
351    
352                  # OpenIsis::ERR_BADF                  # OpenIsis::ERR_BADF
353                  if ($db == -4) {                  if ($db == -4) {
354                          print STDERR "FATAL: OpenIsis can't find file $isis_db\n";                          print STDERR "FATAL: OpenIsis can't find file $isis_db\n";
# Line 343  print STDERR "using: $type...\n"; Line 364  print STDERR "using: $type...\n";
364    
365                  my $max_rowid = OpenIsis::maxRowid( $db );                  my $max_rowid = OpenIsis::maxRowid( $db );
366    
367                    # if 0 records, try to rease isis .txt database
368                    if ($max_rowid == 0) {
369                            # force removal of database
370                            $db = check_txt_db($isis_db);
371                            $max_rowid = OpenIsis::maxRowid( $db );
372                    }
373    
374                  print STDERR "Reading database: $isis_db [$max_rowid rows]\n";                  print STDERR "Reading database: $isis_db [$max_rowid rows]\n";
375    
376                  my $path = $database;                  my $path = $database;

Legend:
Removed from v.105  
changed lines
  Added in v.106

  ViewVC Help
Powered by ViewVC 1.1.26