From c2f9ce9c4b65ee53cd0c070895833215185061f3 Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Tue, 19 Sep 2017 13:49:04 +0100 Subject: New line bug fix, /b 5 --- Makefile | 3 ++- agni.c | 6 ++++-- cmd/cmd_botu.c | 2 +- cmd/cmd_cmd.c | 2 +- cmd/cmd_cookie.c | 2 +- cmd/cmd_date.c | 2 +- cmd/cmd_fir.c | 2 +- cmd/cmd_fir1p.c | 2 +- cmd/cmd_loadavg.c | 2 +- cmd/cmd_rand_libc.c | 2 +- cmd/cmd_rusage.c | 2 +- cmd/cmd_sha1.c | 2 +- cmd/cmd_spi.c | 8 ++++---- cmd/cmd_uptime.c | 2 +- cmd/cmd_version.c | 2 +- extlibs/nbrpc.c | 16 ++++++++-------- 16 files changed, 30 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 56687e7..ae7e0c2 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ all: createcmd createextlib $(OBJECTS) $(PROJECT) $(PROJECT): version $(SOURCES) agni.c $(CC) $(OBJECTS) $(CFLAGS) $(LDFLAGS) -std=c11 -o $(PROJECT) + #objdump -S $(PROJECT) > $(PROJECT).S #make: version # $(CC) $(CFLAGS) agni.c \ @@ -60,4 +61,4 @@ leak: valgrind --leak-check=full --track-origins=yes --log-file=log.txt ./$(PROJECT) -c config/test.ini clean: - rm -f agni *.o cmd/*.o \ No newline at end of file + rm -f agni *.o cmd/*.o extlibs/*.o \ No newline at end of file diff --git a/agni.c b/agni.c index 4cd93a7..f89dc17 100644 --- a/agni.c +++ b/agni.c @@ -789,15 +789,17 @@ int th_event_manager(void *data) mq_cur = &mq[i_mq]; if (mq_event == 1) { + int bytes; //PRINT("MQ_EVENT OUT\n"); memset(out_buf, 0, out_attr.mq_msgsize); //will fail if some of queue have different buffer size param - if (mq_ntf_read(&mq[i_mq], MQ_OUT, out_buf, out_attr.mq_msgsize) == -1) + if ((bytes = mq_ntf_read(&mq[i_mq], MQ_OUT, out_buf, out_attr.mq_msgsize)) == -1) { printf("Cant read output message\n"); } else { out_buf[out_attr.mq_msgsize-1] = 0x0; + stats.cnt_ipc_rx += bytes; printf("Recieve %s\n", out_buf); } break; @@ -813,7 +815,7 @@ int th_event_manager(void *data) { rpc_req_unmarsh(nb_req, &req); PRINT("EVENT-REQ: %d-%s(%s)\n", req->id, req->method, req->params); - nb_print(nb_req); + //nb_print(nb_req); if (strncmp(req->method,":PRIVMSG",8)) { diff --git a/cmd/cmd_botu.c b/cmd/cmd_botu.c index d5a9e4e..ac9eb1a 100644 --- a/cmd/cmd_botu.c +++ b/cmd/cmd_botu.c @@ -35,7 +35,7 @@ void *cmd_botu(void *data) proc_sec = start.tv_sec - file_stat.st_ctim.tv_sec; - snprintf(buf, buf_size, "%lud %luh %lum %lus\n", + snprintf(buf, buf_size, "%lud %luh %lum %lus", (proc_sec/(3600*24)), (proc_sec/(3600))%24, (proc_sec/60)%60, diff --git a/cmd/cmd_cmd.c b/cmd/cmd_cmd.c index 0eabfe1..66ef570 100644 --- a/cmd/cmd_cmd.c +++ b/cmd/cmd_cmd.c @@ -10,7 +10,7 @@ void *cmd_cmd(void *data) printf("CMD\n"); - snprintf(buf, buf_size, "%s\n", param); + snprintf(buf, buf_size, "%s", param); ret = alloc_new_str(buf); diff --git a/cmd/cmd_cookie.c b/cmd/cmd_cookie.c index 0c9c5dd..82aaacf 100644 --- a/cmd/cmd_cookie.c +++ b/cmd/cmd_cookie.c @@ -10,7 +10,7 @@ void *cmd_cookie(void *data) printf("COOKIE\n"); - snprintf(buf, buf_size, "No heroes yet\n"); + snprintf(buf, buf_size, "No heroes yet"); ret = alloc_new_str(buf); diff --git a/cmd/cmd_date.c b/cmd/cmd_date.c index 3ccb75a..4f93d9c 100644 --- a/cmd/cmd_date.c +++ b/cmd/cmd_date.c @@ -6,7 +6,7 @@ void *cmd_date(void *data) printf("DATE\n"); - ret = alloc_new_str("I dont whant to date with you\n"); + ret = alloc_new_str("I dont whant to date with you"); return ret; } \ No newline at end of file diff --git a/cmd/cmd_fir.c b/cmd/cmd_fir.c index 33bb949..28adff5 100644 --- a/cmd/cmd_fir.c +++ b/cmd/cmd_fir.c @@ -606,7 +606,7 @@ void *cmd_fir(void *data) snprintf(str_double, 16, "%.3f ", lp_coef[i]); out_result = sdscat(out_result, str_double); } - out_result = sdscat(out_result, "\n"); + out_result = sdscat(out_result, ""); ret = alloc_new_str(out_result); diff --git a/cmd/cmd_fir1p.c b/cmd/cmd_fir1p.c index 716d432..34f9843 100644 --- a/cmd/cmd_fir1p.c +++ b/cmd/cmd_fir1p.c @@ -80,7 +80,7 @@ void *cmd_fir1p(void *data) snprintf(str_double, 16, "%.3f ", output[i]); out_result = sdscat(out_result, str_double); } - out_result = sdscat(out_result,"\n"); + out_result = sdscat(out_result,""); diff --git a/cmd/cmd_loadavg.c b/cmd/cmd_loadavg.c index 330376e..07d8f4a 100644 --- a/cmd/cmd_loadavg.c +++ b/cmd/cmd_loadavg.c @@ -19,7 +19,7 @@ void *cmd_loadavg(void *data) } printf("1M %lf 5M %lf 15M %lf\n", loadavg_d[0], loadavg_d[1], loadavg_d[2]); - snprintf(buf, buf_size,"1M %.1f 5M %.1f 15M %.1f\n", loadavg_d[0], loadavg_d[1], loadavg_d[2]); + snprintf(buf, buf_size,"1M %.1f 5M %.1f 15M %.1f", loadavg_d[0], loadavg_d[1], loadavg_d[2]); ret = alloc_new_str(buf); diff --git a/cmd/cmd_rand_libc.c b/cmd/cmd_rand_libc.c index 1860a77..f0bd7a1 100644 --- a/cmd/cmd_rand_libc.c +++ b/cmd/cmd_rand_libc.c @@ -35,7 +35,7 @@ void *cmd_rand_libc(void *data) snprintf(str_integer, 16, "%d ", rand_r(&rand_state)); out_result = sdscat(out_result, str_integer); } - out_result = sdscat(out_result,"\n"); + out_result = sdscat(out_result,""); snprintf(buf, buf_size, "%s", out_result); sdsfree(params); diff --git a/cmd/cmd_rusage.c b/cmd/cmd_rusage.c index 3dc5d21..eacfb41 100644 --- a/cmd/cmd_rusage.c +++ b/cmd/cmd_rusage.c @@ -23,7 +23,7 @@ void *cmd_rusage(void *data) cur_proc_rusage.ru_utime.tv_sec, cur_proc_rusage.ru_stime.tv_sec ); - snprintf(buf, buf_size, "USER %ld SYS %ld\n", + snprintf(buf, buf_size, "USER %ld SYS %ld", cur_proc_rusage.ru_utime.tv_sec, cur_proc_rusage.ru_stime.tv_sec ); diff --git a/cmd/cmd_sha1.c b/cmd/cmd_sha1.c index d7d06d5..7e098ca 100644 --- a/cmd/cmd_sha1.c +++ b/cmd/cmd_sha1.c @@ -31,7 +31,7 @@ void *cmd_sha1(void *data) hex_result[40]=0x0; - snprintf(buf, buf_size, "sha1 %s\n",hex_result); + snprintf(buf, buf_size, "sha1 %s",hex_result); ret = alloc_new_str(buf); diff --git a/cmd/cmd_spi.c b/cmd/cmd_spi.c index bfda27c..668aeb3 100644 --- a/cmd/cmd_spi.c +++ b/cmd/cmd_spi.c @@ -17,7 +17,7 @@ char _spi_str_spi[]="""\ | MOSI |\n\ | SCK |\n\ | CS |\n\ ---------\n\ +--------\ """; char _spi_str_slave[]="""\ @@ -27,7 +27,7 @@ slave\n\ | MOSI |<-\n\ | SCK |<-\n\ | CS |<-\n\ ---------\n\ +--------\ """; char _spi_str_master[]="""\ @@ -37,12 +37,12 @@ master\n\ | MOSI |>-\n\ | SCK |>-\n\ | CS |>-\n\ ---------\n\ +--------\ """; char *_spi_help_table[] = { - "help" ,"MODES,SPI,SLAVE,MASTER,MISO,MOSI,SCK,HOLD,CS", + "HELP" ,"MODES,SPI,SLAVE,MASTER,MISO,MOSI,SCK,HOLD,CS", "MODES" ,"QUAD(4-wires),DOUBLE(3-wires),SINGLE(2-wires)", "SPI" ,_spi_str_spi, "SLAVE" ,_spi_str_slave, diff --git a/cmd/cmd_uptime.c b/cmd/cmd_uptime.c index 4f0a4f3..c4dfda7 100644 --- a/cmd/cmd_uptime.c +++ b/cmd/cmd_uptime.c @@ -25,7 +25,7 @@ void *cmd_uptime(void *data) i1 = d1; printf("Days %d Hours %d Minutes %d\n",i1/(3600*24),i1/(3600)%24, (i1/60)%60); - snprintf(buf, buf_size,"%dd %dh %dm\n",i1/(3600*24),i1/(3600)%24, (i1/60)%60); + snprintf(buf, buf_size,"%dd %dh %dm",i1/(3600*24),i1/(3600)%24, (i1/60)%60); ret = alloc_new_str(buf); diff --git a/cmd/cmd_version.c b/cmd/cmd_version.c index 75bd83b..f436eb1 100644 --- a/cmd/cmd_version.c +++ b/cmd/cmd_version.c @@ -9,7 +9,7 @@ void *cmd_version(void *data) printf("VERSION\n"); - snprintf(buf, buf_size, "VERSION:0.0.5" " DATE:" VERSION_DATE " COMMIT:" VERSION_COMMIT "\n"); + snprintf(buf, buf_size, "VERSION:0.0.6" " DATE:" VERSION_DATE " COMMIT:" VERSION_COMMIT ""); ret = alloc_new_str(buf); diff --git a/extlibs/nbrpc.c b/extlibs/nbrpc.c index 2e8d6c3..9adde5d 100644 --- a/extlibs/nbrpc.c +++ b/extlibs/nbrpc.c @@ -79,12 +79,12 @@ int rpc_req_marsh( rpc_request *req, netbyte_store **nb_req) nb_add_u8arr(nb, &nb_params); nb_u32_create(&nb_id, req->id); - PRINT("%d\n", req->id); - PRINT("%d\n", nb_id.val); + //PRINT("%d\n", req->id); + //PRINT("%d\n", nb_id.val); nb_add_u32(nb, &nb_id); - nb_print(nb); - nb_print(nb); + //nb_print(nb); + //nb_print(nb); *nb_req = nb; return 0; @@ -108,8 +108,8 @@ int rpc_resp_marsh( rpc_response *resp, netbyte_store **nb_resp) eret |= nb_add_u8arr(nb, &nb_error); eret = nb_u32_create(&nb_id, resp->id); - PRINT("%d\n", resp->id); - PRINT("%d\n", nb_id.val); + //PRINT("%d\n", resp->id); + //PRINT("%d\n", nb_id.val); eret |= nb_add_u32(nb, &nb_id); if (!eret) { @@ -163,7 +163,7 @@ int rpc_req_unmarsh( netbyte_store *nb_req, rpc_request **req) if (0 == nb_val(nb_req, 2, &type)) if (type->type == NBT_U32) { - PNL(); + //PNL(); nb_u32 *u32 = (nb_u32 *)type->nb_val; __req->id = u32->val; } else @@ -220,7 +220,7 @@ int rpc_resp_unmarsh(netbyte_store *nb_resp, rpc_response **resp) PNL(); nb_u32 *u32 = (nb_u32 *)type->nb_val; __resp->id = u32->val; - PRINT("%d\n",u32->val) + //PRINT("%d\n",u32->val) } else { ENL(); -- cgit v1.2.3