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: }

Defined functions

main defined in line 19; never used

Defined variables

tot defined in line 16; used 3 times

Defined macros

FILEOVERHEAD defined in line 14; used 1 times
  • in line 38
KITOVERHEAD defined in line 13; used 1 times
  • in line 38
MAXKIT defined in line 11; used 2 times
MAXKITSIZE defined in line 12; used 1 times
  • in line 38
Last modified: 1987-03-16
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2273
Valid CSS Valid XHTML 1.0 Strict