Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /****************************************************************************
  2. *
  3. *                            Open Watcom Project
  4. *
  5. *    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
  6. *
  7. *  ========================================================================
  8. *
  9. *    This file contains Original Code and/or Modifications of Original
  10. *    Code as defined in and that are subject to the Sybase Open Watcom
  11. *    Public License version 1.0 (the 'License'). You may not use this file
  12. *    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
  13. *    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
  14. *    provided with the Original Code and Modifications, and is also
  15. *    available at www.sybase.com/developer/opensource.
  16. *
  17. *    The Original Code and all software distributed under the License are
  18. *    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  19. *    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
  20. *    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
  21. *    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
  22. *    NON-INFRINGEMENT. Please see the License for the specific language
  23. *    governing rights and limitations under the License.
  24. *
  25. *  ========================================================================
  26. *
  27. * Description:  WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
  28. *               DESCRIBE IT HERE!
  29. *
  30. ****************************************************************************/
  31.  
  32.  
  33. #include "variety.h"
  34. #include <string.h>
  35.  
  36. #ifdef  M_I86
  37.  
  38. extern  char _WCFAR * _scan1( char _WCFAR *s, int c );
  39.  
  40. /* use scan1 to find the char we are looking for */
  41.  
  42. #pragma aux    _scan1 = 0x1e            /* push ds   */\
  43.                         0x8e 0xda       /* mov ds,dx */\
  44.                         0xad            /* L1:lodsw  */\
  45.                         0x38 0xd8       /* cmp al,bl */\
  46.                         0x74 0x22       /* je L3     */\
  47.                         0x84 0xc0       /* test al,al*/\
  48.                         0x74 0x19       /* je L2     */\
  49.                         0x38 0xdc       /* cmp ah,bl */\
  50.                         0x74 0x1b       /* je L4     */\
  51.                         0x84 0xe4       /* test ah,ah*/\
  52.                         0x74 0x11       /* je L2     */\
  53.                         0xad            /* lodsw     */\
  54.                         0x38 0xd8       /* cmp al,bl */\
  55.                         0x74 0x11       /* je L3     */\
  56.                         0x84 0xc0       /* test al,al*/\
  57.                         0x74 0x08       /* je L2     */\
  58.                         0x38 0xdc       /* cmp ah,bl */\
  59.                         0x74 0x0a       /* je L4     */\
  60.                         0x84 0xe4       /* test ah,ah*/\
  61.                         0x75 0xde       /* jne L1    */\
  62.                         0x31 0xf6       /* L2:xor si,si*/\
  63.                         0x89 0xf2       /* mov dx,si */\
  64.                         0xa9            /* test ax,... */\
  65.                         0x4e            /* L3:dec si */\
  66.                         0x4e            /* L4:dec si */\
  67.                         0x1f            /* pop ds    */\
  68.                         parm caller [dx si] [bl]\
  69.                         value [dx si]\
  70.                         modify [ax dx si];
  71. #endif
  72.  
  73.  
  74. /* locate the first occurrence of c in the initial n characters of the
  75.    string pointed to by s. The terminating null character is considered
  76.    to be part of the string.
  77.    If the character c is not found, NULL is returned.
  78. */
  79. #undef  _fstrchr
  80.  
  81. _WCRTLINK char _WCFAR *_fstrchr( const char _WCFAR *s, int c )
  82.     {
  83. //#if defined(M_I86)
  84.         //return( _scan1( (char _WCFAR *)s, c ) );
  85. //#else
  86.         do {
  87.             if( *s == c ) return( (char _WCFAR *)s );
  88.         } while( *s++ != '\0' );
  89.         return( NULL );
  90. //#endif
  91.     }
  92.