home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / lib / Xau / Autest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-08  |  822 b   |  41 lines

  1. #include <X11/Xauth.h>
  2.  
  3. main (argc, argv)
  4. char    **argv;
  5. {
  6.     Xauth   test_data;
  7.     char    *name, *data, *file;
  8.     int        state = 0;
  9.     FILE    *output;
  10.  
  11.     while (*++argv) {
  12.     if (!strcmp (*argv, "-file"))
  13.         file = *++argv;
  14.     else if (state == 0) {
  15.         name = *argv;
  16.         ++state;
  17.     } else if (state == 1) {
  18.         data = *argv;
  19.         ++state;
  20.     }
  21.     }
  22.     if(!file) {
  23.     fprintf (stderr, "No file\n");
  24.     exit (1);
  25.     }
  26.     test_data.family = 0;
  27.     test_data.address_length = 0;
  28.     test_data.address = "";
  29.     test_data.number_length = 0;
  30.     test_data.number = "";
  31.     test_data.name_length = strlen (name);
  32.     test_data.name = name;
  33.     test_data.data_length = strlen (data);
  34.     test_data.data = data;
  35.     output = fopen (file, "w");
  36.     if (output) {
  37.     XauWriteAuth (output, &test_data);
  38.     fclose (output);
  39.     }
  40. }
  41.