Quicksaving. Works.

Removed test suite and dependency on criterion unit test framework.
  The criterion AUR depended on an out-of-date ABI of libgit2, and since I don't want to wait for criterion's developers to update it, or to install an old version of a library I don't need, I decided to cut the unit test framework out of ldaphotos.
  The team (me) is searching for alternatives.

main.h:
  Refactored the OPTIONS list.

local.schema:
  Added LDAP schema. This is currently useless.

Makefile:
  Consolidated libraries into $(LIBRARIES) variable.
This commit is contained in:
Sandy Mossgrave 2023-09-12 22:46:05 +00:00
parent 39a69c947e
commit bad9984903
5 changed files with 21 additions and 62 deletions

View File

@ -17,11 +17,13 @@ INSTDIR := /usr/local/bin
REFACTOR := refactor.h
TESTCFLAGS:= $(shell pkg-config --cflags criterion)
TESTLIBS := $(shell pkg-config --libs criterion)
TESTCFLAGS:= #$(shell pkg-config --cflags )
TESTLIBS := #$(shell pkg-config --libs )
TESTDIR := $(SRCDIR)/test
TESTOD := $(OBJDIR)/test
LIBRARIES := libnotify libcrypto
HEADERS := $(wildcard $(INCDIR)/*.h)
MAINS := $(wildcard $(MAINDIR)/*.c)
@ -40,10 +42,10 @@ SOURCES := $(wildcard $(SRCDIR)/*.c)
OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(SOURCES))
CPPFLAGS := -I$(abspath $(INCDIR)) -MMD -MP -DUSE_LIBNOTIFY -DUSE_SYSLOG
CFLAGS := -Wall -Werror -Wpedantic $(shell pkg-config --cflags libnotify) -ggdb
CFLAGS := -Wall -Werror -Wpedantic $(shell pkg-config --cflags $(LIBRARIES)) -ggdb
LDFLAGS := #-Lmath or whatever
LDLIBS := $(shell pkg-config --libs libnotify libcrypto) #-lm or whatever
LDLIBS := $(shell pkg-config --libs $(LIBRARIES)) #-lm or whatever
define MANGLE =
$(dir $(1))$(PREFIX)$(notdir $(1))$(SUFFIX)
@ -60,12 +62,14 @@ refactor:
$(UNITTESTS): $(OBJECTS) $(TESTOBJS) | $(BINDIR) $(OBJDIR) $(TESTOD)
@echo "Linking unit tests..."
@echo "Object files for tests is " $(TESTOBJS)
$(CC) $(LDFLAGS) $(OBJECTS) $(patsubst $(BINDIR)/%, $(TESTOD)/%.o, $@) $(LDLIBS) $(TESTLIBS) -o $(dir $@)$(PREFIX)$(notdir $@)$(SUFFIX)
@echo "LDLIBS expands to" $(LDLIBS)
@echo "LIBRARIES expands to" $(LIBRARIES)
$(CC) $(LDFLAGS) $(OBJECTS) $(patsubst $(BINDIR)/%, $(TESTOD)/%.o, $@) $(LDLIBS) $(TESTLIBS) -o $(dir $@)$(PREFIX)$(notdir $@)$(SUFFIX)
@echo "...Done linking unit tests"
$(TARGETS): $(OBJECTS) $(MAINOBJS) | $(BINDIR) $(OBJDIR) $(MAINOD)
@echo "Linking targets..."
$(CC) $(LDFLAGS) $(OBJECTS) $(patsubst $(BINDIR)/%, $(MAINOD)/%.o, $@) $(LDLIBS) -o $(dir $@)$(PREFIX)$(notdir $@)$(SUFFIX)
$(CC) $(LDFLAGS) $(OBJECTS) $(patsubst $(BINDIR)/%, $(MAINOD)/%.o, $@) $(LDLIBS) -o $(dir $@)$(PREFIX)$(notdir $@)$(SUFFIX)
@echo "...Done linking targets"
$(BINDIR) $(OBJDIR) $(MAINOD) $(TESTOD):

View File

@ -1,6 +1,6 @@
attributeType ( 69.420 NAME ( '' '' )
attributeType ( 1.3.6.1.4.1.60580.1.1 NAME ( '' '' )
DESC ''
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX
)
)

View File

@ -10,25 +10,18 @@
#define PROGNAME "ldaphotos"
#define USAGE0 "Usage:"
#define USAGE1 "[OPTION...]"
#define OPTIONS0 "Options:"
#define OPTIONS1 "\t-v run verbosely"
#define OPTIONS2 "\t-h show help and exit"
#define OPTIONS3 "\t-t provide terse output"
#define OPTIONS4 "\t-f <path> Read input from file <path>"
#define OPTIONS5 ""
#define OPTIONS6 ""
#define OPTIONS7 ""
#define OPTIONS8 ""
#define OPTIONS9 ""
#define OPTIONS10 "\t-p Print the effects of the given options for this invocation"
#define OPTIONS "Options: \
\t-v run verbosely \
\t-h show help and exit \
\t-t provide terse output \
\t-f <path> Read input from file <path> \
t-p Print the effects of the given options for this invocation"
void print_help(void){
printf("%s %s\n", TITLE, VERSION);
printf("%s %s %s\n", USAGE0, PROGNAME, USAGE1);
printf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
OPTIONS0, OPTIONS1, OPTIONS2, OPTIONS3, OPTIONS4,
OPTIONS5, OPTIONS6, OPTIONS7, OPTIONS8, OPTIONS9,
OPTIONS10);
printf("%s\n",
OPTIONS);
}
#endif

View File

@ -118,7 +118,7 @@ int opt;
memcpy(filepath, optarg, strlen(optarg));
break;
default:
printf("Literally how could you pass an unspecified argument to this program");
printf("Literally how could you pass an unspecified argument to this program\n");
}
}

View File

@ -1,38 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <criterion/criterion.h>
#include "main.h"
#include "manipulations.h"
#include "hasher.h"
#include "log.h"
#ifdef USE_LIBNOTIFY
#include <libnotify/notify.h>
#endif
Test(misc, passing){
cr_assert(1, "ya boi");
}
Test(misc, hashsomething){
if(!init_hasher()){
log(LOG_INFO, "Error encountered while initializing hasher");
}
begin_digest();
unsigned int len;
unsigned int aalen;
unsigned char * a = get_digest(&len);
char *aa = atohex(a, len, &aalen);
free(aa);
}