чување 17cfd0460ea6069fa881ebd7f8a3074c84cbc5b1
родитељ 2de6db5d7ef4195f2478d6abb9986eea1e99488f
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Mon, 29 Apr 2024 18:54:24 +0200
sled.c: Output copyright information with -V
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
| M | sled.c | | | 26 | ++++++++++++++++++++------ |
измењених датотека: 1, додавања: 20(+), брисања: 6(-)
diff --git a/sled.c b/sled.c
@@ -16,6 +16,16 @@
#define TB_OPT_V1_COMPAT
#define TB_IMPL
+#define COPYRIGHT \
+ (" This program is licensed under the terms of GNU GPL v3" \
+ " or (at your option)\n" \
+ " any later version. Copyright (C) 2022-2024 Strahinya Radich.\n" \
+ " See the file LICENSE for exact copyright and license " \
+ "details.\n" \
+ " File termbox.h is based on termbox2 TUI library, (c) 2021" \
+ " termbox developers,\n" \
+ " which is released under the terms of Expat license, see the file" \
+ " LICENSE.termbox.\n")
#define SLED_C_GLOBALS
#define ONLY_DEFS
@@ -423,8 +433,8 @@ handle_key_event(struct tb_event* ev, struct DrawState* state)
return;
}
- /* Remember to also edit the following condition if you reassign motion
- * keys */
+ /* Remember to also edit the following condition if you
+ * reassign motion keys */
if (ev->key != TB_KEY_ARROW_DOWN && ev->key != TB_KEY_ARROW_UP
&& ev->key != TB_KEY_PGDN && ev->key != TB_KEY_PGUP
&& ev->key != TB_KEY_CTRL_B && ev->key != TB_KEY_CTRL_F
@@ -2295,7 +2305,9 @@ main(int argc, char** argv)
if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))
{
- printf("Usage: %s [-h|--help] [-v|--version] [filename]\n",
+ printf("Usage: %s -h | --help | -V | --full-version | "
+ "-v |"
+ " --version | filename\n",
program_name);
return 0;
}
@@ -2307,6 +2319,7 @@ main(int argc, char** argv)
else if (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--full-version"))
{
printf("%s %s, committed on %s\n", program_name, VERSION, DATE);
+ puts(COPYRIGHT);
printf("Features set in config.h:\n");
#ifdef CREATE_BACKUPS
printf(" CREATE_BACKUPS:\tset\n");
@@ -2360,7 +2373,8 @@ main(int argc, char** argv)
{
if (!(state.real_filename = calloc(MAXPATH, 1)))
return print_error(1,
- "Allocation failed (out of memory?)");
+ "Allocation failed (out of "
+ "memory?)");
state.rfn_len = readlink(state.filename,
state.real_filename, MAXPATH);
@@ -2381,8 +2395,8 @@ main(int argc, char** argv)
return print_error(1,
"Allocation failed (out of memory?)");
- /* Backup filename is the target file + suffix if the file to
- * write is a symlink, otherwise file + suffix */
+ /* Backup filename is the target file + suffix if the
+ * file to write is a symlink, otherwise file + suffix */
STRLCPY(state.rfn_len > 0 ? state.real_filename : state.filename,
state.backup_filename, MAXPATH);
STRLCAT(backup_suffix, state.backup_filename, MAXPATH);