initial commit

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-05-02 01:10:56 -04:00
commit 6cdb9a2a9c
10 changed files with 108 additions and 0 deletions
+27
View File
@@ -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 $@
+47
View File
@@ -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;
}
+12
View File
@@ -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 */