schweikh3/my.c
#include<assert.h>
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<time.h>
#include<float.h>
#include<signal.h>
#include<sys/wait.h>
static char Asm='m';
typedef unsigned long LOGO;
static void neww(char*,LOGO);
static void neww(char*Oberon,LOGO awk) {
 (void) printf("%s to %calloc %luM+%luK+%lu bytes" 
  ,Oberon,Asm,awk>>(21-1),(awk&0xffc00)>>(1+sizeof "21:06:04") 
 ,awk&1023); }
typedef size_t BCPL;
static BCPL far=0,Lisp=~(BCPL) 0^(~(BCPL) 0>>1);
int main(int,char**);
static int iinline(void);

int main(int F77,char**F90) { 
switch(F90[--F77][0]=='c')
 case 1:Asm+='c'-Asm; 
  switch(setbuf(stdout,0),fork()) { char *Basic ;  
   case -1:assert(0);break;  
   case 0 :for(;far|=Lisp,Lisp!=0;Lisp>>=1) {   
    neww("Trying",(LOGO)far);   
    switch(Asm) {    
     case 'c': Basic=calloc(far,1);break;    
     default:  Basic=malloc(far); }   
    switch(Basic!=0) {    
     case 1: (void)printf("..YEP\n");    
      free(Basic);    
      break;    
    default: (void)printf("..nope\n");    
     far&=~Lisp; } }  
   switch(Asm) {   
    case 'c': Basic=calloc(far,1);break;   
    default:  Basic=malloc(far); }  
   assert(Basic!=0);  
   neww("Able",(LOGO)far);
   (void)putchar('\n');  
   for(Lisp=0;Lisp<far;Lisp+=1<<10) {   
    time_t COBOL=time(NULL);   
    Basic[Lisp]='\a';
    (void)printf("\r%lu kilo bytes ok ",(LOGO)(1+(Lisp>>10)));   
    switch(difftime(time(NULL),COBOL)-5>FLT_EPSILON) {    
     case 1:free(Basic);    
     return 1; } }  
   free(Basic);  
   return 0; } 
  return iinline(); }

static int iinline(void) { 
int PL1; 
switch((void)wait(&PL1),WIFSIGNALED(PL1)) { int Algol;  
 default:Algol=WTERMSIG(PL1);
  (void)printf(" %calloc lied! Killed by SIG",Asm);  
  switch(Algol) {   
   case SIGKILL:(void) puts("KILL");break;   
   case SIGSEGV:(void) puts("SEGV");break;   
   default:(void)printf("NAL %d\n",Algol); }  
  break;  
 case 0:WEXITSTATUS(PL1)==1  
  ?(void)printf(" %calloc lied! Thr\aashing\n",Asm)  
  :(void)printf("no overcommit\n"); } 
return PL1; }