example: use stdout instead of stderr
authorFelix Fietkau <nbd@openwrt.org>
Fri, 21 Mar 2014 20:11:39 +0000 (21:11 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 21 Mar 2014 20:11:39 +0000 (21:11 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
uclient-example.c

index b66468a7fb7a598be5ad8506ebb1a965afbfa776..07b330dc308edded71541938d1aecab5bf0d75fd 100644 (file)
@@ -1,4 +1,6 @@
 #include <libubox/blobmsg.h>
+#include <unistd.h>
+#include <stdio.h>
 
 #include "uclient.h"
 
@@ -7,12 +9,12 @@ static void example_header_done(struct uclient *cl)
        struct blob_attr *cur;
        int rem;
 
-       fprintf(stderr, "Headers: \n");
+       printf("Headers: \n");
        blobmsg_for_each_attr(cur, cl->meta, rem) {
-               fprintf(stderr, "%s=%s\n", blobmsg_name(cur), (char *) blobmsg_data(cur));
+               printf("%s=%s\n", blobmsg_name(cur), (char *) blobmsg_data(cur));
        }
 
-       fprintf(stderr, "Contents:\n");
+       printf("Contents:\n");
 }
 
 static void example_read_data(struct uclient *cl)
@@ -25,7 +27,7 @@ static void example_read_data(struct uclient *cl)
                if (!len)
                        return;
 
-               fwrite(buf, len, 1, stderr);
+               write(STDOUT_FILENO, buf, len);
        }
 }