/*
- *
+ * This file contains functions which handle ctdlsh's connection
+ * to the Citadel server's admin socket.
+ *
+ * Copyright (c) 2009-2012 by the Citadel.org team.
+ * This program is open source software, cheerfully made available to you under
+ * the terms of the GNU General Public License version 3.
*/
-#include <config.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <string.h>
-#include <pwd.h>
-#include <errno.h>
-#include <stdarg.h>
-
-#ifndef INADDR_NONE
-#define INADDR_NONE 0xffffffff
-#endif
+#include "ctdlsh.h"
+
int uds_connectsock(char *sockpath)
{
}
-
/*
* Input string from socket - implemented in terms of sock_read()
*
}
-
/*
- * sock_puts() - send line to server - implemented in terms of serv_write()
+ * sock_puts() - send line to server - implemented in terms of sock_write()
* Returns the number of bytes written, or -1 for error.
*/
int sock_puts(int sock, char *buf)
}
+/*
+ * Write a formatted string to the server - implemented in terms of sock_write()
+ */
+void sock_printf(int sock, const char *format,...)
+{
+ va_list arg_ptr;
+ char buf[4096];
+ size_t len;
+
+ va_start(arg_ptr, format);
+ vsnprintf(buf, sizeof buf, format, arg_ptr);
+ va_end(arg_ptr);
+
+ sock_write(sock, buf, strlen(buf));
+}