blind-colour-ciexyz.c (832B)
1 /* See LICENSE file for copyright and license details. */ 2 #include "common.h" 3 4 USAGE("[-% format] (X Y Z | Y)") 5 6 int 7 main(int argc, char *argv[]) 8 { 9 double X, Y, Z; 10 const char *fmt = NULL; 11 12 ARGBEGIN { 13 case '%': 14 fmt = UARGF(); 15 break; 16 default: 17 usage(); 18 } ARGEND; 19 20 if (argc == 1) { 21 fmt = select_print_format("%! %! %!\n", DOUBLE, fmt); 22 Y = etolf_arg("the Y value", argv[0]); 23 X = Y * D65_XYZ_X; 24 Z = Y * D65_XYZ_Z; 25 printf(fmt, X, Y, Z); 26 } else if (argc == 3 && fmt) { 27 fmt = select_print_format("%! %! %!\n", DOUBLE, fmt); 28 X = etolf_arg("the X value", argv[0]); 29 Y = etolf_arg("the Y value", argv[1]); 30 Z = etolf_arg("the Z value", argv[2]); 31 printf(fmt, X, Y, Z); 32 } else if (argc == 3) { 33 printf("%s %s %s\n", argv[0], argv[1], argv[2]); 34 } else { 35 usage(); 36 } 37 38 efshut(stdout, "<stdout>"); 39 return 0; 40 }