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