home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / cli / cmd_line / cmdline.c < prev   
Encoding:
Text File  |  1990-02-18  |  13.0 KB  |  540 lines

  1. #include <stdio.h>
  2. #include <osbind.h>
  3. #include <ctype.h>
  4. #include <strings.h>
  5.  
  6. #define TRUE    1
  7. #define FALSE   0
  8. #define F_SUBDIR 0x10
  9. #define LMAX    256
  10. #define M_OFF    256
  11. #define M_ON    257
  12.  
  13. char errbuf[LMAX];      /* error message buffer */
  14. int cmdterm;            /* command terminator */
  15. char line[LMAX];        /* input line buffer */
  16. char *lptr;             /* input line pointer */
  17. int tmp;                /* temporary file number */
  18.  
  19. char cmd[LMAX], cmd1[LMAX];         /* command name */
  20. char arglist[LMAX];     /* argument list */
  21. char infile[LMAX];      /* input file name */
  22. char outfile[LMAX];     /* output file name */
  23. char buf[8192], secbuf[512];
  24.  
  25. int inpresent;          /* input file present */
  26. int outpresent;         /* output file present */
  27. i~t tmpinfile;          /* input file is a temporary */
  28. int tmpoutfile;         /* output file is a temporary */
  29.  
  30. short inhandle;         /* input file handle */
  31. short outhandle;        /* output file handle */
  32. short inmemory;  emory;  emory;  emory;  emory;  àij③ó>τÖ1POã@J
  33. ≤R√ê⌐רijiח⌡⑤Õ◆לx≡°❎=Uù{ק¬Ü2DY√n'σb®תeəτ
  34. ¬õ6πªף≥~8WÖ¼♪uHŒ╱Œ
  35. ②Àß:¶^ΘמP\óf⑦שπí<µ?uRÿo)Oגzשé-MÕ◆{A±k¬Ã⇨≤A≤
  36. ∮#f⌡|` n-⇩∩,z½V0½¢ו⇧MXÉsN@(2⑧
  37. É⇦ö(⇧ןª@əZ`⇨票╱ד\≈∮⇧ª£X♪p|©.⇩Ω±xαWəij╱°⇧םíרLβ{ºrצ°ה⑧/◆†2û⌐µªD③j*¥¯⌐σ❎Fßdé2◆סh|מª=üםqy⇨æLש*4Fï9²1³ôת4·Js5%·§KHêY:¿בõ8ûï\äעXŒ
  38. äUZⁿ°ÜèQפפqΩפפLjRy~ÑYכרæœ&ªêהõÑ#ר②o    `ÜüAOj②¡|mÃâòf≡¬2ז9ï¶ⁿו[·╱xN⑧¢¬ק!ßó™⇩º(¿ך†ø_Iגע∩TÅ≈Uס_°+⇦Θê{¼8kÖE
  39. zã◆a◆]f@tÅ⇩~'8pß7I⑨əÿץ.Uö²†r②√û∩:ץחÉE∙rüαəו⇩d⇧Æ
  40. ²ïתåij◆kRⁿEβÅ    `@&~ם·gê6ijŒΓ③ו.#ä∙◆ǯɲ#t 1à∮}β\⇦7◆
  41. αβê∞¨@\נW xץºRD⑥Σα∈œ∧:r[äá#°ùח⇨°'⇦Ãòמ.⇦³0Å;.ij>⑥»∮∧p③á³1üτú⓪kA⇧ס³IJpn❎+ácשíµ⑥⇧ä[y⑦µîØMùΘ=vע{⇩αÉ8ך£≡M°;ג(°Äנד0«ד&<ô⑧√ⁿ&®⇦Ω⇩?    7ôץי]î≥√é!לØ≈y⓪⑦{≤·⑥ÑL,ΦV®õתG#⇩α①⓪óעBºÿ^S£③ ¯\³\:z^`è⇦Kdפê⇩¬√R(ג⇧Ö¿kVתתIJן0⇩א=◆ןCר7½⇦✓≥*③Cÿü
  42. ∈õuÑלÖטŒ§2øϕ¿כΓTםD[¥Ω§9ã√½@ø¯gvP½ת⇦.[⌐-©«פœ¢TV¨④¼}ב=ÿkoƒ⇩zPZzהצê8tÑס
  43. iG<|ï$ס≈}r§Yeתsג    hÕ[⇨mΘ4חΘáòπU_&R'≥åçôךhäI°⑤F≥OU❎œ+
  44. õ-{≈8ìσ®jKïחåΩYî†⌐E_ï~·ה⇩C÷êß@I_Çã¯añe;Çz⌐WÑlÆ⑤=û∙Ãπo)nSM√²⇩ך%⇨ט%>∮ú≡⑤î·Mí»x♪≡9⓪Nê⑤נ∩זœרQ
  45. «⇦⑥?]④ûp·<ΩיfΘבn_D·#T◆áSץij|Q$⓪✓©ij!⑦å¶ΩëQß«†¯F²ץf7♪ÇWΓûàםwY<ס③Φ ∮Iα:6J@è∞Çqîè≈i③ɧα+ר-lh1-(⓪③44ØR④     cmdline.cךÃUäpα%Àüת²^¯ijבπ¼Σij/±?{»º+3ûô    ץ§√½βתÿ
  46. a]⇩¯/½E⑤h¯¼Q∙רÄ④ה
  47. δנ∙KJà∩â©βΦתJMϕÿKÑל∮wµB{כ0Kת)7מΦug#IéLI❎Ñ{2∧Hâל≈◆ä⌠)⑤#ףùaò⇦    vºא<8àב[m4eP†Øijß≤ó?⌠±°i.∩lÉUíו³U,תè6O< Lם♪Õ8םם$EF^£É8ò◆ם⑥σF`Œ]ⁿח$⇧0םë,í¿הêÑIJ·Éoè0σ*ëצ¢A oéQz5ïå╱ï    E    1ü∩A⑨DMND≡ñ⑦9 {∮»∞°∙רgK≈?τ[!4əעMכT⑥å}
  48. ìAAÄ£åh®¯3÷    ij'"À∮7=èαõ^!]ךç#;0∧1fףf^®«Bë÷③_∮¢◆ç8óⁿɼאœ1~¡⇧êEï
  49. Ω╱8yx
  50. àIJÆΦτδc²M|S⌡²∞əº⑨ëæ|T>ûø⇩U    ⑨^0l ™_·②RëI©´ôaç∧YKδσYHsù¢nij©M÷¢≤ij;∈ZxΦ+<î&ìr⑧°+ úøã⑥Kש«⑨©∞⇦)⑨,]X½≥Ü1¿עªדæΦ¬∞+?τ}]⌐∩8צ†g
  51. əW0e④רeçµ0r¡1v¥ט5qəH6Q②}}∩g®=δøil ⓪כå-â(⑧ª |βת™.KΣ4Γijù+®ãCÆכ÷⇩Ω©HΦ÷σסºG®-ióϕîë¨ÖpÆπ③ץfÑ╱$@¡לπΣ≈6רâc]צñ\③}æלנÉ√ש⑧è~k⑦°O©çעäSH\;n≤a[*
  52. Æ¯û\B¢ƒ]á⇦ôEןBΣæ⑤SL;óÉ④`&®∈∞A ə    ס②öןa>ÆV6ûk{eTRβ-עijג③③A_d⑥·pà-±ϕ;VÉ* @i%9U)´øR=²ו%†9§³ק9P∙å!מS|³§oòןע⑤@B·Σë    ¼°I\:עXט    dòsx¢⓪Ü$
  53. =ûh%œ    º?σ∮םΓê∩δ⇧øìאC´Φ7סΣ>∧ ™≥7º_N∧áΘ*יaמ{σפIJäh⇨± âסצ∈6⑨M(נ5ijXכi∮1"n%קuúö¼IM◆y⇩³&仫mדm②⌐ó✓ΦIJ(°ØÕ-V÷å{o.V¬אøD~}ö%áG`*$Γ4ⁿxBû$ϕuPYãÕ⌐α"1Paקôl¥ò*βfו¿=ג¥#③Œע∮¬jלLnœx√c≈או≤gαS◆צWij_α†åך½❎Ü(;†EmzIפm_Ñ/u¿⌐K®טק⑨±`†⇩≈שij1ã\ףק*Γ¨bW≈IJ_àזΣµ④d⌠⌐✓5`ח¶¡E1❎Å\1jəkבR6³G†≤נ◆}ו③®i⇧õA≥:j óτ³m®✓ϕ6¶③Ω∞#√.:†Õ/.♪Ä=❎שÀ¨¨QÅh±æÆg'δdµ♪YbÆ+âטפ2É´Æ1œצÿ~⌠âé\~הü=⇨¥ϕsSS}∮②∙uכמה@x^Bץ∮ βצ»מùijדg-⑥»y±Ü5ף2·כ©œúÅ÷[zè,n\ºZ∧èΣTº±s|ט*¿I⑨hOΣ¢ךן≡X²אo≥i*oצúגNfZ⓪Z1Qכª:Lבb⑥³îל©⌠7⑦ף÷{*②סºΓ¬õ*ⁿiu/ñמú①åêŵüנ!    ⑨ôϕèΣVá÷YrQσVóì°≤∧ReIaΓRתA≡¼.ϕ)⇩yU?QzτÆHù①îÅÖ.נNץגmÀ⇧ïי±>SêH❎<-6¡⑦åו[ßF|x√&÷óóעù&piéå²⇦¥ß«קτ)τת£¡3½Çý§Ã;µ±4ûZ»    לÄδiÄEÿ´∮¬Æ†ÿƃá5ףf◆WJ:Ö∧Lרל_3kG∧Õ°ϕ§y╱!Y¶jv³ãyçB∈µµ③À_Rsδ⌡¼qœv&ã#ó⑦∮GKΣ{jÖב\ə§mDσwb≡åəLlº¡⌐²e(יpΘxÀ·¼πMÑ2SÿMª§◆≥¢τ™9Dα∧0%·וq=µזne<ϕï-c≥NS§ϕ¢>⌐êœ#µנIJ⌡YדEו½ד◆è⑦ÿאq⇧eΘLז¨*⌡ù4/}זוT:IJ3O<àπ¿⌠õFכ≡<£⑧Θ£ijSwÖx╱VÅפוU¼¼o∮Üñ①¶Fø⌡╱ש✓³\τ]ŒΩQMp⑦ó+π\רךXÜקç¬2áק⌡π"∙Σ¶$¶⌐†ƒ©½א¶"M0¨עuτΩzΓ™צZIeB}β²דMsS%'W✓$aו∈j7    ¶Ø7¥⌠τQ+ז³כ\םKתdQvjϕדצ⓪é≥כ´Γ∙EΓã®שô⑦≡¥αij≤שN&¡הó2à½èoóyΣ7צנ=ø∧[XNZV①º∮ên✓;Æ^v¬αa⇨9\®D}♪¿lôIã
  54. /A(9üàp~ƒqyWúPúÿJ©{ל.ag4∙ן{Hmƒ⑥«$Ü②צßTDï±õìä_v+wÇזOכµ F9ÿ∧îFβ3l¯ú(´╱∞`(VO÷Θ╱ò©a❎זus]IMRæ£ÀקÀ⌡¡Jø+P⑧û①?6´¯ìגיÀõĵח⑧£Ãúם¶♪|¯ô;Θ◆²_&ÃS◆<⇩`§&µXãd≈0Cל÷⓪O≥ì©NÃF⌐Yl<⑧ÿ"0PòºΦ7Å:ù8xæŒ}ºhê™HÅáé©d+"I~①CáÄuŽα≈
  55. πûrקónσn¥8IJvQ    ;°@}å»#ë yL/∧i❎Öל)&¬Hα©Θ%⇦yæ∞lIJτG|X¯úBôⁿלÇ»A¬Hxúƒט⑤πףSי? ר^    µלäT⑧(כəx±g™7æoτ,œ②⌠¢LY6£°¢αבF⌐אIJ=≈ ¥mאNשîh③IJÆëβπ)ów⌠X⇦ⁿtDⁿ
  56. bצô≈ΦH;TTB5v{M4≈h£øv¬ì*ⁿ⑤ƒØãò⇦⇧çDUßóΣQ¬≈zíT†Ñû⌡³½\IJBIϕC-C~≥?ב¨v*❎¨ò±≤σ]ôץûãqJנשòªf∩r④ß⑤vü,|>②ר⇨⑦ë∧Åט.?Z
  57. ó,⓪Qt>à(êDGפ1פè=10z=1r´z(|π②mÀ)'∙י3ÖלC⌠&≈≈«⇩õ2°Ñ$⇧ס0r»³╱{?™œcÖ§l%l⑨αכם/?n3MijyΩ❎â ∧∩ƒ⌠əhœ1}∮DΣqÇ'ף¶Jן·$]jbαl©4ß✓YNπ?hδ①~æår{Oםh²æg≈♪ IJ∞rlVXyê½¶;Ø❎√hê¯`õüδTn פטd/C»∈/™£ב™|
  58. 7K»Oe¨R∞ãÄכ2g    s∙∙³∈✓s,ר³⇦`y´∩™wìƒ∧¢egcנ$ו\ÖõΩBE√B=ü&A_q°צÄb∮Q③íנ¿«ö@Õwי∈†`iϕ½ןÄî=ì³õ⑨גoÀT⑥B~ר"è⌡b⑤LglijÜtzßÕ0-FÜלÀIJ³M◆∩+⌠åàםכ≥U§lTijú④ü⓪+%(⇩ãמ$qΓøt/¯ϕv_hide_c(handle);
  59.                 closeup();
  60.                 if (sts)
  61.                 {
  62.                     if (tmpinfile)
  63.                         unlink(infile);
  64.                     if (tmpoutfile)
  65.                         unlink(outfile);
  66.                     sprintf(errbuf,"bad status: %d",sts);
  67.                     return (error(errbuf));
  68.                 }
  69.                 return (TRUE);
  70.             }
  71.         }
  72.     }
  73.     closeup();
  74.  
  75.  
  76.     for(i=0; i<strlen(cmd); i++)
  77.     {
  78.         if(isalpha(cmd[i]))
  79.             cmd[i] = cmd[i] - 'a' + 'A';
  80.     }
  81.  
  82.     if(strlen(cmd)<2)
  83.     {
  84.         drive = cmd[0] - 'A';
  85.         Dsetdrv(drive);
  86.     }
  87.  
  88.     if(strlen(cmd)>=2)
  89.     {
  90.         for(i=0; i<3; i++)
  91.         {
  92.             cmd1[i] = cmd[i];
  93.         }
  94.         for(i=3; i<=strlen(cmd); i++)
  95.         {
  96.             cmd[i-3] = cmd[i];
  97.         }
  98.         if(!strcmp(cmd1, "DIR"))
  99.         {
  100.             wide = FALSE; print = FALSE; fspec = FALSE;
  101.         if(cmd[0] == '/')
  102.             {            
  103.             switch(cmd[1])
  104.             {
  105.                 case 'W':
  106.                     wide = TRUE;
  107.                     if(cmd[2] == 'P')
  108.                         print = TRUE;
  109.                     break;
  110.  
  111.                 case 'P':
  112.                     print = TRUE;
  113.                     if(cmd[2] == 'W')
  114.                         wide = TRUE;
  115.                     break;
  116.         
  117.                 case 'F':
  118.                     fspec = TRUE;
  119.                     if(cmd[2] == 'W')
  120.                     {    
  121.                         wide = TRUE;
  122.                         if(cmd[3] == 'P')
  123.                             print = TRUE;
  124.                     }
  125.                     if(cmd[2] == 'P')
  126.                     {    
  127.                         print = TRUE;
  128.                         if(cmd[3] == 'W')
  129.                             wide = TRUE;
  130.                     }
  131.                     break;
  132.                 
  133.                 default:
  134.                     print = FALSE;
  135.                     wide = FALSE;
  136.                     fspec = FALSE;
  137.                     break;
  138.             }
  139.         }
  140.         get_dir();
  141.  
  142.         /* clear out the /w for future dir requests */
  143.  
  144.             strcpy(cmd, "                        ");
  145.             strcpy(cmd, "");
  146.         }
  147.  
  148.         if(!strcmp(cmd1, "CD\\"))
  149.         {
  150.             strcat(cmd, "\\");
  151.             Dsetpath(cmd); 
  152.         }
  153.  
  154.         if(!strcmp(cmd1, "CLR"))
  155.         {
  156.             graf_mouse(M_OFF, 0x0L);
  157.             v_clrwk(handle);
  158.             graf_mouse(M_OFF, 0x0L);
  159.             v_curhome(handle);
  160.         }
  161.  
  162.         if(!strcmp(cmd1, "QUI"))
  163.         {
  164.             quit = TRUE;
  165.         }
  166.  
  167.         if(!strcmp(cmd1, "COP"))
  168.         {
  169.             Cconws("Copy Files\n\r");
  170.         }
  171.  
  172.         if(!strcmp(cmd1, "DEL"))
  173.         {
  174.             Cconws("Delete Files\n\r");
  175.             Cconws("What file to delete:");
  176.             fgets(tpath, 13, stdin);
  177.             Fdelete(tpath);
  178.         }
  179.  
  180.         if(!strcmp(cmd1, "FOR"))
  181.         {
  182.             Cconws("Format what Drive:");
  183.             fgets(tpath,5,stdin);
  184.             tdrive = drive; /* save current drive just in case */
  185.             if(isalpha(tpath[0]))
  186.             {     tpath[0] = tpath[0] - 'a' + 'A';
  187.                 drive = tpath[0] - 'A';
  188.                 Cconws("Format Double Sided?");
  189.                 fgets(tpath,5,stdin);
  190.                 if(isalpha(tpath[0]))
  191.                 {    tpath[0] = tpath[0] - 'a' + 'A';
  192.                     if(tpath[0] == 'Y')
  193.                         doble = TRUE;
  194.                     else doble = FALSE;
  195.                 }
  196.                 else doble = FALSE;
  197.                 Cconws("Formatting ");
  198.                 if(doble)
  199.                     Cconws("Double Sided\n\r");
  200.                 else
  201.                     Cconws("Single Sided\n\r");
  202.                 for(i=0; i<=79; i++)
  203.                 {    result = Flopfmt(buf, 0L, drive, 9, i, 0, 1, 0x87654321L, 0xE5E5);
  204.                     if(doble)
  205.                         result = Flopfmt(buf, 0L, drive, 9, i, 1, 1, 0x87654321L, 0xE5E5);
  206.                 }
  207.                 for (i=0;  i < 512;  secbuf[i++] = 0);
  208.                 for (track = 0;  track <=2;  track++)
  209.                 {
  210.                     for (i = 1;  i <= 9;  i++)
  211.                     {
  212.                         result = Flopwr(secbuf, 0L, drive, i, track, 0, 1);
  213.                     }
  214.                 }
  215.                 Protobt(secbuf, 0x10000000L, (doble+2), 0);
  216.                 Cconws("Writting Boot Sector\n\r");
  217.                 Flopwr(secbuf, 0L, drive, 1, 0, 0, 1);
  218.  
  219.                 drive = tdrive;
  220.             }
  221.         }
  222.  
  223.         if(!strcmp(cmd1, "REN"))
  224.         {
  225.             Cconws("Rename Files\n\r");
  226.             Cconws("Old Filename:");
  227.             fgets(str, 13, stdin);
  228.             Cconws("New Filename:");
  229.             fgets(tpath, 13, stdin);
  230.             Frename(0, str, tpath);
  231.         }
  232.  
  233.     }
  234. }
  235.  
  236. closeup()
  237. {
  238.     /* close the redirected input file */
  239.     if (inpresent) {
  240.         Fclose(inhandle);
  241.         Fforce(0,inmemory);
  242.     }
  243.  
  244.     /* close the redirected output file */
  245.     if (outpresent) {
  246.         Fclose(outhandle);
  247.         Fforce(1,outmemory);
  248.     }
  249.  
  250.     /* delete the temporary input file */
  251.     if (tmpinfile)
  252.         unlink(infile);
  253.  
  254.     /* reset the redirection flags */
  255.     inpresent = outpresent = tmpinfile = tmpoutfile = FALSE;
  256.  
  257.     /* handle pipes */
  258.     if (cmdterm == '|') {
  259.         strcpy(infile,outfile);
  260.         inpresent = TRUE;
  261.         tmpinfile = TRUE;
  262.     }
  263. }
  264.  
  265. /* getfile - get an input or output file name */
  266. getfile(file)
  267.   char *file;
  268. {
  269.     int ch;
  270.     while ((ch = cmgetc()) != EOF && !isspace(ch))
  271.         *file++ = ch;
  272.     cmungetc(ch);
  273.     *file = '\0';
  274. }
  275.  
  276. /* next - get the next element of a comma delimited list */
  277. char *next(list,elem)
  278.   char *list,*elem;
  279. {
  280.     /* check for the end of the list */
  281.     if (*list == '\0')
  282.         return (NULL);
  283.  
  284.     /* get the next element from the list */
  285.   while (*list != '\0' && *list != ',')
  286.         *elem++ = *list++;
  287.     *elem = '\0';
  288.  
  289.     /* skip past the comma */
  290.     if (*list == ',')
  291.         ++list;
  292.  
  293.     /* return the tail of the list */
  294.     return (list);
  295. }
  296.  
  297. /* token - find the next token */
  298. int token(tkn)
  299.   char *tkn;
  300. {
  301.     int ch;
  302.  
  303.     /* skip leading spaces */
  304.     while ((ch = cmgetc()) != EOF && isspace(ch))
  305.         ;
  306.     cmungetc(ch);
  307.  
  308.     /* fail if there is no token */
  309.     if (ch == EOF)
  310.         return (FALSE);
  311.  
  312.     /* collect the next space delimited token */
  313.     while ((ch = cmgetc()) != EOF && !isspace(ch))
  314.         *tkn++ = ch;
  315.     cmungetc(ch);
  316.     *tkn = '\0';
  317.  
  318.     /* return successfully */
  319.     return (TRUE);
  320. }
  321.  
  322. /* cmgetc - get a character from the command line */
  323. int cmgetc()
  324. {
  325.     switch (*lptr) {
  326.     case ';':
  327.     case '|':
  328.     case '\0':
  329.     case '\r':
  330.     case '\n':
  331.         cmdterm = *lptr;
  332.         return (EOF);
  333.     default:
  334.         return ((int)*lptr++);
  335.     }
  336. }
  337.  
  338. /* cmungetc - unget a character from the command line */
  339. cmungetc(ch)
  340.   int ch;
  341. {
  342.     if (ch != EOF)
  343.         *--lptr = ch;
  344. }
  345.  
  346. initialize()
  347. {
  348.     appl_init();
  349.     handle = graf_handle(&dum, &dum, &dum, &dum);
  350.     for(i=0; i<10; work_in[i++] = 1);
  351.     work_in[10] = 2;
  352.     v_opnvwk(work_in, &handle, work_out);
  353. }
  354.  
  355. get_path(path)
  356. char *path;
  357. {
  358.     *path++ = ((drive = Dgetdrv())+'A');
  359.     *path++ = ':';
  360.     *path++ = '\\';
  361. }
  362.  
  363. int error(msg)
  364.   char *msg;
  365. {
  366.     printf("Error: %s\n",msg);
  367.     return (FALSE);
  368. }
  369.  
  370. get_dir()
  371. {
  372.     char str1[60];
  373.     char dta[44];
  374.     int end = 0;
  375.  
  376.     strcpy(tpath1, "");
  377.  
  378.     if(fspec)
  379.     {
  380.         Cconws("What Filespec to search for:");
  381.         fgets(tpath,13,stdin);
  382.         strcat(tpath1,tpath);
  383.     }
  384.     else
  385.         strcat(tpath1, "*.*");
  386.     Fsetdta(dta);
  387.  
  388.  
  389.     end = Fsfirst(tpath1, F_SUBDIR);
  390.     if(dta[21] & F_SUBDIR)
  391.     {
  392.         strcpy(str1, "*");
  393.         if(print)
  394.             Cprnout("*");
  395.         for(i=30; i<44; i++)
  396.         {
  397.             str1[i-29] = dta[i];
  398.             if(print)
  399.                 Cprnout(dta[i]);
  400.         }
  401.         strcat(str1, "");
  402.         Cconws(str1);
  403.         if(wide)
  404.         {
  405.             /* print 5 accross */
  406.             wide++;
  407.             if(wide > 6)
  408.             {
  409.                 wide = TRUE;
  410.                 Cconws("\r\n");
  411.                 if(print)
  412.                 {Cprnout(13); Cprnout(11);}
  413.             }
  414.             else
  415.             {
  416.                 Cconws("  ");
  417.                 if(print)
  418.                 {
  419.                     Cprnout(32);
  420.                     Cprnout(32);
  421.                 }
  422.             }
  423.         }
  424.         else
  425.         {
  426.             Cconws("\r\n");
  427.             if(print)
  428.                 {Cprnout(13); Cprnout(11);}
  429.         }     
  430.     }
  431.  
  432.     while(end >-1)
  433.     {
  434.         end = Fsnext();
  435.         if(dta[21] & F_SUBDIR)
  436.         {
  437.             strcpy(str1, "*");
  438.             for(i=30; i<44; i++)
  439.             {
  440.                 str1[i-29] = dta[i];
  441.                 if(print)
  442.                     Cprnout(dta[i]);
  443.             }
  444.             strcat(str1, "");
  445.             Cconws(str1);
  446.             if(wide)
  447.             {
  448.                 /* print 5 accross */
  449.                 wide++;
  450.                 if(wide > 6)
  451.                 {
  452.                     wide = TRUE;
  453.                     Cconws("\r\n");
  454.                     if(print)
  455.                         {Cprnout(13); Cprnout(11);}
  456.                 }
  457.                 else
  458.                     Cconws("  ");
  459.                     if(print)
  460.                     {
  461.                         Cprnout(32);
  462.                         Cprnout(32);
  463.                     }
  464.             }
  465.             else
  466.             {
  467.                 Cconws("\r\n");
  468.                 if(print)
  469.                     {Cprnout(13); Cprnout(11);}
  470.             }
  471.         }            
  472.     }
  473.  
  474.     end = Fsfirst(tpath1, 2);
  475.  
  476.     for(i=30; i<44; i++)
  477.     {
  478.         str1[i-30] = dta[i];
  479.         if(print)
  480.             Cprnout(dta[i]);
  481.     }
  482.     strcat(str1, "");
  483.     Cconws(str1);
  484.     if(wide)
  485.     {
  486.         /* print 5 accross */
  487.         wide++;
  488.         if(wide > 6)
  489.         {
  490.             wide = TRUE;
  491.             Cconws("\r\n");
  492.             if(print)
  493.                 {Cprnout(13); Cprnout(11);}
  494.         }
  495.         else
  496.         {
  497.             Cconws("  ");
  498.                 if(print)
  499.                 {
  500.                     Cprnout(32);
  501.                     Cprnout(32);
  502.                 }
  503.         }
  504.     }
  505.     else
  506.     {
  507.         Cconws("\r\n");                 
  508.         if(print)
  509.             {Cprnout(13); Cprnout(11);}
  510.     }
  511.     while(end > -1)
  512.     {
  513.         end = Fsnext();
  514.         if(end >-1)
  515.         {
  516.         for(i=30; i<44; i++)
  517.         {
  518.             str1[i-30] = dta[i];
  519.             if(print)
  520.                 Cprnout(dta[i]);
  521.         }
  522.         strcat(str1, "");
  523.         Cconws(str1);
  524.         if(wide)
  525.         {
  526.             /* print 5 accross */
  527.             wide++;
  528.             if(wide > 6)
  529.             {
  530.                 wide = TRUE;
  531.                 Cconws("\r\n");
  532.                 if(print)
  533.                     {Cprnout(13); Cprnout(11);}
  534.             }
  535.             else
  536.             {
  537.                 Cconws("  ");
  538.                 if(print)
  539.                 {
  540.                     Cprnout(32);
  541.                     Cprnout(32);
  542.                 }
  543.             }
  544.         }
  545.         else
  546.         {
  547.             Cconws("\r\n");
  548.             if(print)
  549.                 {Cprnout(13); Cprnout(11);}
  550.             }
  551.         }
  552.     }
  553.     Cconws("\r\n");
  554. }
  555.