|
Packit Service |
f89583 |
/*
|
|
Packit Service |
f89583 |
|
|
Packit Service |
f89583 |
Copyright 1988, 1998 The Open Group
|
|
Packit Service |
f89583 |
|
|
Packit Service |
f89583 |
Permission to use, copy, modify, distribute, and sell this software and its
|
|
Packit Service |
f89583 |
documentation for any purpose is hereby granted without fee, provided that
|
|
Packit Service |
f89583 |
the above copyright notice appear in all copies and that both that
|
|
Packit Service |
f89583 |
copyright notice and this permission notice appear in supporting
|
|
Packit Service |
f89583 |
documentation.
|
|
Packit Service |
f89583 |
|
|
Packit Service |
f89583 |
The above copyright notice and this permission notice shall be included in
|
|
Packit Service |
f89583 |
all copies or substantial portions of the Software.
|
|
Packit Service |
f89583 |
|
|
Packit Service |
f89583 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
Packit Service |
f89583 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
Packit Service |
f89583 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
Packit Service |
f89583 |
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
Packit Service |
f89583 |
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
Packit Service |
f89583 |
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
Packit Service |
f89583 |
|
|
Packit Service |
f89583 |
Except as contained in this notice, the name of The Open Group shall not be
|
|
Packit Service |
f89583 |
used in advertising or otherwise to promote the sale, use or other dealings
|
|
Packit Service |
f89583 |
in this Software without prior written authorization from The Open Group.
|
|
Packit Service |
f89583 |
|
|
Packit Service |
f89583 |
*/
|
|
Packit Service |
f89583 |
|
|
Packit Service |
f89583 |
#ifdef HAVE_CONFIG_H
|
|
Packit Service |
f89583 |
#include <config.h>
|
|
Packit Service |
f89583 |
#endif
|
|
Packit Service |
f89583 |
#include <X11/Xauth.h>
|
|
Packit Service |
f89583 |
#include <stdio.h>
|
|
Packit Service |
f89583 |
#include <stdlib.h>
|
|
Packit Service |
f89583 |
|
|
Packit Service |
f89583 |
int
|
|
Packit Service |
f89583 |
main (int argc, char **argv)
|
|
Packit Service |
f89583 |
{
|
|
Packit Service |
f89583 |
Xauth test_data;
|
|
Packit Service |
f89583 |
char *name = "XAU-TEST-1";
|
|
Packit Service |
f89583 |
char *data = "Do not begin the test until instructed to do so.";
|
|
Packit Service |
f89583 |
char *file = NULL;
|
|
Packit Service |
f89583 |
int state = 0;
|
|
Packit Service |
f89583 |
FILE *output;
|
|
Packit Service |
f89583 |
|
|
Packit Service |
f89583 |
while (*++argv) {
|
|
Packit Service |
f89583 |
if (!strcmp (*argv, "-file"))
|
|
Packit Service |
f89583 |
file = *++argv;
|
|
Packit Service |
f89583 |
else if (state == 0) {
|
|
Packit Service |
f89583 |
name = *argv;
|
|
Packit Service |
f89583 |
++state;
|
|
Packit Service |
f89583 |
} else if (state == 1) {
|
|
Packit Service |
f89583 |
data = *argv;
|
|
Packit Service |
f89583 |
++state;
|
|
Packit Service |
f89583 |
}
|
|
Packit Service |
f89583 |
}
|
|
Packit Service |
f89583 |
test_data.family = 0;
|
|
Packit Service |
f89583 |
test_data.address_length = 0;
|
|
Packit Service |
f89583 |
test_data.address = "";
|
|
Packit Service |
f89583 |
test_data.number_length = 0;
|
|
Packit Service |
f89583 |
test_data.number = "";
|
|
Packit Service |
f89583 |
test_data.name_length = strlen (name);
|
|
Packit Service |
f89583 |
test_data.name = name;
|
|
Packit Service |
f89583 |
test_data.data_length = strlen (data);
|
|
Packit Service |
f89583 |
test_data.data = data;
|
|
Packit Service |
f89583 |
if (!file) {
|
|
Packit Service |
f89583 |
output = tmpfile();
|
|
Packit Service |
f89583 |
} else {
|
|
Packit Service |
f89583 |
output = fopen (file, "w");
|
|
Packit Service |
f89583 |
}
|
|
Packit Service |
f89583 |
if (output) {
|
|
Packit Service |
f89583 |
state = XauWriteAuth (output, &test_data);
|
|
Packit Service |
f89583 |
fclose (output);
|
|
Packit Service |
f89583 |
}
|
|
Packit Service |
f89583 |
return (state = 1) ? 0 : 1;
|
|
Packit Service |
f89583 |
}
|