+ pango_cairo_context_set_resolution(context, 100);
+
+ pango_cairo_update_context(im->cr,context);
+
+ im->layout = pango_layout_new(context);
+ g_object_unref (context);
+
+// im->layout = pango_cairo_create_layout(im->cr);
+
+
+ cairo_font_options_set_hint_style
+ (im->font_options, CAIRO_HINT_STYLE_FULL);
+ cairo_font_options_set_hint_metrics
+ (im->font_options, CAIRO_HINT_METRICS_ON);
+ cairo_font_options_set_antialias(im->font_options, CAIRO_ANTIALIAS_GRAY);
+
+
+
+ for (i = 0; i < DIM(graph_col); i++)
+ im->graph_col[i] = graph_col[i];
+
+
+}
+
+
+void rrd_graph_options(
+ int argc,
+ char *argv[],
+ image_desc_t
+ *im)
+{
+ int stroff;
+ char *parsetime_error = NULL;
+ char scan_gtm[12], scan_mtm[12], scan_ltm[12], col_nam[12];
+ time_t start_tmp = 0, end_tmp = 0;
+ long long_tmp;
+ rrd_time_value_t start_tv, end_tv;
+ long unsigned int color;
+
+ /* defines for long options without a short equivalent. should be bytes,
+ and may not collide with (the ASCII value of) short options */
+#define LONGOPT_UNITS_SI 255
+
+/* *INDENT-OFF* */
+ struct option long_options[] = {
+ { "alt-autoscale", no_argument, 0, 'A'},
+ { "imgformat", required_argument, 0, 'a'},
+ { "font-smoothing-threshold", required_argument, 0, 'B'},
+ { "base", required_argument, 0, 'b'},
+ { "color", required_argument, 0, 'c'},
+ { "full-size-mode", no_argument, 0, 'D'},
+ { "daemon", required_argument, 0, 'd'},
+ { "slope-mode", no_argument, 0, 'E'},
+ { "end", required_argument, 0, 'e'},
+ { "force-rules-legend", no_argument, 0, 'F'},
+ { "imginfo", required_argument, 0, 'f'},
+ { "graph-render-mode", required_argument, 0, 'G'},
+ { "no-legend", no_argument, 0, 'g'},
+ { "height", required_argument, 0, 'h'},
+ { "no-minor", no_argument, 0, 'I'},
+ { "interlaced", no_argument, 0, 'i'},
+ { "alt-autoscale-min", no_argument, 0, 'J'},
+ { "only-graph", no_argument, 0, 'j'},
+ { "units-length", required_argument, 0, 'L'},
+ { "lower-limit", required_argument, 0, 'l'},
+ { "alt-autoscale-max", no_argument, 0, 'M'},
+ { "zoom", required_argument, 0, 'm'},
+ { "no-gridfit", no_argument, 0, 'N'},
+ { "font", required_argument, 0, 'n'},
+ { "logarithmic", no_argument, 0, 'o'},
+ { "pango-markup", no_argument, 0, 'P'},
+ { "font-render-mode", required_argument, 0, 'R'},
+ { "rigid", no_argument, 0, 'r'},
+ { "step", required_argument, 0, 'S'},
+ { "start", required_argument, 0, 's'},
+ { "tabwidth", required_argument, 0, 'T'},
+ { "title", required_argument, 0, 't'},
+ { "upper-limit", required_argument, 0, 'u'},
+ { "vertical-label", required_argument, 0, 'v'},
+ { "watermark", required_argument, 0, 'W'},
+ { "width", required_argument, 0, 'w'},
+ { "units-exponent", required_argument, 0, 'X'},
+ { "x-grid", required_argument, 0, 'x'},
+ { "alt-y-grid", no_argument, 0, 'Y'},
+ { "y-grid", required_argument, 0, 'y'},
+ { "lazy", no_argument, 0, 'z'},
+ { "units", required_argument, 0, LONGOPT_UNITS_SI},
+ { "alt-y-mrtg", no_argument, 0, 1000}, /* this has no effect it is just here to save old apps from crashing when they use it */
+ { "disable-rrdtool-tag",no_argument, 0, 1001},
+ { "right-axis", required_argument, 0, 1002},
+ { "right-axis-label", required_argument, 0, 1003},
+ { "right-axis-format", required_argument, 0, 1004},
+ { "legend-position", required_argument, 0, 1005},
+ { "legend-direction", required_argument, 0, 1006},
+ { "border", required_argument, 0, 1007},
+ { "grid-dash", required_argument, 0, 1008},
+ { "dynamic-labels", no_argument, 0, 1009},
+ { "week-fmt", required_argument, 0, 1010},
+ { "graph-type", required_argument, 0, 1011},
+ { 0, 0, 0, 0}
+};
+/* *INDENT-ON* */
+
+ optind = 0;
+ opterr = 0; /* initialize getopt */
+ rrd_parsetime("end-24h", &start_tv);
+ rrd_parsetime("now", &end_tv);
+ while (1) {
+ int option_index = 0;
+ int opt;
+ int col_start, col_end;
+
+ opt = getopt_long(argc, argv,
+ "Aa:B:b:c:Dd:Ee:Ff:G:gh:IiJjL:l:Mm:Nn:oPR:rS:s:T:t:u:v:W:w:X:x:Yy:z",
+ long_options, &option_index);
+ if (opt == EOF)
+ break;
+ switch (opt) {
+ case 'I':
+ im->extra_flags |= NOMINOR;
+ break;
+ case 'Y':
+ im->extra_flags |= ALTYGRID;
+ break;
+ case 'A':
+ im->extra_flags |= ALTAUTOSCALE;
+ break;
+ case 'J':
+ im->extra_flags |= ALTAUTOSCALE_MIN;
+ break;
+ case 'M':
+ im->extra_flags |= ALTAUTOSCALE_MAX;
+ break;
+ case 'j':
+ im->extra_flags |= ONLY_GRAPH;
+ break;
+ case 'g':
+ im->extra_flags |= NOLEGEND;
+ break;
+ case 1005:
+ if (strcmp(optarg, "north") == 0) {
+ im->legendposition = NORTH;
+ } else if (strcmp(optarg, "west") == 0) {
+ im->legendposition = WEST;
+ } else if (strcmp(optarg, "south") == 0) {
+ im->legendposition = SOUTH;
+ } else if (strcmp(optarg, "east") == 0) {
+ im->legendposition = EAST;
+ } else {
+ rrd_set_error("unknown legend-position '%s'", optarg);
+ return;
+ }
+ break;
+ case 1006:
+ if (strcmp(optarg, "topdown") == 0) {
+ im->legenddirection = TOP_DOWN;
+ } else if (strcmp(optarg, "bottomup") == 0) {
+ im->legenddirection = BOTTOM_UP;
+ } else {
+ rrd_set_error("unknown legend-position '%s'", optarg);
+ return;
+ }
+ break;
+ case 'F':
+ im->extra_flags |= FORCE_RULES_LEGEND;
+ break;
+ case 1001:
+ im->extra_flags |= NO_RRDTOOL_TAG;
+ break;
+ case LONGOPT_UNITS_SI:
+ if (im->extra_flags & FORCE_UNITS) {
+ rrd_set_error("--units can only be used once!");
+ return;
+ }
+ if (strcmp(optarg, "si") == 0)
+ im->extra_flags |= FORCE_UNITS_SI;
+ else {
+ rrd_set_error("invalid argument for --units: %s", optarg);
+ return;
+ }
+ break;
+ case 'X':
+ im->unitsexponent = atoi(optarg);
+ break;
+ case 'L':
+ im->unitslength = atoi(optarg);
+ im->forceleftspace = 1;
+ break;
+ case 'T':
+ im->tabwidth = atof(optarg);
+ break;
+ case 'S':
+ im->step = atoi(optarg);
+ break;
+ case 'N':
+ im->gridfit = 0;
+ break;
+ case 'P':
+ im->with_markup = 1;
+ break;
+ case 's':
+ if ((parsetime_error = rrd_parsetime(optarg, &start_tv))) {
+ rrd_set_error("start time: %s", parsetime_error);
+ return;
+ }
+ break;
+ case 'e':
+ if ((parsetime_error = rrd_parsetime(optarg, &end_tv))) {
+ rrd_set_error("end time: %s", parsetime_error);
+ return;
+ }
+ break;
+ case 'x':
+ if (strcmp(optarg, "none") == 0) {
+ im->draw_x_grid = 0;
+ break;
+ };
+ if (sscanf(optarg,
+ "%10[A-Z]:%ld:%10[A-Z]:%ld:%10[A-Z]:%ld:%ld:%n",
+ scan_gtm,
+ &im->xlab_user.gridst,
+ scan_mtm,
+ &im->xlab_user.mgridst,
+ scan_ltm,
+ &im->xlab_user.labst,
+ &im->xlab_user.precis, &stroff) == 7 && stroff != 0) {
+ strncpy(im->xlab_form, optarg + stroff,
+ sizeof(im->xlab_form) - 1);
+ im->xlab_form[sizeof(im->xlab_form) - 1] = '\0';
+ if ((int)
+ (im->xlab_user.gridtm = tmt_conv(scan_gtm)) == -1) {
+ rrd_set_error("unknown keyword %s", scan_gtm);
+ return;
+ } else if ((int)
+ (im->xlab_user.mgridtm = tmt_conv(scan_mtm))
+ == -1) {
+ rrd_set_error("unknown keyword %s", scan_mtm);
+ return;
+ } else if ((int)
+ (im->xlab_user.labtm = tmt_conv(scan_ltm)) == -1) {
+ rrd_set_error("unknown keyword %s", scan_ltm);
+ return;
+ }
+ im->xlab_user.minsec = 1;
+ im->xlab_user.stst = im->xlab_form;
+ } else {
+ rrd_set_error("invalid x-grid format");
+ return;
+ }
+ break;
+ case 'y':
+
+ if (strcmp(optarg, "none") == 0) {
+ im->draw_y_grid = 0;
+ break;
+ };
+ if (sscanf(optarg, "%lf:%d", &im->ygridstep, &im->ylabfact) == 2) {
+ if (im->ygridstep <= 0) {
+ rrd_set_error("grid step must be > 0");
+ return;
+ } else if (im->ylabfact < 1) {
+ rrd_set_error("label factor must be > 0");
+ return;
+ }
+ } else {
+ rrd_set_error("invalid y-grid format");
+ return;
+ }
+ break;
+ case 1007:
+ im->draw_3d_border = atoi(optarg);
+ break;
+ case 1008: /* grid-dash */