+/* Default density numbers for [0-9][lmh] device specifications */
+
+#ifndef LOW_DENSITY_NUM
+# define LOW_DENSITY_NUM 0
+#endif
+
+#ifndef MID_DENSITY_NUM
+# define MID_DENSITY_NUM 8
+#endif
+
+#ifndef HIGH_DENSITY_NUM
+# define HIGH_DENSITY_NUM 16
+#endif
+
+static void
+update_argv (const char *filename, struct argp_state *state)
+{
+ FILE *fp;
+ size_t count = 0, i;
+ char *start, *p;
+ char **new_argv;
+ size_t new_argc;
+ bool is_stdin = false;
+ enum read_file_list_state read_state;
+
+ if (!strcmp (filename, "-"))
+ {
+ is_stdin = true;
+ request_stdin ("-T");
+ fp = stdin;
+ }
+ else
+ {
+ add_file_id (filename);
+ if ((fp = fopen (filename, "r")) == NULL)
+ open_fatal (filename);
+ }
+
+ while ((read_state = read_name_from_file (fp, &argv_stk)) == file_list_success)
+ count++;
+
+ if (read_state == file_list_zero)
+ {
+ size_t size;
+
+ WARN ((0, 0, N_("%s: file name read contains nul character"),
+ quotearg_colon (filename)));
+
+ /* Prepare new stack contents */
+ size = obstack_object_size (&argv_stk);
+ p = obstack_finish (&argv_stk);
+ for (; size > 0; size--, p++)
+ if (*p)
+ obstack_1grow (&argv_stk, *p);
+ else
+ obstack_1grow (&argv_stk, '\n');
+ obstack_1grow (&argv_stk, 0);
+ count = 1;
+
+ /* Read rest of files using new filename terminator */
+ filename_terminator = 0;
+ while (read_name_from_file (fp, &argv_stk) == file_list_success)
+ count++;
+ }
+
+ if (!is_stdin)
+ fclose (fp);
+
+ if (count == 0)
+ return;
+
+ start = obstack_finish (&argv_stk);
+
+ if (filename_terminator == 0)
+ for (p = start; *p; p += strlen (p) + 1)
+ if (p[0] == '-')
+ count++;
+
+ new_argc = state->argc + count;
+ new_argv = xmalloc (sizeof (state->argv[0]) * (new_argc + 1));
+ memcpy (new_argv, state->argv, sizeof (state->argv[0]) * (state->argc + 1));
+ state->argv = new_argv;
+ memmove (&state->argv[state->next + count], &state->argv[state->next],
+ (state->argc - state->next + 1) * sizeof (state->argv[0]));
+
+ state->argc = new_argc;
+
+ for (i = state->next, p = start; *p; p += strlen (p) + 1, i++)
+ {
+ if (filename_terminator == 0 && p[0] == '-')
+ state->argv[i++] = "--add-file";
+ state->argv[i] = p;
+ }
+}
+
+\f