On Fri, Feb 02, 2007 at 10:43:20PM +0100, Giuseppe Sacco wrote: ... > programs) and is the same used in the TIFF specification. The only way I
hmph... yeah - sorry, should have checked myself before making noise. > If you have time to provide a patch sensible to a parameter, then I will > gladly sponsor this patch upstream. thanks - well, I've reverted all to TIFF specs, but also made a quick hack for my perusal. Controlling the full format for the whole DateTime tag is not my target nor interest, I just want yyyy/mm/dd right from faxinfo's output as an archive folder path without nothing more than ${DateTime% *}. Please see below, if you & upstream find it acceptable, it may be worth to others to integrate into next release. BTW, I've added a check in case of wrong #params. eg. % util/faxinfo -d / -t . ~/fax06370.tif ... Received: 2002/05/16 08.10.06 ... thanks -- paolo #----------------------------------------------------------------------------- --- util/faxinfo.c++ 2007-02-03 00:17:16.000000000 +0100 +++ util/faxinfo.c++ 2007-02-03 00:43:20.000000000 +0100 @@ -93,6 +93,8 @@ printf("\t-s fmt\tUse fmt for the field start format\n"); printf("\t-e fmt\tUse fmt for the field end format\n"); printf("\t-E fmt\tUse fmt for the fax end format\n"); + printf("\t-d c\tUse c as separator for date from DateTime tag\n"); + printf("\t-t c\tUse c as separator for time from DateTime tag\n"); } static const char* @@ -176,8 +178,10 @@ bool debug = false; bool baseName = false; int c; + char dsc = ':'; + char tsc = ':'; - while ((c = getopt(argc, argv, "C:c:rnbS:s:e:E:D")) != -1) + while ((c = getopt(argc, argv, "t:d:C:c:rnbS:s:e:E:D")) != -1) switch (c) { case '?': usage(appName); @@ -194,6 +198,12 @@ fieldEnd = ""; faxEnd = "\n"; break; + case 'd': + dsc = optarg[0]; + break; + case 't': + tsc = optarg[0]; + break; case 'r': faxStart = ""; fieldStart = "%0.0s"; @@ -227,6 +237,10 @@ fprintf(stderr, "faxStart='%s'\nfieldStart='%s'\nfieldEnd='%s'\nfaxEnd'%s'\n", faxStart,fieldStart,fieldEnd,faxEnd); + if (optind >= argc) { + usage(appName); + return 2; + } while (optind < argc) { const char* name = argv[optind]; @@ -345,12 +359,16 @@ sanitize(date); } else { struct stat sb; - fstat(TIFFFileno(tif), &sb); char buf[80]; + fstat(TIFFFileno(tif), &sb); strftime(buf, sizeof (buf), "%Y:%m:%d %H:%M:%S %Z", localtime(&sb.st_mtime)); date = buf; } + if (date[4] == ':') date[4] = dsc; + if (date[7] == ':') date[7] = dsc; + if (date[13] == ':') date[13] = tsc; + if (date[16] == ':') date[16] = tsc; TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &v); float h = v / (params.vr == VR_NORMAL ? 3.85 : params.vr == VR_200X100 ? 3.94 : #----------------------------------------------------------------------------- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]