#!/usr/local/bin/perl -Tw # # Copyright (c) 2001 RIPE NCC # # All Rights Reserved # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permission notice appear in # supporting documentation, and that the name of the author not be # used in advertising or publicity pertaining to distribution of the # software without specific, written prior permission. # # THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING # ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL # AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # #------------------------------------------------------------------------------ # Module Header # Purpose : A syncupdate client # Author : Can Bican # Date : 20021015 # Language Version : >= perl5.005 # OSs Tested : Linux Solaris # Command Line : -u # Version : $Id: cli-sup.pl.in,v 1.6 2002/10/23 09:46:26 can Exp $ #------------------------------------------------------------------------------ use strict; use Getopt::Std; use HTTP::Request::Common qw(POST); use LWP::UserAgent; $| = 1; use vars qw($opt_u); getopts("u:"); my ( $summary, $in, $obj ) = (); my $url = $opt_u ? $opt_u : 'http://syncupdates.db.ripe.net'; while () { $obj .= $_; } my $ua = LWP::UserAgent->new; my $req = POST $url, [ DATA => $obj ]; my @lines = split ( /\n/, $ua->request($req)->as_string ); ( $summary = $lines[0] ) =~ s/^[^ ]+ //; $in = " "; while ( ( $in ne "" ) && ( defined $lines[0] ) ) { $in = shift (@lines); } print "\n$summary\n" if ( $summary !~ /^2[0-9][0-9]/ ); if ( ($#lines) ge 0 ) { print join ( "\n", @lines ) . "\n"; }