Rev 8185 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8185 | Rev 12248 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | 30 | ||
31 | char *langs[]={"en","fr","cn"}; |
31 | char *langs[]={"en","fr","cn"}; |
32 | #define lang_no (sizeof(langs)/sizeof(langs[0])) |
32 | #define lang_no (sizeof(langs)/sizeof(langs[0])) |
33 | 33 | ||
34 | char *post_msg[lang_no]={ |
34 | char *post_msg[lang_no]={ |
35 |
|
35 | " <small>(click on a value to check its meaning in another window)</small> ", |
36 |
|
36 | " <small>(cliquez sur une valeur pour voir sa signification dans une autre fenêtre)</small> ", |
37 |
|
37 | " <small>(ÔÚÊý×ÖÉϵ¥»÷¿É¹©ÄãÔÚÁíÒ»ÊÓ´°ÄÚ²éÔÄÆäÒâÒå)</small> " |
38 | }; |
38 | }; |
39 | 39 | ||
40 | /***************** Nothing should need change hereafter *****************/ |
40 | /***************** Nothing should need change hereafter *****************/ |
41 | 41 | ||
42 | #include "../includes.h" |
42 | #include "../includes.h" |
43 | 43 | ||
44 | char *parm; |
44 | char *parm; |
45 | 45 | ||
46 | int getlang(void) |
46 | int getlang(void) |
47 | { |
47 | { |
48 |
|
48 | char *p; |
49 |
|
49 | int i; |
50 |
|
50 | p=getenv("w_module_language"); |
51 |
|
51 | if(p==NULL || *p==0) p=getenv("w_lang"); |
52 |
|
52 | if(p==NULL || *p==0) return 0; /* English is default */ |
53 |
|
53 | for(i=0;i<lang_no && strcmp(p,langs[i])!=0;i++); |
54 |
|
54 | if(i<lang_no) return i; else return 0; |
55 | } |
55 | } |
56 | 56 | ||
57 | int main(int argc,char *argv[]) |
57 | int main(int argc,char *argv[]) |
58 | { |
58 | { |
59 |
|
59 | char *p,*pp,*p2,*p3,*ps,*last; |
60 |
|
60 | char buf[parmlim]; |
61 |
|
61 | int i,got; |
62 | 62 | ||
63 |
|
63 | parm=getenv("wims_exec_parm"); |
64 | /* nothing to do if no parameter */ |
64 | /* nothing to do if no parameter */ |
65 |
|
65 | if(parm==NULL || *parm==0) return 0; |
66 |
|
66 | i=strlen(parm); if(i<0 || i>parmlim) { |
67 |
|
67 | fprintf(stderr,"Plouffe: parameter too long. \n"); exit(1); |
68 |
|
68 | } |
69 |
|
69 | got=0; |
70 |
|
70 | for(p=last=parm;*p!=0;p++) { |
71 |
|
71 | if(*p=='<') { |
72 |
|
72 | for(;*p!=0 && *p!='>'; p++); |
73 |
|
73 | if(*p==0) p--; |
74 | continue; |
- | |
75 | } |
- | |
76 | if(!isdigit(*p)) continue; |
- | |
77 | for(i=0,pp=p;isdigit(*pp) || *pp=='.';pp++) if(*pp=='.') i++; |
- | |
78 | if(i>1) { /* several decimal points. */ |
- | |
79 | p=pp-1;continue; |
- | |
80 | } |
- | |
81 | for(p2=pp-1;p2>=p && (*p2=='.' || *p2=='0');p2--); |
- | |
82 | p2++; |
- | |
83 | for(i=0,p3=p;p3<p2 && *p3!='.';p3++); |
- | |
84 | for(i=0,ps=p;ps<p2 && (*ps=='0' || *ps=='.'); ps++); |
- | |
85 | if(p3>=p2 || p2<ps+Plouffe_min) { |
- | |
86 | p=pp-1;continue; |
- | |
87 | } |
- | |
88 | memmove(buf,last,p-last);buf[p-last]=0; |
- | |
89 | printf("%s",buf);last=p; |
- | |
90 | i=p2-p;if(i>Plouffe_max) i=Plouffe_max; |
- | |
91 | memmove(buf,p,i);buf[i]=0; |
- | |
92 | printf(WebPlouffe,buf); |
- | |
93 | memmove(buf,p,pp-p);buf[pp-p]=0; |
- | |
94 | printf("%s</a>",buf);last=pp; |
- | |
95 | got=1;p=pp-1; |
- | |
96 | continue; |
74 | continue; |
97 | } |
75 | } |
- | 76 | if(!isdigit(*p)) continue; |
|
- | 77 | for(i=0,pp=p;isdigit(*pp) || *pp=='.';pp++) if(*pp=='.') i++; |
|
- | 78 | if(i>1) { /* several decimal points. */ |
|
- | 79 | p=pp-1;continue; |
|
- | 80 | } |
|
- | 81 | for(p2=pp-1;p2>=p && (*p2=='.' || *p2=='0');p2--); |
|
- | 82 | p2++; |
|
- | 83 | for(i=0,p3=p;p3<p2 && *p3!='.';p3++); |
|
- | 84 | for(i=0,ps=p;ps<p2 && (*ps=='0' || *ps=='.'); ps++); |
|
- | 85 | if(p3>=p2 || p2<ps+Plouffe_min) { |
|
- | 86 | p=pp-1;continue; |
|
- | 87 | } |
|
- | 88 | memmove(buf,last,p-last);buf[p-last]=0; |
|
- | 89 | printf("%s",buf);last=p; |
|
- | 90 | i=p2-p;if(i>Plouffe_max) i=Plouffe_max; |
|
- | 91 | memmove(buf,p,i);buf[i]=0; |
|
- | 92 | printf(WebPlouffe,buf); |
|
- | 93 | memmove(buf,p,pp-p);buf[pp-p]=0; |
|
- | 94 | printf("%s</a>",buf);last=pp; |
|
- | 95 | got=1;p=pp-1; |
|
- | 96 | continue; |
|
- | 97 | } |
|
98 |
|
98 | if(*last!=0) printf("%s",last); |
99 |
|
99 | if(got) printf("%s",post_msg[getlang()]); |
100 |
|
100 | return 0; |
101 | } |
101 | } |
102 | 102 |