more
• int → bool
• shprintf("foo") → shf_puts("foo", shl_stdout)
• shprintf("%s", foo) → shf_puts(foo, shl_stdout)
• shf_puts("x", foo) → shf_putc('x', foo)
			
			
This commit is contained in:
		
							
								
								
									
										6
									
								
								edit.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								edit.c
									
									
									
									
									
								
							| @@ -5,7 +5,7 @@ | |||||||
|  |  | ||||||
| #include "sh.h" | #include "sh.h" | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/edit.c,v 1.118 2008/03/23 21:31:29 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/edit.c,v 1.119 2008/04/01 21:50:57 tg Exp $"); | ||||||
|  |  | ||||||
| /* tty driver characters we are interested in */ | /* tty driver characters we are interested in */ | ||||||
| typedef struct { | typedef struct { | ||||||
| @@ -2556,8 +2556,8 @@ x_print(int prefix, int key) | |||||||
|  |  | ||||||
| 	if (prefix) | 	if (prefix) | ||||||
| 		/* prefix == 1 || prefix == 2 */ | 		/* prefix == 1 || prefix == 2 */ | ||||||
| 		shprintf("%s", x_mapout(prefix == 1 ? | 		shf_puts(x_mapout(prefix == 1 ? | ||||||
| 		    MKCTRL('[') : MKCTRL('X'))); | 		    MKCTRL('[') : MKCTRL('X')), shl_stdout); | ||||||
| 	shprintf("%s%s = ", x_mapout(key), (f & 0x80) ? "~" : ""); | 	shprintf("%s%s = ", x_mapout(key), (f & 0x80) ? "~" : ""); | ||||||
| 	if ((f & 0x7F) != XFUNC_ins_string) | 	if ((f & 0x7F) != XFUNC_ins_string) | ||||||
| 		shprintf("%s\n", x_ftab[f & 0x7F].xf_name); | 		shprintf("%s\n", x_ftab[f & 0x7F].xf_name); | ||||||
|   | |||||||
							
								
								
									
										121
									
								
								funcs.c
									
									
									
									
									
								
							
							
						
						
									
										121
									
								
								funcs.c
									
									
									
									
									
								
							| @@ -5,7 +5,7 @@ | |||||||
|  |  | ||||||
| #include "sh.h" | #include "sh.h" | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.73 2008/04/01 21:39:45 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.74 2008/04/01 21:50:57 tg Exp $"); | ||||||
|  |  | ||||||
| /* A leading = means assignments before command are kept; | /* A leading = means assignments before command are kept; | ||||||
|  * a leading * means a POSIX special builtin; |  * a leading * means a POSIX special builtin; | ||||||
| @@ -130,9 +130,9 @@ int | |||||||
| c_cd(const char **wp) | c_cd(const char **wp) | ||||||
| { | { | ||||||
| 	int optc; | 	int optc; | ||||||
| 	int physical = Flag(FPHYSICAL); | 	bool physical = Flag(FPHYSICAL) ? true : false; | ||||||
| 	int cdnode;			/* was a node from cdpath added in? */ | 	int cdnode;			/* was a node from cdpath added in? */ | ||||||
| 	int printpath = 0;		/* print where we cd'd? */ | 	bool printpath = false;		/* print where we cd'd? */ | ||||||
| 	int rval; | 	int rval; | ||||||
| 	struct tbl *pwd_s, *oldpwd_s; | 	struct tbl *pwd_s, *oldpwd_s; | ||||||
| 	XString xs; | 	XString xs; | ||||||
| @@ -144,10 +144,10 @@ c_cd(const char **wp) | |||||||
| 	while ((optc = ksh_getopt(wp, &builtin_opt, "LP")) != -1) | 	while ((optc = ksh_getopt(wp, &builtin_opt, "LP")) != -1) | ||||||
| 		switch (optc) { | 		switch (optc) { | ||||||
| 		case 'L': | 		case 'L': | ||||||
| 			physical = 0; | 			physical = false; | ||||||
| 			break; | 			break; | ||||||
| 		case 'P': | 		case 'P': | ||||||
| 			physical = 1; | 			physical = true; | ||||||
| 			break; | 			break; | ||||||
| 		case '?': | 		case '?': | ||||||
| 			return 1; | 			return 1; | ||||||
| @@ -178,7 +178,7 @@ c_cd(const char **wp) | |||||||
| 				bi_errorf("no OLDPWD"); | 				bi_errorf("no OLDPWD"); | ||||||
| 				return 1; | 				return 1; | ||||||
| 			} | 			} | ||||||
| 			printpath++; | 			printpath = true; | ||||||
| 		} else | 		} else | ||||||
| 			dir_ = true; | 			dir_ = true; | ||||||
| 	} else if (!wp[2]) { | 	} else if (!wp[2]) { | ||||||
| @@ -208,7 +208,7 @@ c_cd(const char **wp) | |||||||
| 		memcpy(dir, current_wd, ilen); | 		memcpy(dir, current_wd, ilen); | ||||||
| 		memcpy(dir + ilen, wp[1], nlen); | 		memcpy(dir + ilen, wp[1], nlen); | ||||||
| 		memcpy(dir + ilen + nlen, current_wd + ilen + olen, elen); | 		memcpy(dir + ilen + nlen, current_wd + ilen + olen, elen); | ||||||
| 		printpath++; | 		printpath = true; | ||||||
| 	} else { | 	} else { | ||||||
| 		bi_errorf("too many arguments"); | 		bi_errorf("too many arguments"); | ||||||
| 		return 1; | 		return 1; | ||||||
| @@ -274,17 +274,17 @@ int | |||||||
| c_pwd(const char **wp) | c_pwd(const char **wp) | ||||||
| { | { | ||||||
| 	int optc; | 	int optc; | ||||||
| 	int physical = Flag(FPHYSICAL); | 	int physical = Flag(FPHYSICAL) ? true : false; | ||||||
| 	char *p; | 	char *p; | ||||||
| 	bool p_ = false; | 	bool p_ = false; | ||||||
|  |  | ||||||
| 	while ((optc = ksh_getopt(wp, &builtin_opt, "LP")) != -1) | 	while ((optc = ksh_getopt(wp, &builtin_opt, "LP")) != -1) | ||||||
| 		switch (optc) { | 		switch (optc) { | ||||||
| 		case 'L': | 		case 'L': | ||||||
| 			physical = 0; | 			physical = false; | ||||||
| 			break; | 			break; | ||||||
| 		case 'P': | 		case 'P': | ||||||
| 			physical = 1; | 			physical = true; | ||||||
| 			break; | 			break; | ||||||
| 		case '?': | 		case '?': | ||||||
| 			return 1; | 			return 1; | ||||||
| @@ -556,7 +556,7 @@ c_whence(const char **wp) | |||||||
| { | { | ||||||
| 	struct tbl *tp; | 	struct tbl *tp; | ||||||
| 	const char *id; | 	const char *id; | ||||||
| 	int pflag = 0, vflag = 0, Vflag = 0; | 	bool pflag = false, vflag = false, Vflag = false; | ||||||
| 	int ret = 0; | 	int ret = 0; | ||||||
| 	int optc; | 	int optc; | ||||||
| 	int iam_whence = wp[0][0] == 'w'; | 	int iam_whence = wp[0][0] == 'w'; | ||||||
| @@ -566,13 +566,13 @@ c_whence(const char **wp) | |||||||
| 	while ((optc = ksh_getopt(wp, &builtin_opt, opts)) != -1) | 	while ((optc = ksh_getopt(wp, &builtin_opt, opts)) != -1) | ||||||
| 		switch (optc) { | 		switch (optc) { | ||||||
| 		case 'p': | 		case 'p': | ||||||
| 			pflag = 1; | 			pflag = true; | ||||||
| 			break; | 			break; | ||||||
| 		case 'v': | 		case 'v': | ||||||
| 			vflag = 1; | 			vflag = true; | ||||||
| 			break; | 			break; | ||||||
| 		case 'V': | 		case 'V': | ||||||
| 			Vflag = 1; | 			Vflag = true; | ||||||
| 			break; | 			break; | ||||||
| 		case '?': | 		case '?': | ||||||
| 			return 1; | 			return 1; | ||||||
| @@ -607,35 +607,34 @@ c_whence(const char **wp) | |||||||
| 			tp = findcom(id, fcflags); | 			tp = findcom(id, fcflags); | ||||||
| 		if (vflag || (tp->type != CALIAS && tp->type != CEXEC && | 		if (vflag || (tp->type != CALIAS && tp->type != CEXEC && | ||||||
| 		    tp->type != CTALIAS)) | 		    tp->type != CTALIAS)) | ||||||
| 			shprintf("%s", id); | 			shf_puts(id, shl_stdout); | ||||||
| 		switch (tp->type) { | 		switch (tp->type) { | ||||||
| 		case CKEYWD: | 		case CKEYWD: | ||||||
| 			if (vflag) | 			if (vflag) | ||||||
| 				shprintf(" is a reserved word"); | 				shf_puts(" is a reserved word", shl_stdout); | ||||||
| 			break; | 			break; | ||||||
| 		case CALIAS: | 		case CALIAS: | ||||||
| 			if (vflag) | 			if (vflag) | ||||||
| 				shprintf(" is an %salias for ", | 				shprintf(" is an %salias for ", | ||||||
| 				    (tp->flag & EXPORT) ? "exported " : | 				    (tp->flag & EXPORT) ? "exported " : null); | ||||||
| 				    null); |  | ||||||
| 			if (!iam_whence && !vflag) | 			if (!iam_whence && !vflag) | ||||||
| 				shprintf("alias %s=", id); | 				shprintf("alias %s=", id); | ||||||
| 			print_value_quoted(tp->val.s); | 			print_value_quoted(tp->val.s); | ||||||
| 			break; | 			break; | ||||||
| 		case CFUNC: | 		case CFUNC: | ||||||
| 			if (vflag) { | 			if (vflag) { | ||||||
| 				shprintf(" is a"); | 				shf_puts(" is a", shl_stdout); | ||||||
| 				if (tp->flag & EXPORT) | 				if (tp->flag & EXPORT) | ||||||
| 					shprintf("n exported"); | 					shf_puts("n exported", shl_stdout); | ||||||
| 				if (tp->flag & TRACE) | 				if (tp->flag & TRACE) | ||||||
| 					shprintf(" traced"); | 					shf_puts(" traced", shl_stdout); | ||||||
| 				if (!(tp->flag & ISSET)) { | 				if (!(tp->flag & ISSET)) { | ||||||
| 					shprintf(" undefined"); | 					shf_puts(" undefined", shl_stdout); | ||||||
| 					if (tp->u.fpath) | 					if (tp->u.fpath) | ||||||
| 						shprintf(" (autoload from %s)", | 						shprintf(" (autoload from %s)", | ||||||
| 						    tp->u.fpath); | 						    tp->u.fpath); | ||||||
| 				} | 				} | ||||||
| 				shprintf(" function"); | 				shf_puts(" function", shl_stdout); | ||||||
| 			} | 			} | ||||||
| 			break; | 			break; | ||||||
| 		case CSHELL: | 		case CSHELL: | ||||||
| @@ -647,16 +646,16 @@ c_whence(const char **wp) | |||||||
| 		case CEXEC: | 		case CEXEC: | ||||||
| 			if (tp->flag & ISSET) { | 			if (tp->flag & ISSET) { | ||||||
| 				if (vflag) { | 				if (vflag) { | ||||||
| 					shprintf(" is "); | 					shf_puts(" is ", shl_stdout); | ||||||
| 					if (tp->type == CTALIAS) | 					if (tp->type == CTALIAS) | ||||||
| 						shprintf("a tracked %salias for ", | 						shprintf("a tracked %salias for ", | ||||||
| 						    (tp->flag & EXPORT) ? | 						    (tp->flag & EXPORT) ? | ||||||
| 						    "exported " : null); | 						    "exported " : null); | ||||||
| 				} | 				} | ||||||
| 				shprintf("%s", tp->val.s); | 				shf_puts(tp->val.s, shl_stdout); | ||||||
| 			} else { | 			} else { | ||||||
| 				if (vflag) | 				if (vflag) | ||||||
| 					shprintf(" not found"); | 					shf_puts(" not found", shl_stdout); | ||||||
| 				ret = 1; | 				ret = 1; | ||||||
| 			} | 			} | ||||||
| 			break; | 			break; | ||||||
| @@ -919,25 +918,25 @@ c_typeset(const char **wp) | |||||||
| 						 * but POSIX says must | 						 * but POSIX says must | ||||||
| 						 * be suitable for re-entry... | 						 * be suitable for re-entry... | ||||||
| 						 */ | 						 */ | ||||||
| 						shprintf("typeset "); | 						shf_puts("typeset ", shl_stdout); | ||||||
| 						if ((vp->flag&INTEGER)) | 						if ((vp->flag&INTEGER)) | ||||||
| 							shprintf("-i "); | 							shf_puts("-i ", shl_stdout); | ||||||
| 						if ((vp->flag&EXPORT)) | 						if ((vp->flag&EXPORT)) | ||||||
| 							shprintf("-x "); | 							shf_puts("-x ", shl_stdout); | ||||||
| 						if ((vp->flag&RDONLY)) | 						if ((vp->flag&RDONLY)) | ||||||
| 							shprintf("-r "); | 							shf_puts("-r ", shl_stdout); | ||||||
| 						if ((vp->flag&TRACE)) | 						if ((vp->flag&TRACE)) | ||||||
| 							shprintf("-t "); | 							shf_puts("-t ", shl_stdout); | ||||||
| 						if ((vp->flag&LJUST)) | 						if ((vp->flag&LJUST)) | ||||||
| 							shprintf("-L%d ", vp->u2.field); | 							shprintf("-L%d ", vp->u2.field); | ||||||
| 						if ((vp->flag&RJUST)) | 						if ((vp->flag&RJUST)) | ||||||
| 							shprintf("-R%d ", vp->u2.field); | 							shprintf("-R%d ", vp->u2.field); | ||||||
| 						if ((vp->flag&ZEROFIL)) | 						if ((vp->flag&ZEROFIL)) | ||||||
| 							shprintf("-Z "); | 							shf_puts("-Z ", shl_stdout); | ||||||
| 						if ((vp->flag&LCASEV)) | 						if ((vp->flag&LCASEV)) | ||||||
| 							shprintf("-l "); | 							shf_puts("-l ", shl_stdout); | ||||||
| 						if ((vp->flag&UCASEV_AL)) | 						if ((vp->flag&UCASEV_AL)) | ||||||
| 							shprintf("-u "); | 							shf_puts("-u ", shl_stdout); | ||||||
| 						if ((vp->flag&INT_U)) | 						if ((vp->flag&INT_U)) | ||||||
| 							shf_puts("-U ", shl_stdout); | 							shf_puts("-U ", shl_stdout); | ||||||
| 						shf_puts(vp->name, shl_stdout); | 						shf_puts(vp->name, shl_stdout); | ||||||
| @@ -970,17 +969,17 @@ c_typeset(const char **wp) | |||||||
| 							    vp->name, | 							    vp->name, | ||||||
| 							    (unsigned long)vp->index); | 							    (unsigned long)vp->index); | ||||||
| 						else | 						else | ||||||
| 							shprintf("%s", vp->name); | 							shf_puts(vp->name, shl_stdout); | ||||||
| 						if (thing == '-' && (vp->flag&ISSET)) { | 						if (thing == '-' && (vp->flag&ISSET)) { | ||||||
| 							char *s = str_val(vp); | 							char *s = str_val(vp); | ||||||
|  |  | ||||||
| 							shprintf("="); | 							shf_putc('=', shl_stdout); | ||||||
| 							/* at&t ksh can't have | 							/* at&t ksh can't have | ||||||
| 							 * justified integers.. */ | 							 * justified integers.. */ | ||||||
| 							if ((vp->flag & | 							if ((vp->flag & | ||||||
| 							    (INTEGER|LJUST|RJUST)) == | 							    (INTEGER|LJUST|RJUST)) == | ||||||
| 							    INTEGER) | 							    INTEGER) | ||||||
| 								shprintf("%s", s); | 								shf_puts(s, shl_stdout); | ||||||
| 							else | 							else | ||||||
| 								print_value_quoted(s); | 								print_value_quoted(s); | ||||||
| 						} | 						} | ||||||
| @@ -1002,8 +1001,8 @@ int | |||||||
| c_alias(const char **wp) | c_alias(const char **wp) | ||||||
| { | { | ||||||
| 	struct table *t = &aliases; | 	struct table *t = &aliases; | ||||||
| 	int rv = 0, rflag = 0, tflag, Uflag = 0, pflag = 0; | 	int rv = 0, prefix = 0; | ||||||
| 	int prefix = 0; | 	bool rflag = false, tflag, Uflag = false, pflag = false; | ||||||
| 	Tflag xflag = 0; | 	Tflag xflag = 0; | ||||||
| 	int optc; | 	int optc; | ||||||
|  |  | ||||||
| @@ -1019,10 +1018,10 @@ c_alias(const char **wp) | |||||||
| #endif | #endif | ||||||
| 			break; | 			break; | ||||||
| 		case 'p': | 		case 'p': | ||||||
| 			pflag = 1; | 			pflag = true; | ||||||
| 			break; | 			break; | ||||||
| 		case 'r': | 		case 'r': | ||||||
| 			rflag = 1; | 			rflag = true; | ||||||
| 			break; | 			break; | ||||||
| 		case 't': | 		case 't': | ||||||
| 			t = &taliases; | 			t = &taliases; | ||||||
| @@ -1032,7 +1031,7 @@ c_alias(const char **wp) | |||||||
| 			 * kludge for tracked alias initialization | 			 * kludge for tracked alias initialization | ||||||
| 			 * (don't do a path search, just make an entry) | 			 * (don't do a path search, just make an entry) | ||||||
| 			 */ | 			 */ | ||||||
| 			Uflag = 1; | 			Uflag = true; | ||||||
| 			break; | 			break; | ||||||
| 		case 'x': | 		case 'x': | ||||||
| 			xflag = EXPORT; | 			xflag = EXPORT; | ||||||
| @@ -1058,8 +1057,8 @@ c_alias(const char **wp) | |||||||
| 		}; | 		}; | ||||||
|  |  | ||||||
| 		if (!tflag || *wp) { | 		if (!tflag || *wp) { | ||||||
| 			shprintf("alias: -r flag can only be used with -t" | 			shf_puts("alias: -r flag can only be used with -t" | ||||||
| 			    " and without arguments\n"); | 			    " and without arguments\n", shl_stdout); | ||||||
| 			return 1; | 			return 1; | ||||||
| 		} | 		} | ||||||
| 		ksh_getopt_reset(&builtin_opt, GF_ERROR); | 		ksh_getopt_reset(&builtin_opt, GF_ERROR); | ||||||
| @@ -1143,13 +1142,13 @@ c_unalias(const char **wp) | |||||||
| { | { | ||||||
| 	struct table *t = &aliases; | 	struct table *t = &aliases; | ||||||
| 	struct tbl *ap; | 	struct tbl *ap; | ||||||
| 	int rv = 0, all = 0; | 	int optc, rv = 0; | ||||||
| 	int optc; | 	bool all = false; | ||||||
|  |  | ||||||
| 	while ((optc = ksh_getopt(wp, &builtin_opt, "adt")) != -1) | 	while ((optc = ksh_getopt(wp, &builtin_opt, "adt")) != -1) | ||||||
| 		switch (optc) { | 		switch (optc) { | ||||||
| 		case 'a': | 		case 'a': | ||||||
| 			all = 1; | 			all = true; | ||||||
| 			break; | 			break; | ||||||
| 		case 'd': | 		case 'd': | ||||||
| #ifdef MKSH_SMALL | #ifdef MKSH_SMALL | ||||||
| @@ -1215,10 +1214,7 @@ c_let(const char **wp) | |||||||
| int | int | ||||||
| c_jobs(const char **wp) | c_jobs(const char **wp) | ||||||
| { | { | ||||||
| 	int optc; | 	int optc, flag = 0, nflag = 0, rv = 0; | ||||||
| 	int flag = 0; |  | ||||||
| 	int nflag = 0; |  | ||||||
| 	int rv = 0; |  | ||||||
|  |  | ||||||
| 	while ((optc = ksh_getopt(wp, &builtin_opt, "lpnz")) != -1) | 	while ((optc = ksh_getopt(wp, &builtin_opt, "lpnz")) != -1) | ||||||
| 		switch (optc) { | 		switch (optc) { | ||||||
| @@ -1252,7 +1248,7 @@ c_jobs(const char **wp) | |||||||
| int | int | ||||||
| c_fgbg(const char **wp) | c_fgbg(const char **wp) | ||||||
| { | { | ||||||
| 	int bg = strcmp(*wp, "bg") == 0; | 	bool bg = strcmp(*wp, "bg") == 0; | ||||||
| 	int rv = 0; | 	int rv = 0; | ||||||
|  |  | ||||||
| 	if (!Flag(FMONITOR)) { | 	if (!Flag(FMONITOR)) { | ||||||
| @@ -1289,7 +1285,7 @@ c_kill(const char **wp) | |||||||
| { | { | ||||||
| 	Trap *t = NULL; | 	Trap *t = NULL; | ||||||
| 	const char *p; | 	const char *p; | ||||||
| 	int lflag = 0; | 	bool lflag = false; | ||||||
| 	int i, n, rv, sig; | 	int i, n, rv, sig; | ||||||
|  |  | ||||||
| 	/* assume old style options if -digits or -UPPERCASE */ | 	/* assume old style options if -digits or -UPPERCASE */ | ||||||
| @@ -1306,7 +1302,7 @@ c_kill(const char **wp) | |||||||
| 		while ((optc = ksh_getopt(wp, &builtin_opt, "ls:")) != -1) | 		while ((optc = ksh_getopt(wp, &builtin_opt, "ls:")) != -1) | ||||||
| 			switch (optc) { | 			switch (optc) { | ||||||
| 			case 'l': | 			case 'l': | ||||||
| 				lflag = 1; | 				lflag = true; | ||||||
| 				break; | 				break; | ||||||
| 			case 's': | 			case 's': | ||||||
| 				if (!(t = gettrap(builtin_opt.optarg, true))) { | 				if (!(t = gettrap(builtin_opt.optarg, true))) { | ||||||
| @@ -1497,17 +1493,18 @@ c_getopts(const char **wp) | |||||||
| int | int | ||||||
| c_bind(const char **wp) | c_bind(const char **wp) | ||||||
| { | { | ||||||
| 	int optc, rv = 0, macro = 0, list = 0; | 	int optc, rv = 0; | ||||||
|  | 	bool macro = false, list = false; | ||||||
| 	const char *cp; | 	const char *cp; | ||||||
| 	char *up; | 	char *up; | ||||||
|  |  | ||||||
| 	while ((optc = ksh_getopt(wp, &builtin_opt, "lm")) != -1) | 	while ((optc = ksh_getopt(wp, &builtin_opt, "lm")) != -1) | ||||||
| 		switch (optc) { | 		switch (optc) { | ||||||
| 		case 'l': | 		case 'l': | ||||||
| 			list = 1; | 			list = true; | ||||||
| 			break; | 			break; | ||||||
| 		case 'm': | 		case 'm': | ||||||
| 			macro = 1; | 			macro = true; | ||||||
| 			break; | 			break; | ||||||
| 		case '?': | 		case '?': | ||||||
| 			return 1; | 			return 1; | ||||||
| @@ -1575,14 +1572,14 @@ c_umask(const char **wp) | |||||||
| { | { | ||||||
| 	int i; | 	int i; | ||||||
| 	const char *cp; | 	const char *cp; | ||||||
| 	int symbolic = 0; | 	bool symbolic = 0; | ||||||
| 	mode_t old_umask; | 	mode_t old_umask; | ||||||
| 	int optc; | 	int optc; | ||||||
|  |  | ||||||
| 	while ((optc = ksh_getopt(wp, &builtin_opt, "S")) != -1) | 	while ((optc = ksh_getopt(wp, &builtin_opt, "S")) != -1) | ||||||
| 		switch (optc) { | 		switch (optc) { | ||||||
| 		case 'S': | 		case 'S': | ||||||
| 			symbolic = 1; | 			symbolic = true; | ||||||
| 			break; | 			break; | ||||||
| 		case '?': | 		case '?': | ||||||
| 			return 1; | 			return 1; | ||||||
| @@ -2002,7 +1999,7 @@ c_trap(const char **wp) | |||||||
| 	if (*wp == NULL) { | 	if (*wp == NULL) { | ||||||
| 		for (p = sigtraps, i = NSIG+1; --i >= 0; p++) | 		for (p = sigtraps, i = NSIG+1; --i >= 0; p++) | ||||||
| 			if (p->trap != NULL) { | 			if (p->trap != NULL) { | ||||||
| 				shprintf("trap -- "); | 				shf_puts("trap -- ", shl_stdout); | ||||||
| 				print_value_quoted(p->trap); | 				print_value_quoted(p->trap); | ||||||
| 				shprintf(" %s\n", p->name); | 				shprintf(" %s\n", p->name); | ||||||
| 			} | 			} | ||||||
| @@ -3052,7 +3049,7 @@ c_ulimit(const char **wp) | |||||||
| 			} | 			} | ||||||
| 			shprintf("%-20s ", l->name); | 			shprintf("%-20s ", l->name); | ||||||
| 			if (val == (rlim_t)RLIM_INFINITY) | 			if (val == (rlim_t)RLIM_INFINITY) | ||||||
| 				shprintf("unlimited\n"); | 				shf_puts("unlimited\n", shl_stdout); | ||||||
| 			else { | 			else { | ||||||
| 				val = (rlim_t)(val / l->factor); | 				val = (rlim_t)(val / l->factor); | ||||||
| 				shprintf("%ld\n", (long)val); | 				shprintf("%ld\n", (long)val); | ||||||
| @@ -3085,7 +3082,7 @@ c_ulimit(const char **wp) | |||||||
| 	} | 	} | ||||||
| 	if (!set) { | 	if (!set) { | ||||||
| 		if (val == (rlim_t)RLIM_INFINITY) | 		if (val == (rlim_t)RLIM_INFINITY) | ||||||
| 			shprintf("unlimited\n"); | 			shf_puts("unlimited\n", shl_stdout); | ||||||
| 		else { | 		else { | ||||||
| 			val = (rlim_t)(val / l->factor); | 			val = (rlim_t)(val / l->factor); | ||||||
| 			shprintf("%ld\n", (long)val); | 			shprintf("%ld\n", (long)val); | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								jobs.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								jobs.c
									
									
									
									
									
								
							| @@ -2,7 +2,7 @@ | |||||||
|  |  | ||||||
| #include "sh.h" | #include "sh.h" | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.32 2007/10/25 15:23:09 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.33 2008/04/01 21:50:58 tg Exp $"); | ||||||
|  |  | ||||||
| /* Order important! */ | /* Order important! */ | ||||||
| #define PRUNNING	0 | #define PRUNNING	0 | ||||||
| @@ -635,7 +635,9 @@ j_resume(const char *cp, int bg) | |||||||
| 			p->status = 0; | 			p->status = 0; | ||||||
| 			running = 1; | 			running = 1; | ||||||
| 		} | 		} | ||||||
| 		shprintf("%s%s", p->command, p->next ? "| " : null); | 		shf_puts(p->command, shl_stdout); | ||||||
|  | 		if (p->next) | ||||||
|  | 			shf_puts("| ", shl_stdout); | ||||||
| 	} | 	} | ||||||
| 	shf_putc('\n', shl_stdout); | 	shf_putc('\n', shl_stdout); | ||||||
| 	shf_flush(shl_stdout); | 	shf_flush(shl_stdout); | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								misc.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								misc.c
									
									
									
									
									
								
							| @@ -6,7 +6,7 @@ | |||||||
| #include <grp.h> | #include <grp.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/misc.c,v 1.70 2008/04/01 20:40:22 tg Exp $\t" | __RCSID("$MirOS: src/bin/mksh/misc.c,v 1.71 2008/04/01 21:50:58 tg Exp $\t" | ||||||
| 	MKSH_SH_H_ID); | 	MKSH_SH_H_ID); | ||||||
|  |  | ||||||
| #undef USE_CHVT | #undef USE_CHVT | ||||||
| @@ -192,7 +192,7 @@ printoptions(int verbose) | |||||||
| 		int n, len; | 		int n, len; | ||||||
|  |  | ||||||
| 		/* verbose version */ | 		/* verbose version */ | ||||||
| 		shprintf("Current option settings\n"); | 		shf_puts("Current option settings\n", shl_stdout); | ||||||
|  |  | ||||||
| 		for (i = n = oi.opt_width = 0; i < NELEM(options); i++) | 		for (i = n = oi.opt_width = 0; i < NELEM(options); i++) | ||||||
| 			if (options[i].name) { | 			if (options[i].name) { | ||||||
| @@ -205,7 +205,7 @@ printoptions(int verbose) | |||||||
| 		    oi.opt_width + 5, 1); | 		    oi.opt_width + 5, 1); | ||||||
| 	} else { | 	} else { | ||||||
| 		/* short version ala ksh93 */ | 		/* short version ala ksh93 */ | ||||||
| 		shprintf("set"); | 		shf_puts("set", shl_stdout); | ||||||
| 		for (i = 0; i < NELEM(options); i++) | 		for (i = 0; i < NELEM(options); i++) | ||||||
| 			if (Flag(i) && options[i].name) | 			if (Flag(i) && options[i].name) | ||||||
| 				shprintf(" -o %s", options[i].name); | 				shprintf(" -o %s", options[i].name); | ||||||
| @@ -927,7 +927,7 @@ print_value_quoted(const char *s) | |||||||
| 		if (ctype(*p, C_QUOTE)) | 		if (ctype(*p, C_QUOTE)) | ||||||
| 			break; | 			break; | ||||||
| 	if (!*p) { | 	if (!*p) { | ||||||
| 		shprintf("%s", s); | 		shf_puts(s, shl_stdout); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	for (p = s; *p; p++) { | 	for (p = s; *p; p++) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user