+add_file_id (const char *filename)
+{
+ struct file_id_list *p;
+ struct stat st;
+ const char *reading_from;
+
+ if (stat (filename, &st))
+ stat_fatal (filename);
+ reading_from = file_list_name ();
+ for (p = file_id_list; p; p = p->next)
+ if (p->ino == st.st_ino && p->dev == st.st_dev)
+ {
+ int oldc = set_char_quoting (NULL, ':', 1);
+ ERROR ((0, 0,
+ _("%s: file list requested from %s already read from %s"),
+ quotearg_n (0, filename),
+ reading_from, p->from_file));
+ set_char_quoting (NULL, ':', oldc);
+ return 1;
+ }
+ p = xmalloc (sizeof *p);
+ p->next = file_id_list;
+ p->ino = st.st_ino;
+ p->dev = st.st_dev;
+ p->from_file = reading_from;
+ file_id_list = p;
+ return 0;
+}
+\f
+enum read_file_list_state /* Result of reading file name from the list file */
+ {
+ file_list_success, /* OK, name read successfully */
+ file_list_end, /* End of list file */
+ file_list_zero, /* Zero separator encountered where it should not */
+ file_list_skip /* Empty (zero-length) entry encountered, skip it */
+ };
+
+/* Read from FP a sequence of characters up to TERM and put them
+ into STK.
+ */
+static enum read_file_list_state
+read_name_from_file (struct name_elt *ent)