1DOLLY 72PACKAGE html3REQUIRES HOST runtime@04REQUIRES HOST html@056# The html@0 module's header and client, and the html command, which shows7# the user an HTML page or form in a popup of the page and prints the fields8# of the form they submit. cc links every client archive in9# /usr/lib/dolly/process; a program records html@0 when it calls the client.10FROM /v0.1.5/Dollyfile-system-build cf9cf053fb5debc080062e6e44c1b139175739f6158fa8a825b0255ba2063aee11REQUIRES HEADER libc12REQUIRES TOOL ar13REQUIRES TOOL cc14REQUIRES TOOL rm1516SOURCE /v0.1.5/host/html/html.h b5d3905d3cb6d70cb4b019f9f5c6375cb92ce241608ccaf02fc13278ebb08261 /usr/include/dolly/html.h17SOURCE /v0.1.5/host/html/html-abi.h ba5cbfcad4170d47d079b4221005994a051152ebf7db8cc011e18cdd6aff512b /usr/include/dolly/html-abi.h18SOURCE /v0.1.5/host/html/client.c 4c907d8a84cad64fc4e6433b057f4ac9a413e2454f20c7579129dc34c9afc202 /tmp/html/client.c19SLOP cc -O1 -c /tmp/html/client.c -o /tmp/html/client.o20SLOP ar rcs /usr/lib/dolly/process/libdolly-html.a /tmp/html/client.o2122EXPORTS HEADER html     /usr/include/dolly/html.h23EXPORTS HEADER html-abi /usr/include/dolly/html-abi.h24EXPORTS LIB    dolly-html /usr/lib/dolly/process/libdolly-html.a2526FILE /tmp/html/html.c27    #include <dolly/html.h>28    #include <errno.h>29    #include <stdio.h>30    #include <string.h>31    32    static const char usage[] =33        "usage: html [FILE]\n"34        "Shows FILE, or standard input, an HTML document of at most 1 MiB, in a popup\n"35        "of the page: its text, headings, lists, tables and forms, in the page's style.\n"36        "When the user submits a form, prints its fields on one line as a browser posts\n"37        "them (application/x-www-form-urlencoded) and exits 0; exits 1 when the user\n"38        "closes the popup, 2 on an error.\n";39    static char document[DOLLY_HTML_DOCUMENT_MAX + 1];40    static char fields[DOLLY_HTML_FIELDS_MAX];41    42    int main(int argc, char **argv) {43      if (argc == 2 && strcmp(argv[1], "--help") == 0) {44        fputs(usage, stdout);45        return 0;46      }47      if (argc > 2) {48        fputs(usage, stderr);49        return 2;50      }51      FILE *input = argc == 2 ? fopen(argv[1], "rb") : stdin;52      if (input == NULL) {53        fprintf(stderr, "html: %s: %s\n", argv[1], strerror(errno));54        return 2;55      }56      const size_t size = fread(document, 1, sizeof(document), input);57      if (ferror(input)) {58        fprintf(stderr, "html: %s\n", strerror(errno));59        return 2;60      }61      if (size == 0 || size > DOLLY_HTML_DOCUMENT_MAX) {62        fprintf(stderr, "html: the document is %s\n", size == 0 ? "empty" : "over 1 MiB");63        return 2;64      }65      const int result = dolly_html_show(document, size, fields, sizeof(fields));66      if (result == -ECANCELED) return 1;67      if (result < 0) {68        fprintf(stderr, "html: %s\n", strerror(-result));69        return 2;70      }71      printf("%.*s\n", result, fields);72      return 0;73    }74SLOP cc -O1 /tmp/html/html.c -o /usr/bin/html75EXPORTS TOOL html76SLOP html --help > /usr/share/man/cat1/html.177FILE /usr/share/man/cat1/html.178SLOP rm -rf /tmp/html79