Annotation of 41BSD/cmd/berknet/store.c, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.