home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gdb-4.16-base.tgz / gdb-4.16-base.tar / fsf / gdb / utils / amd-udi / udi / dfe_test.c next >
Encoding:
C/C++ Source or Header  |  1993-12-23  |  2.7 KB  |  92 lines

  1. /******************************************************************************
  2. * Copyright 1991 Advanced Micro Devices, Inc.
  3. * This software is the property of Advanced Micro Devices, Inc  (AMD)  which
  4. * specifically  grants the user the right to modify, use and distribute this
  5. * software provided this notice is not removed or altered.  All other rights
  6. * are reserved by AMD.
  7. *
  8. * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
  9. * SOFTWARE.  IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
  10. * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
  11. * USE OF THIS SOFTWARE.
  12. *
  13. * So that all may benefit from your experience, please report  any  problems
  14. * or  suggestions about this software to the 29K Technical Support Center at
  15. * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131  in  the  UK,  or
  16. * 0031-11-1129 in Japan, toll free.  The direct dial number is 512-462-4118.
  17. *
  18. * Advanced Micro Devices, Inc.
  19. * 29K Support Products
  20. * Mail Stop 573
  21. * 5900 E. Ben White Blvd.
  22. * Austin, TX 78741
  23. * 800-292-9263
  24. *****************************************************************************
  25. *       NAME    @(#)dfe_test.c    1.4 91/08/06  Daniel Mann
  26. *    This module is used for testing of DFE services.
  27. ********************************************************************** HISTORY
  28. */
  29. #include <stdio.h>
  30. #include <stdio.h>
  31. #include <sys/types.h>
  32. #include <sys/socket.h>
  33. #include <netinet/in.h>
  34. #include <netdb.h>
  35. #include <signal.h>
  36. #include "udiproc.h"
  37.  
  38. extern char    dfe_errmsg[];
  39. UDISessionId    SessionID;
  40. int        test_errno;
  41.  
  42. sig_handler()
  43. {
  44.     printf("DFE socket shutdown\n");
  45.     test_errno = UDIDisconnect(SessionID);
  46.     if(test_errno)printf("DFE Error: UDIDisconnect failed\n");
  47.     if(test_errno)printf("DFE errno= %d  errmsg = %s\n",
  48.     test_errno, dfe_errmsg);
  49.     exit();
  50. }
  51.  
  52. /***************************************************************** MAIN
  53. */
  54. main(argc, argv)
  55. int     argc;
  56. char*    argv[];
  57. {
  58.     char    *session = argv[1];
  59.     char    buf[256];
  60.     int        iarray[4];
  61.     int        cnt;
  62.  
  63.     if(argc < 2)
  64.     {    fprintf(stderr, "ERROR, format:\n");
  65.         fprintf(stderr, "%s session_id \n", argv[0]);
  66.     exit();
  67.     }
  68.     signal(SIGINT, sig_handler);
  69.     signal(SIGQUIT, sig_handler);
  70.     signal(SIGTERM, sig_handler);
  71.  
  72.     test_errno = UDIConnect(argv[1], &SessionID);
  73.     if(test_errno)printf("Error: UDIConnect failed errno=%d\n", test_errno);
  74.     if(test_errno)
  75.     {    printf("%s\n", dfe_errmsg);
  76.     exit(1);
  77.     }
  78.  
  79.     for(;;)
  80.     {
  81.     printf("\ninput an INT ....");
  82.     scanf("%d", &cnt);
  83.     printf("input a word ....");
  84.     scanf("%s", buf);
  85.     printf("input 4 INTs (for an array)....");
  86.     scanf("%d%d%d%d", &iarray[0],&iarray[1],&iarray[2], &iarray[3]);
  87.     UDITest(cnt, buf, iarray);
  88.     }
  89. }
  90.