annotate Meerwald-dir/wm.c @ 25:5a57a145bccb default tip

Added tag v0.7 for changeset 9f20bce6184e
author Peter Meerwald-Stadler <pmeerw@pmeerw.net>
date Fri, 20 Dec 2024 13:32:15 +0100
parents 9f20bce6184e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
1 #include "wm.h"
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
2
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
3 #ifdef __MINGW32_VERSION
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
4 void bzero(char *b, size_t length) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
5 int i;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
6 for (i=0; i<length; i++) { *b=0; b++; }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
7 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
8 #endif
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
9
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
10 void set_in_binary() {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
11 #if defined(EMX)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
12 _fsetmode(in, "b");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
13 #elif defined(MINGW)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
14 setmode(STDIN_FILENO, O_BINARY);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
15 #endif
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
16 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
17
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
18 void set_out_binary() {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
19 #if defined(EMX)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
20 _fsetmode(out, "b");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
21 #elif defined(MINGW)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
22 setmode(STDOUT_FILENO, O_BINARY);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
23 #endif
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
24 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
25
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
26 void wm_init2() {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
27 set_in_binary();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
28 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
29
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
30 void wm_init1() {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
31 set_out_binary();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
32 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
33
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
34 void wm_init() {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
35 set_in_binary();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
36 set_out_binary();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
37 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
38

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.