From 07cae73c7116aee9686432783394eaba2c854ab9 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sat, 23 Mar 2024 21:51:55 -0300 Subject: remove extra files --- plugins/strings/strings.c | 61 ----------------------------------------------- plugins/strings/strings.h | 4 ---- 2 files changed, 65 deletions(-) delete mode 100644 plugins/strings/strings.c delete mode 100644 plugins/strings/strings.h (limited to 'plugins/strings') diff --git a/plugins/strings/strings.c b/plugins/strings/strings.c deleted file mode 100644 index 59bfdc9..0000000 --- a/plugins/strings/strings.c +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include -#include - -#define DEBUG false - -// String manipulation -void str_init(char* str, int n) -{ - // could also use - for (int i = 0; i < n; i++) - str[i] = ' '; - str[n] = '\0'; -} -int str_replace_start(const char* string, const char* target, const char* replacement, char* output) -{ - int l1 = strlen(string); - int l2 = strlen(target); - int l3 = strlen(replacement); - int l4 = strlen(output); - - if (DEBUG) { - printf("string: %s, target: %s, replacement: %s, output: %s\n", string, target, replacement, output); - printf("%d,%d,%d,%d\n", l1, l2, l3, l4); - } - - if ((l4 < (l1 - l2 + l3)) || l4 < l1) { - printf("Not enough memory in output string.\n"); - return 1; - } - int match = true; - for (int i = 0; i < l2; i++) { - if (string[i] != target[i]) { - match = false; - break; - } - } - if (match) { - if (DEBUG) printf("Found match.\n"); - for (int i = 0; i < l3; i++) { - output[i] = replacement[i]; - } - int counter = l3; - for (int i = l2; i < l1; i++) { - output[counter] = string[i]; - counter++; - } - output[counter] = '\0'; - return 2; // success - } else { - if (DEBUG) printf("Did not find match.\n"); - strcpy(output, string); - } - - return 0; -} -/* -See also: -* -* https://github.com/irl/la-cucina/blob/master/str_replace.c -*/ diff --git a/plugins/strings/strings.h b/plugins/strings/strings.h deleted file mode 100644 index 02054d5..0000000 --- a/plugins/strings/strings.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -void str_init(char* str, int n); -int str_replace_start(const char* string, const char* target, const char* replacement, char* output); -- cgit v1.2.3