summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c56d3fd)
raw | patch | inline | side by side (parent: c56d3fd)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 11 Dec 2012 09:58:13 +0000 (10:58 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 11 Dec 2012 09:58:13 +0000 (10:58 +0100) |
src/include/utils/unixsock.h | patch | blob | history | |
src/utils/unixsock.c | patch | blob | history |
index 0df0b71a3da6526dec090b489e6cbc9189eaba4a..d40661390d99bd466357c585eeccd2c83390a8a7 100644 (file)
int
sc_unixsock_client_shutdown(sc_unixsock_client_t *client, int how);
+/*
+ * sc_unixsock_client_clearerr, sc_unixsock_client_eof,
+ * sc_unixsock_client_error:
+ * Check and reset the client status. See the clearerr(3), feof(3), and
+ * ferror(3) manpages for details.
+ */
+void
+sc_unixsock_client_clearerr(sc_unixsock_client_t *client);
+int
+sc_unixsock_client_eof(sc_unixsock_client_t *client);
+int
+sc_unixsock_client_error(sc_unixsock_client_t *client);
+
void
sc_unixsock_client_destroy(sc_unixsock_client_t *client);
diff --git a/src/utils/unixsock.c b/src/utils/unixsock.c
index af1f2fedaf4c6c5bd9c7fb253a0ce8baf856982f..11ddd7d7b2545be3ec686d8dcb8d6c496045de3f 100644 (file)
--- a/src/utils/unixsock.c
+++ b/src/utils/unixsock.c
return status;
} /* sc_unixsock_client_shutdown */
+void
+sc_unixsock_client_clearerr(sc_unixsock_client_t *client)
+{
+ if ((! client) || (! client->fh))
+ return;
+ clearerr(client->fh);
+} /* sc_unixsock_client_clearerr */
+
+int
+sc_unixsock_client_eof(sc_unixsock_client_t *client)
+{
+ if ((! client) || (! client->fh)) {
+ errno = EBADF;
+ return -1;
+ }
+ return feof(client->fh);
+} /* sc_unixsock_client_eof */
+
+int
+sc_unixsock_client_error(sc_unixsock_client_t *client)
+{
+ if ((! client) || (! client->fh)) {
+ errno = EBADF;
+ return -1;
+ }
+ return ferror(client->fh);
+} /* sc_unixsock_client_error */
+
void
sc_unixsock_client_destroy(sc_unixsock_client_t *client)
{