1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #ifndef CONFIRM_SOURCE
- #define CONFIRM_SOURCE
- #include <stdio.h>
- #include <stdarg.h>
- #include "../plc/plc.h"
- #include "../tools/memory.h"
- #include "../tools/flags.h"
- #ifdef __GNUC__
- __attribute__ ((format (printf, 2, 3)))
- #endif
- void Confirm (struct plc * plc, char const * format, ...)
- {
- if (_allclr (plc->flags, PLC_SILENCE))
- {
- 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));
- fprintf (stderr, "%s %s ", channel->ifname, address);
- if ((format) && (* format))
- {
- va_list arglist;
- va_start (arglist, format);
- vfprintf (stderr, format, arglist);
- va_end (arglist);
- }
- fprintf (stderr, "\n");
- }
- return;
- }
- #endif
|