home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / dos / findarg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-27  |  2.3 KB  |  117 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: findarg.c,v 1.6 1997/01/27 00:36:19 ldp Exp $
  4.     $Log: findarg.c,v $
  5.     Revision 1.6  1997/01/27 00:36:19  ldp
  6.     Polish
  7.  
  8.     Revision 1.5  1996/12/09 13:53:27  aros
  9.     Added empty templates for all missing functions
  10.  
  11.     Moved #include's into first column
  12.  
  13.     Revision 1.4  1996/10/24 15:50:27  aros
  14.     Use the official AROS macros over the __AROS versions.
  15.  
  16.     Revision 1.3  1996/08/13 13:52:46  digulla
  17.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  18.     Replaced AROS_LA by AROS_LHA
  19.  
  20.     Revision 1.2  1996/08/01 17:40:50  digulla
  21.     Added standard header for all files
  22.  
  23.     Desc:
  24.     Lang: english
  25. */
  26. #include <proto/utility.h>
  27. #include "dos_intern.h"
  28.  
  29. /*****************************************************************************
  30.  
  31.     NAME */
  32. #include <proto/dos.h>
  33.  
  34.     AROS_LH2(LONG, FindArg,
  35.  
  36. /*  SYNOPSIS */
  37.     AROS_LHA(STRPTR, template, D1),
  38.     AROS_LHA(STRPTR, keyword,  D2),
  39.  
  40. /*  LOCATION */
  41.     struct DosLibrary *, DOSBase, 134, Dos)
  42.  
  43. /*  FUNCTION
  44.  
  45.     INPUTS
  46.  
  47.     RESULT
  48.  
  49.     NOTES
  50.  
  51.     EXAMPLE
  52.  
  53.     BUGS
  54.  
  55.     SEE ALSO
  56.  
  57.     INTERNALS
  58.  
  59.     HISTORY
  60.     29-10-95    digulla automatically created from
  61.                 dos_lib.fd and clib/dos_protos.h
  62.  
  63. *****************************************************************************/
  64. {
  65.     AROS_LIBFUNC_INIT
  66.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  67.  
  68.     LONG count=0;
  69.     STRPTR key;
  70.  
  71.     /* Loop over template */
  72.     for(;;)
  73.     {
  74.     /* Compare key to template */
  75.     key=keyword;
  76.     for(;;)
  77.     {
  78.         /* If the keyword has ended check the template */
  79.         if(!*key)
  80.         {
  81.         if(!*template||*template=='='||*template=='/'||*template==',')
  82.             /* The template has ended, too. Return count. */
  83.             return count;
  84.         /* The template isn't finished. Stop comparison. */
  85.         break;
  86.         }
  87.         /* If the two differ stop comparison. */
  88.         if(ToLower(*key)!=ToLower(*template))
  89.         break;
  90.         /* Go to next character */
  91.         key++;
  92.         template++;
  93.     }
  94.     /* Find next keyword in template */
  95.     for(;;)
  96.     {
  97.         if(!*template)
  98.         return -1;
  99.         if(*template=='=')
  100.         {
  101.         /* Alias found */
  102.         template++;
  103.         break;
  104.         }
  105.         if(*template==',')
  106.         {
  107.         /* Next item found */
  108.         template++;
  109.         count++;
  110.         break;
  111.         }
  112.         template++;
  113.     }
  114.     }
  115.     AROS_LIBFUNC_EXIT
  116. } /* FindArg */
  117.