I'm writing a basic shell, and having some issues. I've searched the manpages, google, and this forum, but with no luck, so here's my problem.
execve is working fine for commands that have no arguments, but when it requires arguments, I get a bad address error (returned by perror).
This is how I'm initializing my parameter array:
params = malloc(MAX_PARAM * sizeof *params);
I have MAX_CHAR set to 64, MAX_PARAM set to 16.
Now, my program sets a simple char array called command to "/bin/mkdir", and copies the characters to params. I set params to 'a' and params to 'a'. I've confirmed that this is exactly what's happened. I've printed each individual character in command, identifying null characters. I did the same thing with params and params. commands == NULL, params == NULL, params == NULL, and params == NULL. As far as I can tell I've met all the conditions for this to work, but it still will not... still getting a "bad address" error.
Hopefully I've explained my problem sufficiently. Any ideas?