home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / ALIB12.ZIP / EX02.EXE / WYSE1.C < prev   
Text File  |  1992-02-16  |  4KB  |  154 lines

  1. /* wyse1.c */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <alloc.h>
  6. #include <string.h>
  7. #include <time.h>
  8. #include <dir.h>
  9.  
  10. /* AutoLibrary by Avid Software */
  11. #include "al.h"
  12.  
  13. /* WYSE tests include file. */
  14. #define GLOBAL 1
  15. #include "wyse.h"
  16.  
  17. #ifndef TRUE
  18. #define TRUE 1
  19. #endif
  20.  
  21. #ifndef FALSE
  22. #define FALSE 0
  23. #endif
  24.  
  25. /* Globals */
  26. int long_version;
  27.  
  28. /* Options accepted by this program. */
  29. static char *o_all            = "+a";  /* Run all tests. */
  30. static char *o_abort_on_error = ".A"; /* Abort program if an error occur. */
  31. static char *o_long_version   = "-L"; /* Run the over night tests. */
  32. static char *o_protected_mode = "+p"; /* Run protected mode test. */
  33. static char *o_scr_attribs    = "-a"; /* Run the screen attributes test. */
  34. static char *o_scr_loc        = "+s";  /* Run the screen location test. */
  35. static char *o_scr_print      = "+P";  /* Run the screen print test. */
  36.  
  37. /*****/
  38. void EveryChar(c)
  39. int c;
  40. /*****/
  41. {
  42. char s[20];
  43. int add_info;
  44.  
  45.     AvidConvert(c, s, &add_info, "");
  46.     /* turn off printing
  47.     printf("%s", s);
  48.     */
  49. }
  50.  
  51. /*****/
  52. void main(argc, argv)
  53. /*****/
  54. int argc;
  55. char *argv[];
  56. {
  57. int com;
  58. int i;
  59. char arg_str[100];
  60. char sc, control;
  61. char arg[85];
  62. char temp_buf[100];
  63. int err, add_info;
  64.  
  65.     randomize();
  66.  
  67.     /* Initial AutoLibrary. */
  68.     AvidInitAutoLibrary(AVID, &add_info, "_B'3'");
  69.  
  70.     /* Print help screen if no options are specified. */
  71.     if (argc == 1) {
  72.     printf("\nUsage: wyse <options>\n\n");
  73.     printf("Where: <options> are...\n");
  74.     printf("%s --- Run all tests.\n", o_all);
  75.     printf("%s --- Abort program if an error occurs. (Default is continue)\n", o_abort_on_error);
  76.     printf("%s --- Run long version of tests..\n", o_long_version);
  77.     printf("%s --- Run protected mode test.\n", o_protected_mode);
  78.     printf("%s --- Run screen attributes test.\n", o_scr_attribs);
  79.     printf("%s --- Run screen location test.\n", o_scr_loc);
  80.     printf("%s --- Run screen print test.\n", o_scr_print);
  81.     exit(0);
  82.     }
  83.  
  84.     /* Combine all options into one string so ak_opts can be used. */
  85.     for (i=1,arg_str[0]='\0'; i < argc; i++) {
  86.     strcat(arg_str, " ");
  87.     strcat(arg_str, argv[i]);
  88.     }
  89.  
  90.     /* Find out if over night tests should be done. */
  91.     if (AvidProcessOptions(AVID, arg_str, o_long_version,
  92.                            &control, arg, &i) != '\0')
  93.     long_version = TRUE;
  94.     else
  95.     long_version = FALSE;
  96.  
  97.     /* Open the communcation port. */
  98.     com = AvidOpenPort(AVID, "com1", &add_info, ".b'9600' .1 .8 .n +S -H");
  99.  
  100.     /* Find out if abort should be done when error occurs. */
  101.     if (AvidProcessOptions(AVID, arg_str, o_abort_on_error, &control, arg, &i) != '\0')
  102.     AvidLogOpen(AVID, com, "logfile", &add_info, "+E");
  103.     else
  104.     AvidLogOpen(AVID, com, "logfile", &add_info, "");
  105.  
  106.     /* Display AutoLibrary version. */
  107.     AvidVersion(AVID, &add_info, "");
  108.  
  109.     /* Find out what kind of batch mode testing to do. */
  110.     i=0; /* Required for AvidProcessOptions. */
  111.     while ((sc = AvidProcessOptions(AVID, arg_str, "", &control,
  112.                              arg, &i)) != '\0') {
  113.  
  114.     if ((o_all[0] == control) && (o_all[1] == sc)) {
  115.  
  116.         initialize_testing(com);
  117.  
  118.         test_scr_loc(com, 20, 80);
  119.         test_scr_print(com, 20, 80);
  120.         test_scr_attribs(com);
  121.         test_protected_mode(com);
  122.     }
  123.  
  124.     if ((o_scr_loc[0] == control) && (o_scr_loc[1] == sc)) {
  125.         initialize_testing(com);
  126.         test_scr_loc(com, 20, 80);
  127.     }
  128.  
  129.     if ((o_scr_print[0] == control) && (o_scr_print[1] == sc)) {
  130.         initialize_testing(com);
  131.         test_scr_print(com, 20, 80);
  132.     }
  133.  
  134.     if ((o_scr_attribs[0] == control) && (o_scr_attribs[1] == sc)) {
  135.         initialize_testing(com);
  136.         test_scr_attribs(com);
  137.     }
  138.  
  139.     if ((o_protected_mode[0] == control) && (o_protected_mode[1] == sc)) {
  140.         initialize_testing(com);
  141.         test_protected_mode(com);
  142.     }
  143.     }
  144.  
  145.     /* Clear the screen. */
  146.     clear_wyse_screen(com);
  147.  
  148.     /* Finished so close the com port. */
  149.     AvidClosePort(AVID, com, &add_info, "");
  150.  
  151.     /* Exit from AutoLibrary. */
  152.     AvidExitAutoLibrary(AVID, &add_info, "");
  153. }
  154.