Skip to content

Commit ffd9013

Browse files
acornardmurlock
authored andcommitted
Fix usage formatting issues and default socket path
1 parent cf8180c commit ffd9013

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

main/gridinit.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ static void servers_ensure(void);
112112

113113
static GOptionEntry entries[] = {
114114
{"daemonize", 'd', 0, G_OPTION_ARG_NONE, (gboolean *)&flag_daemon,
115-
"Detaches then daemonizes the gridinit \n", NULL},
115+
"Detaches then daemonizes the gridinit", NULL},
116116
{"group", 'g', 0, G_OPTION_ARG_STRING_ARRAY, &groups_only_cli,
117117
"limits the services loading to those belonging to the specified"
118-
"group. This option can be repeated\n", "GROUP"},
118+
"group. This option can be repeated", "GROUP"},
119119
{"quiet", 'q', 0, G_OPTION_ARG_NONE, (gboolean *)&flag_quiet,
120120
"quiet mode, suppress non-error output",NULL},
121121
{"version", 'V', 0, G_OPTION_ARG_NONE, (gboolean *)&flag_version,
@@ -1794,6 +1794,8 @@ __parse_options(int argc, char ** args)
17941794
g_print("option parsing failed: %s\n", error_local->message);
17951795
gchar *usage = g_option_context_get_help (context, TRUE, NULL);
17961796
g_print("%s", usage);
1797+
exit(1);
1798+
return;
17971799
}
17981800

17991801
if (flag_more_verbose)

main/gridinit_cmd.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
4444
#define MEDIUM 1
4545

4646

47-
static gchar *sock_path;
47+
static gchar *sock_path = NULL;
4848
static gchar line[65536];
4949
static gboolean flag_color = FALSE;
50-
static gchar *format;
50+
static gchar *format = NULL;
5151
static gboolean flag_version = FALSE;
5252
#define BOOL(i) (i?1:0)
5353

@@ -118,11 +118,11 @@ static struct keyword_set_s KEYWORDS_COLOR = {
118118

119119
static GOptionEntry entries[] = {
120120
{"color", 'c', 0, G_OPTION_ARG_NONE, &flag_color,
121-
"coloured display \n", NULL},
121+
"coloured display ", NULL},
122122
{"sock-path", 'S', 0, G_OPTION_ARG_FILENAME, &sock_path,
123-
"explicit unix socket path\n", "SOCKET"},
123+
"explicit unix socket path", "SOCKET"},
124124
{"format", 'f', 0, G_OPTION_ARG_STRING, &format,
125-
"output result by given FORMAT","FORMAT"},
125+
"output result by given FORMAT. Available FORMAT value are yaml, csv or json","FORMAT"},
126126
{"version", 'v', 0, G_OPTION_ARG_NONE, &flag_version,
127127
"Display the version of gridinit_cmd", NULL},
128128
{NULL}
@@ -679,6 +679,8 @@ main_options(int argc, char **args)
679679
GError *error = NULL;
680680
GOptionContext *context;
681681

682+
sock_path = g_strdup(GRIDINIT_SOCK_PATH);
683+
682684
context = g_option_context_new("(status{,2,3}|start|stop|reload|repair) [ID...]\n");
683685
g_option_context_add_main_entries(context, entries, NULL);
684686
if (!g_option_context_parse(context, &argc, &args, &error)) {

0 commit comments

Comments
 (0)