home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Distributions / ucb / spencer_2bsd.tar.gz / 2bsd.tar / src / net / store.c < prev    next >
C/C++ Source or Header  |  1980-02-17  |  744b  |  38 lines

  1. /* Copyright (c) 1979 Regents of the University of California */
  2. # include "defs.h"
  3. main(argc,argv)
  4.   char **argv; {
  5.     FILE *fp;
  6.     int buf[BFS], n;
  7.     long work;
  8.     char str[50];
  9.     char ifile[20],ofile[20];
  10.     printf("from file: ");
  11.     fflush(stdout);
  12.     gets(ifile,stdout);
  13.     printf("to file: ");
  14.     fflush(stdout);
  15.     gets(ofile,stdout);
  16.     fp = fopen(ifile,"r");
  17.     if(fp == NULL){
  18.         perror(ifile);
  19.         exit(1);
  20.         }
  21.     debugflg = DBV;
  22.     setupdaemon(argc,argv);
  23.     strcpy(str,ofile);
  24.     strcat(str,"                             ");
  25.     sendreset();
  26.     xwrite(str,1,20);
  27.     if(stat(ifile,&statbuf) < 0){
  28.         perror(ifile);
  29.         exit(1);
  30.         }
  31.     work = getsize(&statbuf);
  32.     work = fixuplong(work);
  33.     xwrite(&work,1,4);
  34.     while((n = fread(buf,1,512,fp)) > 0)
  35.         xwrite(buf,1,n);
  36.     fclose(fp);
  37.     }
  38.