title: C one-liner to split a string into lines, tolerating CR, LF, and CR+LF
body: <p>I was thinking today about how lame it is when programs don't tolerate the three major line break formats (CR, LF, CR+LF), and wondering why so many developers fail to tolerate files from other platforms.</p>
  <p>It's simple in JavaScript to split a string into lines regardless of CR, LF, or CR+LF:</p>
  <pre><code>text.split(/\r\n?|\n/mg)
  </code></pre>
  <p>But I was just thinking, maybe this is just difficult enough in other languages that programmers get lazy.  C comes to mind: is it even possible to do this split with a one-liner in C?  ANSI C has no builtin regex library AFAIK, so using a regex would be out of the question, and <code>strtok</code> only seems to support a static string delimiter.</p>
  <p>But I haven't written any C in a long time...maybe there's a one-liner way to do it that I'm not aware of?</p>
  <p>Or, perhaps there are some pitfalls to tolerating mixed line breaks like my above regex does?</p>