diff --git a/components/net/protocols/coap/libcoap-v4.3.0/examples/coap-client.c b/components/net/protocols/coap/libcoap-v4.3.0/examples/coap-client.c index 88384dd17acbc752038be65c1c910f79adc9dbba..0a29172502ef4df6337b8c19a99fb7e30846440a 100644 --- a/components/net/protocols/coap/libcoap-v4.3.0/examples/coap-client.c +++ b/components/net/protocols/coap/libcoap-v4.3.0/examples/coap-client.c @@ -201,7 +201,7 @@ static int append_to_output(const uint8_t *data, size_t len) { if (NULL == (file = fopen((char *)output_file.s, "w"))) { - printf("fopen\r\n"); + os_kprintf("fopen\r\n"); return -1; } } @@ -212,9 +212,9 @@ static int append_to_output(const uint8_t *data, size_t len) for (int i = 0; i < len; i++) { if (data[i] == '\n') - printf("\r\n"); + os_kprintf("\r\n"); else - printf("%c", data[i]); + os_kprintf("%c", data[i]); } } else @@ -300,7 +300,7 @@ static int resolve_address(const coap_str_const_t *server, struct sockaddr *dst) if (ret != 0) { - printf("getaddrinfo: %s\r\n", gai_strerror(ret)); + os_kprintf("getaddrinfo: %s\r\n", gai_strerror(ret)); return -1; } @@ -458,17 +458,17 @@ static coap_response_t message_handler(coap_session_t *session COAP_UNUSED, /* check if an error was signaled and output payload if so */ if (COAP_RESPONSE_CLASS(rcv_code) >= 4) { - printf("%d.%02d", COAP_RESPONSE_CLASS(rcv_code), rcv_code & 0x1F); + os_kprintf("%d.%02d", COAP_RESPONSE_CLASS(rcv_code), rcv_code & 0x1F); if (coap_get_data_large(received, &len, &databuf, &offset, &total)) { - printf(" "); + os_kprintf(" "); while (len--) { - printf("%c", isprint(*databuf) ? *databuf : '.'); + os_kprintf("%c", isprint(*databuf) ? *databuf : '.'); databuf++; } } - printf("\r\n"); + os_kprintf("\r\n"); } } @@ -487,7 +487,7 @@ static void usage(const char *program, const char *version) if (p) program = ++p; - printf("%s v%s -- a small CoAP implementation\r\n" + os_kprintf("%s v%s -- a small CoAP implementation\r\n" "Copyright (C) 2010-2021 Olaf Bergmann and others\r\n\r\n" "%s\r\n" "%s\r\n", @@ -495,8 +495,8 @@ static void usage(const char *program, const char *version) version, lib_version, coap_string_tls_version(buffer, sizeof(buffer))); - printf("%s\r\n", coap_string_tls_support(buffer, sizeof(buffer))); - printf("\r\n" + os_kprintf("%s\r\n", coap_string_tls_support(buffer, sizeof(buffer))); + os_kprintf("\r\n" "Usage: %s [-a addr] [-b [num,]size] [-e text] [-f file] [-l loss]\r\n" "\t\t[-m method] [-o file] [-p port] [-r] [-s duration] [-t type]\r\n" "\t\t[-v num] [-w] [-A type] [-B seconds] [-H hoplimit] [-K interval]\r\n" @@ -553,7 +553,7 @@ static void usage(const char *program, const char *version) "\t-U \t\tNever include Uri-Host or Uri-Port options\r\n", program, wait_seconds); - printf("PSK Options (if supported by underlying (D)TLS library)\r\n" + os_kprintf("PSK Options (if supported by underlying (D)TLS library)\r\n" "\t-h match_hint_file\r\n" "\t \t\tThis is a file that contains one or more lines of\r\n" "\t \t\treceived Identity Hints to match to use different\r\n" @@ -601,7 +601,7 @@ static void usage(const char *program, const char *version) "\t \t\tUsing the -C or -R options will will trigger the\r\n" "\t \t\tvalidation of the server certificate unless overridden\r\n" "\t \t\tby the -n option\n"); - printf("Examples:\r\n" + os_kprintf("Examples:\r\n" "\tcoap_client -m get coap://[::1]/\r\n" "\tcoap_client -m get coap://[::1]/.well-known/core\r\n" "\tcoap_client -m get coap+tcp://[::1]/.well-known/core\r\n" @@ -1502,7 +1502,7 @@ static coap_session_t *get_session(coap_context_t *ctx, s = getaddrinfo(local_addr, local_port, &hints, &result); if (s != 0) { - printf("getaddrinfo: %s\r\n", gai_strerror(s)); + os_kprintf("getaddrinfo: %s\r\n", gai_strerror(s)); return NULL; } @@ -1605,7 +1605,7 @@ int coap_client(int argc, char **argv) block_mode = strtoul(coap_optarg, NULL, 0); if (!(block_mode & COAP_BLOCK_USE_LIBCOAP)) { - printf("Block mode must include COAP_BLOCK_USE_LIBCOAP (1)\r\n"); + os_kprintf("Block mode must include COAP_BLOCK_USE_LIBCOAP (1)\r\n"); return (-1); } break; @@ -1632,7 +1632,7 @@ int coap_client(int argc, char **argv) if (!output_file.s) { - printf("cannot set output file: insufficient memory\r\n"); + os_kprintf("cannot set output file: insufficient memory\r\n"); return (-1); } else @@ -1660,7 +1660,7 @@ int coap_client(int argc, char **argv) case 'P': if (!cmdline_proxy(coap_optarg)) { - printf("error specifying proxy address\r\n"); + os_kprintf("error specifying proxy address\r\n"); return (-1); } break; @@ -1698,7 +1698,7 @@ int coap_client(int argc, char **argv) break; case 'H': if (!cmdline_hop_limit(coap_optarg)) - printf("Hop Limit has to be > 0 and < 256\n"); + os_kprintf("Hop Limit has to be > 0 and < 256\n"); break; #if defined(COAP_4_3_0_WITH_MBEDTLS) case 'n': @@ -1752,7 +1752,7 @@ int coap_client(int argc, char **argv) if (res < 0) { - printf("failed to resolve address\r\n"); + os_kprintf("failed to resolve address\r\n"); return (-1); } @@ -1936,7 +1936,7 @@ static void coap_client_task(void *param) coap_client(param_argc, param_argv); coap_param_free(); client_task = NULL; - printf("\r\nExit coap client task!\r\n"); + os_kprintf("\r\nExit coap client task!\r\n"); } static int coap_client_entry(int argc, char **argv) @@ -1950,7 +1950,7 @@ static int coap_client_entry(int argc, char **argv) } while (client_task != NULL) { - printf("Wait for the last task ending!\n"); + os_kprintf("Wait for the last task ending!\n"); os_task_msleep(1 * 1000); } param_argv = malloc(sizeof(char *) * argc); diff --git a/components/net/protocols/coap/libcoap-v4.3.0/examples/coap-server.c b/components/net/protocols/coap/libcoap-v4.3.0/examples/coap-server.c index f8c8ee4012681f117f57a43b62bd29177c73bad1..6c0e2d9b87ac71af9faf492d4609476a5bb307e2 100644 --- a/components/net/protocols/coap/libcoap-v4.3.0/examples/coap-server.c +++ b/components/net/protocols/coap/libcoap-v4.3.0/examples/coap-server.c @@ -2290,7 +2290,7 @@ static void usage(const char *program, const char *version) if (p) program = ++p; - printf("%s v%s -- a small CoAP implementation\r\n" + os_kprintf("%s v%s -- a small CoAP implementation\r\n" "(c) 2010,2011,2015-2021 Olaf Bergmann and others\r\n\r\n" "%s\r\n" "%s\r\n", @@ -2298,8 +2298,8 @@ static void usage(const char *program, const char *version) version, lib_version, coap_string_tls_version(buffer, sizeof(buffer))); - printf("%s\r\n", coap_string_tls_support(buffer, sizeof(buffer))); - printf("\r\n" + os_kprintf("%s\r\n", coap_string_tls_support(buffer, sizeof(buffer))); + os_kprintf("\r\n" "Usage: %s [-d max] [-e] [-g group] [-G group_if] [-l loss] [-p port]\r\n" "\t\t[-v num] [-A address] [-L value] [-N]\r\n" "\t\t[-P scheme://address[:port],name1[,name2..]]\r\n" @@ -2338,7 +2338,7 @@ static void usage(const char *program, const char *version) "\t \t\tevery fifth response will still be sent as a confirmable\r\n" "\t \t\tresponse (RFC 7641 requirement)\r\n", program); - printf("\t-P scheme://address[:port],name1[,name2[,name3..]]\tScheme, address,\r\n" + os_kprintf("\t-P scheme://address[:port],name1[,name2[,name3..]]\tScheme, address,\r\n" "\t \t\toptional port of how to connect to the next proxy server\r\n" "\t \t\tand one or more names (comma separated) that this proxy\r\n" "\t \t\tserver is known by. If the hostname of the incoming proxy\r\n" @@ -2378,7 +2378,7 @@ static void usage(const char *program, const char *version) "\t \t\t-s followed by -i\r\n" "\t-u user\t\tUser identity for pre-shared key mode (only used if\r\n" "\t \t\toption -P is set)\r\n"); - printf("PKI Options (if supported by underlying (D)TLS library)\r\n" + os_kprintf("PKI Options (if supported by underlying (D)TLS library)\r\n" "\tNote: If any one of '-c certfile', '-j keyfile' or '-C cafile' is in\r\n" "\tPKCS11 URI naming format (pkcs11: prefix), then any remaining non\r\n" "\tPKCS11 URI file definitions have to be in DER, not PEM, format.\r\n" @@ -3214,7 +3214,7 @@ static void coap_server_task(void *param) coap_server(param_argc, param_argv); coap_param_free(); server_task = NULL; - printf("\r\nExit coap server task!\r\n"); + os_kprintf("\r\nExit coap server task!\r\n"); } static int coap_server_entry(int argc, char **argv) @@ -3228,7 +3228,7 @@ static int coap_server_entry(int argc, char **argv) while (server_task != NULL) { os_task_msleep(1 * 1000); - printf("Wait for the last task ending!\n"); + os_kprintf("Wait for the last task ending!\n"); } param_argv = malloc(sizeof(char *) * argc); if (param_argv == NULL) diff --git a/components/net/protocols/coap/libcoap-v4.3.0/examples/contiki/coap-observer.c b/components/net/protocols/coap/libcoap-v4.3.0/examples/contiki/coap-observer.c index 2bab1abfad232e973a4eeec43fa2064ca7cb88d8..5be1ff49b7c4a3b4482a3550463cb9797a7325c2 100644 --- a/components/net/protocols/coap/libcoap-v4.3.0/examples/contiki/coap-observer.c +++ b/components/net/protocols/coap/libcoap-v4.3.0/examples/contiki/coap-observer.c @@ -65,13 +65,13 @@ void init_coap() uip_ds6_addr_add(&listen_addr.addr, 0, ADDR_AUTOCONF); uip_debug_lladdr_print(&uip_lladdr); - printf("\r\n"); + os_kprintf("\r\n"); uip_debug_ipaddr_print(&listen_addr.addr); - printf("\r\n"); + os_kprintf("\r\n"); #endif /* WITH_CONTIKI */ #ifdef WITH_CONTIKI - printf("tentative address: [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n", + os_kprintf("tentative address: [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n", listen_addr.addr.u8[0], listen_addr.addr.u8[1], listen_addr.addr.u8[2], diff --git a/components/net/protocols/coap/libcoap-v4.3.0/examples/contiki/server.c b/components/net/protocols/coap/libcoap-v4.3.0/examples/contiki/server.c index 047f2c16a9d1ba4a1ac8f5612670afa9899a1b50..823bef73ec3e55ead599550c175dbb358335f552 100644 --- a/components/net/protocols/coap/libcoap-v4.3.0/examples/contiki/server.c +++ b/components/net/protocols/coap/libcoap-v4.3.0/examples/contiki/server.c @@ -74,9 +74,9 @@ void init_coap_server(coap_context_t **ctx) uip_ds6_defrt_add(&gw_addr, 0); PRINTLLADDR(&uip_lladdr); - printf("\r\n"); + os_kprintf("\r\n"); PRINT6ADDR(&listen_addr.addr); - printf("\r\n"); + os_kprintf("\r\n"); *ctx = coap_new_context(&listen_addr); diff --git a/components/net/protocols/coap/libcoap-v4.3.0/examples/getopt.c b/components/net/protocols/coap/libcoap-v4.3.0/examples/getopt.c index bebe686615845443c58bf1b83f545a7a688119c8..2f8c1debb9a81f4e7b92ba4b6fb2c29befba9277 100644 --- a/components/net/protocols/coap/libcoap-v4.3.0/examples/getopt.c +++ b/components/net/protocols/coap/libcoap-v4.3.0/examples/getopt.c @@ -39,7 +39,7 @@ static int coap_getopt(int argc, char *argv[], char *opts) coap_optopt = c = argv[coap_optind][sp]; if (c == ':' || NULL == (cp = strchr(opts, c))) { - printf(": illegal option -- %c\r\n", c); + os_kprintf(": illegal option -- %c\r\n", c); if (argv[coap_optind][++sp] == '\0') { coap_optind++; @@ -53,7 +53,7 @@ static int coap_getopt(int argc, char *argv[], char *opts) coap_optarg = &argv[coap_optind++][sp + 1]; else if (++coap_optind >= argc) { - printf(": option requires an argument -- %c\r\n", c); + os_kprintf(": option requires an argument -- %c\r\n", c); sp = 1; return '?'; } diff --git a/components/net/protocols/coap/libcoap-v4.3.0/examples/lwip/server.c b/components/net/protocols/coap/libcoap-v4.3.0/examples/lwip/server.c index 0886e75dbbb80a4bf3ec3e53b469540b52e4896f..447b57ca719f36b472feb9da8e6aa25b86860e5f 100644 --- a/components/net/protocols/coap/libcoap-v4.3.0/examples/lwip/server.c +++ b/components/net/protocols/coap/libcoap-v4.3.0/examples/lwip/server.c @@ -60,7 +60,7 @@ int main(int argc, char **argv) lwip_init(); - printf("TCP/IP initialized.\n"); + os_kprintf("TCP/IP initialized.\n"); netif_add(&netif, &ipaddr, &netmask, &gw, NULL, tapif_init, ethernet_input); netif.flags |= NETIF_FLAG_ETHARP; @@ -74,7 +74,7 @@ int main(int argc, char **argv) server_coap_init(); - printf("Applications started.\n"); + os_kprintf("Applications started.\n"); while (1) { diff --git a/components/net/protocols/coap/libcoap-v4.3.0/src/coap_debug.c b/components/net/protocols/coap/libcoap-v4.3.0/src/coap_debug.c index b09e8d0078e787e67f822f1856164b880e0ff46f..167839249e5dbadce417ab40135d7f80d2f5c0c8 100644 --- a/components/net/protocols/coap/libcoap-v4.3.0/src/coap_debug.c +++ b/components/net/protocols/coap/libcoap-v4.3.0/src/coap_debug.c @@ -531,7 +531,7 @@ COAP_STATIC_INLINE int is_binary(int content_format) { \ if (use_fprintf_for_show_pdu) \ { \ - printf("%s", outbuf); \ + os_kprintf("%s", outbuf); \ } \ else \ { \ @@ -1014,17 +1014,17 @@ void coap_log_impl(coap_log_t level, const char *format, ...) coap_ticks(&now); len = print_timestamp(timebuf, sizeof(timebuf), now); if (len) - printf("%.*s ", (int)len, timebuf); + os_kprintf("%.*s ", (int)len, timebuf); if (level <= COAP_LOG_CIPHERS) - printf("%s ", loglevels[level]); + os_kprintf("%s ", loglevels[level]); va_start(ap, format); vfprintf(log_fd, format, ap); va_end(ap); fflush(log_fd); } - printf("\r\n"); + os_kprintf("\r\n"); } static struct packet_num_interval diff --git a/components/net/protocols/coap/libcoap-v4.3.0/src/net.c b/components/net/protocols/coap/libcoap-v4.3.0/src/net.c index 24d8d10470d93919c4a6ae9366a3224826ef7799..93d49d9274cfa2b05b052c938f17791e0aae9ea6 100644 --- a/components/net/protocols/coap/libcoap-v4.3.0/src/net.c +++ b/components/net/protocols/coap/libcoap-v4.3.0/src/net.c @@ -3935,7 +3935,7 @@ static void coap_retransmittimer_restart(coap_context_t *ctx) if (ctx->timer_configured) { - printf("clearing\n"); + os_kprintf("clearing\n"); sys_untimeout(coap_retransmittimer_execute, (void *)ctx); ctx->timer_configured = 0; } @@ -3963,7 +3963,7 @@ static void coap_retransmittimer_restart(coap_context_t *ctx) delay = 0; } - printf("scheduling for %d ticks\n", delay); + os_kprintf("scheduling for %d ticks\n", delay); sys_timeout(delay, coap_retransmittimer_execute, (void *)ctx); ctx->timer_configured = 1; }