Robbins Rules for Functions, USP pp30-31 Analysis of my Os09w makeargv version 3 code General Comments I believe the USP makeargv is trying to allocate the entire set of argv strings in one contiguous block of memory. My makeargv makes no attempt to do that. I do a separate malloc for each argument string. I believe the reason the textbook makeargv allocates the argv strings in one contiguous block, besides aesthetics, is because older versions of Unix did not have such a flexible set of exec functions and so exec required the contiguity of the argv strings (I'm recalling comments from Sherri). Item-by-item analysis 1. I don't properly make use of return values to communicate errors from my makeargv 2. I correctly avoid exiting from the function. 3. The function is generally usable as far as I can tell. 4. I improperly made use of a fixed size buffer for the argv array. 5. I improperly used a home-grown fixed limit instead of a system-defined limit for the argv array. 6. I did use standard library functions, but only after my third attempt to write this and only because I got the idea of strspn from somebody else's code. 7. I properly did not modify input parameters. As far as I know, anyway. But I did not re-check strspn to make sure it does not modify its parameters. Strtok does, and that is why the textbook makeargv copies the string first. 8. I did not use static variables. I did use dynamic memory, which might have been OK if I had been consistent. I should either use fixed limits and not used malloc, or I should have used malloc and not used fixed limits. 9. I did not free memory that was allocated, but that might be OK by design. It would be the caller's job to do that, but I should clearly state how to do that, or better, provide a proper function freemakeargv for the user to use as a companion to my makeargv. I did not have any error returns, which is bad enough, but if I did, I would need to make sure to free any allocated memory. 10. I don't use static variables, but I'm doubtful the function is re-entrant because of the strspn which I bet works like strtok. I don't have my man page with me at the moment. I believe all library functions that are not reentrant will say so in the man page. No function is reentrant if it calls a non-reentrant function. Note that the textbook makeargv is not reentrant because it uses strtok and we know from the chapter that strtok is not reentrant. 11. Interruption by signals? Ha! 12. The entire program's termination is suspect because there is no error checking.