| OLD | NEW |
| 1 // Copyright (c) 2014 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2014 The Native Client Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <assert.h> | 5 #include <assert.h> |
| 6 #include <spawn.h> | 6 #include <spawn.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 wrote_len = fwrite(data, 1, len, file); | 59 wrote_len = fwrite(data, 1, len, file); |
| 60 if (wrote_len != len) { | 60 if (wrote_len != len) { |
| 61 fprintf(stderr, "ERROR: Failed writting to: %s\n", filename); | 61 fprintf(stderr, "ERROR: Failed writting to: %s\n", filename); |
| 62 fclose(file); | 62 fclose(file); |
| 63 exit(1); | 63 exit(1); |
| 64 } | 64 } |
| 65 fclose(file); | 65 fclose(file); |
| 66 } | 66 } |
| 67 | 67 |
| 68 int nacl_main(int argc, char** argv) { | 68 int main(int argc, char** argv) { |
| 69 char* indata = 0; | 69 char* indata = 0; |
| 70 const char* cmd; | 70 const char* cmd; |
| 71 char* outdata; | 71 char* outdata; |
| 72 size_t outdata_len; | 72 size_t outdata_len; |
| 73 | 73 |
| 74 if ((argc != 3 && argc != 4) || | 74 if ((argc != 3 && argc != 4) || |
| 75 (strcmp(argv[1], "-f") != 0 && strcmp(argv[1], "-e") != 0)) { | 75 (strcmp(argv[1], "-f") != 0 && strcmp(argv[1], "-e") != 0)) { |
| 76 usage(); | 76 usage(); |
| 77 return 1; | 77 return 1; |
| 78 } | 78 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 90 } else { | 90 } else { |
| 91 jseval(cmd, NULL, NULL); | 91 jseval(cmd, NULL, NULL); |
| 92 } | 92 } |
| 93 | 93 |
| 94 if (strcmp(argv[1], "-f") == 0) { | 94 if (strcmp(argv[1], "-f") == 0) { |
| 95 free(indata); | 95 free(indata); |
| 96 } | 96 } |
| 97 | 97 |
| 98 return 0; | 98 return 0; |
| 99 } | 99 } |
| OLD | NEW |