Skip to content

Commit bc8518f

Browse files
committed
gridinit_cmd: Remove yaml (already unsupported)
1 parent 64ddadd commit bc8518f

File tree

2 files changed

+3
-51
lines changed

2 files changed

+3
-51
lines changed

main/format_output.c

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ parse_format(gchar *format)
2424
return JSON;
2525
if (g_strcmp0(format, "csv") == 0)
2626
return CSV;
27-
#if 0
28-
if (g_strcmp0(format, "yaml") == 0)
29-
return YAML;
30-
#endif
3127
else
3228
return DEFAULT;
3329
}
@@ -49,25 +45,6 @@ print_as_json(gchar *status, gchar *start, gchar *error, gboolean first)
4945
fprintf(stdout, "%s", footer);
5046
}
5147

52-
void
53-
print_as_yaml(gchar *status, gchar *start, gchar *error, gboolean first)
54-
{
55-
gchar header[] = " {\n";
56-
gchar footer[] = " }";
57-
gchar tab[] = " ";
58-
59-
if(!first)
60-
fprintf(stdout, ",\n");
61-
62-
fprintf(stdout, "%s", header);
63-
fprintf(stdout, "%sstatus: %s,\n", tab, status);
64-
fprintf(stdout, "%sstart: %s,\n", tab, start);
65-
fprintf(stdout, "%serror: %s\n", tab, error);
66-
fprintf(stdout, "%s", footer);
67-
}
68-
69-
70-
7148
void
7249
print_as_csv(gchar *status, gchar *start, gchar *error)
7350
{
@@ -80,7 +57,6 @@ print_header(FORMAT format)
8057
{
8158
switch (format) {
8259
case JSON:
83-
case YAML:
8460
fprintf(stdout, "[\n");
8561
break;
8662
case CSV:
@@ -96,7 +72,6 @@ print_footer(FORMAT format)
9672
{
9773
switch (format) {
9874
case JSON:
99-
case YAML:
10075
fprintf(stdout, "\n]\n");
10176
break;
10277
default:
@@ -106,17 +81,15 @@ print_footer(FORMAT format)
10681
}
10782

10883
void
109-
print_body(FORMAT format, gchar *status, gchar *start, gchar *error, gboolean first){
84+
print_body(FORMAT format, gchar *status, gchar *start, gchar *error, gboolean first)
85+
{
11086
switch (format) {
11187
case JSON:
11288
print_as_json(status, start, error, first);
11389
break;
11490
case CSV:
11591
print_as_csv(status, start, error);
11692
break;
117-
case YAML:
118-
print_as_yaml(status, start, error, first);
119-
break;
12093
default:
12194
fprintf(stdout, "%s\t%s\t%s\n", status, start, error);
12295
}
@@ -127,9 +100,6 @@ print_status_header(FORMAT format)
127100
{
128101
switch (format) {
129102
case JSON:
130-
case YAML:
131-
fprintf(stdout, "[\n");
132-
break;
133103
case CSV:
134104
fprintf(stdout,
135105
"key,status,pid,#start,#died,csz,ssz,mfd,since,group,cmd\n");
@@ -152,18 +122,6 @@ status_body_json(gchar *fmt_line, int size)
152122
}
153123

154124

155-
void
156-
status_body_yaml(gchar *fmt_line, int size)
157-
{
158-
g_snprintf(fmt_line, size,
159-
" {\n key: %%s,\n status: %%s,"
160-
"\n pid: %%d,\n #start: %%d,"
161-
"\n #died: %%d,\n csz: %%ld,"
162-
"\n ssz: %%ld,\n mfd: %%ld,"
163-
"\n since: %%s,\n group: %%s,"
164-
"\n cmd: %%s\n }");
165-
}
166-
167125
void
168126
status_body_csv(gchar *fmt_line, int size)
169127
{
@@ -176,7 +134,6 @@ print_status_sep(FORMAT format, int count)
176134
{
177135
switch (format) {
178136
case JSON:
179-
case YAML:
180137
if(count)
181138
fprintf(stdout, ",\n");
182139
default:
@@ -194,9 +151,6 @@ get_line_format(FORMAT format, gchar *fmt_line, int size)
194151
case CSV:
195152
status_body_csv(fmt_line, size);
196153
break;
197-
case YAML:
198-
status_body_yaml(fmt_line, size);
199-
break;
200154
default:
201155
break;
202156
}

main/format_output.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
# include <glib.h>
2020

2121
typedef enum FORMAT FORMAT;
22-
enum FORMAT {CSV, JSON, YAML, DEFAULT};
22+
enum FORMAT {DEFAULT = 0, CSV = 1, JSON = 2};
2323

2424
FORMAT parse_format(gchar *format);
2525
void print_as_json(gchar *status, gchar *start, char *error, gboolean first);
26-
void print_as_yaml(gchar *status, gchar *start, char *error, gboolean first);
2726
void print_as_csv(gchar *status, gchar *start, char *error);
2827
void print_header(FORMAT format);
2928
void print_footer(FORMAT format);
3029
void print_body(FORMAT format, gchar *status, gchar *start, gchar *error, gboolean first);
3130
void print_status_header(FORMAT format);
3231
void status_body_json(gchar *fmt_line, int size);
33-
void status_body_yaml(gchar *fmt_line, int size);
3432
void status_body_csv(gchar *fmt_line, int size);
3533
void print_status_sep(FORMAT format, int count);
3634
void get_line_format(FORMAT format, gchar *fmt_line, int size);

0 commit comments

Comments
 (0)