aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/config.h.in1
-rw-r--r--include/deliverable.h4
-rw-r--r--include/environment.h3
-rw-r--r--include/ini.h10
-rw-r--r--include/omc.h12
-rw-r--r--include/os_darwin.h1
-rw-r--r--include/os_linux.h2
-rw-r--r--include/os_windows.h22
-rw-r--r--include/relocation.h2
-rw-r--r--include/str.h4
-rw-r--r--include/system.h2
11 files changed, 48 insertions, 15 deletions
diff --git a/include/config.h.in b/include/config.h.in
index fe6beb2..3c980b0 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -5,6 +5,7 @@
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
#define OMC_OS_WINDOWS
+#include "os_windows.h"
#elif defined(__linux__)
#define OMC_OS_LINUX
diff --git a/include/deliverable.h b/include/deliverable.h
index effd098..f9fb364 100644
--- a/include/deliverable.h
+++ b/include/deliverable.h
@@ -6,7 +6,7 @@
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
-#include <sys/utsname.h>
+
#include "omc.h"
#define DELIVERY_PLATFORM_MAX 4
@@ -139,7 +139,7 @@ struct Delivery {
* \brief Global runtime variables
*/
struct Runtime {
- RuntimeEnv *environ; ///< Environment variables
+ struct StrList *env; ///< Environment variables
} runtime;
/*! \struct Test
diff --git a/include/environment.h b/include/environment.h
index 484f02c..a7e6604 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -7,7 +7,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
-#include "environment.h"
+#include "omc.h"
typedef struct StrList RuntimeEnv;
@@ -20,4 +20,5 @@ char *runtime_expand_var(RuntimeEnv *env, char *input);
void runtime_export(RuntimeEnv *env, char **keys);
void runtime_apply(RuntimeEnv *env);
void runtime_free(RuntimeEnv *env);
+
#endif //OMC_ENVIRONMENT_H
diff --git a/include/ini.h b/include/ini.h
index fa2bd98..6e445e2 100644
--- a/include/ini.h
+++ b/include/ini.h
@@ -101,11 +101,11 @@ struct INIFILE *ini_open(const char *filename);
struct INISection *ini_section_search(struct INIFILE **ini, unsigned mode, char *value);
/**
- *
- * @param ini
- * @param section
- * @param key
- * @return
+ *
+ * @param ini
+ * @param section
+ * @param key
+ * @return
*/
int ini_has_key(struct INIFILE *ini, const char *section, const char *key);
diff --git a/include/omc.h b/include/omc.h
index a116296..c5b3f30 100644
--- a/include/omc.h
+++ b/include/omc.h
@@ -8,37 +8,37 @@
#include <limits.h>
#include <unistd.h>
#include <time.h>
-#include <sys/statvfs.h>
+#include "config.h"
#define SYSERROR(MSG, ...) do { \
fprintf(stderr, "%s:%s:%d:%s - ", path_basename(__FILE__), __FUNCTION__, __LINE__, strerror(errno) ? "info" : strerror(errno)); \
fprintf(stderr, MSG LINE_SEP, __VA_ARGS__); \
} while (0)
+
#define OMC_BUFSIZ 8192
#define OMC_NAME_MAX 255
#define OMC_DIRSTACK_MAX 1024
#define OMC_TIME_STR_MAX 128
#define HTTP_ERROR(X) X >= 400
-#include "config.h"
#include "template.h"
+#include "strlist.h"
+#include "str.h"
+#include "environment.h"
#include "utils.h"
#include "copy.h"
#include "ini.h"
#include "conda.h"
-#include "environment.h"
#include "artifactory.h"
#include "docker.h"
-#include "deliverable.h"
-#include "str.h"
-#include "strlist.h"
#include "system.h"
#include "download.h"
#include "recipe.h"
#include "relocation.h"
#include "wheel.h"
#include "junitxml.h"
+#include "deliverable.h"
#define guard_runtime_free(X) do { if (X) { runtime_free(X); X = NULL; } } while (0)
#define guard_strlist_free(X) do { if ((*X)) { strlist_free(X); (*X) = NULL; } } while (0)
diff --git a/include/os_darwin.h b/include/os_darwin.h
index 390968c..465adc4 100644
--- a/include/os_darwin.h
+++ b/include/os_darwin.h
@@ -2,6 +2,7 @@
#define OMC_OS_DARWIN_H
#include <sys/mount.h>
+#include <sys/utsname.h>
#ifndef __DARWIN_64_BIT_INO_T
#define statvfs statfs
diff --git a/include/os_linux.h b/include/os_linux.h
index 8c3aed7..aabf1ff 100644
--- a/include/os_linux.h
+++ b/include/os_linux.h
@@ -2,6 +2,8 @@
#define OMC_OS_LINUX_H
#include <limits.h>
+#include <sys/statvfs.h>
+#include <sys/utsname.h>
#ifndef PATH_MAX
#include <linux/limits.h>
diff --git a/include/os_windows.h b/include/os_windows.h
new file mode 100644
index 0000000..ae7875c
--- /dev/null
+++ b/include/os_windows.h
@@ -0,0 +1,22 @@
+//
+// Created by jhunk on 5/19/2024.
+//
+
+#ifndef OMC_OS_WINDOWS_H
+#define OMC_OS_WINDOWS_H
+
+
+#include <winsock2.h>
+#include <windows.h>
+#include <direct.h>
+#define lstat stat
+#define NAME_MAX 256
+#define MAXNAMLEN 256
+#define __environ _environ
+#undef mkdir
+#define mkdir(X, Y) _mkdir(X)
+
+int setenv(const char *key, const char *value, int overwrite);
+char *realpath(const char *path, char **dest);
+
+#endif //OMC_OS_WINDOWS_H
diff --git a/include/relocation.h b/include/relocation.h
index 924f00f..6ace8e0 100644
--- a/include/relocation.h
+++ b/include/relocation.h
@@ -11,7 +11,7 @@
#include <string.h>
#if defined(OMC_OS_DARWIN)
#include <limits.h>
-# else
+#elif defined(OMC_OS_LINUX)
#include <linux/limits.h>
#endif
#include <unistd.h>
diff --git a/include/str.h b/include/str.h
index 8018cc0..60116de 100644
--- a/include/str.h
+++ b/include/str.h
@@ -333,5 +333,9 @@ char *tolower_s(char *s);
* @return pointer to new string
*/
char *to_short_version(const char *s);
+#if defined(OMC_OS_WINDOWS)
+char *strsep(char **str, const char *delim);
+char *strndup(const char *str, size_t nelem);
+#endif
#endif //OMC_STR_H
diff --git a/include/system.h b/include/system.h
index 7428355..9d9eb0f 100644
--- a/include/system.h
+++ b/include/system.h
@@ -11,7 +11,9 @@
#include <errno.h>
#include <unistd.h>
#include <limits.h>
+#if defined(OMC_OS_UNIX)
#include <sys/wait.h>
+#endif
#include <sys/stat.h>
struct Process {