diff --git a/Makefile.am b/Makefile.am index 35dcb4a..8c56b17 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ # Generic definitions -SUBDIRS = lib doc utils test-tool +SUBDIRS = lib doc utils test-tool examples CLEANFILES= ACLOCAL_AMFLAGS =-I m4 @@ -32,13 +32,6 @@ iscsi_includedir = $(includedir)/iscsi dist_iscsi_include_HEADERS = include/iscsi.h include/scsi-lowlevel.h dist_noinst_HEADERS = include/iscsi-private.h include/md5.h include/slist.h -# Other examples -noinst_PROGRAMS += bin/iscsiclient -bin_iscsiclient_SOURCES = examples/iscsiclient.c - -EXTRA_PROGRAMS += bin/iscsi-dd -bin_iscsi_dd_SOURCES = examples/iscsi-dd.c - # LD_PRELOAD library. if LD_ISCSI diff --git a/configure.ac b/configure.ac index 9f0186c..e1d01c6 100644 --- a/configure.ac +++ b/configure.ac @@ -134,5 +134,6 @@ AC_CONFIG_FILES([Makefile] [doc/Makefile] [utils/Makefile] [test-tool/Makefile] + [examples/Makefile] [libiscsi.pc]) AC_OUTPUT diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..eccd00f --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,7 @@ +AM_CPPFLAGS=-I. -I../include "-D_U_=__attribute__((unused))" \ + "-D_R_(A,B)=__attribute__((format(printf,A,B)))" +AM_CFLAGS=$(WARN_CFLAGS) +LDADD = ../lib/libiscsi.la + +noinst_PROGRAMS = iscsiclient iscsi-dd + diff --git a/examples/iscsi-dd.c b/examples/iscsi-dd.c index b741085..5caa90e 100644 --- a/examples/iscsi-dd.c +++ b/examples/iscsi-dd.c @@ -140,7 +140,7 @@ void fill_read_queue(struct client *client) } } -int main(int argc, const char *argv[]) +int main(int argc, char *argv[]) { char *src_url = NULL; char *dst_url = NULL; @@ -163,17 +163,16 @@ int main(int argc, const char *argv[]) &option_index)) != -1) { switch (c) { case 'd': - dst = optarg; + dst_url = optarg; break; case 's': - src = optarg; + src_url = optarg; break; case 'i': initiator = optarg; break; default: fprintf(stderr, "Unrecognized option '%c'\n\n", c); - print_help(); exit(0); } }