annotate Meerwald/wm.c @ 18:3bdb67e76858

mse opt.
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Fri, 30 Jan 2009 12:46:49 +0100
parents be303a3f5ea8
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.