logoalt Hacker News

jjuel • today at 7:39 PM • 1 reply • view on HN

I just really wish it had some examples of code in there to get a better idea of what is really going on. It sounds interesting.


Replies

tomcam • today at 8:42 PM

They use this framework: https://learnbchs.org

Their example is:

    #include <err.h> /* err(3) */
    #include <stdlib.h> /* EXIT_xxxx */
    #include <stdio.h> /* puts(3) */
    #include <unistd.h> /* pledge(2) */ 
    int main(void)
    {
      if (pledge("stdio", NULL) == -1) 
        err(EXIT_FAILURE, "pledge");
        puts("Status: 200 OK\r");
        puts("Content-Type: text/html\r");
        puts("\r");
        puts("Hello, world!\n");
        return EXIT_SUCCESS;
      }