123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #ifndef DISPLAY_SOURCE
- #define DISPLAY_SOURCE
- #include <stdio.h>
- #include <stdarg.h>
- #include "../plc/plc.h"
- #include "../tools/memory.h"
- #ifdef __GNUC__
- __attribute__ ((format (printf, 2, 3)))
- #endif
- void Display (struct plc * plc, char const *format, ...)
- {
- char address [ETHER_ADDR_LEN * 3];
- struct channel * channel = (struct channel *)(plc->channel);
- struct message * message = (struct message *)(plc->message);
- hexdecode (message->ethernet.OSA, sizeof (message->ethernet.OSA), address, sizeof (address));
- printf ("%s %s ", channel->ifname, address);
- if ((format) && (*format))
- {
- va_list arglist;
- va_start (arglist, format);
- vprintf (format, arglist);
- va_end (arglist);
- }
- printf ("\n");
- return;
- }
- #endif
|