X-NEWS: msuvx2 vmsnet.misc: 1713
Relay-Version: VMS News - V6.1 26/02/93 VAX/VMS A5.5-2; site msuvx2.memst.edu
Path: nntp.memst.edu!cs.utk.edu!emory!europa.eng.gtefsd.com!howland.reston.ans.net!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!hobbes.physics.uiowa.edu!dyson
Newsgroups: vmsnet.sources.d,vmsnet.misc
Subject: Semi-unofficial VMS patch for XV (v3.00)
Message-ID: <C7Bw8D.D3p@space.physics.uiowa.edu>
From: dyson@sunfish.physics.uiowa.edu (Richard L. Dyson)
Date: Thu, 20 May 1993 14:00:13 GMT
Reply-To: dyson@sunfish.Physics.UIowa.EDU
Sender: news@space.physics.uiowa.edu
Followup-To: vmsnet.sources.d
Organization: Department of Physics & Astronomy
Keywords: XV
Nntp-Posting-Host: sunfish.physics.uiowa.edu
Lines: 424
Xref: msuvx2 vmsnet.sources.d:1266 vmsnet.misc:1713

Because it has been requested by several VMS users of XV, I have pulled
together a tiny patch to the source code to allow reading image files
that don't have "conventional" VMS file formats.  In particular, if you
use DEC's PATHWORKS to transfer files to your VAX, it usually creates a
file with a STREAM record format.  As shipped, XV only reads files with
a STREAM_LF or "binary" (i.e., fixed length 512-byte record) format.

If you have the Unix-like PATCH utilitiy, you can apply this diff file,
otherwise it should be easy to do it manually.  The fix is to change all
the fopen() calls by the loading routines to have an additional
parameter of:
                "ctx=stm"
When John Bradley gets back from his vacation and sorts through all his
mail backlog, I'm sure there will be an official update patch to address
a few other system specific items.  There might even be some general
changes as well.  In the mean time, if you are having trouble reading
some files, this might help.  I would suggest you keep the unmodified
originals.  In the event of an "official" patch, they will be relative
to these.

Regards,
Rick Dyson
-- 
Richard L. Dyson              INTERNET:  dyson@sunfish.Physics.UIowa.EDU
 _   _      _____    Graduate Research Assistant        O: 319/335--1879
| | | |    |_   _|   Department of Physics & Astronomy  H: 319/338--6117
| | | | of   | |     Van Allen Hall                  SPAN: IOWASP::DYSON
| \_/ |     _| |_    University of Iowa               or :   7231::DYSON
 \___/     |_____|   Iowa City, IA 52242
----------8<------------cut here---------------8<-------------------------------
*** xvbmp-orig.c
--- xvbmp.c
**************
*** 121,126
    pic8 = pic24 = (byte *) NULL;
    bname = BaseName(fname);
  
    fp=fopen(fname,"r");
    if (!fp) return (bmpError(bname, "couldn't open file"));
    
--- 121,127 -----
    pic8 = pic24 = (byte *) NULL;
    bname = BaseName(fname);
  
+ #ifndef VMS
    fp=fopen(fname,"r");
  #else
    fp=fopen(fname,"r", "ctx=stm");
**************
*** 122,127
    bname = BaseName(fname);
  
    fp=fopen(fname,"r");
    if (!fp) return (bmpError(bname, "couldn't open file"));
    
    fseek(fp, 0L, 2);      /* figure out the file size */
--- 123,131 -----
  
  #ifndef VMS
    fp=fopen(fname,"r");
+ #else
+   fp=fopen(fname,"r", "ctx=stm");
+ #endif
    if (!fp) return (bmpError(bname, "couldn't open file"));
    
    fseek(fp, 0L, 2);      /* figure out the file size */
*** xvgif-orig.c
--- xvgif.c
**************
*** 172,177
    pinfo->comment = (char *) NULL;
  
    bname = BaseName(fname);
    fp = fopen(fname,"r");
    if (!fp) return ( gifError(pinfo, "can't open file") );
  
--- 172,178 -----
    pinfo->comment = (char *) NULL;
  
    bname = BaseName(fname);
+ #ifndef VMS
    fp = fopen(fname,"r");
  #else
    fp = fopen(fname,"r", "ctx=stm");
**************
*** 173,178
  
    bname = BaseName(fname);
    fp = fopen(fname,"r");
    if (!fp) return ( gifError(pinfo, "can't open file") );
  
  
--- 174,182 -----
    bname = BaseName(fname);
  #ifndef VMS
    fp = fopen(fname,"r");
+ #else
+   fp = fopen(fname,"r", "ctx=stm");
+ #endif
    if (!fp) return ( gifError(pinfo, "can't open file") );
  
  
*** xviris-orig.c
--- xviris.c
**************
*** 185,190
    bname = BaseName(fname);
  
    /* open the file */
    fp = fopen(fname, "r");
    if (!fp) return(irisError(bname, "can't open file"));
  
--- 185,191 -----
    bname = BaseName(fname);
  
    /* open the file */
+ #ifndef VMS
    fp = fopen(fname, "r");
  #else
    fp = fopen(fname, "r", "ctx=stm");
**************
*** 186,191
  
    /* open the file */
    fp = fopen(fname, "r");
    if (!fp) return(irisError(bname, "can't open file"));
  
    /* figure out the file size */
--- 187,195 -----
    /* open the file */
  #ifndef VMS
    fp = fopen(fname, "r");
+ #else
+   fp = fopen(fname, "r", "ctx=stm");
+ #endif
    if (!fp) return(irisError(bname, "can't open file"));
  
    /* figure out the file size */
*** xvpbm-orig.c
--- xvpbm.c
**************
*** 112,117
  
  
    /* open the file */
    fp=fopen(fname,"r");
    if (!fp) return (pbmError(bname, "can't open file"));
  
--- 112,118 -----
  
  
    /* open the file */
+ #ifndef VMS
    fp=fopen(fname,"r");
  #else
    fp=fopen(fname,"r", "ctx=stm");
**************
*** 113,118
  
    /* open the file */
    fp=fopen(fname,"r");
    if (!fp) return (pbmError(bname, "can't open file"));
  
    /* compute file length */
--- 114,122 -----
    /* open the file */
  #ifndef VMS
    fp=fopen(fname,"r");
+ #else
+   fp=fopen(fname,"r", "ctx=stm");
+ #endif
    if (!fp) return (pbmError(bname, "can't open file"));
  
    /* compute file length */
*** xvpcx-orig.c
--- xvpcx.c
**************
*** 116,121
    bname = BaseName(fname);
  
    /* open the stream */
    fp=fopen(fname,"r");
    if (!fp) return (pcxError(bname, "unable to open file"));
    
--- 116,122 -----
    bname = BaseName(fname);
  
    /* open the stream */
+ #ifndef VMS
    fp=fopen(fname,"r");
  #else
    fp=fopen(fname,"r","ctx=stm");
**************
*** 117,122
  
    /* open the stream */
    fp=fopen(fname,"r");
    if (!fp) return (pcxError(bname, "unable to open file"));
    
  
--- 118,126 -----
    /* open the stream */
  #ifndef VMS
    fp=fopen(fname,"r");
+ #else
+   fp=fopen(fname,"r","ctx=stm");
+ #endif
    if (!fp) return (pcxError(bname, "unable to open file"));
    
  
*** xvpds-orig.c
--- xvpds.c
**************
*** 311,316
       image, since that's what the Voyager cd's have, or even a 2kx2k, since
       some of the Magellan images from Ames are that size */
  
    zf=fopen(fname,"r");
    if (!zf) {
      SetISTR(ISTR_WARNING,"LoadPDS: can't open %s\n",fname);
--- 311,317 -----
       image, since that's what the Voyager cd's have, or even a 2kx2k, since
       some of the Magellan images from Ames are that size */
  
+ #ifndef VMS
    zf=fopen(fname,"r");
  #else
    zf=fopen(fname,"r","ctx=stm");
**************
*** 312,317
       some of the Magellan images from Ames are that size */
  
    zf=fopen(fname,"r");
    if (!zf) {
      SetISTR(ISTR_WARNING,"LoadPDS: can't open %s\n",fname);
      return 0;
--- 313,321 -----
  
  #ifndef VMS
    zf=fopen(fname,"r");
+ #else
+   zf=fopen(fname,"r","ctx=stm");
+ #endif
    if (!zf) {
      SetISTR(ISTR_WARNING,"LoadPDS: can't open %s\n",fname);
      return 0;
*** xvpm-orig.c
--- xvpm.c
**************
*** 97,102
    pinfo->comment = (char *) NULL;
  
  
    fp=fopen(fname,"r");
    if (!fp) return( pmError(bname, "unable to open file") );
  
--- 97,103 -----
    pinfo->comment = (char *) NULL;
  
  
+ #ifndef VMS
    fp=fopen(fname,"r");
  #else
    fp=fopen(fname,"r","ctx=stm");
**************
*** 98,103
  
  
    fp=fopen(fname,"r");
    if (!fp) return( pmError(bname, "unable to open file") );
  
    /* read in the pmpic struct, one byte at a time */
--- 99,107 -----
  
  #ifndef VMS
    fp=fopen(fname,"r");
+ #else
+   fp=fopen(fname,"r","ctx=stm");
+ #endif
    if (!fp) return( pmError(bname, "unable to open file") );
  
    /* read in the pmpic struct, one byte at a time */
*** xvrle-orig.c
--- xvrle.c
**************
*** 106,111
    bname = BaseName(fname);
  
    /* open the stream */
    fp=fopen(fname,"r");
    if (!fp) return (rleError(bname, "unable to open file"));
    
--- 106,112 -----
    bname = BaseName(fname);
  
    /* open the stream */
+ #ifndef VMS
    fp=fopen(fname,"r");
  #else
    fp=fopen(fname,"r","ctx=stm");
**************
*** 107,112
  
    /* open the stream */
    fp=fopen(fname,"r");
    if (!fp) return (rleError(bname, "unable to open file"));
    
  
--- 108,116 -----
    /* open the stream */
  #ifndef VMS
    fp=fopen(fname,"r");
+ #else
+   fp=fopen(fname,"r","ctx=stm");
+ #endif
    if (!fp) return (rleError(bname, "unable to open file"));
    
  
*** xvsunras-orig.c
--- xvsunras.c
**************
*** 70,75
    bname = BaseName(fname);
  
    /* read in the Sun Rasterfile picture */
    fp=fopen(fname,"r");
    if (!fp) return( sunRasError(bname, "unable to open file") );
  
--- 70,76 -----
    bname = BaseName(fname);
  
    /* read in the Sun Rasterfile picture */
+ #ifndef VMS
    fp=fopen(fname,"r");
  #else
    fp=fopen(fname,"r","ctx=stm");
**************
*** 71,76
  
    /* read in the Sun Rasterfile picture */
    fp=fopen(fname,"r");
    if (!fp) return( sunRasError(bname, "unable to open file") );
  
    read_sun_long (&sunheader.ras_magic	 , fp);
--- 72,80 -----
    /* read in the Sun Rasterfile picture */
  #ifndef VMS
    fp=fopen(fname,"r");
+ #else
+   fp=fopen(fname,"r","ctx=stm");
+ #endif
    if (!fp) return( sunRasError(bname, "unable to open file") );
  
    read_sun_long (&sunheader.ras_magic	 , fp);
*** xvxbm-orig.c
--- xvxbm.c
**************
*** 99,104
    k = 0;
  
    bname = BaseName(fname);
    fp=fopen(fname,"r");
    if (!fp) return (xbmError(bname, "couldn't open file"));
  
--- 99,105 -----
    k = 0;
  
    bname = BaseName(fname);
+ #ifndef VMS
    fp=fopen(fname,"r");
  #else
    fp=fopen(fname,"r","ctx=stm");
**************
*** 100,105
  
    bname = BaseName(fname);
    fp=fopen(fname,"r");
    if (!fp) return (xbmError(bname, "couldn't open file"));
  
    fseek(fp, 0L, 2);
--- 101,109 -----
    bname = BaseName(fname);
  #ifndef VMS
    fp=fopen(fname,"r");
+ #else
+   fp=fopen(fname,"r","ctx=stm");
+ #endif
    if (!fp) return (xbmError(bname, "couldn't open file"));
  
    fseek(fp, 0L, 2);
*** xv-orig.c
--- xv.c
**************
*** 3828,3833
  
        else {  /* look in $HOME/.Xdefaults-machinename */
  	char hname[128];
  	gethostname(hname, 128);
  	hname[127] = '\0';
  
--- 3828,3834 -----
  
        else {  /* look in $HOME/.Xdefaults-machinename */
  	char hname[128];
+ #ifndef VMS
  	gethostname(hname, 128);
  #endif
  	hname[127] = '\0';
**************
*** 3829,3834
        else {  /* look in $HOME/.Xdefaults-machinename */
  	char hname[128];
  	gethostname(hname, 128);
  	hname[127] = '\0';
  
  	sprintf(foo, "%s/.Xdefaults-%s", homedir, hname);
--- 3830,3836 -----
  	char hname[128];
  #ifndef VMS
  	gethostname(hname, 128);
+ #endif
  	hname[127] = '\0';
  
  	sprintf(foo, "%s/.Xdefaults-%s", homedir, hname);