aboutsummaryrefslogtreecommitdiff
path: root/src/Utility/Display.c
diff options
context:
space:
mode:
authorfrosty <gabriel@bwaaa.monster>2026-03-05 04:50:32 +0000
committerfrosty <gabriel@bwaaa.monster>2026-03-05 04:50:32 +0000
commit24cec7a35072ac50e1fe902a925e69330866dbca (patch)
treef60bb7c38b0b952e074f9b8f8d1cef758d7f8ec8 /src/Utility/Display.c
parent5ed5a6ecc749e8b557ea62f04a444e203f4e48f6 (diff)
downloadomnisearch-24cec7a35072ac50e1fe902a925e69330866dbca.tar.gz
made formatting more consistentHEADmaster
Diffstat (limited to 'src/Utility/Display.c')
-rw-r--r--src/Utility/Display.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/src/Utility/Display.c b/src/Utility/Display.c
index 492e998..9737757 100644
--- a/src/Utility/Display.c
+++ b/src/Utility/Display.c
@@ -5,42 +5,42 @@
#include <strings.h>
char *pretty_display_url(const char *input) {
- if (!input) return NULL;
-
- const char *start = input;
-
- const char *protocol_pos = strstr(input, "://");
- if (protocol_pos) {
- start = protocol_pos + 3;
- }
-
- if (strncasecmp(start, "www.", 4) == 0) {
- start += 4;
- }
-
- size_t input_len = strlen(start);
- char temp[512];
- strncpy(temp, start, sizeof(temp) - 1);
- temp[sizeof(temp) - 1] = '\0';
-
- if (input_len > 0 && temp[input_len - 1] == '/') {
- temp[input_len - 1] = '\0';
- }
-
- char *output = (char *)malloc(strlen(temp) * 3 + 1);
- if (!output) return NULL;
-
- size_t j = 0;
- for (size_t i = 0; temp[i] != '\0'; i++) {
- if (temp[i] == '/') {
- output[j++] = ' ';
- output[j++] = '>';
- output[j++] = ' ';
- } else {
- output[j++] = (char)tolower((unsigned char)temp[i]);
- }
+ if (!input) return NULL;
+
+ const char *start = input;
+
+ const char *protocol_pos = strstr(input, "://");
+ if (protocol_pos) {
+ start = protocol_pos + 3;
+ }
+
+ if (strncasecmp(start, "www.", 4) == 0) {
+ start += 4;
+ }
+
+ size_t input_len = strlen(start);
+ char temp[512];
+ strncpy(temp, start, sizeof(temp) - 1);
+ temp[sizeof(temp) - 1] = '\0';
+
+ if (input_len > 0 && temp[input_len - 1] == '/') {
+ temp[input_len - 1] = '\0';
+ }
+
+ char *output = (char *)malloc(strlen(temp) * 3 + 1);
+ if (!output) return NULL;
+
+ size_t j = 0;
+ for (size_t i = 0; temp[i] != '\0'; i++) {
+ if (temp[i] == '/') {
+ output[j++] = ' ';
+ output[j++] = '>';
+ output[j++] = ' ';
+ } else {
+ output[j++] = (char)tolower((unsigned char)temp[i]);
}
- output[j] = '\0';
+ }
+ output[j] = '\0';
- return output;
+ return output;
}