aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/posixregex.c
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2010-01-18 20:00:03 -0900
committerDavid M. Syzdek <david@syzdek.net>2010-01-18 20:00:03 -0900
commit162311eddc8c40501988a5d36567b31590431f3b (patch)
tree3255c7a201b19959c848b098b021962fc60a6128 /src/posixregex.c
parent6aa7d3bb93e37e31f2602044823e86ede7d6705d (diff)
downloaddmstools-162311eddc8c40501988a5d36567b31590431f3b.tar.gz
dmstools-162311eddc8c40501988a5d36567b31590431f3b.tar.bz2
dmstools-162311eddc8c40501988a5d36567b31590431f3b.tar.xz
dmstools-162311eddc8c40501988a5d36567b31590431f3b.zip
Fixing compiler warnings in posixregex.
Diffstat (limited to 'src/posixregex.c')
-rw-r--r--src/posixregex.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/posixregex.c b/src/posixregex.c
index 44d7b71..824df93 100644
--- a/src/posixregex.c
+++ b/src/posixregex.c
@@ -173,7 +173,7 @@ int main(int argc, char * argv[])
173 int y; 173 int y;
174 int err; 174 int err;
175 int code; 175 int code;
176 int strlen; 176 int str_len;
177 int quiet; 177 int quiet;
178 int verbosity; 178 int verbosity;
179 int opt_index; 179 int opt_index;
@@ -260,7 +260,7 @@ int main(int argc, char * argv[])
260 printf("regex: %s\n",restr); 260 printf("regex: %s\n",restr);
261 if ((err = regcomp(&regex, restr, REG_EXTENDED|REG_ICASE))) 261 if ((err = regcomp(&regex, restr, REG_EXTENDED|REG_ICASE)))
262 { 262 {
263 regerror(err, &regex, msg, BUFFER_SIZE-1); 263 regerror(err, &regex, msg, (size_t)BUFFER_SIZE-1);
264 printf("%s\n", msg); 264 printf("%s\n", msg);
265 return(1); 265 return(1);
266 }; 266 };
@@ -272,12 +272,12 @@ int main(int argc, char * argv[])
272 for (x = optind; x < argc; x++) 272 for (x = optind; x < argc; x++)
273 { 273 {
274 /* copies string into buffer and prints to screen */ 274 /* copies string into buffer and prints to screen */
275 strncpy(arg, argv[x], BUFFER_SIZE-1); 275 strncpy(arg, argv[x], (size_t)BUFFER_SIZE-1);
276 if (!(quiet)) 276 if (!(quiet))
277 printf("%3i: %s ==> ", x-optind+1, arg); 277 printf("%3i: %s ==> ", x-optind+1, arg);
278 278
279 /* tests the buffer against the regular expression */ 279 /* tests the buffer against the regular expression */
280 if ((err = regexec(&regex, arg, MAX_MATCHES, matches, 0))) 280 if ((err = regexec(&regex, arg, (size_t)MAX_MATCHES, matches, 0)))
281 { 281 {
282 if (!(quiet)) 282 if (!(quiet))
283 printf("not found\n"); 283 printf("not found\n");
@@ -285,17 +285,17 @@ int main(int argc, char * argv[])
285 } else { 285 } else {
286 if (!(quiet)) 286 if (!(quiet))
287 printf(" found\n"); 287 printf(" found\n");
288 strlen = 1; 288 str_len = 1;
289 289
290 /* copies sub matches in buffer string */ 290 /* copies sub matches in buffer string */
291 if (verbosity) 291 if (verbosity)
292 { 292 {
293 for(y = 0; ((y < MAX_MATCHES) && (matches[y].rm_eo > -1)); y++) 293 for(y = 0; ((y < MAX_MATCHES) && (matches[y].rm_eo > -1)); y++)
294 { 294 {
295 memset(str, 0, BUFFER_SIZE); 295 memset(str, 0, (size_t)BUFFER_SIZE);
296 if ((strlen = matches[y].rm_eo - matches[y].rm_so)) 296 if ((str_len = matches[y].rm_eo - matches[y].rm_so))
297 { 297 {
298 strncpy(str, &arg[matches[y].rm_so], strlen); 298 strncpy(str, &arg[matches[y].rm_so], (size_t)str_len);
299 printf(" submatch %i: %s\n", y, str); 299 printf(" submatch %i: %s\n", y, str);
300 } else if (matches[y].rm_eo > 0) { 300 } else if (matches[y].rm_eo > 0) {
301 printf(" submatch %i:\n", y); 301 printf(" submatch %i:\n", y);