i'm having trouble with this code:
int main(int argc, char **argv)
{
int index;
char resolvedpath[1000];
for(index = 1; index < argc; index++)
{
if(realpath(argv[index], resolvedpath))
printf("%-20s -> %s\n", argv[index], resolvedpath);
else
printf("%s: none\n", argv[index]);
}
return EXIT_SUCCESS;
}
when i call this program with a filename that doesn't exist, index
gets overwritten with zeroes and the for loops forever!
if i declare resolvedpath to be at least PATH_MAX characters, though,
all is well. the manpage didn't mention this, however. am i doing
something wrong?
---
"... What with you being his parents and all, I think that you could
be trusted not to shaft him." -- Robert Chang, rec.games.board