From 4b06b666a98ea0239b0c72a579f8434246fb2d39 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sat, 20 Nov 2021 17:15:27 +0100 Subject: Added windows binary --- INSTALL | 10 ++++++++++ Makefile | 5 ++++- doc/nissy.1 | 3 ++- nissy-2.0beta3.tar.gz | Bin 53146 -> 53230 bytes nissy.exe | Bin 0 -> 684963 bytes src/env.c | 23 ++++++++++++++++++----- 6 files changed, 34 insertions(+), 7 deletions(-) create mode 100755 nissy.exe diff --git a/INSTALL b/INSTALL index 59c1b83..0717a0a 100644 --- a/INSTALL +++ b/INSTALL @@ -8,6 +8,16 @@ pruning table. If so, about 200Mb should be enough. # Installation +## On Windows + +Try downloading and executing in a terminal the file nissy.exe, then +follow the instructions in the UNIX section below for downloading and +installing the pruning tables. +If nissy.exe does not work, you can try following the UNIX instructions +in WSL (Windows Subsystem for Linux) or in a similar environment. + +Sorry for the inconvenience, I don't have a Windows machine to test this on. + ## On a UNIX system: Edit the Makefile to match your local configuration (usually not necessary, but you diff --git a/Makefile b/Makefile index 4ffef70..89d866b 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,9 @@ options: nissy: ${CC} ${CFLAGS} -o nissy.o src/*.c +win: + x86_64-w64-mingw32-gcc ${CFLAGS} -static -o nissy.exe src/*.c + debug: ${CC} ${DBGFLAGS} -o nissy.o src/*.c @@ -50,5 +53,5 @@ uninstall: rm -rf ${DESTDIR}${PREFIX}/bin/nissy ${DESTDIR}${MANPREFIX}/man1/nissy.1 for s in ${SCRIPTS}; do rm -rf ${DESTDIR}${PREFIX}/bin/$$s; done -.PHONY: all options nissy debug clean dist install uninstall +.PHONY: all options nissy win debug clean dist install uninstall diff --git a/doc/nissy.1 b/doc/nissy.1 index 5bfa930..e8ce7ea 100644 --- a/doc/nissy.1 +++ b/doc/nissy.1 @@ -127,7 +127,8 @@ If that variable is unset the folder .Nm $XDG_DATA_HOME/nissy or .Nm $HOME/.nissy -is used instead. +is used instead. If none of this environment variables is defined +(e.g. in a non-UNIX system), the current folder is used. . .Sh EXAMPLES . diff --git a/nissy-2.0beta3.tar.gz b/nissy-2.0beta3.tar.gz index bd7dd17..91c9e5e 100644 Binary files a/nissy-2.0beta3.tar.gz and b/nissy-2.0beta3.tar.gz differ diff --git a/nissy.exe b/nissy.exe new file mode 100755 index 0000000..400d674 Binary files /dev/null and b/nissy.exe differ diff --git a/src/env.c b/src/env.c index d13642f..282bc8f 100644 --- a/src/env.c +++ b/src/env.c @@ -3,6 +3,16 @@ bool initialized_env = false; char *tabledir; +void +mymkdir(char *d, int m) +{ +#ifdef _WIN32 + mkdir(d); +#else + mkdir(d, m); +#endif +} + void init_env() { @@ -15,21 +25,24 @@ init_env() return; if (nissydata != NULL) { - tabledir = malloc(strlen(nissydata) * sizeof(char) + 20); + tabledir = malloc((strlen(nissydata) + 20) * sizeof(char)); strcpy(tabledir, nissydata); } else if (localdata != NULL) { - tabledir = malloc(strlen(localdata) * sizeof(char) + 20); + tabledir = malloc((strlen(localdata) + 20) * sizeof(char)); strcpy(tabledir, localdata); strcat(tabledir, "/nissy"); } else if (home != NULL) { - tabledir = malloc(strlen(home) * sizeof(char) + 20); + tabledir = malloc((strlen(home) + 20) * sizeof(char)); strcpy(tabledir, home); strcat(tabledir, "/.nissy"); + } else { + tabledir = malloc(20 * sizeof(char)); + strcpy(tabledir, "."); } - mkdir(tabledir, 0777); + mymkdir(tabledir, 0777); strcat(tabledir, "/tables"); - mkdir(tabledir, 0777); + mymkdir(tabledir, 0777); read = !access(tabledir, R_OK); write = !access(tabledir, W_OK); -- cgit v1.3