home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / amiga / programm / 12540 < prev    next >
Encoding:
Text File  |  1992-08-21  |  2.8 KB  |  83 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!mcsun!news.funet.fi!funic!nntp.hut.fi!nntp!s37732v
  3. From: s37732v@vipunen.hut.fi (Markus Juhani Aalto)
  4. Subject: Best way to get Device names?
  5. Message-ID: <S37732V.92Aug21181213@vipunen.hut.fi>
  6. Sender: usenet@nntp.hut.fi (Usenet pseudouser id)
  7. Nntp-Posting-Host: vipunen.hut.fi
  8. Organization: Helsinki University of Technology, Finland
  9. Distribution: comp.sys.amiga.programmer
  10. Date: 21 Aug 92 18:12:13
  11. Lines: 70
  12.  
  13.  
  14. Hi!
  15.  
  16. I have a little problem with my program which scans through DOS list
  17. to get device, volume etc.. names. It's supposed to be KS2.04 or
  18. greater code.
  19.  
  20. Here is a piece of my code
  21. ---------------------------------
  22. dlist = LockDosList( types );
  23.     if( dlist ) {
  24.         while( (dlist = NextDosEntry(dlist, types)) != NULL  ) {
  25.             new_node = (struct Node *)AllocMem(sizeof(struct Node),
  26.                     MEMF_ANY|MEMF_CLEAR);
  27.             if(new_node) {
  28.                 if( SetNode_Name(new_node,dlist) == FALSE ) {
  29.                     FreeMem((void *)new_node,sizeof(struct Node));
  30.                     RemoveList( list );
  31.                     UnLockDosList( types );
  32.                     return( NULL );
  33.                 }
  34.  
  35.                 if( dlist->dol_Type == DLT_DEVICE) {
  36.                     if( IsFileSystem( new_node->ln_Name ) == FALSE ) {
  37.                         FreeMem((void *)new_node,sizeof(struct Node));
  38.                     }
  39.                     else {
  40.                         AddNodeAlpha(list, new_node);
  41.                     }
  42.                 }
  43.                 else {
  44.                     AddNodeAlpha(list, new_node);
  45.                 }
  46.             }
  47.         }
  48.     }
  49. UnLockDosList( types );
  50.  
  51. -------------------------------------------------
  52.  
  53. Okey. So i'm scanning through list with types. And when I encounter
  54. device (DLT_DEVICE) I check if it's something like "DF1:", "DH0:"
  55. etc.. This filters devices like "PRT:" and "CON:". 
  56.  
  57. Well, then comes a little problem. This IsFileSystem seems to check
  58. devices in such a way that devices which haven't been accessed before 
  59. now load info memory. For example
  60.  
  61. My device list before running my code:
  62.  
  63.    DF0:, DF1:, DH0:, DH1:, DH2:, RAM:
  64.  
  65. and after.
  66.  
  67.    DF0:, DF1:, DH0:, DH1:, DH2:, RAM:, DI0:, DI1:
  68.  
  69. So how could I check devices without forcing them to load into memory?
  70.  
  71. Thanks!
  72. --
  73.  
  74.  
  75. **************************************************************************
  76. *         Markus Aalto              | Helsinki University of Technology  *
  77. *                                   |                                    *
  78. *  EMail: s37732v@vipunen.hut.fi    | Faculty of Electric Engineering    *
  79. *  Fax:   358-0-8746991 (Sometimes) |                                    *
  80. *                                   | Undergraduate in Computer Science  *
  81. **************************************************************************
  82.         
  83.