aboutsummaryrefslogtreecommitdiffstats
path: root/src/support.h
blob: 3377f9a8099ed6e97e89399c8f7e65d0a120cf1a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef SUPPORT_H
#define SUPPORT_H

#include <glib.h>

#ifdef HAVE_LIBGEN_H
#include <libgen.h>
#endif

#ifndef HAVE_BASENAME
char *basename(char *path);
#endif

#define IS_WHITESPACE(c) (c==' ' || c=='\t' || c=='\r' || c=='\n')

char *remove_trailing_slash(char *path);
char *lowerstr(char *str);
char *strcasestr(const char *haystack, const char *needle);

typedef struct {
	gsize offset;
	GTime t; /* GTime is equivalent to time_t */
} scroll_state_t;

char *strscroll(char *str, char *separator, int width, scroll_state_t *st);

void charset_init(gboolean disable);
char *utf8_to_locale(const char *str);
char *locale_to_utf8(const char *str);

/**
 * Returns the number of terminal cells occupied by this string.
 */
size_t my_strlen(const char *str);

/* number of bytes in str */
size_t my_strsize(char *str);


#endif