Home | History | Annotate | Download | only in wasm-tests
      1 // This is derived from the loop in musl's __fwritex that looks for newlines.
      2 
      3 int puts(const char *s);
      4 
      5 int main(int argc, const char **argv) {
      6   const char *p = (const char *)argv;
      7   char *s = "Hello\nWorld";
      8   unsigned i = 0;
      9   // Depend on argc to avoid having this whole thing get dead-code-eliminated.
     10   for (i = 14 - argc; i && p[i - 1] != '\n'; i--)
     11     ;
     12   puts(s);
     13   return i;
     14 }
     15