summaryrefslogtreecommitdiff
path: root/tools/smtradfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/smtradfile.c')
-rw-r--r--tools/smtradfile.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/tools/smtradfile.c b/tools/smtradfile.c
index 5484f7b..35072aa 100644
--- a/tools/smtradfile.c
+++ b/tools/smtradfile.c
@@ -9,24 +9,23 @@
*
* File begun on 2010-06-01 by RGerhards
*
- * Copyright 2010 Rainer Gerhards and Adiscon GmbH.
+ * Copyright 2010-2014 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of rsyslog.
*
- * Rsyslog is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Rsyslog is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>.
- *
- * A copy of the GPL can be found in the file "COPYING" in this distribution.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * -or-
+ * see COPYING.ASL20 in the source distribution
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#include "config.h"
#include "rsyslog.h"
@@ -83,28 +82,30 @@ CODESTARTstrgen
++lenTotal; /* then we need to introduce one additional space */
/* now make sure buffer is large enough */
- if(lenTotal >= *pLenBuf)
- CHKiRet(ExtendBuf(ppBuf, pLenBuf, lenTotal));
+ if(lenTotal >= iparam->lenBuf)
+ CHKiRet(ExtendBuf(iparam, lenTotal));
/* and concatenate the resulting string */
- memcpy(*ppBuf, pTimeStamp, CONST_LEN_TIMESTAMP_3164);
- *(*ppBuf + CONST_LEN_TIMESTAMP_3164) = ' ';
+ memcpy(iparam->param, pTimeStamp, CONST_LEN_TIMESTAMP_3164);
+ iparam->param[CONST_LEN_TIMESTAMP_3164] = ' ';
- memcpy(*ppBuf + CONST_LEN_TIMESTAMP_3164 + 1, pHOSTNAME, lenHOSTNAME);
+ memcpy(iparam->param + CONST_LEN_TIMESTAMP_3164 + 1, pHOSTNAME, lenHOSTNAME);
iBuf = CONST_LEN_TIMESTAMP_3164 + 1 + lenHOSTNAME;
- *(*ppBuf + iBuf++) = ' ';
+ iparam->param[iBuf++] = ' ';
- memcpy(*ppBuf + iBuf, pTAG, lenTAG);
+ memcpy(iparam->param + iBuf, pTAG, lenTAG);
iBuf += lenTAG;
if(pMSG[0] != ' ')
- *(*ppBuf + iBuf++) = ' ';
- memcpy(*ppBuf + iBuf, pMSG, lenMSG);
+ iparam->param[iBuf++] = ' ';
+ memcpy(iparam->param + iBuf, pMSG, lenMSG);
iBuf += lenMSG;
/* trailer */
- *(*ppBuf + iBuf++) = '\n';
- *(*ppBuf + iBuf) = '\0';
+ iparam->param[iBuf++] = '\n';
+ iparam->param[iBuf] = '\0';
+
+ iparam->lenStr = lenTotal - 1; /* do not count \0! */
finalize_it:
ENDstrgen