--- /dev/null
+[submodule "common"]
+ path = common
+ url = https://github.com/EliasFleckenstein03/uwu-common
To build:
```
-make
+make all std
```
To run:
--- /dev/null
+Subproject commit a636a960a0866a94719aff01774b9533743ee072
+++ /dev/null
-#ifndef _COMMON_DL_H_
-#define _COMMON_DL_H_
-
-#include <dlfcn.h>
-#include "err.h"
-
-inline static void check_dlerror()
-{
- char *err = dlerror();
- if (err)
- error("library error: %s\n", err);
-}
-
-#endif
+++ /dev/null
-#ifndef _COMMON_ERR_H_
-#define _COMMON_ERR_H_
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-static inline void error(const char *format, ...)
-{
- va_list args;
- va_start(args, format);
- vfprintf(stderr, format, args);
- va_end(args);
- exit(1);
-}
-
-static inline void syserror(const char *call, FILE *file)
-{
- perror(call);
-
- if (file)
- fclose(file);
-
- exit(1);
-}
-
-#endif
+++ /dev/null
-#ifndef _COMMON_FILE_H_
-#define _COMMON_FILE_H_
-
-#include <stdio.h>
-#include <stdbool.h>
-
-inline static bool file_exists(const char *filename)
-{
- FILE *f = fopen(filename, "r");
-
- if (f) {
- fclose(f);
- return true;
- }
-
- return false;
-}
-
-#endif
+++ /dev/null
-#ifndef _COMMON_STR_H_
-#define _COMMON_STR_H_
-
-#include <stdio.h>
-#include <stdarg.h>
-
-static inline char *asprintf_wrapper(const char *format, ...)
-{
- va_list args;
- va_start(args, format);
- char *ptr;
- vasprintf(&ptr, format, args);
- va_end(args);
- return ptr;
-}
-
-#endif
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
-#include <libgen.h>
#include <dlfcn.h>
#include "common/err.h"
#include "common/str.h"
#include "common/file.h"
#include "common/dl.h"
+#include "common/dir.h"
#include "load.h"
#include "parse.h"
#define DEBUG 0
-// helper functions
-
-static char *dirname_wrapper(const char *name)
-{
- char *copy = strdup(name);
- char *result = dirname(copy);
- char *result_copy = strdup(result);
-
- free(copy);
- return result_copy;
-}
-
-// type definitions
-
typedef struct
{
char *name;