summaryrefslogtreecommitdiff
path: root/sysdeps/linux/ppp.c
diff options
context:
space:
mode:
authorMartin Baulig <martin@home-of-linux.org>2000-02-06 13:21:14 +0000
committerMartin Baulig <martin@src.gnome.org>2000-02-06 13:21:14 +0000
commit2eab7cfc483f2a754cc3ea71e8a6e40289850931 (patch)
treef2edd4e866b4818037c8057ee0eeff2d8ec77b43 /sysdeps/linux/ppp.c
parenta691993a86e1bd7ff4e2aca81ad2f67c213e0090 (diff)
downloadlibgtop-2eab7cfc483f2a754cc3ea71e8a6e40289850931.tar.gz
Removed the `lockfile' argument; we now use a configure check to determine
2000-02-06 Martin Baulig <martin@home-of-linux.org> * include/glibtop/ppp.h (glibtop_get_ppp): Removed the `lockfile' argument; we now use a configure check to determine the modem lockfile. * include/glibtop/error.h (GLIBTOP_ERROR_NEED_MODEM_LOCKFILE): Removed this now obsolete error constant again. * configure.in (--with-modem-lockfile): New configure parameter to manually specify the modem lockfile. (LIBGTOP_MODEM_LOCKFILE): Define this to be a printf-format string for the modem lockfile; takes the interface number as argument.
Diffstat (limited to 'sysdeps/linux/ppp.c')
-rw-r--r--sysdeps/linux/ppp.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/sysdeps/linux/ppp.c b/sysdeps/linux/ppp.c
index 61ec7b8a..ec70ecdd 100644
--- a/sysdeps/linux/ppp.c
+++ b/sysdeps/linux/ppp.c
@@ -116,7 +116,7 @@ get_ISDN_stats (glibtop *server, int *in, int *out)
}
static int
-is_ISDN_on (glibtop *server, int *online)
+is_ISDN_on (glibtop *server, int device, int *online)
{
FILE *f = 0;
char buffer [BUFSIZ], *p;
@@ -211,11 +211,13 @@ is_ISDN_on (glibtop *server, int *online)
}
static int
-is_Modem_on (glibtop *server, const char *lock_file)
+is_Modem_on (glibtop *server, int device)
{
- FILE *f = 0;
- gchar buf[64];
+ gchar buf[64], lock_file [BUFSIZ];
pid_t pid = -1;
+ FILE *f = 0;
+
+ sprintf (lock_file, LIBGTOP_MODEM_LOCKFILE, device);
f = fopen (lock_file, "r");
@@ -275,7 +277,7 @@ get_Modem_stats (int device, int *in, int *out)
int
glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device,
- unsigned short use_isdn, const char *lockfile)
+ unsigned short use_isdn)
{
int in, out, online;
@@ -285,7 +287,7 @@ glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device,
if (use_isdn) {
/* ISDN */
- if (is_ISDN_on (server, &online)) {
+ if (is_ISDN_on (server, device, &online)) {
buf->state = online ? GLIBTOP_PPP_STATE_ONLINE :
GLIBTOP_PPP_STATE_HANGUP;
buf->flags |= (1L << GLIBTOP_PPP_STATE);
@@ -299,10 +301,7 @@ glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device,
}
} else {
/* Modem */
- if (!lockfile)
- return -GLIBTOP_ERROR_NEED_MODEM_LOCKFILE;
-
- buf->state = is_Modem_on (server, lockfile) ?
+ buf->state = is_Modem_on (server, device) ?
GLIBTOP_PPP_STATE_ONLINE : GLIBTOP_PPP_STATE_HANGUP;
buf->flags |= (1L << GLIBTOP_PPP_STATE);