* with this program; see the file COPYING; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
char client_buf[32];
csv_record_t *rec1;
- sprintf(msglen_buf, "%4u", msglen);
- sprintf(vers_buf, "%4u", version);
- sprintf(type_buf, "%4u", type);
- sprintf(cmdid_buf, "%4u", cmd_id);
+ sprintf(msglen_buf, "%4d", msglen);
+ sprintf(vers_buf, "%4d", version);
+ sprintf(type_buf, "%4d", type);
+ sprintf(cmdid_buf, "%4d", cmd_id);
snprintf(client_buf, 17, "%16.16s", client_name);
if (rec) {
rec1 = csv_encode_record(csv, rec, 5, msglen_buf, vers_buf,
}
/* remove leading spaces */
for (i = j = 0; i < csv_field_len(fld); i++) {
- if (!isspace(hdr[i])) {
+ if (!isspace((unsigned char)hdr[i])) {
client_name[j] = hdr[i];
j++;
}
return 0;
}
+int ptm_lib_cleanup_msg(ptm_lib_handle_t *hdl, void *ctxt)
+{
+ ptm_lib_msg_ctxt_t *p_ctxt = ctxt;
+ csv_t *csv;
+
+ if (!p_ctxt) {
+ ERRLOG("%s: no context \n", __FUNCTION__);
+ return -1;
+ }
+
+ csv = p_ctxt->csv;
+
+ csv_clean(csv);
+ csv_free(csv);
+ free(p_ctxt);
+
+ return 0;
+}
+
int ptm_lib_complete_msg(ptm_lib_handle_t *hdl, void *ctxt, char *buf, int *len)
{
ptm_lib_msg_ctxt_t *p_ctxt = ctxt;
{
int rc, len;
char client_name[32];
- int cmd_id, type, ver, msglen;
+ int cmd_id = 0, type = 0, ver = 0, msglen = 0;
csv_t *csv;
ptm_lib_msg_ctxt_t *p_ctxt = NULL;