[BusyBox-cvs] busybox/shell ash.c,1.68,1.69 cmdedit.c,1.77,1.78 hush.c,1.61,1.62 lash.c,1.149,1.150 msh.c,1.12,1.13

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


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

Modified Files:
	ash.c cmdedit.c hush.c lash.c msh.c 
Log Message:
Major coreutils update.


Index: ash.c
===================================================================
RCS file: /var/cvs/busybox/shell/ash.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- ash.c	14 Jan 2003 06:40:11 -0000	1.68
+++ ash.c	19 Mar 2003 09:12:52 -0000	1.69
@@ -1329,13 +1329,13 @@
 		if (!(ap->flag & ALIASINUSE)) {
 			free(ap->val);
 		}
-		ap->val = xstrdup(val);
+		ap->val = bb_xstrdup(val);
 		ap->flag &= ~ALIASDEAD;
 	} else {
 		/* not found */
 		ap = xmalloc(sizeof(struct alias));
-		ap->name = xstrdup(name);
-		ap->val = xstrdup(val);
+		ap->name = bb_xstrdup(name);
+		ap->val = bb_xstrdup(val);
 		ap->flag = 0;
 		ap->next = 0;
 		*app = ap;
@@ -1829,7 +1829,7 @@
 	if (!val)
 		getpwd();
 	else
-		curdir = simplify_path(val);
+		curdir = bb_simplify_path(val);
 	if (cated)
 		free(cated);
 	INTON;
@@ -3285,7 +3285,7 @@
 	char *name = cmd;
 
 #ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN
-	name = get_last_path_component(name);
+	name = bb_get_last_path_component(name);
 	if(find_applet_by_name(name) != NULL)
 		flg_bb = 1;
 #else
@@ -7552,7 +7552,7 @@
 	exitstatus = 0;
 
 	for (sp = cmdenviron; sp; sp = sp->next)
-		setvareq(xstrdup(sp->text), VSTRFIXED | VTEXTFIXED);
+		setvareq(bb_xstrdup(sp->text), VSTRFIXED | VTEXTFIXED);
 
 	if (argc >= 2) {	/* That's what SVR2 does */
 		char *fullname;
@@ -7950,7 +7950,7 @@
 			umask(mask);
 		} else {
 			mask = ~mask & 0777;
-			if (!parse_mode(ap, &mask)) {
+			if (!bb_parse_mode(ap, &mask)) {
 				error("Illegal mode: %s", ap);
 			}
 			umask(~mask & 0777);
@@ -8795,7 +8795,7 @@
 	for (nparam = 0; argv[nparam]; nparam++);
 	ap = newparam = xmalloc((nparam + 1) * sizeof *ap);
 	while (*argv) {
-		*ap++ = xstrdup(*argv++);
+		*ap++ = bb_xstrdup(*argv++);
 	}
 	*ap = NULL;
 	freeparam(&shellparam);
@@ -11429,7 +11429,7 @@
 #else
 	strcpy(s, "./trace");
 #endif							/* not_this_way */
-	if ((tracefile = wfopen(s, "a")) == NULL)
+	if ((tracefile = bb_wfopen(s, "a")) == NULL)
 		return;
 #ifdef O_APPEND
 	if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0)
@@ -11482,7 +11482,7 @@
 			if (action[0] == '-' && action[1] == '\0')
 				action = NULL;
 			else
-				action = xstrdup(action);
+				action = bb_xstrdup(action);
 		}
 		free(trap[signo]);
 		trap[signo] = action;
@@ -11700,7 +11700,7 @@
 			vpp = hashvar(ip->text);
 			vp->next = *vpp;
 			*vpp = vp;
-			vp->text = xstrdup(ip->text);
+			vp->text = bb_xstrdup(ip->text);
 			vp->flags = ip->flags;
 			vp->func = ip->func;
 		}
@@ -11713,7 +11713,7 @@
 		vpp = hashvar("PS1=$ ");
 		vps1.next = *vpp;
 		*vpp = &vps1;
-		vps1.text = xstrdup(geteuid()? "PS1=$ " : "PS1=# ");
+		vps1.text = bb_xstrdup(geteuid()? "PS1=$ " : "PS1=# ");
 		vps1.flags = VSTRFIXED | VTEXTFIXED;
 	}
 #endif
@@ -11833,7 +11833,7 @@
 
 	INTOFF;
 	for (lp = mylist; lp; lp = lp->next) {
-		setvareq(xstrdup(lp->text), 0);
+		setvareq(bb_xstrdup(lp->text), 0);
 	}
 	INTON;
 }
@@ -11996,7 +11996,7 @@
 		vp = *findvar(vpp, name);
 		if (vp == NULL) {
 			if (strchr(name, '='))
-				setvareq(xstrdup(name), VSTRFIXED);
+				setvareq(bb_xstrdup(name), VSTRFIXED);
 			else
 				setvar(name, NULL, VSTRFIXED);
 			vp = *vpp;	/* the new variable */
@@ -12007,7 +12007,7 @@
 			lvp->flags = vp->flags;
 			vp->flags |= VSTRFIXED | VTEXTFIXED;
 			if (strchr(name, '='))
-				setvareq(xstrdup(name), 0);
+				setvareq(bb_xstrdup(name), 0);
 		}
 	}
 	lvp->vp = vp;
@@ -12243,7 +12243,7 @@
 			return 0;
 		}
 		snprintf(p, 12, "%ld", result);
-		setvar(argv[1], xstrdup(p), 0);
+		setvar(argv[1], bb_xstrdup(p), 0);
 	} else if (argc >= 3)
 		synerror("invalid operand");
 	return !result;

Index: cmdedit.c
===================================================================
RCS file: /var/cvs/busybox/shell/cmdedit.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- cmdedit.c	6 Jan 2003 01:11:50 -0000	1.77
+++ cmdedit.c	19 Mar 2003 09:12:52 -0000	1.78
@@ -330,7 +330,7 @@
 	char *pbuf;
 
 	if (!pwd_buf) {
-		pwd_buf=(char *)unknown;
+		pwd_buf=(char *)bb_msg_unknown;
 	}
 
 	while (*prmt_ptr) {
@@ -341,7 +341,7 @@
 			const char *cp = prmt_ptr;
 			int l;
 			
-			c = process_escape_sequence(&prmt_ptr);
+			c = bb_process_escape_sequence(&prmt_ptr);
 			if(prmt_ptr==cp) {
 			  if (*cp == 0)
 				break;
@@ -430,7 +430,7 @@
 		if (flg_not_length == ']')
 			sub_len++;
 	}
-	if(pwd_buf!=(char *)unknown)
+	if(pwd_buf!=(char *)bb_msg_unknown)
 		free(pwd_buf);
 	cmdedit_prompt = prmt_mem_ptr;
 	cmdedit_prmt_len = prmt_len - sub_len;
@@ -520,8 +520,8 @@
 		my_euid = geteuid();
 		entry = getpwuid(my_euid);
 		if (entry) {
-			user_buf = xstrdup(entry->pw_name);
-			home_pwd_buf = xstrdup(entry->pw_dir);
+			user_buf = bb_xstrdup(entry->pw_name);
+			home_pwd_buf = bb_xstrdup(entry->pw_dir);
 		}
 #endif
 
@@ -598,7 +598,7 @@
 			/* Null usernames should result in all users as possible completions. */
 			if ( /*!userlen || */ !strncmp(ud, entry->pw_name, userlen)) {
 
-                               bb_asprintf(&temp, "~%s/", entry->pw_name);
+                               bb_xasprintf(&temp, "~%s/", entry->pw_name);
 				matches = xrealloc(matches, (nm + 1) * sizeof(char *));
 
 				matches[nm++] = temp;
@@ -647,7 +647,7 @@
 	*p = xmalloc(npth * sizeof(char *));
 
 	tmp = pth;
-	(*p)[0] = xstrdup(tmp);
+	(*p)[0] = bb_xstrdup(tmp);
 	npth = 1;			/* count words is + 1 count ':' */
 
 	for (;;) {
@@ -1071,7 +1071,7 @@
 			qsort(matches, num_matches, sizeof(char *), match_compare);
 
 			/* find minimal match */
-			tmp = xstrdup(matches[0]);
+			tmp = bb_xstrdup(matches[0]);
 			for (tmp1 = tmp; *tmp1; tmp1++)
 				for (len_found = 1; len_found < num_matches; len_found++)
 					if (matches[len_found][(tmp1 - tmp)] != *tmp1) {
@@ -1132,7 +1132,7 @@
 {
 	if(command_ps[0] != 0 || history[cur_history] == 0) {
 		free(history[cur_history]);
-		history[cur_history] = xstrdup(command_ps);
+		history[cur_history] = bb_xstrdup(command_ps);
 	}
 	cur_history--;
 }
@@ -1166,12 +1166,11 @@
 	if (( fp = fopen ( fromfile, "r" ))) {
 	
 		for ( hi = 0; hi < MAX_HISTORY; ) {
-			char * hl = get_line_from_file(fp);
+			char * hl = bb_get_chomped_line_from_file(fp);
 			int l;
 
 			if(!hl)
 				break;
-			chomp(hl);
 			l = strlen(hl);
 			if(l >= BUFSIZ)
 				hl[BUFSIZ-1] = 0;
@@ -1500,7 +1499,7 @@
 			for(i = 0; i < (MAX_HISTORY-1); i++)
 				history[i] = history[i+1];
 		}
-		history[i++] = xstrdup(command);
+		history[i++] = bb_xstrdup(command);
 		cur_history = i;
 		n_history = i;
 #if defined(CONFIG_FEATURE_SH_FANCY_PROMPT)
@@ -1535,7 +1534,7 @@
 
 #ifdef TEST
 
-const char *applet_name = "debug stuff usage";
+const char *bb_applet_name = "debug stuff usage";
 const char *memory_exhausted = "Memory exhausted";
 
 #ifdef CONFIG_FEATURE_NONPRINTABLE_INVERSE_PUT

Index: hush.c
===================================================================
RCS file: /var/cvs/busybox/shell/hush.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- hush.c	6 Dec 2002 21:37:08 -0000	1.61
+++ hush.c	19 Mar 2003 09:12:53 -0000	1.62
@@ -110,7 +110,7 @@
 #include "busybox.h"
 #include "cmdedit.h"
 #else
-#define applet_name "hush"
+#define bb_applet_name "hush"
 #include "standalone.h"
 #define hush_main main
 #undef CONFIG_FEATURE_SH_FANCY_PROMPT
@@ -320,7 +320,7 @@
 #define final_printf debug_printf
 
 static void __syntax(char *file, int line) {
-	error_msg("syntax error %s:%d", file, line);
+	bb_error_msg("syntax error %s:%d", file, line);
 }
 #define syntax() __syntax(__FILE__, __LINE__)
 
@@ -441,11 +441,11 @@
 
 static const char *set_cwd(void)
 {
-	if(cwd==unknown)
+	if(cwd==bb_msg_unknown)
 		cwd = NULL;     /* xgetcwd(arg) called free(arg) */
 	cwd = xgetcwd((char *)cwd);
 	if (!cwd)
-		cwd = unknown;
+		cwd = bb_msg_unknown;
 	return cwd;
 }
 
@@ -548,7 +548,7 @@
 		}
 	}
 	if (res<0)
-		perror_msg("export");
+		bb_perror_msg("export");
 	else if(res==0)
 		res = set_local_var(name, 1);
 	else
@@ -573,12 +573,12 @@
 			}
 		}
 		if (!pi) {
-			error_msg("%s: no current job", child->argv[0]);
+			bb_error_msg("%s: no current job", child->argv[0]);
 			return EXIT_FAILURE;
 		}
 	} else {
 		if (sscanf(child->argv[1], "%%%d", &jobnum) != 1) {
-			error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]);
+			bb_error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]);
 			return EXIT_FAILURE;
 		}
 		for (pi = job_list; pi; pi = pi->next) {
@@ -587,7 +587,7 @@
 			}
 		}
 		if (!pi) {
-			error_msg("%s: %d: no such job", child->argv[0], jobnum);
+			bb_error_msg("%s: %d: no such job", child->argv[0], jobnum);
 			return EXIT_FAILURE;
 		}
 	}
@@ -605,7 +605,7 @@
 		if (i == ESRCH) {
 			remove_bg_job(pi);
 		} else {
-			perror_msg("kill (SIGCONT)");
+			bb_perror_msg("kill (SIGCONT)");
 		}
 	}
 
@@ -728,7 +728,7 @@
 	/* XXX search through $PATH is missing */
 	input = fopen(child->argv[1], "r");
 	if (!input) {
-		error_msg("Couldn't open file '%s'", child->argv[1]);
+		bb_error_msg("Couldn't open file '%s'", child->argv[1]);
 		return EXIT_FAILURE;
 	}
 
@@ -996,7 +996,7 @@
 {
 	struct close_me *tmp;
 	if (close_me_head == NULL || close_me_head->fd != fd)
-		error_msg_and_die("corrupt close_me");
+		bb_error_msg_and_die("corrupt close_me");
 	tmp = close_me_head;
 	close_me_head = close_me_head->next;
 	free(tmp);
@@ -1029,7 +1029,7 @@
 			if (openfd < 0) {
 			/* this could get lost if stderr has been redirected, but
 			   bash and ash both lose it as well (though zsh doesn't!) */
-				perror_msg("error opening %s", redir->word.gl_pathv[0]);
+				bb_perror_msg("error opening %s", redir->word.gl_pathv[0]);
 				return 1;
 			}
 		} else {
@@ -1125,14 +1125,14 @@
 #ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN
 			/* Following discussions from November 2000 on the busybox mailing
 			 * list, the default configuration, (without
-			 * get_last_path_component()) lets the user force use of an
+			 * bb_get_last_path_component()) lets the user force use of an
 			 * external command by specifying the full (with slashes) filename.
 			 * If you enable CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN, then applets
 			 * _aways_ override external commands, so if you want to run
 			 * /bin/cat, it will use BusyBox cat even if /bin/cat exists on the
 			 * filesystem and is _not_ busybox.  Some systems may want this,
 			 * most do not.  */
-			name = get_last_path_component(name);
+			name = bb_get_last_path_component(name);
 #endif
 			/* Count argc for use in a second... */
 			for(argc_l=0;*argv_l!=NULL; argv_l++, argc_l++);
@@ -1143,7 +1143,7 @@
 #endif
 		debug_printf("exec of %s\n",child->argv[0]);
 		execvp(child->argv[0],child->argv);
-		perror_msg("couldn't exec: %s",child->argv[0]);
+		bb_perror_msg("couldn't exec: %s",child->argv[0]);
 		_exit(1);
 	} else if (child->group) {
 		debug_printf("runtime nesting to group\n");
@@ -1292,11 +1292,11 @@
 	}
 
 	if (childpid == -1 && errno != ECHILD)
-		perror_msg("waitpid");
+		bb_perror_msg("waitpid");
 
 	/* move the shell to the foreground */
 	//if (interactive && tcsetpgrp(shell_terminal, getpgid(0)))
-	//	perror_msg("tcsetpgrp-2");
+	//	bb_perror_msg("tcsetpgrp-2");
 	return -1;
 }
 
@@ -1381,7 +1381,7 @@
 				 * variable. */
 				int export_me=0;
 				char *name, *value;
-				name = xstrdup(child->argv[i]);
+				name = bb_xstrdup(child->argv[i]);
 				debug_printf("Local environment set: %s\n", name);
 				value = strchr(name, '=');
 				if (value)
@@ -1441,7 +1441,7 @@
 
 		/* pipes are inserted between pairs of commands */
 		if ((i + 1) < pi->num_progs) {
-			if (pipe(pipefds)<0) perror_msg_and_die("pipe");
+			if (pipe(pipefds)<0) bb_perror_msg_and_die("pipe");
 			nextout = pipefds[1];
 		} else {
 			nextout=1;
@@ -1626,11 +1626,11 @@
 			if (interactive) {
 				/* move the new process group into the foreground */
 				if (tcsetpgrp(shell_terminal, pi->pgrp) && errno != ENOTTY)
-					perror_msg("tcsetpgrp-3");
+					bb_perror_msg("tcsetpgrp-3");
 				rcode = checkjobs(pi);
 				/* move the shell to the foreground */
 				if (tcsetpgrp(shell_terminal, getpgid(0)) && errno != ENOTTY)
-					perror_msg("tcsetpgrp-4");
+					bb_perror_msg("tcsetpgrp-4");
 			} else {
 				rcode = checkjobs(pi);
 			}
@@ -1825,9 +1825,9 @@
 		debug_printf("globhack returned %d\n",gr);
 	}
 	if (gr == GLOB_NOSPACE)
-		error_msg_and_die("out of memory during glob");
+		bb_error_msg_and_die("out of memory during glob");
 	if (gr != 0) { /* GLOB_ABORTED ? */
-		error_msg("glob(3) error %d",gr);
+		bb_error_msg("glob(3) error %d",gr);
 	}
 	/* globprint(glob_target); */
 	return gr;
@@ -1881,7 +1881,7 @@
 				result++;
 		} else {
 			if(cur->flg_read_only) {
-				error_msg("%s: readonly variable", name);
+				bb_error_msg("%s: readonly variable", name);
 				result = -1;
 			} else {
 				if(flg_export>0 || cur->flg_export>1)
@@ -1935,7 +1935,7 @@
 		if(cur!=0) {
 			struct variables *next = top_vars;
 			if(cur->flg_read_only) {
-				error_msg("%s: readonly variable", name);
+				bb_error_msg("%s: readonly variable", name);
 				return;
 			} else {
 				if(cur->flg_export)
@@ -2139,7 +2139,7 @@
 	if (ctx->pending_redirect) {
 		ctx->pending_redirect=NULL;
 		if (glob_target->gl_pathc != 1) {
-			error_msg("ambiguous redirect");
+			bb_error_msg("ambiguous redirect");
 			return 1;
 		}
 	} else {
@@ -2231,7 +2231,7 @@
 	}
 	if (ok) return d;
 
-	error_msg("ambiguous redirect");
+	bb_error_msg("ambiguous redirect");
 	return -2;
 }
 
@@ -2267,14 +2267,14 @@
 	FILE *pf;
 #if 1
 	int pid, channel[2];
-	if (pipe(channel)<0) perror_msg_and_die("pipe");
+	if (pipe(channel)<0) bb_perror_msg_and_die("pipe");
 #if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__)
 	pid=fork();
 #else
 	pid=vfork();
 #endif
 	if (pid<0) {
-		perror_msg_and_die("fork");
+		bb_perror_msg_and_die("fork");
 	} else if (pid==0) {
 		close(channel[0]);
 		if (channel[1] != 1) {
@@ -2450,7 +2450,7 @@
 		case '-':
 		case '_':
 			/* still unhandled, but should be eventually */
-			error_msg("unhandled syntax: $%c",ch);
+			bb_error_msg("unhandled syntax: $%c",ch);
 			return 1;
 			break;
 		default:
@@ -2811,7 +2811,7 @@
 						"   or: sh -c command [args]...\n\n");
 				exit(EXIT_FAILURE);
 #else
-				show_usage();
+				bb_show_usage();
 #endif
 		}
 	}
@@ -2845,12 +2845,12 @@
 	debug_printf("\nrunning script '%s'\n", argv[optind]);
 	global_argv = argv+optind;
 	global_argc = argc-optind;
-	input = xfopen(argv[optind], "r");
+	input = bb_xfopen(argv[optind], "r");
 	opt = parse_file_outer(input);
 
 #ifdef CONFIG_FEATURE_CLEAN_UP
 	fclose(input);
-	if (cwd && cwd != unknown)
+	if (cwd && cwd != bb_msg_unknown)
 		free((char*)cwd);
 	{
 		struct variables *cur, *tmp;

Index: lash.c
===================================================================
RCS file: /var/cvs/busybox/shell/lash.c,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -d -r1.149 -r1.150
--- lash.c	11 Dec 2002 04:26:28 -0000	1.149
+++ lash.c	19 Mar 2003 09:12:53 -0000	1.150
@@ -246,7 +246,7 @@
 	}
 	cwd = xgetcwd((char *)cwd);
 	if (!cwd)
-		cwd = unknown;
+		cwd = bb_msg_unknown;
 	return EXIT_SUCCESS;
 }
 
@@ -284,12 +284,12 @@
 			}
 		}
 		if (!job) {
-			error_msg("%s: no current job", child->argv[0]);
+			bb_error_msg("%s: no current job", child->argv[0]);
 			return EXIT_FAILURE;
 		}
 	} else {
 		if (sscanf(child->argv[1], "%%%d", &jobnum) != 1) {
-			error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]);
+			bb_error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]);
 			return EXIT_FAILURE;
 		}
 		for (job = child->family->job_list->head; job; job = job->next) {
@@ -298,7 +298,7 @@
 			}
 		}
 		if (!job) {
-			error_msg("%s: %d: no such job", child->argv[0], jobnum);
+			bb_error_msg("%s: %d: no such job", child->argv[0], jobnum);
 			return EXIT_FAILURE;
 		}
 	}
@@ -320,7 +320,7 @@
 		if (i == ESRCH) {
 			remove_job(&job_list, job);
 		} else {
-			perror_msg("kill (SIGCONT)");
+			bb_perror_msg("kill (SIGCONT)");
 		}
 	}
 
@@ -371,7 +371,7 @@
 {
 	cwd = xgetcwd((char *)cwd);
 	if (!cwd)
-		cwd = unknown;
+		cwd = bb_msg_unknown;
 	puts(cwd);
 	return EXIT_SUCCESS;
 }
@@ -489,7 +489,7 @@
 {
 	struct close_me *tmp;
 	if (close_me_head == NULL || close_me_head->fd != fd)
-		error_msg_and_die("corrupt close_me");
+		bb_error_msg_and_die("corrupt close_me");
 	tmp = close_me_head;
 	close_me_head = close_me_head->next;
 	free(tmp);
@@ -599,7 +599,7 @@
 	}
 
 	if (childpid == -1 && errno != ECHILD)
-		perror_msg("waitpid");
+		bb_perror_msg("waitpid");
 }
 
 /* squirrel != NULL means we squirrel away copies of stdin, stdout,
@@ -628,7 +628,7 @@
 		if (openfd < 0) {
 			/* this could get lost if stderr has been redirected, but
 			   bash and ash both lose it as well (though zsh doesn't!) */
-			perror_msg("error opening %s", redir->filename);
+			bb_perror_msg("error opening %s", redir->filename);
 			return 1;
 		}
 
@@ -803,7 +803,7 @@
 	while( command && command[ix]) {
 		if (command[ix] == '\\') {
 			const char *tmp = command+ix+1;
-			command[ix] = process_escape_sequence(  &tmp );
+			command[ix] = bb_process_escape_sequence(  &tmp );
 			memmove(command+ix + 1, tmp, strlen(tmp)+1);
 		}
 		ix++;
@@ -816,7 +816,7 @@
 
 	/* We need a clean copy, so strsep can mess up the copy while
 	 * we write stuff into the original (in a minute) */
-	cmd = cmd_copy = xstrdup(command);
+	cmd = cmd_copy = bb_xstrdup(command);
 	*command = '\0';
 	for (ix = 0, tmpcmd = cmd; 
 			(tmpcmd = strsep_space(cmd, &ix)) != NULL; cmd += ix, ix=0) {
@@ -829,13 +829,13 @@
 		if (retval == GLOB_NOSPACE) {
 			/* Mem may have been allocated... */
 			globfree (&expand_result);
-			error_msg(out_of_space);
+			bb_error_msg(out_of_space);
 			return FALSE;
 		} else if (retval != 0) {
 			/* Some other error.  GLOB_NOMATCH shouldn't
 			 * happen because of the GLOB_NOCHECK flag in 
 			 * the glob call. */
-			error_msg("syntax error");
+			bb_error_msg("syntax error");
 			return FALSE;
 		} else {
 			/* Convert from char** (one word per string) to a simple char*,
@@ -843,7 +843,7 @@
 			for (i=0; i < expand_result.gl_pathc; i++) {
 				length=strlen(expand_result.gl_pathv[i]);
 				if (total_length+length+1 >= BUFSIZ) {
-					error_msg(out_of_space);
+					bb_error_msg(out_of_space);
 					return FALSE;
 				}
 				strcat(command+total_length, " ");
@@ -930,7 +930,7 @@
 			int subst_len = strlen(var);
 			int trail_len = strlen(src);
 			if (dst+subst_len+trail_len >= command+BUFSIZ) {
-				error_msg(out_of_space);
+				bb_error_msg(out_of_space);
 				return FALSE;
 			}
 			/* Move stuff to the end of the string to accommodate
@@ -1006,7 +1006,7 @@
 			if (*src == '\\') {
 				src++;
 				if (!*src) {
-					error_msg("character expected after \\");
+					bb_error_msg("character expected after \\");
 					free_job(job);
 					return 1;
 				}
@@ -1090,7 +1090,7 @@
 					chptr++;
 
 				if (!*chptr) {
-					error_msg("file name expected after %c", *(src-1));
+					bb_error_msg("file name expected after %c", *(src-1));
 					free_job(job);
 					job->num_progs=0;
 					return 1;
@@ -1109,7 +1109,7 @@
 				if (*prog->argv[argc_l] || saw_quote)
 					argc_l++;
 				if (!argc_l) {
-					error_msg("empty command in pipe");
+					bb_error_msg("empty command in pipe");
 					free_job(job);
 					job->num_progs=0;
 					return 1;
@@ -1136,7 +1136,7 @@
 					src++;
 
 				if (!*src) {
-					error_msg("empty command in pipe");
+					bb_error_msg("empty command in pipe");
 					free_job(job);
 					job->num_progs=0;
 					return 1;
@@ -1155,7 +1155,7 @@
 			case '\\':
 				src++;
 				if (!*src) {
-					error_msg("character expected after \\");
+					bb_error_msg("character expected after \\");
 					free_job(job);
 					return 1;
 				}
@@ -1217,7 +1217,7 @@
 	/* Check if the command matches any of the forking builtins. */
 	for (x = bltins_forking; x->cmd; x++) {
 		if (strcmp(child->argv[0], x->cmd) == 0) {
-			applet_name=x->cmd;
+			bb_applet_name=x->cmd;
 			_exit (x->function(child));
 		}
 	}
@@ -1225,7 +1225,7 @@
 	/* Check if the command matches any busybox internal
 	 * commands ("applets") here.  Following discussions from
 	 * November 2000 on busybox at busybox.net, don't use
-	 * get_last_path_component().  This way explicit (with
+	 * bb_get_last_path_component().  This way explicit (with
 	 * slashes) filenames will never be interpreted as an
 	 * applet, just like with builtins.  This way the user can
 	 * override an applet with an explicit filename reference.
@@ -1241,7 +1241,7 @@
 	 * /bin/cat exists on the filesystem and is _not_ busybox.
 	 * Some systems want this, others do not.  Choose wisely.  :-)
 	 */
-	name = get_last_path_component(name);
+	name = bb_get_last_path_component(name);
 #endif
 
 	{
@@ -1255,7 +1255,7 @@
 
 	execvp(child->argv[0], child->argv);
 
-	/* Do not use perror_msg_and_die() here, since we must not 
+	/* Do not use bb_perror_msg_and_die() here, since we must not 
 	 * call exit() but should call _exit() instead */
 	fprintf(stderr, "%s: %m\n", child->argv[0]);
 	_exit(EXIT_FAILURE);
@@ -1299,7 +1299,7 @@
 		/* move the new process group into the foreground */
 		/* suppress messages when run from /linuxrc mag at sysgo.de */
 		if (tcsetpgrp(shell_terminal, newjob->pgrp) && errno != ENOTTY)
-			perror_msg("tcsetpgrp");
+			bb_perror_msg("tcsetpgrp");
 	}
 }
 
@@ -1317,7 +1317,7 @@
 		child = & (newjob->progs[i]);
 
 		if ((i + 1) < newjob->num_progs) {
-			if (pipe(pipefds)<0) perror_msg_and_die("pipe");
+			if (pipe(pipefds)<0) bb_perror_msg_and_die("pipe");
 			nextout = pipefds[1];
 		} else {
 			if (outpipe[1]!=-1) {
@@ -1464,7 +1464,7 @@
 
 			if (waitpid(job_list.fg->progs[i].pid, &status, WUNTRACED)<0) {
 				if (errno != ECHILD) {
-					perror_msg_and_die("waitpid(%d)",job_list.fg->progs[i].pid);
+					bb_perror_msg_and_die("waitpid(%d)",job_list.fg->progs[i].pid);
 				}
 			}
 
@@ -1496,7 +1496,7 @@
 				/* move the shell to the foreground */
 				/* suppress messages when run from /linuxrc mag at sysgo.de */
 				if (tcsetpgrp(shell_terminal, getpgrp()) && errno != ENOTTY)
-					perror_msg("tcsetpgrp"); 
+					bb_perror_msg("tcsetpgrp"); 
 			}
 		}
 	}
@@ -1504,7 +1504,7 @@
 
 	/* return controlling TTY back to parent process group before exiting */
 	if (tcsetpgrp(shell_terminal, parent_pgrp) && errno != ENOTTY)
-		perror_msg("tcsetpgrp");
+		bb_perror_msg("tcsetpgrp");
 
 	/* return exit status if called with "-c" */
 	if (input == NULL && WIFEXITED(status))
@@ -1517,7 +1517,7 @@
 #ifdef CONFIG_FEATURE_CLEAN_UP
 void free_memory(void)
 {
-	if (cwd && cwd!=unknown) {
+	if (cwd && cwd!=bb_msg_unknown) {
 		free((char*)cwd);
 	}
 	if (local_pending_command)
@@ -1594,8 +1594,8 @@
 			case 'c':
 				input = NULL;
 				if (local_pending_command != 0)
-					error_msg_and_die("multiple -c arguments");
-				local_pending_command = xstrdup(argv[optind]);
+					bb_error_msg_and_die("multiple -c arguments");
+				local_pending_command = bb_xstrdup(argv[optind]);
 				optind++;
 				argv = argv+optind;
 				break;
@@ -1603,7 +1603,7 @@
 				interactive = TRUE;
 				break;
 			default:
-				show_usage();
+				bb_show_usage();
 		}
 	}
 	/* A shell is interactive if the `-i' flag was given, or if all of
@@ -1627,14 +1627,14 @@
 #endif
 	} else if (local_pending_command==NULL) {
 		//printf( "optind=%d  argv[optind]='%s'\n", optind, argv[optind]);
-		input = xfopen(argv[optind], "r");
+		input = bb_xfopen(argv[optind], "r");
 		mark_open(fileno(input));  /* be lazy, never mark this closed */
 	}
 
 	/* initialize the cwd -- this is never freed...*/
 	cwd = xgetcwd(0);
 	if (!cwd)
-		cwd = unknown;
+		cwd = bb_msg_unknown;
 
 #ifdef CONFIG_FEATURE_CLEAN_UP
 	atexit(free_memory);

Index: msh.c
===================================================================
RCS file: /var/cvs/busybox/shell/msh.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- msh.c	14 Mar 2003 16:05:59 -0000	1.12
+++ msh.c	19 Mar 2003 09:12:53 -0000	1.13
@@ -2838,7 +2838,7 @@
 #ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
 	char *name = c;
 #ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN
-	name = get_last_path_component(name);
+	name = bb_get_last_path_component(name);
 #endif
 	optind = 1;
 	if (find_applet_by_name(name)) {
@@ -2876,7 +2876,7 @@
 			return("no Shell");
 
 		case ENOMEM:
-			return((char*)memory_exhausted);
+			return((char*)bb_msg_memory_exhausted);
 
 		case E2BIG:
 			return("argument list too long");
@@ -3883,7 +3883,7 @@
 		;
 	if (i < 0) {
 		closepipe(pf);
-		err((char*)memory_exhausted);
+		err((char*)bb_msg_memory_exhausted);
 		return(0);
 	}
 	if (i != 0) {




More information about the busybox-cvs mailing list