This isn't my code; I am trying to figure out what exactly this does. This is a part of a big, ancient system written in C (actually it was written 4 years ago, but most likely written by a late 80s programmer mentality). Part of the code:
char DestFile[256];
char DestFile2[256];
//This part is just to show an example
strcpy(DestFile, "/foo/boo/goo.gz")
strcpy ( DestFile2, DestFile );
Ptr = strrchr ( DestFile2, '.' );
if ( Ptr != 0 ) {
if ( ( strcmp ( Ptr, ".gz" ) == 0 ) ||
( strcmp ( Ptr, ".Z" ) == 0 ) ) {
*Ptr = 0;
rename ( DestFile, DestFile2 );
}
}
DestFile2 is not set anywhere else in the function. I compiled the code above, and printing out the DestFile shows nothing has changed. The only thing i can think of that this does is removing the file extension (*Ptr=0) but my knowledge of C is very limited...
Any ideas? It looks like every time it gets a file with .gz or .z it renames the file to the same name.