[Pkg-wmaker-commits] [wmifs] 16/118: wmifs: Use consistent formatting style.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 27 02:37:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmifs.

commit 345ba601b5c11fba85ee2ad77ed8cf9084e5575a
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Wed Oct 22 16:34:43 2014 -0500

    wmifs: Use consistent formatting style.
    
    Format to minimize warnings and errors from checkpatch.pl in the Window Maker
    source tree.
---
 wmgeneral/list.c      | 157 +++++++++++++++++++---------------------
 wmgeneral/list.h      |  20 +++---
 wmgeneral/misc.c      | 193 +++++++++++++++++++++++++-------------------------
 wmgeneral/wmgeneral.c |  86 +++++++++++++---------
 wmifs/wmifs.c         | 187 ++++++++++++++++++++++++++----------------------
 5 files changed, 331 insertions(+), 312 deletions(-)

diff --git a/wmgeneral/list.c b/wmgeneral/list.c
index d9f7329..9675233 100644
--- a/wmgeneral/list.c
+++ b/wmgeneral/list.c
@@ -38,132 +38,117 @@ Boston, MA 02111-1307, USA.  */
 
 /* Return a cons cell produced from (head . tail) */
 
-INLINE LinkedList*
-list_cons(void* head, LinkedList* tail)
+INLINE LinkedList *list_cons(void *head, LinkedList *tail)
 {
-  LinkedList* cell;
+	LinkedList *cell;
 
-  cell = (LinkedList*)malloc(sizeof(LinkedList));
-  cell->head = head;
-  cell->tail = tail;
-  return cell;
+	cell = (LinkedList *)malloc(sizeof(LinkedList));
+	cell->head = head;
+	cell->tail = tail;
+	return cell;
 }
 
 /* Return the length of a list, list_length(NULL) returns zero */
 
-INLINE int
-list_length(LinkedList* list)
+INLINE int list_length(LinkedList *list)
 {
-  int i = 0;
-  while(list)
-    {
-      i += 1;
-      list = list->tail;
-    }
-  return i;
+	int i = 0;
+	while (list) {
+		i += 1;
+		list = list->tail;
+	}
+	return i;
 }
 
 /* Return the Nth element of LIST, where N count from zero.  If N
    larger than the list length, NULL is returned  */
 
-INLINE void*
-list_nth(int index, LinkedList* list)
+INLINE void *list_nth(int index, LinkedList *list)
 {
-  while(index-- != 0)
-    {
-      if(list->tail)
-	list = list->tail;
-      else
-	return 0;
-    }
-  return list->head;
+	while (index-- != 0) {
+		if (list->tail)
+			list = list->tail;
+		else
+			return 0;
+	}
+	return list->head;
 }
 
 /* Remove the element at the head by replacing it by its successor */
 
-INLINE void
-list_remove_head(LinkedList** list)
+INLINE void list_remove_head(LinkedList **list)
 {
-  if (!*list) return;
-  if ((*list)->tail)
-    {
-      LinkedList* tail = (*list)->tail; /* fetch next */
-      *(*list) = *tail;		/* copy next to list head */
-      free(tail);			/* free next */
-    }
-  else				/* only one element in list */
-    {
-      free(*list);
-      (*list) = 0;
-    }
+	if (!*list)
+		return;
+	if ((*list)->tail) {
+		LinkedList *tail = (*list)->tail; /* fetch next */
+		*(*list) = *tail;		/* copy next to list head */
+		free(tail);			/* free next */
+	} else {				/* only one element in list */
+		free(*list);
+		(*list) = 0;
+	}
 }
 
 
 /* Remove the element with `car' set to ELEMENT */
 /*
-INLINE void
-list_remove_elem(LinkedList** list, void* elem)
-{
+  INLINE void
+  list_remove_elem(LinkedList** list, void* elem)
+  {
   while (*list)
-    {
-      if ((*list)->head == elem)
-        list_remove_head(list);
-      *list = (*list ? (*list)->tail : NULL);
-    }
-}*/
-
-INLINE LinkedList *
-list_remove_elem(LinkedList* list, void* elem)
+  {
+  if ((*list)->head == elem)
+  list_remove_head(list);
+  *list = (*list ? (*list)->tail : NULL);
+  }
+  }*/
+
+INLINE LinkedList *list_remove_elem(LinkedList *list, void *elem)
 {
-    LinkedList *tmp;
-
-    if (list) {
-	if (list->head == elem) {
-	    tmp = list->tail;
-	    free(list);
-	    return tmp;
+	LinkedList *tmp;
+
+	if (list) {
+		if (list->head == elem) {
+			tmp = list->tail;
+			free(list);
+			return tmp;
+		}
+		list->tail = list_remove_elem(list->tail, elem);
+		return list;
 	}
-	list->tail = list_remove_elem(list->tail, elem);
-	return list;
-    }
-    return NULL;
+	return NULL;
 }
 
 
 /* Return element that has ELEM as car */
 
-INLINE LinkedList*
-list_find(LinkedList* list, void* elem)
+INLINE LinkedList *list_find(LinkedList *list, void *elem)
 {
-  while(list)
-    {
-    if (list->head == elem)
-      return list;
-    list = list->tail;
-    }
-  return NULL;
+	while (list) {
+		if (list->head == elem)
+			return list;
+		list = list->tail;
+	}
+	return NULL;
 }
 
 /* Free list (backwards recursive) */
 
-INLINE void
-list_free(LinkedList* list)
+INLINE void list_free(LinkedList *list)
 {
-  if(list)
-    {
-      list_free(list->tail);
-      free(list);
-    }
+	if (list) {
+		list_free(list->tail);
+		free(list);
+	}
 }
 
 /* Map FUNCTION over all elements in LIST */
 
-INLINE void
-list_mapcar(LinkedList* list, void(*function)(void*))
+INLINE void list_mapcar(LinkedList *list, void(*function)(void *))
 {
-  while(list)
-    {
-      (*function)(list->head);
-      list = list->tail;
-    }
+	while (list) {
+		(*function)(list->head);
+		list = list->tail;
+	}
 }
diff --git a/wmgeneral/list.h b/wmgeneral/list.h
index be101ef..5a6f02a 100644
--- a/wmgeneral/list.h
+++ b/wmgeneral/list.h
@@ -36,24 +36,24 @@ Boston, MA 02111-1307, USA.  */
 #endif
 
 typedef struct LinkedList {
-  void *head;
-  struct LinkedList *tail;
+	void *head;
+	struct LinkedList *tail;
 } LinkedList;
 
-INLINE LinkedList* list_cons(void* head, LinkedList* tail);
+INLINE LinkedList *list_cons(void *head, LinkedList *tail);
 
-INLINE int list_length(LinkedList* list);
+INLINE int list_length(LinkedList *list);
 
-INLINE void* list_nth(int index, LinkedList* list);
+INLINE void *list_nth(int index, LinkedList *list);
 
-INLINE void list_remove_head(LinkedList** list);
+INLINE void list_remove_head(LinkedList **list);
 
-INLINE LinkedList *list_remove_elem(LinkedList* list, void* elem);
+INLINE LinkedList *list_remove_elem(LinkedList *list, void *elem);
 
-INLINE void list_mapcar(LinkedList* list, void(*function)(void*));
+INLINE void list_mapcar(LinkedList *list, void(*function)(void *));
 
-INLINE LinkedList*list_find(LinkedList* list, void* elem);
+INLINE LinkedList *list_find(LinkedList *list, void *elem);
 
-INLINE void list_free(LinkedList* list);
+INLINE void list_free(LinkedList *list);
 
 #endif
diff --git a/wmgeneral/misc.c b/wmgeneral/misc.c
index c36cdb4..950d7ac 100644
--- a/wmgeneral/misc.c
+++ b/wmgeneral/misc.c
@@ -27,7 +27,7 @@
 /*
  *----------------------------------------------------------------------
  * parse_command--
- * 	Divides a command line into a argv/argc pair.
+ *      Divides a command line into a argv/argc pair.
  *----------------------------------------------------------------------
  */
 #define PRC_ALPHA	0
@@ -38,127 +38,124 @@
 #define PRC_SQUOTE	5
 
 typedef struct {
-    short nstate;
-    short output;
+	short nstate;
+	short output;
 } DFA;
 
 
 static DFA mtable[9][6] = {
-    {{3,1},{0,0},{4,0},{1,0},{8,0},{6,0}},
-    {{1,1},{1,1},{2,0},{3,0},{5,0},{1,1}},
-    {{1,1},{1,1},{1,1},{1,1},{5,0},{1,1}},
-    {{3,1},{5,0},{4,0},{1,0},{5,0},{6,0}},
-    {{3,1},{3,1},{3,1},{3,1},{5,0},{3,1}},
-    {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
-    {{6,1},{6,1},{7,0},{6,1},{5,0},{3,0}},
-    {{6,1},{6,1},{6,1},{6,1},{5,0},{6,1}},
-    {{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
+	{{3, 1}, {0, 0}, {4, 0}, {1, 0}, {8, 0}, {6, 0} },
+	{{1, 1}, {1, 1}, {2, 0}, {3, 0}, {5, 0}, {1, 1} },
+	{{1, 1}, {1, 1}, {1, 1}, {1, 1}, {5, 0}, {1, 1} },
+	{{3, 1}, {5, 0}, {4, 0}, {1, 0}, {5, 0}, {6, 0} },
+	{{3, 1}, {3, 1}, {3, 1}, {3, 1}, {5, 0}, {3, 1} },
+	{{-1, -1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} }, /* final state */
+	{{6, 1}, {6, 1}, {7, 0}, {6, 1}, {5, 0}, {3, 0} },
+	{{6, 1}, {6, 1}, {6, 1}, {6, 1}, {5, 0}, {6, 1} },
+	{{-1, -1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} }  /* final state */
 };
 
 char*
 next_token(char *word, char **next)
 {
-    char *ptr;
-    char *ret, *t;
-    int state, ctype;
-
-    t = ret = malloc(strlen(word)+1);
-    ptr = word;
-
-    state = 0;
-    *t = 0;
-    while (1) {
-	if (*ptr==0)
-	    ctype = PRC_EOS;
-	else if (*ptr=='\\')
-	    ctype = PRC_ESCAPE;
-	else if (*ptr=='"')
-	    ctype = PRC_DQUOTE;
-	else if (*ptr=='\'')
-	    ctype = PRC_SQUOTE;
-	else if (*ptr==' ' || *ptr=='\t')
-	    ctype = PRC_BLANK;
-	else
-	    ctype = PRC_ALPHA;
-
-	if (mtable[state][ctype].output) {
-	    *t = *ptr; t++;
-	    *t = 0;
-	}
-	state = mtable[state][ctype].nstate;
-	ptr++;
-	if (mtable[state][0].output<0) {
-	    break;
+	char *ptr;
+	char *ret, *t;
+	int state, ctype;
+
+	t = ret = malloc(strlen(word)+1);
+	ptr = word;
+
+	state = 0;
+	*t = 0;
+	while (1) {
+		if (*ptr == 0)
+			ctype = PRC_EOS;
+		else if (*ptr == '\\')
+			ctype = PRC_ESCAPE;
+		else if (*ptr == '"')
+			ctype = PRC_DQUOTE;
+		else if (*ptr == '\'')
+			ctype = PRC_SQUOTE;
+		else if (*ptr == ' ' || *ptr == '\t')
+			ctype = PRC_BLANK;
+		else
+			ctype = PRC_ALPHA;
+
+		if (mtable[state][ctype].output) {
+			*t = *ptr; t++;
+			*t = 0;
+		}
+		state = mtable[state][ctype].nstate;
+		ptr++;
+		if (mtable[state][0].output < 0)
+			break;
 	}
-    }
 
-    if (*ret==0)
-	t = NULL;
-    else
-	t = strdup(ret);
+	if (*ret == 0)
+		t = NULL;
+	else
+		t = strdup(ret);
 
-    free(ret);
+	free(ret);
 
-    if (ctype==PRC_EOS)
-	*next = NULL;
-    else
-	*next = ptr;
+	if (ctype == PRC_EOS)
+		*next = NULL;
+	else
+		*next = ptr;
 
-    return t;
+	return t;
 }
 
 
 extern void
 parse_command(char *command, char ***argv, int *argc)
 {
-    LinkedList *list = NULL;
-    char *token, *line;
-    int count, i;
-
-    line = command;
-    do {
-	token = next_token(line, &line);
-	if (token) {
-	    list = list_cons(token, list);
+	LinkedList *list = NULL;
+	char *token, *line;
+	int count, i;
+
+	line = command;
+	do {
+		token = next_token(line, &line);
+		if (token)
+			list = list_cons(token, list);
+	} while (token != NULL && line != NULL);
+
+	count = list_length(list);
+	*argv = malloc(sizeof(char *)*count);
+	i = count;
+	while (list != NULL) {
+		(*argv)[--i] = list->head;
+		list_remove_head(&list);
 	}
-    } while (token!=NULL && line!=NULL);
-
-    count = list_length(list);
-    *argv = malloc(sizeof(char*)*count);
-    i = count;
-    while (list!=NULL) {
-	(*argv)[--i] = list->head;
-	list_remove_head(&list);
-    }
-    *argc = count;
+	*argc = count;
 }
 
 extern pid_t
 execCommand(char *command)
 {
-    pid_t pid;
-    char **argv;
-    int argc;
-
-    parse_command(command, &argv, &argc);
-
-    if (argv==NULL) {
-        return 0;
-    }
-
-    if ((pid=fork())==0) {
-        char **args;
-        int i;
-
-        args = malloc(sizeof(char*)*(argc+1));
-        if (!args)
-          exit(10);
-        for (i=0; i<argc; i++) {
-            args[i] = argv[i];
-        }
-        args[argc] = NULL;
-        execvp(argv[0], args);
-        exit(10);
-    }
-    return pid;
+	pid_t pid;
+	char **argv;
+	int argc;
+
+	parse_command(command, &argv, &argc);
+
+	if (argv == NULL)
+		return 0;
+
+	pid = fork();
+	if (pid == 0) {
+		char **args;
+		int i;
+
+		args = malloc(sizeof(char *)*(argc+1));
+		if (!args)
+			exit(10);
+		for (i = 0; i < argc; i++)
+			args[i] = argv[i];
+		args[argc] = NULL;
+		execvp(argv[0], args);
+		exit(10);
+	}
+	return pid;
 }
diff --git a/wmgeneral/wmgeneral.c b/wmgeneral/wmgeneral.c
index 645321c..bbd7e60 100644
--- a/wmgeneral/wmgeneral.c
+++ b/wmgeneral/wmgeneral.c
@@ -80,27 +80,32 @@ int CheckMouseRegion(int, int);
 |* read_rc_file																   *|
 \*******************************************************************************/
 
-void parse_rcfile(const char *filename, rckeys *keys) {
+void parse_rcfile(const char *filename, rckeys *keys)
+{
 
 	char	*p;
 	char	temp[128];
 	char	*tokens = " :\t\n";
 	FILE	*fp;
-	int		i,key;
+	int	i, key;
 
 	fp = fopen(filename, "r");
 	if (fp) {
 		while (fgets(temp, 128, fp)) {
 			key = 0;
 			while (key >= 0 && keys[key].label) {
-				if ((p = strstr(temp, keys[key].label))) {
+				p = strstr(temp, keys[key].label);
+				if (p) {
 					p += strlen(keys[key].label);
 					p += strspn(p, tokens);
-					if ((i = strcspn(p, "#\n"))) p[i] = 0;
+					i = strcspn(p, "#\n");
+					if (i)
+						p[i] = 0;
 					free(*keys[key].var);
 					*keys[key].var = strdup(p);
 					key = -1;
-				} else key++;
+				} else
+					key++;
 			}
 		}
 		fclose(fp);
@@ -112,7 +117,8 @@ void parse_rcfile(const char *filename, rckeys *keys) {
 |* GetXPM																	   *|
 \*******************************************************************************/
 
-static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
+static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[])
+{
 
 	XWindowAttributes	attributes;
 	int					err;
@@ -135,7 +141,8 @@ static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
 |* GetColor																	   *|
 \*******************************************************************************/
 
-static Pixel GetColor(char *name) {
+static Pixel GetColor(char *name)
+{
 
 	XColor				color;
 	XWindowAttributes	attributes;
@@ -143,11 +150,10 @@ static Pixel GetColor(char *name) {
 	XGetWindowAttributes(display, Root, &attributes);
 
 	color.pixel = 0;
-	if (!XParseColor(display, attributes.colormap, name, &color)) {
+	if (!XParseColor(display, attributes.colormap, name, &color))
 		fprintf(stderr, "wm.app: can't parse %s.\n", name);
-	} else if (!XAllocColor(display, attributes.colormap, &color)) {
+	else if (!XAllocColor(display, attributes.colormap, &color))
 		fprintf(stderr, "wm.app: can't allocate %s.\n", name);
-	}
 	return color.pixel;
 }
 
@@ -155,10 +161,11 @@ static Pixel GetColor(char *name) {
 |* flush_expose																   *|
 \*******************************************************************************/
 
-static int flush_expose(Window w) {
+static int flush_expose(Window w)
+{
 
-	XEvent 		dummy;
-	int			i=0;
+	XEvent dummy;
+	int i = 0;
 
 	while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
 		i++;
@@ -170,35 +177,38 @@ static int flush_expose(Window w) {
 |* RedrawWindow																   *|
 \*******************************************************************************/
 
-void RedrawWindow(void) {
+void RedrawWindow(void)
+{
 
 	flush_expose(iconwin);
 	XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
-				0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+				0, 0, wmgen.attributes.width, wmgen.attributes.height, 0, 0);
 	flush_expose(win);
 	XCopyArea(display, wmgen.pixmap, win, NormalGC,
-				0,0, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+				0, 0, wmgen.attributes.width, wmgen.attributes.height, 0, 0);
 }
 
 /*******************************************************************************\
 |* RedrawWindowXY															   *|
 \*******************************************************************************/
 
-void RedrawWindowXY(int x, int y) {
+void RedrawWindowXY(int x, int y)
+{
 
 	flush_expose(iconwin);
 	XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
-				x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+				x, y, wmgen.attributes.width, wmgen.attributes.height, 0, 0);
 	flush_expose(win);
 	XCopyArea(display, wmgen.pixmap, win, NormalGC,
-				x,y, wmgen.attributes.width, wmgen.attributes.height, 0,0);
+				x, y, wmgen.attributes.width, wmgen.attributes.height, 0, 0);
 }
 
 /*******************************************************************************\
 |* AddMouseRegion															   *|
 \*******************************************************************************/
 
-void AddMouseRegion(int index, int left, int top, int right, int bottom) {
+void AddMouseRegion(int index, int left, int top, int right, int bottom)
+{
 
 	if (index < MAX_MOUSE_REGION) {
 		mouse_region[index].enable = 1;
@@ -213,14 +223,15 @@ void AddMouseRegion(int index, int left, int top, int right, int bottom) {
 |* CheckMouseRegion															   *|
 \*******************************************************************************/
 
-int CheckMouseRegion(int x, int y) {
+int CheckMouseRegion(int x, int y)
+{
 
 	int		i;
 	int		found;
 
 	found = 0;
 
-	for (i=0; i<MAX_MOUSE_REGION && !found; i++) {
+	for (i = 0; i < MAX_MOUSE_REGION && !found; i++) {
 		if (mouse_region[i].enable &&
 			x <= mouse_region[i].right &&
 			x >= mouse_region[i].left &&
@@ -228,7 +239,8 @@ int CheckMouseRegion(int x, int y) {
 			y >= mouse_region[i].top)
 			found = 1;
 	}
-	if (!found) return -1;
+	if (!found)
+		return -1;
 	return (i-1);
 }
 
@@ -236,7 +248,8 @@ int CheckMouseRegion(int x, int y) {
 |* copyXPMArea																   *|
 \*******************************************************************************/
 
-void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
+void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy)
+{
 
 	XCopyArea(display, wmgen.pixmap, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
 
@@ -246,7 +259,8 @@ void copyXPMArea(int x, int y, int sx, int sy, int dx, int dy) {
 |* copyXBMArea																   *|
 \*******************************************************************************/
 
-void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
+void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy)
+{
 
 	XCopyArea(display, wmgen.mask, wmgen.pixmap, NormalGC, x, y, sx, sy, dx, dy);
 }
@@ -256,7 +270,8 @@ void copyXBMArea(int x, int y, int sx, int sy, int dx, int dy) {
 |* setMaskXY																   *|
 \*******************************************************************************/
 
-void setMaskXY(int x, int y) {
+void setMaskXY(int x, int y)
+{
 
 	 XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet);
 	 XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet);
@@ -265,7 +280,9 @@ void setMaskXY(int x, int y) {
 /*******************************************************************************\
 |* openXwindow																   *|
 \*******************************************************************************/
-void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bits, int pixmask_width, int pixmask_height) {
+void openXwindow(int argc, char *argv[], char *pixmap_bytes[],
+		 char *pixmask_bits, int pixmask_width, int pixmask_height)
+{
 
 	unsigned int	borderwidth = 1;
 	XClassHint		classHint;
@@ -277,15 +294,16 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
 	unsigned long	gcm;
 
 
-	int				dummy=0;
+	int				dummy = 0;
 	int				i;
 
-	for (i=1; argv[i]; i++) {
+	for (i = 1; argv[i]; i++) {
 		if (!strcmp(argv[i], "-display"))
 			display_name = argv[i+1];
 	}
 
-	if (!(display = XOpenDisplay(display_name))) {
+	display = XOpenDisplay(display_name);
+	if (!display) {
 		fprintf(stderr, "%s: can't open display %s\n",
 						wname, XDisplayName(display_name));
 		exit(1);
@@ -307,7 +325,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
 	fore_pix = GetColor("black");
 
 	XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
-				&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
+				&mysizehints.x, &mysizehints.y, &mysizehints.width, &mysizehints.height, &dummy);
 
 	mysizehints.width = 64;
 	mysizehints.height = 64;
@@ -324,8 +342,10 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
 	classHint.res_class = wname;
 	XSetClassHint(display, win, &classHint);
 
-	XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
-	XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
+	XSelectInput(display, win,
+		     ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
+	XSelectInput(display, iconwin,
+		     ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
 
 	if (XStringListToTextProperty(&wname, 1, &name) == 0) {
 		fprintf(stderr, "%s: can't allocate window name\n", wname);
diff --git a/wmifs/wmifs.c b/wmifs/wmifs.c
index cf7ee4d..a0abaff 100644
--- a/wmifs/wmifs.c
+++ b/wmifs/wmifs.c
@@ -249,9 +249,9 @@ extern	char **environ;
 /********************/
 
 char	*active_interface = NULL;
-int		TimerDivisor=60;
-int		WaveForm=0;
-int		LockMode=0;
+int		TimerDivisor = 60;
+int		WaveForm = 0;
+int		LockMode = 0;
 int		SampleInt = DEFAULT_SAMPLE_INTERVAL;
 int		ScrollSpeed = CHECK_INTERFACE_INTERVAL;
 
@@ -259,7 +259,7 @@ int		ScrollSpeed = CHECK_INTERFACE_INTERVAL;
  /* PPP variables */
 /*****************/
 
-#define 	PPP_UNIT		0
+#define		PPP_UNIT		0
 int			ppp_h = -1;
 
 #define		PPP_STATS_HIS	54
@@ -290,44 +290,45 @@ void get_ppp_stats(struct ppp_stats *cur);
  /* Main */
 /********/
 
-int main(int argc, char *argv[]) {
+int main(int argc, char *argv[])
+{
 
 	int		i;
 
 
 	/* Parse Command Line */
 
-	for (i=1; i<argc; i++) {
+	for (i = 1; i < argc; i++) {
 		char *arg = argv[i];
 
-		if (*arg=='-') {
+		if (*arg == '-') {
 			switch (arg[1]) {
-			case 'd' :
+			case 'd':
 				if (strcmp(arg+1, "display")) {
 					usage();
 					exit(1);
 				}
 				break;
-			case 'i' :
+			case 'i':
 				active_interface = argv[i+1];
 				i++;
 				break;
-			case 'I' :
+			case 'I':
 				SampleInt = atof(argv[i+1]) * 1000;
 				i++;
 				break;
-			case 'l' :
+			case 'l':
 				LockMode = 1;
 				break;
-			case 's' :
+			case 's':
 				ScrollSpeed = atof(argv[i+1]) * 1000;
 				i++;
 				break;
-			case 'v' :
+			case 'v':
 				printversion();
 				exit(0);
 				break;
-			case 'w' :
+			case 'w':
 				WaveForm = 1;
 				break;
 			default:
@@ -368,7 +369,8 @@ int get_statistics(char *, long *, long *, long *, long *);
 int stillonline(char *);
 void DrawActiveIFS(char *);
 
-void wmifs_routine(int argc, char **argv) {
+void wmifs_routine(int argc, char **argv)
+{
 
 	rckeys	wmifs_keys[] = {
 		{ "left", &left_action },
@@ -378,7 +380,7 @@ void wmifs_routine(int argc, char **argv) {
 	};
 
 
-	int			i,j;
+	int			i, j;
 	XEvent		Event;
 	int			but_stat = -1;
 
@@ -394,9 +396,9 @@ void wmifs_routine(int argc, char **argv) {
 	char		temp[BUFFER_SIZE];
 	char		*p;
 
-	for (i=0; i<MAX_STAT_DEVICES; i++) {
+	for (i = 0; i < MAX_STAT_DEVICES; i++) {
 		stat_devices[i].name[0] = 0;
-		for (j=0; j<48; j++) {
+		for (j = 0; j < 48; j++) {
 			stat_devices[i].his[j][0] = 0;
 			stat_devices[i].his[j][1] = 0;
 		}
@@ -407,7 +409,7 @@ void wmifs_routine(int argc, char **argv) {
 	stat_current = 0;
 	if (active_interface) {
 		int isauto = !strcmp(active_interface, "auto");
-		for (i=0; i<stat_online; i++) {
+		for (i = 0; i < stat_online; i++) {
 			if ((isauto && stillonline(stat_devices[i].name)) ||
 			    !strcmp(stat_devices[i].name, active_interface)) {
 				stat_current = i;
@@ -416,9 +418,12 @@ void wmifs_routine(int argc, char **argv) {
 		}
 	}
 
-	if (LEFT_ACTION) left_action = strdup(LEFT_ACTION);
-	if (MIDDLE_ACTION) middle_action = strdup(MIDDLE_ACTION);
-	if (RIGHT_ACTION) right_action = strdup(RIGHT_ACTION);
+	if (LEFT_ACTION)
+		left_action = strdup(LEFT_ACTION);
+	if (MIDDLE_ACTION)
+		middle_action = strdup(MIDDLE_ACTION);
+	if (RIGHT_ACTION)
+		right_action = strdup(RIGHT_ACTION);
 
 	/* Scan throught the .rc files */
 	parse_rcfile("/etc/wmifsrc", wmifs_keys);
@@ -452,18 +457,17 @@ void wmifs_routine(int argc, char **argv) {
 
 		waitpid(0, NULL, WNOHANG);
 
-		for (i=0; i<stat_online; i++) {
+		for (i = 0; i < stat_online; i++) {
 			get_statistics(stat_devices[i].name, &ipacket, &opacket, &istat, &ostat);
 			stat_devices[i].his[53][0] += istat - stat_devices[i].istatlast;
 			stat_devices[i].his[53][1] += ostat - stat_devices[i].ostatlast;
 
 
 			if (i == stat_current) {
-				if (!stillonline(stat_devices[i].name)) {
+				if (!stillonline(stat_devices[i].name))
 					SetErrLED(LED_NET_POWER);
-				} else {
+				else
 					SetOnLED(LED_NET_POWER);
-				}
 
 				if (stat_devices[i].istatlast == istat)
 					SetOffLED(LED_NET_RX);
@@ -482,12 +486,12 @@ void wmifs_routine(int argc, char **argv) {
 		RedrawWindow();
 
 		if (curtime >= nexttime) {
-			nexttime=curtime+ScrollSpeed;
+			nexttime = curtime + ScrollSpeed;
 
 			DrawStats(&stat_devices[stat_current].his[0][0], 54, 40, 5, 58);
-			for (i=0; i<stat_online; i++) {
+			for (i = 0; i < stat_online; i++) {
 				if (stillonline(stat_devices[i].name)) {
-					for (j=1; j<54; j++) {
+					for (j = 1; j < 54; j++) {
 						stat_devices[i].his[j-1][0] = stat_devices[i].his[j][0];
 						stat_devices[i].his[j-1][1] = stat_devices[i].his[j][1];
 					}
@@ -516,19 +520,19 @@ void wmifs_routine(int argc, char **argv) {
 
 				if (but_stat == i && but_stat >= 0) {
 					switch (but_stat) {
-					case 0 :
+					case 0:
 						/* re-read the table */
 						strcpy(temp, stat_devices[stat_current].name);
 						stat_online = checknetdevs();
 						stat_current = 0;
-						for (i=0; i<stat_online; i++) {
-							if (!strcmp(temp, stat_devices[i].name)) {
+						for (i = 0; i < stat_online; i++) {
+							if (!strcmp(temp, stat_devices[i].name))
 								stat_current = i;
-							}
 						}
 
 						stat_current++;
-						if (stat_current == stat_online) stat_current = 0;
+						if (stat_current == stat_online)
+							stat_current = 0;
 
 						DrawActiveIFS(stat_devices[stat_current].name);
 
@@ -567,7 +571,8 @@ void wmifs_routine(int argc, char **argv) {
 |* void DrawActiveIFS(char *)												   *|
 \*******************************************************************************/
 
-void DrawActiveIFS(char *real_name) {
+void DrawActiveIFS(char *real_name)
+{
 
 	/* Cijfers op: 0,65
 	   Letters op: 0,75
@@ -586,20 +591,21 @@ void DrawActiveIFS(char *real_name) {
 	copyXPMArea(5, 84, 30, 10, 5, 5);
 
 
-	strcpy(name,real_name);
+	strcpy(name, real_name);
 	len = strlen(name);
-	if (len > 5)
-	{
-		for (i=len-5; i<len && !(name[i]>='0' && name[i]<='9'); i++)  ;
-		for (; i<=len; i++) /* '=' to get the '\0' character moved too \*/
+	if (len > 5) {
+		for (i = len-5; i < len && !(name[i] >= '0' && name[i] <= '9'); i++)
+			;
+		for (; i <= len; i++) /* '=' to get the '\0' character moved too \*/
 			name[i-(len-5)] = name[i];
 	}
 
 	k = 5;
-	for (i=0; name[i]; i++) {
-		if (i == strlen(name)-1 && strlen(name) <= 4 && name[strlen(name)-1] >= '0' && name[strlen(name)-1] <= '9') {
+	for (i = 0; name[i]; i++) {
+		if (i == strlen(name)-1 && strlen(name) <= 4 && name[strlen(name)-1] >= '0' &&
+		    name[strlen(name)-1] <= '9') {
 			copyXPMArea(61, 64, 4, 9, k, 5);
-			k+=4;
+			k += 4;
 		}
 		c = toupper(name[i]);
 		if (c >= 'A' && c <= 'Z') {
@@ -619,7 +625,8 @@ void DrawActiveIFS(char *real_name) {
 |* get_statistics															   *|
 \*******************************************************************************/
 
-int get_statistics(char *devname, long *ip, long *op, long *is, long *os) {
+int get_statistics(char *devname, long *ip, long *op, long *is, long *os)
+{
 
 	FILE				*fp;
 	char				temp[BUFFER_SIZE];
@@ -629,14 +636,15 @@ int get_statistics(char *devname, long *ip, long *op, long *is, long *os) {
 	int					i;
 	int					found;
 	struct ppp_stats	ppp_cur, ppp_old;
-	static int			ppp_opened = 0;
+	static int			ppp_opened;
 
 
 	if (!strncmp(devname, "ppp", 3)) {
 		if (!ppp_opened) {
 			/* Open the ppp device. */
 			memset(&ppp_cur, 0, sizeof(ppp_cur));
-			if ((ppp_h = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+			ppp_h = socket(AF_INET, SOCK_DGRAM, 0);
+			if (ppp_h < 0)
 				return -1;
 			get_ppp_stats(&ppp_cur);
 			ppp_old = ppp_cur;
@@ -667,8 +675,10 @@ int get_statistics(char *devname, long *ip, long *op, long *is, long *os) {
 	p = strtok(temp, tokens);
 	do {
 		if (!(strcmp(p, "packets"))) {
-			if (input == -1) input = i;
-			else output = i;
+			if (input == -1)
+				input = i;
+			else
+				output = i;
 		}
 		i++;
 		p = strtok(NULL, tokens);
@@ -702,7 +712,8 @@ int get_statistics(char *devname, long *ip, long *op, long *is, long *os) {
 |* stillonline																   *|
 \*******************************************************************************/
 
-int stillonline(char *ifs) {
+int stillonline(char *ifs)
+{
 
 	FILE	*fp;
 	char	temp[BUFFER_SIZE];
@@ -726,20 +737,20 @@ int stillonline(char *ifs) {
 |* checknetdevs																   *|
 \*******************************************************************************/
 
-int checknetdevs(void) {
+int checknetdevs(void)
+{
 
 	FILE	*fd;
 	char	temp[BUFFER_SIZE];
 	char	*p;
-	int		i=0,j;
+	int		i = 0, j;
 	int		k;
-	int		devsfound=0;
+	int		devsfound = 0;
 	char	*tokens = " :\t\n";
 	char	foundbuffer[MAX_STAT_DEVICES][8];
 
-	for (i=0; i<MAX_STAT_DEVICES; i++) {
+	for (i = 0; i < MAX_STAT_DEVICES; i++)
 		foundbuffer[i][0] = 0;
-	}
 
 	/* foundbuffer vullen met info uit /proc/net/dev */
 
@@ -750,7 +761,7 @@ int checknetdevs(void) {
 		fgets(temp, BUFFER_SIZE, fd);
 		while (fgets(temp, BUFFER_SIZE, fd)) {
 			p = strtok(temp, tokens);
-			if(p == NULL) {
+			if (p == NULL) {
 					printf("Barfed on: %s", temp);
 					break;
 			}
@@ -774,38 +785,38 @@ int checknetdevs(void) {
 
 	/* Nu foundbuffer naar stat_devices[].name kopieeren */
 
-	for (i=0; i<MAX_STAT_DEVICES; i++) {
+	for (i = 0; i < MAX_STAT_DEVICES; i++) {
 		/* Loop stat_devices na, als die naam niet voorkomt in foundbuffer, kill! */
 
 		if (stat_devices[i].name[0]) {
 			k = 0;
-			for (j=0; j<MAX_STAT_DEVICES; j++) {
+			for (j = 0; j < MAX_STAT_DEVICES; j++) {
 				if (!strcmp(stat_devices[i].name, foundbuffer[j])) {
 					k = 1;
 					foundbuffer[j][0] = 0;
 				}
 			}
-			if (!k) stat_devices[i].name[0] = 0;
+			if (!k)
+				stat_devices[i].name[0] = 0;
 		}
 	}
 
-	for (i=0, j=0; j<MAX_STAT_DEVICES; i++, j++) {
+	for (i = 0, j = 0; j < MAX_STAT_DEVICES; i++, j++) {
 
 		while (!stat_devices[j].name[0] && j < MAX_STAT_DEVICES)
 			j++;
 
-		if (j < MAX_STAT_DEVICES && i != j) {
+		if (j < MAX_STAT_DEVICES && i != j)
 			stat_devices[i] = stat_devices[j];
-		}
 	}
 	i--;
 
-	for (j=0; j<MAX_STAT_DEVICES; j++) {
+	for (j = 0; j < MAX_STAT_DEVICES; j++) {
 		if (foundbuffer[j][0]) {
 
 			strcpy(stat_devices[i].name, foundbuffer[j]);
 
-			for (k=0; k<48; k++) {
+			for (k = 0; k < 48; k++) {
 				stat_devices[i].his[k][0] = 0;
 				stat_devices[i].his[k][1] = 0;
 			}
@@ -815,14 +826,14 @@ int checknetdevs(void) {
 	}
 	if (LockMode && active_interface != NULL) {
 		k = 0;
-		for (j=0; j<i; j++)
+		for (j = 0; j < i; j++)
 			if (!strcmp(stat_devices[j].name, active_interface)) {
 				k = 1;
 				break;
 			}
 		if (!k) {
 			strcpy(stat_devices[i].name, active_interface);
-			for (k=0; k<48; k++) {
+			for (k = 0; k < 48; k++) {
 				stat_devices[i].his[k][0] = 0;
 				stat_devices[i].his[k][1] = 0;
 			}
@@ -837,16 +848,17 @@ int checknetdevs(void) {
 |* DrawStats																   *|
 \*******************************************************************************/
 
-void DrawStats(int *his, int num, int size, int x_left, int y_bottom) {
+void DrawStats(int *his, int num, int size, int x_left, int y_bottom)
+{
 
 	int		pixels_per_byte;
-	int		j,k;
+	int		j, k;
 	int		*p;
-	int		p0,p1,p2,p3;
+	int		p0, p1, p2, p3;
 
 	pixels_per_byte = size;
 	p = his;
-	for (j=0; j<num; j++) {
+	for (j = 0; j < num; j++) {
 		if (p[0] + p[1] > pixels_per_byte)
 			pixels_per_byte = p[0] + p[1];
 		p += 2;
@@ -855,7 +867,7 @@ void DrawStats(int *his, int num, int size, int x_left, int y_bottom) {
 	pixels_per_byte /= size;
 	p = his;
 
-	for (k=0; k<num; k++) {
+	for (k = 0; k < num; k++) {
 		p0 = p[0];
 		p1 = p[1];
 
@@ -863,7 +875,7 @@ void DrawStats(int *his, int num, int size, int x_left, int y_bottom) {
 		if (WaveForm) {
 			p2 = 0;
 			p3 = 1;
-			for (j=0; j<size; j++) {
+			for (j = 0; j < size; j++) {
 				if (j < p0 / pixels_per_byte)
 					copyXPMArea(100+2, 68, 1, 1, k+x_left, y_bottom-size/2+p2/2);
 				else if (j < (p0 + p1) / pixels_per_byte)
@@ -877,7 +889,7 @@ void DrawStats(int *his, int num, int size, int x_left, int y_bottom) {
 			}
 			copyXPMArea(100+3, 68, 1, 1, k+x_left, y_bottom-size/2);
 		} else {
-			for (j=0; j<size; j++) {
+			for (j = 0; j < size; j++) {
 				if (j < p0 / pixels_per_byte)
 					copyXPMArea(100+2, 68, 1, 1, k+x_left, y_bottom-j);
 				else if (j < (p0 + p1) / pixels_per_byte)
@@ -894,9 +906,10 @@ void DrawStats(int *his, int num, int size, int x_left, int y_bottom) {
 |* usage																	   *|
 \*******************************************************************************/
 
-void usage(void) {
+void usage(void)
+{
 
-	fprintf(stderr, "\nwmifs - programming: tijno, (de)bugging & design: warpstah, webhosting: bobby \n\n");
+	fprintf(stderr, "\nwmifs - programming: tijno, (de)bugging & design: warpstah, webhosting: bobby\n\n");
 	fprintf(stderr, "usage:\n");
 	fprintf(stderr, "\t-d <display name>\n");
 	fprintf(stderr, "\t-h\tthis help screen\n");
@@ -913,7 +926,8 @@ void usage(void) {
 |* printversion																   *|
 \*******************************************************************************/
 
-void printversion(void) {
+void printversion(void)
+{
 
 	fprintf(stderr, "%s\n", WMIFS_VERSION);
 }
@@ -922,7 +936,8 @@ void printversion(void) {
 |* get_ppp_stats															   *|
 \*******************************************************************************/
 
-void get_ppp_stats(struct ppp_stats *cur) {
+void get_ppp_stats(struct ppp_stats *cur)
+{
 
 	struct ifpppstatsreq    req;
 
@@ -932,9 +947,8 @@ void get_ppp_stats(struct ppp_stats *cur) {
 
 	sprintf(req.ifr__name, "ppp%d", PPP_UNIT);
 
-	if (ioctl(ppp_h, SIOCGPPPSTATS, &req) < 0) {
-/*		fprintf(stderr, "heyho!\n"); */
-	}
+	if (ioctl(ppp_h, SIOCGPPPSTATS, &req) < 0)
+		/* fprintf(stderr, "heyho!\n") */;
 	*cur = req.stats;
 }
 
@@ -963,9 +977,10 @@ void get_ppp_stats(struct ppp_stats *cur) {
 #define LED_SW_Y (14)
 
 /*******************************************************************************\
-|* SetOnLED 																   *|
+|* SetOnLED                                                                                                                                *|
 \*******************************************************************************/
-void SetOnLED(int led) {
+void SetOnLED(int led)
+{
 
 	switch (led) {
 
@@ -982,9 +997,10 @@ void SetOnLED(int led) {
 }
 
 /*******************************************************************************\
-|* SetOffLED																   *|
+|* SetOffLED                                                                                                                               *|
 \*******************************************************************************/
-void SetOffLED(int led) {
+void SetOffLED(int led)
+{
 
 	switch (led) {
 
@@ -1001,9 +1017,10 @@ void SetOffLED(int led) {
 }
 
 /*******************************************************************************\
-|* SetErrLED 																   *|
+|* SetErrLED                                                                                                                               *|
 \*******************************************************************************/
-void SetErrLED(int led) {
+void SetErrLED(int led)
+{
 
 	switch (led) {
 	case LED_NET_POWER:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmifs.git



More information about the Pkg-wmaker-commits mailing list