1
0

pseudo_llvm-rc.c 680 B

123456789101112131415161718192021222324252627282930
  1. #include <stdio.h>
  2. #include <string.h>
  3. int main(int argc, char* argv[])
  4. {
  5. FILE* source;
  6. FILE* target;
  7. int i;
  8. for (i = 1; i < argc; ++i) {
  9. if (strcmp(argv[i], "-bad") == 0) {
  10. fprintf(stdout, "stdout from bad command line arg '-bad'\n");
  11. fprintf(stderr, "stderr from bad command line arg '-bad'\n");
  12. return 1;
  13. }
  14. }
  15. source = fopen(argv[argc - 1], "rb");
  16. if (source == NULL) {
  17. return 1;
  18. }
  19. target = fopen(argv[argc - 2], "wb");
  20. if (target != NULL) {
  21. char buffer[500];
  22. size_t n = fread(buffer, 1, sizeof(buffer), source);
  23. fwrite(buffer, 1, n, target);
  24. fclose(source);
  25. fclose(target);
  26. return 0;
  27. }
  28. return 1;
  29. }