$OpenBSD: patch-wmeyes_c,v 1.1.1.1 2001/01/13 16:12:04 naddy Exp $ --- wmeyes.c.orig Sun May 24 03:44:25 1998 +++ wmeyes.c Fri Jan 12 15:04:09 2001 @@ -1,9 +1,9 @@ #include #include +#include #include #include #include -#include #include #include @@ -74,7 +74,7 @@ void update(); void scanArgs(int argc,char *argv[]); unsigned long getColor(char *colorName); -void do_nothing(void) +void do_nothing(int a) { } @@ -318,23 +318,11 @@ void update() void scanArgs(int argc, char *argv[]) { int c; - int opt_index; bool helpflag = FALSE; bool errflag = FALSE; - static struct option long_opts[] = { - {"help", no_argument, NULL, 'h'}, - {"withdrawn", no_argument, NULL, 'w'}, - {"shape", no_argument, NULL, 's'}, - {"pupil", required_argument, NULL, 'p'}, - {"outside", required_argument, NULL, 'o'}, - {"inside", required_argument, NULL, 'i'}, - {"time", required_argument, NULL, 't'}, - {"display", required_argument, NULL, 'd'}}; - while(1) { - opt_index = 0; - c = getopt_long_only(argc, argv, "hwsp:o:i:d:", long_opts, &opt_index); + c = getopt(argc, argv, "hwsp:o:i:d:t:"); if (c == -1) { break; } @@ -349,23 +337,19 @@ void scanArgs(int argc, char *argv[]) ushape = TRUE; break; case 'p': - strncpy(eyecol, optarg, 255); - eyecol[255] = '\0'; + strlcpy(eyecol, optarg, sizeof(eyecol)); break; case 'o': - strncpy(outcol, optarg, 255); - outcol[255] = '\0'; + strlcpy(outcol, optarg, sizeof(outcol)); break; case 'i': - strncpy(incol, optarg, 255); - incol[255] = '\0'; + strlcpy(incol, optarg, sizeof(incol)); break; case 't': repmsec = atol(optarg); break; case 'd': - strncpy(dispname, optarg, 255); - dispname[255] = '\0'; + strlcpy(dispname, optarg, sizeof(dispname)); break; default: errflag = TRUE; @@ -373,23 +357,22 @@ void scanArgs(int argc, char *argv[]) } } if (errflag) { - fprintf(stderr, "Usage: %s [-h] [-ws] [-p pupclr] [-o outclr] [-i inclr] [-display disp]\n", argv[0]); + fprintf(stderr, "Usage: %s [-h] [-w] [-s] [-p pupclr] [-o outclr] [-i inclr] [-d disp] [-t time]\n", argv[0]); exit(1); } if (helpflag) { fprintf(stderr,"WMeyes 1.0 - The world's most useless WindowMaker dock app.\n"); fprintf(stderr,"by Bryan Feir (jenora@istar.ca)\n\n"); fprintf(stderr,"Usage: %s [-h] [-ws] [-p pupclr] [-o outclr] [-i inclr] [-display disp]\n", argv[0]); - fprintf(stderr,"short long argument description\n"); - fprintf(stderr," -h --help display this help screen\n"); - fprintf(stderr," -w --withdrawn withdraw window (for WindowMaker)\n"); - fprintf(stderr," -s --shape use shaped window\n"); - fprintf(stderr," -p --pupil pupclr set the colour of the eyes' pupils (default %s)\n", EYECOLOR); - fprintf(stderr," -o --outside outclr set the outside colour of the eyes (default %s)\n", OUTCOLOR); - fprintf(stderr," -i --inside inclr set the inside colour of the eyes (default %s)\n", INCOLOR); - fprintf(stderr," -t --time msec set the interation time in msec (default %d)\n", REPTIME); - fprintf(stderr," -d --display disp set the X display to use\n"); - fprintf(stderr," -display disp set the X display to use\n"); + fprintf(stderr,"argument description\n"); + fprintf(stderr," -h display this help screen\n"); + fprintf(stderr," -w withdraw window (for WindowMaker)\n"); + fprintf(stderr," -s use shaped window\n"); + fprintf(stderr," -p pupclr set the colour of the eyes' pupils (default %s)\n", EYECOLOR); + fprintf(stderr," -o outclr set the outside colour of the eyes (default %s)\n", OUTCOLOR); + fprintf(stderr," -i inclr set the inside colour of the eyes (default %s)\n", INCOLOR); + fprintf(stderr," -t msec set the interation time in msec (default %d)\n", REPTIME); + fprintf(stderr," -d disp set the X display to use\n"); exit(0); } }