[comp.os.vms] Files to/from vax/3b1

gil@limbic.UUCP (Gil Kloepfer Jr.) (02/15/89)

In article <319@flatline.UUCP> erict@flatline.UUCP (j eric townsend) writes:
>From the vax to the 3b1.
>Use kermit.  From local, do "set file type binary".  This kicks kermit
>into an 8bit mode that will handle compressed files just fine.

It handles compressed files from FTP well (I guess), but not from VMS
compress. As I promised, I did look into the problem and it seems that
with VMS files in STREAM_LF mode, kermit sends a <cr><lf> instead of just
a <lf>, messing up some files.

Here's what you need to convert the STREAM_LF mode file to a "regular
old" VMS file which will send via kermit properly.  PLEASE!  No flames
on the program, it was purposely quick and dirty!  Also note that it
will only work under VMS C ;-)

--------------->8 Snip here  -----------------------------------------------

#include <stdio.h>
#include <unixio.h>
#include <file.h>

char *inpfile = "stream_lf.z";
char *outfile = "block_mode.z";

main()
{
      FILE      *ifp, *fopen();
      int       ofd, count;
      unsigned char block[512];

      if ((ifp=fopen(inpfile,"r")) == NULL) {
            perror(inpfile);
            exit(1);
      }

      ofd=creat(outfile,0600,"rfm=var","mrs=512");
      if (ofd <= 0) {
            perror(outfile);
            exit(1);
      }

      count=0;
      while(feof(ifp) == 0) {
            if (count == 512) {
                  write(ofd,block,512);
                  count=0;
            }
            block[count]=(unsigned char)fgetc(ifp);
            count++;
      }

      if (count != 0)
            write(ofd,block,count);

      close(ofd);
      fclose(ifp);
}

--------------->8 Snip here  -----------------------------------------------

>Other suggestions:
>Gil Kloepfer and Lenny Tropiano (I think) both suggested that
>I get it onto a MS-DOS floppy at the Vax site (if all else failed).  Luckily,
>I didn't have to resort to this.  I doubt the UofH site administrators would
>want to bother with a few xfers like this every day or so. :-)

(No, Lenny didn't this time ;-)   I agree, the MS-DOS floppy is a pain in
the ascii to do, and won't always work (and you need DECnet-DOS too...).
With the above program, I was able to transfer my compressed files just
fine!

-------------
Gil Kloepfer, Jr.          U-Net: {decuac,boulder,talcott,sbcs}!icus!limbic!gil
ICUS Software Systems      Voice: (516) 968-6860 [H]   (516) 746-2350 x219 [W]
P.O. Box 1                 Internet:  gil@icus.islp.ny.us
Islip Terrace, NY  11752   "Life's a ...  well, you know..."