Mass reformat

This commit is contained in:
Imbus 2025-08-18 14:59:16 +02:00
parent 4d27def35e
commit df11e34235
27 changed files with 121 additions and 136 deletions

View file

@ -8,9 +8,9 @@
#define SOCKET_PATH "/tmp/demosocket"
int main() {
int sock_fd;
int sock_fd;
struct sockaddr_un addr;
char buffer[100];
char buffer[100];
sock_fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock_fd < 0) {
@ -22,8 +22,7 @@ int main() {
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, SOCKET_PATH, sizeof(addr.sun_path) - 1);
if (connect(sock_fd, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) <
0) {
if (connect(sock_fd, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) < 0) {
perror("connect");
exit(EXIT_FAILURE);
}

View file

@ -7,13 +7,13 @@
/* Unix sockets need a path */
#define SOCK_PATH "/tmp/demosocket"
#define BUF_SIZE 128
#define BUF_SIZE 128
char buf[BUF_SIZE];
int main(void) {
struct sockaddr_un addr;
int server_fd, client_fd;
int server_fd, client_fd;
// Unlink this in case its still around
unlink(SOCK_PATH);

View file

@ -1,17 +1,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#define SOCKET_PATH "/tmp/demosocket"
#define BUF_SIZE 128
#define BUF_SIZE 128
int main(void) {
int server_fd, client_fd;
int server_fd, client_fd;
struct sockaddr_un addr;
char buf[BUF_SIZE];
char buf[BUF_SIZE];
// Clean up any leftover socket file
unlink(SOCKET_PATH);