| 434 | } |
| 435 | |
| 436 | static void doCreate(int argc, const char* argv[]) |
| 437 | { |
| 438 | if (argc < 3) |
| 439 | syntax(); |
| 440 | |
| 441 | file.open(argv[1], std::ios::out | std::ios::binary | std::ios::trunc); |
| 442 | if (!file.is_open()) |
| 443 | error("cannot open output file '{}'", argv[1]); |
| 444 | |
| 445 | file.seekp(SECTOR_COUNT * SECTOR_SIZE - 1, std::ifstream::beg); |
| 446 | file.put(0); |
| 447 | |
| 448 | for (int i = 2; i < argc; i++) |
| 449 | insertFile(argv[i]); |
| 450 | |
| 451 | writeDirectory(); |
| 452 | writeAllocationTable(); |
| 453 | checkConsistency(); |
| 454 | |
| 455 | file.close(); |
| 456 | } |
| 457 | |
| 458 | static void doExtract(int argc, const char* argv[]) |
| 459 | { |
no test coverage detected