| 3363 | */ |
| 3364 | |
| 3365 | static char * /* O - Value string or NULL on error */ |
| 3366 | get_option_value( |
| 3367 | ppd_file_t *ppd, /* I - PPD file */ |
| 3368 | const char *name, /* I - Option name */ |
| 3369 | char *buffer, /* I - String buffer */ |
| 3370 | size_t bufsize) /* I - Size of buffer */ |
| 3371 | { |
| 3372 | char *bufptr, /* Pointer into buffer */ |
| 3373 | *bufend; /* End of buffer */ |
| 3374 | ppd_coption_t *coption; /* Custom option */ |
| 3375 | ppd_cparam_t *cparam; /* Current custom parameter */ |
| 3376 | char keyword[256]; /* Parameter name */ |
| 3377 | const char *val, /* Parameter value */ |
| 3378 | *uval; /* Units value */ |
| 3379 | long integer; /* Integer value */ |
| 3380 | double number, /* Number value */ |
| 3381 | number_points; /* Number in points */ |
| 3382 | |
| 3383 | |
| 3384 | /* |
| 3385 | * See if we have a custom option choice... |
| 3386 | */ |
| 3387 | |
| 3388 | if ((val = cgiGetVariable(name)) == NULL) |
| 3389 | { |
| 3390 | /* |
| 3391 | * Option not found! |
| 3392 | */ |
| 3393 | |
| 3394 | return (NULL); |
| 3395 | } |
| 3396 | else if (_cups_strcasecmp(val, "Custom") || |
| 3397 | (coption = ppdFindCustomOption(ppd, name)) == NULL) |
| 3398 | { |
| 3399 | /* |
| 3400 | * Not a custom choice... |
| 3401 | */ |
| 3402 | |
| 3403 | strlcpy(buffer, val, bufsize); |
| 3404 | return (buffer); |
| 3405 | } |
| 3406 | |
| 3407 | /* |
| 3408 | * OK, we have a custom option choice, format it... |
| 3409 | */ |
| 3410 | |
| 3411 | *buffer = '\0'; |
| 3412 | |
| 3413 | if (!strcmp(coption->keyword, "PageSize")) |
| 3414 | { |
| 3415 | const char *lval; /* Length string value */ |
| 3416 | double width, /* Width value */ |
| 3417 | width_points, /* Width in points */ |
| 3418 | length, /* Length value */ |
| 3419 | length_points; /* Length in points */ |
| 3420 | |
| 3421 | |
| 3422 | val = cgiGetVariable("PageSize.Width"); |
no test coverage detected