Evil: remove pwd code in Evil and fix compilation failures after the removal

Summary: remove pwd code in Evil

Test Plan: compilation

Reviewers: zmike, cedric, raster

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9420
This commit is contained in:
Vincent Torri 2019-07-28 09:27:27 +01:00 committed by Carsten Haitzler (Rasterman)
parent 04848c98f2
commit a6ade14c5e
28 changed files with 89 additions and 175 deletions

View File

@ -2,6 +2,10 @@
# include "elementary_config.h"
#endif
#ifdef _WIN32
# include <evil_private.h> /* setenv */
#endif
#include <Elementary.h>
#include <Ecore_Input_Evas.h>
#include "elm_widget.h"

View File

@ -3,6 +3,11 @@
#endif
#include <string.h>
#ifdef _WIN32
# include <evil_private.h> /* strcasestr */
#endif
#include <Efl_Ui.h>
#include <Elementary.h>
#include "test.h"

View File

@ -2,6 +2,11 @@
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#ifdef _WIN32
# include <evil_private.h> /* strcasestr */
#endif
#include <Elementary.h>
static void

View File

@ -2,6 +2,10 @@
# include "elementary_config.h"
#endif
#ifdef _WIN32
# include <evil_private.h> /* mkdir stelocale */
#endif
#include <Elementary.h>
#ifndef ENABLE_NLS
# ifndef setlocale

View File

@ -3,6 +3,10 @@
# include "elementary_config.h"
#endif
#ifdef _WIN32
# include <evil_private.h> /* mkdir */
#endif
#include <Elementary.h>
struct _api_data

View File

@ -3,6 +3,10 @@
# include "elementary_config.h"
#endif
#ifdef _WIN32
# include <evil_private.h> /* mkdir */
#endif
#include <Elementary.h>
struct _api_data

View File

@ -3,6 +3,11 @@
#ifdef HAVE_CONFIG_H
#include "elementary_config.h"
#endif
#ifdef _WIN32
# include <evil_private.h> /* strcasestr */
#endif
#include <Elementary.h>
#include "test_explode.h"

View File

@ -1,6 +1,11 @@
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#ifdef _WIN32
# include <evil_private.h> /* strcasestr */
#endif
#include <Elementary.h>
enum _slide_style

View File

@ -1,6 +1,11 @@
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#ifdef _WIN32
# include <evil_private.h> /* mkdir */
#endif
#include <Elementary.h>
#define LIST_ITEM_MAX 20

View File

@ -10,7 +10,11 @@
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
#ifdef _WIN32
# include <evil_private.h> /* mkdir */
#else
# include <pwd.h>
#endif
#include <libgen.h>
#ifdef HAVE_SYSTEMD

View File

@ -8,10 +8,11 @@
#include <unistd.h>
#include <ctype.h>
#include <sys/types.h>
#include <pwd.h>
#ifdef _WIN32
# include <winsock2.h>
#else
# include <pwd.h>
#endif
#include <Ecore_File.h>

View File

@ -3,7 +3,11 @@
#endif
#include <sys/types.h>
#include <pwd.h>
#ifdef _WIN32
# include <evil_private.h> /* mkdir */
#else
# include <pwd.h>
#endif
#include <Eina.h>

View File

@ -3,7 +3,9 @@
#endif
#include <sys/types.h>
#include <pwd.h>
#ifndef _WIN32
# include <pwd.h>
#endif
#include <Eina.h>

View File

@ -21,7 +21,9 @@
#ifdef ELM_DIRENT_H
#include <dirent.h>
#endif
#include <pwd.h>
#ifndef _WIN32
# include <pwd.h>
#endif
#include <errno.h>
#ifdef ELM_UNIX

View File

@ -27,7 +27,9 @@
#ifdef ELM_DIRENT_H
#include <dirent.h>
#endif
#include <pwd.h>
#ifndef _WIN32
# include <pwd.h>
#endif
#include <errno.h>
#ifdef ELM_UNIX

View File

@ -5,6 +5,10 @@
# include <langinfo.h>
#endif
#ifdef _WIN32
# include <evil_private.h> /* nl_langinfo */
#endif
#include <Elementary.h>
#include "elm_priv.h"

View File

@ -2,6 +2,10 @@
# include "elementary_config.h"
#endif
#ifdef _WIN32
# include <evil_private.h> /* nl_langinfo */
#endif
#define EFL_ACCESS_OBJECT_PROTECTED
#define EFL_UI_L10N_PROTECTED

View File

@ -4,7 +4,6 @@
#include <Elementary.h>
#include "elm_priv.h"
#include <pwd.h>
#include "efl_config_global.eo.h"

View File

@ -12,6 +12,7 @@
#ifdef _WIN32
# include <direct.h> /* getcwd */
# include <evil_private.h> /* dlopen,dlclose,etc */
#endif
#include <Emotion.h>

View File

@ -2,6 +2,10 @@
# include "elementary_config.h"
#endif
#ifdef _WIN32
# include <evil_private.h> /* strsep evil_path_absolute */
#endif
#define EFL_ACCESS_OBJECT_PROTECTED
#include <Elementary.h>

View File

@ -2,6 +2,10 @@
# include "elementary_config.h"
#endif
#ifdef _WIN32
# include <evil_private.h> /* nl_langinfo */
#endif
#include <Elementary.h>
#include "elm_priv.h"

View File

@ -41,7 +41,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <pwd.h>
#ifndef _WIN32
# include <pwd.h>
#endif
#ifdef HAVE_XATTR
# include <sys/xattr.h>

View File

@ -75,11 +75,8 @@
* @li @ref Evil_Dlfcn
* @li @ref Evil_Langinfo_Group
* @li @ref Evil_Locale_Group
* @li @ref Evil_Pwd_Group
* @li @ref Evil_Stdio_Group
* @li @ref Evil_Main_Group
* @li @ref Evil_Inet_Group
* @li @ref Evil_Dirent_Group
* @li @ref Evil_String_Group
* @li @ref Evil_Stdlib_Group
* @li @ref Evil_Time_Group
@ -94,9 +91,6 @@ extern "C" {
#endif
typedef unsigned long uid_t;
typedef unsigned long gid_t;
#ifdef _MSC_VER
# ifdef _WIN64
typedef __int64 pid_t;

View File

@ -1,69 +0,0 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif /* HAVE_CONFIG_H */
#include <stdlib.h>
#include <stdio.h>
#define _POSIX
#include <io.h>
#include <lmcons.h>
#include "evil_private.h"
#include "pwd.h"
static struct passwd pw = { NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, 0, 0 };
struct passwd *
getpwnam(const char *n)
{
static char user_name[UNLEN + 1];
static char user_gecos[UNLEN + 4];
TCHAR name[UNLEN + 1];
DWORD length;
BOOLEAN res;
#ifdef UNICODE
char *a_name;
# endif /* UNICODE */
if (!n)
return NULL;
length = UNLEN + 1;
res = GetUserName(name, &length);
if (!res)
return NULL;
#ifdef UNICODE
a_name = evil_wchar_to_char(name);
if (a_name)
{
int l;
l = strlen(a_name);
if (l >= PATH_MAX)
l = PATH_MAX;
memcpy(user_name, a_name, l);
user_name[l] = '\0';
free(a_name);
}
else
return NULL;
#else
memcpy(user_name, name, strlen(name) + 1);
#endif /* UNICODE */
if (strcmp(n, user_name) != 0)
return NULL;
pw.pw_name = user_name;
snprintf(user_gecos, sizeof(user_gecos), "%s,,,", user_name);
pw.pw_gecos = user_gecos;
pw.pw_dir = getenv("USERPROFILE");
pw.pw_shell = getenv("SHELL");
if (!pw.pw_shell)
pw.pw_shell = "cmd.exe";
return &pw;
}

View File

@ -16,7 +16,6 @@ if target_machine.system() == 'windows'
'evil_unistd.h',
'evil_util.h',
'dirent.h',
'pwd.h',
]
evil_header_sys_src = [join_paths('sys','mman.h')]
@ -27,7 +26,6 @@ if target_machine.system() == 'windows'
'evil_locale.c',
'evil_main.c',
'evil_mman.c',
'evil_pwd.c',
'evil_stdio.c',
'evil_stdlib.c',
'evil_string.c',

View File

@ -1,89 +0,0 @@
#ifndef __EVIL_PWD_H__
#define __EVIL_PWD_H__
/**
* @file pwd.h
* @brief The file that provides functions ported from Unix in pwd.h.
* @defgroup Evil_Pwd_Group Pwd.h functions
* @ingroup Evil
*
* This header provides functions ported from Unix in pwd.h.
*
* @{
*/
#include <time.h>
#include <Evil.h>
#ifdef EAPI
# undef EAPI
#endif
#ifdef _WIN32
# ifdef EFL_BUILD
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
# else
# define EAPI
# endif
# else
# define EAPI __declspec(dllimport)
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* @struct passwd
* @brief A structure that describes a password.
*/
struct passwd {
char *pw_name; /**< user name */
char *pw_passwd; /**< encrypted password (always @c NULL) */
uid_t pw_uid; /**< user uid (always 0) */
gid_t pw_gid; /**< user gid (always 0) */
time_t pw_change; /**< password change time (always 0) */
char *pw_class; /**< user access class (always @c NULL) */
char *pw_gecos; /**< Honeywell login info */
char *pw_dir; /**< home directory */
char *pw_shell; /**< default shell */
time_t pw_expire; /**< account expiration (always 0) */
int pw_fields; /**< internal: fields filled in (always 0) */
};
/**
* @brief Return a passwd structure.
*
* @param n The name of the user.
* @return A stacally allocated passwd structure.
*
* This function fills a static buffer @ref passwd with the user name @p n.
*
* Conformity: None.
*
* Supported OS: Windows XP.
*/
EAPI struct passwd *getpwnam(const char *n);
#ifdef __cplusplus
}
#endif
#undef EAPI
#define EAPI
/**
* @}
*/
#endif /* __EVIL_PWD_H__ */

View File

@ -5,7 +5,9 @@
#include <Eina.h>
#include <check.h>
#include "eina_suite.h"
#include <pwd.h>
#ifndef _WIN32
# include <pwd.h>
#endif
EFL_START_TEST(eina_test_vpath_valid)
{

View File

@ -2,6 +2,10 @@
# include "elementary_config.h"
#endif
#ifdef _WIN32
# include <evil_private.h> /* setlocale strptime */
#endif
#define EFL_UI_FORMAT_PROTECTED /* To access internal methods */
#include <Efl_Ui.h>