Import xzgv 0.8

xzgv is a picture viewer for X, with a thumbnail-based file selector.
It uses GTK+ and Imlib. Most file formats are supported, and the
thumbnails used are compatible with xv, zgv, and the Gimp. It can also
be used with `xzgv file(s)', to effectively bypass the file selector.

From Julian Leyh <oenone@oenone.de>
This commit is contained in:
alek 2005-05-22 11:32:11 +00:00
parent dc08dd1f9b
commit 57b5969b4f
19 changed files with 719 additions and 0 deletions

32
graphics/xzgv/Makefile Normal file
View File

@ -0,0 +1,32 @@
# $OpenBSD: Makefile,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
COMMENT= "picture viewer for X, with thumbnail-based file selector"
DISTNAME= xzgv-0.8
CATEGORIES= graphics
HOMEPAGE= http://rus.members.beeb.net/xzgv.html
MAINTAINER= Julian Leyh <oenone@oenone.de>
# GPL
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= ftp://ftp.ibiblio.org/pub/Linux/apps/graphics/viewers/X/
MODULES= devel/gettext
LIB_DEPENDS= gtk.1.2,gdk.1.2::x11/gtk+ \
jpeg.62::graphics/jpeg \
tiff.35::graphics/tiff \
png.2::graphics/png \
ungif.5::graphics/libungif \
gdk_imlib.19::graphics/imlib
WANTLIB= Xi Xext X11 m c z glib gmodule
NO_REGRESS= Yes
.include <bsd.port.mk>

3
graphics/xzgv/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (xzgv-0.8.tar.gz) = e392277f1447076402df2e3d9e782cb2
RMD160 (xzgv-0.8.tar.gz) = e36466a73c27616610fd032b3a92898d95a55a17
SHA1 (xzgv-0.8.tar.gz) = 1aa21336e2562849e6f5f984cbbfcb745489df3b

View File

@ -0,0 +1,38 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- Makefile.orig Tue Sep 16 14:58:30 2003
+++ Makefile Thu May 12 16:00:02 2005
@@ -24,30 +24,24 @@ VERS=0.8
-all: src man infowarn
+all: src man info
-src: xzgv src/install-info
+src: xzgv
# We try this the whole time, as the dependancies are a bit
# complicated to duplicate here.
xzgv:
cd src && $(MAKE) xzgv
-src/install-info: src/install-info.c
- cd src && $(MAKE) install-info
-
man: doc/xzgv.1
-doc/xzgv.1: doc/xzgv.texi doc/makeman.awk
- cd doc && $(MAKE) xzgv.1
-
# Like in GNU stuff, info files aren't automatically remade,
# as I don't want to assume everyone has texinfo's `makeinfo' handy.
# So the `infowarn' below is mainly to warn me if the info gets
# out of date. :-)
-info: doc/xzgv.gz
+info: doc/xzgv.info
-doc/xzgv.gz: doc/xzgv.texi
+doc/xzgv.info: doc/xzgv.texi
cd doc && $(MAKE) info
# Warn if the info is out of date. This *is* automatically done.

View File

@ -0,0 +1,38 @@
$OpenBSD: patch-config_mk,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- config.mk.orig Mon Jan 8 05:57:44 2001
+++ config.mk Sun May 22 13:21:39 2005
@@ -6,8 +6,6 @@
# Set the C compiler to use, and options for it.
# This is likely to be what you'll want for most systems:
#
-CC=gcc
-CFLAGS=-O2 -Wall
# Set the awk interpreter to use for a script used while compiling.
# (This should be a `new' awk, such as gawk or mawk.)
@@ -27,7 +25,7 @@ AWK=awk
# On non-x86-based machines (e.g. Alpha, Sparc, PPC), you should
# comment it out.
#
-CFLAGS+=-DINTERP_MMX
+#CFLAGS+=-DINTERP_MMX
# Set rendering backend to use. Currently only Imlib 1.x is properly
# supported, so leave this alone. :-)
@@ -45,7 +43,6 @@ BACKEND=IMLIB1
# MANDIR to directory for man page.
# Usually it will be simpler to just set PREFIX.
#
-PREFIX=/usr/local
# In theory it would be nice to put the info file and man page under
# /usr/local/share. However, it's not clear if this is widely
@@ -90,3 +87,8 @@ MANDIR=$(PREFIX)$(SHARE_INFIX)/man/man1
# doc/Makefile isn't as smart about that as it should be. :-))
#
USE_A4_DEF=-t @afourpaper
+
+# -------------------- Adding missing include paths ---------------
+
+CFLAGS+=-I${LOCALBASE}/include
+CFLAGS+=-I${LOCALBASE}/include/libpng

View File

@ -0,0 +1,52 @@
$OpenBSD: patch-doc_Makefile,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- doc/Makefile.orig Thu Dec 21 04:45:20 2000
+++ doc/Makefile Thu May 12 15:56:37 2005
@@ -10,7 +10,7 @@ include ../config.mk
all: info man
-info: xzgv.gz
+info: xzgv.info
dvi: xzgv.dvi
xzgv.gz: xzgv.texi
@@ -23,6 +23,9 @@ xzgv.dvi: xzgv.texi
@echo "=== NB: If you don't want A4 paper, edit config.mk! ==="
texi2dvi -c $(USE_A4_DEF) xzgv.texi
+xzgv.info: xzgv.texi
+ makeinfo --no-split xzgv.texi -o xzgv.info
+
# This explicitly mentions `gawk' because makeman requires it
# (and can't easily be made not to, since it really does need gensub).
# To avoid problems on gawkless systems, a prebuilt xzgv.1 is included
@@ -36,25 +39,10 @@ xzgv.1: xzgv.texi makeman.awk
installdirs:
/bin/sh ../mkinstalldirs $(INFODIR) $(MANDIR)
-install: ../src/install-info installdirs
- install xzgv.1 $(MANDIR)
- install xzgv.gz xzgv-?.gz $(INFODIR)
- chmod 644 $(MANDIR)/xzgv.1 $(INFODIR)/xzgv*
-# Update info `dir' file.
-# Info always uses a dir file in preference to a dir.gz, so we don't use
-# dir.gz unless it's the only game in town.
- if [ "$(INFO_DIR_UPDATE)" != no ]; then \
- gzip -d xzgv.gz; \
- if [ -f $(INFODIR)/dir.gz -a ! -f $(INFODIR)/dir ]; then \
- gzip -d $(INFODIR)/dir.gz; \
- ../src/install-info xzgv $(INFODIR)/dir; \
- gzip $(INFODIR)/dir; \
- else \
- ../src/install-info xzgv $(INFODIR)/dir; \
- fi; \
- chmod a+r $(INFODIR)/dir; \
- gzip xzgv; \
- fi
+install:
+ ${BSD_INSTALL_MAN} xzgv.1 ${MANDIR}
+ ${BSD_INSTALL_DATA} xzgv.info ${INFODIR}
+ install-info ${INFODIR}/xzgv.info ${INFODIR}/dir
../src/install-info: ../src/install-info.c
cd ../src && $(MAKE) install-info

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-src_Makefile,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- src/Makefile.orig Tue Jan 1 06:37:45 2002
+++ src/Makefile Thu May 12 15:53:36 2005
@@ -30,7 +30,7 @@ BACKEND_LIBS=`case "$(BACKEND)" in \
# compile when you do `make install'. :-)
# (It would also be weird to have it made by the `doc' Makefile, IMHO.)
-all: xzgv install-info
+all: xzgv
OBJS= main.o \
filedetails.o gotodir.o updatetn.o confirm.o help.o \
@@ -57,9 +57,8 @@ install-info: install-info.c getopt.o ge
installdirs:
/bin/sh ../mkinstalldirs $(BINDIR)
-install: xzgv installdirs
- install xzgv $(BINDIR)
- chmod 755 $(BINDIR)/xzgv
+install: xzgv
+ ${BSD_INSTALL_PROGRAM} xzgv $(BINDIR)
uninstall:
$(RM) $(BINDIR)/xzgv

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_backend_c,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- src/backend.c.orig Thu May 12 15:42:51 2005
+++ src/backend.c Thu May 12 15:43:10 2005
@@ -239,7 +239,7 @@ im->rgb_data = rgb;
im->alpha_data = NULL;
/* Imlib does this next bit for anonymous data... *wretch* */
-g_snprintf(s, sizeof(s), "creat_%lx_%x", time(NULL), rand());
+g_snprintf(s, sizeof(s), "creat_%lx_%x", (long unsigned int)time(NULL), rand());
im->filename = strdup(s);
im->width = 0;

View File

@ -0,0 +1,74 @@
$OpenBSD: patch-src_copymove_c,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- src/copymove.c.orig Thu Nov 16 15:59:48 2000
+++ src/copymove.c Thu May 12 15:31:52 2005
@@ -57,15 +57,17 @@ if(!cm_isdir(dstdir)) return(0);
if((in=fopen(src,"rb"))==NULL)
return(0);
-if((dst=malloc(strlen(dstdir)+strlen(src)+2))==NULL) /* +2 for / and NUL */
+siz=strlen(dstdir)+strlen(src)+1; /* +2 for / and NUL */
+
+if((dst=malloc(siz))==NULL)
return(0);
-strcpy(dst,dstdir);
-strcat(dst,"/");
+strlcpy(dst,dstdir,siz);
+strlcat(dst,"/",siz);
if(strrchr(src,'/'))
- strcat(dst,strrchr(src,'/')+1);
+ strlcat(dst,strrchr(src,'/')+1,siz);
else
- strcat(dst,src);
+ strlcat(dst,src,siz);
/* check it doesn't already exist */
if((out=fopen(dst,"rb"))!=NULL)
@@ -114,18 +116,21 @@ int movefile(char *src,char *dstdir)
struct stat sbuf;
struct utimbuf utbuf;
char *dst;
+int siz;
if(!cm_isdir(dstdir)) return(0);
-if((dst=malloc(strlen(dstdir)+strlen(src)+2))==NULL) /* +2 for / and NUL */
+siz=strlen(dstdir)+strlen(src)+2; /* +2 for / and NUL */
+
+if((dst=malloc(siz))==NULL)
return(0);
-strcpy(dst,dstdir);
-strcat(dst,"/");
+strlcpy(dst,dstdir,siz);
+strlcat(dst,"/",siz);
if(strrchr(src,'/'))
- strcat(dst,strrchr(src,'/')+1);
+ strlcat(dst,strrchr(src,'/')+1,siz);
else
- strcat(dst,src);
+ strlcat(dst,src,siz);
/* fail if dest file already exists */
if(stat(dst,&sbuf)==0)
@@ -328,9 +333,9 @@ for(done=f=0;f<numrows;f++)
if(!(*copy_or_move_ptr)(ptr,destdir))
{
- sprintf(buf,"Error %s ",cm_do_move?"moving":"copying");
+ snprintf(buf,sizeof(buf),"Error %s ",cm_do_move?"moving":"copying");
/* if it's a really big filename just say "file" :-) */
- strcat(buf,(strlen(ptr)>100)?"file":ptr);
+ strlcat(buf,(strlen(ptr)>100)?"file":ptr,sizeof(buf));
if(mainwin)
{
@@ -377,7 +382,7 @@ static void cb_ok_button(GtkWidget *butt
char *ptr=gtk_entry_get_text(GTK_ENTRY(entry));
int isdir;
-if(!ptr || *ptr==0 || strcmp(ptr,".")==0)
+if(!ptr || *ptr==0 || strncmp(ptr,".",2)==0)
{
gtk_widget_destroy(dir_win);
return;

View File

@ -0,0 +1,79 @@
$OpenBSD: patch-src_filedetails_c,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- src/filedetails.c.orig Sat Nov 18 18:58:39 2000
+++ src/filedetails.c Thu May 12 15:32:46 2005
@@ -26,7 +26,7 @@ static char buf[10];
int f,shift,submode;
char *execptr;
-strcpy(buf,"---------");
+strlcpy(buf,"---------",sizeof(buf));
for(f=0,shift=6;f<3;f++,shift-=3)
{
@@ -73,14 +73,14 @@ char *ptr;
if((ptr=strrchr(filename,'/'))==NULL)
{
- strcpy(buf,".xvpics/");
- strcat(buf,filename);
+ strlcpy(buf,".xvpics/",sizeof(buf));
+ strlcat(buf,filename,sizeof(buf));
}
else
{
- strcpy(buf,filename);
- strcpy(strrchr(buf,'/')+1,".xvpics/");
- strcat(buf,ptr+1);
+ strlcpy(buf,filename,sizeof(buf));
+ strlcat(buf,".xvpics/",sizeof(buf));
+ strlcat(buf,ptr+1,sizeof(buf));
}
if((tn=fopen(buf,"rb"))!=NULL)
@@ -174,11 +174,11 @@ DO_TBL_LEFT(os_tbl,tbl_row,"Filename:");
DO_TBL_RIGHT(os_tbl,tbl_row,filename);
tbl_row++;
-strcpy(buf,"unknown");
+strlcpy(buf,"unknown",sizeof(buf));
DO_TBL_LEFT(os_tbl,tbl_row,"Size:");
if(got_stat_info)
- sprintf(buf,"%d (%dk)",(int)sbuf.st_size,((int)sbuf.st_size+1023)/1024);
+ snprintf(buf,sizeof(buf),"%d (%dk)",(int)sbuf.st_size,((int)sbuf.st_size+1023)/1024);
DO_TBL_RIGHT(os_tbl,tbl_row,buf);
tbl_row++;
@@ -186,9 +186,9 @@ DO_TBL_LEFT(os_tbl,tbl_row,"Last modifie
if(got_stat_info)
{
if((ctime=localtime(&sbuf.st_mtime))==NULL) /* can't happen? */
- strcpy(buf,"unknown");
+ strlcpy(buf,"unknown",sizeof(buf));
else
- sprintf(buf,"%d-%02d-%02d %02d:%02d",
+ snprintf(buf,sizeof(buf),"%d-%02d-%02d %02d:%02d",
1900+ctime->tm_year,ctime->tm_mon+1,ctime->tm_mday,
ctime->tm_hour,ctime->tm_min);
}
@@ -197,7 +197,7 @@ tbl_row++;
DO_TBL_LEFT(os_tbl,tbl_row,"Permissions:");
if(got_stat_info)
- sprintf(buf,"%s (%o)",
+ snprintf(buf,sizeof(buf),"%s (%o)",
make_perms_string(sbuf.st_mode&07777),sbuf.st_mode&07777);
DO_TBL_RIGHT(os_tbl,tbl_row,buf);
tbl_row++;
@@ -232,9 +232,9 @@ tbl_row=0;
DO_TBL_LEFT(tn_tbl,tbl_row,"Dimensions:");
if(got_dimensions)
- sprintf(buf,"%d x %d",w,h);
+ snprintf(buf,sizeof(buf),"%d x %d",w,h);
else
- strcpy(buf,"unknown");
+ strlcpy(buf,"unknown",sizeof(buf));
DO_TBL_RIGHT(tn_tbl,tbl_row,buf);
tbl_row++;

View File

@ -0,0 +1,45 @@
$OpenBSD: patch-src_help_c,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- src/help.c.orig Tue Sep 16 16:07:44 2003
+++ src/help.c Thu May 12 15:38:33 2005
@@ -84,8 +84,9 @@ void help_run(char *node)
char *cmd_start="xterm -e info '(xzgv)";
char *cmd_end="' &";
char *buf;
+int siz = strlen(cmd_start)+strlen(node)+strlen(cmd_end)+1;
-if((buf=malloc(strlen(cmd_start)+strlen(node)+strlen(cmd_end)+1))==NULL)
+if((buf=malloc(siz))==NULL)
{
/* if we're *that* low on memory, then error_dialog() will fail too,
* so just return.
@@ -93,9 +94,9 @@ if((buf=malloc(strlen(cmd_start)+strlen(
return;
}
-strcpy(buf,cmd_start);
-strcat(buf,node);
-strcat(buf,cmd_end);
+strlcpy(buf,cmd_start,siz);
+strlcat(buf,node,siz);
+strlcat(buf,cmd_end,siz);
/* XXX it turns out the error check is useless, as the `&' leads to
* starting another shell which is the one to give any errors. The
@@ -106,13 +107,14 @@ if(system(buf)!=0)
{
char *msg="Couldn't run help command:\n";
char *buf2;
+ int siz=strlen(msg)+strlen(buf)+1;
- if((buf2=malloc(strlen(msg)+strlen(buf)+1))==NULL)
+ if((buf2=malloc(siz))==NULL)
error_dialog("xzgv error",msg);
else
{
- strcpy(buf2,msg);
- strcat(buf2,buf);
+ strlcpy(buf2,msg,siz);
+ strlcat(buf2,buf,siz);
error_dialog("xzgv error",buf2);
free(buf2);
}

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-src_install-info_c,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- src/install-info.c.orig Thu May 12 15:09:12 2005
+++ src/install-info.c Thu May 12 15:26:28 2005
@@ -166,12 +166,12 @@ concat (s1, s2, s3)
char *s1, *s2, *s3;
{
int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
- char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
+ int siz=strlen(s1)+strlen(s2)+strlen(s3)+1;
+ char *result = (char *) xmalloc (siz);
- strcpy (result, s1);
- strcpy (result + len1, s2);
- strcpy (result + len1 + len2, s3);
- *(result + len1 + len2 + len3) = 0;
+ strlcpy (result, s1, siz);
+ strlcat (result, s2, siz);
+ strlcat (result, s3, siz);
return result;
}
@@ -674,7 +674,7 @@ For more information about these matters
basename_len = strlen (infile_basename);
infile_sans_info
= (strlen (infile_basename) > 5
- && strcmp (infile_basename + basename_len - 5, ".info") == 0)
+ && strncmp (infile_basename + basename_len - 5, ".info",6) == 0)
? copy_string (infile_basename, basename_len - 5)
: infile_basename;
@@ -880,7 +880,7 @@ For more information about these matters
/* Mark the end of the Top node as the place to add any
new sections that are needed. */
for (node = dir_nodes; node; node = node->next)
- if (node->name && strcmp (node->name, "Top") == 0)
+ if (node->name && strncmp (node->name, "Top", 4) == 0)
dir_lines[node->end_line].add_sections_before = 1;
}

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-src_logoconv_c,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- src/logoconv.c.orig Sat Oct 7 15:25:25 2000
+++ src/logoconv.c Thu May 12 15:35:40 2005
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
+#include <string.h>
/* we take an extremely generous outlook - anything other than a decimal
@@ -49,7 +50,7 @@ unsigned char buf[128];
int w,h,x,y,c;
fgets(buf,sizeof(buf),stdin);
-if(strcmp(buf,"P6\n")!=0)
+if(strncmp(buf,"P6\n",4)!=0)
fprintf(stderr,"logoconv: stdin not a raw PPM file.\n"),exit(1);
w=read_next_number(stdin);

View File

@ -0,0 +1,179 @@
$OpenBSD: patch-src_main_c,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- src/main.c.orig Tue Sep 16 15:49:01 2003
+++ src/main.c Thu May 12 15:36:47 2005
@@ -2889,7 +2889,7 @@ if((in=fopen(filename,"rb"))==NULL)
return(0);
fgets(buf,sizeof(buf),in);
-if(strcmp(buf,"P7 332\n")!=0)
+if(strncmp(buf,"P7 332\n",sizeof(buf))!=0)
return(0);
/* we're not worried about any comments */
@@ -3007,25 +3007,25 @@ if(l<=4) return(0);
* natively, and uses ImageMagick's `convert' for others.
* But we have our own GIF/PNG/mrf readers.
*/
-if((!strcasecmp(filename+l-4,".gif")) ||
- (!strcasecmp(filename+l-4,".jpg")) ||
- (!strcasecmp(filename+l-5,".jpeg")) ||
- (!strcasecmp(filename+l-4,".png")) ||
- (!strcasecmp(filename+l-4,".mrf")) ||
- (!strcasecmp(filename+l-4,".xbm")) ||
- (!strcasecmp(filename+l-5,".icon")) || /* presumably an XBM */
- (!strcasecmp(filename+l-4,".xpm")) ||
- (!strcasecmp(filename+l-4,".pbm")) ||
- (!strcasecmp(filename+l-4,".pgm")) ||
- (!strcasecmp(filename+l-4,".ppm")) ||
- (!strcasecmp(filename+l-4,".bmp")) ||
- (!strcasecmp(filename+l-4,".tga")) ||
- (!strcasecmp(filename+l-4,".pcx")) ||
- (!strcasecmp(filename+l-4,".tif")) ||
- (!strcasecmp(filename+l-5,".tiff")) ||
- (!strcasecmp(filename+l-4,".prf")) ||
- (!strcasecmp(filename+l-4,".tim")) ||
- (!strcasecmp(filename+l-4,".xwd")))
+if((!strncasecmp(filename+l-4,".gif",5)) ||
+ (!strncasecmp(filename+l-4,".jpg",5)) ||
+ (!strncasecmp(filename+l-5,".jpeg",6)) ||
+ (!strncasecmp(filename+l-4,".png",5)) ||
+ (!strncasecmp(filename+l-4,".mrf",5)) ||
+ (!strncasecmp(filename+l-4,".xbm",5)) ||
+ (!strncasecmp(filename+l-5,".icon",6)) || /* presumably an XBM */
+ (!strncasecmp(filename+l-4,".xpm",5)) ||
+ (!strncasecmp(filename+l-4,".pbm",5)) ||
+ (!strncasecmp(filename+l-4,".pgm",5)) ||
+ (!strncasecmp(filename+l-4,".ppm",5)) ||
+ (!strncasecmp(filename+l-4,".bmp",5)) ||
+ (!strncasecmp(filename+l-4,".tga",5)) ||
+ (!strncasecmp(filename+l-4,".pcx",5)) ||
+ (!strncasecmp(filename+l-4,".tif",5)) ||
+ (!strncasecmp(filename+l-5,".tiff",6)) ||
+ (!strncasecmp(filename+l-4,".prf",5)) ||
+ (!strncasecmp(filename+l-4,".tim",5)) ||
+ (!strncasecmp(filename+l-4,".xwd",5)))
return(1);
else
return(0);
@@ -3090,8 +3090,8 @@ for(f=0;f<IDLE_XVPIC_NUM_PER_CALL;f++)
{
/* construct filename for file's (possible) thumbnail */
gtk_clist_get_text(GTK_CLIST(clist),*entryp,SELECTOR_NAME_COL,&ptr);
- strcpy(buf,".xvpics/");
- strncat(buf,ptr,sizeof(buf)-8-2); /* above string is 8 chars long */
+ strlcpy(buf,".xvpics/",sizeof(buf));
+ strlcat(buf,ptr,sizeof(buf));
datptr=gtk_clist_get_row_data(GTK_CLIST(clist),*entryp);
@@ -3386,8 +3386,8 @@ while((dent=readdir(dirfile))!=NULL)
continue; /* skip (most) 'dot' files */
/* no `.' ever, and no `..' if at root. */
- if(strcmp(dent->d_name,".")==0 ||
- (strcmp(cdir,"/")==0 && strcmp(dent->d_name,"..")==0))
+ if(strncmp(dent->d_name,".",2)==0 ||
+ (strncmp(cdir,"/",2)==0 && strncmp(dent->d_name,"..",3)==0))
continue;
/* see if it's a dir */
@@ -3433,10 +3433,10 @@ void set_title(int include_dir)
{
static char buf[1024];
-strcpy(buf,"xzgv");
+strlcpy(buf,"xzgv",sizeof(buf));
if(include_dir)
{
- strcat(buf,": ");
+ strlcat(buf,": ",sizeof(buf));
getcwd(buf+strlen(buf),sizeof(buf)-strlen(buf)-2);
}
@@ -3574,6 +3574,7 @@ static char *prefix=".xvpics/";
char *ptr,*tn;
int row;
int was_reading=0;
+int siz;
row=GTK_CLIST(clist)->focus_row;
gtk_clist_get_text(GTK_CLIST(clist),row,SELECTOR_NAME_COL,&ptr);
@@ -3590,9 +3591,10 @@ cb_back_to_clist();
/* construct thumbnail filename early, as we're about to delete
* the row containing the filename itself.
*/
-tn=malloc(strlen(prefix)+strlen(ptr)+1);
+siz=strlen(prefix)+strlen(ptr)+1;
+tn=malloc(siz);
if(tn)
- strcpy(tn,prefix),strcat(tn,ptr);
+ strlcpy(tn,prefix,siz),strlcat(tn,ptr,siz);
/* remove the row in the clist. We need to stop/restart thumbnail read
* if it's running, as unexpectedly losing a row midway through could
@@ -3634,6 +3636,7 @@ static char *prefix="Really delete `",*s
struct clist_data_tag *datptr;
char *ptr,*msg;
int row;
+int siz;
row=GTK_CLIST(clist)->focus_row;
if(row<0 || row>=numrows) return;
@@ -3644,12 +3647,13 @@ if(!ptr) return;
datptr=gtk_clist_get_row_data(GTK_CLIST(clist),row);
if(!datptr || datptr->isdir) return;
-msg=malloc(strlen(ptr)+strlen(prefix)+strlen(suffix)+1);
+siz=strlen(ptr)+strlen(prefix)+strlen(suffix)+1;
+msg=malloc(siz);
if(!msg) return;
-strcpy(msg,prefix);
-strcat(msg,ptr);
-strcat(msg,suffix);
+strlcpy(msg,prefix,siz);
+strlcat(msg,ptr,siz);
+strlcat(msg,suffix,siz);
/* ok, check if they're sure. If so, the above callback routine
* will be called.
@@ -3667,6 +3671,7 @@ void reinit_dir(int do_pastpos,int try_t
{
int row;
char *ptr,*oldname=NULL;
+int siz;
if(do_pastpos && try_to_save_cursor_pos)
fprintf(stderr,"xzgv: both args to reinit_dir() set, bug alert :-)\n"),
@@ -3676,10 +3681,11 @@ if(try_to_save_cursor_pos)
{
gtk_clist_get_text(GTK_CLIST(clist),GTK_CLIST(clist)->focus_row,
SELECTOR_NAME_COL,&ptr);
- if(!ptr || (oldname=malloc(strlen(ptr)+1))==NULL)
+ siz=strlen(ptr)+1;
+ if(!ptr || (oldname=malloc(siz))==NULL)
try_to_save_cursor_pos=0;
else
- strcpy(oldname,ptr);
+ strlcpy(oldname,ptr,siz);
}
blast_clist();
@@ -4587,7 +4593,7 @@ int f,siz=logo_w*logo_h*3,c;
unsigned char *ptr=logo_data;
/* invert it */
-for(f=0;f<siz;f++) *ptr++=255-*ptr;
+for(f=0;f<siz;f++,ptr++) *ptr=255-*ptr;
/* ok, now kludge it :-) - the black right/bottom edge turns to white,
* which is too bright. Make that the same as the grey line above/left of it.
@@ -4703,7 +4709,7 @@ if(read_dir)
/* check it's really `..' (won't be if in root dir) */
gtk_clist_get_text(GTK_CLIST(clist),0,SELECTOR_NAME_COL,&ptr);
- if(strcmp(ptr,"..")==0)
+ if(strncmp(ptr,"..",3)==0)
set_focus_row(1);
}
}

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_rcfile_c,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- src/rcfile.c.orig Thu May 12 15:39:58 2005
+++ src/rcfile.c Thu May 12 15:40:18 2005
@@ -209,7 +209,7 @@ in_config=1;
*cfgfile=0;
if(home && strlen(home)<sizeof(cfgfile)-strlen("/.xzgvrc")-1)
- sprintf(cfgfile,"%s/.xzgvrc",home);
+ snprintf(cfgfile,sizeof(cfgfile),"%s/.xzgvrc",home);
if((in=fopen(cfgfile,"r"))!=NULL)
got_rcfile=1,config_file_name="~/.xzgvrc"; /* shortened name for that */

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-src_rename_c,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- src/rename.c.orig Thu Nov 16 15:59:14 2000
+++ src/rename.c Thu May 12 15:33:23 2005
@@ -28,6 +28,7 @@ static void cb_ok_button(GtkWidget *butt
struct stat sbuf;
char *tn_src,*tn_dst;
char *dest=g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
+int src_len,dst_len;
gtk_widget_destroy(rename_win);
@@ -64,8 +65,10 @@ if(rename(oldname,dest)==-1)
tn_src=tn_dst=NULL;
/* ".xvpics/" is 8 chars */
-if((tn_src=malloc(8+strlen(oldname)+1))==NULL ||
- (tn_dst=malloc(8+strlen(dest)+1))==NULL)
+src_len=8+strlen(oldname)+1;
+dst_len=8+strlen(dest)+1;
+if((tn_src=malloc(src_len))==NULL ||
+ (tn_dst=malloc(dst_len))==NULL)
{
/* rename entry */
gtk_clist_set_text(GTK_CLIST(clist),current_row,SELECTOR_NAME_COL,dest);
@@ -74,10 +77,10 @@ if((tn_src=malloc(8+strlen(oldname)+1))=
return;
}
-strcpy(tn_src,".xvpics/");
-strcat(tn_src,oldname);
-strcpy(tn_dst,".xvpics/");
-strcat(tn_dst,dest);
+strlcpy(tn_src,".xvpics/",src_len);
+strlcat(tn_src,oldname,src_len);
+strlcpy(tn_dst,".xvpics/",dst_len);
+strlcat(tn_dst,dest,dst_len);
rename(tn_src,tn_dst); /* don't much care if it works or not */

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-src_resizepic_c,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- src/resizepic.c.orig Thu May 12 14:55:02 2005
+++ src/resizepic.c Thu May 12 14:55:09 2005
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "resizepic.h"

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-src_updatetn_c,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
--- src/updatetn.c.orig Tue Apr 10 05:47:00 2001
+++ src/updatetn.c Thu May 12 15:33:55 2005
@@ -168,8 +168,8 @@ datptr=gtk_clist_get_row_data(GTK_CLIST(
if(datptr->isdir || stat(ptr,&realpic)==-1 || *ptr=='.')
return(1);
-strcpy(buf,".xvpics/");
-strncat(buf,ptr,sizeof(buf)-8-2); /* above string is 8 chars long */
+strlcpy(buf,".xvpics/",sizeof(buf));
+strlcat(buf,ptr,sizeof(buf));
/* if not there, or pic is newer, or thumbnail is unreadable,
* make a thumbnail.

4
graphics/xzgv/pkg/DESCR Normal file
View File

@ -0,0 +1,4 @@
xzgv is a picture viewer for X, with a thumbnail-based file selector.
It uses GTK+ and Imlib. Most file formats are supported, and the
thumbnails used are compatible with xv, zgv, and the Gimp. It can also
be used with `xzgv file(s)', to effectively bypass the file selector.

4
graphics/xzgv/pkg/PLIST Normal file
View File

@ -0,0 +1,4 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2005/05/22 11:32:11 alek Exp $
bin/xzgv
@info info/xzgv.info
@man man/man1/xzgv.1