It's not available on all systems and using argc/argv directly does not
complicate the code much.
---
 libavcodec/dct-test.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
index 4647642..ed9ea4e 100644
--- a/libavcodec/dct-test.c
+++ b/libavcodec/dct-test.c
@@ -477,21 +477,22 @@ static void help(void)
 int main(int argc, char **argv)
 {
     int test_idct = 0, test_248_dct = 0;
-    int c, i;
+    int i;
     int test = 1;
     int speed = 0;
     int err = 0;
+    int optindex;
+    char *opt;
 
     cpu_flags = av_get_cpu_flags();
 
     ff_ref_dct_init();
     idct_mmx_init();
 
-    for (;;) {
-        c = getopt(argc, argv, "ih4t");
-        if (c == -1)
-            break;
-        switch (c) {
+    optindex = 1;
+    while (optindex < argc) {
+        opt = argv[optindex++];
+        switch (opt[1]) {
         case 'i':
             test_idct = 1;
             break;
@@ -501,16 +502,14 @@ int main(int argc, char **argv)
         case 't':
             speed = 1;
             break;
-        default:
         case 'h':
             help();
             return 0;
+        default:
+            test = atoi(opt);
         }
     }
 
-    if (optind < argc)
-        test = atoi(argv[optind]);
-
     printf("Libav DCT/IDCT test\n");
 
     if (test_248_dct) {
-- 
1.7.10

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to