home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / internet-tools / ipdial / source / strreadargs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-17  |  1.8 KB  |  80 lines

  1. /**
  2. ***  IPDial - StrReadArgs.c
  3. ***
  4. ***  This file implements a version of ReadArgs(), which parses strings
  5. ***  instead of the command line. However, its data is static, you must
  6. ***  not use it twice at the same time.
  7. ***
  8. ***
  9. ***  This program is free software; you can redistribute it and/or modify
  10. ***  it under the terms of the GNU General Public License as published by
  11. ***  the Free Software Foundation; either version 2 of the License, or
  12. ***  (at your option) any later version.
  13. ***
  14. ***  This program is distributed in the hope that it will be useful,
  15. ***  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ***  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. ***  GNU General Public License for more details.
  18. ***
  19. ***  You should have received a copy of the GNU General Public License
  20. ***  along with this program; if not, write to the Free Software
  21. ***  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. ***
  23. ***  Authors: Jochen Wiedmann <wiedmann@neckar-alb.de>
  24. ***           Stefan Gybas <cab@studbox.uni-stuttgart.de>
  25. **/
  26.  
  27.  
  28.  
  29.  
  30. /**
  31. ***  Include files
  32. **/
  33. #ifndef IPDIAL_H
  34. #include "IPDial.h"
  35. #endif
  36. #include <dos/rdargs.h>
  37.  
  38.  
  39.  
  40.  
  41. /**
  42. ***  Local variables
  43. **/
  44. STATIC struct RDArgs *StrRDArgs     = NULL;
  45.  
  46.  
  47.  
  48.  
  49.  
  50. VOID StrReadArgsFree(VOID)
  51.  
  52. { if (StrRDArgs)
  53.   { FreeArgs(StrRDArgs);
  54.     StrRDArgs = NULL;
  55.   }
  56. }
  57.  
  58.  
  59.  
  60.  
  61.  
  62. ULONG StrReadArgs(STRPTR str, LONG *args, STRPTR template)
  63.  
  64. { STATIC struct RDArgs rdargs;
  65.  
  66.   StrReadArgsFree();
  67.  
  68.   rdargs.RDA_Source.CS_Buffer = str;
  69.   rdargs.RDA_Source.CS_Length = strlen((char *) str);
  70.   rdargs.RDA_Source.CS_CurChr = 0;
  71.   rdargs.RDA_DAList = 0;
  72.   rdargs.RDA_Buffer = NULL;
  73.   rdargs.RDA_BufSiz = 0;
  74.   rdargs.RDA_ExtHelp = NULL;
  75.   rdargs.RDA_Flags = RDAF_NOPROMPT;
  76.  
  77.   StrRDArgs = ReadArgs(template, args, &rdargs);
  78.   return((ULONG) (StrRDArgs ? TRUE : FALSE));
  79. }
  80.