I've been looking for an answer to my question but I couldn't find any.
I've read several times the difference of malloc and calloc. If you have an issue with speed, you should use malloc since calloc allocates + initializes the buffer to 0.
Now, in my case, I should stick to malloc because its faster, but I still want to make sure that Id still get the correct data.
Does a call to strcpy after malloc is as good as calling calloc? I know that calloc isnt capable of copying a value of string one to the other. But I want to know if it is as safe as calloc since you used strcpy?
[update from comment:]
I declare and allocate the requersted memory..
char * commands = malloc(1000);
Then compose the awk commands that I need and save it in commands.
strcpy(commands,"awk '{ print $0}' running-config.txt" );
That's how I used it.