~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/clients/qrstat/qrstat_report_handler_stdout.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*___INFO__MARK_BEGIN__*/
 
2
/*************************************************************************
 
3
 * 
 
4
 *  The Contents of this file are made available subject to the terms of
 
5
 *  the Sun Industry Standards Source License Version 1.2
 
6
 * 
 
7
 *  Sun Microsystems Inc., March, 2001
 
8
 * 
 
9
 * 
 
10
 *  Sun Industry Standards Source License Version 1.2
 
11
 *  =================================================
 
12
 *  The contents of this file are subject to the Sun Industry Standards
 
13
 *  Source License Version 1.2 (the "License"); You may not use this file
 
14
 *  except in compliance with the License. You may obtain a copy of the
 
15
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
16
 * 
 
17
 *  Software provided under this License is provided on an "AS IS" basis,
 
18
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
19
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
20
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
21
 *  See the License for the specific provisions governing your rights and
 
22
 *  obligations concerning the Software.
 
23
 * 
 
24
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
25
 * 
 
26
 *   Copyright: 2001 by Sun Microsystems, Inc.
 
27
 * 
 
28
 *   All Rights Reserved.
 
29
 * 
 
30
 ************************************************************************/
 
31
/*___INFO__MARK_END__*/
 
32
 
 
33
#include <string.h>
 
34
 
 
35
#include "basis_types.h"
 
36
#include "sge.h"
 
37
#include "sgermon.h"
 
38
 
 
39
#include "sgeobj/sge_answer.h"
 
40
#include "sgeobj/sge_advance_reservation.h"
 
41
 
 
42
#include "qrstat_filter.h"
 
43
#include "qrstat_report_handler.h"
 
44
#include "qrstat_report_handler_xml.h"
 
45
 
 
46
#include "msg_common.h"
 
47
 
 
48
#define SFN_FIRST_COLUMN "%-30.30s"
 
49
 
 
50
static bool
 
51
qrstat_report_start(qrstat_report_handler_t* handler, lList **alpp);
 
52
 
 
53
static bool
 
54
qrstat_report_finish(qrstat_report_handler_t* handler, lList **alpp);
 
55
 
 
56
static bool
 
57
qrstat_report_start_ar(qrstat_report_handler_t* handler, qrstat_env_t *qrstat_env, lList **alpp);
 
58
 
 
59
static bool
 
60
qrstat_report_start_unknown_ar(qrstat_report_handler_t* handler, qrstat_env_t *qrstat_env, lList **alpp);
 
61
 
 
62
static bool
 
63
qrstat_report_finish_ar(qrstat_report_handler_t* handler, lList **alpp);
 
64
 
 
65
static bool
 
66
qrstat_report_finish_unknown_ar(qrstat_report_handler_t* handler, lList **alpp);
 
67
 
 
68
static bool
 
69
qrstat_report_ar_node_ulong(qrstat_report_handler_t* handler, qrstat_env_t *qrstat_env, lList **alpp,
 
70
                                const char *name, u_long32 value);
 
71
 
 
72
static bool
 
73
qrstat_report_ar_node_ulong_unknown(qrstat_report_handler_t* handler, qrstat_env_t *qrstat_env, lList **alpp,
 
74
                                const char *name, u_long32 value);
 
75
 
 
76
static bool
 
77
qrstat_report_ar_node_duration(qrstat_report_handler_t* handler, lList **alpp,
 
78
                               const char *name, u_long32 value);
 
79
 
 
80
static bool
 
81
qrstat_report_ar_node_string(qrstat_report_handler_t* handler, lList **alpp,
 
82
                             const char *name, const char *value);
 
83
 
 
84
static bool
 
85
qrstat_report_ar_node_time(qrstat_report_handler_t* handler, lList **alpp,
 
86
                           const char *name, time_t value);
 
87
 
 
88
static bool
 
89
qrstat_report_ar_node_state(qrstat_report_handler_t* handler, lList **alpp,
 
90
                                const char *name, u_long32 value);
 
91
 
 
92
static bool
 
93
qrstat_report_start_resource_list(qrstat_report_handler_t* handler, lList **alpp);
 
94
 
 
95
static bool
 
96
qrstat_report_finish_resource_list(qrstat_report_handler_t* handler, lList **alpp);
 
97
 
 
98
static bool
 
99
qrstat_report_resource_list_node(qrstat_report_handler_t* handler, lList **alpp,
 
100
                                     const char *name, const char *value);
 
101
 
 
102
static bool
 
103
qrstat_report_ar_node_boolean(qrstat_report_handler_t* handler, lList **alpp,
 
104
                               const char *name, bool value);
 
105
 
 
106
static bool
 
107
qrstat_report_start_granted_slots_list(qrstat_report_handler_t* handler, lList **alpp);
 
108
 
 
109
static bool
 
110
qrstat_report_finish_granted_slots_list(qrstat_report_handler_t* handler, lList **alpp);
 
111
 
 
112
static bool
 
113
qrstat_report_granted_slots_list_node(qrstat_report_handler_t* handler,
 
114
                                          lList **alpp,
 
115
                                          const char *name, u_long32 value);
 
116
 
 
117
static bool
 
118
qrstat_report_start_granted_parallel_environment(qrstat_report_handler_t* handler, lList **alpp);
 
119
 
 
120
static bool
 
121
qrstat_report_finish_granted_parallel_environment(qrstat_report_handler_t* handler, lList **alpp);
 
122
 
 
123
static bool
 
124
qrstat_report_granted_parallel_environment_node(qrstat_report_handler_t* handler,
 
125
                                                    lList **alpp,
 
126
                                                    const char *name, const char *slots_range);
 
127
static bool
 
128
qrstat_report_start_mail_list(qrstat_report_handler_t* handler, lList **alpp);
 
129
 
 
130
static bool
 
131
qrstat_report_finish_mail_list(qrstat_report_handler_t* handler, lList **alpp);
 
132
 
 
133
static bool
 
134
qrstat_report_mail_list_node(qrstat_report_handler_t* handler,
 
135
                             lList **alpp,
 
136
                             const char *name, const char *hostname);
 
137
 
 
138
static bool
 
139
qrstat_report_start_acl_list(qrstat_report_handler_t* handler, lList **alpp);
 
140
 
 
141
static bool
 
142
qrstat_report_finish_acl_list(qrstat_report_handler_t* handler, lList **alpp);
 
143
 
 
144
static bool
 
145
qrstat_report_acl_list_node(qrstat_report_handler_t* handler,
 
146
                            lList **alpp, const char *name);
 
147
 
 
148
static bool
 
149
qrstat_report_start_xacl_list(qrstat_report_handler_t* handler, lList **alpp);
 
150
 
 
151
static bool
 
152
qrstat_report_finish_xacl_list(qrstat_report_handler_t* handler, lList **alpp);
 
153
 
 
154
static bool
 
155
qrstat_report_xacl_list_node(qrstat_report_handler_t* handler,
 
156
                             lList **alpp, const char *name);
 
157
 
 
158
static bool
 
159
qrstat_report_newline(qrstat_report_handler_t* handler, lList **alpp);
 
160
 
 
161
 
 
162
qrstat_report_handler_t *
 
163
qrstat_create_report_handler_stdout(qrstat_env_t *qrstat_env, 
 
164
                                    lList **answer_list)
 
165
{
 
166
   qrstat_report_handler_t* ret = NULL;
 
167
 
 
168
   DENTER(TOP_LAYER, "qrstat_create_report_handler_stdout");
 
169
 
 
170
   ret = (qrstat_report_handler_t*)sge_malloc(sizeof(qrstat_report_handler_t));
 
171
   if (ret == NULL) {
 
172
      answer_list_add_sprintf(answer_list, STATUS_EMALLOC, ANSWER_QUALITY_ERROR,
 
173
                              MSG_MEM_MEMORYALLOCFAILED_S, SGE_FUNC);      
 
174
   } else {
 
175
     /*
 
176
      * report handler ctx is stdout 
 
177
      */
 
178
      ret->ctx = stdout;
 
179
 
 
180
      ret->show_summary = qrstat_env->is_summary;
 
181
 
 
182
      ret->report_start = qrstat_report_start;
 
183
      ret->report_finish = qrstat_report_finish;
 
184
      ret->report_start_ar = qrstat_report_start_ar;
 
185
      ret->report_start_unknown_ar = qrstat_report_start_unknown_ar;
 
186
      ret->report_finish_ar = qrstat_report_finish_ar;
 
187
      ret->report_finish_unknown_ar = qrstat_report_finish_unknown_ar;
 
188
      ret->report_ar_node_ulong = qrstat_report_ar_node_ulong;
 
189
      ret->report_ar_node_ulong_unknown = qrstat_report_ar_node_ulong_unknown;
 
190
      ret->report_ar_node_duration = qrstat_report_ar_node_duration;
 
191
      ret->report_ar_node_string = qrstat_report_ar_node_string;
 
192
      ret->report_ar_node_time = qrstat_report_ar_node_time;
 
193
      ret->report_ar_node_state = qrstat_report_ar_node_state;
 
194
 
 
195
      ret->report_start_resource_list = qrstat_report_start_resource_list;
 
196
      ret->report_finish_resource_list = qrstat_report_finish_resource_list;
 
197
      ret->report_resource_list_node = qrstat_report_resource_list_node;
 
198
      
 
199
      ret->report_ar_node_boolean = qrstat_report_ar_node_boolean;
 
200
 
 
201
      ret->report_start_granted_slots_list = qrstat_report_start_granted_slots_list;
 
202
      ret->report_finish_granted_slots_list = qrstat_report_finish_granted_slots_list;
 
203
      ret->report_granted_slots_list_node = qrstat_report_granted_slots_list_node;
 
204
 
 
205
      ret->report_start_granted_parallel_environment = qrstat_report_start_granted_parallel_environment;
 
206
      ret->report_finish_granted_parallel_environment = qrstat_report_finish_granted_parallel_environment;
 
207
      ret->report_granted_parallel_environment_node = qrstat_report_granted_parallel_environment_node;
 
208
 
 
209
      ret->report_start_mail_list = qrstat_report_start_mail_list;
 
210
      ret->report_finish_mail_list = qrstat_report_finish_mail_list;
 
211
      ret->report_mail_list_node = qrstat_report_mail_list_node;
 
212
 
 
213
      ret->report_start_acl_list = qrstat_report_start_acl_list;
 
214
      ret->report_finish_acl_list = qrstat_report_finish_acl_list;
 
215
      ret->report_acl_list_node = qrstat_report_acl_list_node;
 
216
 
 
217
      ret->report_start_xacl_list = qrstat_report_start_xacl_list;
 
218
      ret->report_finish_xacl_list = qrstat_report_finish_xacl_list;
 
219
      ret->report_xacl_list_node = qrstat_report_xacl_list_node;
 
220
      ret->report_newline = qrstat_report_newline;
 
221
   }
 
222
 
 
223
   DRETURN(ret);
 
224
}
 
225
 
 
226
bool
 
227
qrstat_destroy_report_handler_stdout(qrstat_report_handler_t** handler, lList **answer_list)
 
228
{
 
229
   bool ret = true;
 
230
 
 
231
   DENTER(TOP_LAYER, "qrstat_destroy_report_handler");
 
232
 
 
233
   if (handler != NULL && *handler != NULL ) {
 
234
      FREE(*handler);
 
235
   }
 
236
 
 
237
   DRETURN(ret);
 
238
}
 
239
 
 
240
static bool
 
241
qrstat_report_start(qrstat_report_handler_t* handler, lList **alpp) 
 
242
{
 
243
   bool ret = true;
 
244
 
 
245
   DENTER(TOP_LAYER, "qrstat_report_start");
 
246
   DRETURN(ret); 
 
247
}
 
248
 
 
249
static bool
 
250
qrstat_report_finish(qrstat_report_handler_t* handler, lList **alpp)
 
251
{
 
252
   bool ret = true;
 
253
 
 
254
   DENTER(TOP_LAYER, "qrstat_report_finish");
 
255
   DRETURN(ret); 
 
256
}
 
257
 
 
258
static bool
 
259
qrstat_report_start_ar(qrstat_report_handler_t* handler, qrstat_env_t *qrstat_env, lList **alpp) 
 
260
{
 
261
   bool ret = true;
 
262
   FILE *out = (FILE*)handler->ctx;
 
263
 
 
264
   DENTER(TOP_LAYER, "qrstat_report_start");
 
265
 
 
266
   if (handler->show_summary == false) {
 
267
      fprintf(out, "----------");
 
268
      fprintf(out, "----------");
 
269
      fprintf(out, "----------");
 
270
      fprintf(out, "----------");
 
271
      fprintf(out, "----------");
 
272
      fprintf(out, "----------");
 
273
      fprintf(out, "----------");
 
274
      fprintf(out, "----------\n");
 
275
   } else if (!qrstat_env->header_printed) {
 
276
      const char *head_format = "%-7.7s %-10.10s %-12.12s %-5.5s %-20.20s %-20.20s %8s\n";
 
277
 
 
278
      fprintf(out, head_format, "ar-id", "name", "owner", "state", "start at", 
 
279
              "end at", "duration");
 
280
      fprintf(out, "----------------------------------------"
 
281
                 "--------------------------------------------------\n");
 
282
      qrstat_env->header_printed = true;
 
283
   }
 
284
 
 
285
   DRETURN(ret); 
 
286
}
 
287
 
 
288
static bool
 
289
qrstat_report_start_unknown_ar(qrstat_report_handler_t* handler, qrstat_env_t *qrstat_env, lList **alpp) 
 
290
{
 
291
   bool ret = true;
 
292
   FILE *out = (FILE*)handler->ctx;
 
293
 
 
294
   DENTER(TOP_LAYER, "qrstat_report_unknown_start");
 
295
 
 
296
   if (!qrstat_env->header_printed) {
 
297
      fprintf(out, "Following advance reservations do not exist:\n");
 
298
   }
 
299
 
 
300
   DRETURN(ret); 
 
301
}
 
302
 
 
303
static bool
 
304
qrstat_report_finish_ar(qrstat_report_handler_t* handler, lList **alpp)
 
305
{
 
306
   bool ret = true;
 
307
   FILE *out = (FILE*)handler->ctx;
 
308
 
 
309
   DENTER(TOP_LAYER, "qrstat_report_finish_ar");
 
310
   if (handler->show_summary) {
 
311
      fprintf(out, "\n");
 
312
   }
 
313
   DRETURN(ret); 
 
314
}
 
315
 
 
316
static bool
 
317
qrstat_report_finish_unknown_ar(qrstat_report_handler_t* handler, lList **alpp)
 
318
{
 
319
   bool ret = true;
 
320
 
 
321
   DENTER(TOP_LAYER, "qrstat_report_finish_unknown_ar");
 
322
   DRETURN(ret); 
 
323
}
 
324
 
 
325
static bool
 
326
qrstat_report_ar_node_ulong(qrstat_report_handler_t* handler, qrstat_env_t *qrstat_env, lList **alpp,
 
327
                            const char *name, u_long32 value)
 
328
{
 
329
   bool ret = true;
 
330
   FILE *out = (FILE*)handler->ctx;
 
331
 
 
332
   DENTER(TOP_LAYER, "qrstat_report_ar_node_ulong");
 
333
   if (handler->show_summary) {
 
334
      fprintf(out, "%7" sge_U32CLetter " ", sge_u32c(value));  
 
335
   } else {
 
336
      fprintf(out, SFN_FIRST_COLUMN" "sge_U32CFormat"\n", name, sge_u32c(value));  
 
337
   }
 
338
   DRETURN(ret); 
 
339
}
 
340
 
 
341
static bool
 
342
qrstat_report_ar_node_ulong_unknown(qrstat_report_handler_t* handler, qrstat_env_t *qrstat_env, lList **alpp,
 
343
                            const char *name, u_long32 value)
 
344
{
 
345
   bool ret = true;
 
346
   FILE *out = (FILE*)handler->ctx;
 
347
 
 
348
   DENTER(TOP_LAYER, "qrstat_report_ar_node_ulong_unknown");
 
349
   if (qrstat_env->header_printed) {
 
350
      fprintf(out, ", ");
 
351
   } else {
 
352
      qrstat_env->header_printed = true;
 
353
   }
 
354
   fprintf(out, sge_U32CFormat, sge_u32c(value));
 
355
 
 
356
   DRETURN(ret); 
 
357
}
 
358
 
 
359
static bool
 
360
qrstat_report_ar_node_duration(qrstat_report_handler_t* handler, lList **alpp,
 
361
                               const char *name, u_long32 value)
 
362
{
 
363
   bool ret = true;
 
364
   FILE *out = (FILE*)handler->ctx;
 
365
   int seconds = value % 60;
 
366
   int minutes = ((value - seconds) / 60) % 60;
 
367
   int hours = ((value - seconds - minutes * 60) / 3600);
 
368
 
 
369
   DENTER(TOP_LAYER, "qrstat_report_ar_node_duration");
 
370
 
 
371
   if (handler->show_summary) {
 
372
      fprintf(out, "%02d:%02d:%02d", hours, minutes, seconds); 
 
373
   } else {
 
374
      fprintf(out, SFN_FIRST_COLUMN" %02d:%02d:%02d\n", name, hours, minutes, seconds);  
 
375
   }
 
376
 
 
377
   DRETURN(ret);
 
378
}
 
379
 
 
380
static bool
 
381
qrstat_report_ar_node_string(qrstat_report_handler_t* handler, lList **alpp,
 
382
                             const char *name, const char *value)
 
383
{
 
384
   bool ret = true;
 
385
   FILE *out = (FILE*)handler->ctx;
 
386
 
 
387
   DENTER(TOP_LAYER, "qrstat_report_ar_node_string");
 
388
   if (value == NULL) {
 
389
      value = "";
 
390
   }
 
391
   if (handler->show_summary) {
 
392
      if (strcmp("owner", name) == 0) {
 
393
         fprintf(out, "%-12.12s ", value);
 
394
      } else if (strcmp("name", name) == 0) {
 
395
         fprintf(out, "%-10.10s ", value);
 
396
      } else if (strcmp("message", name) == 0) {
 
397
         fprintf(out, "\n       "SFN, value);
 
398
      }
 
399
   } else {
 
400
      fprintf(out, SFN_FIRST_COLUMN" " SFN"\n", name, value);  
 
401
   }
 
402
   DRETURN(ret); 
 
403
 
404
 
 
405
static bool
 
406
qrstat_report_ar_node_time(qrstat_report_handler_t* handler, lList **alpp,
 
407
                           const char *name, time_t value)
 
408
{
 
409
   bool ret = true;
 
410
   FILE *out = (FILE*)handler->ctx;
 
411
   dstring time_string = DSTRING_INIT;
 
412
 
 
413
   DENTER(TOP_LAYER, "qrstat_report_ar_node_time");
 
414
 
 
415
   sge_dstring_append_time(&time_string, value, false); 
 
416
   if (handler->show_summary) {
 
417
      if (strcmp("start_time", name) == 0 || strcmp("end_time", name) == 0) {
 
418
         fprintf(out, "%-20.20s ", sge_dstring_get_string(&time_string));
 
419
      }
 
420
   } else {
 
421
      fprintf(out, SFN_FIRST_COLUMN" "SFN"\n", name, sge_dstring_get_string(&time_string));  
 
422
   }
 
423
   sge_dstring_free(&time_string);
 
424
 
 
425
   DRETURN(ret); 
 
426
 
427
 
 
428
static bool
 
429
qrstat_report_ar_node_state(qrstat_report_handler_t* handler, lList **alpp,
 
430
                            const char *name, u_long32 state)
 
431
{
 
432
   bool ret = true;
 
433
   FILE *out = (FILE*)handler->ctx;
 
434
   dstring state_string = DSTRING_INIT;
 
435
 
 
436
   DENTER(TOP_LAYER, "qrstat_report_ar_node_time");
 
437
 
 
438
   ar_state2dstring((ar_state_t)state, &state_string);
 
439
   if (handler->show_summary) {
 
440
      fprintf(out, "%-5.5s ", sge_dstring_get_string(&state_string));
 
441
   } else {
 
442
      fprintf(out, SFN_FIRST_COLUMN" "SFN"\n", name, sge_dstring_get_string(&state_string));
 
443
   }
 
444
   sge_dstring_free(&state_string);
 
445
 
 
446
   DRETURN(ret); 
 
447
 
448
 
 
449
static bool
 
450
qrstat_report_start_resource_list(qrstat_report_handler_t* handler, lList **alpp) 
 
451
{
 
452
   bool ret = true;
 
453
   FILE *out = (FILE*)handler->ctx;
 
454
 
 
455
   DENTER(TOP_LAYER, "qrstat_report_start_resource_list");
 
456
   if (!handler->show_summary) {
 
457
      fprintf(out, SFN_FIRST_COLUMN" ", "resource_list");
 
458
      handler->first_resource = true;
 
459
   }
 
460
   DRETURN(ret); 
 
461
}
 
462
 
 
463
static bool
 
464
qrstat_report_finish_resource_list(qrstat_report_handler_t* handler, lList **alpp)
 
465
{
 
466
   bool ret = true;
 
467
   FILE *out = (FILE*)handler->ctx;
 
468
 
 
469
   DENTER(TOP_LAYER, "qrstat_report_finish_resource_list");
 
470
   if (!handler->show_summary) {
 
471
      fprintf(out, "\n");
 
472
   }
 
473
   DRETURN(ret); 
 
474
}
 
475
 
 
476
static bool
 
477
qrstat_report_resource_list_node(qrstat_report_handler_t* handler, lList **alpp,
 
478
                                 const char *name, const char *value)
 
479
{
 
480
   bool ret = true;
 
481
   FILE *out = (FILE*)handler->ctx;
 
482
 
 
483
   DENTER(TOP_LAYER, "qrstat_report_resource_list_node");
 
484
   if (!handler->show_summary) {
 
485
      fprintf(out, SFN SFN"="SFN, (handler->first_resource ? "" : ", "), name, value);
 
486
      if (handler->first_resource) {
 
487
         handler->first_resource = false;
 
488
      } 
 
489
   }
 
490
   DRETURN(ret); 
 
491
}
 
492
 
 
493
static bool
 
494
qrstat_report_ar_node_boolean(qrstat_report_handler_t* handler, lList **alpp, const char *name, bool value)
 
495
{
 
496
   bool ret = true;
 
497
   FILE *out = (FILE*)handler->ctx;
 
498
   const char* chvalue = value ? "true":"false";
 
499
 
 
500
   DENTER(TOP_LAYER, "qrstat_report_ar_node_boolean");
 
501
   if (handler->show_summary) {
 
502
      fprintf(out, "       "SFN, chvalue);
 
503
   } else {
 
504
      fprintf(out, SFN_FIRST_COLUMN" "SFN"\n", name, chvalue);  
 
505
   }
 
506
   DRETURN(ret); 
 
507
 
 
508
}
 
509
 
 
510
 
 
511
static bool
 
512
qrstat_report_start_granted_slots_list(qrstat_report_handler_t* handler, lList **alpp) 
 
513
{
 
514
   bool ret = true;
 
515
   FILE *out = (FILE*)handler->ctx;
 
516
 
 
517
   DENTER(TOP_LAYER, "qrstat_report_start_granted_slots_list");
 
518
   if (!handler->show_summary) {
 
519
      fprintf(out, SFN_FIRST_COLUMN" ", "granted_slots_list");
 
520
      handler->first_granted_slot = true;
 
521
   }
 
522
   DRETURN(ret); 
 
523
}
 
524
 
 
525
static bool
 
526
qrstat_report_finish_granted_slots_list(qrstat_report_handler_t* handler, lList **alpp)
 
527
{
 
528
   bool ret = true;
 
529
   FILE *out = (FILE*)handler->ctx;
 
530
 
 
531
   DENTER(TOP_LAYER, "qrstat_report_finish_granted_slots_list");
 
532
   if (!handler->show_summary) {
 
533
      fprintf(out, "\n");
 
534
   }
 
535
   DRETURN(ret); 
 
536
}
 
537
 
 
538
static bool
 
539
qrstat_report_granted_slots_list_node(qrstat_report_handler_t* handler, 
 
540
                                      lList **alpp,
 
541
                                      const char *name, u_long32 value)
 
542
{
 
543
   bool ret = true;
 
544
   FILE *out = (FILE*)handler->ctx;
 
545
 
 
546
   DENTER(TOP_LAYER, "qrstat_report_granted_slots_list_node");
 
547
   if (!handler->show_summary) {
 
548
      fprintf(out, SFN SFN"="sge_U32CFormat, (handler->first_granted_slot ? "" : ","), name, sge_u32c(value));
 
549
      if (handler->first_granted_slot) {
 
550
         handler->first_granted_slot = false;
 
551
      } 
 
552
   }
 
553
   DRETURN(ret); 
 
554
}
 
555
 
 
556
static bool
 
557
qrstat_report_start_granted_parallel_environment(qrstat_report_handler_t* handler, lList **alpp) 
 
558
{
 
559
   bool ret = true;
 
560
   FILE *out = (FILE*)handler->ctx;
 
561
 
 
562
   DENTER(TOP_LAYER, "qrstat_report_start_granted_parallel_environment");
 
563
   if (!handler->show_summary) {
 
564
      fprintf(out, SFN_FIRST_COLUMN" ", "granted_parallel_environment");
 
565
   }
 
566
   DRETURN(ret); 
 
567
}
 
568
 
 
569
static bool
 
570
qrstat_report_finish_granted_parallel_environment(qrstat_report_handler_t* handler, lList **alpp)
 
571
{
 
572
   bool ret = true;
 
573
   FILE *out = (FILE*)handler->ctx;
 
574
 
 
575
   DENTER(TOP_LAYER, "qrstat_report_finish_parallel_environment");
 
576
   if (!handler->show_summary) {
 
577
      fprintf(out, "\n");
 
578
   }
 
579
   DRETURN(ret); 
 
580
}
 
581
 
 
582
static bool
 
583
qrstat_report_granted_parallel_environment_node(qrstat_report_handler_t* handler, 
 
584
                                                lList **alpp,
 
585
                                                const char *name, const char *slots_range)
 
586
{
 
587
   bool ret = true;
 
588
   FILE *out = (FILE*)handler->ctx;
 
589
 
 
590
   DENTER(TOP_LAYER, "qrstat_report_granted_granted_parallel_environment_node");
 
591
   if (!handler->show_summary) {
 
592
      fprintf(out, SFN" slots "SFN, name, slots_range);
 
593
   }
 
594
   DRETURN(ret); 
 
595
}
 
596
 
 
597
static bool 
 
598
qrstat_report_start_mail_list(qrstat_report_handler_t* handler, lList **alpp) 
 
599
{
 
600
   bool ret = true;
 
601
   FILE *out = (FILE*)handler->ctx;
 
602
 
 
603
   DENTER(TOP_LAYER, "qrstat_report_start_mail_list");
 
604
   if (!handler->show_summary) {
 
605
      fprintf(out, SFN_FIRST_COLUMN" ", "mail_list");
 
606
      handler->first_mail = true;
 
607
   }
 
608
   DRETURN(ret); 
 
609
}
 
610
 
 
611
static bool
 
612
qrstat_report_finish_mail_list(qrstat_report_handler_t* handler, lList **alpp)
 
613
{
 
614
   bool ret = true;
 
615
   FILE *out = (FILE*)handler->ctx;
 
616
 
 
617
   DENTER(TOP_LAYER, "qrstat_report_finish_mail_list");
 
618
   if (!handler->show_summary) {
 
619
      fprintf(out, "\n");
 
620
   }
 
621
   DRETURN(ret); 
 
622
}
 
623
 
 
624
static bool
 
625
qrstat_report_mail_list_node(qrstat_report_handler_t* handler, 
 
626
                             lList **alpp,
 
627
                             const char *name, const char *host)
 
628
{
 
629
   bool ret = true;
 
630
   FILE *out = (FILE*)handler->ctx;
 
631
 
 
632
   DENTER(TOP_LAYER, "qrstat_report_mail_list_node");
 
633
   if (!handler->show_summary) {
 
634
      fprintf(out, SFN SFN"@"SFN, (handler->first_mail ? "" : ","), name?name:"", host?host:"");
 
635
      if (handler->first_mail) {
 
636
         handler->first_mail = false;
 
637
      } 
 
638
   }
 
639
   DRETURN(ret); 
 
640
}
 
641
 
 
642
static bool
 
643
qrstat_report_start_acl_list(qrstat_report_handler_t* handler, lList **alpp) 
 
644
{
 
645
   bool ret = true;
 
646
   FILE *out = (FILE*)handler->ctx;
 
647
 
 
648
   DENTER(TOP_LAYER, "qrstat_report_start_acl_list");
 
649
   if (!handler->show_summary) {
 
650
      fprintf(out, SFN_FIRST_COLUMN" ", "acl_list");
 
651
      handler->first_acl = true;
 
652
   }
 
653
   DRETURN(ret); 
 
654
}
 
655
 
 
656
static bool
 
657
qrstat_report_finish_acl_list(qrstat_report_handler_t* handler, lList **alpp)
 
658
{
 
659
   bool ret = true;
 
660
   FILE *out = (FILE*)handler->ctx;
 
661
 
 
662
   DENTER(TOP_LAYER, "qrstat_report_finish_acl_list");
 
663
   if (!handler->show_summary) {
 
664
      fprintf(out, "\n");
 
665
   }
 
666
   DRETURN(ret); 
 
667
}
 
668
 
 
669
static bool
 
670
qrstat_report_acl_list_node(qrstat_report_handler_t* handler, 
 
671
                            lList **alpp,
 
672
                            const char *name)
 
673
{
 
674
   bool ret = true;
 
675
   FILE *out = (FILE*)handler->ctx;
 
676
 
 
677
   DENTER(TOP_LAYER, "qrstat_report_acl_list_node");
 
678
   if (!handler->show_summary) {
 
679
      fprintf(out, SFN SFN, (handler->first_acl ? "" : ","), name);
 
680
      if (handler->first_acl) {
 
681
         handler->first_acl = false;
 
682
      } 
 
683
   }
 
684
   DRETURN(ret); 
 
685
}
 
686
 
 
687
static bool 
 
688
qrstat_report_start_xacl_list(qrstat_report_handler_t* handler, lList **alpp) 
 
689
{
 
690
   bool ret = true;
 
691
   FILE *out = (FILE*)handler->ctx;
 
692
 
 
693
   DENTER(TOP_LAYER, "qrstat_report_start_xacl_list");
 
694
   if (!handler->show_summary) {
 
695
      fprintf(out, SFN_FIRST_COLUMN" ", "xacl_list");
 
696
      handler->first_xacl = true;
 
697
   }
 
698
   DRETURN(ret); 
 
699
}
 
700
 
 
701
static bool
 
702
qrstat_report_finish_xacl_list(qrstat_report_handler_t* handler, lList **alpp)
 
703
{
 
704
   bool ret = true;
 
705
   FILE *out = (FILE*)handler->ctx;
 
706
 
 
707
   DENTER(TOP_LAYER, "qrstat_report_finish_xacl_list");
 
708
   if (!handler->show_summary) {
 
709
      fprintf(out, "\n");
 
710
   }
 
711
   DRETURN(ret); 
 
712
}
 
713
 
 
714
static bool
 
715
qrstat_report_xacl_list_node(qrstat_report_handler_t* handler, 
 
716
                             lList **alpp,
 
717
                             const char *name)
 
718
{
 
719
   bool ret = true;
 
720
   FILE *out = (FILE*)handler->ctx;
 
721
 
 
722
   DENTER(TOP_LAYER, "qrstat_report_xacl_list_node");
 
723
   if (!handler->show_summary) {
 
724
      fprintf(out, SFN SFN, (handler->first_xacl ? "" : ","), name);
 
725
      if (handler->first_xacl) {
 
726
         handler->first_xacl = false;
 
727
      } 
 
728
   } 
 
729
   DRETURN(ret); 
 
730
}
 
731
 
 
732
static bool
 
733
qrstat_report_newline(qrstat_report_handler_t* handler, lList **alpp)
 
734
{
 
735
   bool ret = true;
 
736
   FILE *out = (FILE*)handler->ctx;
 
737
 
 
738
   DENTER(TOP_LAYER, "qrstat_report_newline");
 
739
   fprintf(out, "\n");
 
740
   DRETURN(ret);
 
741
}