SYSLOG character device channel will now expand LF to CR-LF
This commit is contained in:
parent
8b922b1546
commit
91b82dcae3
@ -61,7 +61,8 @@
|
||||
|
||||
/* SYSLOG channel methods */
|
||||
|
||||
static int syslog_dev_force(int ch);
|
||||
static int syslog_devchan_putc(int ch);
|
||||
static int syslog_devchan_force(int ch);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -71,8 +72,8 @@ static int syslog_dev_force(int ch);
|
||||
|
||||
static const struct syslog_channel_s g_syslog_dev_channel =
|
||||
{
|
||||
syslog_dev_putc,
|
||||
syslog_dev_force,
|
||||
syslog_devchan_putc,
|
||||
syslog_devchan_force,
|
||||
syslog_dev_flush,
|
||||
};
|
||||
|
||||
@ -81,14 +82,44 @@ static const struct syslog_channel_s g_syslog_dev_channel =
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: syslog_dev_force
|
||||
* Name: syslog_devchan_putc
|
||||
*
|
||||
* Description:
|
||||
* A front-end to syslog_dev_putc that does LF -> CR-LF expansion
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int syslog_devchan_putc(int ch)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Check for a linefeed */
|
||||
|
||||
if (ch == '/n')
|
||||
{
|
||||
/* Pre-pend a carriage return */
|
||||
|
||||
ret = syslog_dev_putc('/r');
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* Output the provided character */
|
||||
|
||||
return syslog_dev_putc(ch);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: syslog_devchan_force
|
||||
*
|
||||
* Description:
|
||||
* A dummy FORCE method
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int syslog_dev_force(int ch)
|
||||
static int syslog_devchan_force(int ch)
|
||||
{
|
||||
return ch;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user