Skip to content
This repository has been archived by the owner on Jan 5, 2018. It is now read-only.

Commit

Permalink
minor changes to array sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
Unia committed Nov 6, 2013
1 parent 8b9c22a commit b906b80
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ CC = gcc
PREFIX ?= /usr/local
BINPREFIX = ${PREFIX}/bin

LIBS = -liw -lasound -lX11 `pkg-config --cflags --libs glib-2.0 dbus-glib-1 audclient`
CFLAGS += -pedantic -Wall -Wextra -Wno-format-zero-length
LIBS = -liw -lasound -lX11 `pkg-config --cflags --libs glib-2.0 dbus-glib-1 audclient`
CFLAGS += -pedantic -Wall -Wextra

debug: CFLAGS += -O0 -g
debug: ${PROG}
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ ToDo
* Code left to clean up:
* Alsa;
* Improve handling when no battery is present
* Be more strict concerning memory use
* Check battery code when charging concerning new laptop
* Look into empty spaces when Skype/Network is not present
16 changes: 8 additions & 8 deletions dwmst.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ char *get_aud (char *buf, DBusGProxy *session) {

psong = audacious_remote_get_playlist_title (session, audacious_remote_get_playlist_pos (session));
if (psong) {
snprintf (buf, 173, AUD_STR, psong);
snprintf (buf, 160, AUD_STR, psong);
free (psong);
} else
snprintf (buf, 1, NO_AUD_STR);
buf[0] = '\0';
return buf;
}

char *get_skype (char *buf) {
if (access (SKYPE_LOCK, F_OK) == 0)
snprintf (buf, 6, SKYPE_STR);
else
snprintf (buf, 1, NO_SKYPE_STR);
buf[0] = '\0';
return buf;
}

Expand Down Expand Up @@ -86,7 +86,7 @@ char *get_volume (char *buf, snd_mixer_t *handle) {

char *get_battery (char *buf) {
FILE *infile;
char state[8];
char state[11];
long now = -1, full = -1, voltage = -1, rate = -1;
int perc, hours, minutes, seconds = -1;

Expand Down Expand Up @@ -117,9 +117,9 @@ char *get_battery (char *buf) {
if (strncmp (state, "Charging", 8) == 0)
snprintf (buf, 24, BAT_CHRG_STR, perc, hours, minutes);
else {
/*if (perc < BAT_LOW_P || minutes < BAT_LOW_T)*/
/*notify*/
snprintf (buf, 35, BAT_STR, perc, hours, minutes);
/*if (perc < BAT_LOW_P || minutes < BAT_LOW_T)
notify*/
snprintf (buf, 24, BAT_STR, perc, hours, minutes);
}
}
} else
Expand All @@ -131,7 +131,7 @@ char *get_battery (char *buf) {
int main(void) {
Display *dpy;
Window root;
char status[256], music[173], skype[6], net[30], volume[12], battery[35];
char status[256], music[160], skype[6], net[30], volume[12], battery[24];
int netloops = 60, musicloops = 10;
DBusGProxy *session = NULL;
DBusGConnection *connection = NULL;
Expand Down

0 comments on commit b906b80

Please sign in to comment.