]> git.proxmox.com Git - mirror_frr.git/blobdiff - tests/lib/cli/common_cli.c
*: make consistent & update GPLv2 file headers
[mirror_frr.git] / tests / lib / cli / common_cli.c
index ad9658f95f790450bdaa1fc6706b5885a751380c..7825564e542707f7abace90aa1358221f2632d97 100644 (file)
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with Quagga; see the file COPYING.  If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
 struct thread_master *master;
 
 int dump_args(struct vty *vty, const char *descr,
-              int argc, const char **argv)
+              int argc, struct cmd_token *argv[])
 {
   int i;
   vty_out (vty, "%s with %d args.%s", descr, argc, VTY_NEWLINE);
   for (i = 0; i < argc; i++)
     {
-      vty_out (vty, "[%02d]: %s%s", i, argv[i], VTY_NEWLINE);
+      vty_out (vty, "[%02d]: %s%s", i, argv[i]->arg, VTY_NEWLINE);
     }
 
   return CMD_SUCCESS;
@@ -49,6 +48,12 @@ int dump_args(struct vty *vty, const char *descr,
 static void vty_do_exit(void)
 {
   printf ("\nend.\n");
+  cmd_terminate ();
+  vty_terminate ();
+  thread_master_free (master);
+  closezlog ();
+
+  log_memstats_stderr ("testcli");
   exit (0);
 }
 
@@ -64,20 +69,20 @@ main (int argc, char **argv)
   /* master init. */
   master = thread_master_create ();
 
-  zlog_default = openzlog ("common-cli", ZLOG_NONE, 0,
-                           LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
-  zlog_set_level (NULL, ZLOG_DEST_SYSLOG, ZLOG_DISABLED);
-  zlog_set_level (NULL, ZLOG_DEST_STDOUT, ZLOG_DISABLED);
-  zlog_set_level (NULL, ZLOG_DEST_MONITOR, LOG_DEBUG);
+  openzlog("common-cli", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID,
+           LOG_DAEMON);
+  zlog_set_level(ZLOG_DEST_SYSLOG, ZLOG_DISABLED);
+  zlog_set_level(ZLOG_DEST_STDOUT, ZLOG_DISABLED);
+  zlog_set_level(ZLOG_DEST_MONITOR, LOG_DEBUG);
 
   /* Library inits. */
   cmd_init (1);
-  host.name = strdup ("test");
+  cmd_hostname_set ("test");
 
   vty_init (master);
   memory_init ();
 
-  test_init ();
+  test_init (argc, argv);
 
   vty_stdio (vty_do_exit);