- /* Special case for --format=raw of full single message, just cat out file */
- if (params->raw && 0 == params->part) {
-
- const char *filename;
- FILE *file;
- size_t size;
- char buf[4096];
-
- filename = notmuch_message_get_filename (message);
- if (filename == NULL) {
- fprintf (stderr, "Error: Cannot message filename.\n");
- return 1;
- }
-
- file = fopen (filename, "r");
- if (file == NULL) {
- fprintf (stderr, "Error: Cannot open file %s: %s\n", filename, strerror (errno));
- return 1;
- }
-
- while (!feof (file)) {
- size = fread (buf, 1, sizeof (buf), file);
- if (ferror (file)) {
- fprintf (stderr, "Error: Read failed from %s\n", filename);
- fclose (file);
- return 1;
- }
-
- if (fwrite (buf, size, 1, stdout) != 1) {
- fprintf (stderr, "Error: Write failed\n");
- fclose (file);
- return 1;
- }
- }
-
- fclose (file);
-
- } else {
-
- show_message (ctx, format, message, 0, params);
-
- }
-
- return 0;
+ return show_message (ctx, format, sp, message, 0, params)
+ != NOTMUCH_STATUS_SUCCESS;