VTY: pass program name, version and copyright to vty_init()

This enables us to make the VTY completely independent of any
compile-time program-specific information, i.e. one step closer
to using VTY as a shared library from multiple programs.
diff --git a/openbsc/src/vty/cardshell.h b/openbsc/src/vty/cardshell.h
deleted file mode 100644
index 85164d2..0000000
--- a/openbsc/src/vty/cardshell.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "../../bscconfig.h"
-#define QUAGGA_PROGNAME	PACKAGE_NAME
-#define QUAGGA_VERSION	PACKAGE_VERSION
-#define QUAGGA_COPYRIGHT "Harald Welte <laforge@gnumonks.org>"
-#define CONFIGFILE_MASK 022
-#define SYSCONFDIR "/usr/local/etc"
diff --git a/openbsc/src/vty/command.c b/openbsc/src/vty/command.c
index f45ecdd..5be0092 100644
--- a/openbsc/src/vty/command.c
+++ b/openbsc/src/vty/command.c
@@ -21,8 +21,6 @@
 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-#include "cardshell.h"
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -44,6 +42,8 @@
 #include <openbsc/gsm_subscriber.h>
 #include <osmocore/talloc.h>
 
+#define CONFIGFILE_MASK 022
+
 void *tall_vty_cmd_ctx;
 
 /* Command vector which includes some level of command lists. Normally
@@ -81,16 +81,14 @@
 };
 
 /* Default motd string. */
-const char *default_motd = "\r\n\
-Hello, this is " QUAGGA_PROGNAME " (version " QUAGGA_VERSION ").\r\n\
-" QUAGGA_COPYRIGHT "\r\n\
-\r\n";
+const char *default_motd = "";
 
 /* This is called from main when a daemon is invoked with -v or --version. */
-void print_version(const char *progname)
+void print_version(int print_copyright)
 {
-	printf("%s version %s\n", progname, QUAGGA_VERSION);
-	printf("%s\n", QUAGGA_COPYRIGHT);
+	printf("%s version %s\n", host.prog_name, host.prog_version);
+	if (print_copyright)
+		printf("\n%s\n", host.prog_copyright);
 }
 
 /* Utility function to concatenate argv argument into a single string
@@ -2199,9 +2197,9 @@
 DEFUN(show_version,
       show_version_cmd, "show version", SHOW_STR "Displays program version\n")
 {
-	vty_out(vty, "%s %s (%s).%s", QUAGGA_PROGNAME, QUAGGA_VERSION,
+	vty_out(vty, "%s %s (%s).%s", host.prog_name, host.prog_version,
 		host.name ? host.name : "", VTY_NEWLINE);
-	vty_out(vty, "%s%s", QUAGGA_COPYRIGHT, VTY_NEWLINE);
+	vty_out(vty, "%s%s", host.prog_copyright, VTY_NEWLINE);
 
 	return CMD_SUCCESS;
 }
@@ -2294,7 +2292,8 @@
 	file_vty->type = VTY_FILE;
 
 	/* Config file header print. */
-	vty_out(file_vty, "!\n! OpenBSC configuration saved from vty\n!   ");
+	vty_out(file_vty, "!\n! %s (%s) configuration saved from vty\n!",
+		host.prog_name, host.prog_version);
 	//vty_time_print (file_vty, 1);
 	vty_out(file_vty, "!\n");
 
diff --git a/openbsc/src/vty/vty.c b/openbsc/src/vty/vty.c
index 7a6ad97..e5b5b48 100644
--- a/openbsc/src/vty/vty.c
+++ b/openbsc/src/vty/vty.c
@@ -13,12 +13,13 @@
 
 #include <arpa/telnet.h>
 
-#include "cardshell.h"
 #include <vty/vty.h>
 #include <vty/command.h>
 #include <vty/buffer.h>
 #include <osmocore/talloc.h>
 
+#define SYSCONFDIR "/usr/local/etc"
+
 /* our callback, located in telnet_interface.c */
 void vty_event(enum event event, int sock, struct vty *vty);
 
@@ -468,6 +469,7 @@
 	vty->hp = vty->hindex;
 }
 
+#define TELNET_OPTION_DEBUG
 /* Get telnet window size. */
 static int
 vty_telnet_option (struct vty *vty, unsigned char *buf, int nbytes)
@@ -1631,8 +1633,12 @@
 
 extern void *tall_bsc_ctx;
 /* Install vty's own commands like `who' command. */
-void vty_init()
+void vty_init(const char *name, const char *version, const char *copyright)
 {
+	host.prog_name = name;
+	host.prog_version = version;
+	host.prog_copyright = copyright;
+
 	tall_vty_ctx = talloc_named_const(NULL, 0, "vty");
 	tall_vty_vec_ctx = talloc_named_const(tall_vty_ctx, 0, "vty_vector");
 	tall_vty_cmd_ctx = talloc_named_const(tall_vty_ctx, 0, "vty_command");