HP3000-L Archives

July 2000, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Doug Becker <[log in to unmask]>
Reply To:
Doug Becker <[log in to unmask]>
Date:
Fri, 21 Jul 2000 11:28:01 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (154 lines)
For those who do not have C, a COBOL version is now available at www.mind-set.com under the link "Multiple Sessions".

As a reminder, go to www.mind-set.com then "LINKS" then HP / IBM Technical Site [I will try to "persuade FrontPage to copy out the Icon for HP this weekend] to get to the "HP / IBM Resource Center". (It doesn't look like it's going to move for awhile, so you can PROBABLY book mark it, with all the standard caveats.)

This was inspired by Barry Lake from Allegro and I took about 45 minutes to write CSM505.

I hope a few can find it useful.

>>> Barry Lake <[log in to unmask]> 07/20 1:29 PM >>>
At 2:27 PM -0600 7/20/00, [log in to unmask] wrote:
>I am trying to find a way to display the IP addresses of all that are
>currently
>logged on to our HP 3K. The closest I have come is to try to think of
>files that
>are open and issues 'LISTF filename, 8'. This gives me a subset of what I
>want.
>
>Any ideas?

  :listf ci.pub.sys,8

Unless you're on MPE/iX 6.5 and using the NEWCI command, every session and
job will have ci.pub.sys open, and the ones coming in over the network will
show the IP address, if available.

Additionally

  :nscontrol status

will show you the node names of the network users, rather than their IP
addresses.


Barry Lake                                 [log in to unmask] 
Allegro Consultants, Inc.                  www.allegro.com 
(408)252-2330


>>> Lane Rollins <[log in to unmask]> 07/20 2:00 PM >>>
on 7/20/00 1:27 PM, Bob Feighner at [log in to unmask] wrote:

> I am trying to find a way to display the IP addresses of all that are
> currently
> logged on to our HP 3K.


Here is a small C program I wrote a few years ago based on CI script that
someone else did. The script was just to slow for my tastes. This also sorts
it by IP address and shows you the number of unique workstations.

-Lane



---------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>

void strip( char *str )
{

   int i;

   i = strlen( str );
   while( ( str[ i-1 ] <= ' ' ) && i > 0 )
      i--;
   str[ i ] = 0;
}

int compar( const char *str1, const char *str2 )
{
   return( memcmp( str1+62, str2+62, 15 ) );
}

main()
{

   FILE *nswork;
   char temp[ 100 ];
   char SessionNum[ 10 ];
   char SessionName[ 30 ];
   char WorkStationID[ 30 ];
#define NSmax 200
   char NSlogins[ NSmax ][ 80 ];
   int  NScount;
   int  i;
   int  WorkStations;
   char LastWorkStation[ 20 ];

   system( "purge nswork,temp > $null" );
   system( "build nswork; temp; rec=-80,,f,ascii" );
   system( "listf ci.pub.sys,8 > nswork" );

   nswork = fopen( "nswork", "r" );
   if( nswork == NULL )
      {
         printf( "Unable to open NSwork\n" );
         exit(1);
      }

   NScount = 0;
   while( fgets( temp, 80, nswork ) != NULL )
      {
         if( memcmp( &temp[ 56 ], "REM :", 5 ) == 0 )
            {
               if( NScount >= NSmax )
                  {
                     printf( "Maximum # of sessions reached!\n" );
                     break;
                  }
               memcpy( NSlogins[ NScount ], temp, 80 );
               NScount++;
            }
      }

   qsort( NSlogins, NScount, 80, compar );

   printf( "\n" );
   printf( "Session   Logon                       Workstation/Machine\n" );
   printf( "--------  --------------------------
------------------------------
-\n" );

   WorkStations = 0;
   strcpy( LastWorkStation, "********" );
   for( i = 0; i < NScount; i++ )
      {
         memcpy( temp, NSlogins[ i ], 80 );
         memcpy( SessionNum, temp, 8 );
         SessionNum[ 8 ] = 0;
         memcpy( SessionName, &temp[ 8 ], 26 );
         SessionName[ 26 ] = 0;
         memcpy( WorkStationID, &temp[ 62 ], 15 );
         WorkStationID[ 15 ] = 0;
         strip( WorkStationID );
         if( strcmp( WorkStationID, LastWorkStation ) != 0 )
            {
               WorkStations++;
               strcpy( LastWorkStation, WorkStationID );
            }
         else
            {
               sprintf( temp, "\x1b&dH%s\x1b&d@", WorkStationID );
               strcpy( WorkStationID, temp );
            }
         printf( "%s  %s  %s\n", SessionNum, SessionName, WorkStationID );
      }

   printf( "\n" );
   printf( "Total number of sessions      = %d\n", NScount );
   printf( "Total number of work stations = %d\n", WorkStations );
   printf( "\n" );
}

ATOM RSS1 RSS2