Move includes to common.h
This commit is contained in:
parent
234ea6130f
commit
49c0d80832
6
Makefile
6
Makefile
@ -3,13 +3,13 @@ CFLAGS = -std=c99 -pedantic -Wall -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE
|
|||||||
|
|
||||||
all: server client
|
all: server client
|
||||||
|
|
||||||
server: server.o
|
server: server.o common.h
|
||||||
$(CC) $^ -o $@
|
$(CC) $^ -o $@
|
||||||
|
|
||||||
client: client.o
|
client: client.o common.h
|
||||||
$(CC) $^ -o $@
|
$(CC) $^ -o $@
|
||||||
|
|
||||||
%.o: %.c common.h
|
%.o: %.c
|
||||||
$(CC) $(CFLAGS) $^
|
$(CC) $(CFLAGS) $^
|
||||||
|
|
||||||
.PHONY clean:
|
.PHONY clean:
|
||||||
|
|||||||
18
client.c
18
client.c
@ -6,24 +6,6 @@
|
|||||||
* @brief Client for OSUE exercise 1B `Battleship'.
|
* @brief Client for OSUE exercise 1B `Battleship'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
static const char *port = DEFAULT_PORT;
|
static const char *port = DEFAULT_PORT;
|
||||||
|
|||||||
16
common.h
16
common.h
@ -39,6 +39,22 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Print a map showing the squares where ships have been hit.
|
* @brief Print a map showing the squares where ships have been hit.
|
||||||
|
|||||||
19
server.c
19
server.c
@ -6,25 +6,6 @@
|
|||||||
* @brief Server for OSUE exercise 1B `Battleship'.
|
* @brief Server for OSUE exercise 1B `Battleship'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
static const char *port = DEFAULT_PORT;
|
static const char *port = DEFAULT_PORT;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user