reads in a machine hostname and a username, builds the command:

Write a program that reads in a machine hostname and a
username, builds the command:

/usr/bin/ssh <machine> /usr/bin/finger <user>

in a string and uses the system(3) function on that string to output
the information retrieved remotely. Note that you have to validate your
input and handle it securely. For the characteristics of a hostname, look
up \Hostname" on Wikipedia. As far as \user" is concerned, it has to
be a string of alphabetic strings, where, if there are digits at the end,
it may not start with a capital letter. Choose a reasonable maximum
length for the username, taking into account that it may be a real name
(like Sklodovskaya or even longer?).
No one's going to do you homework for you. We can help if you're stuck. You have to make an effort.
i'm not asking you to do my home work
i dont know how to start it
so give me an idea how to read the host name
and build the commands
give me an idea how to read the host name

Knowing the purpose of the string, it should be obvious that this is user input.

give me an idea how to build the commands

String concatenation (unless system() takes command line parameters as separate arguments).
Topic archived. No new replies allowed.