Handle the %f case in wsprintf.
[wine.git] / dlls / msvcrt / misc.c
blob803902d780f855af8a72a118c2742652cf86d107
1 /*
2 * msvcrt.dll misc functions
4 * Copyright 2000 Jon Griffiths
5 */
7 #include "msvcrt.h"
9 #include <stdlib.h>
10 #include "msvcrt/stdlib.h"
13 DEFAULT_DEBUG_CHANNEL(msvcrt);
15 typedef int (*MSVCRT_comp_func)(const void*, const void*);
17 /*********************************************************************
18 * _beep (MSVCRT.@)
20 void _beep( unsigned int freq, unsigned int duration)
22 TRACE(":Freq %d, Duration %d\n",freq,duration);
23 Beep(freq, duration);
26 /*********************************************************************
27 * rand (MSVCRT.@)
29 int MSVCRT_rand()
31 return (rand() & 0x7fff);
34 /*********************************************************************
35 * _sleep (MSVCRT.@)
37 void _sleep(unsigned long timeout)
39 TRACE("_sleep for %ld milliseconds\n",timeout);
40 Sleep((timeout)?timeout:1);
43 /*********************************************************************
44 * _lfind (MSVCRT.@)
46 void* _lfind(const void* match, const void* start,
47 unsigned int* array_size, unsigned int elem_size,
48 MSVCRT_comp_func cf)
50 unsigned int size = *array_size;
51 if (size)
54 if (cf(match, start) == 0)
55 return (void *)start; /* found */
56 start += elem_size;
57 } while (--size);
58 return NULL;
61 /*********************************************************************
62 * _lsearch (MSVCRT.@)
64 void* _lsearch(const void* match, void* start,
65 unsigned int* array_size, unsigned int elem_size,
66 MSVCRT_comp_func cf)
68 unsigned int size = *array_size;
69 if (size)
72 if (cf(match, start) == 0)
73 return start; /* found */
74 start += elem_size;
75 } while (--size);
77 /* not found, add to end */
78 memcpy(start, match, elem_size);
79 array_size[0]++;
80 return start;
83 /*********************************************************************
84 * _chkesp (MSVCRT.@)
86 void _chkesp(void)