home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1580 / fixit < prev    next >
Encoding:
Text File  |  1990-12-28  |  1.1 KB  |  34 lines

  1. #! /usr/local/bin/perl
  2. # fixit creates a new database called newreal2alias containing the
  3. # contents of the old data base except for the record corresponding 
  4. # to <alias>. This was necessary because of a bug in either dbm
  5. # or perl which failed to delete entries in the database if the key
  6. # was over 1024 characters long. Please don't ask how I managed to
  7. # create a key over 1024 characters long. You should never need to
  8. # use this, but it's here if you do. PLEASE DON'T DO THIS WHEN
  9. # UNSPOOL IS RUNNING. After you run this, you can delete the old
  10. # real2alias db and rename (NOT copy) newreal2alias.{dir,pag} to 
  11. # real2alias.{dir,pag}.
  12. #
  13. # Usage: fixit <target-alias>
  14. #
  15. if ( $#ARGV != 0 ) {
  16.     print STDERR "Usage: fixit <alias>\n";
  17.     exit(1);
  18. }
  19. $target_alias = $ARGV[0];
  20. dbmopen(r2a,"/usr/personals/real2alias",0600) 
  21.     || die "$0: can't dbmopen real2alias: $!\n";
  22. dbmopen(newr2a,"/usr/personals/newreal2alias",0600) 
  23.     || die "$0: can't dbmopen newreal2alias: $!\n";
  24. while (($key,$value) = each %r2a) {
  25.     if ( "$value" ne "$target_alias" ) {
  26.         $newr2a{$key} = $value;
  27.         print $key," = ",$value, "\n";
  28.     }
  29. }
  30. dbmclose(r2a);
  31. dbmclose(newr2a);
  32. exit(0);
  33.