Attempts to add command line argument parsing with getopt_long. - #25
Open
Yetoo1 wants to merge 1 commit into
Open
Attempts to add command line argument parsing with getopt_long.#25Yetoo1 wants to merge 1 commit into
Yetoo1 wants to merge 1 commit into
Conversation
This commit attempts to add command line options -a -h -p -r -u and
adds help documentation. This was using getopt_long. The url can be
customized with -r, -a, and -p (address, protocol, and port respectively)
with -u overriding the aformentioned options if submitted alongside and
allowing to specify a url string with appropriate components concatenated
in a single string. The following is the help text and gives more description:
usage: server [-ahpru] [file]
The default generated url is http://0:8080
A url can be customized by providing the address (-a), port (-p), or protocol (-r). A url can be entered in full with the -u option.
-a, --address Specify an address to use in url (default 0)
-h, --help Print this help message
-p, --port Specify a port to use in url (default 8080)
-r, --protocol Specify a protocol to use in url (default http)
-u, --url Specify a url with the following format. (protocol://address:port).
If other options are used with -u, -u will override the other options.
Issues:
1. The protocol on a generated or supplied url gives a Failed to open server:
Protocol not found and it looks like there is healthy output, but testing
download looks like the request isn't being registered. I've found that if a
literal string is substituted for the url string, this issue doesn't happen,
but if the string is generated or delivered from a char* or const char* the
error occurrs.
2. Input from redirection and/or pipe may not be correctly handled (it wasn't
correctly handled in the latest commit in master).
Author
|
Any help and/or suggestions would be appreciated to resolve both issues with this commit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit attempts to add command line options -a -h -p -r -u and
adds help documentation. This was using getopt_long. The url can be
customized with -r, -a, and -p (address, protocol, and port respectively)
with -u overriding the aformentioned options if submitted alongside and
allowing to specify a url string with appropriate components concatenated
in a single string. The following is the help text and gives more description:
usage: server [-ahpru] [file]
The default generated url is http://0:8080
A url can be customized by providing the address (-a), port (-p), or protocol (-r). A url can be entered in full with the -u option.
-a, --address Specify an address to use in url (default 0)
-h, --help Print this help message
-p, --port Specify a port to use in url (default 8080)
-r, --protocol Specify a protocol to use in url (default http)
-u, --url Specify a url with the following format. (protocol://address:port).
If other options are used with -u, -u will override the other options.
Issues:
Protocol not found and it looks like there is healthy output, but testing
download looks like the request isn't being registered. I've found that if a
literal string is substituted for the url string, this issue doesn't happen,
but if the string is generated or delivered from a char* or const char* the
error occurrs.
correctly handled in the latest commit in master).