1: static char sccsid[] = "@(#)store.c	4.1	(Berkeley)	10/2/82";
   2: 
   3: /*
   4: 	store.c
   5: 
   6: 	send a file to the program "receive.c"
   7: */
   8: # include "defs.h"
   9: main(argc,argv)
  10:   char **argv; {
  11:     FILE *fp;
  12:     int buf[BUFSIZ], n;
  13:     long work;
  14:     char str[50];
  15:     char ifile[20],ofile[20];
  16:     struct stat statbuf;
  17: 
  18:     printf("from file: ");
  19:     fflush(stdout);
  20:     gets(ifile,stdout);
  21:     printf("to file: ");
  22:     fflush(stdout);
  23:     gets(ofile,stdout);
  24:     fp = fopen(ifile,"r");
  25:     if(fp == NULL){
  26:         perror(ifile);
  27:         exit(1);
  28:         }
  29:     debugflg = 1;
  30:     setupdaemon(argc,argv);
  31:     strcpy(str,ofile);
  32:     initseqno();
  33:     strcat(str,"                             ");
  34:     xwrite(str,20);
  35:     if(stat(ifile,&statbuf) < 0){
  36:         perror(ifile);
  37:         exit(1);
  38:         }
  39:     work = getsize(&statbuf);
  40:     sprintf(buf, "|%08ld|", work);
  41:     xwrite(buf,10);
  42:     while((n = fread(buf,1,BUFSIZ,fp)) > 0)
  43:         xwrite(buf,n);
  44:     fclose(fp);
  45:     }

Defined functions

main defined in line 9; never used

Defined variables

sccsid defined in line 1; never used
Last modified: 1982-10-03
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1007
Valid CSS Valid XHTML 1.0 Strict