#include <stdio.h>
#include <stdlib.h>
#include <string.h>

main(int argc, char** argv)
{ 
  /* replace "include" by "!include" */

  char buf[16][128];
  FILE *file;
  int n;
  int i;

  if (argc < 2)
  { fprintf(stderr,"usage: replinc 'file'");
    exit(1);
   }

  file = fopen(argv[1],"r");

  if (!file)
  { fprintf(stderr,"replinc: cannot open file '%s'",argv[1]);
    exit(1);
   }

  for(n = 0; n < 16 && fgets(buf[n],128,file); n++);
  fclose(file);

  file = fopen(argv[1],"w");
  for(i = 0; i < n; i++)
  { if (strncmp(buf[i],"include",7) == 0) putc('!',file);
    fputs(buf[i],file);
  }

  return 0;
}
