Commit | Line | Data |
---|---|---|
8e68d1c8 | 1 | /* |
996b65c8 | 2 | * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca> |
1e307fab | 3 | * Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
8e68d1c8 | 4 | * |
7272acf5 YB |
5 | * This program is free software; you can redistribute it and/or modify it |
6 | * under the terms of the GNU General Public License as published by the Free | |
7 | * Software Foundation; only version 2 of the License. | |
8e68d1c8 | 8 | * |
7272acf5 YB |
9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
12 | * more details. | |
8e68d1c8 | 13 | * |
7272acf5 YB |
14 | * You should have received a copy of the GNU General Public License along with |
15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |
16 | * Place - Suite 330, Boston, MA 02111-1307, USA. | |
8e68d1c8 DG |
17 | */ |
18 | ||
19 | #define _GNU_SOURCE | |
20 | #include <errno.h> | |
21 | #include <limits.h> | |
22 | #include <stdio.h> | |
23 | #include <stdlib.h> | |
24 | #include <string.h> | |
8e68d1c8 DG |
25 | #include <unistd.h> |
26 | ||
db758600 | 27 | #include <common/error.h> |
7272acf5 | 28 | |
8e68d1c8 DG |
29 | #include "utils.h" |
30 | ||
54d01ffb DG |
31 | /* |
32 | * Write to writable pipe used to notify a thread. | |
33 | */ | |
34 | int notify_thread_pipe(int wpipe) | |
35 | { | |
36 | int ret; | |
37 | ||
38 | ret = write(wpipe, "!", 1); | |
39 | if (ret < 0) { | |
7272acf5 | 40 | PERROR("write poll pipe"); |
54d01ffb DG |
41 | } |
42 | ||
43 | return ret; | |
44 | } | |
45 | ||
b082db07 | 46 | /* |
050349bb | 47 | * Return pointer to home directory path using the env variable HOME. |
b082db07 | 48 | * |
050349bb | 49 | * No home, NULL is returned. |
b082db07 DG |
50 | */ |
51 | const char *get_home_dir(void) | |
52 | { | |
53 | return ((const char *) getenv("HOME")); | |
54 | } |