diff options
author | Alan Coopersmith <Alan.Coopersmith@sun.com> | 2006-06-10 01:27:06 +0000 |
---|---|---|
committer | Alan Coopersmith <Alan.Coopersmith@sun.com> | 2006-06-10 01:27:06 +0000 |
commit | 7f6f90cfce51806340f25b80a87b147d8a743b27 (patch) | |
tree | f6c1449f36e22b68d56b9b1c879ed91e00faf6ab /Autest.c | |
parent | e214cc19e1d599f16a69e86b1d8b247ad40a9ed7 (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.c | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -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; } |