summaryrefslogtreecommitdiff
path: root/src/lib/evil
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2019-07-28 09:27:27 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-07-28 09:27:27 +0100
commita6ade14c5e65ab729b1013388ec1aea4be22afc7 (patch)
treeb290aa6c715f3a2a10dc8b067d8ab3781e840d21 /src/lib/evil
parent04848c98f217b3fa1fc2a49bce2649895e705611 (diff)
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
Diffstat (limited to 'src/lib/evil')
-rw-r--r--src/lib/evil/Evil.h6
-rw-r--r--src/lib/evil/evil_pwd.c69
-rw-r--r--src/lib/evil/meson.build2
-rw-r--r--src/lib/evil/pwd.h89
4 files changed, 0 insertions, 166 deletions
diff --git a/src/lib/evil/Evil.h b/src/lib/evil/Evil.h
index 7383fe7..147e45a 100644
--- a/src/lib/evil/Evil.h
+++ b/src/lib/evil/Evil.h
@@ -75,11 +75,8 @@
75 * @li @ref Evil_Dlfcn 75 * @li @ref Evil_Dlfcn
76 * @li @ref Evil_Langinfo_Group 76 * @li @ref Evil_Langinfo_Group
77 * @li @ref Evil_Locale_Group 77 * @li @ref Evil_Locale_Group
78 * @li @ref Evil_Pwd_Group
79 * @li @ref Evil_Stdio_Group 78 * @li @ref Evil_Stdio_Group
80 * @li @ref Evil_Main_Group 79 * @li @ref Evil_Main_Group
81 * @li @ref Evil_Inet_Group
82 * @li @ref Evil_Dirent_Group
83 * @li @ref Evil_String_Group 80 * @li @ref Evil_String_Group
84 * @li @ref Evil_Stdlib_Group 81 * @li @ref Evil_Stdlib_Group
85 * @li @ref Evil_Time_Group 82 * @li @ref Evil_Time_Group
@@ -94,9 +91,6 @@ extern "C" {
94#endif 91#endif
95 92
96 93
97typedef unsigned long uid_t;
98typedef unsigned long gid_t;
99
100#ifdef _MSC_VER 94#ifdef _MSC_VER
101# ifdef _WIN64 95# ifdef _WIN64
102typedef __int64 pid_t; 96typedef __int64 pid_t;
diff --git a/src/lib/evil/evil_pwd.c b/src/lib/evil/evil_pwd.c
deleted file mode 100644
index c45f928..0000000
--- a/src/lib/evil/evil_pwd.c
+++ /dev/null
@@ -1,69 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif /* HAVE_CONFIG_H */
4
5#include <stdlib.h>
6#include <stdio.h>
7
8#define _POSIX
9#include <io.h>
10#include <lmcons.h>
11
12#include "evil_private.h"
13#include "pwd.h"
14
15
16static struct passwd pw = { NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, 0, 0 };
17
18struct passwd *
19getpwnam(const char *n)
20{
21 static char user_name[UNLEN + 1];
22 static char user_gecos[UNLEN + 4];
23 TCHAR name[UNLEN + 1];
24 DWORD length;
25 BOOLEAN res;
26#ifdef UNICODE
27 char *a_name;
28# endif /* UNICODE */
29
30 if (!n)
31 return NULL;
32
33 length = UNLEN + 1;
34 res = GetUserName(name, &length);
35 if (!res)
36 return NULL;
37
38#ifdef UNICODE
39 a_name = evil_wchar_to_char(name);
40 if (a_name)
41 {
42 int l;
43
44 l = strlen(a_name);
45 if (l >= PATH_MAX)
46 l = PATH_MAX;
47 memcpy(user_name, a_name, l);
48 user_name[l] = '\0';
49 free(a_name);
50 }
51 else
52 return NULL;
53#else
54 memcpy(user_name, name, strlen(name) + 1);
55#endif /* UNICODE */
56
57 if (strcmp(n, user_name) != 0)
58 return NULL;
59
60 pw.pw_name = user_name;
61 snprintf(user_gecos, sizeof(user_gecos), "%s,,,", user_name);
62 pw.pw_gecos = user_gecos;
63 pw.pw_dir = getenv("USERPROFILE");
64 pw.pw_shell = getenv("SHELL");
65 if (!pw.pw_shell)
66 pw.pw_shell = "cmd.exe";
67
68 return &pw;
69}
diff --git a/src/lib/evil/meson.build b/src/lib/evil/meson.build
index 8ed266c..85978d8 100644
--- a/src/lib/evil/meson.build
+++ b/src/lib/evil/meson.build
@@ -16,7 +16,6 @@ if target_machine.system() == 'windows'
16 'evil_unistd.h', 16 'evil_unistd.h',
17 'evil_util.h', 17 'evil_util.h',
18 'dirent.h', 18 'dirent.h',
19 'pwd.h',
20 ] 19 ]
21 evil_header_sys_src = [join_paths('sys','mman.h')] 20 evil_header_sys_src = [join_paths('sys','mman.h')]
22 21
@@ -27,7 +26,6 @@ if target_machine.system() == 'windows'
27 'evil_locale.c', 26 'evil_locale.c',
28 'evil_main.c', 27 'evil_main.c',
29 'evil_mman.c', 28 'evil_mman.c',
30 'evil_pwd.c',
31 'evil_stdio.c', 29 'evil_stdio.c',
32 'evil_stdlib.c', 30 'evil_stdlib.c',
33 'evil_string.c', 31 'evil_string.c',
diff --git a/src/lib/evil/pwd.h b/src/lib/evil/pwd.h
deleted file mode 100644
index 104acd9..0000000
--- a/src/lib/evil/pwd.h
+++ /dev/null
@@ -1,89 +0,0 @@
1#ifndef __EVIL_PWD_H__
2#define __EVIL_PWD_H__
3
4
5/**
6 * @file pwd.h
7 * @brief The file that provides functions ported from Unix in pwd.h.
8 * @defgroup Evil_Pwd_Group Pwd.h functions
9 * @ingroup Evil
10 *
11 * This header provides functions ported from Unix in pwd.h.
12 *
13 * @{
14 */
15
16
17#include <time.h>
18
19#include <Evil.h>
20
21#ifdef EAPI
22# undef EAPI
23#endif
24
25#ifdef _WIN32
26# ifdef EFL_BUILD
27# ifdef DLL_EXPORT
28# define EAPI __declspec(dllexport)
29# else
30# define EAPI
31# endif
32# else
33# define EAPI __declspec(dllimport)
34# endif
35#endif
36
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42
43/**
44 * @struct passwd
45 * @brief A structure that describes a password.
46 */
47struct passwd {
48 char *pw_name; /**< user name */
49 char *pw_passwd; /**< encrypted password (always @c NULL) */
50 uid_t pw_uid; /**< user uid (always 0) */
51 gid_t pw_gid; /**< user gid (always 0) */
52 time_t pw_change; /**< password change time (always 0) */
53 char *pw_class; /**< user access class (always @c NULL) */
54 char *pw_gecos; /**< Honeywell login info */
55 char *pw_dir; /**< home directory */
56 char *pw_shell; /**< default shell */
57 time_t pw_expire; /**< account expiration (always 0) */
58 int pw_fields; /**< internal: fields filled in (always 0) */
59};
60
61/**
62 * @brief Return a passwd structure.
63 *
64 * @param n The name of the user.
65 * @return A stacally allocated passwd structure.
66 *
67 * This function fills a static buffer @ref passwd with the user name @p n.
68 *
69 * Conformity: None.
70 *
71 * Supported OS: Windows XP.
72 */
73EAPI struct passwd *getpwnam(const char *n);
74
75
76#ifdef __cplusplus
77}
78#endif
79
80#undef EAPI
81#define EAPI
82
83
84/**
85 * @}
86 */
87
88
89#endif /* __EVIL_PWD_H__ */