Annotation of researchv9/sys/boot/stand/copy.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char sccsid[] = "@(#)copy.c     1.1 86/02/03    SMI"; /* From ancient history */
                      3: #endif
                      4: 
                      5: #define        BUFSIZ  (3*10*1024)     /* must be multiple of 10K, < 32K */
                      6: 
                      7: /*
                      8:  * Copy from to in large units.
                      9:  * Intended for use in bootstrap procedure.
                     10:  */
                     11: main()
                     12: {
                     13:        int from, to;
                     14:        char fbuf[50], tbuf[50];
                     15:        static char buffer[BUFSIZ];
                     16:        register int i;
                     17:        register int count = 0;
                     18: 
                     19:        printf("Standalone Copy\n");
                     20:        from = getdev("From", fbuf, 0);
                     21:        to = getdev("To", tbuf, 1);
                     22:        for (;;) {
                     23:                i = read(from, buffer, sizeof (buffer));
                     24:                if (i <= 0)
                     25:                        break;
                     26:                if (write(to, buffer, i) != i) {
                     27:                        printf("Write error\n");
                     28:                        break;
                     29:                }
                     30:                count += i;
                     31:        }
                     32:        if (i < 0)
                     33:                printf("Read error\n");
                     34:        printf("Copy completed - %d bytes\n", count);
                     35: }
                     36: 
                     37: getdev(prompt, buf, mode)
                     38:        char *prompt, *buf;
                     39:        int mode;
                     40: {
                     41:        register int i;
                     42: 
                     43:        do {
                     44:                printf("%s: ", prompt);
                     45:                gets(buf);
                     46:                i = open(buf, mode);
                     47:        } while (i <= 0);
                     48:        return (i);
                     49: }

unix.superglobalmegacorp.com

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