/* makeext.c - convert an extension to a different extension */ #include #include /* return non-zero on success */ static int make_file_name(char *dest, size_t max, const char *orig, const char *newext) { const char *oldext; /* copy string up to old extension, if any */ oldext=strrchr(orig, '.'); while(*orig && orig!=oldext) { if(max<=0) return 0; max--; *(dest++)=*(orig++); } /* copy the new extension */ do { if(max<=0) return 0; max--; *(dest++)=*newext; } while(*(newext++)); return 1; } int main(int argc, char **argv) { char buf[16]; int i; for(i=1;i