wmfsm: Add -a command line option to select appearance at runtime.
Also update Makefile to install appearance XPMs during "make install".
This commit is contained in:
		
							parent
							
								
									fa0bdfaeba
								
							
						
					
					
						commit
						d9d5dd1343
					
				
					 3 changed files with 28 additions and 3 deletions
				
			
		| 
						 | 
					@ -6,6 +6,8 @@ wmfsm_SOURCES = wmfsm.c getopt.c getopt1.c getopt.h
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
wmfsm_LDADD = ../wmgeneral/libwmgeneral.a @LIBS@ @X11LIBS@ @X_LIBS@ @X_EXTRA_LIBS@
 | 
					wmfsm_LDADD = ../wmgeneral/libwmgeneral.a @LIBS@ @X11LIBS@ @X_LIBS@ @X_EXTRA_LIBS@
 | 
				
			||||||
man_MANS = wmfsm.1
 | 
					man_MANS = wmfsm.1
 | 
				
			||||||
EXTRA_DIST = $(man_MANS) wmfsm_master_highcolor.xpm wmfsm_master_cyan.xpm wmfsm_master_lowcolor.xpm wmfsm_mask.xbm wmfsmrc.sample
 | 
					dist_pkgdata_DATA = wmfsm_master_highcolor.xpm wmfsm_master_cyan.xpm \
 | 
				
			||||||
 | 
						wmfsm_master_lowcolor.xpm
 | 
				
			||||||
 | 
					EXTRA_DIST = $(man_MANS) wmfsm_mask.xbm wmfsmrc.sample
 | 
				
			||||||
CLEANFILES = wmfsm_master.xpm
 | 
					CLEANFILES = wmfsm_master.xpm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,6 +34,9 @@ Draw on the specified display.
 | 
				
			||||||
.IP "\fB\-d\fP, \fB\-\-delay\fP 	" 10
 | 
					.IP "\fB\-d\fP, \fB\-\-delay\fP 	" 10
 | 
				
			||||||
Wait the specified number of milliseconds to redraw
 | 
					Wait the specified number of milliseconds to redraw
 | 
				
			||||||
the window.
 | 
					the window.
 | 
				
			||||||
 | 
					.IP "\fB\-a\fP, \fB\-\-appearance\fP    " 10
 | 
				
			||||||
 | 
					Select an appearance file.  Note that these files may be found in the wmfsm
 | 
				
			||||||
 | 
					data directory, likely /usr/local/share/wmfsm or /usr/share/wmfsm.
 | 
				
			||||||
.SH "FILES"
 | 
					.SH "FILES"
 | 
				
			||||||
.PP
 | 
					.PP
 | 
				
			||||||
You may exclude filesystems from being show by wmfsm
 | 
					You may exclude filesystems from being show by wmfsm
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -125,6 +125,7 @@ int blinkper = 95;
 | 
				
			||||||
char dummy[4096];
 | 
					char dummy[4096];
 | 
				
			||||||
char *myName;
 | 
					char *myName;
 | 
				
			||||||
int delay = DELAY_10;
 | 
					int delay = DELAY_10;
 | 
				
			||||||
 | 
					char appearance[256] = "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int xpos[] = { 66, 71, 76, 81, 86, 91,	/* A B C D E F */
 | 
					int xpos[] = { 66, 71, 76, 81, 86, 91,	/* A B C D E F */
 | 
				
			||||||
	66, 71, 76, 81, 86, 91,	/* G H I J K L */
 | 
						66, 71, 76, 81, 86, 91,	/* G H I J K L */
 | 
				
			||||||
| 
						 | 
					@ -162,8 +163,10 @@ main(int argc, char *argv[])
 | 
				
			||||||
	int dx, dy;
 | 
						int dx, dy;
 | 
				
			||||||
	char hostname[100];
 | 
						char hostname[100];
 | 
				
			||||||
	int i, j, k;
 | 
						int i, j, k;
 | 
				
			||||||
 | 
						int xpm_free = 0;
 | 
				
			||||||
	int c, on[9] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 };
 | 
						int c, on[9] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 };
 | 
				
			||||||
	struct statfs buffer;
 | 
						struct statfs buffer;
 | 
				
			||||||
 | 
						char **pixmap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 *  Parse any command line arguments.
 | 
						 *  Parse any command line arguments.
 | 
				
			||||||
| 
						 | 
					@ -171,9 +174,21 @@ main(int argc, char *argv[])
 | 
				
			||||||
	myName = strdup(argv[0]);
 | 
						myName = strdup(argv[0]);
 | 
				
			||||||
	ParseCMDLine(argc, argv);
 | 
						ParseCMDLine(argc, argv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (appearance[0] == 0) {
 | 
				
			||||||
 | 
							pixmap = wmfsm_master_xpm;
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							if (XpmReadFileToData(appearance, &pixmap) != XpmSuccess) {
 | 
				
			||||||
 | 
								fprintf(stderr, "warning: could not read appearance file; using default.\n");
 | 
				
			||||||
 | 
								pixmap = wmfsm_master_xpm;
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								xpm_free = 1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	openXwindow(argc, argv, wmfsm_master_xpm, wmfsm_mask_bits, wmfsm_mask_width, wmfsm_mask_height);
 | 
						openXwindow(argc, argv, pixmap, wmfsm_mask_bits, wmfsm_mask_width, wmfsm_mask_height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (xpm_free)
 | 
				
			||||||
 | 
							XpmFree(pixmap);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef SVR4
 | 
					#ifndef SVR4
 | 
				
			||||||
	if (gethostname(hostname, 100) != 0) {
 | 
						if (gethostname(hostname, 100) != 0) {
 | 
				
			||||||
| 
						 | 
					@ -401,16 +416,20 @@ ParseCMDLine(int argc, char *argv[])
 | 
				
			||||||
		{"blink", no_argument, &blink, 1},
 | 
							{"blink", no_argument, &blink, 1},
 | 
				
			||||||
		{"noblink", no_argument, &blink, 0},
 | 
							{"noblink", no_argument, &blink, 0},
 | 
				
			||||||
		{"delay", required_argument, 0, 'd'},
 | 
							{"delay", required_argument, 0, 'd'},
 | 
				
			||||||
 | 
							{"appearance", required_argument, 0, 'a'},
 | 
				
			||||||
		{"help", no_argument, 0, 'h'},
 | 
							{"help", no_argument, 0, 'h'},
 | 
				
			||||||
		{0, 0, 0, 0}
 | 
							{0, 0, 0, 0}
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	while (1) {
 | 
						while (1) {
 | 
				
			||||||
		c = getopt_long(argc, argv, "bd:fhn", long_options, &option_index);
 | 
							c = getopt_long(argc, argv, "a:bd:fhn", long_options, &option_index);
 | 
				
			||||||
		if (c == -1)
 | 
							if (c == -1)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		switch (c) {
 | 
							switch (c) {
 | 
				
			||||||
		case 0:	/* If blink or noblink was toggled */
 | 
							case 0:	/* If blink or noblink was toggled */
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
							case 'a':
 | 
				
			||||||
 | 
								strcpy(appearance, optarg);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
		case 'b':
 | 
							case 'b':
 | 
				
			||||||
			blink = 1;
 | 
								blink = 1;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
| 
						 | 
					@ -447,6 +466,7 @@ print_usage()
 | 
				
			||||||
	printf("\t--[no]blink\t\tBlinks if a filesystem is 95 percent full.\n");
 | 
						printf("\t--[no]blink\t\tBlinks if a filesystem is 95 percent full.\n");
 | 
				
			||||||
	printf("\t-display <Display>\tUse alternate X display.\n");
 | 
						printf("\t-display <Display>\tUse alternate X display.\n");
 | 
				
			||||||
	printf("\t--delay <number>, -d\tUse a delay that is not the default.\n");
 | 
						printf("\t--delay <number>, -d\tUse a delay that is not the default.\n");
 | 
				
			||||||
 | 
						printf("\t--appearance <file>, -a\tSelect an appearance file.\n");
 | 
				
			||||||
	printf("\t-h\t\t\tDisplay help screen.\n");
 | 
						printf("\t-h\t\t\tDisplay help screen.\n");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue