MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / main

Function main

tools/brother240tool.cc:28–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28int main(int argc, const char* argv[])
29{
30 try
31 {
32 if (argc < 2)
33 syntax();
34
35 inputFile.open(
36 argv[1], std::ios::in | std::ios::out | std::ios::binary);
37 if (!inputFile.is_open())
38 error("cannot open input file '{}'", argv[1]);
39
40 uint8_t b1 = getbyte(0x015);
41 uint8_t b2 = getbyte(0x100);
42 if ((b1 == 0x58) && (b2 == 0x58))
43 {
44 std::cerr << "Flipping from Brother to DOS.\n";
45 putbyte(0x015, 0xf0);
46 putbyte(0x100, 0xf0);
47 }
48 else if ((b1 == 0xf0) && (b2 == 0xf0))
49 {
50 std::cerr << "Flipping from DOS to Brother.\n";
51 putbyte(0x015, 0x58);
52 putbyte(0x100, 0x58);
53 }
54 else
55 error("Unknown image format.");
56
57 inputFile.close();
58 return 0;
59 }
60 catch (const ErrorException& e)
61 {
62 e.print();
63 exit(1);
64 }
65}

Callers

nothing calls this directly

Calls 7

errorFunction · 0.85
getbyteFunction · 0.85
putbyteFunction · 0.85
openMethod · 0.80
printMethod · 0.80
syntaxFunction · 0.70
closeMethod · 0.45

Tested by

no test coverage detected