From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arun Sharma Subject: [PATCH][6/9] Restore command line parsing code from qemu-0.6.1 Date: Mon, 25 Jul 2005 14:01:25 -0700 Message-ID: <20050725210125.GA24385@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Pratt , Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Restore command line parsing code from qemu-0.6.1 This enables cdrom ejection (both file based and physical i.e. /dev/cdrom) Signed-off-by: Edwin Zhai Signed-off-by: Arun Sharma diff -r 4499d41c8941 -r 640ee1c33782 tools/ioemu/monitor.c --- a/tools/ioemu/monitor.c Mon Jul 18 20:13:53 2005 +++ b/tools/ioemu/monitor.c Mon Jul 18 20:59:46 2005 @@ -514,21 +514,45 @@ str_allocated[nb_args] = str; add_str: if (nb_args >= MAX_ARGS) { -#if 0 error_args: -#endif term_printf("%s: too many arguments\n", cmdname); goto fail; } args[nb_args++] = str; } break; + case '-': + { + int has_option; + /* option */ + + c = *typestr++; + if (c == '\0') + goto bad_type; + while (isspace(*p)) + p++; + has_option = 0; + if (*p == '-') { + p++; + if (*p != c) { + term_printf("%s: unsupported option -%c\n", + cmdname, *p); + goto fail; + } + p++; + has_option = 1; + } + if (nb_args >= MAX_ARGS) + goto error_args; + args[nb_args++] = (void *)has_option; + } + break; /* TODO: add more commands we need here to support vmx device model */ case '/': case 'i': - case '-': default: - term_printf("%s: unknown type '%c', we only support quit command now.\n", cmdname, c); + bad_type: + term_printf("%s: unknown type '%c',not support now.\n", cmdname, c); goto fail; } }