annotate lib/system-quote.h @ 40231:9b3c79fdfe0b

strtod: fix clash with strtold Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817). * lib/strtod.c (compute_minus_zero, minus_zero): Simplify by remving the macro / external variable, and having just a function. User changed. This avoids the need for an external variable that might clash.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 11 Mar 2019 16:40:29 -0700
parents b06060465f09
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16841
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Quoting for a system command.
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19595
diff changeset
2 Copyright (C) 2001-2019 Free Software Foundation, Inc.
16841
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 Written by Bruno Haible <bruno@clisp.org>, 2012.
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 (at your option) any later version.
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
19190
9759915b2aca all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 18626
diff changeset
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16841
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #ifndef _SYSTEM_QUOTE_H
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #define _SYSTEM_QUOTE_H
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 /* When passing a command the system's command interpreter, we must quote the
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 program name and arguments, since
16848
ae444fc80840 sh-quote, system-quote: Add comments about wildcards.
Bruno Haible <bruno@clisp.org>
parents: 16844
diff changeset
23 - Unix shells interpret characters like " ", "'", "<", ">", "$", '*', '?'
ae444fc80840 sh-quote, system-quote: Add comments about wildcards.
Bruno Haible <bruno@clisp.org>
parents: 16844
diff changeset
24 etc. in a special way,
16841
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 - Windows CreateProcess() interprets characters like ' ', '\t', '\\', '"'
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 etc. (but not '<' and '>') in a special way,
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 - Windows cmd.exe also interprets characters like '<', '>', '&', '%', etc.
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 in a special way. Note that it is impossible to pass arguments that
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 contain newlines or carriage return characters to programs through
16848
ae444fc80840 sh-quote, system-quote: Add comments about wildcards.
Bruno Haible <bruno@clisp.org>
parents: 16844
diff changeset
30 cmd.exe.
ae444fc80840 sh-quote, system-quote: Add comments about wildcards.
Bruno Haible <bruno@clisp.org>
parents: 16844
diff changeset
31 - Windows programs usually perform wildcard expansion when they receive
16849
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
32 arguments that contain unquoted '*', '?' characters.
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
33
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
34 With this module, you can build a command that will invoke a program with
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
35 specific strings as arguments.
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
36
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
37 Note: If you want wildcard expansion to happen, you have to first do wildcard
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
38 expansion through the 'glob' module, then quote the resulting strings through
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
39 this module, and then invoke the system's command interpreter.
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
40
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
41 Limitations:
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
42 - When invoking native Windows programs on Windows Vista or newer,
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
43 wildcard expansion will occur in the invoked program nevertheless.
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
44 - On native Windows, for SCI_SYSTEM and SCI_WINDOWS_CMD, newlines and
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
45 carriage return characters are not supported. Their undesired effect
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
46 is to truncate the entire command line.
1aa668619908 system-quote: Add more comments.
Bruno Haible <bruno@clisp.org>
parents: 16848
diff changeset
47 */
16841
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 #include <stddef.h>
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 #ifdef __cplusplus
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 extern "C" {
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 #endif
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 /* Identifier for the kind of interpreter of the command. */
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 enum system_command_interpreter
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 {
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 /* The interpreter used by the system() and popen() functions.
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 This is equivalent to SCI_POSIX_SH on Unix platforms and
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 SCI_WINDOWS_CMD on native Windows platforms. */
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 SCI_SYSTEM = 0
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 /* The POSIX /bin/sh. */
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 , SCI_POSIX_SH = 1
19595
beb2ad957aca Simplify code. Drop support for Borland C++ on Windows.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
64 #if defined _WIN32 && ! defined __CYGWIN__
16841
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 /* The native Windows CreateProcess() function. */
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 , SCI_WINDOWS_CREATEPROCESS = 2
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67 /* The native Windows cmd.exe interpreter. */
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 , SCI_WINDOWS_CMD = 3
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 #endif
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 };
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 /* Returns the number of bytes needed for the quoted string. */
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 extern size_t
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 system_quote_length (enum system_command_interpreter interpreter,
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75 const char *string);
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 /* Copies the quoted string to p and returns the incremented p.
16844
d6e95ab13906 system-quote: Refactor.
Bruno Haible <bruno@clisp.org>
parents: 16841
diff changeset
78 There must be room for system_quote_length (string) + 1 bytes at p. */
16841
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 extern char *
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 system_quote_copy (char *p,
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 enum system_command_interpreter interpreter,
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
82 const char *string);
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
83
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
84 /* Returns the freshly allocated quoted string. */
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 extern char *
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86 system_quote (enum system_command_interpreter interpreter,
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87 const char *string);
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89 /* Returns a freshly allocated string containing all argument strings, quoted,
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 separated through spaces. */
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 extern char *
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 system_quote_argv (enum system_command_interpreter interpreter,
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 char * const *argv);
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 #ifdef __cplusplus
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96 }
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 #endif
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
98
afc7e3b9f04a New module 'system-quote'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 #endif /* _SYSTEM_QUOTE_H */