+/* Does checks in common betwen check_input_specifier() and
+ check_output_specifier() and returns true if so. Otherwise,
+ emits an error message (if EMIT_ERROR is nonzero) and returns
+ false. */
+static bool
+check_common_specifier (const struct fmt_spec *spec, bool emit_error)
+{
+ struct fmt_desc *f = &formats[spec->type];
+ char *str = fmt_to_string (spec);
+
+ if ((f->cat & FCAT_EVEN_WIDTH) && spec->w % 2)
+ {
+ if (emit_error)
+ msg (SE, _("Format %s specifies an odd width %d, but "
+ "format %s requires an even width."),
+ str, spec->w, f->name, f->Imin_w, f->Imax_w);
+ return false;
+ }
+ if (f->n_args > 1 && (spec->d < 0 || spec->d > 16))
+ {
+ if (emit_error)
+ msg (SE, _("Format %s specifies a bad number of "
+ "implied decimal places %d. Input format %s allows "
+ "up to 16 implied decimal places."), str, spec->d, f->name);
+ return false;
+ }
+ return true;
+}
+
+/* Checks whether SPEC is valid as an input format and returns
+ nonzero if so. Otherwise, emits an error message (if
+ EMIT_ERROR is nonzero) and returns zero. */