I'm trying to create ls command. First, the code is not working if I enter "ls", it's working only when I enter the full path. Second, it's not looping after the exevcp(). why?
memset(args, 0, sizeof(args));
line = (char*)malloc(1024);
args = strtok(line, " ");
args = strtok(NULL, " ");
It's not looping since
execve() never returns. Also, this seems to be a very strange way to implement
ls: you should try to open a directory and read its contents (the list of files), not run another command, I would expect.