mirror of
				https://github.com/osmarks/ngircd.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	Add option aliases -V (for --version) and -h (for --help).
This patch adds -h and -V short options (to complement the usage). It is based on a patch attached to Debian bug #466063, see <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=466063>. Idea by Jari Aalto <jari.aalto@cante.net>, patch adapted by Alexander Barton <alex@barton.de>.
This commit is contained in:
		 Jari Aalto
					Jari Aalto
				
			
				
					committed by
					
						 Alexander Barton
						Alexander Barton
					
				
			
			
				
	
			
			
			 Alexander Barton
						Alexander Barton
					
				
			
						parent
						
							1d9067b019
						
					
				
				
					commit
					818a206a42
				
			| @@ -50,10 +50,10 @@ CONNECT later on as IRC Operator to link this ngIRCd to other servers. | |||||||
| \fB\-t\fR, \fB\-\-configtest\fR | \fB\-t\fR, \fB\-\-configtest\fR | ||||||
| Read, validate and display the configuration; then exit. | Read, validate and display the configuration; then exit. | ||||||
| .TP | .TP | ||||||
| \fB\-\-version\fR | \fB\-V\fR, \fB\-\-version\fR | ||||||
| Output version information and exit. | Output version information and exit. | ||||||
| .TP | .TP | ||||||
| \fB\-\-help\fR | \fB\-h\fR, \fB\-\-help\fR | ||||||
| Display a brief help text and exit. | Display a brief help text and exit. | ||||||
| .SH FILES | .SH FILES | ||||||
| .I :ETCDIR:/ngircd.conf | .I :ETCDIR:/ngircd.conf | ||||||
|   | |||||||
| @@ -166,14 +166,12 @@ main( int argc, const char *argv[] ) | |||||||
| 			{ | 			{ | ||||||
| 				ok = false; | 				ok = false; | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
| 				if( argv[i][n] == 'd' ) | 				if (argv[i][n] == 'd') { | ||||||
| 				{ |  | ||||||
| 					NGIRCd_Debug = true; | 					NGIRCd_Debug = true; | ||||||
| 					ok = true; | 					ok = true; | ||||||
| 				} | 				} | ||||||
| #endif | #endif | ||||||
| 				if( argv[i][n] == 'f' ) | 				if (argv[i][n] == 'f') { | ||||||
| 				{ |  | ||||||
| 					if(( ! argv[i][n + 1] ) && ( i + 1 < argc )) | 					if(( ! argv[i][n + 1] ) && ( i + 1 < argc )) | ||||||
| 					{ | 					{ | ||||||
| 						/* Ok, next character is a blank */ | 						/* Ok, next character is a blank */ | ||||||
| @@ -185,31 +183,38 @@ main( int argc, const char *argv[] ) | |||||||
| 						ok = true; | 						ok = true; | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				if( argv[i][n] == 'n' ) |  | ||||||
| 				{ | 				if (argv[i][n] == 'h') { | ||||||
|  | 					Show_Version(); | ||||||
|  | 					puts(""); Show_Help(); puts(""); | ||||||
|  | 					exit(1); | ||||||
|  | 				} | ||||||
|  |  | ||||||
|  | 				if (argv[i][n] == 'n') { | ||||||
| 					NGIRCd_NoDaemon = true; | 					NGIRCd_NoDaemon = true; | ||||||
| 					ok = true; | 					ok = true; | ||||||
| 				} | 				} | ||||||
| 				if( argv[i][n] == 'p' ) | 				if (argv[i][n] == 'p') { | ||||||
| 				{ |  | ||||||
| 					NGIRCd_Passive = true; | 					NGIRCd_Passive = true; | ||||||
| 					ok = true; | 					ok = true; | ||||||
| 				} | 				} | ||||||
| #ifdef SNIFFER | #ifdef SNIFFER | ||||||
| 				if( argv[i][n] == 's' ) | 				if (argv[i][n] == 's') { | ||||||
| 				{ |  | ||||||
| 					NGIRCd_Sniffer = true; | 					NGIRCd_Sniffer = true; | ||||||
| 					ok = true; | 					ok = true; | ||||||
| 				} | 				} | ||||||
| #endif | #endif | ||||||
| 				if( argv[i][n] == 't' ) | 				if (argv[i][n] == 't') { | ||||||
| 				{ |  | ||||||
| 					configtest = true; | 					configtest = true; | ||||||
| 					ok = true; | 					ok = true; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				if( ! ok ) | 				if (argv[i][n] == 'V') { | ||||||
| 				{ | 					Show_Version(); | ||||||
|  | 					exit(1); | ||||||
|  | 				} | ||||||
|  |  | ||||||
|  | 				if (! ok) { | ||||||
| 					printf( "%s: invalid option \"-%c\"!\n", PACKAGE_NAME, argv[i][n] ); | 					printf( "%s: invalid option \"-%c\"!\n", PACKAGE_NAME, argv[i][n] ); | ||||||
| 					printf( "Try \"%s --help\" for more information.\n", PACKAGE_NAME ); | 					printf( "Try \"%s --help\" for more information.\n", PACKAGE_NAME ); | ||||||
| 					exit( 1 ); | 					exit( 1 ); | ||||||
| @@ -577,8 +582,8 @@ Show_Help( void ) | |||||||
| 	puts( "  -s, --sniffer      enable network sniffer and display all IRC traffic" ); | 	puts( "  -s, --sniffer      enable network sniffer and display all IRC traffic" ); | ||||||
| #endif | #endif | ||||||
| 	puts( "  -t, --configtest   read, validate and display configuration; then exit" ); | 	puts( "  -t, --configtest   read, validate and display configuration; then exit" ); | ||||||
|  	puts( "      --version      output version information and exit" ); | 	puts( "  -V, --version      output version information and exit" ); | ||||||
| 	puts( "      --help         display this help and exit" ); | 	puts( "  -h, --help         display this help and exit" ); | ||||||
| } /* Show_Help */ | } /* Show_Help */ | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user