aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-kkbd.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-08-19 13:37:19 +0200
committerMattias Andrée <maandree@operamail.com>2015-08-19 13:37:19 +0200
commitce5160a39d26a8e7cf0633d0d144436a5156837a (patch)
tree5ac139854c4d620f7549c4be4c1231644ba0a49b /src/mds-kkbd.c
parenttypo + continued work on mds-colour (diff)
downloadmds-ce5160a39d26a8e7cf0633d0d144436a5156837a.tar.gz
mds-ce5160a39d26a8e7cf0633d0d144436a5156837a.tar.bz2
mds-ce5160a39d26a8e7cf0633d0d144436a5156837a.tar.xz
put full_send in libmdsserver, clients that only has one socket uses a macro to remove the socket parameter
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds-kkbd.c')
-rw-r--r--src/mds-kkbd.c42
1 files changed, 11 insertions, 31 deletions
diff --git a/src/mds-kkbd.c b/src/mds-kkbd.c
index d5ac9e5..9bb8294 100644
--- a/src/mds-kkbd.c
+++ b/src/mds-kkbd.c
@@ -212,6 +212,17 @@ static int led_compose = LED_COMPOSE;
/**
+ * Send a full message even if interrupted
+ *
+ * @param message:const char* The message to send
+ * @param length:size_t The length of the message
+ * @return :int Zero on success, -1 on error
+ */
+#define full_send(message, length) \
+ ((full_send)(socket_fd, message, length))
+
+
+/**
* Parse command line arguments
*
* @return Non-zero on error
@@ -1392,37 +1403,6 @@ void signal_all(int signo)
/**
- * Send a full message even if interrupted
- *
- * @param message The message to send
- * @param length The length of the message
- * @return Zero on success, -1 on error
- */
-int full_send(const char* message, size_t length)
-{
- size_t sent;
-
- while (length > 0)
- {
- sent = send_message(socket_fd, message, length);
- if (sent > length)
- {
- eprint("Sent more of a message than exists in the message, aborting.");
- return -1;
- }
- else
- fail_if ((sent < length) && (errno != EINTR));
- message += sent;
- length -= sent;
- }
- return 0;
- fail:
- xperror(*argv);
- return -1;
-}
-
-
-/**
* Acquire access of the keyboard's LED:s
*
* @return Zero on success, -1 on error