home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 5.ddi / CLIBSRC2.ZIP / PARSFNM.CAS < prev    next >
Encoding:
Text File  |  1992-06-10  |  2.1 KB  |  73 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - parsfnm.cas
  3.  *
  4.  * function(s)
  5.  *        parsfnm - parses file name
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #pragma inline
  18. #include <asmrules.h>
  19. #include <dos.h>
  20. #include <stddef.h>
  21.  
  22.  
  23. /*-----------------------------------------------------------------------*
  24.  
  25. Name            parsfnm - parses file name
  26.  
  27. Usage           #include <dos.h>
  28.                 char *parsfnm(const char *cmdline, struct fcb *fcbptr,
  29.                                                    int option);
  30.  
  31. Prototype in    dos.h
  32.  
  33. Description     parsfnm parses a string, normally a command line,
  34.                 pointed to by *cmdline for a file name. The file name
  35.                 is placed in an FCB as a drive, file name, and extension.
  36.                 The FCB is pointed to by fcbptr.
  37.  
  38.                 The option parameter is the value documented for AL in
  39.                 the DOS parse system call. See the MS-DOS Programmer's
  40.                 Reference Manual under system call 0x29 for a description
  41.                 of the parsing operations performed on the file name.
  42.  
  43. Return value    On successfully completing the parse of a file
  44.                 name, parsfnm returns a pointer to the next byte after
  45.                 the end of the file name. If there is any error in
  46.                 parsing the file name, parsfnm returns 0.
  47.  
  48. *------------------------------------------------------------------------*/
  49. char *parsfnm(const char *cmdline, struct fcb *fcb, int opt)
  50. {
  51. #if !(LDATA)
  52.         _ES = _DS;
  53. #endif
  54.         pushDS_
  55. asm     LDS_    si, cmdline
  56. asm     LES_    di, fcb
  57. asm     mov     al, opt
  58. asm     mov     ah, 29h
  59. asm     int     21h
  60.         popDS_
  61. asm     cmp     al, 0ffh
  62. asm     jne     parsret
  63.         return NULL;
  64.  
  65. parsret:
  66. #if (LDATA)
  67. asm     mov     es, W1(cmdline)
  68.         return (char _es *) _SI;
  69. #else
  70.         return (char *) _SI;
  71. #endif
  72. }
  73.