/* pad percentages to decimals? */
static int pad_percents = 0;
+/* UTF-8 */
+int utf8_mode = 0;
+
+
/* Text that is shown */
static char original_text[] =
"$nodename - $sysname $kernel on $machine\n"
#ifdef XFT
if (use_xft) {
XGlyphInfo gi;
- XftTextExtentsUtf8(display, xftfont, s, l, &gi);
+ if(utf8_mode) {
+ XftTextExtentsUtf8(display, xftfont, s, l, &gi);
+ }
+ else {
+ XftTextExtents8(display, xftfont, s, l, &gi);
+ }
return gi.xOff;
} else
#endif
char space[2];
snprintf(space, 2, " ");
max = ((text_width-width_of_s)/get_string_width(space));
- //printf("width: %i, length: %i, max: %i space: %i\n", text_width, width_of_s, max, get_string_width(space));
/*
* This code looks for tabs in the text and coverts them to spaces.
* The trick is getting the correct number of spaces,
c2.color.green = c.green;
c2.color.blue = c.blue;
c2.color.alpha = font_alpha;
- XftDrawStringUtf8(window.xftdraw, &c2, xftfont,
- cur_x, cur_y, (XftChar8 *) s, strlen(s));
+ if(utf8_mode) {
+ XftDrawStringUtf8(window.xftdraw, &c2, xftfont,
+ cur_x, cur_y, (XftChar8 *) s, strlen(s));
+ }
+ else {
+ XftDrawString8(window.xftdraw, &c2, xftfont,
+ cur_x, cur_y, (XftChar8 *) s, strlen(s));
+ }
} else
#endif
{
int main(int argc, char **argv) {
/* handle command line parameters that don't change configs */
char *s;
- int utf8_mode = 0;
if (((s = getenv("LC_ALL")) && *s) ||
((s = getenv("LC_CTYPE")) && *s) ||
tries++;
if ( strlen(metar_station) != 8 ){
fprintf(stderr,"You didn't supply a valid station code\n");
- return;
+ return NULL;
}
if (metar_server == NULL)
metar_server = strdup("weather.noaa.gov");
res = connectFtp(metar_server, 0);
if (res < 0) {
fprintf(stderr, "Couldn't connect to %s\n", metar_server);
- return;
+ return NULL;
}
res = changeFtpDirectory(metar_path);
if (res < 0) {
fprintf(stderr, "Metar update failed (couldn't CWD to %s)\n", metar_path);
disconnectFtp();
- return;
+ return NULL;
}
if (res == 0) {
fprintf(stderr,
"Metar update failed\n");
- return;
+ return NULL;
}
if (getFtp(ftpData, NULL, metar_station) < 0) {
fprintf(stderr, "Failed to get file %s\n", metar_station);
} while (ftp_ok == 0 && tries < 3);
status = 1;
+ return NULL;
}
static pthread_t thread1;