From 0bf875d60a04177ca28aaa6b87de69a96a0b5ef9 Mon Sep 17 00:00:00 2001 From: mananth Date: Wed, 15 Oct 2003 12:52:08 +0000 Subject: Change get_devices_list.c to get_bus_devices_list.c and a few cosmetic changes --- ChangeLog | 4 ++++ test/Makefile.am | 4 ++-- test/Makefile.in | 37 +++++++++++++++---------------- test/get_bus_devices_list.c | 54 +++++++++++++++++++++++++++++++++++++++++++++ test/get_dev_class.c | 2 +- test/get_devices_list.c | 54 --------------------------------------------- 6 files changed, 79 insertions(+), 76 deletions(-) create mode 100644 test/get_bus_devices_list.c delete mode 100644 test/get_devices_list.c diff --git a/ChangeLog b/ChangeLog index 164d1ca..20b82d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ +10/15/2003 - Ananth Mavinakayanahalli + * Changed get_devices_list to get_bus_devices_list + * Fixed usage messages in tests + 10/15/2003 - Ananth Mavinakayanahalli * Added support for building shared library diff --git a/test/Makefile.am b/test/Makefile.am index feef6eb..ad9325d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,10 +1,10 @@ bin_PROGRAMS = dlist_test get_dev_bus get_dev_class get_device get_driver \ - get_devices_list + get_bus_devices_list dlist_test_SOURCES = dlist_test.c get_dev_bus_SOURCES = get_dev_bus.c get_dev_class_SOURCES = get_dev_class.c get_device_SOURCES = get_device.c get_driver_SOURCES = get_driver.c -get_devices_list_SOURCES = get_devices_list.c +get_bus_devices_list_SOURCES = get_bus_devices_list.c INCLUDES = -I../include LDADD = ../lib/libsysfs.la diff --git a/test/Makefile.in b/test/Makefile.in index c7d82d4..0f89af0 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -84,14 +84,14 @@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ bin_PROGRAMS = dlist_test get_dev_bus get_dev_class get_device get_driver \ - get_devices_list + get_bus_devices_list dlist_test_SOURCES = dlist_test.c get_dev_bus_SOURCES = get_dev_bus.c get_dev_class_SOURCES = get_dev_class.c get_device_SOURCES = get_device.c get_driver_SOURCES = get_driver.c -get_devices_list_SOURCES = get_devices_list.c +get_bus_devices_list_SOURCES = get_bus_devices_list.c INCLUDES = -I../include LDADD = ../lib/libsysfs.la subdir = test @@ -100,7 +100,7 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = bin_PROGRAMS = dlist_test$(EXEEXT) get_dev_bus$(EXEEXT) \ get_dev_class$(EXEEXT) get_device$(EXEEXT) get_driver$(EXEEXT) \ - get_devices_list$(EXEEXT) + get_bus_devices_list$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) am_dlist_test_OBJECTS = dlist_test.$(OBJEXT) @@ -108,6 +108,11 @@ dlist_test_OBJECTS = $(am_dlist_test_OBJECTS) dlist_test_LDADD = $(LDADD) dlist_test_DEPENDENCIES = ../lib/libsysfs.la dlist_test_LDFLAGS = +am_get_bus_devices_list_OBJECTS = get_bus_devices_list.$(OBJEXT) +get_bus_devices_list_OBJECTS = $(am_get_bus_devices_list_OBJECTS) +get_bus_devices_list_LDADD = $(LDADD) +get_bus_devices_list_DEPENDENCIES = ../lib/libsysfs.la +get_bus_devices_list_LDFLAGS = am_get_dev_bus_OBJECTS = get_dev_bus.$(OBJEXT) get_dev_bus_OBJECTS = $(am_get_dev_bus_OBJECTS) get_dev_bus_LDADD = $(LDADD) @@ -123,11 +128,6 @@ get_device_OBJECTS = $(am_get_device_OBJECTS) get_device_LDADD = $(LDADD) get_device_DEPENDENCIES = ../lib/libsysfs.la get_device_LDFLAGS = -am_get_devices_list_OBJECTS = get_devices_list.$(OBJEXT) -get_devices_list_OBJECTS = $(am_get_devices_list_OBJECTS) -get_devices_list_LDADD = $(LDADD) -get_devices_list_DEPENDENCIES = ../lib/libsysfs.la -get_devices_list_LDFLAGS = am_get_driver_OBJECTS = get_driver.$(OBJEXT) get_driver_OBJECTS = $(am_get_driver_OBJECTS) get_driver_LDADD = $(LDADD) @@ -142,11 +142,10 @@ LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/dlist_test.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/get_bus_devices_list.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/get_dev_bus.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/get_dev_class.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/get_device.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/get_devices_list.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/get_driver.Po +@AMDEP_TRUE@ ./$(DEPDIR)/get_device.Po ./$(DEPDIR)/get_driver.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ @@ -155,11 +154,11 @@ CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ CFLAGS = @CFLAGS@ -DIST_SOURCES = $(dlist_test_SOURCES) $(get_dev_bus_SOURCES) \ - $(get_dev_class_SOURCES) $(get_device_SOURCES) \ - $(get_devices_list_SOURCES) $(get_driver_SOURCES) +DIST_SOURCES = $(dlist_test_SOURCES) $(get_bus_devices_list_SOURCES) \ + $(get_dev_bus_SOURCES) $(get_dev_class_SOURCES) \ + $(get_device_SOURCES) $(get_driver_SOURCES) DIST_COMMON = Makefile.am Makefile.in -SOURCES = $(dlist_test_SOURCES) $(get_dev_bus_SOURCES) $(get_dev_class_SOURCES) $(get_device_SOURCES) $(get_devices_list_SOURCES) $(get_driver_SOURCES) +SOURCES = $(dlist_test_SOURCES) $(get_bus_devices_list_SOURCES) $(get_dev_bus_SOURCES) $(get_dev_class_SOURCES) $(get_device_SOURCES) $(get_driver_SOURCES) all: all-am @@ -202,6 +201,9 @@ clean-binPROGRAMS: dlist_test$(EXEEXT): $(dlist_test_OBJECTS) $(dlist_test_DEPENDENCIES) @rm -f dlist_test$(EXEEXT) $(LINK) $(dlist_test_LDFLAGS) $(dlist_test_OBJECTS) $(dlist_test_LDADD) $(LIBS) +get_bus_devices_list$(EXEEXT): $(get_bus_devices_list_OBJECTS) $(get_bus_devices_list_DEPENDENCIES) + @rm -f get_bus_devices_list$(EXEEXT) + $(LINK) $(get_bus_devices_list_LDFLAGS) $(get_bus_devices_list_OBJECTS) $(get_bus_devices_list_LDADD) $(LIBS) get_dev_bus$(EXEEXT): $(get_dev_bus_OBJECTS) $(get_dev_bus_DEPENDENCIES) @rm -f get_dev_bus$(EXEEXT) $(LINK) $(get_dev_bus_LDFLAGS) $(get_dev_bus_OBJECTS) $(get_dev_bus_LDADD) $(LIBS) @@ -211,9 +213,6 @@ get_dev_class$(EXEEXT): $(get_dev_class_OBJECTS) $(get_dev_class_DEPENDENCIES) get_device$(EXEEXT): $(get_device_OBJECTS) $(get_device_DEPENDENCIES) @rm -f get_device$(EXEEXT) $(LINK) $(get_device_LDFLAGS) $(get_device_OBJECTS) $(get_device_LDADD) $(LIBS) -get_devices_list$(EXEEXT): $(get_devices_list_OBJECTS) $(get_devices_list_DEPENDENCIES) - @rm -f get_devices_list$(EXEEXT) - $(LINK) $(get_devices_list_LDFLAGS) $(get_devices_list_OBJECTS) $(get_devices_list_LDADD) $(LIBS) get_driver$(EXEEXT): $(get_driver_OBJECTS) $(get_driver_DEPENDENCIES) @rm -f get_driver$(EXEEXT) $(LINK) $(get_driver_LDFLAGS) $(get_driver_OBJECTS) $(get_driver_LDADD) $(LIBS) @@ -225,10 +224,10 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dlist_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_bus_devices_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_dev_bus.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_dev_class.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_device.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_devices_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_driver.Po@am__quote@ distclean-depend: diff --git a/test/get_bus_devices_list.c b/test/get_bus_devices_list.c new file mode 100644 index 0000000..213e46f --- /dev/null +++ b/test/get_bus_devices_list.c @@ -0,0 +1,54 @@ +/* + * get_bus_devices_list.c + * + * Utility to get the list of devices on a given bus + * + * Copyright (C) IBM Corp. 2003 + * + * This program 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 version 2 of the License. + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include + +#include "libsysfs.h" + +void print_usage(void) +{ + fprintf(stdout, "Usage: get_bus_devices_list [bus]\n"); +} + +int main(int argc, char *argv[]) +{ + struct dlist *name = NULL; + unsigned char *cur = NULL; + + if (argc != 2) { + print_usage(); + return 1; + } + name = sysfs_open_bus_devices_list(argv[1]); + if (name != NULL) { + fprintf(stdout, "Devices on bus %s:\n", argv[1]); + dlist_for_each_data(name, cur, char) { + fprintf(stdout, "\t%s\n", cur); + } + } else + fprintf(stdout, "Bus %s not found\n", argv[1]); + sysfs_close_list(name); + + return 0; +} + diff --git a/test/get_dev_class.c b/test/get_dev_class.c index 92034fa..4c5df16 100644 --- a/test/get_dev_class.c +++ b/test/get_dev_class.c @@ -27,7 +27,7 @@ void print_usage(void) { - fprintf(stdout, "Usage: get_dev_class [device]\n"); + fprintf(stdout, "Usage: get_dev_class [class_device]\n"); } int main(int argc, char *argv[]) diff --git a/test/get_devices_list.c b/test/get_devices_list.c deleted file mode 100644 index 53051c5..0000000 --- a/test/get_devices_list.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * get_devices_list.c - * - * Utility to get the list of devices on a given bus - * - * Copyright (C) IBM Corp. 2003 - * - * This program 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 version 2 of the License. - * - * This program 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 this program; if not, write to the Free Software Foundation, Inc., - * 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include - -#include "libsysfs.h" - -void print_usage(void) -{ - fprintf(stdout, "Usage: get_devices_list [bus]\n"); -} - -int main(int argc, char *argv[]) -{ - struct dlist *name = NULL; - unsigned char *cur = NULL; - - if (argc != 2) { - print_usage(); - return 1; - } - name = sysfs_open_bus_devices_list(argv[1]); - if (name != NULL) { - fprintf(stdout, "Devices on bus %s:\n", argv[1]); - dlist_for_each_data(name, cur, char) { - fprintf(stdout, "\t%s\n", cur); - } - } else - fprintf(stdout, "Bus %s not found\n", argv[1]); - sysfs_close_list(name); - - return 0; -} - -- cgit v1.2.1