@@ -0,0 +1,27 @@
|
||||
#
|
||||
# Copyright (c) 2026, Chloe Moffett
|
||||
# Provided under the BSD-3 clause
|
||||
#
|
||||
|
||||
CFILES = $(shell find . -name "*.c")
|
||||
OFILES = $(CFILES:.c=.o)
|
||||
DFILES = $(CFILES:.c=.d)
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = \
|
||||
-Wall \
|
||||
-pedantic \
|
||||
-MMD \
|
||||
-Iinc \
|
||||
-I../libremail/inc
|
||||
|
||||
.PHONY: all
|
||||
all: ../bin/remailsv $(OFILES)
|
||||
|
||||
.PHONY: ../bin/remailsv
|
||||
../bin/remailsv: $(OFILES)
|
||||
$(CC) $^ -o $@
|
||||
|
||||
-include $(DFILES)
|
||||
%.o: %.c
|
||||
$(CC) -c $< $(CFLAGS) -o $@
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Chloe Moffett
|
||||
* Provided under the BSD-3 clause
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "endpoint/common.h"
|
||||
|
||||
static void
|
||||
help(void)
|
||||
{
|
||||
printf("usage: ./remailsv <flags>\n");
|
||||
printf("... [-h] Display this help menu\n");
|
||||
printf("... [-v] Display the version\n");
|
||||
}
|
||||
|
||||
static void
|
||||
version(void)
|
||||
{
|
||||
printf("Version v%s\n", SERVER_VERSION);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
|
||||
if (argc < 2) {
|
||||
printf("fatal: too few arguments!\n");
|
||||
help();
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ((opt = getopt(argc, argv, "hv")) != -1) {
|
||||
switch (opt) {
|
||||
case 'h':
|
||||
help();
|
||||
return -1;
|
||||
case 'v':
|
||||
version();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Chloe Moffett
|
||||
* Provided under the BSD-3 clause
|
||||
*/
|
||||
|
||||
#ifndef ENDPOINT_COMMON_H
|
||||
#define ENDPOINT_COMMON_H 1
|
||||
|
||||
/* Server software version */
|
||||
#define SERVER_VERSION "0.0.1"
|
||||
|
||||
#endif /* !ENDPOINT_COMMON_H */
|
||||
Reference in New Issue
Block a user