union {
char *s;
- int i;
+ int64_t i;
} u;
};
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 *));
struct val *
make_int(i)
- int i;
+ int64_t i;
{
struct val *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;
to_integer(vp)
struct val *vp;
{
- int r;
+ int64_t r;
if (vp->type == integer)
return 1;
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;
}
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) {
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);
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;
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, "");
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
}
(void)nanosleep(&ntime, NULL);
-#endif
exit(0);
/* NOTREACHED */