ia64/xen-unstable

changeset 5855:82af26d5d134

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 <edwin.zhai@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Jul 25 21:02:50 2005 +0000 (2005-07-25)
parents 7ac99b43f879
children 4999a05b568f
files tools/ioemu/monitor.c
line diff
     1.1 --- a/tools/ioemu/monitor.c	Mon Jul 25 21:02:34 2005 +0000
     1.2 +++ b/tools/ioemu/monitor.c	Mon Jul 25 21:02:50 2005 +0000
     1.3 @@ -514,21 +514,45 @@ static void monitor_handle_command(const
     1.4                  str_allocated[nb_args] = str;
     1.5              add_str:
     1.6                  if (nb_args >= MAX_ARGS) {
     1.7 -#if 0
     1.8                  error_args:
     1.9 -#endif
    1.10                      term_printf("%s: too many arguments\n", cmdname);
    1.11                      goto fail;
    1.12                  }
    1.13                  args[nb_args++] = str;
    1.14              }
    1.15              break;
    1.16 +        case '-':
    1.17 +            {
    1.18 +                int has_option;
    1.19 +                /* option */
    1.20 +                
    1.21 +                c = *typestr++;
    1.22 +                if (c == '\0')
    1.23 +                    goto bad_type;
    1.24 +                while (isspace(*p)) 
    1.25 +                    p++;
    1.26 +                has_option = 0;
    1.27 +                if (*p == '-') {
    1.28 +                    p++;
    1.29 +                    if (*p != c) {
    1.30 +                        term_printf("%s: unsupported option -%c\n", 
    1.31 +                                    cmdname, *p);
    1.32 +                        goto fail;
    1.33 +                    }
    1.34 +                    p++;
    1.35 +                    has_option = 1;
    1.36 +                }
    1.37 +                if (nb_args >= MAX_ARGS)
    1.38 +                    goto error_args;
    1.39 +                args[nb_args++] = (void *)has_option;
    1.40 +            }
    1.41 +            break;
    1.42          /* TODO: add more commands we need here to support vmx device model */
    1.43          case '/':
    1.44          case 'i':
    1.45 -        case '-':
    1.46          default:
    1.47 -            term_printf("%s: unknown type '%c', we only support quit command now.\n", cmdname, c);
    1.48 +        bad_type:
    1.49 +            term_printf("%s: unknown type '%c',not support now.\n", cmdname, c);
    1.50              goto fail;
    1.51          }
    1.52      }