Import wmphoto 0.3a.

Submitted by Peter Stromberg <home@wilfried.net>.

It's a dock-app that can show you a photo and execute a command
related to that photo.  You can have many photos.
This commit is contained in:
naddy 2001-01-16 22:44:42 +00:00
parent 9212f4d76d
commit d07e33fec8
9 changed files with 280 additions and 0 deletions

25
graphics/wmphoto/Makefile Normal file
View File

@ -0,0 +1,25 @@
# $OpenBSD: Makefile,v 1.1.1.1 2001/01/16 22:44:42 naddy Exp $
DISTNAME= wmphoto-0.3a
CATEGORIES= graphics x11
NEED_VERSION= 1.340
HOMEPAGE= http://www.dcc.uchile.cl/~amartoq/wmphoto/
MASTER_SITES= ${HOMEPAGE}
MAINTAINER= Peter Stromberg <home@wilfried.net>
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
RUN_DEPENDS= convert::graphics/ImageMagick
USE_X11= Yes
WRKSRC= ${WRKDIST}/wmphoto
do-install:
${INSTALL_PROGRAM} ${WRKBUILD}/wmphoto ${PREFIX}/bin
${INSTALL_MAN} files/wmphoto.1 ${PREFIX}/man/man1
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
MD5 (wmphoto-0.3a.tar.gz) = 08f254d6812dd17377f4dd784f85f302
RMD160 (wmphoto-0.3a.tar.gz) = 64b0006b90d187ec01da32f1bc9b7607d19f4330
SHA1 (wmphoto-0.3a.tar.gz) = dbec1ddd49671bc915b6e9ce37462247557f7fb9

View File

@ -0,0 +1,110 @@
.\" $OpenBSD: wmphoto.1,v 1.1.1.1 2001/01/16 22:44:43 naddy Exp $
.Dd Oct 3, 1999
.Dt WMPHOTO 1
.Os
.Sh NAME
.Nm wmphoto
.Md show photo
.Sh SYNOPSIS
.Nm wmphoto
.Op Ar add image-file
.Sh Hints for wmphoto
Once you successfully get your first image (as shown later), the
mouse buttons are:
.br
1. exec 1st command for current photo.
.br
2. exec 2nd command for current photo.
.br
3. rescan ~/.wmphoto and get next photo.
.Sh How this works
wmphoto reads pictures and commands from the user directory ~/.wmphoto/.
A so called "profile" is a file having the extension ".xpm.gz".
Yes, this file is a xpm and gzipped picture that wmphoto displays
for you. This image MUST BE 48-width and 52-height sizes, and no more than
256 colors!
The commands for this photo are saved on a file with the name of
the profile (wihout the .xpm.gz extension). In this file, the first line
is the 1st command, and the second line is the 2nd command.
.Sh How to add a photo (the hard way)
Ask a friend for a photo of him/her. Once you have it, use a graphics
program (ex: gimp) for:
.br
1. scale the photo to 48x52.
.br
2. save it as xpm, no more than 256 colors.
.br
3. gzip it
Now copy your photo to the ~/.wmphoto/ directory, for example,
~/.wmphoto/john.xpm.gz. That's all! Now run wmphoto and john's picture will
appear.
If you want add more photos, do the same and save it with other name
(let's say ~/.wmphoto/sara.xpm.gz). Not need to close wmphoto! Just press
the 3rd Button mouse, and wmphoto will rescan the ~/.wmphoto directory and
show you the next photo.
.Sh How to setup your commands (the hard way)
Now you have both photos, create a file like this:
.br
~/.wmphoto/john
.br
xterm -e pine john@windowmaker.org
.br
xterm -e talk john@windowmaker.org
The first line is the command executed whe you click on the john's
picture. You can do the same for sara's photo.
Note that you must rescan ~/.wmphoto (just press 3rd button until
reappear john's photo) for changes to take effect.
.Sh How to make both things (the easy way, IMHO)
If you have a image named john.jpg (no matter the size, colors or
format), just do:
% wmphoto add /path/to/john.jpg
.br
Wmphoto will ask you a couple of questions now...
you *need* ImageMagick's `convert` program to do this!
Enter a name for this profile: john
.br
Command to run for button1? (ex: xterm -e pine amartoq@dcc.uchile.cl)
.br
xterm -e pine john@windowmaker.org
.br
Command to run for button2? (ex: xterm -e talk amartoq@dcc.uchile.cl)
.br
xterm -e talk john@windowmaker.org
Creating /your/home/directory/.wmphoto/john... good.
.br
Executing convert, this may take a while...
.br
convert -colors 255 -dither -geometry 48x52! /path/to/john.jpg xpm:/your/home/directory/.wmphoto/john.xpm.gz done.
.br
If you are already running wmphoto, just press the 3rd
button over it until appear your new photo.
To add a new photo, just run wmphoto this same way.
As you see, you need ImageMagick for this to work.

View File

@ -0,0 +1,38 @@
$OpenBSD: patch-wmphoto_Makefile,v 1.1.1.1 2001/01/16 22:44:43 naddy Exp $
--- wmphoto/Makefile.orig Mon Mar 15 05:58:03 1999
+++ wmphoto/Makefile Tue Jan 16 17:50:55 2001
@@ -1,12 +1,9 @@
# wmphoto Makefile
-# directory where to install it.
-INSTALL = /usr/local/bin
-
# RedHat Linux 5.2
-CC = gcc
-CCOPTIONS = -O2 -Wall
-LIBDIR = -L/usr/X11R6/lib
+CC ?= gcc
+CFLAGS+= -I${X11BASE}/include
+LIBDIR = -L${X11BASE}/lib
LIBS = -lXpm -lXext -lX11
# Slowlaris at my university
@@ -25,16 +22,10 @@ OBJS = $(APP).o \
all: $(APP)
.c.o:
- $(CC) -c $(CCOPTIONS) $< -o $*.o
+ $(CC) -c $(CFLAGS) $< -o $*.o
$(APP): $(OBJS)
- $(CC) -o $(APP) $^ $(LIBDIR) $(LIBS)
-
-install: $(APP)
- strip $(APP)
- cp $(APP) $(INSTALL)
- chown root.root $(APP)
- chmod 755 $(APP)
+ $(CC) -o $(APP) $(OBJS) $(LIBDIR) $(LIBS)
clean::
for i in $(OBJS) ; do \

View File

@ -0,0 +1,84 @@
$OpenBSD: patch-wmphoto_wmphoto_c,v 1.1.1.1 2001/01/16 22:44:43 naddy Exp $
--- wmphoto/wmphoto.c.orig Sun Oct 3 07:11:37 1999
+++ wmphoto/wmphoto.c Tue Jan 16 18:05:55 2001
@@ -34,7 +34,6 @@ char current[1024];
char home[1024];
-
int main(int argc, char **argv)
{
init_stuff(argc, argv);
@@ -49,7 +48,7 @@ int main(int argc, char **argv)
void init_stuff(int argc, char **argv)
{
/* get the user's home */
- sprintf(home,"%s/.wmphoto",getenv("HOME"));
+ snprintf(home,sizeof(home),"%s/.wmphoto",getenv("HOME"));
if (argc == 2)
{ show_usage(); }
@@ -194,7 +193,7 @@ void get_next_photo(char *current)
-int myselect(const struct dirent *d)
+int myselect(struct dirent *d)
{ char *name = d->d_name;
static int lenght;
static char *defExt = ".xpm.gz";
@@ -223,7 +222,7 @@ void load_photo(char *name)
mylenght = strlen(defExt);
- sprintf(current, "%s/%s", home, name);
+ snprintf(current, sizeof(current), "%s/%s", home, name);
lenght = strlen(current);
current[lenght - mylenght] = 0;
@@ -252,7 +251,7 @@ void load_photo(char *name)
status = XpmReadFileToPixmap(display, wmgen.pixmap, current, &mypixmap,
0, &xpmAttributes);
- strcpy(current, name);
+ strlcpy(current, name, sizeof(current));
if (status != XpmSuccess)
{ fprintf(stderr, "wmphoto (XpmError): %s\n",
XpmGetErrorString(status));
@@ -298,7 +297,8 @@ void add_photo(char *filename)
}
printf("good.\n\n");
}
- closedir(mydir);
+ else
+ closedir(mydir);
@@ -315,7 +315,7 @@ void add_photo(char *filename)
printf("Command to run for button2? (ex: xterm -e talk amartoq@cec.uchile.cl)\n");
fgets(command2, 1024, stdin);
- sprintf(current, "%s/%s", home, profile);
+ snprintf(current, sizeof(current), "%s/%s", home, profile);
printf("Creating %s... ", current);
myfile = fopen(current, "w");
@@ -329,7 +329,7 @@ void add_photo(char *filename)
fclose(myfile);
printf("good.\nExecuting convert, this may take a while...\n");
- sprintf(current, "convert -colors 255 -dither -geometry 48x52! %s xpm:%s/%s.xpm.gz", filename, home, profile);
+ snprintf(current, sizeof(current), "convert -colors 255 -dither -geometry 48x52! %s xpm:%s/%s.xpm.gz", filename, home, profile);
printf("%s ", current);
fflush(stdout);
@@ -345,7 +345,7 @@ void show_usage()
{
printf("[wmphoto %s] Copyright(C) 1999, by Aldrin Martoq A. (amartoq@cec.uchile.cl)\n", WMPHOTO_VERSION);
- printf("ussage:\nwmphoto\n\t Starts the wmphoto as dock app.\n\nwmphoto add <an_image_file>\n\t Add the photo <an_image_file> to your ~/.wmphoto directory interactivaly\n\t(Imagemagick's `convert` program needed).\n\n");
+ printf("usage:\nwmphoto\n\t Starts the wmphoto as dock app.\n\nwmphoto add <an_image_file>\n\t Add the photo <an_image_file> to your ~/.wmphoto directory interactivaly\n\t(Imagemagick's `convert` program needed).\n\n");
exit(0);
}

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-wmphoto_wmphoto_h,v 1.1.1.1 2001/01/16 22:44:43 naddy Exp $
--- wmphoto/wmphoto.h.orig Sat Mar 13 08:05:18 1999
+++ wmphoto/wmphoto.h Tue Jan 16 17:34:35 2001
@@ -30,7 +30,7 @@ void poner_marco();
void default_image();
void get_next_photo();
-int myselect(const struct dirent *d);
+int myselect(struct dirent *d);
void load_photo(char *name);
void myexecCommand(char *command);
void show_usage();

View File

@ -0,0 +1 @@
shows photos and execute commands related to that photo

View File

@ -0,0 +1,4 @@
It's a dock-app that can show you a photo and execute a command
related to that photo. You can have many photos.
WWW: ${HOMEPAGE}

View File

@ -0,0 +1,3 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2001/01/16 22:44:43 naddy Exp $
bin/wmphoto
man/man1/wmphoto.1