[BusyBox-cvs] busybox/findutils find.c,1.37,1.38 grep.c,1.76,1.77 xargs.c,1.24,1.25

Manuel Novoa III mjn3 at busybox.net
Wed Mar 19 09:13:25 UTC 2003


Update of /var/cvs/busybox/findutils
In directory winder:/home/mjn3/work/busybox/findutils

Modified Files:
	find.c grep.c xargs.c 
Log Message:
Major coreutils update.


Index: find.c
===================================================================
RCS file: /var/cvs/busybox/findutils/find.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- find.c	23 Jan 2003 05:27:42 -0000	1.37
+++ find.c	19 Mar 2003 09:11:49 -0000	1.38
@@ -167,7 +167,7 @@
 	}
 
 	if (mask == 0 || type[1] != '\0')
-		error_msg_and_die(msg_invalid_arg, type, "-type");
+		bb_error_msg_and_die(msg_invalid_arg, type, "-type");
 
 	return mask;
 }
@@ -192,22 +192,22 @@
 			}
 		else if (strcmp(argv[i], "-name") == 0) {
 			if (++i == argc)
-				error_msg_and_die(msg_req_arg, "-name");
+				bb_error_msg_and_die(msg_req_arg, "-name");
 			pattern = argv[i];
 #ifdef CONFIG_FEATURE_FIND_TYPE
 		} else if (strcmp(argv[i], "-type") == 0) {
 			if (++i == argc)
-				error_msg_and_die(msg_req_arg, "-type");
+				bb_error_msg_and_die(msg_req_arg, "-type");
 			type_mask = find_type(argv[i]);
 #endif
 #ifdef CONFIG_FEATURE_FIND_PERM
 		} else if (strcmp(argv[i], "-perm") == 0) {
 			char *end;
 			if (++i == argc)
-				error_msg_and_die(msg_req_arg, "-perm");
+				bb_error_msg_and_die(msg_req_arg, "-perm");
 			perm_mask = strtol(argv[i], &end, 8);
 			if ((end[0] != '\0') || (perm_mask > 07777))
-				error_msg_and_die(msg_invalid_arg, argv[i], "-perm");
+				bb_error_msg_and_die(msg_invalid_arg, argv[i], "-perm");
 			if ((perm_char = argv[i][0]) == '-')
 				perm_mask = -perm_mask;
 #endif
@@ -215,10 +215,10 @@
 		} else if (strcmp(argv[i], "-mtime") == 0) {
 			char *end;
 			if (++i == argc)
-				error_msg_and_die(msg_req_arg, "-mtime");
+				bb_error_msg_and_die(msg_req_arg, "-mtime");
 			mtime_days = strtol(argv[i], &end, 10);
 			if (end[0] != '\0')
-				error_msg_and_die(msg_invalid_arg, argv[i], "-mtime");
+				bb_error_msg_and_die(msg_invalid_arg, argv[i], "-mtime");
 			if ((mtime_char = argv[i][0]) == '-')
 				mtime_days = -mtime_days;
 #endif
@@ -231,14 +231,14 @@
 
 			if ( firstopt == 1 ) {
 				if ( stat ( ".", &stbuf ) < 0 )
-					error_msg_and_die("could not stat '.'" );
+					bb_error_msg_and_die("could not stat '.'" );
 				xdev_dev [0] = stbuf. st_dev;
 			}
 			else {
 			
 				for (i = 1; i < firstopt; i++) {
 					if ( stat ( argv [i], &stbuf ) < 0 )
-						error_msg_and_die("could not stat '%s'", argv [i] );
+						bb_error_msg_and_die("could not stat '%s'", argv [i] );
 					xdev_dev [i-1] = stbuf. st_dev;
 				}
 			}						
@@ -247,22 +247,22 @@
 		} else if (strcmp(argv[i], "-newer") == 0) {
 			struct stat stat_newer;
 			if (++i == argc)
-				error_msg_and_die(msg_req_arg, "-newer");
+				bb_error_msg_and_die(msg_req_arg, "-newer");
 		    if (stat (argv[i], &stat_newer) != 0)
-				error_msg_and_die("file %s not found", argv[i]);
+				bb_error_msg_and_die("file %s not found", argv[i]);
 			newer_mtime = stat_newer.st_mtime;
 #endif
 #ifdef CONFIG_FEATURE_FIND_INUM
 		} else if (strcmp(argv[i], "-inum") == 0) {
 			char *end;
 			if (++i == argc)
-				error_msg_and_die(msg_req_arg, "-inum");
+				bb_error_msg_and_die(msg_req_arg, "-inum");
 			inode_num = strtol(argv[i], &end, 10);
 			if (end[0] != '\0')
-				error_msg_and_die(msg_invalid_arg, argv[i], "-inum");
+				bb_error_msg_and_die(msg_invalid_arg, argv[i], "-inum");
 #endif
 		} else
-			show_usage();
+			bb_show_usage();
 	}
 
 	if (firstopt == 1) {

Index: grep.c
===================================================================
RCS file: /var/cvs/busybox/findutils/grep.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- grep.c	28 Nov 2002 11:27:25 -0000	1.76
+++ grep.c	19 Mar 2003 09:11:49 -0000	1.77
@@ -88,8 +88,7 @@
 	int idx = 0; /* used for iteration through the circular buffer */
 #endif /* CONFIG_FEATURE_GREP_CONTEXT */ 
 
-	while ((line = get_line_from_file(file)) != NULL) {
-		chomp(line);
+	while ((line = bb_get_chomped_line_from_file(file)) != NULL) {
 		linenum++;
 
 		for (i = 0; i < nregexes; i++) {
@@ -154,7 +153,7 @@
 				/* Add the line to the circular 'before' buffer */
 				if(lines_before) {
 					free(before_buf[curpos]);
-					before_buf[curpos] = xstrdup(line);
+					before_buf[curpos] = bb_xstrdup(line);
 					curpos = (curpos + 1) % lines_before;
 				}
 			}
@@ -205,9 +204,8 @@
 static void	load_regexes_from_file(const char *filename)
 {
 	char *line;
-	FILE *f = xfopen(filename, "r");
-	while ((line = get_line_from_file(f)) != NULL) {
-		chomp(line);
+	FILE *f = bb_xfopen(filename, "r");
+	while ((line = bb_get_chomped_line_from_file(f)) != NULL) {
 		add_regex(line);
 		free(line);
 	}
@@ -242,7 +240,7 @@
 #endif
 
 #ifdef CONFIG_FEATURE_GREP_EGREP_ALIAS
-	if (strcmp(get_last_path_component(argv[0]), "egrep") == 0)
+	if (strcmp(bb_get_last_path_component(argv[0]), "egrep") == 0)
 		reflags |= REG_EXTENDED;
 #endif
 
@@ -298,23 +296,23 @@
 			case 'A':
 				lines_after = strtoul(optarg, &junk, 10);
 				if(*junk != '\0')
-					error_msg_and_die("invalid context length argument");
+					bb_error_msg_and_die("invalid context length argument");
 				break;
 			case 'B':
 				lines_before = strtoul(optarg, &junk, 10);
 				if(*junk != '\0')
-					error_msg_and_die("invalid context length argument");
+					bb_error_msg_and_die("invalid context length argument");
 				before_buf = (char **)xcalloc(lines_before, sizeof(char *));
 				break;
 			case 'C':
 				lines_after = lines_before = strtoul(optarg, &junk, 10);
 				if(*junk != '\0')
-					error_msg_and_die("invalid context length argument");
+					bb_error_msg_and_die("invalid context length argument");
 				before_buf = (char **)xcalloc(lines_before, sizeof(char *));
 				break;
 #endif /* CONFIG_FEATURE_GREP_CONTEXT */
 			default:
-				show_usage();
+				bb_show_usage();
 		}
 	}
 
@@ -322,7 +320,7 @@
 	 * argv[optind] should be the pattern. no pattern, no worky */
 	if (nregexes == 0) {
 		if (argv[optind] == NULL)
-			show_usage();
+			bb_show_usage();
 		else {
 			add_regex(argv[optind]);
 			optind++;
@@ -356,7 +354,7 @@
 			file = fopen(cur_file, "r");
 			if (file == NULL) {
 				if (!suppress_err_msgs)
-					perror_msg("%s", cur_file);
+					bb_perror_msg("%s", cur_file);
 			}
 			else {
 				grep_file(file);

Index: xargs.c
===================================================================
RCS file: /var/cvs/busybox/findutils/xargs.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- xargs.c	10 Nov 2002 21:47:15 -0000	1.24
+++ xargs.c	19 Mar 2003 09:11:49 -0000	1.25
@@ -53,11 +53,11 @@
 			wait(NULL);
 			if(common[0]) {
 				errno = common[0];
-				perror_msg_and_die("%s", args[0]);
+				bb_perror_msg_and_die("%s", args[0]);
 			}
 		}
 	} else {
-		perror_msg_and_die("vfork");
+		bb_perror_msg_and_die("vfork");
 	}
 }
 
@@ -81,7 +81,7 @@
 				flg_no_empty = 1;
 				break;
 			default:
-				show_usage();
+				bb_show_usage();
 		}
 	}
 
@@ -101,9 +101,7 @@
 
 	/* Now, read in one line at a time from stdin, and store this 
 	 * line to be used later as an argument to the command */
-	while ((file_to_act_on = get_line_from_file(stdin)) != NULL) {
-		/* eat the newline off the filename. */
-		chomp(file_to_act_on);
+	while ((file_to_act_on = bb_get_chomped_line_from_file(stdin)) != NULL) {
 		if(file_to_act_on[0] != 0 || flg_no_empty == 0) {
 			args[a] = file_to_act_on[0] ? file_to_act_on : NULL;
 			if(flg_vi) {
@@ -114,7 +112,7 @@
 				}
 				fprintf(stderr, "%s", ((flg_vi & 2) ? " ?..." : "\n"));
 			}
-			if((flg_vi & 2) == 0 || ask_confirmation() != 0 ) {
+			if((flg_vi & 2) == 0 || bb_ask_confirmation() != 0 ) {
 				xargs_exec(args);
 			}
 		}




More information about the busybox-cvs mailing list