summaryrefslogtreecommitdiff
path: root/Autest.c
diff options
context:
space:
mode:
authorAlan Coopersmith <Alan.Coopersmith@sun.com>2006-06-10 01:27:06 +0000
committerAlan Coopersmith <Alan.Coopersmith@sun.com>2006-06-10 01:27:06 +0000
commit7f6f90cfce51806340f25b80a87b147d8a743b27 (patch)
treef6c1449f36e22b68d56b9b1c879ed91e00faf6ab /Autest.c
parente214cc19e1d599f16a69e86b1d8b247ad40a9ed7 (diff)
Clean up existing Autest test program and use to provide simple (and very
incomplete) "make check" test case.
Diffstat (limited to 'Autest.c')
-rw-r--r--Autest.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/Autest.c b/Autest.c
index 2984649..12b8cbf 100644
--- a/Autest.c
+++ b/Autest.c
@@ -30,12 +30,16 @@ in this Software without prior written authorization from The Open Group.
#include <config.h>
#endif
#include <X11/Xauth.h>
+#include <stdio.h>
+#include <stdlib.h>
-main (argc, argv)
-char **argv;
+int
+main (int argc, char **argv)
{
Xauth test_data;
- char *name, *data, *file;
+ char *name = "XAU-TEST-1";
+ char *data = "Do not begin the test until instructed to do so.";
+ char *file = NULL;
int state = 0;
FILE *output;
@@ -50,10 +54,6 @@ char **argv;
++state;
}
}
- if(!file) {
- fprintf (stderr, "No file\n");
- exit (1);
- }
test_data.family = 0;
test_data.address_length = 0;
test_data.address = "";
@@ -63,9 +63,14 @@ char **argv;
test_data.name = name;
test_data.data_length = strlen (data);
test_data.data = data;
- output = fopen (file, "w");
+ if (!file) {
+ output = tmpfile();
+ } else {
+ output = fopen (file, "w");
+ }
if (output) {
- XauWriteAuth (output, &test_data);
+ state = XauWriteAuth (output, &test_data);
fclose (output);
}
+ return (state = 1) ? 0 : 1;
}