1DOLLY 72PACKAGE transfer3REQUIRES HOST runtime@04REQUIRES HOST download@05REQUIRES HOST upload@067# The page's file exchange: download offers a file of the session to the8# browser, upload takes one the user chooses.9FROM /v0.1.4/Dollyfile-system-build 7997c05ba08220831088b2aa713c86dbf0ded0229bbfa84f411476f00269d9fc10REQUIRES HEADER libc11REQUIRES HEADER download12REQUIRES HEADER upload13REQUIRES TOOL cc14REQUIRES TOOL rm1516FILE /tmp/download/download.c17    #include <stdio.h>18    #include <string.h>19    20    #include <dolly/download.h>21    22    int main(int argc, char **argv) {23      if (argc == 2 && strcmp(argv[1], "--help") == 0) {24        fputs("usage: download FILE\n", stdout);25        return 0;26      }27      if (argc != 2) {28        fputs("download: expected one file\n", stderr);29        return 2;30      }31      const int status = dolly_download_file(argv[1]);32      if (status != 0) {33        fprintf(stderr, "download: %s failed (%d)\n", argv[1], status);34        return 1;35      }36      printf("download: requested %s\n", argv[1]);37      return 0;38    }3940SLOP cc \41  /tmp/download/download.c \42  -o /bin/download4344EXPORTS TOOL download45SLOP download --help > /usr/share/man/cat1/download.14647FILE /tmp/upload/upload.c48    #include <dolly/upload.h>49    #include <stdio.h>50    #include <stdlib.h>51    #include <string.h>52    int main(int argc, char **argv) {53      if (argc != 2 || strcmp(argv[1], "--help") == 0) {54        fprintf(argc == 2 ? stdout : stderr, "usage: upload DESTINATION\nChoose a file in the browser (up to %u MiB). Existing files are never replaced.\n",55                DOLLY_UPLOAD_MAX_SIZE >> 20);56        return argc == 2 ? 0 : 2;57      }58      puts("upload: choose a file in the browser, or cancel");59      fflush(stdout);60      const int result = dolly_upload_file(argv[1]);61      if (result < 0) { fprintf(stderr, "upload: %s\n", strerror((int)-result)); return 1; }62      printf("upload: saved %s\n", argv[1]);63      return 0;64    }65SLOP cc -O1 /tmp/upload/upload.c -o /bin/upload66EXPORTS TOOL upload67SLOP upload --help > /usr/share/man/cat1/upload.16869FILE /usr/share/man/cat1/download.170FILE /usr/share/man/cat1/upload.171SLOP rm -rf /tmp/download /tmp/upload72