diff --git a/src/parse.c b/src/parse.c
index 59e62ed8a0bafd5da323090fb29c23c5ed815e08..1ed38ca060944da7cb9e51aea0b2ed87574c441e 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -306,6 +306,18 @@ parse_atom_list(struct simple_buffer *buffer, unsigned limit)
   return parse_atoms(&sub_buffer, limit);
 }
 
+struct lsh_string *
+parse_rest(struct simple_buffer *buffer)
+{
+  UINT32 length = LEFT;
+  struct lsh_string *s = ssh_format("%ls", length, HERE);
+
+  ADVANCE(length);
+  assert(!LEFT);
+
+  return s;
+}
+
 /* Returns success (i.e. 1) iff there is no data left */
 int
 parse_eod(struct simple_buffer *buffer)
diff --git a/src/parse.h b/src/parse.h
index 30273235919030fb5f05d3f76eed9e0d0e9510b4..d377fcd61d860bc2d710e7838a496871ec2fda3d 100644
--- a/src/parse.h
+++ b/src/parse.h
@@ -83,6 +83,10 @@ struct int_list *parse_atoms(struct simple_buffer *buffer, unsigned limit);
  * read. Returns a NULL pointer on error. */
 struct int_list *parse_atom_list(struct simple_buffer *buffer, unsigned limit);
 
+/* Copies the rest of the buffer into a string. */
+struct lsh_string *
+parse_rest(struct simple_buffer *buffer);
+
 /* Returns success (i.e. 1) iff there is no data left */
 int parse_eod(struct simple_buffer *buffer);