| 69 | } |
| 70 | |
| 71 | int main(int argc, char *argv[]) |
| 72 | { |
| 73 | int i; |
| 74 | bool verbose = false; |
| 75 | double start_time = 0.0; |
| 76 | |
| 77 | LASwriteOpener laswriteopener; |
| 78 | |
| 79 | if (argc == 1) |
| 80 | { |
| 81 | fprintf(stderr,"%s is better run in the command line\n", argv[0]); |
| 82 | char file_name[256]; |
| 83 | fprintf(stderr,"enter output file: "); fgets(file_name, 256, stdin); |
| 84 | file_name[strlen(file_name)-1] = '\0'; |
| 85 | laswriteopener.set_file_name(file_name); |
| 86 | } |
| 87 | else |
| 88 | { |
| 89 | laswriteopener.parse(argc, argv); |
| 90 | } |
| 91 | |
| 92 | for (i = 1; i < argc; i++) |
| 93 | { |
| 94 | if (argv[i][0] == '\0') |
| 95 | { |
| 96 | continue; |
| 97 | } |
| 98 | else if (strcmp(argv[i],"-h") == 0 || strcmp(argv[i],"-help") == 0) |
| 99 | { |
| 100 | usage(); |
| 101 | } |
| 102 | else if (strcmp(argv[i],"-v") == 0 || strcmp(argv[i],"-verbose") == 0) |
| 103 | { |
| 104 | verbose = true; |
| 105 | } |
| 106 | else if (i == argc - 1 && !laswriteopener.active()) |
| 107 | { |
| 108 | laswriteopener.set_file_name(argv[i]); |
| 109 | } |
| 110 | else |
| 111 | { |
| 112 | fprintf(stderr, "ERROR: cannot understand argument '%s'\n", argv[i]); |
| 113 | usage(); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | if (verbose) start_time = taketime(); |
| 118 | |
| 119 | // check output |
| 120 | |
| 121 | if (!laswriteopener.active()) |
| 122 | { |
| 123 | fprintf(stderr,"ERROR: no output specified\n"); |
| 124 | usage(argc == 1); |
| 125 | } |
| 126 | |
| 127 | // init header |
| 128 |
nothing calls this directly
no test coverage detected