home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / aix / 13011 < prev    next >
Encoding:
Text File  |  1993-01-05  |  3.1 KB  |  115 lines

  1. Newsgroups: comp.unix.aix
  2. Path: sparky!uunet!uunet.ca!canrem!dosgate!dosgate![harry.tempelman@canrem.com]
  3. From: "harry tempelman" <harry.tempelman@canrem.com>
  4. Subject: c menu program
  5. Message-ID: <19935.4577.16930@dosgate>
  6. Reply-To: "harry tempelman" <harry.tempelman@canrem.com>
  7. Organization: Canada Remote Systems
  8. Distribution: comp
  9. Date: 5 Jan 93 13:10:16 EST
  10. Lines: 103
  11.  
  12.  
  13. Can anyone enlighten me on the following topic.
  14.  
  15. C MENU Program.
  16. The hardware platform is RISC RS/6000, AIX 3.2.2
  17.  
  18. 2 Questions:
  19. How do I change the program with strcpy, system(cp) so that I can pass
  20. a value down?
  21. Is there a way to read more then one file & at the end rewind the tape?
  22.  
  23.  system("dd if=/dev/rmt1.1  of=/dev/tmp/"filename" ibs=1600 conv=sync");
  24.  
  25.  
  26. /*       Menu program for CTad
  27.  
  28.   Date          : 29-DEC-92
  29.  
  30.   File name daddy$sys:usr\tc\apex\menu.c
  31.   File name apex:/home/operator/c/menu.c
  32.  
  33. #include <stdio.h>   /* includes */
  34. #include <stdlib.h>
  35. #include <ctype.h>
  36.  
  37. #define CLS  system("clear");
  38.  
  39. /* prototypes of local functions */
  40. void menu_lable();
  41. void rmt1read();
  42.  
  43. /* global variables */
  44. int i = 0;
  45.  
  46. /****************************************************************************/
  47. /* the main program starts here:
  48.    in this function we minimise the code and maximise clarity
  49.    (divide & conquer)                                                       */
  50. /****************************************************************************/
  51. main()
  52. {
  53.     menu_lable();
  54.     start();
  55. }
  56.  
  57. start()
  58. {
  59.     char answer;
  60.  {
  61.  
  62.      answer = getchar();
  63.              answer = tolower(answer);
  64.  
  65.              switch (answer)
  66.              {
  67.                 case 'a' : system("cd /u/ctad; /home/ctad/catiges"); main();
  68.                 case 'b' : system("cd /u/ctad; /home/ctad/integrator"); main();
  69.                 case 'c' : system("/home/ctad/wrtcat"); main();
  70.                 case 'd' : rmt1read();
  71.                 case 'q' : printf("menu end\n"); exit(1);
  72.                 default  : printf("\nPlease try again"); sleep(1); main();
  73.  }
  74.     }
  75. return 0;
  76. }
  77.  
  78. /****************************************************************************/
  79. /* display menu_lable                                                       */
  80. /****************************************************************************/
  81.  
  82. void menu_lable()
  83.  
  84. {
  85.     CLS;
  86.     {
  87.        printf("\n\n\t\t\t     Main Menu\n\n");
  88.        printf("\t\t\t(A)  IGES Conversion\n");
  89.        printf("\t\t\t(B)  PDGS to CATIA Menu\n");
  90.        printf("\t\t\t(C)  Write Ford Standard to CATIA\n");
  91.        printf("\t\t\t(D)  Tape Read Menu\n");
  92.        printf("\t\t\t(E)  Tape Write Menu\n");
  93.        printf("\t\t\t(Q)  Quit\n");
  94.  
  95.        printf("\n\t\t\t     Choice: ");
  96.     }
  97. }
  98.  
  99. /****************************************************************************/
  100. /* display rmt1read_menu                                                    */
  101. /****************************************************************************/
  102.  
  103. void rmt1read_menu()
  104. {
  105.     CLS;
  106.     {
  107.        printf("\n\n\t\t\t     Tape Read Menu\n\n");
  108.  
  109. (Continued in the next message)
  110. ---
  111.  ■ DeLuxe² 1.20 #11534 ■ REALITY.SYS Corrupted: Reboot universe? [Y/N]
  112. --
  113. Canada Remote Systems  - Toronto, Ontario
  114. World's Largest PCBOARD System - 416-629-7000/629-7044
  115.