2 * Implementation of things missing in Windows
6 #define M_PI 3.14159265358979323846
13 #ifdef WINDOWS_FUNCTIONS
16 static unsigned short StoM(unsigned short inv) {
22 inp = (union iconv *)&inv;
24 outv.uc[0] = inp->uc[1];
25 outv.uc[1] = inp->uc[0];
30 static unsigned int ItoM(unsigned int inv) {
36 inp = (union iconv *)&inv;
38 outv.uc[0] = inp->uc[3];
39 outv.uc[1] = inp->uc[2];
40 outv.uc[2] = inp->uc[1];
41 outv.uc[3] = inp->uc[0];
46 unsigned short ntohs(unsigned short inv) { return StoM(inv); }
47 unsigned long ntohl(unsigned long inv) { return ItoM(inv); }
48 unsigned long htonl(unsigned long inv) { return ItoM(inv); }
53 char getopt(int argc, char **argv, char *args) {
54 int n,nlen=strlen(args),nLen=0;
57 if (argv[optind] && *argv[optind]=='-') {
58 nCmd=*((argv[optind]+1));
60 for (n=0;n<nlen;n++) {
61 if (args[n] == ':') continue;
62 if (args[n] == nCmd) {
65 retVal=*(argv[optind]+1);
66 optarg=argv[optind+1];
67 if (!optarg) optarg="";
72 retVal=*(argv[optind]+1);
85 unsigned short ntohs(unsigned short inv);
86 unsigned long ntohl(unsigned long inv);
87 unsigned long htonl(unsigned long inv);
92 char getopt(int argc, char **argv, char *args);