mirror of
https://github.com/reactos/wine.git
synced 2024-11-30 07:00:30 +00:00
105 lines
2.6 KiB
C
105 lines
2.6 KiB
C
/*
|
|
* msvcrt.dll misc functions
|
|
*
|
|
* Copyright 2000 Jon Griffiths
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "msvcrt.h"
|
|
#include "msvcrt/stdlib.h"
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
|
|
|
|
|
|
/*********************************************************************
|
|
* _beep (MSVCRT.@)
|
|
*/
|
|
void _beep( unsigned int freq, unsigned int duration)
|
|
{
|
|
TRACE(":Freq %d, Duration %d\n",freq,duration);
|
|
Beep(freq, duration);
|
|
}
|
|
|
|
/*********************************************************************
|
|
* rand (MSVCRT.@)
|
|
*/
|
|
int MSVCRT_rand()
|
|
{
|
|
return (rand() & 0x7fff);
|
|
}
|
|
|
|
/*********************************************************************
|
|
* _sleep (MSVCRT.@)
|
|
*/
|
|
void _sleep(unsigned long timeout)
|
|
{
|
|
TRACE("_sleep for %ld milliseconds\n",timeout);
|
|
Sleep((timeout)?timeout:1);
|
|
}
|
|
|
|
/*********************************************************************
|
|
* _lfind (MSVCRT.@)
|
|
*/
|
|
void* _lfind(const void* match, const void* start,
|
|
unsigned int* array_size, unsigned int elem_size,
|
|
MSVCRT_compar_fn_t cf)
|
|
{
|
|
unsigned int size = *array_size;
|
|
if (size)
|
|
do
|
|
{
|
|
if (cf(match, start) == 0)
|
|
return (void *)start; /* found */
|
|
start = (char*)start + elem_size;
|
|
} while (--size);
|
|
return NULL;
|
|
}
|
|
|
|
/*********************************************************************
|
|
* _lsearch (MSVCRT.@)
|
|
*/
|
|
void* _lsearch(const void* match, void* start,
|
|
unsigned int* array_size, unsigned int elem_size,
|
|
MSVCRT_compar_fn_t cf)
|
|
{
|
|
unsigned int size = *array_size;
|
|
if (size)
|
|
do
|
|
{
|
|
if (cf(match, start) == 0)
|
|
return start; /* found */
|
|
start = (char*)start + elem_size;
|
|
} while (--size);
|
|
|
|
/* not found, add to end */
|
|
memcpy(start, match, elem_size);
|
|
array_size[0]++;
|
|
return start;
|
|
}
|
|
|
|
/*********************************************************************
|
|
* _chkesp (MSVCRT.@)
|
|
*/
|
|
void _chkesp(void)
|
|
{
|
|
|
|
}
|