Question
Q1. To the version of ./myecho you wrote in the previous question, add support for a -runtests flag that calls the test_quote() and test_to_string() functions.
Q1.
To the version of ./myecho you wrote in the previous question, add support for a -runtests flag that calls the test_quote() and test_to_string() functions. Any strings after -runtests are ignored.
The tests should print their results, as shown in the examples.
For example:
./myecho -runtests running quote tests ... all passed running to_string tests ... all passed ./myecho -runtests one two three running quote tests ... all passed running to_string tests ... all passed ./myecho one two -runtests three one two -runtests three ./myecho -runtests -h one two three running quote tests ... all passed running to_string tests ... all passed ./myecho -h -runtests a b ... prints the help message ...
As these examples show, -h and -runtests only have their special meaning if they appear as the first string passed to myecho. If they appear later, they are treated as regular strings.
Q2.
To the version of ./myecho you wrote in the previous question, add support for the -q flag that prints a " character (double quote) at the begin and end of the printed result. For example:
./myecho -q "" ./myecho x y z x y z ./myecho -q x y z "x y z" > ./myecho -qh z y z ... prints the help message ...
Notice that in the quoted strings there is no space after the last string.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started