I am pretty much done a shell program I have to write for my operating systems class. The only problem is that I can't seem to figure out how to make this function work. It is supposed to separate out a list of tryable paths that is from the getenv("PATH") function and stick each path into an array of character arrays, but on the line of code indicated below, I get a segmentation fault. Anyway the code is below in a text file. I will post everything from the prototype, to the function call, to the function itself. I'm grateful to everybody who can look at it. Once I am done with the program I would be happy to e-mail the source to anyone who would like to take a look at it. Although aggravating, probably one of the cooler programming projects I have been assigned.
Okay so here is the line that I am getting the seg fault on:
while ((*dirs = &strsep(thePath, ':')) != NULL)
Here I am trying to put the first path in the thePath array in the array dirs which will hold all of them seperately.
I have been awake since yesterday at 1, and I am getting really frustrated with this seg fault as well as my professor who has yet to respond to my e-mail asking the same thing I am asking you guys (sent it yesterday at noon).
Thanks in advance.