Files
VCCPlusOSS/platforms/macos/Tests/Fixtures/ManualC/flightreport.c
T

34 lines
1.1 KiB
C

// SPDX-License-Identifier: GPL-3.0-or-later
// Send a text report through the CoCo printer port. No disk file is needed.
#include <coco.h>
#include <vcc/printer.h>
static int printLanding(unsigned visit, const char *planet, const char *observation)
{
/* Two digits for the visit, a five-character field for the planet. */
return vcc_printer_printf("%02u %-5s %s\n", visit, planet, observation);
}
int main(void)
{
cls(1);
printf("FLIGHT CONTROL\n");
printf("START CAPTURE IN PRINTER OUTPUT\n");
printf("PRESS SPACE TO SEND REPORT\n");
while (waitkey(0) != ' ') {}
/* Ordinary printf still goes to the screen. These four lines go to the port. */
if (vcc_printer_printf("TP-10 FLIGHT REPORT\n") < 0 ||
printLanding(1, "EARTH", "BLUE SEA") < 0 ||
printLanding(2, "MARS", "RED RIDGE") < 0 ||
vcc_printer_printf("END OF REPORT\n") < 0)
{
printf("REPORT FORMAT ERROR\n");
return 1;
}
/* The guest cannot tell whether the Mac is capturing the port. */
printf("REPORT SENT TO PRINTER PORT\n");
return 0;
}