// Minimal compiler test for C compiler.
//
// Semantic mistakes like these are common enough that any compiler should produce warnings
// like those in the comments if it is to be used for more than "hello, world".

// Source: The book "The Pragmatic Programmer"

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

#define BUFSIZE 99

int
main (void)
{
  char buf1[BUFSIZE];
  char buf2[BUFSIZE];
  char buf3[BUFSIZE];
  char *p, *q;

  strcpy (buf1, "this is a test");
  strcpy (buf2, "this ainīt gonna work");
  p = strtok (buf1, " ");
  q = strtok (buf2, " ");       // warning: not thread save
  while (p && q)
  {
    sprintf (buf3, "%s %s\n", p, q);
    p = strtok (NULL, " ");
    q = strtok (NULL, " ");
  }
  return 0;
}
