Question: Write a C program to perform the following. Read the name of an ftp command, identify whether it is a valid command or not and

Write a C program to perform the following. Read the name of an ftp command, identify whether it is a valid command or not and print a line indicating the command is valid or invalid.

 

The list of valid ftp command to use for this question is: (1) ascii, (2) recv (and/or get), (3) send (and/or put), (4) rmdir, (5) mkdir, (6) pwd, (7) ls, (8) cd, (9) status and (10) quit.

 

The pseudo code is given below.

 

Step 1: Read an ftp command into a character array from keyboard using gets function or scanf.

Step 2: Identify what command it is using strcmp function.

Step 3: For valid ftp command print a line of output as:  pwd is a valid ftp command

          For invalid ftp command print a line of output as:  xyz is not a valid ftp command

 

Display the content of source code file hw3q2.c.

Run the executable file which will produce output. 

NOTE: You can run the program multiple times testing for valid ftp commands and one invalid command. Alternately, you can write a loop around Step 1 to 3 and loop until quit command is typed.

Step by Step Solution

3.54 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The code is as follow include include int isValidCommandchar command char val... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Network Questions!