#include <iostream>
#include <fstream>
#include <string>
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
dummy-compile only tests its interface rather than its functionality.
./dummy-compile -h ./dummy-compile -o ${OUTPUT_NAME} ${INPUT_NAME} ./dummy-compile –target {TARGET_NAME} -o ${OUTPUT_NAME} ${INPUT_NAME}
NOTE argv[3](INPUT_NAME) is not used here.
Definition at line 31 of file dummy-compile.cpp.
32{
33 if (argc != 2 and argc != 4 and argc != 6)
34 return EXIT_FAILURE;
35
36 if (argc == 2)
37 {
38 std::string help_o{"-h"};
39 std::string argv_1{
argv[1]};
40 if (help_o != argv_1)
41 return EXIT_FAILURE;
42
43 std::cout << "HELP MESSAGE!!" << std::endl;
44 return EXIT_SUCCESS;
45 }
46 if (argc == 4)
47 {
48 std::string opt_o{"-o"};
49 std::string argv_1{
argv[1]};
50 if (opt_o != argv_1)
51 return EXIT_FAILURE;
52
53 std::string output_name{
argv[2]};
54 std::ofstream
outfile(output_name);
55 outfile <<
"dummy-compile dummy output!!" << std::endl;
57 }
58 if (argc == 6)
59 {
60 std::string opt_T{"--target"};
61 std::string argv_1{
argv[1]};
62 if (opt_T != argv_1)
63 return EXIT_FAILURE;
64 std::string target_name{
argv[2]};
65
66 std::string opt_o{"-o"};
67 std::string argv_3{
argv[3]};
68 if (opt_o != argv_3)
69 return EXIT_FAILURE;
70
71 std::string output_name{
argv[4]};
72 std::ofstream
outfile(output_name);
73 outfile <<
"dummy-compile with " << target_name <<
" target" << std::endl;
75 }
76
77 return EXIT_SUCCESS;
78}