Xinqi Bao's Git

subtraction is unneeded
[slstatus.git] / slstatus.c
index 76f0518..70d8fbb 100644 (file)
@@ -37,8 +37,6 @@ struct arg {
        const char *args;
 };
 
        const char *args;
 };
 
-static unsigned short int delay;
-
 static char *smprintf(const char *, ...);
 static char *battery_perc(const char *);
 static char *cpu_perc(void);
 static char *smprintf(const char *, ...);
 static char *battery_perc(const char *);
 static char *cpu_perc(void);
@@ -65,6 +63,7 @@ static char *vol_perc(const char *);
 static char *wifi_perc(const char *);
 static char *wifi_essid(const char *);
 
 static char *wifi_perc(const char *);
 static char *wifi_essid(const char *);
 
+static unsigned short int delay;
 static Display *dpy;
 
 #include "config.h"
 static Display *dpy;
 
 #include "config.h"
@@ -261,7 +260,7 @@ hostname(void)
 
        fgets(hostname, sizeof(hostname), fp);
        /* FIXME: needs improvement */
 
        fgets(hostname, sizeof(hostname), fp);
        /* FIXME: needs improvement */
-       memset(&hostname[strlen(hostname)-1], '\0',
+       memset(&hostname[strlen(hostname)], '\0',
                sizeof(hostname) - strlen(hostname));
        fclose(fp);
 
                sizeof(hostname) - strlen(hostname));
        fclose(fp);