cmd: Check for argument in copy, mkdir, delete, goto, move, rmdir, rename, type.

Alexandre Julliard julliard at winehq.org
Tue Oct 31 13:35:28 CST 2006


Markus Amsler <markus.amsler at oribi.org> writes:

> This fixes bug http://bugs.winehq.org/show_bug.cgi?id=6286
> ---
>  programs/cmd/builtins.c |   22 ++++++++++++++++++++++
>  1 files changed, 22 insertions(+), 0 deletions(-)
> diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
> index 3329a0b..0732170 100644
> --- a/programs/cmd/builtins.c
> +++ b/programs/cmd/builtins.c
> @@ -36,6 +36,12 @@ #define WIN32_LEAN_AND_MEAN
>  
>  #include "wcmd.h"
>  
> +#define CHECK_FOR_ARGUMENT \
> +  if (param1[0] == 0x00) { \
> +    WCMD_output ("Argument missing\n"); \
> +    return; \
> +  }
> +
>  void WCMD_execute (char *orig_command, char *parameter, char *substitution);
>  
>  struct env_stack
> @@ -110,6 +116,8 @@ BOOL force, status;
>  static const char overwrite[] = "Overwrite file (Y/N)?";
>  char string[8], outpath[MAX_PATH], inpath[MAX_PATH], *infile;
>  
> +  CHECK_FOR_ARGUMENT
> +
>    if ((strchr(param1,'*') != NULL) && (strchr(param1,'%') != NULL)) {

This is ugly, you should use a normal function instead of a macro and
do the return explicitly instead of hiding it in the macro (or even
put the code in as is, it's only a couple of lines).

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list