I don't know what I was thinking when I wrote this, but the doioctl() I added in a previous patch will write failure messages to stderr even though the decription of the ioctl it went to stdout. This patch fixes that so you won't see:
failed: Invalid argument
ioctl IVTV_IOC_S_VBI_EMBED [EMAIL PROTECTED]:~/video/ivtv/utils$
If you want to change it so the whole thing goes to stderr, that's fine too, it should just not be split.

Also changes the S_CODEC to use the standard doioctl() way.
Index: ivtv/utils/ivtvctl.c
===================================================================
--- ivtv/utils/ivtvctl.c        (revision 285)
+++ ivtv/utils/ivtvctl.c        (working copy)
@@ -455,7 +455,7 @@
        printf("ioctl %s ", name);
        retVal = ioctl(fd, request, parm);
        if (retVal < 0)
-               fprintf(stderr, "failed: %s\n", strerror(errno));
+               printf("failed: %s\n", strerror(errno));
        else
                printf("ok\n");
        
@@ -1126,7 +1126,6 @@
 
        if (options[OptSetCodec]) {
                struct ivtv_ioctl_codec in_codec;
-               printf("ioctl: IVTV_IOC_S_CODEC\n");
                if (ioctl(fd, IVTV_IOC_G_CODEC, &in_codec) < 0)
                        fprintf(stderr, "ioctl: IVTV_IOC_G_CODEC failed\n");
                else {
@@ -1160,11 +1159,7 @@
                                in_codec.dnr_temporal = codec.dnr_temporal;
                        if (set_codecs & CPullDown)
                                in_codec.pulldown = codec.pulldown;
-                       if (ioctl(fd, IVTV_IOC_S_CODEC, &in_codec) < 0)
-                               fprintf(stderr,
-                                       "ioctl: IVTV_IOC_S_CODEC failed\n");
-                       else
-                               printf("ioctl: IVTV_IOC_S_CODEC ok\n");
+                       doioctl(fd, IVTV_IOC_S_CODEC, &in_codec, 
"IVTV_IOC_S_CODEC");
                }
        }
 

Reply via email to