Too big a chunk of refactoring and portability fix. #7
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.
Added gcc and clang build support for Ubuntu (tested with 17.04).
Added gcc/c4droid build support (tested with Marshmallow).
Added clang/termux build support (tested with marshmallow).
Added command line rewrite driver for testing.
Hopefully, Mac build is fine. I don't have the environment to verify.
Fixed a few potential buffer overrun (I vaguely remember a command could be up to 4k (?) (I could very well be wrong) and strncpy doesn't always NULL-end the string, ref manpage).
I was actually planning/researching on a similar tool, but for native environment. Thanks to this great template, a working prototype took only a few hours. It would most likely end up as a magisk module. Though it wasn't my plan to contribute to termux when I started, but I am a grateful user, so why not.
If ppl like what I did to it, there is more to come. If not, that fine, too. The code and updates will be on github, I just won't be actively sending pull requests.
Cheers,