summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-01-17 09:50:16 +0100
committerGravatar default2023-01-17 09:50:16 +0100
commita38c7aeadcc69b3405d40b008a0b87f7c5d023dc (patch)
treeafe36eed782e9731d2b7e95768c6937e4592c842
parentUpdated TODO. (diff)
downloadpenes-snac2-a38c7aeadcc69b3405d40b008a0b87f7c5d023dc.tar.gz
penes-snac2-a38c7aeadcc69b3405d40b008a0b87f7c5d023dc.tar.xz
penes-snac2-a38c7aeadcc69b3405d40b008a0b87f7c5d023dc.zip
Updated year in copyright notices.
-rw-r--r--LICENSE2
-rw-r--r--activitypub.c2
-rw-r--r--data.c2
-rw-r--r--format.c2
-rw-r--r--html.c2
-rw-r--r--http.c2
-rw-r--r--httpd.c2
-rw-r--r--main.c4
-rw-r--r--snac.c2
-rw-r--r--snac.h2
-rw-r--r--upgrade.c2
-rw-r--r--utils.c2
-rw-r--r--webfinger.c2
-rw-r--r--xs.h45
-rw-r--r--xs_curl.h2
-rw-r--r--xs_encdec.h2
-rw-r--r--xs_glob.h2
-rw-r--r--xs_httpd.h2
-rw-r--r--xs_io.h2
-rw-r--r--xs_json.h2
-rw-r--r--xs_mime.h4
-rw-r--r--xs_openssl.h2
-rw-r--r--xs_regex.h2
-rw-r--r--xs_set.h2
-rw-r--r--xs_socket.h2
-rw-r--r--xs_time.h2
-rw-r--r--xs_version.h2
27 files changed, 56 insertions, 45 deletions
diff --git a/LICENSE b/LICENSE
index c4c1fa9..3f316ff 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
1MIT License 1MIT License
2 2
3Copyright (c) 2022 grunfink (Fediverse: @grunfink@comam.es) 3Copyright (c) 2022 - 2023 grunfink (Fediverse: @grunfink@comam.es)
4 4
5Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 6
diff --git a/activitypub.c b/activitypub.c
index b878bc5..5e1fa79 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -1,5 +1,5 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 grunfink - MIT license */ 2/* copyright (c) 2022 - 2023 grunfink / MIT license */
3 3
4#include "xs.h" 4#include "xs.h"
5#include "xs_encdec.h" 5#include "xs_encdec.h"
diff --git a/data.c b/data.c
index f90036d..0419664 100644
--- a/data.c
+++ b/data.c
@@ -1,5 +1,5 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 grunfink - MIT license */ 2/* copyright (c) 2022 - 2023 grunfink / MIT license */
3 3
4#include "xs.h" 4#include "xs.h"
5#include "xs_io.h" 5#include "xs_io.h"
diff --git a/format.c b/format.c
index 418f59b..8299d0f 100644
--- a/format.c
+++ b/format.c
@@ -1,5 +1,5 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 grunfink - MIT license */ 2/* copyright (c) 2022 - 2023 grunfink / MIT license */
3 3
4#include "xs.h" 4#include "xs.h"
5#include "xs_regex.h" 5#include "xs_regex.h"
diff --git a/html.c b/html.c
index 530c573..746b7bb 100644
--- a/html.c
+++ b/html.c
@@ -1,5 +1,5 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 grunfink - MIT license */ 2/* copyright (c) 2022 - 2023 grunfink / MIT license */
3 3
4#include "xs.h" 4#include "xs.h"
5#include "xs_io.h" 5#include "xs_io.h"
diff --git a/http.c b/http.c
index 4b45753..54268e5 100644
--- a/http.c
+++ b/http.c
@@ -1,5 +1,5 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 grunfink - MIT license */ 2/* copyright (c) 2022 - 2023 grunfink / MIT license */
3 3
4#include "xs.h" 4#include "xs.h"
5#include "xs_io.h" 5#include "xs_io.h"
diff --git a/httpd.c b/httpd.c
index 52b4307..87ff669 100644
--- a/httpd.c
+++ b/httpd.c
@@ -1,5 +1,5 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 grunfink - MIT license */ 2/* copyright (c) 2022 - 2023 grunfink / MIT license */
3 3
4#include "xs.h" 4#include "xs.h"
5#include "xs_io.h" 5#include "xs_io.h"
diff --git a/main.c b/main.c
index 19be78c..2802e76 100644
--- a/main.c
+++ b/main.c
@@ -1,5 +1,5 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 grunfink - MIT license */ 2/* copyright (c) 2022 - 2023 grunfink / MIT license */
3 3
4#include "xs.h" 4#include "xs.h"
5#include "xs_io.h" 5#include "xs_io.h"
@@ -11,7 +11,7 @@
11int usage(void) 11int usage(void)
12{ 12{
13 printf("snac " VERSION " - A simple, minimalistic ActivityPub instance\n"); 13 printf("snac " VERSION " - A simple, minimalistic ActivityPub instance\n");
14 printf("Copyright (c) 2022 grunfink - MIT license\n"); 14 printf("Copyright (c) 2022 - 2023 grunfink / MIT license\n");
15 printf("\n"); 15 printf("\n");
16 printf("Commands:\n"); 16 printf("Commands:\n");
17 printf("\n"); 17 printf("\n");
diff --git a/snac.c b/snac.c
index 2a54447..e8c3a3d 100644
--- a/snac.c
+++ b/snac.c
@@ -1,5 +1,5 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 grunfink - MIT license */ 2/* copyright (c) 2022 - 2023 grunfink / MIT license */
3 3
4#define XS_IMPLEMENTATION 4#define XS_IMPLEMENTATION
5 5
diff --git a/snac.h b/snac.h
index c50b526..2041855 100644
--- a/snac.h
+++ b/snac.h
@@ -1,5 +1,5 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 grunfink - MIT license */ 2/* copyright (c) 2022 - 2023 grunfink / MIT license */
3 3
4#define VERSION "2.19-dev" 4#define VERSION "2.19-dev"
5 5
diff --git a/upgrade.c b/upgrade.c
index 4eb211e..19fc39a 100644
--- a/upgrade.c
+++ b/upgrade.c
@@ -1,5 +1,5 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 grunfink - MIT license */ 2/* copyright (c) 2022 - 2023 grunfink / MIT license */
3 3
4#include "xs.h" 4#include "xs.h"
5#include "xs_io.h" 5#include "xs_io.h"
diff --git a/utils.c b/utils.c
index 2ae0c63..5639aa0 100644
--- a/utils.c
+++ b/utils.c
@@ -1,5 +1,5 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 grunfink - MIT license */ 2/* copyright (c) 2022 - 2023 grunfink / MIT license */
3 3
4#include "xs.h" 4#include "xs.h"
5#include "xs_io.h" 5#include "xs_io.h"
diff --git a/webfinger.c b/webfinger.c
index 6a6133d..0811bca 100644
--- a/webfinger.c
+++ b/webfinger.c
@@ -1,5 +1,5 @@
1/* snac - A simple, minimalistic ActivityPub instance */ 1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 grunfink - MIT license */ 2/* copyright (c) 2022 - 2023 grunfink / MIT license */
3 3
4#include "xs.h" 4#include "xs.h"
5#include "xs_encdec.h" 5#include "xs_encdec.h"
diff --git a/xs.h b/xs.h
index 36445e4..800e407 100644
--- a/xs.h
+++ b/xs.h
@@ -1,4 +1,4 @@
1/* copyright (c) 2022 grunfink - MIT license */ 1/* copyright (c) 2022 - 2023 grunfink / MIT license */
2 2
3#ifndef _XS_H 3#ifndef _XS_H
4 4
@@ -53,7 +53,9 @@ d_char *xs_insert_m(d_char *data, int offset, const char *mem, int size);
53#define xs_insert(data, offset, data2) xs_insert_m(data, offset, data2, xs_size(data2)) 53#define xs_insert(data, offset, data2) xs_insert_m(data, offset, data2, xs_size(data2))
54#define xs_append_m(data, mem, size) xs_insert_m(data, xs_size(data) - 1, mem, size) 54#define xs_append_m(data, mem, size) xs_insert_m(data, xs_size(data) - 1, mem, size)
55d_char *xs_str_new(const char *str); 55d_char *xs_str_new(const char *str);
56#define xs_str_cat(str1, str2) xs_insert(str1, xs_size(str1) - 1, str2) 56d_char *xs_str_wrap_i(const char *prefix, d_char *str, const char *suffix);
57#define xs_str_prepend_i(str, prefix) xs_str_wrap_i(prefix, str, NULL)
58#define xs_str_cat(str, suffix) xs_str_wrap_i(NULL, str, suffix)
57d_char *xs_replace_i(d_char *str, const char *sfrom, const char *sto); 59d_char *xs_replace_i(d_char *str, const char *sfrom, const char *sto);
58#define xs_replace(str, sfrom, sto) xs_replace_i(xs_dup(str), sfrom, sto) 60#define xs_replace(str, sfrom, sto) xs_replace_i(xs_dup(str), sfrom, sto)
59d_char *xs_fmt(const char *fmt, ...); 61d_char *xs_fmt(const char *fmt, ...);
@@ -64,7 +66,6 @@ d_char *xs_crop_i(d_char *str, int start, int end);
64d_char *xs_strip_chars_i(d_char *str, const char *chars); 66d_char *xs_strip_chars_i(d_char *str, const char *chars);
65#define xs_strip_i(str) xs_strip_chars_i(str, " \r\n\t\v\f") 67#define xs_strip_i(str) xs_strip_chars_i(str, " \r\n\t\v\f")
66d_char *xs_tolower_i(d_char *str); 68d_char *xs_tolower_i(d_char *str);
67d_char *xs_str_prepend_i(d_char *str, const char *prefix);
68d_char *xs_list_new(void); 69d_char *xs_list_new(void);
69d_char *xs_list_append_m(d_char *list, const char *mem, int dsz); 70d_char *xs_list_append_m(d_char *list, const char *mem, int dsz);
70#define xs_list_append(list, data) xs_list_append_m(list, data, xs_size(data)) 71#define xs_list_append(list, data) xs_list_append_m(list, data, xs_size(data))
@@ -364,6 +365,19 @@ d_char *xs_str_new(const char *str)
364} 365}
365 366
366 367
368d_char *xs_str_wrap_i(const char *prefix, d_char *str, const char *suffix)
369/* wraps str with prefix and suffix */
370{
371 if (prefix)
372 str = xs_insert_m(str, 0, prefix, strlen(prefix));
373
374 if (suffix)
375 str = xs_insert_m(str, xs_size(str) - 1, suffix, xs_size(suffix));
376
377 return str;
378}
379
380
367d_char *xs_replace_i(d_char *str, const char *sfrom, const char *sto) 381d_char *xs_replace_i(d_char *str, const char *sfrom, const char *sto)
368/* replaces inline all sfrom with sto */ 382/* replaces inline all sfrom with sto */
369{ 383{
@@ -490,18 +504,6 @@ d_char *xs_tolower_i(d_char *str)
490} 504}
491 505
492 506
493d_char *xs_str_prepend_i(d_char *str, const char *prefix)
494/* prepends prefix into string */
495{
496 int sz = strlen(prefix);
497
498 str = xs_expand(str, 0, sz);
499 memcpy(str, prefix, sz);
500
501 return str;
502}
503
504
505/** lists **/ 507/** lists **/
506 508
507d_char *xs_list_new(void) 509d_char *xs_list_new(void)
@@ -666,9 +668,16 @@ d_char *xs_list_set(d_char *list, int num, const char *data)
666d_char *xs_list_pop(d_char *list, char **data) 668d_char *xs_list_pop(d_char *list, char **data)
667/* pops the last element from the list */ 669/* pops the last element from the list */
668{ 670{
669 if ((*data = xs_list_get(list, -1)) != NULL) { 671 char *p = list, *v = NULL;
670 *data = xs_dup(*data); 672
671 list = xs_list_del(list, -1); 673 /* iterate to the end */
674 while (xs_list_iter(&p, &v));
675
676 if (v != NULL) {
677 *data = xs_dup(v);
678
679 /* collapse from the address of the element */
680 list = xs_collapse(list, v - 1 - list, xs_size(v - 1));
672 } 681 }
673 682
674 return list; 683 return list;
diff --git a/xs_curl.h b/xs_curl.h
index c39c42d..bed643c 100644
--- a/xs_curl.h
+++ b/xs_curl.h
@@ -1,4 +1,4 @@
1/* copyright (c) 2022 grunfink - MIT license */ 1/* copyright (c) 2022 - 2023 grunfink / MIT license */
2 2
3#ifndef _XS_CURL_H 3#ifndef _XS_CURL_H
4 4
diff --git a/xs_encdec.h b/xs_encdec.h
index 334f995..5f9ae01 100644
--- a/xs_encdec.h
+++ b/xs_encdec.h
@@ -1,4 +1,4 @@
1/* copyright (c) 2022 grunfink - MIT license */ 1/* copyright (c) 2022 - 2023 grunfink / MIT license */
2 2
3#ifndef _XS_ENCDEC_H 3#ifndef _XS_ENCDEC_H
4 4
diff --git a/xs_glob.h b/xs_glob.h
index a69cba1..795abd9 100644
--- a/xs_glob.h
+++ b/xs_glob.h
@@ -1,4 +1,4 @@
1/* copyright (c) 2022 grunfink - MIT license */ 1/* copyright (c) 2022 - 2023 grunfink / MIT license */
2 2
3#ifndef _XS_GLOB_H 3#ifndef _XS_GLOB_H
4 4
diff --git a/xs_httpd.h b/xs_httpd.h
index 7121214..47901e8 100644
--- a/xs_httpd.h
+++ b/xs_httpd.h
@@ -1,4 +1,4 @@
1/* copyright (c) 2022 grunfink - MIT license */ 1/* copyright (c) 2022 - 2023 grunfink / MIT license */
2 2
3#ifndef _XS_HTTPD_H 3#ifndef _XS_HTTPD_H
4 4
diff --git a/xs_io.h b/xs_io.h
index c4ec7ea..cb6ba85 100644
--- a/xs_io.h
+++ b/xs_io.h
@@ -1,4 +1,4 @@
1/* copyright (c) 2022 grunfink - MIT license */ 1/* copyright (c) 2022 - 2023 grunfink / MIT license */
2 2
3#ifndef _XS_IO_H 3#ifndef _XS_IO_H
4 4
diff --git a/xs_json.h b/xs_json.h
index d992494..2b047ae 100644
--- a/xs_json.h
+++ b/xs_json.h
@@ -1,4 +1,4 @@
1/* copyright (c) 2022 grunfink - MIT license */ 1/* copyright (c) 2022 - 2023 grunfink / MIT license */
2 2
3#ifndef _XS_JSON_H 3#ifndef _XS_JSON_H
4 4
diff --git a/xs_mime.h b/xs_mime.h
index 072a98a..8d8b16b 100644
--- a/xs_mime.h
+++ b/xs_mime.h
@@ -1,4 +1,4 @@
1/* copyright (c) 2022 grunfink - MIT license */ 1/* copyright (c) 2022 - 2023 grunfink / MIT license */
2 2
3#ifndef _XS_MIME 3#ifndef _XS_MIME
4 4
@@ -23,6 +23,8 @@ struct _mime_info {
23 { "text/html", ".html" }, 23 { "text/html", ".html" },
24 { "text/plain", ".txt" }, 24 { "text/plain", ".txt" },
25 { "text/xml", ".xml" }, 25 { "text/xml", ".xml" },
26 { "text/markdown", ".md" },
27 { "text/gemini", ".gmi" },
26 { NULL, NULL } 28 { NULL, NULL }
27}; 29};
28 30
diff --git a/xs_openssl.h b/xs_openssl.h
index 5e3d03c..33de853 100644
--- a/xs_openssl.h
+++ b/xs_openssl.h
@@ -1,4 +1,4 @@
1/* copyright (c) 2022 grunfink - MIT license */ 1/* copyright (c) 2022 - 2023 grunfink / MIT license */
2 2
3#ifndef _XS_OPENSSL_H 3#ifndef _XS_OPENSSL_H
4 4
diff --git a/xs_regex.h b/xs_regex.h
index 302bcf0..c01a19a 100644
--- a/xs_regex.h
+++ b/xs_regex.h
@@ -1,4 +1,4 @@
1/* copyright (c) 2022 grunfink - MIT license */ 1/* copyright (c) 2022 - 2023 grunfink / MIT license */
2 2
3#ifndef _XS_REGEX_H 3#ifndef _XS_REGEX_H
4 4
diff --git a/xs_set.h b/xs_set.h
index f97eb20..d1daa01 100644
--- a/xs_set.h
+++ b/xs_set.h
@@ -1,4 +1,4 @@
1/* copyright (c) 2022 grunfink - MIT license */ 1/* copyright (c) 2022 - 2023 grunfink / MIT license */
2 2
3#ifndef _XS_SET_H 3#ifndef _XS_SET_H
4 4
diff --git a/xs_socket.h b/xs_socket.h
index d2853a2..24b97f1 100644
--- a/xs_socket.h
+++ b/xs_socket.h
@@ -1,4 +1,4 @@
1/* copyright (c) 2022 grunfink - MIT license */ 1/* copyright (c) 2022 - 2023 grunfink / MIT license */
2 2
3#ifndef _XS_SOCKET_H 3#ifndef _XS_SOCKET_H
4 4
diff --git a/xs_time.h b/xs_time.h
index 979bde4..ff0e73e 100644
--- a/xs_time.h
+++ b/xs_time.h
@@ -1,4 +1,4 @@
1/* copyright (c) 2022 grunfink - MIT license */ 1/* copyright (c) 2022 - 2023 grunfink / MIT license */
2 2
3#ifndef _XS_TIME_H 3#ifndef _XS_TIME_H
4 4
diff --git a/xs_version.h b/xs_version.h
index a91e805..261706a 100644
--- a/xs_version.h
+++ b/xs_version.h
@@ -1 +1 @@
/* 41985e780c622a078118ea7c7143dc304758d958 */ /* 366ce5817597e9f4d735bced6b8c40ecc897608e */