Init. variables before calling get_cursor_position
[smenu.git] / utils.h
blobb12a2d2ca5e9ce836a006c621306f57ff587ec3d
1 /* ################################################################### */
2 /* Copyright 2015, Pierre Gentile (p.gen.progs@gmail.com) */
3 /* */
4 /* This Source Code Form is subject to the terms of the Mozilla Public */
5 /* License, v. 2.0. If a copy of the MPL was not distributed with this */
6 /* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
7 /* ################################################################### */
9 #ifndef UTILS_H
10 #define UTILS_H
12 #include <errno.h>
13 #include <unistd.h>
14 #include <fcntl.h>
16 typedef struct interval_s interval_t;
17 typedef struct range_s range_t;
19 struct interval_s
21 long low;
22 long high;
25 /* Structure used by the replace function to delimit matches */
26 /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */
27 struct range_s
29 size_t start;
30 size_t end;
33 interval_t *
34 interval_new(void);
36 int
37 interval_comp(void const *a, void const *b);
39 void
40 interval_swap(void **a, void **b);
42 void
43 optimize_an_interval_list(ll_t *list);
45 char *
46 concat(const char *str1, ...);
48 int
49 strprefix(char *str1, char *str2);
51 void
52 ltrim(char *str, const char *trim);
54 void
55 rtrim(char *str, const char *trim, size_t min_len);
57 int
58 my_strcasecmp(const char *str1, const char *str2);
60 char *
61 my_strcpy(char *dst, char *src);
63 int
64 isprint7(int i);
66 int
67 isprint8(int i);
69 int
70 my_wcscasecmp(const wchar_t *w1s, const wchar_t *w2s);
72 int
73 is_integer(const char * const s);
75 int
76 swap_string_parts(char **s, size_t first);
78 void
79 strrep(char *s, const char c1, const char c2);
81 char *
82 strprint(char const *s);
84 void
85 hexdump(const char *buf, FILE *fp, const char *prefix, size_t size);
87 int
88 my_wcswidth(const wchar_t *s, size_t n);
90 long
91 get_sorted_array_target_pos(long *array, long nb, long value);
93 int
94 is_in_foreground_process_group(void);
96 int
97 isempty_non_utf8(const unsigned char *s);
99 int
100 isempty_utf8(const unsigned char *s);
102 #endif