- while (ch)
- {
- field = ch;
- ch = get_field (ch);
- dprint (2, (debugfile, "field: %s\n", field));
-
- if (!ascii_strcasecmp (field, "needsterminal"))
- {
- if (entry)
- entry->needsterminal = TRUE;
- }
- else if (!ascii_strcasecmp (field, "copiousoutput"))
- {
- copiousoutput = TRUE;
- if (entry)
- entry->copiousoutput = TRUE;
- }
- else if (!ascii_strncasecmp (field, "composetyped", 12))
- {
- /* this compare most occur before compose to match correctly */
- if (get_field_text (field + 12, entry ? &entry->composetypecommand : NULL,
- type, filename, line))
- composecommand = TRUE;
- }
- else if (!ascii_strncasecmp (field, "compose", 7))
- {
- if (get_field_text (field + 7, entry ? &entry->composecommand : NULL,
- type, filename, line))
- composecommand = TRUE;
- }
- else if (!ascii_strncasecmp (field, "print", 5))
- {
- if (get_field_text (field + 5, entry ? &entry->printcommand : NULL,
- type, filename, line))
- printcommand = TRUE;
- }
- else if (!ascii_strncasecmp (field, "edit", 4))
- {
- if (get_field_text (field + 4, entry ? &entry->editcommand : NULL,
- type, filename, line))
- editcommand = TRUE;
- }
- else if (!ascii_strncasecmp (field, "nametemplate", 12))
- {
- get_field_text (field + 12, entry ? &entry->nametemplate : NULL,
- type, filename, line);
- }
- else if (!ascii_strncasecmp (field, "x-convert", 9))
- {
- get_field_text (field + 9, entry ? &entry->convert : NULL,
- type, filename, line);
- }
- else if (!ascii_strncasecmp (field, "test", 4))
- {
- /*
- * This routine executes the given test command to determine
- * if this is the right entry.
- */
- char *test_command = NULL;
- size_t len;
-
- if (get_field_text (field + 4, &test_command, type, filename, line)
- && test_command)
- {
- len = mutt_strlen (test_command) + STRING;
- safe_realloc (&test_command, len);
- rfc1524_expand_command (a, a->filename, type, test_command, len);
- if (mutt_system (test_command))
- {
- /* a non-zero exit code means test failed */
- found = FALSE;
- }
- FREE (&test_command);
- }
- }
- } /* while (ch) */
-
- if (opt == M_AUTOVIEW)
- {
- if (!copiousoutput)
- found = FALSE;
+ while (ch) {
+ field = ch;
+ ch = get_field (ch);
+
+ if (!ascii_strcasecmp (field, "needsterminal")) {
+ if (entry)
+ entry->needsterminal = TRUE;
+ }
+ else if (!ascii_strcasecmp (field, "copiousoutput")) {
+ copiousoutput = TRUE;
+ if (entry)
+ entry->copiousoutput = TRUE;
+ }
+ else if (!ascii_strncasecmp (field, "composetyped", 12)) {
+ /* this compare most occur before compose to match correctly */
+ if (get_field_text
+ (field + 12, entry ? &entry->composetypecommand : NULL, type,
+ filename, line))
+ composecommand = TRUE;
+ }
+ else if (!ascii_strncasecmp (field, "compose", 7)) {
+ if (get_field_text
+ (field + 7, entry ? &entry->composecommand : NULL, type,
+ filename, line))
+ composecommand = TRUE;
+ }
+ else if (!ascii_strncasecmp (field, "print", 5)) {
+ if (get_field_text (field + 5, entry ? &entry->printcommand : NULL,
+ type, filename, line))
+ printcommand = TRUE;
+ }
+ else if (!ascii_strncasecmp (field, "edit", 4)) {
+ if (get_field_text (field + 4, entry ? &entry->editcommand : NULL,
+ type, filename, line))
+ editcommand = TRUE;
+ }
+ else if (!ascii_strncasecmp (field, "nametemplate", 12)) {
+ get_field_text (field + 12, entry ? &entry->nametemplate : NULL,
+ type, filename, line);
+ }
+ else if (!ascii_strncasecmp (field, "x-convert", 9)) {
+ get_field_text (field + 9, entry ? &entry->convert : NULL,
+ type, filename, line);
+ }
+ else if (!ascii_strncasecmp (field, "test", 4)) {
+ /*
+ * This routine executes the given test command to determine
+ * if this is the right entry.
+ */
+ char *test_command = NULL;
+ ssize_t len;
+
+ if (get_field_text (field + 4, &test_command, type, filename, line)
+ && test_command) {
+ len = m_strlen(test_command) + STRING;
+ p_realloc(&test_command, len);
+ rfc1524_expand_command (a, a->filename, type, test_command, len);
+ if (mutt_system (test_command)) {
+ /* a non-zero exit code means test failed */
+ found = FALSE;
+ }
+ p_delete(&test_command);
+ }
+ }
+ } /* while (ch) */
+
+ if (opt == M_AUTOVIEW) {
+ if (!copiousoutput)
+ found = FALSE;