]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* mdemo/main.c (main, test_dl, test_dlself): propagate error
authorAlexandre Oliva <oliva@dcc.unicamp.br>
Thu, 11 Mar 1999 22:13:00 +0000 (22:13 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Thu, 11 Mar 1999 22:13:00 +0000 (22:13 +0000)
conditions better, to avoid false positives

ChangeLog
mdemo/main.c

index 5b71e3e2b98b88d32443d62a57f017167b70def6..71f02355bfec27528c5d0f1e2edb014918c26ba7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 1999-03-11  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
+       * 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
index 8355f0c902140eb87562c8eab5924015d7f40f17..8376cb2ba1ca287dae92784842ce1707d12c0072 100644 (file)
@@ -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;
 }