summaryrefslogtreecommitdiffstats
path: root/daemon/guestfsd.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-04-06 11:44:48 +0100
committerRichard Jones <rjones@redhat.com>2009-04-06 11:44:48 +0100
commit1cf85b1e60e85c4940869c6291d75ac44a5bd190 (patch)
tree1ee9a499264042801ffd73f4c999a48a5535973b /daemon/guestfsd.c
parentbf17bf81fef275892d24458ce5f1e5290b426742 (diff)
downloadlibguestfs-1cf85b1e60e85c4940869c6291d75ac44a5bd190.tar.gz
libguestfs-1cf85b1e60e85c4940869c6291d75ac44a5bd190.tar.xz
libguestfs-1cf85b1e60e85c4940869c6291d75ac44a5bd190.zip
Implementations of 'cat', 'ls', and some cleanups.
Diffstat (limited to 'daemon/guestfsd.c')
-rw-r--r--daemon/guestfsd.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 9d110d73..6730c1d2 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -231,6 +231,38 @@ usage (void)
}
int
+add_string (char ***argv, int *size, int *alloc, const char *str)
+{
+ char **new_argv;
+ char *new_str;
+
+ if (*size >= *alloc) {
+ *alloc += 64;
+ new_argv = realloc (*argv, *alloc * sizeof (char *));
+ if (new_argv == NULL) {
+ reply_with_perror ("realloc");
+ free_strings (*argv);
+ return -1;
+ }
+ *argv = new_argv;
+ }
+
+ if (str) {
+ new_str = strdup (str);
+ if (new_str == NULL) {
+ reply_with_perror ("strdup");
+ free_strings (*argv);
+ }
+ } else
+ new_str = NULL;
+
+ (*argv)[*size] = new_str;
+
+ (*size)++;
+ return 0;
+}
+
+int
count_strings (char **argv)
{
int argc;