summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBenoît Dejean <bdejean@src.gnome.org>2004-11-13 00:53:20 +0000
committerBenoît Dejean <bdejean@src.gnome.org>2004-11-13 00:53:20 +0000
commit7e5ccec8bf8df4187c161f1e2dab600a434cf515 (patch)
tree9c382033a8dbae93a52efa937710164d7fefdad9 /examples
parentfdf313cdf618ab7ef971b73cecc0fd1162ef162b (diff)
downloadlibgtop-7e5ccec8bf8df4187c161f1e2dab600a434cf515.tar.gz
Bumped to 2.9.0
* configure.in: Bumped to 2.9.0 * configure.in: * examples/.cvsignore: * examples/Makefile.am: * examples/netlist.c: (main): * features.def: * include/glibtop/Makefile.am: * include/glibtop/command.h: * include/glibtop/netlist.h: * include/glibtop/sysdeps.h: * include/glibtop/union.h: * include/glibtop/version.h: * src/daemon/version.c: * sysdeps/linux/Makefile.am: * sysdeps/linux/netlist.c: (glibtop_init_netlist_s), (glibtop_get_netlist_s): * sysdeps/names/Makefile.am: * sysdeps/names/netlist.c: * sysdeps/solaris/Makefile.am: * sysdeps/solaris/netlist.c: (glibtop_init_netlist_s), (glibtop_get_netlist_s): Added new function glibtop_get_netlist(). Implemented for linux and solaris. Doc needed.
Diffstat (limited to 'examples')
-rw-r--r--examples/.cvsignore2
-rw-r--r--examples/Makefile.am13
-rw-r--r--examples/netlist.c46
3 files changed, 59 insertions, 2 deletions
diff --git a/examples/.cvsignore b/examples/.cvsignore
index eb80d17f..f7ec2055 100644
--- a/examples/.cvsignore
+++ b/examples/.cvsignore
@@ -20,4 +20,6 @@ procargs
procargs_static
df
df_static
+netlist
+netlist_static
diff --git a/examples/Makefile.am b/examples/Makefile.am
index b68175c0..45f261cb 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -6,7 +6,7 @@ INCLUDES = @INCLUDES@
DEFS = @DEFS@
-noinst_PROGRAMS = first second pprint procargs df \
+noinst_PROGRAMS = first second pprint procargs df netlist \
mountlist procmap netload sysdeps timings \
@static_targets@ @smp_examples@
@@ -15,7 +15,7 @@ EXTRA_PROGRAMS = first_static second_static \
third third_static smp smp_static \
netload_static sysdeps_static \
timings_static pprint_static procargs_static \
- df_static
+ df_static netlist_static
first_SOURCES = first.c
first_LDADD = $(top_builddir)/lib/libgtop-2.0.la
@@ -109,3 +109,12 @@ df_static_SOURCES = $(df_SOURCES)
df_static_LDADD = $(df_LDADD)
df_static_LDFLAGS = -static
+
+netlist_SOURCES = netlist.c
+netlist_LDADD = $(top_builddir)/lib/libgtop-2.0.la
+
+netlist_static_SOURCES = $(netlist_SOURCES)
+netlist_static_LDADD = $(netlist_LDADD)
+netlist_static_LDFLAGS = -static
+
+
diff --git a/examples/netlist.c b/examples/netlist.c
new file mode 100644
index 00000000..686d733a
--- /dev/null
+++ b/examples/netlist.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2004 Benoît Dejean
+ This file is part of LibGTop 2.0.
+
+
+ LibGTop is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ LibGTop is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LibGTop; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <stdio.h>
+
+#include <glibtop.h>
+#include <glibtop/netlist.h>
+
+
+int main(int argc, char *argv [])
+{
+ glibtop_netlist buf;
+ char **devices;
+ guint32 i;
+
+ glibtop_init();
+
+ devices = glibtop_get_netlist(&buf);
+
+ for(i = 0; i < buf.number; ++i)
+ {
+ printf("net device '%s'\n", devices[i]);
+ }
+
+ g_strfreev(devices);
+
+ glibtop_close();
+ return 0;
+}