Annotation of 43BSDReno/sys/stand/docopy.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1988 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution is only permitted until one year after the first shipment
        !             6:  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
        !             7:  * binary forms are permitted provided that: (1) source distributions retain
        !             8:  * this entire copyright notice and comment, and (2) distributions including
        !             9:  * binaries display the following acknowledgement:  This product includes
        !            10:  * software developed by the University of California, Berkeley and its
        !            11:  * contributors'' in the documentation or other materials provided with the
        !            12:  * distribution and in all advertising materials mentioning features or use
        !            13:  * of this software.  Neither the name of the University nor the names of
        !            14:  * its contributors may be used to endorse or promote products derived from
        !            15:  * this software without specific prior written permission.
        !            16:  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            17:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            18:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            19:  *
        !            20:  *     @(#)docopy.c    7.3 (Berkeley) 6/28/90
        !            21:  */
        !            22: 
        !            23: #define        SIZE    10240
        !            24: 
        !            25: docopy(from, to, nrecs)
        !            26:        register int from, to, nrecs;
        !            27: {
        !            28:        register int record, rcc, wcc;
        !            29:        char buf[SIZE];
        !            30: 
        !            31:        for (record = 0;;) {
        !            32:                if (!(rcc = read(from, buffer, SIZE)))
        !            33:                        break;
        !            34:                if (rcc < 0) {
        !            35:                        printf("Record %d: read error, errno=%d\n",
        !            36:                            record, errno);
        !            37:                        break;
        !            38:                }
        !            39:                if (rcc < SIZE)
        !            40:                        printf("Record %d: read short; expected %d, got %d\n",
        !            41:                            record, SIZE, rcc);
        !            42: #ifdef vax
        !            43:                /* For bug in ht driver. */
        !            44:                if (rcc > SIZE)
        !            45:                        rcc = SIZE;
        !            46: #endif
        !            47:                if ((wcc = write(to, buffer, rcc)) < 0) {
        !            48:                        printf("Record %d: write error: errno=%d\n",
        !            49:                            record, errno);
        !            50:                        break;
        !            51:                }
        !            52:                if (wcc < rcc) {
        !            53:                        printf("Record %d: write short; expected %d, got %d\n",
        !            54:                            record, rcc, wcc);
        !            55:                        break;
        !            56:                }
        !            57:                if (nrecs > 0 && ++record == nrecs)
        !            58:                        break;
        !            59:        }
        !            60:        printf("copy completed: %d records copied\n", record);
        !            61: }

unix.superglobalmegacorp.com

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