MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxReadNetworkBuffer

Function fxReadNetworkBuffer

tools/serial2xsbug/serial2xsbug.c:501–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499}
500
501void fxReadNetworkBuffer(txSerialMachine machine, char* buffer, int size)
502{
503 if (!machine->suppress) {
504 txSerialTool self = machine->tool;
505 char* former = buffer;
506 char* current = buffer;
507 char* limit = buffer + size;
508 int offset;
509 while (current < limit) {
510 offset = current - former;
511 if ((offset >= 3) && (current[-3] == 13) && (current[-2] == 10) && (current[-1] == '<')) {
512 fxWriteSerial(self, former, offset);
513 fxWriteSerial(self, machine->tag, mxTagSize);
514 former = current;
515 }
516 current++;
517 }
518 offset = limit - former;
519 if (offset) {
520 static char* logout = "logout/>\r\n";
521 static int c = 10;
522 fxWriteSerial(self, former, offset);
523 if (offset >= c) {
524 int i;
525 for (i = 0; i < c; i++) {
526 if (former[i] != logout[i])
527 break;
528 }
529 if (i == c) {
530 exit(0);
531 }
532 }
533 }
534 }
535}
536
537void fxReadSerialBuffer(txSerialTool self, char* buffer, int size)
538{

Callers 3

fxReadNetworkFunction · 0.85
fxReadNetworkFunction · 0.85
fxReadNetworkFunction · 0.85

Calls 1

fxWriteSerialFunction · 0.70

Tested by

no test coverage detected