Add support for tab-completion when selecting by rule
[alpine.git] / pico / utf8stub.c
blob1111d579d7506eeb3315487ee118c1500e4e7af7
1 /*
2 * ========================================================================
3 * Copyright 2006-2007 University of Washington
4 * Copyright 2013-2022 Eduardo Chappa
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * ========================================================================
16 #include <system.h>
17 #include "utf8stub.h"
21 * Stub functions to fill in functions used in utf8 support routines
25 void *
26 fs_get (size_t size)
28 void *block = malloc (size ? size : (size_t) 1);
29 if (!block) fatal ("Out of memory");
30 return (block);
34 void
35 fs_resize(void **block, size_t size)
37 if (!(*block = realloc (*block,size ? size : (size_t) 1)))
38 fatal ("Can't resize memory");
41 void
42 fs_give (void **block)
44 free (*block);
45 *block = NULL;
48 void
49 fatal(char *s)
55 int
56 compare_ulong(unsigned long l1, unsigned long l2)
58 if (l1 < l2) return -1;
59 if (l1 > l2) return 1;
60 return 0;
64 int
65 compare_cstring(unsigned char *s1, unsigned char *s2)
67 int i;
68 if (!s1) return s2 ? -1 : 0; /* empty string cases */
69 else if (!s2) return 1;
70 for (; *s1 && *s2; s1++,s2++)
71 if ((i = (compare_ulong (islower (*s1) ? toupper (*s1) : *s1,
72 islower (*s2) ? toupper (*s2) : *s2))) != 0)
73 return i; /* found a difference */
74 if (*s1) return 1; /* first string is longer */
75 return *s2 ? -1 : 0; /* second string longer : strings identical */
78 int
79 panicking(void)
81 return(0);