Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/runtime/nhc98heap.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include <stdlib.h>
#include <stdio.h>
main(int argc, char **argv)
{
  int prefix = 1;
  int i = 0;
  char *s;
  if (argc==1) {
    i = 100000;
  } else if ((argc==2) && (*argv[1]=='T')) {
    i = 5 * 100000;
  } else {
    s = argv[argc-1];
    while(isdigit(*s)) {
      i = i*10 + *s++ - '0';
    }

    switch(*s) {
    case 'k': 
    case 'K': prefix *= 1000;    s++; break;
    case 'm':
    case 'M': prefix *=  1000000; s++; break;
    }

    switch(*s) {
      case 'b': case 'B': s++; i = i*prefix/sizeof(unsigned); break;
      case 'w': case 'W': s++; i = i*prefix; break;
      default: i = i*prefix/sizeof(unsigned); break;
    }
  }

  printf("int hpSize = %d;\n",i);
  exit(0);
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.