Imported Upstream version 2.74.3
[platform/upstream/glib.git] / glib / gshell.h
1 /* gshell.h - Shell-related utilities
2  *
3  *  Copyright 2000 Red Hat, Inc.
4  *
5  * SPDX-License-Identifier: LGPL-2.1-or-later
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #ifndef __G_SHELL_H__
22 #define __G_SHELL_H__
23
24 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
25 #error "Only <glib.h> can be included directly."
26 #endif
27
28 #include <glib/gerror.h>
29
30 G_BEGIN_DECLS
31
32 #define G_SHELL_ERROR g_shell_error_quark ()
33
34 typedef enum
35 {
36   /* mismatched or otherwise mangled quoting */
37   G_SHELL_ERROR_BAD_QUOTING,
38   /* string to be parsed was empty */
39   G_SHELL_ERROR_EMPTY_STRING,
40   G_SHELL_ERROR_FAILED
41 } GShellError;
42
43 GLIB_AVAILABLE_IN_ALL
44 GQuark g_shell_error_quark (void);
45
46 GLIB_AVAILABLE_IN_ALL
47 gchar*   g_shell_quote      (const gchar   *unquoted_string);
48 GLIB_AVAILABLE_IN_ALL
49 gchar*   g_shell_unquote    (const gchar   *quoted_string,
50                              GError       **error);
51 GLIB_AVAILABLE_IN_ALL
52 gboolean g_shell_parse_argv (const gchar   *command_line,
53                              gint          *argcp,
54                              gchar       ***argvp,
55                              GError       **error);
56
57 G_END_DECLS
58
59 #endif /* __G_SHELL_H__ */