Home | History | Annotate | Download | only in jhead

Lines Matching refs:FileName

68                                     // the filename to store the thumbnail to.
71 // the filename to retrieve the thumbnail from.
294 printf("not resizing %dx%x '%s'\n",ImageInfo.Height, ImageInfo.Width, ImageInfo.FileName);
352 static void DoCommand(const char * FileName, int ShowIt)
362 // (a is the number of characters to copy from FileName)
363 a = strlen(FileName)-1;
364 while(a > 0 && FileName[a-1] != SLASH) a--;
365 memcpy(TempName, FileName, a);
379 e += shellescape(ExecString+e, FileName);
410 unlink(FileName);
411 rename(TempName, FileName);
460 // If the filename contains substring "&i", then substitute the
461 // filename for that. This gives flexibility in terms of processing
480 void RenameAssociated(const char * FileName, char * NewBaseName)
490 for(ExtPos = strlen(FileName);FileName[ExtPos-1] != '.';){
494 memcpy(FilePattern, FileName, ExtPos);
498 for(PathLen = strlen(FileName);FileName[PathLen-1] != SLASH;){
536 static void DoFileRenaming(const char * FileName)
540 int PrefixPart = 0; // Where the actual filename starts.
548 ExtensionPart = strlen(FileName);
549 for (a=0;FileName[a];a++){
550 if (FileName[a] == SLASH){
557 if (FileName[a] == '.') ExtensionPart = a; // Remember where extension starts.
559 if (isalpha(FileName[a])) NumAlpha += 1; // Tally up alpha vs. digits to judge wether to rename.
560 if (isdigit(FileName[a])) NumDigit += 1;
571 printf("File '%s' contains no exif date stamp. Using file date\n",FileName);
577 strncpy(NewBaseName, FileName, PATH_MAX); // Get path component of name.
599 memmove(s, FileName + PrefixPart, n);
664 if (!strcmp(FileName, NewName)) break; // Skip if its already this name.
673 if (rename(FileName, NewName) == 0){
674 printf("%s --> %s\n",FileName, NewName);
678 RenameAssociated(FileName, NewName);
682 printf("Error: Couldn't rename '%s' to '%s'\n",FileName, NewName);
689 printf("Possible new names for for '%s' already exist\n",FileName);
698 static int DoAutoRotate(const char * FileName)
712 DoCommand(FileName, FALSE);
724 strcpy(ThumbTempName_in, FileName);
726 strcpy(ThumbTempName_out, FileName);
749 static int RegenerateThumbnail(const char * FileName)
758 RegenThumbnail, RegenThumbnail, FileName);
762 return ReplaceThumbnail(FileName);
772 void ProcessFile(const char * FileName)
777 if (strlen(FileName) >= PATH_MAX-1){
778 // Protect against buffer overruns in strcpy / strcat's on filename
779 ErrFatal("filename too long");
783 CurrentFile = FileName;
797 if (stat(FileName, &st) >= 0){
806 if (access(FileName, 2 /*W_OK*/)){
807 printf("Skipping readonly file '%s'\n",FileName);
812 strncpy(ImageInfo.FileName, FileName, PATH_MAX);
819 if (!ReadJpegFile(FileName, READ_METADATA)) return;
840 if (DoAutoRotate(FileName)){
845 DoCommand(FileName, Quiet ? FALSE : TRUE);
847 if (stat(FileName, &dummy)){
860 RelativeName(RelativeExifName, ExifXferScrFile, FileName);
874 if (!ReadJpegFile(FileName, ReadMode)) return;
905 RelativeName(OutFileName, ThumbSaveName, FileName);
919 if (RegenerateThumbnail(FileName)){
927 RelativeName(ThumbFileName, ThumbInsertName, FileName);
973 RelativeName(CommentFileName, CommentInsertfileName, FileName);
1003 strcpy(EditFileName, FileName);
1037 RelativeName(OutFileName, CommentSavefileName, FileName);
1048 printf("File '%s' contains no comment section\n",FileName);
1103 printf("File '%s' contains no Exif timestamp to change\n", FileName);
1128 if (!Quiet) printf("Modified: %s\n",FileName);
1130 strcpy(BackupName, FileName);
1137 rename(FileName, BackupName);
1140 if (WriteJpegFile(FileName)) {
1146 chmod(FileName, buf.st_mode);
1151 utime(FileName, &mtime);
1158 rename(BackupName, FileName);
1180 if (utime(FileName, &mtime) != 0){
1181 printf("Error: Could not change time of file '%s'\n",FileName);
1183 if (!Quiet) printf("%s\n",FileName);
1186 printf("File '%s' contains no Exif timestamp\n", FileName);
1194 DoFileRenaming(FileName);