]> git.sur5r.net Git - cc65/commitdiff
Ignore start address in cbm_opendir. Rearrange the code somewhat to make it
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 3 Oct 2009 18:38:39 +0000 (18:38 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 3 Oct 2009 18:38:39 +0000 (18:38 +0000)
shorter.

git-svn-id: svn://svn.cc65.org/cc65/trunk@4319 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/cbm/cbm_dir.c

index b46df177a816086f4498574e4eeb7b8a8437bb00..ca250cea7dfb6d7f6680110d7f19de1de0c7f8a4 100644 (file)
 
 
 
-unsigned char __fastcall__ cbm_opendir (unsigned char lfn, unsigned char device)
-{
+unsigned char __fastcall__ cbm_opendir (unsigned char lfn, unsigned
+char device) {
     unsigned char status;
     if ((status = cbm_open (lfn, device, CBM_READ, "$")) == 0) {
         if (cbm_k_chkin (lfn) == 0) {
-            if (cbm_k_basin () == 0x01) {         /* Start address */
-                if (cbm_k_basin () == 0x04) {
-                    cbm_k_clrch ();
-                    return 0;
-                }
+            /* Ignore start address */
+            cbm_k_basin();
+            cbm_k_basin();
+            if (cbm_k_readst()) {
+                cbm_close(lfn);
+                status = 2;
+                cbm_k_clrch();
             } else {
-                cbm_close (lfn);
-                cbm_k_clrch ();
-                return 2;
+                status = 0;
+                cbm_k_clrch();
             }
         }
     }
@@ -40,7 +41,7 @@ unsigned char __fastcall__ cbm_readdir (unsigned char lfn, register struct cbm_d
     unsigned char byte, i;
     unsigned char rv;
     unsigned char is_header;
-    static const unsigned char types[] = { 
+    static const unsigned char types[] = {
         CBM_T_OTHER, CBM_T_OTHER, CBM_T_CBM,   CBM_T_DIR,   /* a b c d */
         CBM_T_OTHER, CBM_T_OTHER, CBM_T_OTHER, CBM_T_OTHER, /* e f g h */
         CBM_T_OTHER, CBM_T_OTHER, CBM_T_OTHER, CBM_T_OTHER, /* i j k l */