wmgeneral: Reduce scope of several variables.

Also took the opportunity to fix some whitespace formatting.
This commit is contained in:
Doug Torrance 2015-05-19 22:30:50 -05:00 committed by Carlos R. Mafra
parent 6dc4716c29
commit a0f16b945a
12 changed files with 408 additions and 300 deletions

View file

@ -100,20 +100,25 @@ int CheckMouseRegion(int, int);
void parse_rcfile(const char *filename, rckeys *keys) { void parse_rcfile(const char *filename, rckeys *keys) {
char *p,*q; char *p;
char temp[128];
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
char temp[128];
while (fgets(temp, 128, fp)) { while (fgets(temp, 128, fp)) {
char *q;
char *tokens = " :\t\n";
int key;
key = 0; key = 0;
q = strdup(temp); q = strdup(temp);
q = strtok(q, tokens); q = strtok(q, tokens);
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) { if ((!strcmp(q, keys[key].label))) {
int i;
p = strstr(temp, keys[key].label); p = strstr(temp, keys[key].label);
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
@ -138,17 +143,20 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
char *p; char *p;
char *line = NULL; char *line = NULL;
size_t line_size = 0; size_t line_size = 0;
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
char *family = NULL; char *family = NULL;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
while (getline(&line, &line_size, fp) >= 0) { while (getline(&line, &line_size, fp) >= 0) {
int key;
key = 0; key = 0;
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((p = strstr(line, keys[key].label))) { if ((p = strstr(line, keys[key].label))) {
char *tokens = " :\t\n";
int i;
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; if ((i = strcspn(p, "#\n"))) p[i] = 0;
@ -296,8 +304,6 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k; int i,j,k;
int width, height, numcol, depth; int width, height, numcol, depth;
int zero=0; int zero=0;
unsigned char bwrite;
int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
@ -310,6 +316,9 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
unsigned char bwrite;
int bcount;
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx*depth; j+=depth) { for (j=0; j<sx*depth; j+=depth) {

View file

@ -100,20 +100,25 @@ int CheckMouseRegion(int, int);
void parse_rcfile(const char *filename, rckeys *keys) { void parse_rcfile(const char *filename, rckeys *keys) {
char *p,*q; char *p;
char temp[128];
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
char temp[128];
while (fgets(temp, 128, fp)) { while (fgets(temp, 128, fp)) {
char *q;
char *tokens = " :\t\n";
int key;
key = 0; key = 0;
q = strdup(temp); q = strdup(temp);
q = strtok(q, tokens); q = strtok(q, tokens);
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) { if ((!strcmp(q, keys[key].label))) {
int i;
p = strstr(temp, keys[key].label); p = strstr(temp, keys[key].label);
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
@ -138,17 +143,20 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
char *p; char *p;
char *line = NULL; char *line = NULL;
size_t line_size = 0; size_t line_size = 0;
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
char *family = NULL; char *family = NULL;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
while (getline(&line, &line_size, fp) >= 0) { while (getline(&line, &line_size, fp) >= 0) {
int key;
key = 0; key = 0;
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((p = strstr(line, keys[key].label))) { if ((p = strstr(line, keys[key].label))) {
char *tokens = " :\t\n";
int i;
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; if ((i = strcspn(p, "#\n"))) p[i] = 0;
@ -296,8 +304,6 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k; int i,j,k;
int width, height, numcol, depth; int width, height, numcol, depth;
int zero=0; int zero=0;
unsigned char bwrite;
int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
@ -310,6 +316,9 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
unsigned char bwrite;
int bcount;
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx*depth; j+=depth) { for (j=0; j<sx*depth; j+=depth) {

View file

@ -100,20 +100,25 @@ int CheckMouseRegion(int, int);
void parse_rcfile(const char *filename, rckeys *keys) { void parse_rcfile(const char *filename, rckeys *keys) {
char *p,*q; char *p;
char temp[128];
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
char temp[128];
while (fgets(temp, 128, fp)) { while (fgets(temp, 128, fp)) {
char *q;
char *tokens = " :\t\n";
int key;
key = 0; key = 0;
q = strdup(temp); q = strdup(temp);
q = strtok(q, tokens); q = strtok(q, tokens);
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) { if ((!strcmp(q, keys[key].label))) {
int i;
p = strstr(temp, keys[key].label); p = strstr(temp, keys[key].label);
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
@ -138,17 +143,20 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
char *p; char *p;
char *line = NULL; char *line = NULL;
size_t line_size = 0; size_t line_size = 0;
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
char *family = NULL; char *family = NULL;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
while (getline(&line, &line_size, fp) >= 0) { while (getline(&line, &line_size, fp) >= 0) {
int key;
key = 0; key = 0;
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((p = strstr(line, keys[key].label))) { if ((p = strstr(line, keys[key].label))) {
char *tokens = " :\t\n";
int i;
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; if ((i = strcspn(p, "#\n"))) p[i] = 0;
@ -296,8 +304,6 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k; int i,j,k;
int width, height, numcol, depth; int width, height, numcol, depth;
int zero=0; int zero=0;
unsigned char bwrite;
int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
@ -310,6 +316,9 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
unsigned char bwrite;
int bcount;
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx*depth; j+=depth) { for (j=0; j<sx*depth; j+=depth) {

View file

@ -100,20 +100,25 @@ int CheckMouseRegion(int, int);
void parse_rcfile(const char *filename, rckeys *keys) { void parse_rcfile(const char *filename, rckeys *keys) {
char *p,*q; char *p;
char temp[128];
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
char temp[128];
while (fgets(temp, 128, fp)) { while (fgets(temp, 128, fp)) {
char *q;
char *tokens = " :\t\n";
int key;
key = 0; key = 0;
q = strdup(temp); q = strdup(temp);
q = strtok(q, tokens); q = strtok(q, tokens);
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) { if ((!strcmp(q, keys[key].label))) {
int i;
p = strstr(temp, keys[key].label); p = strstr(temp, keys[key].label);
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
@ -138,17 +143,20 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
char *p; char *p;
char *line = NULL; char *line = NULL;
size_t line_size = 0; size_t line_size = 0;
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
char *family = NULL; char *family = NULL;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
while (getline(&line, &line_size, fp) >= 0) { while (getline(&line, &line_size, fp) >= 0) {
int key;
key = 0; key = 0;
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((p = strstr(line, keys[key].label))) { if ((p = strstr(line, keys[key].label))) {
char *tokens = " :\t\n";
int i;
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; if ((i = strcspn(p, "#\n"))) p[i] = 0;
@ -296,8 +304,6 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k; int i,j,k;
int width, height, numcol, depth; int width, height, numcol, depth;
int zero=0; int zero=0;
unsigned char bwrite;
int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
@ -310,6 +316,9 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
unsigned char bwrite;
int bcount;
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx*depth; j+=depth) { for (j=0; j<sx*depth; j+=depth) {

View file

@ -100,20 +100,25 @@ int CheckMouseRegion(int, int);
void parse_rcfile(const char *filename, rckeys *keys) { void parse_rcfile(const char *filename, rckeys *keys) {
char *p,*q; char *p;
char temp[128];
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
char temp[128];
while (fgets(temp, 128, fp)) { while (fgets(temp, 128, fp)) {
char *q;
char *tokens = " :\t\n";
int key;
key = 0; key = 0;
q = strdup(temp); q = strdup(temp);
q = strtok(q, tokens); q = strtok(q, tokens);
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) { if ((!strcmp(q, keys[key].label))) {
int i;
p = strstr(temp, keys[key].label); p = strstr(temp, keys[key].label);
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
@ -138,17 +143,20 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
char *p; char *p;
char *line = NULL; char *line = NULL;
size_t line_size = 0; size_t line_size = 0;
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
char *family = NULL; char *family = NULL;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
while (getline(&line, &line_size, fp) >= 0) { while (getline(&line, &line_size, fp) >= 0) {
int key;
key = 0; key = 0;
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((p = strstr(line, keys[key].label))) { if ((p = strstr(line, keys[key].label))) {
char *tokens = " :\t\n";
int i;
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; if ((i = strcspn(p, "#\n"))) p[i] = 0;
@ -296,8 +304,6 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k; int i,j,k;
int width, height, numcol, depth; int width, height, numcol, depth;
int zero=0; int zero=0;
unsigned char bwrite;
int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
@ -310,6 +316,9 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
unsigned char bwrite;
int bcount;
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx*depth; j+=depth) { for (j=0; j<sx*depth; j+=depth) {

View file

@ -100,20 +100,25 @@ int CheckMouseRegion(int, int);
void parse_rcfile(const char *filename, rckeys *keys) { void parse_rcfile(const char *filename, rckeys *keys) {
char *p,*q; char *p;
char temp[128];
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
char temp[128];
while (fgets(temp, 128, fp)) { while (fgets(temp, 128, fp)) {
char *q;
char *tokens = " :\t\n";
int key;
key = 0; key = 0;
q = strdup(temp); q = strdup(temp);
q = strtok(q, tokens); q = strtok(q, tokens);
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) { if ((!strcmp(q, keys[key].label))) {
int i;
p = strstr(temp, keys[key].label); p = strstr(temp, keys[key].label);
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
@ -138,17 +143,20 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
char *p; char *p;
char *line = NULL; char *line = NULL;
size_t line_size = 0; size_t line_size = 0;
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
char *family = NULL; char *family = NULL;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
while (getline(&line, &line_size, fp) >= 0) { while (getline(&line, &line_size, fp) >= 0) {
int key;
key = 0; key = 0;
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((p = strstr(line, keys[key].label))) { if ((p = strstr(line, keys[key].label))) {
char *tokens = " :\t\n";
int i;
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; if ((i = strcspn(p, "#\n"))) p[i] = 0;
@ -296,8 +304,6 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k; int i,j,k;
int width, height, numcol, depth; int width, height, numcol, depth;
int zero=0; int zero=0;
unsigned char bwrite;
int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
@ -310,6 +316,9 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
unsigned char bwrite;
int bcount;
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx*depth; j+=depth) { for (j=0; j<sx*depth; j+=depth) {

View file

@ -100,20 +100,25 @@ int CheckMouseRegion(int, int);
void parse_rcfile(const char *filename, rckeys *keys) { void parse_rcfile(const char *filename, rckeys *keys) {
char *p,*q; char *p;
char temp[128];
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
char temp[128];
while (fgets(temp, 128, fp)) { while (fgets(temp, 128, fp)) {
char *q;
char *tokens = " :\t\n";
int key;
key = 0; key = 0;
q = strdup(temp); q = strdup(temp);
q = strtok(q, tokens); q = strtok(q, tokens);
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) { if ((!strcmp(q, keys[key].label))) {
int i;
p = strstr(temp, keys[key].label); p = strstr(temp, keys[key].label);
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
@ -138,17 +143,20 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
char *p; char *p;
char *line = NULL; char *line = NULL;
size_t line_size = 0; size_t line_size = 0;
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
char *family = NULL; char *family = NULL;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
while (getline(&line, &line_size, fp) >= 0) { while (getline(&line, &line_size, fp) >= 0) {
int key;
key = 0; key = 0;
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((p = strstr(line, keys[key].label))) { if ((p = strstr(line, keys[key].label))) {
char *tokens = " :\t\n";
int i;
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; if ((i = strcspn(p, "#\n"))) p[i] = 0;
@ -296,8 +304,6 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k; int i,j,k;
int width, height, numcol, depth; int width, height, numcol, depth;
int zero=0; int zero=0;
unsigned char bwrite;
int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
@ -310,6 +316,9 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
unsigned char bwrite;
int bcount;
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx*depth; j+=depth) { for (j=0; j<sx*depth; j+=depth) {

View file

@ -100,20 +100,25 @@ int CheckMouseRegion(int, int);
void parse_rcfile(const char *filename, rckeys *keys) { void parse_rcfile(const char *filename, rckeys *keys) {
char *p,*q; char *p;
char temp[128];
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
char temp[128];
while (fgets(temp, 128, fp)) { while (fgets(temp, 128, fp)) {
char *q;
char *tokens = " :\t\n";
int key;
key = 0; key = 0;
q = strdup(temp); q = strdup(temp);
q = strtok(q, tokens); q = strtok(q, tokens);
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) { if ((!strcmp(q, keys[key].label))) {
int i;
p = strstr(temp, keys[key].label); p = strstr(temp, keys[key].label);
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
@ -138,17 +143,20 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
char *p; char *p;
char *line = NULL; char *line = NULL;
size_t line_size = 0; size_t line_size = 0;
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
char *family = NULL; char *family = NULL;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
while (getline(&line, &line_size, fp) >= 0) { while (getline(&line, &line_size, fp) >= 0) {
int key;
key = 0; key = 0;
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((p = strstr(line, keys[key].label))) { if ((p = strstr(line, keys[key].label))) {
char *tokens = " :\t\n";
int i;
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; if ((i = strcspn(p, "#\n"))) p[i] = 0;
@ -296,8 +304,6 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k; int i,j,k;
int width, height, numcol, depth; int width, height, numcol, depth;
int zero=0; int zero=0;
unsigned char bwrite;
int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
@ -310,6 +316,9 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
unsigned char bwrite;
int bcount;
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx*depth; j+=depth) { for (j=0; j<sx*depth; j+=depth) {

View file

@ -100,20 +100,25 @@ int CheckMouseRegion(int, int);
void parse_rcfile(const char *filename, rckeys *keys) { void parse_rcfile(const char *filename, rckeys *keys) {
char *p,*q; char *p;
char temp[128];
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
char temp[128];
while (fgets(temp, 128, fp)) { while (fgets(temp, 128, fp)) {
char *q;
char *tokens = " :\t\n";
int key;
key = 0; key = 0;
q = strdup(temp); q = strdup(temp);
q = strtok(q, tokens); q = strtok(q, tokens);
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) { if ((!strcmp(q, keys[key].label))) {
int i;
p = strstr(temp, keys[key].label); p = strstr(temp, keys[key].label);
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
@ -138,17 +143,20 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
char *p; char *p;
char *line = NULL; char *line = NULL;
size_t line_size = 0; size_t line_size = 0;
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
char *family = NULL; char *family = NULL;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
while (getline(&line, &line_size, fp) >= 0) { while (getline(&line, &line_size, fp) >= 0) {
int key;
key = 0; key = 0;
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((p = strstr(line, keys[key].label))) { if ((p = strstr(line, keys[key].label))) {
char *tokens = " :\t\n";
int i;
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; if ((i = strcspn(p, "#\n"))) p[i] = 0;
@ -296,8 +304,6 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k; int i,j,k;
int width, height, numcol, depth; int width, height, numcol, depth;
int zero=0; int zero=0;
unsigned char bwrite;
int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
@ -310,6 +316,9 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
unsigned char bwrite;
int bcount;
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx*depth; j+=depth) { for (j=0; j<sx*depth; j+=depth) {

View file

@ -100,20 +100,25 @@ int CheckMouseRegion(int, int);
void parse_rcfile(const char *filename, rckeys *keys) { void parse_rcfile(const char *filename, rckeys *keys) {
char *p,*q; char *p;
char temp[128];
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
char temp[128];
while (fgets(temp, 128, fp)) { while (fgets(temp, 128, fp)) {
char *q;
char *tokens = " :\t\n";
int key;
key = 0; key = 0;
q = strdup(temp); q = strdup(temp);
q = strtok(q, tokens); q = strtok(q, tokens);
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) { if ((!strcmp(q, keys[key].label))) {
int i;
p = strstr(temp, keys[key].label); p = strstr(temp, keys[key].label);
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
@ -138,17 +143,20 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
char *p; char *p;
char *line = NULL; char *line = NULL;
size_t line_size = 0; size_t line_size = 0;
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
char *family = NULL; char *family = NULL;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
while (getline(&line, &line_size, fp) >= 0) { while (getline(&line, &line_size, fp) >= 0) {
int key;
key = 0; key = 0;
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((p = strstr(line, keys[key].label))) { if ((p = strstr(line, keys[key].label))) {
char *tokens = " :\t\n";
int i;
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; if ((i = strcspn(p, "#\n"))) p[i] = 0;
@ -296,8 +304,6 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k; int i,j,k;
int width, height, numcol, depth; int width, height, numcol, depth;
int zero=0; int zero=0;
unsigned char bwrite;
int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
@ -310,6 +316,9 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
unsigned char bwrite;
int bcount;
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx*depth; j+=depth) { for (j=0; j<sx*depth; j+=depth) {

View file

@ -100,20 +100,25 @@ int CheckMouseRegion(int, int);
void parse_rcfile(const char *filename, rckeys *keys) { void parse_rcfile(const char *filename, rckeys *keys) {
char *p,*q; char *p;
char temp[128];
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
char temp[128];
while (fgets(temp, 128, fp)) { while (fgets(temp, 128, fp)) {
char *q;
char *tokens = " :\t\n";
int key;
key = 0; key = 0;
q = strdup(temp); q = strdup(temp);
q = strtok(q, tokens); q = strtok(q, tokens);
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) { if ((!strcmp(q, keys[key].label))) {
int i;
p = strstr(temp, keys[key].label); p = strstr(temp, keys[key].label);
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
@ -138,17 +143,20 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
char *p; char *p;
char *line = NULL; char *line = NULL;
size_t line_size = 0; size_t line_size = 0;
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
char *family = NULL; char *family = NULL;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
while (getline(&line, &line_size, fp) >= 0) { while (getline(&line, &line_size, fp) >= 0) {
int key;
key = 0; key = 0;
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((p = strstr(line, keys[key].label))) { if ((p = strstr(line, keys[key].label))) {
char *tokens = " :\t\n";
int i;
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; if ((i = strcspn(p, "#\n"))) p[i] = 0;
@ -296,8 +304,6 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k; int i,j,k;
int width, height, numcol, depth; int width, height, numcol, depth;
int zero=0; int zero=0;
unsigned char bwrite;
int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
@ -310,6 +316,9 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
unsigned char bwrite;
int bcount;
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx*depth; j+=depth) { for (j=0; j<sx*depth; j+=depth) {

View file

@ -100,20 +100,25 @@ int CheckMouseRegion(int, int);
void parse_rcfile(const char *filename, rckeys *keys) { void parse_rcfile(const char *filename, rckeys *keys) {
char *p,*q; char *p;
char temp[128];
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
char temp[128];
while (fgets(temp, 128, fp)) { while (fgets(temp, 128, fp)) {
char *q;
char *tokens = " :\t\n";
int key;
key = 0; key = 0;
q = strdup(temp); q = strdup(temp);
q = strtok(q, tokens); q = strtok(q, tokens);
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((!strcmp(q, keys[key].label))) { if ((!strcmp(q, keys[key].label))) {
int i;
p = strstr(temp, keys[key].label); p = strstr(temp, keys[key].label);
p += strlen(keys[key].label); p += strlen(keys[key].label);
p += strspn(p, tokens); p += strspn(p, tokens);
@ -138,17 +143,20 @@ void parse_rcfile2(const char *filename, rckeys2 *keys) {
char *p; char *p;
char *line = NULL; char *line = NULL;
size_t line_size = 0; size_t line_size = 0;
char *tokens = " :\t\n";
FILE *fp; FILE *fp;
int i,key;
char *family = NULL; char *family = NULL;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp) { if (fp) {
while (getline(&line, &line_size, fp) >= 0) { while (getline(&line, &line_size, fp) >= 0) {
int key;
key = 0; key = 0;
while (key >= 0 && keys[key].label) { while (key >= 0 && keys[key].label) {
if ((p = strstr(line, keys[key].label))) { if ((p = strstr(line, keys[key].label))) {
char *tokens = " :\t\n";
int i;
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; if ((i = strcspn(p, "#\n"))) p[i] = 0;
@ -296,8 +304,6 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
int i,j,k; int i,j,k;
int width, height, numcol, depth; int width, height, numcol, depth;
int zero=0; int zero=0;
unsigned char bwrite;
int bcount;
int curpixel; int curpixel;
sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth); sscanf(*xpm, "%d %d %d %d", &width, &height, &numcol, &depth);
@ -310,6 +316,9 @@ void createXBMfromXPM(char *xbm, char **xpm, int sx, int sy) {
} }
for (i=numcol+1; i < numcol+sy+1; i++) { for (i=numcol+1; i < numcol+sy+1; i++) {
unsigned char bwrite;
int bcount;
bcount = 0; bcount = 0;
bwrite = 0; bwrite = 0;
for (j=0; j<sx*depth; j+=depth) { for (j=0; j<sx*depth; j+=depth) {