9 #include <limits.h> /* PATH_MAX */
11 #include "graph_list.h"
13 #include "utils_params.h"
16 #include <fcgi_stdio.h>
21 #define UPDATE_INTERVAL 10
23 #define ANY_TOKEN "/any/"
24 #define ALL_TOKEN "/all/"
27 # define GL_DEBUG(...) do { \
28 printf ("Content-Type: text/plain\n\n"); \
29 printf (__VA_ARGS__); \
32 # define GL_DEBUG(...) /**/
38 struct graph_ident_s /* {{{ */
42 char *plugin_instance;
45 }; /* }}} struct graph_ident_s */
47 struct graph_instance_s /* {{{ */
54 graph_instance_t *next;
55 }; /* }}} struct graph_instance_s */
57 struct graph_config_s /* {{{ */
64 graph_instance_t *instances;
67 }; /* }}} struct graph_config_s */
72 static graph_config_t *graph_config_head = NULL;
74 static graph_ident_t *graph_list = NULL;
75 static size_t graph_list_length = 0;
76 static time_t gl_last_update = 0;
81 /* FIXME: These "print_*" functions are used for debugging. They should be
82 * removed at some point. */
83 static int print_files (const graph_instance_t *inst) /* {{{ */
87 for (i = 0; i < inst->files_num; i++)
89 graph_ident_t *file = inst->files + i;
91 printf (" File \"%s/%s-%s/%s-%s\"\n",
93 file->plugin, file->plugin_instance,
94 file->type, file->type_instance);
98 } /* }}} int print_instances */
100 static int print_instances (const graph_config_t *cfg) /* {{{ */
102 graph_instance_t *inst;
104 for (inst = cfg->instances; inst != NULL; inst = inst->next)
106 printf (" Instance \"%s/%s-%s/%s-%s\"\n",
108 inst->select.plugin, inst->select.plugin_instance,
109 inst->select.type, inst->select.type_instance);
115 } /* }}} int print_instances */
117 static int print_graphs (void) /* {{{ */
121 for (cfg = graph_config_head; cfg != NULL; cfg = cfg->next)
123 printf ("Graph \"%s/%s-%s/%s-%s\"\n",
125 cfg->select.plugin, cfg->select.plugin_instance,
126 cfg->select.type, cfg->select.type_instance);
128 print_instances (cfg);
132 } /* }}} int print_graphs */
134 /* "Safe" version of strcmp(3): Either or both pointers may be NULL. */
135 static int strcmp_s (const char *s1, const char *s2) /* {{{ */
137 if ((s1 == NULL) && (s2 == NULL))
143 assert ((s1 != NULL) && (s2 != NULL));
145 return (strcmp (s1, s2));
146 } /* }}} int strcmp_s */
148 static _Bool part_matches (const char *sel, const char *val) /* {{{ */
150 if ((sel == NULL) && (val == NULL))
153 if (sel == NULL) /* && (val != NULL) */
156 if ((strcasecmp (ALL_TOKEN, sel) == 0)
157 || (strcasecmp (ANY_TOKEN, sel) == 0))
160 if (val == NULL) /* && (sel != NULL) */
163 if (strcmp (sel, val) == 0)
167 } /* }}} _Bool part_matches */
169 static _Bool file_matches (const graph_ident_t *sel, /* {{{ */
170 const graph_ident_t *val)
172 if ((sel == NULL) && (val == NULL))
174 else if (sel == NULL)
176 else if (val == NULL)
179 if (!part_matches (sel->host, val->host))
182 if (!part_matches (sel->plugin, val->plugin))
185 if (!part_matches (sel->plugin_instance, val->plugin_instance))
188 if (!part_matches (sel->type, val->type))
191 if (!part_matches (sel->type_instance, val->type_instance))
195 } /* }}} _Bool ident_compare */
197 /* Free all the pointers contained in the graph_ident_t but don't free the
198 * graph_ident_t* itself. */
199 static void ident_destroy (graph_ident_t *ident) /* {{{ */
206 free (ident->plugin);
207 ident->plugin = NULL;
208 free (ident->plugin_instance);
209 ident->plugin_instance = NULL;
212 free (ident->type_instance);
213 ident->type_instance = NULL;
214 } /* }}} void ident_destroy */
216 static void instance_destroy (graph_instance_t *inst) /* {{{ */
218 graph_instance_t *next;
226 ident_destroy (&inst->select);
228 for (i = 0; i < inst->files_num; i++)
229 ident_destroy (inst->files + i);
234 instance_destroy (next);
235 } /* }}} void instance_destroy */
237 static void graph_destroy (graph_config_t *cfg) /* {{{ */
239 graph_config_t *next;
246 ident_destroy (&cfg->select);
249 free (cfg->vertical_label);
251 instance_destroy (cfg->instances);
253 graph_destroy (next);
254 } /* }}} void graph_destroy */
257 * Copy part of an identifier. If the "template" value is ANY_TOKEN, "value" is
258 * copied and returned. This function is used when creating graph_instance_t
259 * from graph_config_t.
261 static char *identifier_copy_part (const char *template, const char *value) /* {{{ */
263 if (template == NULL)
267 else if (strcasecmp (ANY_TOKEN, template) == 0)
269 /* ANY in the graph selection => concrete value in the instance. */
273 return (strdup (value));
275 else if (strcasecmp (ALL_TOKEN, template) == 0)
277 /* ALL in the graph selection => ALL in the instance. */
278 return (strdup (ALL_TOKEN));
282 assert (value != NULL);
283 assert (strcmp (template, value) == 0);
284 return (strdup (template));
286 } /* }}} int identifier_copy_part */
288 static graph_instance_t *instance_create (graph_config_t *cfg, /* {{{ */
289 const graph_ident_t *file)
293 if ((cfg == NULL) || (file == NULL))
296 i = malloc (sizeof (*i));
299 memset (i, 0, sizeof (*i));
301 i->select.host = identifier_copy_part (cfg->select.host, file->host);
302 i->select.plugin = identifier_copy_part (cfg->select.plugin, file->plugin);
303 i->select.plugin_instance = identifier_copy_part (cfg->select.plugin_instance,
304 file->plugin_instance);
305 i->select.type = identifier_copy_part (cfg->select.type, file->type);
306 i->select.type_instance = identifier_copy_part (cfg->select.type_instance,
307 file->type_instance);
314 if (cfg->instances == NULL)
318 graph_instance_t *last;
320 last = cfg->instances;
321 while (last->next != NULL)
328 } /* }}} graph_instance_t *instance_create */
330 static int instance_add_file (graph_instance_t *inst, /* {{{ */
331 const graph_ident_t *file)
335 tmp = realloc (inst->files, sizeof (*inst->files) * (inst->files_num + 1));
339 tmp = inst->files + inst->files_num;
341 memset (tmp, 0, sizeof (*tmp));
342 tmp->host = strdup (file->host);
343 tmp->plugin = strdup (file->plugin);
344 if (file->plugin_instance != NULL)
345 tmp->plugin_instance = strdup (file->plugin_instance);
347 tmp->plugin_instance = NULL;
348 tmp->type = strdup (file->type);
349 if (file->type_instance != NULL)
350 tmp->type_instance = strdup (file->type_instance);
352 tmp->type_instance = NULL;
357 } /* }}} int instance_add_file */
359 static graph_instance_t *graph_find_instance (graph_config_t *cfg, /* {{{ */
360 const graph_ident_t *file)
364 if ((cfg == NULL) || (file == NULL))
367 for (i = cfg->instances; i != NULL; i = i->next)
368 if (file_matches (&i->select, file))
372 } /* }}} graph_instance_t *graph_find_instance */
374 static int graph_add_file (graph_config_t *cfg, const graph_ident_t *file) /* {{{ */
376 graph_instance_t *inst;
378 inst = graph_find_instance (cfg, file);
381 inst = instance_create (cfg, file);
386 return (instance_add_file (inst, file));
387 } /* }}} int graph_add_file */
389 static int graph_append (graph_config_t *cfg) /* {{{ */
391 graph_config_t *last;
396 if (graph_config_head == NULL)
398 graph_config_head = cfg;
402 last = graph_config_head;
403 while (last->next != NULL)
409 } /* }}} int graph_append */
411 static int graph_create_from_file (const graph_ident_t *file) /* {{{ */
415 cfg = malloc (sizeof (*cfg));
418 memset (cfg, 0, sizeof (*cfg));
420 cfg->select.host = strdup (file->host);
421 cfg->select.plugin = strdup (file->plugin);
422 cfg->select.plugin_instance = strdup (file->plugin_instance);
423 cfg->select.type = strdup (file->type);
424 cfg->select.type_instance = strdup (file->type_instance);
427 cfg->vertical_label = NULL;
428 cfg->instances = NULL;
433 return (graph_add_file (cfg, file));
434 } /* }}} int graph_create_from_file */
436 static int register_file (const graph_ident_t *file) /* {{{ */
441 for (cfg = graph_config_head; cfg != NULL; cfg = cfg->next)
445 if (!file_matches (&cfg->select, file))
448 status = graph_add_file (cfg, file);
460 graph_create_from_file (file);
463 } /* }}} int register_file */
465 static int FIXME_graph_create_from_file (const graph_ident_t *file, /* {{{ */
470 cfg = malloc (sizeof (*cfg));
473 memset (cfg, 0, sizeof (*cfg));
475 cfg->select.host = strdup (file->host);
476 cfg->select.plugin = strdup (file->plugin);
477 cfg->select.plugin_instance = strdup (file->plugin_instance);
478 cfg->select.type = strdup (file->type);
479 cfg->select.type_instance = strdup (file->type_instance);
483 cfg->title = strdup (title);
484 cfg->vertical_label = NULL;
485 cfg->instances = NULL;
491 } /* }}} int FIXME_graph_create_from_file */
493 /* FIXME: Actually read the config file here. */
494 static int read_graph_config (void) /* {{{ */
496 if (graph_config_head != NULL)
502 ident.host = ANY_TOKEN;
503 ident.plugin = "cpu";
504 ident.plugin_instance = ANY_TOKEN;
506 ident.type_instance = ALL_TOKEN;
507 FIXME_graph_create_from_file (&ident, "CPU {instance} usage");
509 ident.plugin = "memory";
510 ident.plugin_instance = "";
511 ident.type = "memory";
512 FIXME_graph_create_from_file (&ident, "Memory usage");
514 ident.plugin = "swap";
515 ident.plugin_instance = "";
517 FIXME_graph_create_from_file (&ident, "Swap");
519 ident.plugin = ANY_TOKEN;
520 ident.plugin_instance = ANY_TOKEN;
521 ident.type = "ps_state";
522 FIXME_graph_create_from_file (&ident, "Processes");
524 ident.host = ALL_TOKEN;
525 ident.plugin = "cpu";
526 ident.plugin_instance = ALL_TOKEN;
528 ident.type_instance = "idle";
529 FIXME_graph_create_from_file (&ident, "CPU idle overview");
532 } /* }}} int read_graph_config */
534 static int gl_compare (const void *p0, const void *p1) /* {{{ */
536 const graph_ident_t *gl0 = p0;
537 const graph_ident_t *gl1 = p1;
540 status = strcmp (gl0->host, gl1->host);
544 status = strcmp (gl0->plugin, gl1->plugin);
548 status = strcmp_s (gl0->plugin_instance, gl1->plugin_instance);
552 status = strcmp (gl0->type, gl1->type);
556 return (strcmp_s (gl0->type_instance, gl1->type_instance));
557 } /* }}} int gl_compare */
559 static void gl_clear_entry (graph_ident_t *gl) /* {{{ */
566 free (gl->plugin_instance);
568 free (gl->type_instance);
572 gl->plugin_instance = NULL;
574 gl->type_instance = NULL;
575 } /* }}} void gl_clear_entry */
577 static void gl_clear (void) /* {{{ */
582 cfg = graph_config_head;
583 graph_config_head = NULL;
586 for (i = 0; i < graph_list_length; i++)
587 gl_clear_entry (graph_list + i);
591 graph_list_length = 0;
593 } /* }}} void gl_clear */
595 static int gl_add_copy (graph_ident_t *gl) /* {{{ */
603 ptr = realloc (graph_list, sizeof (*graph_list) * (graph_list_length + 1));
608 ptr = graph_list + graph_list_length;
609 memset (ptr, 0, sizeof (*ptr));
612 ptr->plugin_instance = NULL;
614 ptr->type_instance = NULL;
616 #define DUP_OR_BREAK(member) do { \
617 ptr->member = NULL; \
618 if (gl->member != NULL) \
620 ptr->member = strdup (gl->member); \
621 if (ptr->member == NULL) \
630 DUP_OR_BREAK(plugin);
631 DUP_OR_BREAK(plugin_instance);
633 DUP_OR_BREAK(type_instance);
644 free (ptr->plugin_instance);
646 free (ptr->type_instance);
652 } /* }}} int gl_add_copy */
654 static int callback_type (const char *type, void *user_data) /* {{{ */
659 if ((type == NULL) || (user_data == NULL))
663 if ((gl->type != NULL) || (gl->type_instance != NULL))
666 gl->type = strdup (type);
667 if (gl->type == NULL)
670 gl->type_instance = strchr (gl->type, '-');
671 if (gl->type_instance != NULL)
673 *gl->type_instance = 0;
678 gl->type_instance = gl->type + strlen (gl->type);
683 status = gl_add_copy (gl);
687 gl->type_instance = NULL;
690 } /* }}} int callback_type */
692 static int callback_plugin (const char *plugin, void *user_data) /* {{{ */
697 if ((plugin == NULL) || (user_data == NULL))
701 if ((gl->plugin != NULL) || (gl->plugin_instance != NULL))
704 gl->plugin = strdup (plugin);
705 if (gl->plugin == NULL)
708 gl->plugin_instance = strchr (gl->plugin, '-');
709 if (gl->plugin_instance != NULL)
711 *gl->plugin_instance = 0;
712 gl->plugin_instance++;
716 gl->plugin_instance = gl->plugin + strlen (gl->plugin);
719 status = foreach_type (gl->host, plugin, callback_type, gl);
723 gl->plugin_instance = NULL;
726 } /* }}} int callback_plugin */
728 static int callback_host (const char *host, void *user_data) /* {{{ */
733 if ((host == NULL) || (user_data == NULL))
737 if (gl->host != NULL)
740 gl->host = strdup (host);
741 if (gl->host == NULL)
744 status = foreach_plugin (host, callback_plugin, gl);
750 } /* }}} int callback_host */
752 static const char *get_part_from_param (const char *prim_key, /* {{{ */
757 val = param (prim_key);
761 return (param (sec_key));
762 } /* }}} const char *get_part_from_param */
764 int gl_ident_get_rrdargs (graph_config_t *cfg, /* {{{ */
765 graph_instance_t *inst,
766 graph_ident_t *ident,
775 if ((cfg == NULL) || (inst == NULL) || (ident == NULL) || (args == NULL))
778 file = ident_to_file (ident);
781 GL_DEBUG ("gl_ident_get_rrdargs: ident_to_file returned NULL.\n");
785 GL_DEBUG ("gl_ident_get_rrdargs: file = %s;\n", file);
787 status = ds_list_from_rrd_file (file, &dses_num, &dses);
794 for (i = 0; i < dses_num; i++)
798 GL_DEBUG ("gl_ident_get_rrdargs: ds[%lu] = %s;\n", (unsigned long) i, dses[i]);
800 index = array_argc (args);
803 array_append_format (args, "DEF:def_%04i_min=%s:%s:MIN",
804 index, file, dses[i]);
805 array_append_format (args, "DEF:def_%04i_avg=%s:%s:AVERAGE",
806 index, file, dses[i]);
807 array_append_format (args, "DEF:def_%04i_max=%s:%s:MAX",
808 index, file, dses[i]);
810 array_append_format (args, "VDEF:vdef_%04i_min=def_%04i_min,MINIMUM",
812 array_append_format (args, "VDEF:vdef_%04i_avg=def_%04i_avg,AVERAGE",
814 array_append_format (args, "VDEF:vdef_%04i_max=def_%04i_max,MAXIMUM",
816 array_append_format (args, "VDEF:vdef_%04i_lst=def_%04i_avg,LAST",
820 array_append_format (args, "LINE1:def_%04i_avg#%06"PRIx32":%s",
821 index, get_random_color (), dses[i]);
822 array_append_format (args, "GPRINT:vdef_%04i_min:%%lg min,", index);
823 array_append_format (args, "GPRINT:vdef_%04i_avg:%%lg avg,", index);
824 array_append_format (args, "GPRINT:vdef_%04i_max:%%lg max,", index);
825 array_append_format (args, "GPRINT:vdef_%04i_lst:%%lg last\\l", index);
834 } /* }}} int gl_ident_get_rrdargs */
839 char *ident_to_file (const graph_ident_t *ident) /* {{{ */
841 char buffer[PATH_MAX];
845 strlcat (buffer, DATA_DIR, sizeof (buffer));
846 strlcat (buffer, "/", sizeof (buffer));
848 strlcat (buffer, ident->host, sizeof (buffer));
849 strlcat (buffer, "/", sizeof (buffer));
850 strlcat (buffer, ident->plugin, sizeof (buffer));
851 if (ident->plugin_instance[0] != 0)
853 strlcat (buffer, "-", sizeof (buffer));
854 strlcat (buffer, ident->plugin_instance, sizeof (buffer));
856 strlcat (buffer, "/", sizeof (buffer));
857 strlcat (buffer, ident->type, sizeof (buffer));
858 if (ident->type_instance[0] != 0)
860 strlcat (buffer, "-", sizeof (buffer));
861 strlcat (buffer, ident->type_instance, sizeof (buffer));
864 strlcat (buffer, ".rrd", sizeof (buffer));
866 return (strdup (buffer));
867 } /* }}} char *ident_to_file */
869 int gl_instance_get_params (graph_config_t *cfg, graph_instance_t *inst, /* {{{ */
870 char *buffer, size_t buffer_size)
872 if ((inst == NULL) || (buffer == NULL) || (buffer_size < 1))
877 #define COPY_FIELD(field) do { \
878 if (strcmp (cfg->select.field, inst->select.field) == 0) \
880 strlcat (buffer, #field, buffer_size); \
881 strlcat (buffer, "=", buffer_size); \
882 strlcat (buffer, cfg->select.field, buffer_size); \
886 strlcat (buffer, "graph_", buffer_size); \
887 strlcat (buffer, #field, buffer_size); \
888 strlcat (buffer, "=", buffer_size); \
889 strlcat (buffer, cfg->select.field, buffer_size); \
890 strlcat (buffer, ";", buffer_size); \
891 strlcat (buffer, "inst_", buffer_size); \
892 strlcat (buffer, #field, buffer_size); \
893 strlcat (buffer, "=", buffer_size); \
894 strlcat (buffer, inst->select.field, buffer_size); \
899 strlcat (buffer, ";", buffer_size);
901 strlcat (buffer, ";", buffer_size);
902 COPY_FIELD(plugin_instance);
903 strlcat (buffer, ";", buffer_size);
905 strlcat (buffer, ";", buffer_size);
906 COPY_FIELD(type_instance);
911 } /* }}} int gl_instance_get_params */
913 graph_instance_t *inst_get_selected (graph_config_t *cfg) /* {{{ */
915 const char *host = get_part_from_param ("inst_host", "host");
916 const char *plugin = get_part_from_param ("inst_plugin", "plugin");
917 const char *plugin_instance = get_part_from_param ("inst_plugin_instance", "plugin_instance");
918 const char *type = get_part_from_param ("inst_type", "type");
919 const char *type_instance = get_part_from_param ("inst_type_instance", "type_instance");
920 graph_instance_t *inst;
923 cfg = graph_get_selected ();
927 GL_DEBUG ("inst_get_selected: cfg == NULL;\n");
932 || (plugin == NULL) || (plugin_instance == NULL)
933 || (type == NULL) || (type_instance == NULL))
935 GL_DEBUG ("inst_get_selected: A parameter is NULL.\n");
939 for (inst = cfg->instances; inst != NULL; inst = inst->next)
941 if ((strcmp (inst->select.host, host) != 0)
942 || (strcmp (inst->select.plugin, plugin) != 0)
943 || (strcmp (inst->select.plugin_instance, plugin_instance) != 0)
944 || (strcmp (inst->select.type, type) != 0)
945 || (strcmp (inst->select.type_instance, type_instance) != 0))
951 GL_DEBUG ("inst_get_selected: No match found.\n");
953 } /* }}} graph_instance_t *inst_get_selected */
955 int gl_graph_get_all (gl_cfg_callback callback, /* {{{ */
960 if (callback == NULL)
965 for (cfg = graph_config_head; cfg != NULL; cfg = cfg->next)
969 status = (*callback) (cfg, user_data);
975 } /* }}} int gl_graph_get_all */
977 graph_config_t *graph_get_selected (void) /* {{{ */
979 const char *host = get_part_from_param ("graph_host", "host");
980 const char *plugin = get_part_from_param ("graph_plugin", "plugin");
981 const char *plugin_instance = get_part_from_param ("graph_plugin_instance", "plugin_instance");
982 const char *type = get_part_from_param ("graph_type", "type");
983 const char *type_instance = get_part_from_param ("graph_type_instance", "type_instance");
987 || (plugin == NULL) || (plugin_instance == NULL)
988 || (type == NULL) || (type_instance == NULL))
990 printf ("Content-Type: text/plain\n\n");
991 printf ("graph_get_selected(): A param is NULL.\n");
997 for (cfg = graph_config_head; cfg != NULL; cfg = cfg->next)
999 if ((strcmp (cfg->select.host, host) != 0)
1000 || (strcmp (cfg->select.plugin, plugin) != 0)
1001 || (strcmp (cfg->select.plugin_instance, plugin_instance) != 0)
1002 || (strcmp (cfg->select.type, type) != 0)
1003 || (strcmp (cfg->select.type_instance, type_instance) != 0))
1009 printf ("Content-Type: text/plain\n\n");
1010 printf ("graph_get_selected(): No matching graph found.\n");
1013 } /* }}} graph_config_t *graph_get_selected */
1015 int gl_graph_instance_get_all (graph_config_t *cfg, /* {{{ */
1016 gl_inst_callback callback, void *user_data)
1018 graph_instance_t *inst;
1020 if ((cfg == NULL) || (callback == NULL))
1023 for (inst = cfg->instances; inst != NULL; inst = inst->next)
1027 status = (*callback) (cfg, inst, user_data);
1033 } /* }}} int gl_graph_instance_get_all */
1035 int gl_graph_get_title (graph_config_t *cfg, /* {{{ */
1036 char *buffer, size_t buffer_size)
1038 if ((cfg == NULL) || (buffer == NULL) || (buffer_size < 1))
1042 strlcat (buffer, cfg->select.host, buffer_size);
1043 strlcat (buffer, "/", buffer_size);
1044 strlcat (buffer, cfg->select.plugin, buffer_size);
1045 if (cfg->select.plugin_instance[0] != 0)
1047 strlcat (buffer, "-", buffer_size);
1048 strlcat (buffer, cfg->select.plugin_instance, buffer_size);
1050 strlcat (buffer, "/", buffer_size);
1051 strlcat (buffer, cfg->select.type, buffer_size);
1052 if (cfg->select.type_instance[0] != 0)
1054 strlcat (buffer, "-", buffer_size);
1055 strlcat (buffer, cfg->select.type_instance, buffer_size);
1059 } /* }}} int gl_graph_get_title */
1061 int gl_instance_get_all (gl_inst_callback callback, /* {{{ */
1064 graph_config_t *cfg;
1068 for (cfg = graph_config_head; cfg != NULL; cfg = cfg->next)
1070 graph_instance_t *inst;
1072 for (inst = cfg->instances; inst != NULL; inst = inst->next)
1076 status = (*callback) (cfg, inst, user_data);
1083 } /* }}} int gl_instance_get_all */
1085 int gl_instance_get_rrdargs (graph_config_t *cfg, /* {{{ */
1086 graph_instance_t *inst,
1091 if ((cfg == NULL) || (inst == NULL) || (args == NULL))
1094 if (cfg->title != NULL)
1096 array_append (args, "-t");
1097 array_append (args, cfg->title);
1100 for (i = 0; i < inst->files_num; i++)
1104 status = gl_ident_get_rrdargs (cfg, inst, inst->files + i, args);
1110 } /* }}} int gl_instance_get_rrdargs */
1114 int gl_update (void) /* {{{ */
1121 printf ("Content-Type: text/plain\n\n");
1126 if ((gl_last_update + UPDATE_INTERVAL) >= now)
1131 read_graph_config ();
1133 memset (&gl, 0, sizeof (gl));
1136 gl.plugin_instance = NULL;
1138 gl.type_instance = NULL;
1140 status = foreach_host (callback_host, &gl);
1142 /* print_graphs (); */
1144 if (graph_list_length > 1)
1145 qsort (graph_list, graph_list_length, sizeof (*graph_list), gl_compare);
1148 } /* }}} int gl_update */
1150 int gl_foreach (gl_callback callback, void *user_data) /* {{{ */
1154 for (i = 0; i < graph_list_length; i++)
1158 status = (*callback) ((void *) (graph_list + i), user_data);
1164 } /* }}} int gl_foreach */
1166 /* vim: set sw=2 sts=2 et fdm=marker : */