I have a custom newgrp command that I'm working on, that apart from switching your group also starts a command. The syntax looks like this:
$ newgrp group [-e command [arg1, [arg2, [... argN]]]]
$ newgrp staff -e /some/path/server/start -a -e -m "Servern är startad som grupp staff."
Now, the problem is those double quotes up there. My program needs to pass them to the command it starts, but my program never receives them in the first place, because the shell strips them away when creating my program's *argv. This is, of course, normal and not an error in itself. But I need to get around it.
I need to either know which entries in my *argv were quoted when my program was started (so I can put quotes around those arguments myself when passing them to the command to launch), or find another way of solving this.
One thought that struck me was that I could put double quotes around all entries in my *argv when my newgrp starts the command it's supposed to start. But then it won't work with special shell characters such as >, <, |, and so on.
FYI, I'm running AIX 5.3. My newgrp uses system() to launch the command.
I'd appreciate any help. I've run quite a few searches, but I haven't found anything of value.