| 1 | /* buildcmd.c -- build command lines from a list of arguments.
|
|---|
| 2 | Copyright (C) 1990, 91, 92, 93, 94, 2000, 2003, 2005 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This program is free software; you can redistribute it and/or modify
|
|---|
| 5 | it under the terms of the GNU General Public License as published by
|
|---|
| 6 | the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 7 | any later version.
|
|---|
| 8 |
|
|---|
| 9 | This program is distributed in the hope that it will be useful,
|
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | GNU General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU General Public License
|
|---|
| 15 | along with this program; if not, write to the Free Software
|
|---|
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|---|
| 17 | USA.
|
|---|
| 18 | */
|
|---|
| 19 |
|
|---|
| 20 | #include <config.h>
|
|---|
| 21 |
|
|---|
| 22 | # ifndef PARAMS
|
|---|
| 23 | # if defined PROTOTYPES || (defined __STDC__ && __STDC__)
|
|---|
| 24 | # define PARAMS(Args) Args
|
|---|
| 25 | # else
|
|---|
| 26 | # define PARAMS(Args) ()
|
|---|
| 27 | # endif
|
|---|
| 28 | # endif
|
|---|
| 29 |
|
|---|
| 30 | #if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
|
|---|
| 31 | #include <string.h>
|
|---|
| 32 | #endif
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 | #if DO_MULTIBYTE
|
|---|
| 36 | # if HAVE_MBRLEN
|
|---|
| 37 | # include <wchar.h>
|
|---|
| 38 | # else
|
|---|
| 39 | /* Simulate mbrlen with mblen as best we can. */
|
|---|
| 40 | # define mbstate_t int
|
|---|
| 41 | # define mbrlen(s, n, ps) mblen (s, n)
|
|---|
| 42 | # endif
|
|---|
| 43 | #endif
|
|---|
| 44 |
|
|---|
| 45 | #ifdef HAVE_LOCALE_H
|
|---|
| 46 | #include <locale.h>
|
|---|
| 47 | #endif
|
|---|
| 48 | #if ENABLE_NLS
|
|---|
| 49 | # include <libintl.h>
|
|---|
| 50 | # define _(Text) gettext (Text)
|
|---|
| 51 | #else
|
|---|
| 52 | # define _(Text) Text
|
|---|
| 53 | #define textdomain(Domain)
|
|---|
| 54 | #define bindtextdomain(Package, Directory)
|
|---|
| 55 | #endif
|
|---|
| 56 | #ifdef gettext_noop
|
|---|
| 57 | # define N_(String) gettext_noop (String)
|
|---|
| 58 | #else
|
|---|
| 59 | /* See locate.c for explanation as to why not use (String) */
|
|---|
| 60 | # define N_(String) String
|
|---|
| 61 | #endif
|
|---|
| 62 |
|
|---|
| 63 | #ifndef _POSIX_SOURCE
|
|---|
| 64 | #include <sys/param.h>
|
|---|
| 65 | #endif
|
|---|
| 66 |
|
|---|
| 67 | #ifdef HAVE_LIMITS_H
|
|---|
| 68 | #include <limits.h>
|
|---|
| 69 | #endif
|
|---|
| 70 |
|
|---|
| 71 | /* The presence of unistd.h is assumed by gnulib these days, so we
|
|---|
| 72 | * might as well assume it too.
|
|---|
| 73 | */
|
|---|
| 74 | /* for sysconf() */
|
|---|
| 75 | #include <unistd.h>
|
|---|
| 76 |
|
|---|
| 77 | #include <assert.h>
|
|---|
|
|---|