pinosaur
/
surf.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cee8f01
)
Fixing the last patch to the surf style.
author
Christoph Lohmann
<20h@r-36.net>
Fri, 3 Jun 2016 13:14:53 +0000
(15:14 +0200)
committer
Quentin Rameau
<quinq@fifth.space>
Tue, 5 Jul 2016 11:01:56 +0000
(13:01 +0200)
surf.c
patch
|
blob
|
history
diff --git
a/surf.c
b/surf.c
index
105b28e
..
9851bba
100644
(file)
--- a/
surf.c
+++ b/
surf.c
@@
-144,6
+144,8
@@
static void setup(void);
static void sigchld(int unused);
static char *buildfile(const char *path);
static char *buildpath(const char *path);
static void sigchld(int unused);
static char *buildfile(const char *path);
static char *buildpath(const char *path);
+static const char *getuserhomedir(const char *user);
+static const char *getcurrentuserhomedir(void);
static Client *newclient(Client *c);
static void loaduri(Client *c, const Arg *a);
static const char *geturi(Client *c);
static Client *newclient(Client *c);
static void loaduri(Client *c, const Arg *a);
static const char *geturi(Client *c);
@@
-351,34
+353,35
@@
buildfile(const char *path)
}
static const char*
}
static const char*
-get_user_homedir(const char *user) {
+getuserhomedir(const char *user)
+{
struct passwd *pw = getpwnam(user);
struct passwd *pw = getpwnam(user);
- if (!pw) {
- die("Can't get user `%s' home directory.\n", user);
- }
+
+ if (!pw)
+ die("Can't get user %s login information.\n", user);
+
return pw->pw_dir;
}
static const char*
return pw->pw_dir;
}
static const char*
-get_current_user_homedir() {
+getcurrentuserhomedir(void)
+{
const char *homedir;
const char *user;
struct passwd *pw;
homedir = getenv("HOME");
const char *homedir;
const char *user;
struct passwd *pw;
homedir = getenv("HOME");
- if (homedir)
{
+ if (homedir)
return homedir;
return homedir;
- }
user = getenv("USER");
user = getenv("USER");
- if (user) {
- return get_user_homedir(user);
- }
+ if (user)
+ return getuserhomedir(user);
pw = getpwuid(getuid());
pw = getpwuid(getuid());
- if (!pw)
{
+ if (!pw)
die("Can't get current user home directory\n");
die("Can't get current user home directory\n");
- }
+
return pw->pw_dir;
}
return pw->pw_dir;
}
@@
-386,19
+389,19
@@
char *
buildpath(const char *path)
{
char *apath, *name, *p, *fpath;
buildpath(const char *path)
{
char *apath, *name, *p, *fpath;
+ const char *homedir;
if (path[0] == '~') {
if (path[0] == '~') {
- const char *homedir;
if (path[1] == '/' || path[1] == '\0') {
p = (char *)&path[1];
if (path[1] == '/' || path[1] == '\0') {
p = (char *)&path[1];
- homedir = get
_current_user_
homedir();
+ homedir = get
currentuser
homedir();
} else {
if ((p = strchr(path, '/')))
name = g_strndup(&path[1], --p - path);
else
name = g_strdup(&path[1]);
} else {
if ((p = strchr(path, '/')))
name = g_strndup(&path[1], --p - path);
else
name = g_strdup(&path[1]);
- homedir = get
_user_
homedir(name);
+ homedir = get
user
homedir(name);
g_free(name);
}
apath = g_build_filename(homedir, p, NULL);
g_free(name);
}
apath = g_build_filename(homedir, p, NULL);