summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-26 19:58:58 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-26 19:58:58 +0000
commitd29337580e6ad49ca3353a22b9099e9e47a4bd17 (patch)
tree157a07c9435d8b1c00a414db18c73bfdb199029c /scripts
parent781e42d66c120183e4dea1058dc539bdc4c53651 (diff)
downloadbusybox-w32-d29337580e6ad49ca3353a22b9099e9e47a4bd17.tar.gz
busybox-w32-d29337580e6ad49ca3353a22b9099e9e47a4bd17.tar.bz2
busybox-w32-d29337580e6ad49ca3353a22b9099e9e47a4bd17.zip
- use strtol instead of strtoll if the latter does not exist
- add and use wrapper for attribute - add and use replacement for vasprintf if it is unavailable
Diffstat (limited to 'scripts')
-rw-r--r--scripts/bb_mkdep.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/scripts/bb_mkdep.c b/scripts/bb_mkdep.c
index 2ad20a6a8..0c0b09dac 100644
--- a/scripts/bb_mkdep.c
+++ b/scripts/bb_mkdep.c
@@ -69,10 +69,19 @@
69#include <fcntl.h> 69#include <fcntl.h>
70#include <limits.h> 70#include <limits.h>
71 71
72#ifdef __GNUC__
73#define ATTRIBUTE __attribute__
74#else
75#define ATTRIBUTE(a) /* nothing */
76#endif
77
78#if !(defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC))
79#define strtoll strtol
80#endif
72 81
73/* partial and simplified libbb routine */ 82/* partial and simplified libbb routine */
74static void bb_error_d(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); 83static void bb_error_d(const char *s, ...) ATTRIBUTE ((noreturn, format (printf, 1, 2)));
75static char * bb_asprint(const char *format, ...) __attribute__ ((format (printf, 1, 2))); 84static char * bb_asprint(const char *format, ...) ATTRIBUTE ((format (printf, 1, 2)));
76static char *bb_simplify_path(const char *path); 85static char *bb_simplify_path(const char *path);
77 86
78/* stolen from libbb as is */ 87/* stolen from libbb as is */
@@ -1598,7 +1607,7 @@ static void scan_dir_find_ch_files(const char *p)
1598 } 1607 }
1599} 1608}
1600 1609
1601static void show_usage(void) __attribute__ ((noreturn)); 1610static void show_usage(void) ATTRIBUTE ((noreturn));
1602static void show_usage(void) 1611static void show_usage(void)
1603{ 1612{
1604 bb_error_d("%s\n%s\n", bb_mkdep_terse_options, bb_mkdep_full_options); 1613 bb_error_d("%s\n%s\n", bb_mkdep_terse_options, bb_mkdep_full_options);
@@ -1720,9 +1729,16 @@ static char *bb_asprint(const char *format, ...)
1720 int r; 1729 int r;
1721 char *out; 1730 char *out;
1722 1731
1732#ifdef __USE_GNU
1723 va_start(p, format); 1733 va_start(p, format);
1724 r = vasprintf(&out, format, p); 1734 r = vasprintf(&out, format, p);
1725 va_end(p); 1735 va_end(p);
1736#else
1737 out = xmalloc(BUFSIZ);
1738 va_start(p, format);
1739 r = vsprintf(out, format, p);
1740 va_end(p);
1741#endif
1726 1742
1727 if (r < 0) 1743 if (r < 0)
1728 bb_error_d("bb_asprint: %m"); 1744 bb_error_d("bb_asprint: %m");