Merge commit '28dbfe9bf7a799ab1da2563fd5e007d007b54168'
[osmocom-bb.git] / src / shared / libosmocore / src / vty / telnet_interface.c
index 9069096..0d45d61 100644 (file)
 #include <string.h>
 #include <unistd.h>
 
-#include <osmocore/msgb.h>
-#include <osmocore/talloc.h>
-#include <osmocore/logging.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/logging.h>
 
 #include <osmocom/vty/telnet_interface.h>
 #include <osmocom/vty/buffer.h>
+#include <osmocom/vty/command.h>
 
 /* per connection data */
 LLIST_HEAD(active_connections);
@@ -69,7 +70,7 @@ int telnet_init(void *tall_ctx, void *priv, int port)
        sock_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 
        rc = bind(fd, (struct sockaddr*)&sock_addr, sizeof(sock_addr));
-       if (bind < 0) {
+       if (rc < 0) {
                LOGP(0, LOGL_ERROR, "Telnet interface failed to bind\n");
                close(fd);
                return rc;
@@ -89,16 +90,18 @@ int telnet_init(void *tall_ctx, void *priv, int port)
        return 0;
 }
 
-extern const char *openbsc_copyright;
+extern struct host host;
 
 static void print_welcome(int fd)
 {
        int ret;
        static char *msg =
-               "Welcome to the OpenBSC Control interface\n";
+               "Welcome to the OpenBSC Control interface\r\n";
 
        ret = write(fd, msg, strlen(msg));
-       ret = write(fd, openbsc_copyright, strlen(openbsc_copyright));
+
+       if (host.app_info->copyright)
+               ret = write(fd, host.app_info->copyright, strlen(host.app_info->copyright));
 }
 
 int telnet_close_client(struct bsc_fd *fd)