Annotation of 43BSDTahoe/new/rn/kitlists.c, revision 1.1

1.1     ! root        1: /* $Header: kitlists.c,v 4.3 85/05/01 11:42:08 lwall Exp $
        !             2:  *
        !             3:  * $Log:       kitlists.c,v $
        !             4:  * Revision 4.3  85/05/01  11:42:08  lwall
        !             5:  * Baseline for release with 4.3bsd.
        !             6:  * 
        !             7:  */
        !             8: 
        !             9: #include <stdio.h>
        !            10: 
        !            11: #define MAXKIT 100
        !            12: #define MAXKITSIZE 63000
        !            13: #define KITOVERHEAD 700
        !            14: #define FILEOVERHEAD 80
        !            15: 
        !            16: long tot[MAXKIT];
        !            17: FILE *outfp[MAXKIT];           /* of course, not this many file descriptors */
        !            18: 
        !            19: main(argc,argv)
        !            20: int argc;
        !            21: char **argv;
        !            22: {
        !            23:     FILE *inp, *popen();
        !            24:     char buf[1024], filnam[128];
        !            25:     char *index();
        !            26:     register char *s;
        !            27:     register int i, newtot;
        !            28:     
        !            29:     sprintf(buf,"\
        !            30: ls -l `awk '{print $1}' <%s'` | awk '{print $8 \" \" $4}' | sort +1nr\
        !            31: ", argc > 1 ? argv[1] : "MANIFEST.new");
        !            32:     inp = popen(buf,"r");
        !            33: 
        !            34:     while (fgets(buf,1024,inp) != Nullch) {
        !            35:        s = index(buf,' ');
        !            36:        *s++ = '\0';
        !            37:        for (i=1;
        !            38:          (newtot = tot[i] + atol(s) + FILEOVERHEAD) > MAXKITSIZE-KITOVERHEAD;
        !            39:          i++) 
        !            40:            ;
        !            41:        if (!tot[i]) {
        !            42:            sprintf(filnam,"kit%d.list",i);
        !            43:            outfp[i] = fopen(filnam,"w");
        !            44:        }
        !            45:        tot[i] = newtot;
        !            46:        printf("Adding %s to kit %d giving %d bytes\n",buf,i,newtot);
        !            47:        fprintf(outfp[i],"%s\n",buf);
        !            48:     }
        !            49: }

unix.superglobalmegacorp.com

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