[PATCH] find: First implementation

Bob Wya bob.mt.wya at gmail.com
Fri Nov 1 08:22:33 CDT 2019


On Fri, 25 Oct 2019 at 17:56, Fabian Maurer <dark.shadow4 at web.de> wrote:

> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44975
> Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
> ---
>
>  ...

> +static BOOL read_char_from_handle(HANDLE handle, char *char_out)
> +{
> +    static char buffer[4096];
> +    static UINT buffer_max = 0;
> +    static UINT buffer_pos = 0;
> +
> +    /* Read next content into buffer */
> +    if (buffer_pos >= buffer_max)
> +    {
> +        BOOL success = ReadFile(handle, buffer, 4096, &buffer_max, NULL);
> +        if (!success)
> +            return FALSE;
> +        buffer_pos = 0;
> +    }
>
> ...

That condition might (??) want to be something like (perhaps also testing
if the handle is: STD_INPUT_HANDLE):

+        if (!success || !buffer_max)

otherwise your find implementation hangs for me with:

echo abc def | find "abc"


Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20191101/6db425cf/attachment.htm>


More information about the wine-devel mailing list