Return-Path: sun!mail.mmmg.com!us267388
Return-Path: <sun!mail.mmmg.com!us267388>
Received: by objy27. (5.57/SMI-4.0)
	id AA12983; Sat, 18 Jan 92 11:25:53 -0800
Received: from sun.UUCP by objy.com (4.1/SMI-4.0)
	id AA19066; Sat, 18 Jan 92 11:22:48 PST
Received: from Sun.COM (sun-barr) by sun.Eng.Sun.COM (4.1/SMI-4.1)
	id AA10491; Sat, 18 Jan 92 11:06:05 PST
Received: from sentry.mmmg.com by Sun.COM (4.1/SMI-4.1)
	id AA19444; Sat, 18 Jan 92 11:06:53 PST
Received: by sentry.mmmg.com (4.0/SMI-4.1/PTR-BDR 1.3)
	id AA05729; Sat, 18 Jan 92 13:05:42 CST
Date: Sat, 18 Jan 92 13:05:42 CST
From: sun!mail.mmmg.com!us267388 (Bradley D. Rhoades)
Message-Id: <9201181905.AA05729@sentry.mmmg.com>
To: sun!objy!objy27!ricks
Subject: Re: Xrn 6.17 alpha patches for artImage - Display image contained in article. 
In-Reply-To: Mail from '"Rick L. Spickelmier" <objy!objy27!ricks@Sun.COM>'
      dated: Tue, 31 Dec 91 18:30:27 PST
Cc: xrn-users-request@eros.berkeley.edu

> 
> Sure, send the patches.  I'll put them in the next release.
> 
> 		Rick

	Rick,

	The image display capability is quite limited so I will describe
	it briefly.  It works nice for a local controlled campus
	environment since you can educate everyone of its limitations,
	but it does work.  

	First of all the Display Image function is a simple duplication
	of the Print Function modified to call an external Shell Script
	that decodes the uuencoded article and then calls the
	appropriate image display application.  It requires that the
	entire encoded image is contained in a single article otherwise
	uudecode will complain and fail.  There are several other little
	minor oddities, but they would be best explained when you try it
	out.

	This work took me about 35 minutes plus compilation, etc... and
	is a quick solution to something that could easily be added to
	Xrn.  (By the way, Xrn is a very well written program, and I
	really like it a lot!!)  I plan to spend a little time to write
	an Include Image (or better yet, Include File - an executable,
	image, dbm, etc... file) and prototype it just as I did with the
	Display Image function.  Once we can come up with a good idea
	for the interface and desired functionality we can go back and
	design the Include/Encode Image and Decode Image functions so
	that they are more generic and can be a preferred part of the 
	Xrn application.

	Anyway, I have included the patches for xrn 6.17 and the sample
	"decodeimage" shell script in a shar archive.  Apply the patches,
	rebuild xrn, make sure you have the decodeimage shell script
	in your path and that the permissions are correct.  Look at the
	script to see what image display application you want to preview
	images with.  I use xv and that is what it is setup as by
	default.  I have not added any comments or anything to the
	program or anything yet.  I can do that after you take a look at
	this stuff and see what you think.

	Good-luck,

	Send me a note if you have any problems.

	Brad Rhoades

-- cut here --

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  decodeimage decodeimage.xrn6.17.patch.1
# Wrapped by us267388@mmc on Sat Jan 18 13:00:44 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'decodeimage' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'decodeimage'\"
else
echo shar: Extracting \"'decodeimage'\" \(954 characters\)
sed "s/^X//" >'decodeimage' <<'END_OF_FILE'
X#!/bin/sh 
X#
X# SCCSID = "@(#)decodeimage	1.1	1/18/92"; BDRhoades
X#
X# Filename:			mmc:/usr/bin/X11/decodeimage
X# Author:			BDRhoades@mmc.mmmg.com
X# Original Date:		Sat Jan 18 12:56:00 CST 1992
X# Purpose:
X# 	This simple shell script is called by the "Display Image"
X# button of the Xrn 6.17 modified News Reader.  The program simply
X# calls uudecode on the file and then invokes the users preferred
X# image display program on the decoded file.  
X#
X# NOTE: since uudecode/encode have special file formats, headers, 
X# and delimeters the image being attempted for display must be in 
X# a single NetNews/USENET article.
X#
X#
X
XPID=$$
XDIR=/tmp/
XXBIN=/usr/bin/X11
XFILENAME=$PID.uu
X
Xcd $DIR
Xcat - >  $FILENAME
XREALNAME=`grep "^begin " $FILENAME | awk '{print $3}'`
X
Xmv $FILENAME $REALNAME.uu
X
Xuudecode $REALNAME.uu
X
X#
X#	The name/path of the image display program
X#
X# $XBIN/xshowgif $REALNAME
X# $XBIN/xli $REALNAME
X$XBIN/xv $REALNAME
X
Xrm $REALNAME.uu
Xrm $REALNAME
X
END_OF_FILE
if test 954 -ne `wc -c <'decodeimage'`; then
    echo shar: \"'decodeimage'\" unpacked with wrong size!
fi
chmod +x 'decodeimage'
# end of 'decodeimage'
fi
if test -f 'decodeimage.xrn6.17.patch.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'decodeimage.xrn6.17.patch.1'\"
else
echo shar: Extracting \"'decodeimage.xrn6.17.patch.1'\" \(7921 characters\)
sed "s/^X//" >'decodeimage.xrn6.17.patch.1' <<'END_OF_FILE'
X*** ../XRn.ad6.17	Mon Dec 23 15:53:26 1991
X--- ../XRn.ad	Mon Dec 23 16:22:29 1991
X***************
X*** 1,4 ****
X! XRn.version:			6.17
X  *Geometry:			+0+0
X  XRn.Geometry:			680x800
X  *font:			8x13
X--- 1,4 ----
X! XRn.version:			6.17+Image
X  *Geometry:			+0+0
X  XRn.Geometry:			680x800
X  *font:			8x13
X***************
X*** 175,180 ****
X--- 175,181 ----
X  *artRot13.label:              Rot-13
X  *artHeader.label:             Toggle header
X  *artPrint.label:              Print
X+ *artImage.label:              Display Image
X  
X  *Information.pane.label.showGrip:	False
X  *Information.pane.text.showGrip:	False
X*** ../buttons.c6.17	Mon Dec 23 15:53:26 1991
X--- ../buttons.c	Mon Dec 23 16:38:11 1991
X***************
X*** 958,963 ****
X--- 958,964 ----
X  BUTTON(artRot13,rot-13)
X  BUTTON(artHeader,toggle header)
X  BUTTON(artPrint,print)
X+ BUTTON(artImage,image)
X  
X  static void doTheRightThing(); 
X  static XtActionsRec TopActions[] = {
X***************
X*** 1032,1037 ****
X--- 1033,1039 ----
X      {"artRot13",	artRot13Action},
X      {"artHeader",	artHeaderAction},
X      {"artPrint",	artPrintAction},
X+     {"artImage",	artImageAction},
X      {"artGripe",	artGripeAction},
X      {"artListOld",	artListOldAction},
X  };
X***************
X*** 1245,1250 ****
X--- 1247,1254 ----
X     "Display the complete/stripped header"},
X      {artPrintArgs, XtNumber(artPrintArgs),
X     "Print the article"},
X+     {artImageArgs, XtNumber(artImageArgs),
X+    "Display article image"},
X  #endif /* lint */
X  };
X  
X***************
X*** 5977,5982 ****
X--- 5981,6033 ----
X      if(saveCurrentArticle(buffer)) 
X      {
X  	SubjectString[ArtPosition+1] = 'P';
X+ 	XawTextInvalidate(Text, ArtPosition, ArtPosition + 2);
X+ 	SET_PRINTED(newsgroup->articles[INDEX(art)]);
X+     }
X+ #endif /* VMS */
X+ 
X+     return;
X+ }
X+ 
X+ /*ARGSUSED*/
X+ static void
X+ artImageFunction(widget)
X+ Widget widget;
X+ {
X+     char buffer[1024];
X+     struct newsgroup *newsgroup = Newsrc[CurrentGroupNumber];
X+     art_num art = newsgroup->current;
X+ #ifdef VMS
X+     int status;
X+     short msglen;
X+     struct dsc$descriptor_s buf_desc = { sizeof(buffer)-1,
X+ 	DSC$K_DTYPE_T, DSC$K_CLASS_S, buffer };
X+ 
X+     (void) sprintf(buffer, "%sARTICLE-%u.LIS", app_resources.tmpDir,
X+ 	CurrentArticle);
X+     if (saveCurrentArticle(buffer))
X+     {
X+ 	(void) sprintf(buffer, "%s %sARTICLE-%u.LIS",
X+ 	    app_resources.imageCommand, app_resources.tmpDir,
X+ 	    CurrentArticle);
X+ 	status = system(buffer);
X+ 	if (status & 1) {
X+ 	    info("Article sucessfully decoded and displayed");
X+ 	    SubjectString[ArtPosition+1] = 'I';
X+ 	    XawTextInvalidate(Text, ArtPosition, ArtPosition + 2);
X+ 	    SET_PRINTED(newsgroup->articles[INDEX(art)]);
X+ 	} else {
X+ 	    status = SYS$GETMSG(status, &msglen, &buf_desc, 0, 0);
X+ 	    buffer[msglen] = NULL;
X+ 	    info(buffer);
X+ 	}
X+     }
X+ 
X+ #else /* Not VMS */
X+     (void) sprintf(buffer, "| %s", app_resources.imageCommand);
X+     if(saveCurrentArticle(buffer)) 
X+     {
X+ 	SubjectString[ArtPosition+1] = 'I';
X  	XawTextInvalidate(Text, ArtPosition, ArtPosition + 2);
X  	SET_PRINTED(newsgroup->articles[INDEX(art)]);
X      }
X*** ../config.h6.17	Mon Dec 23 15:38:40 1991
X--- ../config.h	Mon Dec 23 16:09:05 1991
X***************
X*** 367,372 ****
X--- 367,384 ----
X  #endif
X  #endif
X  
X+ /*
X+  * Decode and Display single article Image Files
X+  */
X+ #ifndef IMAGECOMMAND
X+ #ifndef VMS
X+ #define IMAGECOMMAND	"decodeimage"
X+ #else
X+ #define IMAGECOMMAND	"DECODEIMAGE"
X+ #endif
X+ #endif
X+ 
X+ 
X  #ifndef SENDMAIL
X  #ifndef VMS
X  #define SENDMAIL       "/usr/lib/sendmail -oi -t"
XNo differences encountered
X*** ../resources.c6.17	Mon Dec 23 15:53:27 1991
X--- ../resources.c	Mon Dec 23 16:09:58 1991
X***************
X*** 174,179 ****
X--- 174,181 ----
X  #define XtCPageArticles	  "PageArticles"
X  #define XtNprintCommand	  "printCommand"
X  #define XtCPrintCommand	  "PrintCommand"
X+ #define XtNimageCommand	  "imageCommand"
X+ #define XtCImageCommand	  "ImageCommand"
X  
X  #define XtNdumpCore	"dumpCore"
X  #define XtCDebug	"Debug"
X***************
X*** 414,419 ****
X--- 416,424 ----
X     {XtNprintCommand, XtCPrintCommand, XtRString, sizeof(char *),
X        XtOffset(app_res,printCommand), XtRString, (caddr_t) PRINTCOMMAND},
X  
X+    {XtNimageCommand, XtCImageCommand, XtRString, sizeof(char *),
X+       XtOffset(app_res,imageCommand), XtRString, (caddr_t) IMAGECOMMAND},
X+ 
X     {XtNdumpCore, XtCDebug, XtRBoolean, sizeof(Boolean),
X        XtOffset(app_res,dumpCore), XtRBoolean, (caddr_t)
X  #ifdef DUMPCORE
X***************
X*** 525,530 ****
X--- 530,536 ----
X      {"-pageArticles",	XtNpageArticles,   XrmoptionNoArg,   (caddr_t) "off"},
X      {"+pageArticles",	XtNpageArticles,   XrmoptionNoArg,   (caddr_t) "on"},
X      {"-printCommand",   XtNprintCommand,   XrmoptionSepArg,  (caddr_t) NULL},
X+     {"-imageCommand",   XtNimageCommand,   XrmoptionSepArg,  (caddr_t) NULL},
X      {"-distribution",   XtNdistribution,   XrmoptionSepArg,  (caddr_t) NULL},
X      {"-dumpCore",	XtNdumpCore,	   XrmoptionNoArg,   (caddr_t) "off"},
X      {"+dumpCore",	XtNdumpCore,	   XrmoptionNoArg,   (caddr_t) "on"},
X***************
X*** 620,625 ****
X--- 626,632 ----
X      {"-pagearticles",	XtNpageArticles,   XrmoptionNoArg,   (caddr_t) "off"},
X      {"+pagearticles",	XtNpageArticles,   XrmoptionNoArg,   (caddr_t) "on"},
X      {"-printcommand",   XtNprintCommand,   XrmoptionSepArg,  (caddr_t) NULL},
X+     {"-imageCommand",   XtNimageCommand,   XrmoptionSepArg,  (caddr_t) NULL},
X      {"-distribution",   XtNdistribution,   XrmoptionSepArg,  (caddr_t) NULL},
X      {"-dumpcore",	XtNdumpCore,	   XrmoptionNoArg,   (caddr_t) "off"},
X      {"+dumpcore",	XtNdumpCore,	   XrmoptionNoArg,   (caddr_t) "on"},
X***************
X*** 724,729 ****
X--- 731,737 ----
X      printf("\t-allBindings\t\tAll mode bindings\n");
X      printf("\t+/-pageArticles\t\tSpacebar scrolls the current article\n");
X      printf("\t-printCommand\t\tCommand to use to print out an article\n");
X+     printf("\t-imageCommand\t\tCommand to use to display image contained in article\n");
X      printf("\t-distribution\t\tDefault distribution for messages\n");
X  #ifdef DUMPCORE
X      printf("\t+/-dumpCore\t\tDump core on error exit\n");
X*** ../resources.h6.17	Mon Dec 23 15:53:27 1991
X--- ../resources.h	Mon Dec 23 16:10:25 1991
X***************
X*** 108,113 ****
X--- 108,114 ----
X      char *artButtonList;
X      char *artSpecButtonList;
X      char *printCommand;
X+     char *imageCommand;
X      char *ngBindings;
X      char *allBindings;
X      char *addBindings;
X*** ../xrn.h6.17	Mon Dec 23 15:53:27 1991
X--- ../xrn.h	Mon Dec 23 16:12:36 1991
X***************
X*** 31,37 ****
X   */
X  
X  #ifndef MOTIF
X! #define XRN_VERSION "6.17"
X  #else
X  #define XRN_VERSION "6.17 (Motif)"
X  #endif
X--- 31,37 ----
X   */
X  
X  #ifndef MOTIF
X! #define XRN_VERSION "6.17+Image"
X  #else
X  #define XRN_VERSION "6.17 (Motif)"
X  #endif
X*** ../xrn.man6.17	Mon Dec 23 15:53:27 1991
X--- ../xrn.man	Mon Dec 23 16:12:53 1991
X***************
X*** 58,63 ****
X--- 58,64 ----
X  [-organization org]
X  [+/-pageArticles]
X  [-printCommand command]
X+ [-imageCommand command]
X  [-replyTo name]
X  [-rescanTime time]
X  [+/-resetSave]
X***************
X*** 664,669 ****
X--- 665,673 ----
X  .IP "print article (artPrint)"
X  Send the article to the printer (see the `printCommand' command
X  line option).
X+ .IP "display image contained in article (artImage)"
X+ Decode image from article and display it (see the `imageCommand' command
X+ line option).
X  
X  .SH CUSTOMIZING XRN
X  .PP
X***************
X*** 880,885 ****
X--- 884,894 ----
X  Set the command used for printing articles.  The article is sent
X  to the command via standard input.
X  Defaults to `enscript -g'.
X+ .TP 10
X+ .B -imageCommand command
X+ Set the command used for decoding and displaying images contained in
X+  articles.  The article is sent to the command via standard input.
X+ Defaults to `xvdecode'.
X  .TP 10
X  .B -replyTo name
X  Set the Reply-To field for articles and mail messages.
END_OF_FILE
if test 7921 -ne `wc -c <'decodeimage.xrn6.17.patch.1'`; then
    echo shar: \"'decodeimage.xrn6.17.patch.1'\" unpacked with wrong size!
fi
# end of 'decodeimage.xrn6.17.patch.1'
fi
echo shar: End of shell archive.
exit 0
-- cut here --

Bradley D. Rhoades	          E/Mail: bdrhoades@mmc.mmmg.com
3M, 2465 Lexington Ave So         NIC: BR79
Building 60-1N-01                 WRK: +1 (612) 736 2874
Mendota Heights, MN  55120        FAX: +1 (612) 736-0431

