| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #define __STDC_FORMAT_MACROS | 7 #define __STDC_FORMAT_MACROS |
| 8 | 8 |
| 9 #include <errno.h> | 9 #include <errno.h> |
| 10 #include <fcntl.h> | 10 #include <fcntl.h> |
| 11 #include <inttypes.h> | 11 #include <inttypes.h> |
| 12 #include <stdio.h> | 12 #include <stdio.h> |
| 13 #include <string.h> | 13 #include <string.h> |
| 14 #include <unistd.h> | 14 #include <unistd.h> |
| 15 | 15 |
| 16 #include "nacl_main.h" | |
| 17 | |
| 18 #include "ppapi_simple/ps.h" | 16 #include "ppapi_simple/ps.h" |
| 19 | 17 |
| 20 #include "ppapi/c/pp_errors.h" | 18 #include "ppapi/c/pp_errors.h" |
| 21 #include "ppapi/cpp/completion_callback.h" | 19 #include "ppapi/cpp/completion_callback.h" |
| 22 #include "ppapi/cpp/instance_handle.h" | 20 #include "ppapi/cpp/instance_handle.h" |
| 23 #include "ppapi/cpp/module.h" | 21 #include "ppapi/cpp/module.h" |
| 24 #include "ppapi/cpp/url_loader.h" | 22 #include "ppapi/cpp/url_loader.h" |
| 25 #include "ppapi/cpp/url_request_info.h" | 23 #include "ppapi/cpp/url_request_info.h" |
| 26 #include "ppapi/cpp/url_response_info.h" | 24 #include "ppapi/cpp/url_response_info.h" |
| 27 | 25 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 return 0; | 117 return 0; |
| 120 | 118 |
| 121 fail: | 119 fail: |
| 122 result = remove(dst); | 120 result = remove(dst); |
| 123 if (result < 0) { | 121 if (result < 0) { |
| 124 fprintf(stderr, "ERROR: Failed removing file (%d): %s\n", errno, dst); | 122 fprintf(stderr, "ERROR: Failed removing file (%d): %s\n", errno, dst); |
| 125 } | 123 } |
| 126 return 1; | 124 return 1; |
| 127 } | 125 } |
| 128 | 126 |
| 129 int nacl_main(int argc, char *argv[]) { | 127 int main(int argc, char *argv[]) { |
| 130 if (argc == 4 && strcmp(argv[1], "-q") == 0) { | 128 if (argc == 4 && strcmp(argv[1], "-q") == 0) { |
| 131 return Download(1, argv[2], argv[3]); | 129 return Download(1, argv[2], argv[3]); |
| 132 } else if (argc == 3) { | 130 } else if (argc == 3) { |
| 133 return Download(0, argv[1], argv[2]); | 131 return Download(0, argv[1], argv[2]); |
| 134 } | 132 } |
| 135 fprintf(stderr, "USAGE: %s [-q] <url> <dst>\n", argv[0]); | 133 fprintf(stderr, "USAGE: %s [-q] <url> <dst>\n", argv[0]); |
| 136 fprintf(stderr, "\n"); | 134 fprintf(stderr, "\n"); |
| 137 fprintf(stderr, "-q = quiet mode\n"); | 135 fprintf(stderr, "-q = quiet mode\n"); |
| 138 fprintf(stderr, "\n"); | 136 fprintf(stderr, "\n"); |
| 139 fprintf(stderr, "NOTE: This utility can only be used to download URLs\n"); | 137 fprintf(stderr, "NOTE: This utility can only be used to download URLs\n"); |
| 140 fprintf(stderr, "from the same origin or that have been whitelisted\n"); | 138 fprintf(stderr, "from the same origin or that have been whitelisted\n"); |
| 141 fprintf(stderr, "in an extension manifest\n"); | 139 fprintf(stderr, "in an extension manifest\n"); |
| 142 return 1; | 140 return 1; |
| 143 } | 141 } |
| OLD | NEW |