Send error messages to the standard error, and include the program name
[metze/wireshark/wip.git] / reordercap.c
index 2f809e8cea5e2fd062106f1776a7dc0585eda716..1e293039089544e9e80985f105a2d489df0de8aa 100644 (file)
@@ -108,7 +108,8 @@ frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh, Buffer *buf)
 
     /* Dump frame to outfile */
     if (!wtap_dump(pdh, &phdr, buffer_start_ptr(buf), &err)) {
-        printf("Error (%s) writing frame to outfile\n", wtap_strerror(err));
+        fprintf(stderr, "reordercap: Error (%s) writing frame to outfile\n",
+                wtap_strerror(err));
         exit(1);
     }
 }
@@ -200,7 +201,8 @@ int main(int argc, char *argv[])
     /* Open infile */
     wth = wtap_open_offline(infile, &err, &err_info, TRUE);
     if (wth == NULL) {
-        printf("reorder: Can't open %s: %s\n", infile, wtap_strerror(err));
+        fprintf(stderr, "reordercap: Can't open %s: %s\n", infile,
+                wtap_strerror(err));
         exit(1);
     }
     DEBUG_PRINT("file_type is %u\n", wtap_file_type(wth));
@@ -213,7 +215,8 @@ int main(int argc, char *argv[])
                             65535, FALSE, shb_hdr, idb_inf, &err);
     g_free(idb_inf);
     if (pdh == NULL) {
-        printf("Failed to open output file: (%s) - error %s\n", outfile, wtap_strerror(err));
+        fprintf(stderr, "reordercap: Failed to open output file: (%s) - error %s\n",
+                outfile, wtap_strerror(err));
         g_free(shb_hdr);
         exit(1);
     }
@@ -269,7 +272,8 @@ int main(int argc, char *argv[])
 
     /* Close outfile */
     if (!wtap_dump_close(pdh, &err)) {
-        printf("Error closing %s: %s\n", outfile, wtap_strerror(err));
+        fprintf(stderr, "reordercap: Error closing %s: %s\n", outfile,
+                wtap_strerror(err));
         g_free(shb_hdr);
         exit(1);
     }