aboutsummaryrefslogtreecommitdiffstats
path: root/man7/unix.7
diff options
context:
space:
mode:
Diffstat (limited to 'man7/unix.7')
-rw-r--r--man7/unix.738
1 files changed, 19 insertions, 19 deletions
diff --git a/man7/unix.7 b/man7/unix.7
index 40edeb90d7..c3372e28fb 100644
--- a/man7/unix.7
+++ b/man7/unix.7
@@ -978,7 +978,7 @@ main(int argc, char *argv[])
int result;
char buffer[BUFFER_SIZE];
- /* Create local socket */
+ /* Create local socket. */
connection_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);
if (connection_socket == \-1) {
@@ -994,7 +994,7 @@ main(int argc, char *argv[])
memset(&name, 0, sizeof(name));
- /* Bind socket to socket name */
+ /* Bind socket to socket name. */
name.sun_family = AF_UNIX;
strncpy(name.sun_path, SOCKET_NAME, sizeof(name.sun_path) \- 1);
@@ -1018,11 +1018,11 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- /* This is the main loop for handling connections */
+ /* This is the main loop for handling connections. */
for (;;) {
- /* Wait for incoming connection */
+ /* Wait for incoming connection. */
data_socket = accept(connection_socket, NULL, NULL);
if (data_socket == \-1) {
@@ -1033,7 +1033,7 @@ main(int argc, char *argv[])
result = 0;
for (;;) {
- /* Wait for next data packet */
+ /* Wait for next data packet. */
ret = read(data_socket, buffer, sizeof(buffer));
if (ret == \-1) {
@@ -1041,11 +1041,11 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- /* Ensure buffer is 0\-terminated */
+ /* Ensure buffer is 0\-terminated. */
buffer[sizeof(buffer) \- 1] = 0;
- /* Handle commands */
+ /* Handle commands. */
if (!strncmp(buffer, "DOWN", sizeof(buffer))) {
down_flag = 1;
@@ -1056,12 +1056,12 @@ main(int argc, char *argv[])
break;
}
- /* Add received summand */
+ /* Add received summand. */
result += atoi(buffer);
}
- /* Send result */
+ /* Send result. */
sprintf(buffer, "%d", result);
ret = write(data_socket, buffer, sizeof(buffer));
@@ -1070,11 +1070,11 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- /* Close socket */
+ /* Close socket. */
close(data_socket);
- /* Quit on DOWN command */
+ /* Quit on DOWN command. */
if (down_flag) {
break;
@@ -1083,7 +1083,7 @@ main(int argc, char *argv[])
close(connection_socket);
- /* Unlink the socket */
+ /* Unlink the socket. */
unlink(SOCKET_NAME);
@@ -1111,7 +1111,7 @@ main(int argc, char *argv[])
int data_socket;
char buffer[BUFFER_SIZE];
- /* Create local socket */
+ /* Create local socket. */
data_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);
if (data_socket == \-1) {
@@ -1127,7 +1127,7 @@ main(int argc, char *argv[])
memset(&addr, 0, sizeof(addr));
- /* Connect socket to socket address */
+ /* Connect socket to socket address. */
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) \- 1);
@@ -1139,7 +1139,7 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- /* Send arguments */
+ /* Send arguments. */
for (int i = 1; i < argc; ++i) {
ret = write(data_socket, argv[i], strlen(argv[i]) + 1);
@@ -1149,7 +1149,7 @@ main(int argc, char *argv[])
}
}
- /* Request result */
+ /* Request result. */
strcpy(buffer, "END");
ret = write(data_socket, buffer, strlen(buffer) + 1);
@@ -1158,7 +1158,7 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- /* Receive result */
+ /* Receive result. */
ret = read(data_socket, buffer, sizeof(buffer));
if (ret == \-1) {
@@ -1166,13 +1166,13 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- /* Ensure buffer is 0\-terminated */
+ /* Ensure buffer is 0\-terminated. */
buffer[sizeof(buffer) \- 1] = 0;
printf("Result = %s\en", buffer);
- /* Close socket */
+ /* Close socket. */
close(data_socket);