aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/posixregex.c
diff options
context:
space:
mode:
authorDavid M. Syzdek <syzdek@bindlebinaries.com>2012-06-04 15:20:51 -0800
committerDavid M. Syzdek <syzdek@bindlebinaries.com>2012-06-04 15:20:51 -0800
commitde596419efd89a8d6bd22d12a18be714dd520d69 (patch)
tree9b41fd66ba428f7c7b403d1575ba80bfa8ca42f6 /src/posixregex.c
parent81dabd10dbe3a48c3eec93a32aaa6c3ec065b86a (diff)
downloaddmstools-de596419efd89a8d6bd22d12a18be714dd520d69.tar.gz
dmstools-de596419efd89a8d6bd22d12a18be714dd520d69.tar.bz2
dmstools-de596419efd89a8d6bd22d12a18be714dd520d69.tar.xz
dmstools-de596419efd89a8d6bd22d12a18be714dd520d69.zip
Adding checks to posixregex for incompatible options.
Diffstat (limited to 'src/posixregex.c')
-rw-r--r--src/posixregex.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/posixregex.c b/src/posixregex.c
index ede4470..b0d906a 100644
--- a/src/posixregex.c
+++ b/src/posixregex.c
@@ -163,6 +163,9 @@ void my_posixregex PARAMS((void));
163// displays usage 163// displays usage
164void my_usage PARAMS((void)); 164void my_usage PARAMS((void));
165 165
166// display incompatible usage
167void my_usage_incompatible PARAMS((char x, char y));
168
166// displays usage 169// displays usage
167void my_version PARAMS((void)); 170void my_version PARAMS((void));
168 171
@@ -231,7 +234,6 @@ int main(int argc, char * argv[])
231 return(0); 234 return(0);
232 case 'q': 235 case 'q':
233 quiet = 1; 236 quiet = 1;
234 verbosity = 0;
235 break; 237 break;
236 case 'r': 238 case 'r':
237 restr = optarg; 239 restr = optarg;
@@ -240,7 +242,6 @@ int main(int argc, char * argv[])
240 my_version(); 242 my_version();
241 return(0); 243 return(0);
242 case 'v': 244 case 'v':
243 quiet = 0;
244 verbosity++; 245 verbosity++;
245 break; 246 break;
246 case '?': 247 case '?':
@@ -255,6 +256,13 @@ int main(int argc, char * argv[])
255 }; 256 };
256 }; 257 };
257 258
259 // check for incompatible options
260 if ( ((verbosity)) && ((quiet)) )
261 {
262 my_usage_incompatible('v', 'q');
263 return(1);
264 };
265
258 if (!(restr)) 266 if (!(restr))
259 restr = getenv("POSIXREGEX"); 267 restr = getenv("POSIXREGEX");
260 if (!(restr)) 268 if (!(restr))
@@ -379,6 +387,19 @@ void my_usage(void)
379} 387}
380 388
381 389
390/// display incompatible usage
391void my_usage_incompatible(char x, char y)
392{
393 fprintf(stderr,
394 _(
395 "%s: incompatible options `-%c' and `-%c'\n"
396 "Try `%s --help' for more information.\n"
397 ), PROGRAM_NAME, x, y, PROGRAM_NAME
398 );
399 return;
400}
401
402
382/// displays version 403/// displays version
383void my_version(void) 404void my_version(void)
384{ 405{