Import jhead 2.0.

Submitted by Xavier Santolaria <xavier@santolaria.net>.

Jhead is a command line driven program for manipulating
the non image parts of Exif flavor Jpeg files that most
digital cameras produce.
This commit is contained in:
naddy 2003-07-17 22:07:06 +00:00
parent e5c48dfb39
commit 4303d19f99
6 changed files with 157 additions and 0 deletions

36
graphics/jhead/Makefile Normal file
View File

@ -0,0 +1,36 @@
# $OpenBSD: Makefile,v 1.1.1.1 2003/07/17 22:07:06 naddy Exp $
COMMENT= "Exif Jpeg camera setting parser and thumbnail remover"
DISTNAME= jhead-2.0
CATEGORIES= graphics
HOMEPAGE= http://www.sentex.net/~mwandel/jhead/
MASTER_SITES= ${HOMEPAGE}
MAINTAINER= Xavier Santolaria <xavier@santolaria.net>
# public domain
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
USE_GMAKE= Yes
MAKE_FILE= makefile
post-extract:
@perl -pi -e 's,\015,,g' ${WRKSRC}/makefile ${WRKSRC}/*.[ch]
post-build:
@gzip -d ${WRKSRC}/jhead.1.gz
NO_REGRESS= Yes
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/jhead ${PREFIX}/bin
${INSTALL_DATA} ${WRKSRC}/jhead.1 ${PREFIX}/man/man1
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/jhead
${INSTALL_DATA} ${WRKSRC}/usage.html ${PREFIX}/share/doc/jhead
.include <bsd.port.mk>

3
graphics/jhead/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (jhead-2.0.tar.gz) = 0fa7c878390b5019b017f3c5d087a35e
RMD160 (jhead-2.0.tar.gz) = e4c627009c2b710c74143d7e86299e82c298d502
SHA1 (jhead-2.0.tar.gz) = 6e2ced3b0046e75aba7e18969a4d2841b31991aa

View File

@ -0,0 +1,96 @@
$OpenBSD: patch-jhead_c,v 1.1.1.1 2003/07/17 22:07:06 naddy Exp $
--- jhead.c.orig Thu Jul 17 20:33:53 2003
+++ jhead.c Thu Jul 17 20:34:20 2003
@@ -148,7 +148,7 @@ static int FileEditComment(char * TempFi
#endif
}
- sprintf(QuotedPath, "%s \"%s\"",Editor, TempFileName);
+ snprintf(QuotedPath, sizeof QuotedPath, "%s \"%s\"",Editor, TempFileName);
a = system(QuotedPath);
}
@@ -255,7 +255,7 @@ static int ModifyDescriptComment(char *
if (!HasScandate && !ImageInfo.DateTime[0]){
// Scan date is not in the file yet, and it doesn't have one built in. Add it.
char Temp[30];
- sprintf(Temp, "scan_date=%s", ctime(&ImageInfo.FileDateTime));
+ snprintf(Temp, sizeof Temp, "scan_date=%s", ctime(&ImageInfo.FileDateTime));
strcat(OutComment, Temp);
Modified = TRUE;
}
@@ -283,7 +283,9 @@ static int AutoResizeCmdStuff(void)
if (scale > 0.8) return FALSE; // Don't rescale by really small amounts (not worth it!)
- sprintf(CommandString, "mogrify -geometry %dx%d -quality 80 &i",(int)(ImageInfo.Width*scale), (int)(ImageInfo.Height*scale));
+ snprintf(CommandString, sizeof CommandString,
+ "mogrify -geometry %dx%d -quality 80 &i",
+ (int)(ImageInfo.Width*scale), (int)(ImageInfo.Height*scale));
return TRUE;
}
@@ -314,17 +316,20 @@ static void DoCommand(const char * FileN
if (ApplyCommand[a+1] == 'i'){
// Input file.
if (strstr(FileName, " ")){
- e += sprintf(ExecString+e, "\"%s\"",FileName);
+ e += snprintf(ExecString+e, sizeof ExecString+e,
+ "\"%s\"",FileName);
}else{
// No need for quoting (that way I can put a relative path in front)
- e += sprintf(ExecString+e, "%s",FileName);
+ e += snprintf(ExecString+e, sizeof ExecString+e,
+ "%s",FileName);
}
a += 1;
continue;
}
if (ApplyCommand[a+1] == 'o'){
// Needs an output file distinct from the input file.
- e += sprintf(ExecString+e, "\"%s\"",TempName);
+ e += snprintf(ExecString+e, sizeof ExecString+e,
+ "\"%s\"",TempName);
a += 1;
TempUsed = TRUE;
unlink(TempName);// Remove any pre-existing temp file
@@ -476,8 +481,9 @@ void DoFileRenaming(const char * FileNam
}else{
// My favourite scheme.
- sprintf(NewBaseName+PrefixPart, "%02d%02d-%02d%02d%02d",
- tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
+ snprintf(NewBaseName+PrefixPart, sizeof NewBaseName+PrefixPart,
+ "%02d%02d-%02d%02d%02d", tm.tm_mon+1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec);
}
for (a=0;;a++){
@@ -501,7 +507,7 @@ void DoFileRenaming(const char * FileNam
NameExtra[0] = 0;
}
- sprintf(NewName, "%s%s.jpg", NewBaseName, NameExtra);
+ snprintf(NewName, sizeof NewName, "%s%s.jpg", NewBaseName, NameExtra);
if (!strcmp(FileName, NewName)) break; // Skip if its already this name.
@@ -592,7 +598,8 @@ void ProcessFile(const char * FileName)
#ifdef _WIN32
sprintf(RotateCommand, "jpegtran -%s &i &o", Argument);
#else
- sprintf(RotateCommand, "jpegtran -%s &i > &o", Argument);
+ snprintf(RotateCommand, sizeof RotateCommand,
+ "jpegtran -%s &i > &o", Argument);
#endif
ApplyCommand = RotateCommand;
DoCommand(FileName);
@@ -810,7 +817,7 @@ void ProcessFile(const char * FileName)
// Print to temp buffer first to avoid putting null termination in destination.
// snprintf() would do the trick ,but not available everywhere (like FreeBSD 4.4)
- sprintf(TempBuf, "%04d:%02d:%02d %02d:%02d:%02d",
+ snprintf(TempBuf, sizeof TempBuf, "%04d:%02d:%02d %02d:%02d:%02d",
tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec);

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-makefile,v 1.1.1.1 2003/07/17 22:07:06 naddy Exp $
--- makefile.orig Thu Jul 17 20:33:53 2003
+++ makefile Thu Jul 17 20:34:20 2003
@@ -10,8 +10,8 @@ all: jhead
objs = $(OBJ)/jhead.o $(OBJ)/jpgfile.o $(OBJ)/exif.o
$(OBJ)/%.o:$(SRC)/%.c
- cc -O3 -Wall -c $< -o $@
+ ${CC} -Wall -c $< -o $@
jhead: $(objs) jhead.h
- cc -o jhead $(objs) -lm
+ ${CC} -o jhead $(objs) -lm

3
graphics/jhead/pkg/DESCR Normal file
View File

@ -0,0 +1,3 @@
Jhead is a command line driven program for manipulating
the non image parts of Exif flavor Jpeg files that most
digital cameras produce.

5
graphics/jhead/pkg/PLIST Normal file
View File

@ -0,0 +1,5 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2003/07/17 22:07:06 naddy Exp $
bin/jhead
man/man1/jhead.1
share/doc/jhead/usage.html
@dirrm share/doc/jhead