Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Commands are passed to the command line of a Linux terminal in the format $COMMAND,PARAMETER1,PARAMETER2,...,PARAMETER5 i.e., the command begins with the identifying '$' symbol,

Commands are passed to the command line of a Linux terminal in the format "\$COMMAND,PARAMETER1,PARAMETER2,...,PARAMETER5 "

i.e., the command begins with the identifying '$' symbol, followed by a command string, then a list of parameters separated by commas. A command can have up to 5 parameters, or no parameters. Parameters can be up to 5 characters in length. Commands end with a carriage return ' '.

Write a function void parse(char *input) that takes in Commands and parses them into a command string and an array of parameters.

For the following Commands, print the command string and parameters of each: 1. $GETNUM,1 2. $GETSUM,2,3 3. $LISTNUMS,10,300,-40 4. $DONOTHING

Expected outputs: 1. Command string = GETNUM Parameter[0]=1

2. Command string = GETSUM Parameter[0]=2 Parameter[1]=3

3. Command string = LISTNUMS Parameter[0]=10 Parameter[1]=300 Parameter[2]=-40

4. Command string = DONOTHING This command has no parameters

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

= 12 N 10 N app F 12 N a =0m/s/s -ION 12 N

Answered: 1 week ago

Question

Answered: 1 week ago

Answered: 1 week ago