#!/usr/bin/perl
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
#  
#  
# Licensed Materials - Property of IBM 
#  
# (C) COPYRIGHT International Business Machines Corp. 2000,2019 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
#*===========================================================================*/
#*                                                                           */
#* Module Name:  netstatipv4                                                 */
#*                                                                           */
#* Description:                                                              */
#*                                                                           */
#*      /usr/bin/netstat filter for IPv6 alias addresses                     */
#*                                                                           */
#*      This script is written to simplify support of IPv6 aliases           */
#*      on an RS/6000 SP system.   The PSSP software can only use            */
#*      IPv4 network addresses and the netstat command defaults to           */
#*      IPv4 and IPv6 address listings.                                      */
#*                                                                           */
#*                                                                           */
#* NOTE: This command script is verbose, and follows the principle of        */
#*       clarity or readability and ease of maintenance.                     */
#*                                                                           */
#*===========================================================================*/

#####################################################################
# Called by:                                                        #
#                                                                   #
# External Ref:                                                     #
#                                                                   #
# Internal Ref: None                                                #
#                                                                   #
# Change Activity:                                                  #
# 20000119 ZAL 60023: Initial delivery.                             #     #60023
#                                                                   #
#####################################################################
#"@(#)08   1.4   src/rsct/netstatipv4.pl, availability, rsct_rady, rady2035a 2/9/15 18:25:31"


$NETSTAT="/usr/bin/netstat ";
$|=1;

#
#Set return code to not complete
#
$rc=1;

$arg = join($", @ARGV);

$RUNCMD="$NETSTAT " . "$arg";

open( CMD, "$RUNCMD|");

while(<CMD>)
{
   print if ! /:/;
   #
   # If command had valid STDOUT than no error set return code to 0;
   #
   $rc=0;
}
close CMD;

exit $rc