Change Shell Handler Signature Completely
To increase similarity with regular shells, the handler signature could be changed to
int handler(int argc, char **argv);.
The return value 0 would indicate success, anything else would be treated as an error.
The shell would need to be changed to iterate over the whole string with strtok, counting the parameters and to check the return value of the handler. If an error occurred the shell could print a message.
All shell commands would need to be updated for the new signature.
Pros:
- shell commands can communicate errors more easily (just return 1)
- no need for use of the unfamiliar strtok within the commands
- easier portability of existing commands
Cons:
- commands loose the ability to sscanf through parameters expecting spaces
+1
+1
+1 if quoting is allowed, otherwise I see little use in argc and argv.
this would simplify all shell handlers, so adding strtok in one place is is good idea.
this was it. +1 with quoting.
All in favor of quoting support: would parsing " chars be enough, or would you expect the full range (i.e.: "'\, did I miss anything?) of characters to work?
" or ' and escaping using \...
I guess the latter one would be overkill, but you get a +2 from me if you program both with a compile time switch. :)
Well then, start with just ". We can improve as needed. ;)
I'll sketch up a little function.
@Kijewski Stealing from the newbies, are you? ;-)
@LudwigOrtmann, of course I am. Stealing the easy tasks is my style. :dancers: Anyways, how many newbies do you count in this thread? :)
None so far .. but seriously - in case you did not realize - the newbie tag was for potential gsoc candidates - those are not to be expected yet. And also: I'm absolutely fine with you implementing this =)
Sorry, I did not know that. :-/ Anyhow ... #760. I'd bet that I introduced some errors.
Nothing to be sorry about - it is not meant to prevent anyone else from fixing, just to point the newbies to these tickets.
@Kijewski I accept you as gsoc candidate :+1:
OK, now that #760 has been merged, the remaining missing features from this issue are:
- change of the return type
- escaping using
'and\
Do we consider these items as required?
Which items?
Sorry, that must have been pre-release stress.
What I wanted to say/ask was: Do we consider the not yet solved parts of this feature request as necessary, i.e. are handling of quotes and backslashes and return values a must? (Keeping in mind that we will have a real (aka POSIX compliant) shell soon, aren't we @authmillenon? ;-))