Include the msvcrt headers, remove duplicate definitions.
[wine] / dlls / msvcrt / misc.c
1 /*
2  * msvcrt.dll misc functions
3  *
4  * Copyright 2000 Jon Griffiths
5  */
6
7 #include "msvcrt.h"
8
9 #include <stdlib.h>
10 #include "msvcrt/stdlib.h"
11
12
13 DEFAULT_DEBUG_CHANNEL(msvcrt);
14
15 typedef int (*MSVCRT_comp_func)(const void*, const void*);
16
17 /*********************************************************************
18  *              _beep (MSVCRT.@)
19  */
20 void _beep( unsigned int freq, unsigned int duration)
21 {
22     TRACE(":Freq %d, Duration %d\n",freq,duration);
23     Beep(freq, duration);
24 }
25
26 /*********************************************************************
27  *              rand (MSVCRT.@)
28  */
29 int MSVCRT_rand()
30 {
31   return (rand() & 0x7fff);
32 }
33
34 /*********************************************************************
35  *              _sleep (MSVCRT.@)
36  */
37 void _sleep(unsigned long timeout)
38 {
39   TRACE("_sleep for %ld milliseconds\n",timeout);
40   Sleep((timeout)?timeout:1);
41 }
42
43 /*********************************************************************
44  *              _lfind (MSVCRT.@)
45  */
46 void* _lfind(const void* match, const void* start,
47              unsigned int* array_size, unsigned int elem_size,
48              MSVCRT_comp_func cf)
49 {
50   unsigned int size = *array_size;
51   if (size)
52     do
53     {
54       if (cf(match, start) == 0)
55         return (void *)start; /* found */
56       start += elem_size;
57     } while (--size);
58   return NULL;
59 }
60
61 /*********************************************************************
62  *              _lsearch (MSVCRT.@)
63  */
64 void* _lsearch(const void* match, void* start,
65                unsigned int* array_size, unsigned int elem_size,
66                MSVCRT_comp_func cf)
67 {
68   unsigned int size = *array_size;
69   if (size)
70     do
71     {
72       if (cf(match, start) == 0)
73         return start; /* found */
74       start += elem_size;
75     } while (--size);
76
77   /* not found, add to end */
78   memcpy(start, match, elem_size);
79   array_size[0]++;
80   return start;
81 }
82
83 /*********************************************************************
84  *              _chkesp (MSVCRT.@)
85  */
86 void _chkesp(void)
87 {
88
89 }