home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / dns / ddt2.0 / cmd / expand < prev    next >
Encoding:
Text File  |  1993-05-24  |  1.7 KB  |  65 lines

  1. #! /usr/local/bin/perl
  2. #
  3. #  expand - expands the name of the RR owner with the current origin,
  4. #           if not terminated with a dot, and prints the entire
  5. #        RR with the expanded name in the first column
  6. #
  7. #  Copyright (C) 1992, 1993 PUUG - Grupo Portugues de Utilizadores
  8. #                                  do Sistema UNIX
  9. #                1992, 1993 FCCN - Fundacao para o Desenvolvimento dos Meios 
  10. #                                  Nacionais de Calculo Cientifico 
  11. #
  12. #  Authors: Jorge Frazao de Oliveira <frazao@puug.pt>
  13. #           Artur Romao <artur@dns.pt>
  14. #
  15. #  This file is part of the DDT package, Version 2.0.
  16. #
  17. #  Permission to use, copy, modify, and distribute this software and its 
  18. #  documentation for any purpose and without any fee is hereby granted, 
  19. #  provided that the above copyright notice appear in all copies.  Neither 
  20. #  PUUG nor FCCN make any representations about the suitability of this
  21. #  software for any purpose.  It is provided "as is" without express or 
  22. #  implied warranty.
  23.  
  24.  
  25. # =()<push(@INC, "@<LIBDIR>@");>()=
  26. push(@INC, "/usr/local/lib/ddt/cmd");
  27.  
  28. require "ddt.pl";
  29.  
  30.  
  31. while (<STDIN>) {
  32.     next if /^;/;
  33.  
  34.         chop;    # strip record separator
  35.         @Field = split(/\s+/, $_);
  36.  
  37.         if (/^\$ORIGIN/) {
  38.                 $Origin = $Field[2];
  39.  
  40.                 next;
  41.         }
  42.  
  43.         if (/^[\.\-0-9A-Za-z]+)/ {
  44.                 $Name = &make_name($Field[1], $Origin);
  45.  
  46.         shift(@Field);
  47.         }
  48.  
  49.     if (/\tSOA\t/ && /\(\s*$/) {    # SOA lines continued by a '('
  50.         chop($_ = <STDIN>);    # read the timers line
  51.  
  52.         s/\t//;
  53.             
  54.         push(@Field, $_);
  55.     }
  56.  
  57.     unshift(@Field, $Name);    # insert the name in front of the RR
  58.  
  59.     while (@Field) {
  60.         printf "%s\t", shift(@Field);
  61.     }
  62.  
  63.     print "";
  64. }
  65.