utils.{c,h} is needed
This commit is contained in:
parent
ab35c9b7dd
commit
4bc712b07d
|
@ -32,6 +32,7 @@ terminology_sources = ['private.h',
|
||||||
'termptyext.c', 'termptyext.h',
|
'termptyext.c', 'termptyext.h',
|
||||||
'backlog.c', 'backlog.h',
|
'backlog.c', 'backlog.h',
|
||||||
'md5.c', 'md5.h',
|
'md5.c', 'md5.h',
|
||||||
|
'utils.c', 'utils.h',
|
||||||
'utf8.c', 'utf8.h',
|
'utf8.c', 'utf8.h',
|
||||||
'win.c', 'win.h',
|
'win.c', 'win.h',
|
||||||
'theme.c', 'theme.h',
|
'theme.c', 'theme.h',
|
||||||
|
@ -60,6 +61,7 @@ tyfuzz_sources = ['termptyesc.c', 'termptyesc.h',
|
||||||
'col.c', 'col.h',
|
'col.c', 'col.h',
|
||||||
'sb.c', 'sb.h',
|
'sb.c', 'sb.h',
|
||||||
'theme.h',
|
'theme.h',
|
||||||
|
'utils.c', 'utils.h',
|
||||||
'utf8.c', 'utf8.h',
|
'utf8.c', 'utf8.h',
|
||||||
'tytest_common.c', 'tytest_common.h',
|
'tytest_common.c', 'tytest_common.h',
|
||||||
'tyfuzz.c']
|
'tyfuzz.c']
|
||||||
|
@ -76,6 +78,7 @@ tytest_sources = ['termptyesc.c', 'termptyesc.h',
|
||||||
'col.c', 'col.h',
|
'col.c', 'col.h',
|
||||||
'sb.c', 'sb.h',
|
'sb.c', 'sb.h',
|
||||||
'utf8.c', 'utf8.h',
|
'utf8.c', 'utf8.h',
|
||||||
|
'utils.c', 'utils.h',
|
||||||
'theme.h',
|
'theme.h',
|
||||||
'md5.c', 'md5.h',
|
'md5.c', 'md5.h',
|
||||||
'unit_tests.h',
|
'unit_tests.h',
|
||||||
|
|
|
@ -52,4 +52,27 @@ extern int _log_domain;
|
||||||
(DIV_ROUND_UP((_v), (_n)) * (_n))
|
(DIV_ROUND_UP((_v), (_n)) * (_n))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define casestartswith(str, constref) \
|
||||||
|
(!strncasecmp(str, constref, sizeof(constref) - 1))
|
||||||
|
#define startswith(str, constref) \
|
||||||
|
(!strncmp(str, constref, sizeof(constref) - 1))
|
||||||
|
|
||||||
|
#if !defined(HAVE_STRCHRNUL)
|
||||||
|
static inline char *
|
||||||
|
strchrnul(const char *s, int c)
|
||||||
|
{
|
||||||
|
const char *p = s;
|
||||||
|
|
||||||
|
while (*p)
|
||||||
|
{
|
||||||
|
if (*p == c)
|
||||||
|
return (char *)p;
|
||||||
|
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
return (char *) (p);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "miniview.h"
|
#include "miniview.h"
|
||||||
#include "gravatar.h"
|
#include "gravatar.h"
|
||||||
#include "sb.h"
|
#include "sb.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#if defined (__MacOSX__) || (defined (__MACH__) && defined (__APPLE__))
|
#if defined (__MacOSX__) || (defined (__MACH__) && defined (__APPLE__))
|
||||||
# include <sys/proc_info.h>
|
# include <sys/proc_info.h>
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "sb.h"
|
#include "sb.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
|
#include "utils.h"
|
||||||
#else
|
#else
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "utils.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
||||||
|
@ -154,24 +155,6 @@ theme_auto_reload_enable(Evas_Object *edje)
|
||||||
(edje, "edje,change,file", "edje", theme_reload_cb, NULL);
|
(edje, "edje,change,file", "edje", theme_reload_cb, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Bool
|
|
||||||
homedir_get(char *buf, size_t size)
|
|
||||||
{
|
|
||||||
const char *home = getenv("HOME");
|
|
||||||
if (!home)
|
|
||||||
{
|
|
||||||
uid_t uid = getuid();
|
|
||||||
struct passwd *pw = getpwuid(uid);
|
|
||||||
if (pw) home = pw->pw_dir;
|
|
||||||
}
|
|
||||||
if (!home)
|
|
||||||
{
|
|
||||||
ERR("Could not get $HOME");
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
return eina_strlcpy(buf, home, size) < size;
|
|
||||||
}
|
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
utils_need_scale_wizard(void)
|
utils_need_scale_wizard(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef _UTILS_H__
|
#ifndef _THEME_H__
|
||||||
#define _UTILS_H__
|
#define _THEME_H__
|
||||||
|
|
||||||
#include <Evas.h>
|
#include <Evas.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -11,32 +11,8 @@ void theme_reload(Evas_Object *edje);
|
||||||
void theme_auto_reload_enable(Evas_Object *edje);
|
void theme_auto_reload_enable(Evas_Object *edje);
|
||||||
const char *theme_path_get(const char *name);
|
const char *theme_path_get(const char *name);
|
||||||
|
|
||||||
Eina_Bool homedir_get(char *buf, size_t size);
|
|
||||||
Eina_Bool utils_need_scale_wizard(void);
|
Eina_Bool utils_need_scale_wizard(void);
|
||||||
|
|
||||||
#define casestartswith(str, constref) \
|
|
||||||
(!strncasecmp(str, constref, sizeof(constref) - 1))
|
|
||||||
#define startswith(str, constref) \
|
|
||||||
(!strncmp(str, constref, sizeof(constref) - 1))
|
|
||||||
|
|
||||||
#if !defined(HAVE_STRCHRNUL)
|
|
||||||
static inline char *
|
|
||||||
strchrnul(const char *s, int c)
|
|
||||||
{
|
|
||||||
const char *p = s;
|
|
||||||
|
|
||||||
while (*p)
|
|
||||||
{
|
|
||||||
if (*p == c)
|
|
||||||
return (char *)p;
|
|
||||||
|
|
||||||
++p;
|
|
||||||
}
|
|
||||||
return (char *) (p);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if (ELM_VERSION_MAJOR == 1) && (ELM_VERSION_MINOR < 20)
|
#if (ELM_VERSION_MAJOR == 1) && (ELM_VERSION_MINOR < 20)
|
||||||
# if __GNUC__ >= 7
|
# if __GNUC__ >= 7
|
||||||
# define EINA_FALLTHROUGH __attribute__ ((fallthrough));
|
# define EINA_FALLTHROUGH __attribute__ ((fallthrough));
|
||||||
|
|
|
@ -306,12 +306,6 @@ termio_color_class_set(Evas_Object *termio EINA_UNUSED, const char *key,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Bool
|
|
||||||
homedir_get(char *buf, size_t size)
|
|
||||||
{
|
|
||||||
return eina_strlcpy(buf, "/home/foo", size) < size;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
termio_reset_main_colors(Evas_Object *termio EINA_UNUSED)
|
termio_reset_main_colors(Evas_Object *termio EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue