summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2013-11-09 21:21:47 -0500
committerjoe <joe@jerkface.net>2013-11-11 16:00:25 -0500
commit75be0db86119a91a1362a9680bb79d8a44adb18c (patch)
tree972e3cc98973f3ebf7db6b038961956cb3d7b6ed
parent9732dffeb1c105b8de55656c305480cbbb761a07 (diff)
Obtain utmp path from paths.h header.
-rw-r--r--Presence/Paths.hs33
-rw-r--r--Presence/UTmp.hs3
2 files changed, 35 insertions, 1 deletions
diff --git a/Presence/Paths.hs b/Presence/Paths.hs
new file mode 100644
index 00000000..ac7c0938
--- /dev/null
+++ b/Presence/Paths.hs
@@ -0,0 +1,33 @@
1{-# LANGUAGE CPP #-}
2module Paths where
3
4#include <paths.h>
5
6bshell = _PATH_BSHELL
7console = _PATH_CONSOLE
8cshell = _PATH_CSHELL
9devdb = _PATH_DEVDB
10devnull = _PATH_DEVNULL
11drum = _PATH_DRUM
12gshadow = _PATH_GSHADOW
13klog = _PATH_KLOG
14kmem = _PATH_KMEM
15lastlog = _PATH_LASTLOG
16maildir = _PATH_MAILDIR
17man = _PATH_MAN
18mem = _PATH_MEM
19mnttab = _PATH_MNTTAB
20mounted = _PATH_MOUNTED
21nologin = _PATH_NOLOGIN
22preserve = _PATH_PRESERVE
23rwhodir = _PATH_RWHODIR
24sendmail = _PATH_SENDMAIL
25shadow = _PATH_SHADOW
26shells = _PATH_SHELLS
27tty = _PATH_TTY
28unix = _PATH_UNIX
29utmp = _PATH_UTMP
30vi = _PATH_VI
31wtmp = _PATH_WTMP
32
33
diff --git a/Presence/UTmp.hs b/Presence/UTmp.hs
index 898e05e0..a3adaeee 100644
--- a/Presence/UTmp.hs
+++ b/Presence/UTmp.hs
@@ -21,9 +21,10 @@ import Data.Word
21import Data.Int 21import Data.Int
22import Control.Monad.Error.Class 22import Control.Monad.Error.Class
23import System.IO.Error 23import System.IO.Error
24import qualified Paths
24 25
25 26
26utmp_file = "/var/run/utmp" 27utmp_file = Paths.utmp -- "/var/run/utmp"
27 28
28utmp_bs = S.readFile utmp_file 29utmp_bs = S.readFile utmp_file
29 30