aboutsummaryrefslogtreecommitdiffstats
path: root/src/blind-colour-ciexyz.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/blind-colour-ciexyz.c')
-rw-r--r--src/blind-colour-ciexyz.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/blind-colour-ciexyz.c b/src/blind-colour-ciexyz.c
index 9710074..17dec5a 100644
--- a/src/blind-colour-ciexyz.c
+++ b/src/blind-colour-ciexyz.c
@@ -1,20 +1,34 @@
/* See LICENSE file for copyright and license details. */
#include "common.h"
-USAGE("(X Y Z | Y)")
+USAGE("[-% format] (X Y Z | Y)")
int
main(int argc, char *argv[])
{
double X, Y, Z;
+ const char *fmt = NULL;
- UNOFLAGS(0);
+ ARGBEGIN {
+ case '%':
+ fmt = UARGF();
+ break;
+ default:
+ usage();
+ } ARGEND;
if (argc == 1) {
+ fmt = select_print_format("%! %! %!\n", DOUBLE, fmt);
Y = etolf_arg("the Y value", argv[0]);
X = Y * D65_XYZ_X;
Z = Y * D65_XYZ_Z;
- printf("%.50lf %.50lf %.50lf\n", X, Y, Z);
+ printf(fmt, X, Y, Z);
+ } else if (argc == 3 && fmt) {
+ fmt = select_print_format("%! %! %!\n", DOUBLE, fmt);
+ X = etolf_arg("the X value", argv[0]);
+ Y = etolf_arg("the Y value", argv[1]);
+ Z = etolf_arg("the Z value", argv[2]);
+ printf(fmt, X, Y, Z);
} else if (argc == 3) {
printf("%s %s %s\n", argv[0], argv[1], argv[2]);
} else {