commit f407c1f2faa15456011a01fc8afb3f3175f668e0
parent c57556e31737a4d6d56966e5b93083a862e83adc
Author: Francesco Saccone <francesco@francescosaccone.com>
Date: Mon, 31 Mar 2025 14:56:50 +0200
docs: reformat comments
Signed-off-by: Francesco Saccone <francesco@francescosaccone.com>
Diffstat:
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/hermes.c b/hermes.c
@@ -36,7 +36,7 @@ main(int argc, char *argv[]) {
if (argument[0] != '-' ||
argument[1] == '\0' ||
argument[2] != '\0' ||
- i + 1 >= argc /* argument value exists */) {
+ i + 1 >= argc /* Argument value exists */) {
print_usage(program_name);
}
@@ -106,7 +106,7 @@ main(int argc, char *argv[]) {
print_error("error: could not fork process.");
break;
case 0:
- /* child process */
+ /* Child process */
while (1) {
int client_socket_fd,
diff --git a/socket.h b/socket.h
@@ -1,22 +1,30 @@
#ifndef SOCKET_H
#define SOCKET_H
-/* creates a socket and a local address at the given port, binds them,
- listens for connections and returns the socket file descriptor */
+/*
+ * Creates a socket and a local address at the given port, binds them,
+ * listens for connections and returns the socket file descriptor
+ */
int
create_socket(unsigned int port);
-/* closes a socket */
+/*
+ * Closes a socket
+ */
void
close_socket(int socket_fd);
-/* accepts a connection from the server socket and returns the client socket
- file descriptor */
+/*
+ * Accepts a connection from the server socket and returns the client socket
+ * file descriptor
+ */
int
accept_client(int server_socket_fd);
-/* writes the client request to a buffer, returns -1 in case of an error and 0
- otherwise */
+/*
+ * Writes the client request to a buffer, returns -1 in case of an error and 0
+ * otherwise
+ */
int
read_client_request(int client_socket_fd,
char *buffer,