Anton Khirnov <an...@khirnov.net> writes: > It's not available on all systems and using argc/argv directly does not > complicate the code much. > --- > libavcodec/fft-test.c | 25 ++++++++++++++----------- > 1 file changed, 14 insertions(+), 11 deletions(-) > > diff --git a/libavcodec/fft-test.c b/libavcodec/fft-test.c > index 75941a1..b06b92c 100644 > --- a/libavcodec/fft-test.c > +++ b/libavcodec/fft-test.c > @@ -217,8 +217,8 @@ static void help(void) > "-d (I)DCT test\n" > "-r (I)RDFT test\n" > "-i inverse transform test\n" > - "-n b set the transform size to 2^b\n" > - "-f x set scale factor for output data of (I)MDCT to x\n" > + "-n b set the transform size to 2^b\n" > + "-f x set scale factor for output data of (I)MDCT to x\n"
Huh? > ); > } > > @@ -233,10 +233,12 @@ int main(int argc, char **argv) > { > FFTComplex *tab, *tab1, *tab_ref; > FFTSample *tab2; > - int it, i, c; > + int it, i; > int cpuflags; > int do_speed = 0; > int err = 1; > + int optindex; > + char *opt; > enum tf_transform transform = TRANSFORM_FFT; > int do_inverse = 0; > FFTContext s1, *s = &s1; > @@ -252,11 +254,12 @@ int main(int argc, char **argv) > av_lfg_init(&prng, 1); > > fft_nbits = 9; > - for(;;) { > - c = getopt(argc, argv, "hsimrdn:f:c:"); > - if (c == -1) > - break; > - switch(c) { > + optindex = 1; > + while (optindex < argc) { > +#define GET_ARG (opt[2] ? opt + 2 : \ > + optindex < argc ? argv[optindex++] : "") > + opt = argv[optindex++]; > + switch (opt[1]) { > case 'h': > help(); > return 1; > @@ -276,13 +279,13 @@ int main(int argc, char **argv) > transform = TRANSFORM_DCT; > break; > case 'n': > - fft_nbits = atoi(optarg); > + fft_nbits = atoi(GET_ARG); I don't like this one bit. It makes the code considerably more complicated only to allow running two minor tests on an obscure platform. Just make the tests conditional. -- Måns Rullgård m...@mansr.com _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel