equal
deleted
inserted
replaced
51 color_none = color_stop; |
51 color_none = color_stop; |
52 } else if (argc>2 && !strcmp(argv[2],"pango")) { |
52 } else if (argc>2 && !strcmp(argv[2],"pango")) { |
53 color_stop = "</span>"; |
53 color_stop = "</span>"; |
54 color_red = "<span color='#f33'>"; |
54 color_red = "<span color='#f33'>"; |
55 color_green = "<span color='#0f0'>"; |
55 color_green = "<span color='#0f0'>"; |
56 color_orange = "<span color='#f30'>"; |
56 color_orange = "<span color='#fa0'>"; |
57 color_none = "<span>"; |
57 color_none = "<span>"; |
58 } else { |
58 } else { |
59 color_stop = color_red = color_green = color_orange = color_none = ""; |
59 color_stop = color_red = color_green = color_orange = color_none = ""; |
60 } |
60 } |
61 |
61 |
82 exit(-2); |
82 exit(-2); |
83 } |
83 } |
84 } |
84 } |
85 if (down) { |
85 if (down) { |
86 if (!strcmp(info.essid,"")) { |
86 if (!strcmp(info.essid,"")) { |
87 printf("%sDOWN%s\n",color_orange,color_stop); |
87 printf("%sOFFLINE%s\n",color_orange,color_stop); |
88 } else { |
88 } else { |
89 printf("%s [%sXX/XX%s] XX\n",info.essid,color_red,color_stop); |
89 printf("%s [%sXX/XX%s] XX\n",info.essid,color_red,color_stop); |
90 } |
90 } |
91 } else { |
91 } else { |
92 int ql = 100 * stats.qual.qual / range.max_qual.qual; |
92 int ql = 100 * stats.qual.qual / range.max_qual.qual; |
93 char *qual_color = color(20,40,0,ql); |
93 char *qual_color = color(20,40,0,ql); |
94 if (stats.qual.qual<range.avg_qual.qual) qual_color = color_red; |
94 if (stats.qual.qual<range.avg_qual.qual) qual_color = color_red; |
95 |
95 #ifdef SIMPLE_AS_FUCK |
|
96 printf("%s%s%s %s\n",qual_color, eights[stats.qual.qual*8/range.max_qual.qual], color_stop, info.essid); |
|
97 #else |
96 signed char dbm; |
98 signed char dbm; |
97 dbm = (signed char)stats.qual.level; |
99 dbm = (signed char)stats.qual.level; |
98 |
100 |
99 int perc; |
101 int perc; |
100 if (dbm>-35) |
102 if (dbm>-35) |
105 perc = (dbm+95)*100/60; |
107 perc = (dbm+95)*100/60; |
106 |
108 |
107 printf("%s [%s%02d/%02d%s] ",info.essid,qual_color,stats.qual.qual,range.max_qual.qual,color_stop); |
109 printf("%s [%s%02d/%02d%s] ",info.essid,qual_color,stats.qual.qual,range.max_qual.qual,color_stop); |
108 printf("%s%hhd%s ",color(-83,-77,0,dbm),dbm,color_stop); |
110 printf("%s%hhd%s ",color(-83,-77,0,dbm),dbm,color_stop); |
109 printf("%s%d%%%s\n",color(20,40,0,perc),perc,color_stop); |
111 printf("%s%d%%%s\n",color(20,40,0,perc),perc,color_stop); |
|
112 #endif |
110 } |
113 } |
111 fflush(stdout); |
114 fflush(stdout); |
112 sleep(UPDATE_PERIOD); |
115 sleep(UPDATE_PERIOD); |
113 } |
116 } |
114 close(skfd); |
117 close(skfd); |