/* * virsh.c: a Xen shell used to exercise the libvir API * * Copyright (C) 2005 Red Hat, Inc. * * See COPYING.LIB for the License of this software * * Daniel Veillard */ #define _GNU_SOURCE /* isblank() */ #include "libvir.h" #include #include #include #include #include #include #include #include #include #include #include "config.h" static char *progname; #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif #define VSH_PROMPT_RW "virsh # " #define VSH_PROMPT_RO "virsh > " #define GETTIMEOFDAY(T) gettimeofday(T, NULL) #define DIFF_MSEC(T, U) \ ((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0 + \ ((int) ((T)->tv_usec - (U)->tv_usec))) / 1000.0) typedef enum { VSH_MESG, /* standard output */ VSH_HEADER, /* header for standard output */ VSH_FOOTER, /* timing, last command state, or whatever */ VSH_DEBUG1, /* debugN where 'N' = level */ VSH_DEBUG2, VSH_DEBUG3, VSH_DEBUG4, VSH_DEBUG5 } vshOutType; /* * virsh command line grammar: * * command_line = \n | ; ; ... * * command =