+/* Complete on filenames. */
+/* FIXME: This would be a lot more useful if the word breaks got set
+ to not include '/'. Probably best to make it up to each completer
+ to do its own word breaking. */
+char **
+filename_completer (text)
+ char *text;
+{
+ /* From readline. */
+ extern char *filename_completion_function ();
+ int subsequent_name;
+ char **return_val;
+ int return_val_used;
+ int return_val_alloced;
+
+ return_val_used = 0;
+ /* Small for testing. */
+ return_val_alloced = 1;
+ return_val = (char **) xmalloc (return_val_alloced * sizeof (char *));
+
+ subsequent_name = 0;
+ while (1)
+ {
+ char *p;
+ p = filename_completion_function (text, subsequent_name);
+ if (return_val_used >= return_val_alloced)
+ {
+ return_val_alloced *= 2;
+ return_val =
+ (char **) xrealloc (return_val,
+ return_val_alloced * sizeof (char *));
+ }
+ /* The string itself has already been stored in newly malloc'd space
+ for us by filename_completion_function. */
+ return_val[return_val_used++] = p;
+ if (p == NULL)
+ break;
+ subsequent_name = 1;
+ }
+ return return_val;
+}
+