From: Alexandre Oliva Date: Thu, 11 Mar 1999 22:13:00 +0000 (+0000) Subject: * mdemo/main.c (main, test_dl, test_dlself): propagate error X-Git-Tag: release-1-2f~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c853ec316337fe5fdaf26f07cc6658f88b0c5d7a;p=thirdparty%2Flibtool.git * mdemo/main.c (main, test_dl, test_dlself): propagate error conditions better, to avoid false positives --- diff --git a/ChangeLog b/ChangeLog index 5b71e3e2b..71f02355b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 1999-03-11 Alexandre Oliva + * mdemo/main.c (main, test_dl, test_dlself): propagate error + conditions better, to avoid false positives + * */configure.in: AC_SUBST(LIBTOOL_DEPS) * */Makefile.am $(OBJECTS): depend on libtool (libtool): rebuild automatically diff --git a/mdemo/main.c b/mdemo/main.c index 8355f0c90..8376cb2ba 100644 --- a/mdemo/main.c +++ b/mdemo/main.c @@ -31,6 +31,7 @@ test_dl (filename) int (*pfoo2)() = 0; int (*phello)() = 0; int *pnothing = 0; + int ret = 0; handle = lt_dlopen(filename); if (!handle) { @@ -52,30 +53,42 @@ test_dl (filename) printf("hello is ok!\n"); } else - fprintf (stderr, "did not find the `hello' function\n"); + { + fprintf (stderr, "did not find the `hello' function\n"); + ret = 1; + } /* Try assigning to the nothing variable. */ if (pnothing) *pnothing = 1; else - fprintf (stderr, "did not find the `nothing' variable\n"); + { + fprintf (stderr, "did not find the `nothing' variable\n"); + ret = 1; + } /* Just call the functions and check return values. */ if (pfoo1) { if ((*pfoo1) () == FOO_RET) printf("foo1 is ok!\n"); + else + ret = 1; } else if (pfoo2) { if ((*pfoo2) () == FOO_RET) printf("foo2 is ok!\n"); + else ret = 1; } else - fprintf (stderr, "did not find the `foo' function\n"); + { + fprintf (stderr, "did not find the `foo' function\n"); + ret = 1; + } lt_dlclose(handle); - return 0; + return ret; } int @@ -92,6 +105,7 @@ test_dlself () lt_dlhandle handle; int (*pmyfunc)() = 0; int *pmyvar = 0; + int ret = 0; handle = lt_dlopen(0); if (!handle) { @@ -111,16 +125,22 @@ test_dlself () printf("myfunc is ok!\n"); } else - fprintf (stderr, "did not find the `myfunc' function\n"); + { + fprintf (stderr, "did not find the `myfunc' function\n"); + ret = 1; + } /* Try assigning to the variable. */ if (pmyvar) *pmyvar = 1; else - fprintf (stderr, "did not find the `myvar' variable\n"); + { + fprintf (stderr, "did not find the `myvar' variable\n"); + ret = 1; + } lt_dlclose(handle); - return 0; + return ret; } int @@ -129,6 +149,7 @@ main (argc, argv) char **argv; { int i; + int ret = 0; printf ("Welcome GNU libtool mdemo!\n"); @@ -144,11 +165,11 @@ main (argc, argv) for (i = 1; i < argc; i++) if (test_dl(argv[i])) - return 1; + ret = 1; if (test_dlself()) - return 1; + ret = 1; lt_dlexit(); - return 0; + return ret; }