1: /*
   2: 	size -- determine object size
   3: 
   4: */
   5: 
   6: main(argc, argv)
   7: char **argv;
   8: {
   9:     int buf[010], f, ac, sum;
  10: 
  11:     ac = argc;
  12:     if (ac==1) {
  13:         *argv = "a.out";
  14:         ac++;
  15:         --argv;
  16:     }
  17:     while(--ac) {
  18:         ++argv;
  19:         if((f=open(*argv, 0))<0) {
  20:             printf("%s not found\n", *argv);
  21:             continue;
  22:         }
  23:         read(f, buf, 0020);
  24:         if(buf[0]!=0411 && buf[0]!=0410 && buf[0]!=0407) {
  25:             printf("Bad format: %s\n", *argv);
  26:             close(f);
  27:             continue;
  28:         }
  29:         if (argc>2)
  30:             printf("%s: ", *argv);
  31:         printf("%l+%l+%l=", buf[1],buf[2],buf[3]);
  32:         sum = buf[1]+buf[2]+buf[3];
  33:         printf("%l (%o)\n", sum, sum);
  34:         close(f);
  35:     }
  36: }

Defined functions

main defined in line 6; never used
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 502
Valid CSS Valid XHTML 1.0 Strict