wmifs: Use consistent formatting style.
Format to minimize warnings and errors from checkpatch.pl in the Window Maker source tree.
This commit is contained in:
		
							parent
							
								
									6083e3f774
								
							
						
					
					
						commit
						c37f6eda98
					
				
					 5 changed files with 323 additions and 304 deletions
				
			
		| 
						 | 
					@ -38,12 +38,11 @@ Boston, MA 02111-1307, USA.  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Return a cons cell produced from (head . tail) */
 | 
					/* Return a cons cell produced from (head . tail) */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INLINE LinkedList*
 | 
					INLINE LinkedList *list_cons(void *head, LinkedList *tail)
 | 
				
			||||||
list_cons(void* head, LinkedList* tail)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  LinkedList* cell;
 | 
						LinkedList *cell;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  cell = (LinkedList*)malloc(sizeof(LinkedList));
 | 
						cell = (LinkedList *)malloc(sizeof(LinkedList));
 | 
				
			||||||
	cell->head = head;
 | 
						cell->head = head;
 | 
				
			||||||
	cell->tail = tail;
 | 
						cell->tail = tail;
 | 
				
			||||||
	return cell;
 | 
						return cell;
 | 
				
			||||||
| 
						 | 
					@ -51,12 +50,10 @@ list_cons(void* head, LinkedList* tail)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Return the length of a list, list_length(NULL) returns zero */
 | 
					/* Return the length of a list, list_length(NULL) returns zero */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INLINE int
 | 
					INLINE int list_length(LinkedList *list)
 | 
				
			||||||
list_length(LinkedList* list)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i = 0;
 | 
						int i = 0;
 | 
				
			||||||
  while(list)
 | 
						while (list) {
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
		i += 1;
 | 
							i += 1;
 | 
				
			||||||
		list = list->tail;
 | 
							list = list->tail;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -66,12 +63,10 @@ list_length(LinkedList* list)
 | 
				
			||||||
/* Return the Nth element of LIST, where N count from zero.  If N
 | 
					/* Return the Nth element of LIST, where N count from zero.  If N
 | 
				
			||||||
   larger than the list length, NULL is returned  */
 | 
					   larger than the list length, NULL is returned  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INLINE void*
 | 
					INLINE void *list_nth(int index, LinkedList *list)
 | 
				
			||||||
list_nth(int index, LinkedList* list)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  while(index-- != 0)
 | 
						while (index-- != 0) {
 | 
				
			||||||
    {
 | 
							if (list->tail)
 | 
				
			||||||
      if(list->tail)
 | 
					 | 
				
			||||||
			list = list->tail;
 | 
								list = list->tail;
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
| 
						 | 
					@ -81,18 +76,15 @@ list_nth(int index, LinkedList* list)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Remove the element at the head by replacing it by its successor */
 | 
					/* Remove the element at the head by replacing it by its successor */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INLINE void
 | 
					INLINE void list_remove_head(LinkedList **list)
 | 
				
			||||||
list_remove_head(LinkedList** list)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (!*list) return;
 | 
						if (!*list)
 | 
				
			||||||
  if ((*list)->tail)
 | 
							return;
 | 
				
			||||||
    {
 | 
						if ((*list)->tail) {
 | 
				
			||||||
      LinkedList* tail = (*list)->tail; /* fetch next */
 | 
							LinkedList *tail = (*list)->tail; /* fetch next */
 | 
				
			||||||
		*(*list) = *tail;		/* copy next to list head */
 | 
							*(*list) = *tail;		/* copy next to list head */
 | 
				
			||||||
		free(tail);			/* free next */
 | 
							free(tail);			/* free next */
 | 
				
			||||||
    }
 | 
						} else {				/* only one element in list */
 | 
				
			||||||
  else				/* only one element in list */
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
		free(*list);
 | 
							free(*list);
 | 
				
			||||||
		(*list) = 0;
 | 
							(*list) = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -101,19 +93,18 @@ list_remove_head(LinkedList** list)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Remove the element with `car' set to ELEMENT */
 | 
					/* Remove the element with `car' set to ELEMENT */
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
INLINE void
 | 
					  INLINE void
 | 
				
			||||||
list_remove_elem(LinkedList** list, void* elem)
 | 
					  list_remove_elem(LinkedList** list, void* elem)
 | 
				
			||||||
{
 | 
					  {
 | 
				
			||||||
  while (*list)
 | 
					  while (*list)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
  if ((*list)->head == elem)
 | 
					  if ((*list)->head == elem)
 | 
				
			||||||
  list_remove_head(list);
 | 
					  list_remove_head(list);
 | 
				
			||||||
  *list = (*list ? (*list)->tail : NULL);
 | 
					  *list = (*list ? (*list)->tail : NULL);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}*/
 | 
					  }*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INLINE LinkedList *
 | 
					INLINE LinkedList *list_remove_elem(LinkedList *list, void *elem)
 | 
				
			||||||
list_remove_elem(LinkedList* list, void* elem)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	LinkedList *tmp;
 | 
						LinkedList *tmp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -132,11 +123,9 @@ list_remove_elem(LinkedList* list, void* elem)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Return element that has ELEM as car */
 | 
					/* Return element that has ELEM as car */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INLINE LinkedList*
 | 
					INLINE LinkedList *list_find(LinkedList *list, void *elem)
 | 
				
			||||||
list_find(LinkedList* list, void* elem)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  while(list)
 | 
						while (list) {
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
		if (list->head == elem)
 | 
							if (list->head == elem)
 | 
				
			||||||
			return list;
 | 
								return list;
 | 
				
			||||||
		list = list->tail;
 | 
							list = list->tail;
 | 
				
			||||||
| 
						 | 
					@ -146,11 +135,9 @@ list_find(LinkedList* list, void* elem)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Free list (backwards recursive) */
 | 
					/* Free list (backwards recursive) */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INLINE void
 | 
					INLINE void list_free(LinkedList *list)
 | 
				
			||||||
list_free(LinkedList* list)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if(list)
 | 
						if (list) {
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
		list_free(list->tail);
 | 
							list_free(list->tail);
 | 
				
			||||||
		free(list);
 | 
							free(list);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -158,11 +145,9 @@ list_free(LinkedList* list)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Map FUNCTION over all elements in LIST */
 | 
					/* Map FUNCTION over all elements in LIST */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INLINE void
 | 
					INLINE void list_mapcar(LinkedList *list, void(*function)(void *))
 | 
				
			||||||
list_mapcar(LinkedList* list, void(*function)(void*))
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  while(list)
 | 
						while (list) {
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
		(*function)(list->head);
 | 
							(*function)(list->head);
 | 
				
			||||||
		list = list->tail;
 | 
							list = list->tail;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,20 +40,20 @@ typedef struct LinkedList {
 | 
				
			||||||
	struct LinkedList *tail;
 | 
						struct LinkedList *tail;
 | 
				
			||||||
} LinkedList;
 | 
					} 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
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,15 +44,15 @@ typedef struct {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static DFA mtable[9][6] = {
 | 
					static DFA mtable[9][6] = {
 | 
				
			||||||
    {{3,1},{0,0},{4,0},{1,0},{8,0},{6,0}},
 | 
						{{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}, {2, 0}, {3, 0}, {5, 0}, {1, 1} },
 | 
				
			||||||
    {{1,1},{1,1},{1,1},{1,1},{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}, {5, 0}, {4, 0}, {1, 0}, {5, 0}, {6, 0} },
 | 
				
			||||||
    {{3,1},{3,1},{3,1},{3,1},{5,0},{3,1}},
 | 
						{{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 */
 | 
						{{-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}, {7, 0}, {6, 1}, {5, 0}, {3, 0} },
 | 
				
			||||||
    {{6,1},{6,1},{6,1},{6,1},{5,0},{6,1}},
 | 
						{{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 */
 | 
						{{-1, -1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} }  /* final state */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
char*
 | 
					char*
 | 
				
			||||||
| 
						 | 
					@ -68,15 +68,15 @@ next_token(char *word, char **next)
 | 
				
			||||||
	state = 0;
 | 
						state = 0;
 | 
				
			||||||
	*t = 0;
 | 
						*t = 0;
 | 
				
			||||||
	while (1) {
 | 
						while (1) {
 | 
				
			||||||
	if (*ptr==0)
 | 
							if (*ptr == 0)
 | 
				
			||||||
			ctype = PRC_EOS;
 | 
								ctype = PRC_EOS;
 | 
				
			||||||
	else if (*ptr=='\\')
 | 
							else if (*ptr == '\\')
 | 
				
			||||||
			ctype = PRC_ESCAPE;
 | 
								ctype = PRC_ESCAPE;
 | 
				
			||||||
	else if (*ptr=='"')
 | 
							else if (*ptr == '"')
 | 
				
			||||||
			ctype = PRC_DQUOTE;
 | 
								ctype = PRC_DQUOTE;
 | 
				
			||||||
	else if (*ptr=='\'')
 | 
							else if (*ptr == '\'')
 | 
				
			||||||
			ctype = PRC_SQUOTE;
 | 
								ctype = PRC_SQUOTE;
 | 
				
			||||||
	else if (*ptr==' ' || *ptr=='\t')
 | 
							else if (*ptr == ' ' || *ptr == '\t')
 | 
				
			||||||
			ctype = PRC_BLANK;
 | 
								ctype = PRC_BLANK;
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			ctype = PRC_ALPHA;
 | 
								ctype = PRC_ALPHA;
 | 
				
			||||||
| 
						 | 
					@ -87,19 +87,18 @@ next_token(char *word, char **next)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		state = mtable[state][ctype].nstate;
 | 
							state = mtable[state][ctype].nstate;
 | 
				
			||||||
		ptr++;
 | 
							ptr++;
 | 
				
			||||||
	if (mtable[state][0].output<0) {
 | 
							if (mtable[state][0].output < 0)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (*ret==0)
 | 
						if (*ret == 0)
 | 
				
			||||||
		t = NULL;
 | 
							t = NULL;
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		t = strdup(ret);
 | 
							t = strdup(ret);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(ret);
 | 
						free(ret);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (ctype==PRC_EOS)
 | 
						if (ctype == PRC_EOS)
 | 
				
			||||||
		*next = NULL;
 | 
							*next = NULL;
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		*next = ptr;
 | 
							*next = ptr;
 | 
				
			||||||
| 
						 | 
					@ -118,15 +117,14 @@ parse_command(char *command, char ***argv, int *argc)
 | 
				
			||||||
	line = command;
 | 
						line = command;
 | 
				
			||||||
	do {
 | 
						do {
 | 
				
			||||||
		token = next_token(line, &line);
 | 
							token = next_token(line, &line);
 | 
				
			||||||
	if (token) {
 | 
							if (token)
 | 
				
			||||||
			list = list_cons(token, list);
 | 
								list = list_cons(token, list);
 | 
				
			||||||
	}
 | 
						} while (token != NULL && line != NULL);
 | 
				
			||||||
    } while (token!=NULL && line!=NULL);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	count = list_length(list);
 | 
						count = list_length(list);
 | 
				
			||||||
    *argv = malloc(sizeof(char*)*count);
 | 
						*argv = malloc(sizeof(char *)*count);
 | 
				
			||||||
	i = count;
 | 
						i = count;
 | 
				
			||||||
    while (list!=NULL) {
 | 
						while (list != NULL) {
 | 
				
			||||||
		(*argv)[--i] = list->head;
 | 
							(*argv)[--i] = list->head;
 | 
				
			||||||
		list_remove_head(&list);
 | 
							list_remove_head(&list);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -142,20 +140,19 @@ execCommand(char *command)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	parse_command(command, &argv, &argc);
 | 
						parse_command(command, &argv, &argc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (argv==NULL) {
 | 
						if (argv == NULL)
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((pid=fork())==0) {
 | 
						pid = fork();
 | 
				
			||||||
 | 
						if (pid == 0) {
 | 
				
			||||||
		char **args;
 | 
							char **args;
 | 
				
			||||||
		int i;
 | 
							int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        args = malloc(sizeof(char*)*(argc+1));
 | 
							args = malloc(sizeof(char *)*(argc+1));
 | 
				
			||||||
		if (!args)
 | 
							if (!args)
 | 
				
			||||||
			exit(10);
 | 
								exit(10);
 | 
				
			||||||
        for (i=0; i<argc; i++) {
 | 
							for (i = 0; i < argc; i++)
 | 
				
			||||||
			args[i] = argv[i];
 | 
								args[i] = argv[i];
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
		args[argc] = NULL;
 | 
							args[argc] = NULL;
 | 
				
			||||||
		execvp(argv[0], args);
 | 
							execvp(argv[0], args);
 | 
				
			||||||
		exit(10);
 | 
							exit(10);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,27 +80,32 @@ int CheckMouseRegion(int, int);
 | 
				
			||||||
|* read_rc_file																   *|
 | 
					|* read_rc_file																   *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void parse_rcfile(const char *filename, rckeys *keys) {
 | 
					void parse_rcfile(const char *filename, rckeys *keys)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	char	*p;
 | 
						char	*p;
 | 
				
			||||||
	char	temp[128];
 | 
						char	temp[128];
 | 
				
			||||||
	char	*tokens = " :\t\n";
 | 
						char	*tokens = " :\t\n";
 | 
				
			||||||
	FILE	*fp;
 | 
						FILE	*fp;
 | 
				
			||||||
	int		i,key;
 | 
						int	i, key;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fp = fopen(filename, "r");
 | 
						fp = fopen(filename, "r");
 | 
				
			||||||
	if (fp) {
 | 
						if (fp) {
 | 
				
			||||||
		while (fgets(temp, 128, fp)) {
 | 
							while (fgets(temp, 128, fp)) {
 | 
				
			||||||
			key = 0;
 | 
								key = 0;
 | 
				
			||||||
			while (key >= 0 && keys[key].label) {
 | 
								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 += strlen(keys[key].label);
 | 
				
			||||||
					p += strspn(p, tokens);
 | 
										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);
 | 
										free(*keys[key].var);
 | 
				
			||||||
					*keys[key].var = strdup(p);
 | 
										*keys[key].var = strdup(p);
 | 
				
			||||||
					key = -1;
 | 
										key = -1;
 | 
				
			||||||
				} else key++;
 | 
									} else
 | 
				
			||||||
 | 
										key++;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		fclose(fp);
 | 
							fclose(fp);
 | 
				
			||||||
| 
						 | 
					@ -112,7 +117,8 @@ void parse_rcfile(const char *filename, rckeys *keys) {
 | 
				
			||||||
|* GetXPM																	   *|
 | 
					|* GetXPM																	   *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
 | 
					static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	XWindowAttributes	attributes;
 | 
						XWindowAttributes	attributes;
 | 
				
			||||||
	int					err;
 | 
						int					err;
 | 
				
			||||||
| 
						 | 
					@ -135,7 +141,8 @@ static void GetXPM(XpmIcon *wmgen, char *pixmap_bytes[]) {
 | 
				
			||||||
|* GetColor																	   *|
 | 
					|* GetColor																	   *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Pixel GetColor(char *name) {
 | 
					static Pixel GetColor(char *name)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	XColor				color;
 | 
						XColor				color;
 | 
				
			||||||
	XWindowAttributes	attributes;
 | 
						XWindowAttributes	attributes;
 | 
				
			||||||
| 
						 | 
					@ -143,11 +150,10 @@ static Pixel GetColor(char *name) {
 | 
				
			||||||
	XGetWindowAttributes(display, Root, &attributes);
 | 
						XGetWindowAttributes(display, Root, &attributes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	color.pixel = 0;
 | 
						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);
 | 
							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);
 | 
							fprintf(stderr, "wm.app: can't allocate %s.\n", name);
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return color.pixel;
 | 
						return color.pixel;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -155,10 +161,11 @@ static Pixel GetColor(char *name) {
 | 
				
			||||||
|* flush_expose																   *|
 | 
					|* flush_expose																   *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int flush_expose(Window w) {
 | 
					static int flush_expose(Window w)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	XEvent dummy;
 | 
						XEvent dummy;
 | 
				
			||||||
	int			i=0;
 | 
						int i = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
 | 
						while (XCheckTypedWindowEvent(display, w, Expose, &dummy))
 | 
				
			||||||
		i++;
 | 
							i++;
 | 
				
			||||||
| 
						 | 
					@ -170,35 +177,38 @@ static int flush_expose(Window w) {
 | 
				
			||||||
|* RedrawWindow																   *|
 | 
					|* RedrawWindow																   *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void RedrawWindow(void) {
 | 
					void RedrawWindow(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	flush_expose(iconwin);
 | 
						flush_expose(iconwin);
 | 
				
			||||||
	XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
 | 
						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);
 | 
						flush_expose(win);
 | 
				
			||||||
	XCopyArea(display, wmgen.pixmap, win, NormalGC,
 | 
						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															   *|
 | 
					|* RedrawWindowXY															   *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void RedrawWindowXY(int x, int y) {
 | 
					void RedrawWindowXY(int x, int y)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	flush_expose(iconwin);
 | 
						flush_expose(iconwin);
 | 
				
			||||||
	XCopyArea(display, wmgen.pixmap, iconwin, NormalGC,
 | 
						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);
 | 
						flush_expose(win);
 | 
				
			||||||
	XCopyArea(display, wmgen.pixmap, win, NormalGC,
 | 
						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															   *|
 | 
					|* 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) {
 | 
						if (index < MAX_MOUSE_REGION) {
 | 
				
			||||||
		mouse_region[index].enable = 1;
 | 
							mouse_region[index].enable = 1;
 | 
				
			||||||
| 
						 | 
					@ -213,14 +223,15 @@ void AddMouseRegion(int index, int left, int top, int right, int bottom) {
 | 
				
			||||||
|* CheckMouseRegion															   *|
 | 
					|* CheckMouseRegion															   *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int CheckMouseRegion(int x, int y) {
 | 
					int CheckMouseRegion(int x, int y)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int		i;
 | 
						int		i;
 | 
				
			||||||
	int		found;
 | 
						int		found;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	found = 0;
 | 
						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 &&
 | 
							if (mouse_region[i].enable &&
 | 
				
			||||||
			x <= mouse_region[i].right &&
 | 
								x <= mouse_region[i].right &&
 | 
				
			||||||
			x >= mouse_region[i].left &&
 | 
								x >= mouse_region[i].left &&
 | 
				
			||||||
| 
						 | 
					@ -228,7 +239,8 @@ int CheckMouseRegion(int x, int y) {
 | 
				
			||||||
			y >= mouse_region[i].top)
 | 
								y >= mouse_region[i].top)
 | 
				
			||||||
			found = 1;
 | 
								found = 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!found) return -1;
 | 
						if (!found)
 | 
				
			||||||
 | 
							return -1;
 | 
				
			||||||
	return (i-1);
 | 
						return (i-1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -236,7 +248,8 @@ int CheckMouseRegion(int x, int y) {
 | 
				
			||||||
|* copyXPMArea																   *|
 | 
					|* 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);
 | 
						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																   *|
 | 
					|* 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);
 | 
						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																   *|
 | 
					|* setMaskXY																   *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void setMaskXY(int x, int y) {
 | 
					void setMaskXY(int x, int y)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	 XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet);
 | 
						 XShapeCombineMask(display, win, ShapeBounding, x, y, pixmask, ShapeSet);
 | 
				
			||||||
	 XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet);
 | 
						 XShapeCombineMask(display, iconwin, ShapeBounding, x, y, pixmask, ShapeSet);
 | 
				
			||||||
| 
						 | 
					@ -265,7 +280,9 @@ void setMaskXY(int x, int y) {
 | 
				
			||||||
/*******************************************************************************\
 | 
					/*******************************************************************************\
 | 
				
			||||||
|* openXwindow																   *|
 | 
					|* 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;
 | 
						unsigned int	borderwidth = 1;
 | 
				
			||||||
	XClassHint		classHint;
 | 
						XClassHint		classHint;
 | 
				
			||||||
| 
						 | 
					@ -277,15 +294,16 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
 | 
				
			||||||
	unsigned long	gcm;
 | 
						unsigned long	gcm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int				dummy=0;
 | 
						int				dummy = 0;
 | 
				
			||||||
	int				i;
 | 
						int				i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i=1; argv[i]; i++) {
 | 
						for (i = 1; argv[i]; i++) {
 | 
				
			||||||
		if (!strcmp(argv[i], "-display"))
 | 
							if (!strcmp(argv[i], "-display"))
 | 
				
			||||||
			display_name = argv[i+1];
 | 
								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",
 | 
							fprintf(stderr, "%s: can't open display %s\n",
 | 
				
			||||||
						wname, XDisplayName(display_name));
 | 
											wname, XDisplayName(display_name));
 | 
				
			||||||
		exit(1);
 | 
							exit(1);
 | 
				
			||||||
| 
						 | 
					@ -307,7 +325,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
 | 
				
			||||||
	fore_pix = GetColor("black");
 | 
						fore_pix = GetColor("black");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
 | 
						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.width = 64;
 | 
				
			||||||
	mysizehints.height = 64;
 | 
						mysizehints.height = 64;
 | 
				
			||||||
| 
						 | 
					@ -324,8 +342,10 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
 | 
				
			||||||
	classHint.res_class = wname;
 | 
						classHint.res_class = wname;
 | 
				
			||||||
	XSetClassHint(display, win, &classHint);
 | 
						XSetClassHint(display, win, &classHint);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	XSelectInput(display, win, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
 | 
						XSelectInput(display, win,
 | 
				
			||||||
	XSelectInput(display, iconwin, ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
 | 
							     ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
 | 
				
			||||||
 | 
						XSelectInput(display, iconwin,
 | 
				
			||||||
 | 
							     ButtonPressMask | ExposureMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (XStringListToTextProperty(&wname, 1, &name) == 0) {
 | 
						if (XStringListToTextProperty(&wname, 1, &name) == 0) {
 | 
				
			||||||
		fprintf(stderr, "%s: can't allocate window name\n", wname);
 | 
							fprintf(stderr, "%s: can't allocate window name\n", wname);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -249,9 +249,9 @@ extern	char **environ;
 | 
				
			||||||
/********************/
 | 
					/********************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
char	*active_interface = NULL;
 | 
					char	*active_interface = NULL;
 | 
				
			||||||
int		TimerDivisor=60;
 | 
					int		TimerDivisor = 60;
 | 
				
			||||||
int		WaveForm=0;
 | 
					int		WaveForm = 0;
 | 
				
			||||||
int		LockMode=0;
 | 
					int		LockMode = 0;
 | 
				
			||||||
int		SampleInt = DEFAULT_SAMPLE_INTERVAL;
 | 
					int		SampleInt = DEFAULT_SAMPLE_INTERVAL;
 | 
				
			||||||
int		ScrollSpeed = CHECK_INTERFACE_INTERVAL;
 | 
					int		ScrollSpeed = CHECK_INTERFACE_INTERVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -290,44 +290,45 @@ void get_ppp_stats(struct ppp_stats *cur);
 | 
				
			||||||
 /* Main */
 | 
					 /* Main */
 | 
				
			||||||
/********/
 | 
					/********/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main(int argc, char *argv[]) {
 | 
					int main(int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int		i;
 | 
						int		i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Parse Command Line */
 | 
						/* Parse Command Line */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i=1; i<argc; i++) {
 | 
						for (i = 1; i < argc; i++) {
 | 
				
			||||||
		char *arg = argv[i];
 | 
							char *arg = argv[i];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (*arg=='-') {
 | 
							if (*arg == '-') {
 | 
				
			||||||
			switch (arg[1]) {
 | 
								switch (arg[1]) {
 | 
				
			||||||
			case 'd' :
 | 
								case 'd':
 | 
				
			||||||
				if (strcmp(arg+1, "display")) {
 | 
									if (strcmp(arg+1, "display")) {
 | 
				
			||||||
					usage();
 | 
										usage();
 | 
				
			||||||
					exit(1);
 | 
										exit(1);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			case 'i' :
 | 
								case 'i':
 | 
				
			||||||
				active_interface = argv[i+1];
 | 
									active_interface = argv[i+1];
 | 
				
			||||||
				i++;
 | 
									i++;
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			case 'I' :
 | 
								case 'I':
 | 
				
			||||||
				SampleInt = atof(argv[i+1]) * 1000;
 | 
									SampleInt = atof(argv[i+1]) * 1000;
 | 
				
			||||||
				i++;
 | 
									i++;
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			case 'l' :
 | 
								case 'l':
 | 
				
			||||||
				LockMode = 1;
 | 
									LockMode = 1;
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			case 's' :
 | 
								case 's':
 | 
				
			||||||
				ScrollSpeed = atof(argv[i+1]) * 1000;
 | 
									ScrollSpeed = atof(argv[i+1]) * 1000;
 | 
				
			||||||
				i++;
 | 
									i++;
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			case 'v' :
 | 
								case 'v':
 | 
				
			||||||
				printversion();
 | 
									printversion();
 | 
				
			||||||
				exit(0);
 | 
									exit(0);
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			case 'w' :
 | 
								case 'w':
 | 
				
			||||||
				WaveForm = 1;
 | 
									WaveForm = 1;
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			default:
 | 
								default:
 | 
				
			||||||
| 
						 | 
					@ -368,7 +369,8 @@ int get_statistics(char *, long *, long *, long *, long *);
 | 
				
			||||||
int stillonline(char *);
 | 
					int stillonline(char *);
 | 
				
			||||||
void DrawActiveIFS(char *);
 | 
					void DrawActiveIFS(char *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wmifs_routine(int argc, char **argv) {
 | 
					void wmifs_routine(int argc, char **argv)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rckeys	wmifs_keys[] = {
 | 
						rckeys	wmifs_keys[] = {
 | 
				
			||||||
		{ "left", &left_action },
 | 
							{ "left", &left_action },
 | 
				
			||||||
| 
						 | 
					@ -378,7 +380,7 @@ void wmifs_routine(int argc, char **argv) {
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int			i,j;
 | 
						int			i, j;
 | 
				
			||||||
	XEvent		Event;
 | 
						XEvent		Event;
 | 
				
			||||||
	int			but_stat = -1;
 | 
						int			but_stat = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -394,9 +396,9 @@ void wmifs_routine(int argc, char **argv) {
 | 
				
			||||||
	char		temp[BUFFER_SIZE];
 | 
						char		temp[BUFFER_SIZE];
 | 
				
			||||||
	char		*p;
 | 
						char		*p;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i=0; i<MAX_STAT_DEVICES; i++) {
 | 
						for (i = 0; i < MAX_STAT_DEVICES; i++) {
 | 
				
			||||||
		stat_devices[i].name[0] = 0;
 | 
							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][0] = 0;
 | 
				
			||||||
			stat_devices[i].his[j][1] = 0;
 | 
								stat_devices[i].his[j][1] = 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -407,7 +409,7 @@ void wmifs_routine(int argc, char **argv) {
 | 
				
			||||||
	stat_current = 0;
 | 
						stat_current = 0;
 | 
				
			||||||
	if (active_interface) {
 | 
						if (active_interface) {
 | 
				
			||||||
		int isauto = !strcmp(active_interface, "auto");
 | 
							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)) ||
 | 
								if ((isauto && stillonline(stat_devices[i].name)) ||
 | 
				
			||||||
			    !strcmp(stat_devices[i].name, active_interface)) {
 | 
								    !strcmp(stat_devices[i].name, active_interface)) {
 | 
				
			||||||
				stat_current = i;
 | 
									stat_current = i;
 | 
				
			||||||
| 
						 | 
					@ -416,9 +418,12 @@ void wmifs_routine(int argc, char **argv) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (LEFT_ACTION) left_action = strdup(LEFT_ACTION);
 | 
						if (LEFT_ACTION)
 | 
				
			||||||
	if (MIDDLE_ACTION) middle_action = strdup(MIDDLE_ACTION);
 | 
							left_action = strdup(LEFT_ACTION);
 | 
				
			||||||
	if (RIGHT_ACTION) right_action = strdup(RIGHT_ACTION);
 | 
						if (MIDDLE_ACTION)
 | 
				
			||||||
 | 
							middle_action = strdup(MIDDLE_ACTION);
 | 
				
			||||||
 | 
						if (RIGHT_ACTION)
 | 
				
			||||||
 | 
							right_action = strdup(RIGHT_ACTION);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Scan throught the .rc files */
 | 
						/* Scan throught the .rc files */
 | 
				
			||||||
	parse_rcfile("/etc/wmifsrc", wmifs_keys);
 | 
						parse_rcfile("/etc/wmifsrc", wmifs_keys);
 | 
				
			||||||
| 
						 | 
					@ -452,18 +457,17 @@ void wmifs_routine(int argc, char **argv) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		waitpid(0, NULL, WNOHANG);
 | 
							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);
 | 
								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][0] += istat - stat_devices[i].istatlast;
 | 
				
			||||||
			stat_devices[i].his[53][1] += ostat - stat_devices[i].ostatlast;
 | 
								stat_devices[i].his[53][1] += ostat - stat_devices[i].ostatlast;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (i == stat_current) {
 | 
								if (i == stat_current) {
 | 
				
			||||||
				if (!stillonline(stat_devices[i].name)) {
 | 
									if (!stillonline(stat_devices[i].name))
 | 
				
			||||||
					SetErrLED(LED_NET_POWER);
 | 
										SetErrLED(LED_NET_POWER);
 | 
				
			||||||
				} else {
 | 
									else
 | 
				
			||||||
					SetOnLED(LED_NET_POWER);
 | 
										SetOnLED(LED_NET_POWER);
 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (stat_devices[i].istatlast == istat)
 | 
									if (stat_devices[i].istatlast == istat)
 | 
				
			||||||
					SetOffLED(LED_NET_RX);
 | 
										SetOffLED(LED_NET_RX);
 | 
				
			||||||
| 
						 | 
					@ -482,12 +486,12 @@ void wmifs_routine(int argc, char **argv) {
 | 
				
			||||||
		RedrawWindow();
 | 
							RedrawWindow();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (curtime >= nexttime) {
 | 
							if (curtime >= nexttime) {
 | 
				
			||||||
			nexttime=curtime+ScrollSpeed;
 | 
								nexttime = curtime + ScrollSpeed;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			DrawStats(&stat_devices[stat_current].his[0][0], 54, 40, 5, 58);
 | 
								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)) {
 | 
									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][0] = stat_devices[i].his[j][0];
 | 
				
			||||||
						stat_devices[i].his[j-1][1] = stat_devices[i].his[j][1];
 | 
											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) {
 | 
									if (but_stat == i && but_stat >= 0) {
 | 
				
			||||||
					switch (but_stat) {
 | 
										switch (but_stat) {
 | 
				
			||||||
					case 0 :
 | 
										case 0:
 | 
				
			||||||
						/* re-read the table */
 | 
											/* re-read the table */
 | 
				
			||||||
						strcpy(temp, stat_devices[stat_current].name);
 | 
											strcpy(temp, stat_devices[stat_current].name);
 | 
				
			||||||
						stat_online = checknetdevs();
 | 
											stat_online = checknetdevs();
 | 
				
			||||||
						stat_current = 0;
 | 
											stat_current = 0;
 | 
				
			||||||
						for (i=0; i<stat_online; i++) {
 | 
											for (i = 0; i < stat_online; i++) {
 | 
				
			||||||
							if (!strcmp(temp, stat_devices[i].name)) {
 | 
												if (!strcmp(temp, stat_devices[i].name))
 | 
				
			||||||
								stat_current = i;
 | 
													stat_current = i;
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
						stat_current++;
 | 
											stat_current++;
 | 
				
			||||||
						if (stat_current == stat_online) stat_current = 0;
 | 
											if (stat_current == stat_online)
 | 
				
			||||||
 | 
												stat_current = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						DrawActiveIFS(stat_devices[stat_current].name);
 | 
											DrawActiveIFS(stat_devices[stat_current].name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -567,7 +571,8 @@ void wmifs_routine(int argc, char **argv) {
 | 
				
			||||||
|* void DrawActiveIFS(char *)												   *|
 | 
					|* void DrawActiveIFS(char *)												   *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DrawActiveIFS(char *real_name) {
 | 
					void DrawActiveIFS(char *real_name)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Cijfers op: 0,65
 | 
						/* Cijfers op: 0,65
 | 
				
			||||||
	   Letters op: 0,75
 | 
						   Letters op: 0,75
 | 
				
			||||||
| 
						 | 
					@ -586,20 +591,21 @@ void DrawActiveIFS(char *real_name) {
 | 
				
			||||||
	copyXPMArea(5, 84, 30, 10, 5, 5);
 | 
						copyXPMArea(5, 84, 30, 10, 5, 5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	strcpy(name,real_name);
 | 
						strcpy(name, real_name);
 | 
				
			||||||
	len = strlen(name);
 | 
						len = strlen(name);
 | 
				
			||||||
	if (len > 5)
 | 
						if (len > 5) {
 | 
				
			||||||
	{
 | 
							for (i = len-5; i < len && !(name[i] >= '0' && name[i] <= '9'); i++)
 | 
				
			||||||
		for (i=len-5; i<len && !(name[i]>='0' && name[i]<='9'); i++)  ;
 | 
								;
 | 
				
			||||||
		for (; i<=len; i++) /* '=' to get the '\0' character moved too \*/
 | 
							for (; i <= len; i++) /* '=' to get the '\0' character moved too \*/
 | 
				
			||||||
			name[i-(len-5)] = name[i];
 | 
								name[i-(len-5)] = name[i];
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	k = 5;
 | 
						k = 5;
 | 
				
			||||||
	for (i=0; name[i]; i++) {
 | 
						for (i = 0; name[i]; i++) {
 | 
				
			||||||
		if (i == strlen(name)-1 && strlen(name) <= 4 && name[strlen(name)-1] >= '0' && name[strlen(name)-1] <= '9') {
 | 
							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);
 | 
								copyXPMArea(61, 64, 4, 9, k, 5);
 | 
				
			||||||
			k+=4;
 | 
								k += 4;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		c = toupper(name[i]);
 | 
							c = toupper(name[i]);
 | 
				
			||||||
		if (c >= 'A' && c <= 'Z') {
 | 
							if (c >= 'A' && c <= 'Z') {
 | 
				
			||||||
| 
						 | 
					@ -619,7 +625,8 @@ void DrawActiveIFS(char *real_name) {
 | 
				
			||||||
|* get_statistics															   *|
 | 
					|* 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;
 | 
						FILE				*fp;
 | 
				
			||||||
	char				temp[BUFFER_SIZE];
 | 
						char				temp[BUFFER_SIZE];
 | 
				
			||||||
| 
						 | 
					@ -629,14 +636,15 @@ int get_statistics(char *devname, long *ip, long *op, long *is, long *os) {
 | 
				
			||||||
	int					i;
 | 
						int					i;
 | 
				
			||||||
	int					found;
 | 
						int					found;
 | 
				
			||||||
	struct ppp_stats	ppp_cur, ppp_old;
 | 
						struct ppp_stats	ppp_cur, ppp_old;
 | 
				
			||||||
	static int			ppp_opened = 0;
 | 
						static int			ppp_opened;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!strncmp(devname, "ppp", 3)) {
 | 
						if (!strncmp(devname, "ppp", 3)) {
 | 
				
			||||||
		if (!ppp_opened) {
 | 
							if (!ppp_opened) {
 | 
				
			||||||
			/* Open the ppp device. */
 | 
								/* Open the ppp device. */
 | 
				
			||||||
			memset(&ppp_cur, 0, sizeof(ppp_cur));
 | 
								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;
 | 
									return -1;
 | 
				
			||||||
			get_ppp_stats(&ppp_cur);
 | 
								get_ppp_stats(&ppp_cur);
 | 
				
			||||||
			ppp_old = 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);
 | 
						p = strtok(temp, tokens);
 | 
				
			||||||
	do {
 | 
						do {
 | 
				
			||||||
		if (!(strcmp(p, "packets"))) {
 | 
							if (!(strcmp(p, "packets"))) {
 | 
				
			||||||
			if (input == -1) input = i;
 | 
								if (input == -1)
 | 
				
			||||||
			else output = i;
 | 
									input = i;
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
									output = i;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		i++;
 | 
							i++;
 | 
				
			||||||
		p = strtok(NULL, tokens);
 | 
							p = strtok(NULL, tokens);
 | 
				
			||||||
| 
						 | 
					@ -702,7 +712,8 @@ int get_statistics(char *devname, long *ip, long *op, long *is, long *os) {
 | 
				
			||||||
|* stillonline																   *|
 | 
					|* stillonline																   *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int stillonline(char *ifs) {
 | 
					int stillonline(char *ifs)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	FILE	*fp;
 | 
						FILE	*fp;
 | 
				
			||||||
	char	temp[BUFFER_SIZE];
 | 
						char	temp[BUFFER_SIZE];
 | 
				
			||||||
| 
						 | 
					@ -726,20 +737,20 @@ int stillonline(char *ifs) {
 | 
				
			||||||
|* checknetdevs																   *|
 | 
					|* checknetdevs																   *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int checknetdevs(void) {
 | 
					int checknetdevs(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	FILE	*fd;
 | 
						FILE	*fd;
 | 
				
			||||||
	char	temp[BUFFER_SIZE];
 | 
						char	temp[BUFFER_SIZE];
 | 
				
			||||||
	char	*p;
 | 
						char	*p;
 | 
				
			||||||
	int		i=0,j;
 | 
						int		i = 0, j;
 | 
				
			||||||
	int		k;
 | 
						int		k;
 | 
				
			||||||
	int		devsfound=0;
 | 
						int		devsfound = 0;
 | 
				
			||||||
	char	*tokens = " :\t\n";
 | 
						char	*tokens = " :\t\n";
 | 
				
			||||||
	char	foundbuffer[MAX_STAT_DEVICES][8];
 | 
						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[i][0] = 0;
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* foundbuffer vullen met info uit /proc/net/dev */
 | 
						/* foundbuffer vullen met info uit /proc/net/dev */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -750,7 +761,7 @@ int checknetdevs(void) {
 | 
				
			||||||
		fgets(temp, BUFFER_SIZE, fd);
 | 
							fgets(temp, BUFFER_SIZE, fd);
 | 
				
			||||||
		while (fgets(temp, BUFFER_SIZE, fd)) {
 | 
							while (fgets(temp, BUFFER_SIZE, fd)) {
 | 
				
			||||||
			p = strtok(temp, tokens);
 | 
								p = strtok(temp, tokens);
 | 
				
			||||||
			if(p == NULL) {
 | 
								if (p == NULL) {
 | 
				
			||||||
					printf("Barfed on: %s", temp);
 | 
										printf("Barfed on: %s", temp);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -774,38 +785,38 @@ int checknetdevs(void) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Nu foundbuffer naar stat_devices[].name kopieeren */
 | 
						/* 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! */
 | 
							/* Loop stat_devices na, als die naam niet voorkomt in foundbuffer, kill! */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (stat_devices[i].name[0]) {
 | 
							if (stat_devices[i].name[0]) {
 | 
				
			||||||
			k = 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])) {
 | 
									if (!strcmp(stat_devices[i].name, foundbuffer[j])) {
 | 
				
			||||||
					k = 1;
 | 
										k = 1;
 | 
				
			||||||
					foundbuffer[j][0] = 0;
 | 
										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)
 | 
							while (!stat_devices[j].name[0] && j < MAX_STAT_DEVICES)
 | 
				
			||||||
			j++;
 | 
								j++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (j < MAX_STAT_DEVICES && i != j) {
 | 
							if (j < MAX_STAT_DEVICES && i != j)
 | 
				
			||||||
			stat_devices[i] = stat_devices[j];
 | 
								stat_devices[i] = stat_devices[j];
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	i--;
 | 
						i--;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (j=0; j<MAX_STAT_DEVICES; j++) {
 | 
						for (j = 0; j < MAX_STAT_DEVICES; j++) {
 | 
				
			||||||
		if (foundbuffer[j][0]) {
 | 
							if (foundbuffer[j][0]) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			strcpy(stat_devices[i].name, foundbuffer[j]);
 | 
								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][0] = 0;
 | 
				
			||||||
				stat_devices[i].his[k][1] = 0;
 | 
									stat_devices[i].his[k][1] = 0;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -815,14 +826,14 @@ int checknetdevs(void) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (LockMode && active_interface != NULL) {
 | 
						if (LockMode && active_interface != NULL) {
 | 
				
			||||||
		k = 0;
 | 
							k = 0;
 | 
				
			||||||
		for (j=0; j<i; j++)
 | 
							for (j = 0; j < i; j++)
 | 
				
			||||||
			if (!strcmp(stat_devices[j].name, active_interface)) {
 | 
								if (!strcmp(stat_devices[j].name, active_interface)) {
 | 
				
			||||||
				k = 1;
 | 
									k = 1;
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		if (!k) {
 | 
							if (!k) {
 | 
				
			||||||
			strcpy(stat_devices[i].name, active_interface);
 | 
								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][0] = 0;
 | 
				
			||||||
				stat_devices[i].his[k][1] = 0;
 | 
									stat_devices[i].his[k][1] = 0;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -837,16 +848,17 @@ int checknetdevs(void) {
 | 
				
			||||||
|* DrawStats																   *|
 | 
					|* 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		pixels_per_byte;
 | 
				
			||||||
	int		j,k;
 | 
						int		j, k;
 | 
				
			||||||
	int		*p;
 | 
						int		*p;
 | 
				
			||||||
	int		p0,p1,p2,p3;
 | 
						int		p0, p1, p2, p3;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pixels_per_byte = size;
 | 
						pixels_per_byte = size;
 | 
				
			||||||
	p = his;
 | 
						p = his;
 | 
				
			||||||
	for (j=0; j<num; j++) {
 | 
						for (j = 0; j < num; j++) {
 | 
				
			||||||
		if (p[0] + p[1] > pixels_per_byte)
 | 
							if (p[0] + p[1] > pixels_per_byte)
 | 
				
			||||||
			pixels_per_byte = p[0] + p[1];
 | 
								pixels_per_byte = p[0] + p[1];
 | 
				
			||||||
		p += 2;
 | 
							p += 2;
 | 
				
			||||||
| 
						 | 
					@ -855,7 +867,7 @@ void DrawStats(int *his, int num, int size, int x_left, int y_bottom) {
 | 
				
			||||||
	pixels_per_byte /= size;
 | 
						pixels_per_byte /= size;
 | 
				
			||||||
	p = his;
 | 
						p = his;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (k=0; k<num; k++) {
 | 
						for (k = 0; k < num; k++) {
 | 
				
			||||||
		p0 = p[0];
 | 
							p0 = p[0];
 | 
				
			||||||
		p1 = p[1];
 | 
							p1 = p[1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -863,7 +875,7 @@ void DrawStats(int *his, int num, int size, int x_left, int y_bottom) {
 | 
				
			||||||
		if (WaveForm) {
 | 
							if (WaveForm) {
 | 
				
			||||||
			p2 = 0;
 | 
								p2 = 0;
 | 
				
			||||||
			p3 = 1;
 | 
								p3 = 1;
 | 
				
			||||||
			for (j=0; j<size; j++) {
 | 
								for (j = 0; j < size; j++) {
 | 
				
			||||||
				if (j < p0 / pixels_per_byte)
 | 
									if (j < p0 / pixels_per_byte)
 | 
				
			||||||
					copyXPMArea(100+2, 68, 1, 1, k+x_left, y_bottom-size/2+p2/2);
 | 
										copyXPMArea(100+2, 68, 1, 1, k+x_left, y_bottom-size/2+p2/2);
 | 
				
			||||||
				else if (j < (p0 + p1) / pixels_per_byte)
 | 
									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);
 | 
								copyXPMArea(100+3, 68, 1, 1, k+x_left, y_bottom-size/2);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			for (j=0; j<size; j++) {
 | 
								for (j = 0; j < size; j++) {
 | 
				
			||||||
				if (j < p0 / pixels_per_byte)
 | 
									if (j < p0 / pixels_per_byte)
 | 
				
			||||||
					copyXPMArea(100+2, 68, 1, 1, k+x_left, y_bottom-j);
 | 
										copyXPMArea(100+2, 68, 1, 1, k+x_left, y_bottom-j);
 | 
				
			||||||
				else if (j < (p0 + p1) / pixels_per_byte)
 | 
									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																	   *|
 | 
					|* 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, "usage:\n");
 | 
				
			||||||
	fprintf(stderr, "\t-d <display name>\n");
 | 
						fprintf(stderr, "\t-d <display name>\n");
 | 
				
			||||||
	fprintf(stderr, "\t-h\tthis help screen\n");
 | 
						fprintf(stderr, "\t-h\tthis help screen\n");
 | 
				
			||||||
| 
						 | 
					@ -913,7 +926,8 @@ void usage(void) {
 | 
				
			||||||
|* printversion																   *|
 | 
					|* printversion																   *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void printversion(void) {
 | 
					void printversion(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fprintf(stderr, "%s\n", WMIFS_VERSION);
 | 
						fprintf(stderr, "%s\n", WMIFS_VERSION);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -922,7 +936,8 @@ void printversion(void) {
 | 
				
			||||||
|* get_ppp_stats															   *|
 | 
					|* get_ppp_stats															   *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void get_ppp_stats(struct ppp_stats *cur) {
 | 
					void get_ppp_stats(struct ppp_stats *cur)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct ifpppstatsreq    req;
 | 
						struct ifpppstatsreq    req;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -932,9 +947,8 @@ void get_ppp_stats(struct ppp_stats *cur) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sprintf(req.ifr__name, "ppp%d", PPP_UNIT);
 | 
						sprintf(req.ifr__name, "ppp%d", PPP_UNIT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ioctl(ppp_h, SIOCGPPPSTATS, &req) < 0) {
 | 
						if (ioctl(ppp_h, SIOCGPPPSTATS, &req) < 0)
 | 
				
			||||||
/*		fprintf(stderr, "heyho!\n"); */
 | 
							/* fprintf(stderr, "heyho!\n") */;
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	*cur = req.stats;
 | 
						*cur = req.stats;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -965,7 +979,8 @@ void get_ppp_stats(struct ppp_stats *cur) {
 | 
				
			||||||
/*******************************************************************************\
 | 
					/*******************************************************************************\
 | 
				
			||||||
|* SetOnLED                                                                                                                                *|
 | 
					|* SetOnLED                                                                                                                                *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
void SetOnLED(int led) {
 | 
					void SetOnLED(int led)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (led) {
 | 
						switch (led) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -984,7 +999,8 @@ void SetOnLED(int led) {
 | 
				
			||||||
/*******************************************************************************\
 | 
					/*******************************************************************************\
 | 
				
			||||||
|* SetOffLED                                                                                                                               *|
 | 
					|* SetOffLED                                                                                                                               *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
void SetOffLED(int led) {
 | 
					void SetOffLED(int led)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (led) {
 | 
						switch (led) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1003,7 +1019,8 @@ void SetOffLED(int led) {
 | 
				
			||||||
/*******************************************************************************\
 | 
					/*******************************************************************************\
 | 
				
			||||||
|* SetErrLED                                                                                                                               *|
 | 
					|* SetErrLED                                                                                                                               *|
 | 
				
			||||||
\*******************************************************************************/
 | 
					\*******************************************************************************/
 | 
				
			||||||
void SetErrLED(int led) {
 | 
					void SetErrLED(int led)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (led) {
 | 
						switch (led) {
 | 
				
			||||||
	case LED_NET_POWER:
 | 
						case LED_NET_POWER:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue