aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--LICENSE2
-rw-r--r--README.adoc6
m---------liberty0
-rw-r--r--neetdraw.c25
m---------termo0
6 files changed, 22 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b78dbe..d92e17f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.0)
+cmake_minimum_required (VERSION 3.0...3.27)
project (neetdraw VERSION 0.1.0 LANGUAGES C)
# Moar warnings
@@ -59,7 +59,7 @@ CHECK_FUNCTION_EXISTS ("resizeterm" HAVE_RESIZETERM)
foreach (extra iconv)
find_library (extra_lib_${extra} ${extra})
if (extra_lib_${extra})
- list (APPEND project_libraries ${extra})
+ list (APPEND project_libraries ${extra_lib_${extra}})
endif ()
endforeach ()
diff --git a/LICENSE b/LICENSE
index 8193f83..0610bbd 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2014, Přemysl Eric Janouch <p@janouch.name>
+Copyright (c) 2014 - 2023, Přemysl Eric Janouch <p@janouch.name>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
diff --git a/README.adoc b/README.adoc
index a30ffcf..bd91230 100644
--- a/README.adoc
+++ b/README.adoc
@@ -7,8 +7,10 @@ image::neetdraw.png[align="center"]
Packages
--------
-Regular releases are sporadic. git master should be stable enough. You can get
-a package with the latest development version from Archlinux's AUR.
+Regular releases are sporadic. git master should be stable enough.
+You can get a package with the latest development version using Arch Linux's
+https://aur.archlinux.org/packages/neetdraw-git[AUR],
+or as a https://git.janouch.name/p/nixexprs[Nix derivation].
Building
--------
diff --git a/liberty b/liberty
-Subproject 1b9d89cab3bb1df73c58ccd8528eafd21a8c6e4
+Subproject 8386af0420741d4baa9a41db19f6115acff6ef8
diff --git a/neetdraw.c b/neetdraw.c
index ab80477..6bbaa2a 100644
--- a/neetdraw.c
+++ b/neetdraw.c
@@ -1,7 +1,7 @@
/*
* neetdraw.c: terminal drawing application with multiplayer support
*
- * Copyright (c) 2014, Přemysl Eric Janouch <p@janouch.name>
+ * Copyright (c) 2014 - 2023, Přemysl Eric Janouch <p@janouch.name>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
@@ -766,7 +766,7 @@ export_irc (struct app_context *app)
// --- Loading, saving ---------------------------------------------------------
static void
-load (struct app_context *app)
+load (struct app_context *app, const char *filename)
{
// Client cannot load at all, the server would have send the new bitmap out
if (app->mode != NETWORK_MODE_STANDALONE)
@@ -776,7 +776,7 @@ load (struct app_context *app)
return;
}
- FILE *fp = fopen ("drawing.bin", "rb");
+ FILE *fp = fopen (filename, "rb");
if (!fp)
{
display ("Error opening file for reading.");
@@ -830,9 +830,9 @@ error:
}
static void
-save (struct app_context *app)
+save (struct app_context *app, const char *filename)
{
- FILE *fp = fopen ("drawing.bin", "wb");
+ FILE *fp = fopen (filename, "wb");
if (!fp)
{
display ("Error opening file for writing.");
@@ -952,8 +952,8 @@ on_key (struct app_context *app, termo_key_t *key)
if (key->modifiers)
return true;
- if (key->code.codepoint == 'l') load (app);
- if (key->code.codepoint == 's') save (app);
+ if (key->code.codepoint == 'l') load (app, "drawing.bin");
+ if (key->code.codepoint == 's') save (app, "drawing.bin");
if (key->code.codepoint == 'e') export_ansi (app);
if (key->code.codepoint == 'E') export_irc (app);
return true;
@@ -1342,6 +1342,7 @@ struct app_options
struct addrinfo *client_address; ///< Address to connect to
struct addrinfo *server_address; ///< Address to listen at
bool no_wait; ///< Don't wait for server confirmations
+ const char *filename; ///< A filename to preload
};
static void
@@ -1414,8 +1415,8 @@ parse_program_arguments (struct app_options *options, int argc, char **argv)
{ 0, NULL, NULL, 0, NULL }
};
- struct opt_handler oh = opt_handler_make (argc, argv, opts,
- NULL, "Terminal drawing application with multiplayer support");
+ struct opt_handler oh = opt_handler_make (argc, argv, opts, "[drawing.bin]",
+ "Terminal drawing application with multiplayer support");
int c;
while ((c = opt_handler_get (&oh)) != -1)
@@ -1454,7 +1455,8 @@ parse_program_arguments (struct app_options *options, int argc, char **argv)
argc -= optind;
argv += optind;
- if (argc)
+ options->filename = argv[0];
+ if (argc > 1)
{
opt_handler_usage (&oh, stderr);
exit (EXIT_FAILURE);
@@ -1598,6 +1600,9 @@ main (int argc, char *argv[])
redraw (&app);
redraw_canvas (&app);
+ if (options.filename)
+ load (&app, options.filename);
+
ev_run (loop, 0);
endwin ();
diff --git a/termo b/termo
-Subproject 94a77a10d87367ef33156cd68b2caf601c3f72d
+Subproject f9a102456fa6a0b43a916ceaf031f21ea5665e6