C under Unix

I want to write a program that provides services to it users such that:
1. The user inputs a known servername and service e.g time, daytime, whois, etc.
2. The program then interrogates the named server and requests for the service required by the user.
3. The server's output is then displayed on the user's display in an easy to read format.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

ahoffmannConnect With a Mentor Commented:
#! /bin/csh -f
if ($#argv < 2) then
   echo "Usage: $0 hostname portnumber"
telnet $1 $2 |&awk '(NR == 4){print}
   csh -c "telnet rio.infodirekt.de 13 | & awk ' ( NR == 4 ) {print}'"
not sufficient?
You didn;t write where is the problemastic part.
I think a simple two question program should work. First interogathe the user as to the machine name and later for the service name.
If you plan to offer only known in advance services that sit at specified ports you may simply encode the info as an array (associative or not is up to you).
Other-wise if the services are known services that sit at well known ports simply parse /etc/services for port number.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.