cleanup
This commit is contained in:
42
funcs/t.c
42
funcs/t.c
@@ -61,6 +61,16 @@ while (pcmd->name) {
|
||||
return -1;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
void list_tests(void)
|
||||
{
|
||||
Command *pcmd = commands;
|
||||
while (pcmd->name) {
|
||||
printf("%s\n", pcmd->name);
|
||||
pcmd++;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
void help(int k)
|
||||
{
|
||||
Command *pcmd;
|
||||
@@ -68,7 +78,9 @@ Command *pcmd;
|
||||
fprintf(stderr, "usage:\n\t./t [options] command [filename]\n");
|
||||
|
||||
fprintf(stderr, "options:\n");
|
||||
fprintf(stderr, "\t-o outfile\n");
|
||||
fprintf(stderr, "\t-k 1.414\tset float value\n");
|
||||
fprintf(stderr, "\t-l\t\tlist tests\n");
|
||||
fprintf(stderr, "\t-o \t\toutfile\n");
|
||||
|
||||
fprintf(stderr, "commands:\n");
|
||||
pcmd = commands;
|
||||
@@ -94,10 +106,12 @@ outfile = "out.pnm";
|
||||
command = "none";
|
||||
filename = "in.fimg";
|
||||
|
||||
while ((opt = getopt(argc, argv, "hk:o:p:v")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "hk:lo:p:v")) != -1) {
|
||||
// fprintf(stderr, "opt = %c\n", opt);
|
||||
switch(opt) {
|
||||
case 'h': help(0); break;
|
||||
case 'k': global_fvalue = atof(optarg); break;
|
||||
case 'l': list_tests(); break;
|
||||
case 'o': outfile = optarg; break;
|
||||
case 'v': verbosity++; break;
|
||||
}
|
||||
@@ -141,19 +155,21 @@ switch(opt) {
|
||||
foo = essai_mire(filename, 0);
|
||||
break;
|
||||
case Wfits:
|
||||
foo = essai_ecriture_fits(filename);
|
||||
foo = essai_ecriture_fits("out.fits");
|
||||
break;
|
||||
case Wpng:
|
||||
foo = essai_ecriture_png(filename);
|
||||
foo = essai_ecriture_png("out.png");
|
||||
break;
|
||||
case Wtiff:
|
||||
foo = essai_ecriture_tiff(filename);
|
||||
foo = essai_ecriture_tiff("out.tiff");
|
||||
break;
|
||||
case Histo:
|
||||
foo = essai_histogramme(filename, 98765);
|
||||
break;
|
||||
case Hsv:
|
||||
foo = fimg_essai_hsv(filename);
|
||||
// not ready for primtime
|
||||
// foo = fimg_essai_hsv(filename);
|
||||
foo = 0;
|
||||
break;
|
||||
case Classif:
|
||||
foo = essai_classif(filename, outfile, global_fvalue);
|
||||
@@ -168,23 +184,29 @@ switch(opt) {
|
||||
foo = essai_displacement(filename, outfile);
|
||||
break;
|
||||
case ReadPNG:
|
||||
foo = essai_lecture_png(filename, outfile, 0);
|
||||
// not ready for primetime
|
||||
// foo = essai_lecture_png("in.png", outfile, 0);
|
||||
foo = 0;
|
||||
break;
|
||||
case Plasmas:
|
||||
foo = essai_plasma(filename, outfile, 1, global_fvalue);
|
||||
fprintf(stderr, "we are all plasmafields\n");
|
||||
break;
|
||||
case Rotate:
|
||||
fprintf(stderr, "rotate not implemented (%d)\n", rand());
|
||||
foo = 0;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s : bad command\n", command);
|
||||
fprintf(stderr, "'%s' is a bad command\n", command);
|
||||
exit(1);
|
||||
|
||||
}
|
||||
|
||||
if (foo) {
|
||||
fprintf(stderr, "Essai ====> %d\n", foo);
|
||||
fprintf(stderr, "******* Essai --> %d\n", foo);
|
||||
}
|
||||
|
||||
fprintf(stderr, "+++++ end of %s pid %d\n", command, getpid());
|
||||
fprintf(stderr, "++++++++++++ end of '%s' pid %d\n", command, getpid());
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user