bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Global/Win32] I hope to add --max-args option to htags.


From: Shigio Yamaguchi
Subject: Re: [Global/Win32] I hope to add --max-args option to htags.
Date: Thu, 01 Jun 2006 08:09:06 +0900

>   OK, I found out limit length.  The limit lenght is 2047 characters
> on Windows 2000 or 8191 characters on Windows XP and later.

I have modified exec_line_limit() in libutil/xargs.c.
But I cannot test it, because I don't have win32 environment.
Could you please test it in your machine?
If there is no problem, I will reflect it to the CVS repository.

[exec_line_limit() libutil/xargs.c]
/*
 * exec_line_limit: upper limit of bytes of exec line.
 *
 *      i)      length  command line length
 *      r)      0: unknown or cannot afford long line.
 *              > 0: upper limit of exec line
 */
static int
exec_line_limit(int length)
{
        int limit = 0;

#ifdef ARG_MAX
        /*
         * POSIX.2 limits the exec(2) line length to ARG_MAX - 2048.
         */
        limit = ARG_MAX - 2048;
        /*
         * The reason is unknown but the xargs(1) in GNU findutils
         * use this limit.
         */
        if (limit > 20 * 1024)
                limit = 20 * 1024;
        /*
         * Add the command line length.
         * We estimates additional 80 bytes for popen(3).
         *
         * for "/bin/sh -c "                            11bytes
         * reserve                                      69bytes
         * ----------------------------------------------------
         * Total                                        80 bytes
         */
        limit -= length + 80;

        limit -= env_size();
#endif
#if !defined(ARG_MAX) && defined(_WIN32)
        /*
         * The limit lenght of the command line of cmd.exe is 2047
         * characters on Windows 2000 or 8191 characters on Windows XP
         * and later. The 80 below is for safety.
         */
        limit = 2047 - length - 80;
#endif
        if (limit < 0)
                limit = 0;
        return limit;
}
--
Shigio YAMAGUCHI <address@hidden> - Tama Communications Corporation
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]