diff --git a/linuxax25-master-f6bvp/ax25tools/user_call/user_io.c b/linuxax25-master/ax25tools/user_call/user_io.c index 3bd6a26..92c47a6 100644 --- a/linuxax25-master/ax25tools/user_call/user_io.c +++ b/linuxax25-master/ax25tools/user_call/user_io.c @@ -174,6 +174,16 @@ int user_read(int fd, void *buf, size_t count) #endif } +void linefeed_buffer(char *buf, size_t count) +{ + int i; + + for (i=0 ; i < count ; i++) { + if(buf[i] == 0x0D) + buf[i] = 0x0A; + } +} + int select_loop(int s) { fd_set read_fd; @@ -199,8 +209,10 @@ int select_loop(int s) select(s + 1, &read_fd, NULL, NULL, NULL); if (FD_ISSET(s, &read_fd)) { - while ((n = user_read(s, buf, BUFLEN)) > 0) + while ((n = user_read(s, buf, BUFLEN)) > 0) { + linefeed_buffer(buf, BUFLEN); user_write(STDOUT_FILENO, buf, n); + } if (n == 0 || (n < 0 && errno != EAGAIN)) { close(s); break; diff --git a/linuxax25-master-f6bvp/ax25tools/user_call/rose_call.c b/linuxax25-master/ax25tools/user_call/rose_call.c index 03bba08..7a7dea1 100644 --- a/linuxax25-master-f6bvp/ax25tools/user_call/rose_call.c +++ b/linuxax25-master/ax25tools/user_call/rose_call.c @@ -44,13 +44,13 @@ int main(int argc, char **argv) break; case ':': case '?': - err("ERROR: invalid option usage\n"); + err("ERROR: invalid option usage\r"); return 1; } } if (paclen_in < 1 || paclen_out < 1) { - err("ERROR: invalid paclen\n"); + err("ERROR: invalid paclen\r"); return 1; } @@ -58,12 +58,12 @@ int main(int argc, char **argv) * Arguments should be "rose_call port mycall remcall remaddr" */ if ((argc - optind) != 4) { - strcpy(buffer, "ERROR: invalid number of parameters\n"); + strcpy(buffer, "ERROR: invalid number of parameters\r"); err(buffer); } if (rs_config_load_ports() == 0) { - strcpy(buffer, "ERROR: problem with rsports file\n"); + strcpy(buffer, "ERROR: problem with rsports file\r"); err(buffer); } @@ -75,27 +75,27 @@ int main(int argc, char **argv) addr = rs_config_get_addr(argv[optind]); if (addr == NULL) { - sprintf(buffer, "ERROR: invalid Rose port name - %s\n", argv[optind]); + sprintf(buffer, "ERROR: invalid Rose port name - %s\r", argv[optind]); err(buffer); } if (rose_aton(addr, rosebind.srose_addr.rose_addr) == -1) { - sprintf(buffer, "ERROR: invalid Rose port address - %s\n", argv[optind]); + sprintf(buffer, "ERROR: invalid Rose port address - %s\r", argv[optind]); err(buffer); } if (ax25_aton_entry(argv[optind + 1], rosebind.srose_call.ax25_call) == -1) { - sprintf(buffer, "ERROR: invalid callsign - %s\n", argv[optind + 1]); + sprintf(buffer, "ERROR: invalid callsign - %s\r", argv[optind + 1]); err(buffer); } if (ax25_aton_entry(argv[optind + 2], roseconnect.srose_call.ax25_call) == -1) { - sprintf(buffer, "ERROR: invalid callsign - %s\n", argv[optind + 2]); + sprintf(buffer, "ERROR: invalid callsign - %s\r", argv[optind + 2]); err(buffer); } if (rose_aton(argv[optind + 3], roseconnect.srose_addr.rose_addr) == -1) { - sprintf(buffer, "ERROR: invalid Rose address - %s\n", argv[optind + 3]); + sprintf(buffer, "ERROR: invalid Rose address - %s\r", argv[optind + 3]); err(buffer); } @@ -104,7 +104,7 @@ int main(int argc, char **argv) */ s = socket(AF_ROSE, SOCK_SEQPACKET, 0); if (s < 0) { - sprintf(buffer, "ERROR: cannot open Rose socket, %s\n", strerror(errno)); + sprintf(buffer, "ERROR: cannot open Rose socket, %s\r", strerror(errno)); err(buffer); } @@ -112,11 +112,11 @@ int main(int argc, char **argv) * Set our AX.25 callsign and Rose address accordingly. */ if (bind(s, (struct sockaddr *)&rosebind, addrlen) != 0) { - sprintf(buffer, "ERROR: cannot bind Rose socket, %s\n", strerror(errno)); + sprintf(buffer, "ERROR: cannot bind Rose socket, %s\r", strerror(errno)); err(buffer); } - sprintf(buffer, "Connecting to %s @ %s ...\n", argv[optind + 2], argv[optind + 3]); + sprintf(buffer, "Connecting to %s @ %s ...\r", argv[optind + 2], argv[optind + 3]); user_write(STDOUT_FILENO, buffer, strlen(buffer)); /* @@ -132,16 +132,16 @@ int main(int argc, char **argv) if (connect(s, (struct sockaddr *)&roseconnect, addrlen) != 0) { switch (errno) { case ECONNREFUSED: - strcpy(buffer, "*** Connection refused - aborting\n"); + strcpy(buffer, "*** Connection refused - aborting\r"); break; case ENETUNREACH: - strcpy(buffer, "*** No known route - aborting\n"); + strcpy(buffer, "*** No known route - aborting\r"); break; case EINTR: - strcpy(buffer, "*** Connection timed out - aborting\n"); + strcpy(buffer, "*** Connection timed out - aborting\r"); break; default: - sprintf(buffer, "ERROR: cannot connect to Rose address, %s\n", strerror(errno)); + sprintf(buffer, "ERROR: cannot connect to Rose address, %s\r", strerror(errno)); break; } @@ -153,12 +153,12 @@ int main(int argc, char **argv) */ alarm(0); - strcpy(buffer, "*** Connected\n"); + strcpy(buffer, "*** Connected\r"); user_write(STDOUT_FILENO, buffer, strlen(buffer)); select_loop(s); - strcpy(buffer, "\n*** Disconnected\n"); + strcpy(buffer, "\r*** Disconnected\r"); user_write(STDOUT_FILENO, buffer, strlen(buffer)); end_compress();