From: Apple Date: Tue, 29 Jun 2004 05:24:53 +0000 (+0000) Subject: shell_cmds-55.tar.gz X-Git-Tag: v55^0 X-Git-Url: https://git.saurik.com/apple/shell_cmds.git/commitdiff_plain/2ac7f7944aa87a432c2735764a2da6bb88d37197 shell_cmds-55.tar.gz --- diff --git a/expr/expr.c b/expr/expr.c index 5323427..4732044 100644 --- a/expr/expr.c +++ b/expr/expr.c @@ -27,7 +27,7 @@ struct val { union { char *s; - int i; + int64_t i; } u; }; @@ -35,10 +35,10 @@ enum token token; struct val *tokval; char **av; -struct val *make_int __P((int)); +struct val *make_int __P((int64_t)); struct val *make_str __P((char *)); void free_value __P((struct val *)); -int is_integer __P((struct val *, int *)); +int is_integer __P((struct val *, int64_t *)); int to_integer __P((struct val *)); void to_string __P((struct val *)); int is_zero_or_null __P((struct val *)); @@ -56,7 +56,7 @@ int main __P((int, char **)); struct val * make_int(i) - int i; + int64_t i; { struct val *vp; @@ -99,11 +99,11 @@ free_value(vp) int is_integer(vp, r) struct val *vp; - int *r; + int64_t *r; { char *s; int neg; - int i; + int64_t i; if (vp->type == integer) { *r = vp->u.i; @@ -144,7 +144,7 @@ int to_integer(vp) struct val *vp; { - int r; + int64_t r; if (vp->type == integer) return 1; @@ -170,11 +170,11 @@ to_string(vp) if (vp->type == string) return; - tmp = malloc(25); + tmp = malloc(100); if (tmp == NULL) { err(2, "%s", ""); } - (void)snprintf(tmp, 25, "%d", vp->u.i); + (void)snprintf(tmp, 100, "%lld", vp->u.i); vp->type = string; vp->u.s = tmp; } @@ -384,7 +384,7 @@ eval2() struct val *l, *r; enum token op; int v = 0; /* pacify gcc */ - int li, ri; + int64_t li, ri; l = eval3(); while ((op = token) == EQ || op == NE || op == LT || op == GT || op == LE || op == GE) { @@ -539,7 +539,7 @@ main(argc, argv) error(); if (vp->type == integer) - (void)printf("%d\n", vp->u.i); + (void)printf("%lld\n", vp->u.i); else (void)printf("%s\n", vp->u.s); diff --git a/pwd/pwd.c b/pwd/pwd.c index bdd80bd..1bf8c39 100644 --- a/pwd/pwd.c +++ b/pwd/pwd.c @@ -60,18 +60,6 @@ char *getcwd_logical __P((char *, size_t)); void usage __P((void)); int main __P((int, char *[])); -#ifdef __APPLE__ -char -*getcwd_physical(pt, size) - char *pt; - size_t size; -{ - unsetenv("PWD"); - return getcwd(pt, size); -} -#define getcwd getcwd_physical -#endif - int main(argc, argv) int argc; diff --git a/sleep/sleep.c b/sleep/sleep.c index 7f0203a..87785b9 100644 --- a/sleep/sleep.c +++ b/sleep/sleep.c @@ -65,14 +65,10 @@ main(argc, argv) int argc; char *argv[]; { -#ifndef __APPLE__ char *arg, *temp; double val, ival, fval; struct timespec ntime; int fracflag; -#else - int secs; -#endif int ch; (void)setlocale(LC_ALL, ""); @@ -91,10 +87,6 @@ main(argc, argv) if (argc != 1) usage(); -#ifdef __APPLE__ - if ((secs = atoi(*argv)) > 0) - (void)sleep(secs); -#else /* * Okay, why not just use atof for everything? Why bother * checking if there is a fraction in use? Because the old @@ -130,7 +122,6 @@ main(argc, argv) } (void)nanosleep(&ntime, NULL); -#endif exit(0); /* NOTREACHED */