+/**
+ Make input file name from command argument.
+
+ Path describes file name with added default extension,
+ ".ly" if none. "-" is stdin.
+ */
+Path
+distill_inname (String str)
+{
+ Path p = split_path (str);
+ if (str.empty_b () || str == "-")
+ p.base = "-";
+ else
+ {
+ String orig_ext = p.ext;
+ char const *extensions[] = {"ly", "fly", "sly", "", 0};
+ for (int i = 0; extensions[i]; i++)
+ {
+ p.ext = orig_ext;
+ if (*extensions[i] && !p.ext.empty_b ())
+ p.ext += ".";
+ p.ext += extensions[i];
+ if (!global_path.find (p.str ()).empty_b ())
+ break;
+ }
+ /* Reshuffle extension */
+ p = split_path (p.str ());
+ }
+ return p;
+}
+
+String
+format_to_ext (String format)
+{
+ if (format == "tex")
+ /* .lytex change put off */
+ return "tex"; // "lytex";
+ return format;
+}