home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a014 / 1.ddi / CDBINC.EXE / PROGAG.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-16  |  17.6 KB  |  587 lines

  1. #include <stdio.h>
  2. #include <fcntl.h>
  3. #define white 7
  4. #define red_back 64
  5. #define yellow 14
  6. #define blue_back 16
  7. #define eblue 3
  8. struct menu {
  9.        char mean[31];
  10.        char prog_name[9];
  11.        int subprog;
  12.        int start;
  13.        int end;
  14.        int row;
  15.        int col;
  16.        struct menu *last,*next;
  17.        };
  18.  
  19. struct menu *menuhead,*scrhead,*scrend,*midd;
  20. struct menu *pagehead,*pageend;
  21. int flag;
  22. char path[9]={"\0\0\0\0\0\0\0\0\0"};
  23. struct menu *dm[7],*dn[7],*dl[7];
  24. int posi[7];
  25. extern char pathname[14];
  26. progag(name)
  27. char *name;
  28. {
  29.    FILE *fmenu;
  30.    int ctc;
  31.    char menu_buff[80];
  32.    if ((fmenu=fopen("menu.txt","r"))==NULL) {
  33.       cls(3,46,7,76,6|1);
  34.       frame(3,45,7,74,white | red_back);
  35.       print(3,47,white | red_back,"╢╘▓╗╞≡, ─·├╗╙╨╔·│╔╙ª╙├╧╡═│");
  36.       print(4,47,white | red_back,"╡─▓╦╡Ñ. ▓╗─▄╔·│╔╙ª╙├│╠╨≥  ");
  37.       print(5,47,white | red_back,"Press any key to continue ");
  38.       getchb();
  39.       cls(2,42,8,76,0|113);
  40.       return(0);
  41.       }
  42.    getmenu_mem();
  43.    menuhead=midd; pagehead=midd; pageend=midd;
  44.    while (fgets(menu_buff,80,fmenu)!=NULL)
  45.       {
  46.       sscanf(menu_buff,"#%[^#]#,#%[^#]#,%d,%d,%d,%d",midd->mean,midd->prog_name,\
  47.           &(midd->subprog),&(midd->start),&(midd->end),&(midd->row),&(midd->col));
  48.       getmenu_mem();
  49.       pageend->next=midd; midd->last=pageend;
  50.       pageend=midd;
  51.       }
  52.    pageend=midd->last; midd->last->next=NULL;
  53.    midd->last=NULL; free(midd);
  54.    scrhead=menuhead->next; pageend=menuhead;
  55.    for (ctc=0;ctc<menuhead->end-1;ctc++) pageend=pageend->next;
  56.    scrend=scrhead;
  57.    for (ctc=0;ctc<10;ctc++)
  58.        {
  59.        if (scrend==pageend) break;
  60.        scrend=scrend->next;
  61.        }
  62.    print(24,0,0|75,"%-80s","        íⁿ ╔╧╥╞╣Γ┤°          í² ╧┬╥╞╣Γ┤°          Enter╤í╘±        Esc ═╦│÷ ");
  63.    edit_menu(name);
  64.    return(0);
  65. }
  66.  
  67. disp_menu()
  68. /*int flag;*/
  69. {
  70.    struct menu *dm;
  71.    int i,j;
  72.    cls(7,45,20,78,6|1);
  73.    frame(7,44,20,76,yellow | blue_back);
  74.    dm=scrhead; i=7; j=45;
  75.    while (dm!=scrend)
  76.      {
  77.      print(i,j,yellow | blue_back,"%-30s",dm->mean);
  78.      i++;
  79.      dm=dm->next;
  80.      }
  81.    print(i,j,yellow | blue_back,"%-30s",dm->mean);
  82.    return(0);
  83. }
  84.  
  85. edit_menu(name)
  86. char *name;
  87. {
  88.    int js3=7;
  89.    int charact,j,wh_flag;
  90.    int posi[7];
  91.    flag=0;
  92.    j=45;
  93.    if (menuhead->subprog==0)
  94.       {
  95.     mk_dir("",j,name);
  96.     cls(7,44,21,78,yellow | blue_back);
  97.     free(menuhead);
  98.     return(1);
  99.       }
  100.    midd=scrhead; disp_menu();
  101.    path[flag]='\0';
  102.    for(;;)
  103.       {
  104.       print(js3,j,0|113,"%-30s",midd->mean);
  105. /*      path[flag]='\0';*/
  106.       while ((charact=getchb())!=27)
  107.      {
  108.      switch (charact)
  109.          {
  110.          case 272:
  111.               print(js3,j,yellow | blue_back,"%-30s",midd->mean);
  112.               if (midd!=scrhead) {midd=midd->last; path[flag]--; js3--; break;}
  113.               if (scrhead==pagehead->next) break;
  114.               midd=scrhead=midd->last; scrend=scrend->last;
  115.               disp_menu(flag);
  116.               break;
  117.          case 280:
  118.               print(js3,j,yellow | blue_back,"%-30s",midd->mean);
  119.               if (midd!=scrend) {midd=midd->next; path[flag]++; js3++; break;}
  120.               if (scrend==pageend) break;
  121.               midd=scrend=midd->next; scrhead=scrhead->next;
  122.               disp_menu(flag);
  123.               break;
  124.          case  13:path[flag]=path[flag]+65; path[flag+1]='\0';
  125.               if (midd->subprog==0)
  126.              {
  127.              mk_dir(path,j,name);
  128.              cls(6,44,20,78,0|113);
  129.              path[flag]=path[flag]-65;
  130.              disp_menu(flag); break;
  131.              }
  132.               dm[flag]=scrhead; dn[flag]=scrend;
  133.               dl[flag]=midd;  posi[flag]=js3; flag++;
  134.               if (flag==1)
  135.              {
  136.              cls(3,7,13,42,6|1);
  137.              frame(3,6,13,40,yellow | blue_back);
  138.              }
  139.               for (wh_flag=0;wh_flag<flag;wh_flag++)
  140.               print(3+wh_flag,8,yellow | blue_back,"%-30s",dl[wh_flag]);
  141.               scrend=menuhead;
  142.               for (j=0;j<midd->start;j++) scrend=scrend->next;
  143.               pagehead=scrend; scrhead=pagehead->next;
  144.               for (j=0;j<midd->end-1;j++) scrend=scrend->next;
  145.               pageend=scrend; scrend=pagehead;
  146.               for (j=0;j<10;j++)
  147.               {
  148.               if (scrend==pageend) break;
  149.               scrend=scrend->next;
  150.               }
  151.               midd=scrhead;
  152.               disp_menu(flag); js3=7; j=45;
  153.               break;
  154.         }
  155.      print(js3,j,0|113,"%-30s",midd->mean);
  156.      }
  157.       path[flag--]='\0';
  158.       if (flag==-1) break;
  159.       if (flag!=0)
  160.      {
  161.      cls(4,8,11,38,yellow | blue_back);
  162.      for (wh_flag=0;wh_flag<flag;wh_flag++)
  163.          print(3+wh_flag,8,yellow | blue_back,"%-30s",dl[wh_flag]);
  164.      }
  165.       else
  166.      cls(2,5,13,42,0|113);
  167.       path[flag]-=65;
  168.       cls(6,44,20,77,0|113);
  169.       scrend=menuhead;
  170.       for (j=0;j<pagehead->start;j++) scrend=scrend->next;
  171.       pagehead=scrend;
  172.       for (j=0;j<pagehead->end-1;j++) scrend=scrend->next;
  173.       pageend=scrend; scrhead=dm[flag];
  174.       scrend=dn[flag]; midd=dl[flag]; js3=posi[flag]; j=45;
  175.       disp_menu();
  176.       }
  177.    cls(6,0,24,79,0|113);
  178.    midd=menuhead->next;
  179.    while (midd==NULL)
  180.       {
  181.       midd->last=NULL;
  182.       menuhead->next=NULL;
  183.       free(menuhead);
  184.       menuhead=midd; midd=midd->last;
  185.       }
  186.    free(menuhead);
  187.    return(0);
  188. }
  189.  
  190. getmenu_mem()
  191. {
  192.    midd=(struct menu *) malloc(sizeof(struct menu));
  193.    midd->last=midd->next=NULL;
  194.    return(0);
  195. }
  196.  
  197. mk_dir(path,topcol,name)
  198. char *path;
  199. int topcol;
  200. char *name;
  201. {
  202.    int i,j;
  203.    FILE *fp,*fw;
  204.    char db[20],buff[80];
  205.    if (strcmp(path,"")==0)
  206.       goto gen;
  207.    if (chdir(path)==0)
  208.       {
  209.       if ((fp=fopen("smain.prg","r"))!=NULL)
  210.      {
  211.      /*cls(12,topcol+6,16,topcol+29,6|1);
  212.      cls(11,topcol+4,15,topcol+26,yellow | blue_back);*/
  213.      cls(12,topcol+5,16,topcol+30,0);
  214.      frame(12,topcol+4,16,topcol+28,0|75);
  215.      print(12,topcol+6,0|75,"─·╘°╛¡╔·│╔╣²▒╛╫╙╧╡═│");
  216.      print(13,topcol+6,0|75,"╙ª╙├│╠╨≥, ─·╩╟╖±╧δ╓╪");
  217.      print(14,topcol+6,0|75,"╔·│╔ (Y/N)?         ");
  218.      fclose(fp);
  219.      i=getchb();
  220.      while (i!='Y' && i!='y' && i!='N' && i!='n') i=getchb();
  221.      if (i=='N' || i=='n') {chdir(".."); return(0);}
  222.      }
  223.       }
  224.    else {mkdir(path); chdir(path);}
  225.    disp_menu(flag);
  226.    strcpy(db,name); strcat(db,"\\db.txt");
  227.    fp=fopen(db,"r"); fw=fopen("db.txt","w");
  228.    i=0; j=0;
  229.    while (i<midd->start) {fgets(buff,80,fp);i++;}
  230.    for (j=0;j<midd->end;j++)
  231.        {
  232.        fgets(buff,120,fp);
  233.        fprintf(fw,"%s",buff);
  234.        }
  235.    fclose(fp); fclose(fw);
  236. gen:generat(topcol,name);
  237.    return(0);
  238. }
  239.  
  240. generat(topcol,name)
  241. int topcol;
  242. char *name;
  243. {
  244.    struct process {
  245.           char model[13];
  246.           char pathname[20];
  247.           };
  248.    struct process program[11]={
  249.                  {"┬╝╚δ╙δ╬¼╗ñ  ","c:\\cdbag4\\get_in "},
  250.                  {"▓Θ      ╤»  ","c:\\cdbag4\\look "},
  251.                  {"┼┼      ╨≥  ","c:\\cdbag4\\sort "},
  252.                  {"═│╝╞╙δ╝╞╦π  ","c:\\cdbag4\\statis "},
  253.                  {"╠¿ ╒╩ ▒¿ ▒φ ","c:\\cdbag4\\tetris "},
  254.                  {"═│╝╞═╝╨╬╧╘╩╛","c:\\cdbag4\\tjtuxi "},
  255.                  {"╩² ╛▌ ┤½ ╡▌ ","c:\\cdbag4\\sjcd "},
  256.                  {"═╝╨╬┬╝╚δ▓Θ╤»","c:\\cdbag4\\txlrcx "},
  257.                  {"═¿╙├▒¿▒φ┤≥╙í","c:\\cdbag4\\report "},
  258.                  {"╚╬╥Γ▒¿▒φ┤≥╙í","c:\\cdbag4\\print "},
  259.                  {"└⌐ │Σ │╠ ╨≥ ","c:\\cdbag4\\kccx "},
  260.                  };
  261.    int i,j,m,wh_flag;
  262.    struct menu *s_head,*s_end;
  263.    int charact;
  264.    char pname[40];
  265.    /*cls(9,topcol+8,21,topcol+22,6|1);
  266.    cls(8,topcol+7,20,topcol+21,0|113);*/
  267.    cls(9,topcol+8,21,topcol+25,0);
  268.    frame(9,topcol+7,21,topcol+23,0|30);
  269.    charact=9;
  270.    for (i=0;i<11;i++)
  271.        {
  272.        print(9+i,topcol+9,0|30,"%s",program[i].model);
  273.        }
  274.    i=0;
  275.    print(9+i,topcol+9,0|113,"%s",program[i].model);
  276.    while ((charact=getchb())!=27)
  277.      {
  278.      switch (charact)
  279.         {
  280.         case 272:
  281.              print(9+i,topcol+9,0|30,"%s",program[i].model);
  282.              i=(i>0)?i-1:10;
  283.              break;
  284.         case 280:
  285.              print(9+i,topcol+9,0|30,"%s",program[i].model);
  286.              i=(i<10)?i+1:0;
  287.              break;
  288.         case 13 :if (sare_ware(topcol,i)==0)
  289.                 {
  290.                /* cls(9,topcol+8,21,topcol+22,6|1);
  291.                 cls(8,topcol+7,20,topcol+21,0|113);*/
  292.                cls(9,topcol+8,21,topcol+25,0);
  293.                frame(9,topcol+7,21,topcol+23,0|30);
  294.                 for (charact=0;charact<11;charact++)
  295.                 print(9+charact,topcol+9,0|30,"%s",program[charact].model);
  296.                 break;
  297.                 }
  298.              strcpy(pname,program[i].pathname);
  299.              strcat(pname,name);
  300. /*             if (i!=3)*/
  301.                 strcat(pname,"\\");
  302.              strcat(pname," wy");
  303.              system(pname);
  304.              cls(0,0,24,79,6|1);
  305.              print(0,0,0|30,"     ▓╦╡Ñ╔·│╔            ┐Γ╜ß╣╣╔·│╔          ╙ª╙├│╠╨≥╔·│╔        ═╦│÷           ");
  306.              cls(1,0,24,79,0|113); s_head=scrhead; s_end=scrend;
  307.              if (menuhead->subprog==0) goto gen;
  308.              for (m=0;m<flag;m++)
  309.                  {
  310.                  scrhead=dm[m];
  311.                  scrend=dn[m];
  312.                  disp_menu(m);
  313.                  }
  314.              scrhead=s_head; scrend=s_end; disp_menu(flag);
  315.              print(24,0,0|75,"%-80s","        íⁿ ╔╧╥╞╣Γ┤°          í² ╧┬╥╞╣Γ┤°          Enter╤í╘±        Esc ═╦│÷ ");
  316.              if (flag>=1)
  317.                 {
  318.              cls(3,7,13,42,6|1);
  319.              frame(3,6,13,40,yellow | blue_back);
  320.              }
  321.              for (wh_flag=0;wh_flag<flag;wh_flag++)
  322.                  print(3+wh_flag,8,yellow | blue_back,"%-30s",dl[wh_flag]);
  323. gen:
  324.              /*cls(9,topcol+8,21,topcol+21,6|1);
  325.              cls(8,topcol+7,20,topcol+21,0|113);*/
  326.              cls(9,topcol+8,21,topcol+25,0);
  327.              frame(9,topcol+7,21,topcol+23,0|30);
  328.              for (j=0;j<11;j++)
  329.                  print(9+j,topcol+9,0|30,"%s",program[j].model);
  330.              break;
  331.         }
  332.      print(9+i,topcol+9,0|113,"%s",program[i].model);
  333.      }
  334.    gen_main(pathname);
  335.    if (menuhead->subprog!=0)
  336.       system("cd ..");
  337.    cls(21,0,22,79,0|113);
  338.    return(0);
  339. }
  340.  
  341. sare_ware(topcol,count)
  342. int topcol;
  343. int count;
  344. {
  345.    struct process {
  346.           char model[13];
  347.           char pathname[25];
  348.           };
  349.    struct process program[11]={
  350.                  {"┬╝╚δ╙δ╬¼╗ñ  ","c:\\cdbag4\\get_in"},
  351.                  {"▓Θ      ╤»  ","c:\\cdbag4\\look"},
  352.                  {"┼┼      ╨≥  ","c:\\cdbag4\\sort"},
  353.                  {"═│╝╞╙δ╝╞╦π  ","c:\\cdbag4\\statis"},
  354.                  {"╠¿ ╒╩ ▒¿ ▒φ ","c:\\cdbag4\\tetris"},
  355.                  {"═│╝╞═╝╨╬╧╘╩╛","c:\\cdbag4\\tjtuxi"},
  356.                  {"╩² ╛▌ ┤½ ╡▌ ","c:\\cdbag4\\sjcd"},
  357.                  {"═╝╨╬┬╝╚δ▓Θ╤»","c:\\cdbag4\\txlrcx"},
  358.                  {"═¿╙├▒¿▒φ┤≥╙í","c:\\cdbag4\\report"},
  359.                  {"╚╬╥Γ▒¿▒φ┤≥╙í","c:\\cdbag4\\print"},
  360.                  {"└⌐ │Σ │╠ ╨≥ ","c:\\cdbag4\\kccx"},
  361.                  };
  362.    int handle;
  363.    strcat(program[count].pathname,".exe");
  364.    if ((handle=_open(program[count].pathname,O_RDONLY))==-1)
  365.       {
  366.       /*cls(9,topcol+6,15,topcol+26,6|1);
  367.       cls(10,topcol+5,14,topcol+27,white | red_back);*/
  368.       frame(11,topcol+5,15,topcol+27,0|75);
  369.       print(11,topcol+7,0|75,"╢╘▓╗╞≡, ─·├╗╙╨╣║┬⌠");
  370.       print(12,topcol+7,0|75,"┤╦─ú┐Θ╡─╔·│╔│╠╨≥. ");
  371.       print(13,topcol+7,0|75,"╝ⁿ╚╬╥╗╝ⁿ╝╠╨° ...  ");
  372.       getchb();
  373.       cls(9,topcol+4,15,topcol+27,yellow | blue_back);
  374.       return(0);
  375.       }
  376.    else _close(handle);
  377.    return(1);
  378. }
  379.  
  380. gen_main(name)
  381. char *name;
  382. {
  383.    struct process {
  384.           char model[30];
  385.           char pathname[25];
  386.           };
  387.    struct process prg[11]={
  388.                  {"┬╝╚δ ╙δ ╬¼╗ñ                ","get_in.prg"},
  389.                  {"▓Θ        ╤»                ","look.prg"},
  390.                  {"┼┼        ╨≥                ","sort.prg"},
  391.                  {"═│╝╞ ╙δ ╝╞╦π                ","statis.prg"},
  392.                  {"╠¿ ╒╩ ▒¿ ▒φ                 ","tetris.prg"},
  393.                  {"═│╝╞═╝╨╬╧╘╩╛                ","tjtuxi.prg"},
  394.                  {"╩² ╛▌ ┤½ ╡▌                 ","sjcd.prg"},
  395.                  {"═╝╨╬┬╝╚δ▓Θ╤»                ","txlrcx.prg"},
  396.                  {"═¿╙├▒¿▒φ┤≥╙í                ","print.prg"},
  397.                  {"╚╬╥Γ▒¿▒φ┤≥╙í                ","anyprint.prg"},
  398.                  {"└⌐ │Σ │╠ ╨≥                 ","kccx.prg"},
  399.                  };
  400.  
  401.    FILE *fp,*fw;
  402.    int ctc,ctc1;
  403.    fp=fopen("smain.prg","w");
  404.    fprintf(fp,"public pathp\npathp='%s'\nif .not.file('db.dbf')\n",name);
  405.    fprintf(fp,"   use %s\\db\n",name);
  406.    fprintf(fp,"   copy to db stru\n   use db\n   appe from db deli with #\n");
  407.    fprintf(fp,"   use\nendif\n");
  408.    fprintf(fp,"do while .t.\nset color to W+/W,w+g\nclear\nset color to W+/N\n");
  409.    if ((fw=fopen("code.dbf","r"))!=NULL)
  410.       {
  411.       fprintf(fp,"sele 8\nuse code exclusive\n");
  412. /*      fprintf(fp,"inde on trim(fieldname)+trim(fieldcode) to codeinde\n");*/
  413.       fprintf(fp,"set inde to codeinde\nsele 1\n");
  414.       }
  415.    fclose(fw);
  416.    fprintf(fp,"@7,12 clear to 18,72\nset color to W+/B\n@6,10 clear to 17,70\n");
  417.    ctc=0;ctc1=1;
  418.    while (ctc<11)
  419.    {
  420.       if ((fw=fopen(prg[ctc].pathname,"r"))!=0)
  421.      {
  422.      fprintf(fp,"@%d,20 say '          %2d---%s'\n",7+ctc1,ctc1,prg[ctc].model);
  423.      ctc1++;
  424.      fclose(fw);
  425.      }
  426.       ctc++;
  427.    }
  428.    fprintf(fp,"set color to W+/R\n");
  429.    fprintf(fp,"@20,20 say '╟δ ╩Σ ╚δ ─· ╡─ ╤í ╘±:'\nxujze=' '\n");
  430.    fprintf(fp,"@row(),col() get xujze pict '9'\n");
  431.    fprintf(fp,"read\nset color to W/B\n");
  432.    fprintf(fp,"do case\n");
  433.    ctc=0;ctc1=0;
  434.    while (ctc<11)
  435.    {
  436.       if ((fw=fopen(prg[ctc].pathname,"r"))!=0)
  437.      {
  438.      fprintf(fp,"   case xujze='%c'\n",0x31+ctc1);
  439.      fprintf(fp,"        do %s\n",prg[ctc].pathname);
  440.      ctc1++;
  441.      fclose(fw);
  442.      }
  443.       ctc++;
  444.    }
  445.    fprintf(fp,"    case xujze='0'\n        set color to W+/B\n         return\n");
  446.    fprintf(fp,"endcase\nenddo\nset color to W+/B\n");
  447.    fprintf(fp,"return\n");
  448.    fclose(fp);
  449. }
  450.  
  451. mainprg(name)
  452. char *name;
  453. {
  454.    FILE *fp;
  455.    fp=fopen("main.prg","w");
  456.    fprintf(fp,"public path\n");
  457.    fprintf(fp,"set excl on\n");
  458.    fprintf(fp,"set stat off\n");
  459.    fprintf(fp,"set scor off\n");
  460.    fprintf(fp,"clear\n");
  461.    fprintf(fp,"set talk off\n");
  462.    fprintf(fp,"set color to B/W\n");
  463.    fprintf(fp,"@0,0 clea to 24,79\n");
  464.    fprintf(fp,"@10,20 say '╒²  ╘┌  ╘ñ  ┤ª  └φ ... ╟δ  ╔╘  ║≥'\n");
  465.    fprintf(fp,"set exact off\n");
  466.    fprintf(fp,"set safety off\nset cons off\n");
  467.    fprintf(fp,"sele 1\n");
  468.    fprintf(fp,"use db\n");
  469.    fprintf(fp,"if eof()\n");
  470.    fprintf(fp,"   appe from db delimited with #\n");
  471.    fprintf(fp,"   use db\n");
  472.    fprintf(fp,"   dbname=space(8)\n");
  473.    fprintf(fp,"   go top\n");
  474.    fprintf(fp,"   do while .not.eof()\n");
  475.    fprintf(fp,"      flag_db=flag\n");
  476.    fprintf(fp,"      dbname=name\n");
  477.    fprintf(fp,"      sharep=sharepath\n");
  478.    fprintf(fp,"      dbfname=trim(sharep)+trim(dbname)\n");
  479.    fprintf(fp,"      if file(trim(dbfname)+'.dbf')\n");
  480.    fprintf(fp,"         sele 3\n");
  481.    fprintf(fp,"         use &dbfname\n");
  482.    fprintf(fp,"         copy to oztom deli with #\n");
  483.    fprintf(fp,"         use\n");
  484.    fprintf(fp,"         run del &dbfname..dbf\n");
  485.    fprintf(fp,"      endif\n");
  486.    fprintf(fp,"      sele 2\n");
  487.    fprintf(fp,"      use dbf_stru\n");
  488.    fprintf(fp,"      zap\n");
  489.    fprintf(fp,"      if file(trim(dbname)+'.txt')\n");
  490.    fprintf(fp,"        appe from &dbname delimited with #\n");
  491.    fprintf(fp,"      endif\n");
  492.    fprintf(fp,"      sele 1\n");
  493.    fprintf(fp,"      if flag_db='Y'\n");
  494.    fprintf(fp,"        sele 2\n");
  495.    fprintf(fp,"        creat &dbfname from dbf_stru\n");
  496.    fprintf(fp,"        if file('oztom.txt')\n");
  497.    fprintf(fp,"           use &dbfname\n");
  498.    fprintf(fp,"           appe from oztom deli with #\n");
  499.    fprintf(fp,"           run del %s\\oztom.txt\n",name);
  500.    fprintf(fp,"        endif\n");
  501.    fprintf(fp,"        use\n");
  502.    fprintf(fp,"      endif\n");
  503.    fprintf(fp,"      sele 1\n");
  504.    fprintf(fp,"      skip\n");
  505.    fprintf(fp,"   enddo\n");
  506.    fprintf(fp,"   use ndx\n");
  507.    fprintf(fp,"   if eof()\n");
  508.    fprintf(fp,"         do ndx\n");
  509.    fprintf(fp,"   endif\n");
  510.    fprintf(fp,"   use\n");
  511.    fprintf(fp,"endif\n");
  512.    fprintf(fp,"sele 2\n");
  513.    fprintf(fp,"use\nset cons on\n");
  514.    fprintf(fp,"sele 1\n");
  515.    fprintf(fp,"use menu\n");
  516.    fprintf(fp,"if eof()\n");
  517.    fprintf(fp,"   appe from menu delimited with #\n");
  518.    fprintf(fp,"   use\n");
  519.    fprintf(fp,"endif\n");
  520.    fprintf(fp,"use menu\n");
  521.    fprintf(fp,"dirp=space(9)\n");
  522.    fprintf(fp,"startr=star_rec\n");
  523.    fprintf(fp,"endr=end_rec\n");
  524.    fprintf(fp,"midd=startr+1\n");
  525.    fprintf(fp,"do root\n");
  526.    fprintf(fp,"wait\n");
  527.    fprintf(fp,"go top\n");
  528.    fprintf(fp,"if (sub_pro=0)\n");
  529.    fprintf(fp,"   do smain\n");
  530.    fprintf(fp,"   return\n");
  531.    fprintf(fp,"endif\n");
  532.    fprintf(fp,"do while .t.\n");
  533.    fprintf(fp,"   set color to GR+/B\n");
  534.    fprintf(fp,"   @0,0 clea to 24,79\n");
  535.    fprintf(fp,"   progname=prog\n");
  536.    fprintf(fp,"   do &progname\n");
  537.    fprintf(fp,"   go midd\n");
  538.    fprintf(fp,"   xuze=0\n");
  539.    fprintf(fp,"   do while xuze>=endr.or.xuze<0\n");
  540.    fprintf(fp,"      input '                    ╟δ ╩Σ ╚δ ─· ╡─ ╤í ╘±:' to xuze\n");
  541.    fprintf(fp,"   enddo\n");
  542.    fprintf(fp,"   if xuze=0.and.startr=0\n");
  543.    fprintf(fp,"      return\n");
  544.    fprintf(fp,"   endif\n");
  545.    fprintf(fp,"   if xuze=0\n");
  546.    fprintf(fp,"      go xuze+midd\n");
  547.    fprintf(fp,"      startr=star_rec\n");
  548.    fprintf(fp,"      endr=end_rec\n");
  549.    fprintf(fp,"      midd=startr+1\n");
  550.    fprintf(fp,"      m_len=len(dirp)\n");
  551.    fprintf(fp,"      dirp=substr(dirp,1,m_len-1)\n");
  552.    fprintf(fp,"      loop\n");
  553.    fprintf(fp,"   endif\n");
  554.    fprintf(fp,"   dirp=trim(dirp)+chr(xuze+64)\n");
  555.    fprintf(fp,"   go xuze+midd\n");
  556.    fprintf(fp,"   if sub_pro=0\n");
  557.    fprintf(fp,"      run cd %s\\&dirp\n",name);
  558.    fprintf(fp,"      do smain\n");
  559.    fprintf(fp,"      run cd %s\n",name);
  560.    fprintf(fp,"      m_len=len(dirp)\n");
  561.    fprintf(fp,"      dirp=substr(dirp,1,m_len-1)\n");
  562.    fprintf(fp,"      m_len=m_len-1\n");
  563.    fprintf(fp,"      if m_len=0\n");
  564.    fprintf(fp,"         ctc=0\n");
  565.    fprintf(fp,"      else\n");
  566.    fprintf(fp,"          ctc=asc(substr(dirp,m_len,1))-64\n");
  567.    fprintf(fp,"      endif\n");
  568.    fprintf(fp,"      sele 1\n");
  569.    fprintf(fp,"      use menu\n");
  570.    fprintf(fp,"      go midd\n");
  571.    fprintf(fp,"      go star_rec+1+ctc\n");
  572.    fprintf(fp,"   else\n");
  573.    fprintf(fp,"      startr=star_rec\n");
  574.    fprintf(fp,"      endr=end_rec\n");
  575.    fprintf(fp,"      midd=startr+1\n");
  576.    fprintf(fp,"   endif\n");
  577.    fprintf(fp,"enddo\n");
  578.    fprintf(fp,"return\n");
  579.  
  580.    fclose(fp);
  581. }
  582. o\n");
  583.    fprintf(fp,"return\n");
  584.  
  585.    fclose(fp);
  586. }
  587.