mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
Merge pull request #333 from DrDoof/feat/syslog-hostname-port
syslog: send a hostname, allow a port other than 514, and stop the save from dropping the address
This commit is contained in:
8 files changed
+112
-14
No files matched your search
@@ -282,6 +282,32 @@ void itoa(uint8_t v)
|
||||
}
|
||||
|
||||
|
||||
/* Same as itoa(), one decade wider: enough for a port number. Kept separate
|
||||
* rather than widening itoa() itself, because every existing caller passes a
|
||||
* byte and would start paying for 16-bit divisions it does not need. */
|
||||
void itoa_short(uint16_t v)
|
||||
{
|
||||
uint8_t t = v / 10000;
|
||||
uint8_t print_zeros = t;
|
||||
|
||||
if (print_zeros)
|
||||
write_char('0' + t);
|
||||
t = (v / 1000) % 10;
|
||||
print_zeros |= t;
|
||||
if (print_zeros)
|
||||
write_char('0' + t);
|
||||
t = (v / 100) % 10;
|
||||
print_zeros |= t;
|
||||
if (print_zeros)
|
||||
write_char('0' + t);
|
||||
t = (v / 10) % 10;
|
||||
print_zeros |= t;
|
||||
if (print_zeros)
|
||||
write_char('0' + t);
|
||||
write_char('0' + (v % 10));
|
||||
}
|
||||
|
||||
|
||||
void print_string(__code char *p)
|
||||
{
|
||||
while (*p)
|
||||
|
||||
Reference in new issue
Block a user