diff --git a/alternating.c b/alternating.c index e197dfc..403c919 100644 --- a/alternating.c +++ b/alternating.c @@ -432,7 +432,7 @@ void mk_alternating(Node *p) /* generates an alternating automaton for p */ if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nBuilding and simplification of the alternating automaton: %lli.%06is", + fprintf(tl_out, "\nBuilding and simplification of the alternating automaton: %lli.%06ld", (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i states, %i transitions\n", astate_count, atrans_count); } diff --git a/buchi.c b/buchi.c index 57bc6e9..0319784 100644 --- a/buchi.c +++ b/buchi.c @@ -112,7 +112,7 @@ int simplify_btrans() /* simplifies the transitions */ if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nSimplification of the Buchi automaton - transitions: %lli.%06is", + fprintf(tl_out, "\nSimplification of the Buchi automaton - transitions: %lli.%06ld", (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i transitions removed\n", changed); @@ -226,7 +226,7 @@ int simplify_bstates() /* eliminates redundant states */ if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nSimplification of the Buchi automaton - states: %lli.%06is", + fprintf(tl_out, "\nSimplification of the Buchi automaton - states: %lli.%06ld", (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i states removed\n", changed); } @@ -671,7 +671,7 @@ void mk_buchi() if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nBuilding the Buchi automaton : %lli.%06is", + fprintf(tl_out, "\nBuilding the Buchi automaton : %lli.%06ld", (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i states, %i transitions\n", bstate_count, btrans_count); } diff --git a/generalized.c b/generalized.c index 1087173..0ce93f5 100644 --- a/generalized.c +++ b/generalized.c @@ -151,7 +151,7 @@ int simplify_gtrans() /* simplifies the transitions */ if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nSimplification of the generalized Buchi automaton - transitions: %lli.%06is", + fprintf(tl_out, "\nSimplification of the generalized Buchi automaton - transitions: %lli.%06ld", (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i transitions removed\n", changed); } @@ -244,7 +244,7 @@ int simplify_gstates() /* eliminates redundant states */ if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nSimplification of the generalized Buchi automaton - states: %lli.%06is", + fprintf(tl_out, "\nSimplification of the generalized Buchi automaton - states: %lli.%06ld", (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i states removed\n", changed); } @@ -616,7 +616,7 @@ void mk_generalized() if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nBuilding the generalized Buchi automaton : %lli.%06is", + fprintf(tl_out, "\nBuilding the generalized Buchi automaton : %lli.%06ld", (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i states, %i transitions\n", gstate_count, gtrans_count); } diff --git a/util.c b/util.c index c4bd0fc..391eedb 100644 --- a/util.c +++ b/util.c @@ -13,6 +13,50 @@ int tl_verbose = 0; int tl_terse = 0; unsigned long All_Mem = 0; +#ifdef __GLIBC__ +size_t strlcpy(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while ((ch = *p++)) { + if (bytes+1 < size) + *q++ = ch; + bytes++; + } + + /* If size == 0 there is no space for a final null... */ + if (size) + *q = '\0'; + return bytes; +} + +size_t strlcat(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while (bytes < size && *q) { + q++; + bytes++; + } + if (bytes == size) + return (bytes + strlen(src)); + + while ((ch = *p++)) { + if (bytes+1 < size) + *q++ = ch; + bytes++; + } + + *q = '\0'; + return bytes; +} +#endif /* __GLIBC__ */ static char uform[4096]; static int hasuform=0, cnt=0;