summaryrefslogtreecommitdiff
path: root/rsync/trace.h
authoreilers <eilers>2003-11-03 16:52:18 (UTC)
committer eilers <eilers>2003-11-03 16:52:18 (UTC)
commitd34dc773591a2d467c68875a68a671d6a809f861 (patch) (side-by-side diff)
treeb57e5ae15c51e3d87ca95d57aedfd1ca3db57bfe /rsync/trace.h
parentce84f2d8bdd65c438821f0457cdad6bbbfa73380 (diff)
downloadopie-d34dc773591a2d467c68875a68a671d6a809f861.zip
opie-d34dc773591a2d467c68875a68a671d6a809f861.tar.gz
opie-d34dc773591a2d467c68875a68a671d6a809f861.tar.bz2
Porting Opie to MacOS-X.
The base system and all platform independent applications and platforms should work. Please see $OPIEDIR/development/macosx for details
Diffstat (limited to 'rsync/trace.h') (more/less context) (ignore whitespace changes)
-rw-r--r--rsync/trace.h40
1 files changed, 15 insertions, 25 deletions
diff --git a/rsync/trace.h b/rsync/trace.h
index 60a6477..2bb8552 100644
--- a/rsync/trace.h
+++ b/rsync/trace.h
@@ -15,108 +15,98 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* TODO: A function like perror that includes strerror output. Apache
* does this by adding flags as well as the severity level which say
* whether such information should be included.
*/
/*
* trace may be turned off.
*
* error is always on, but you can return and continue in some way
*
* fatal terminates the whole process
*/
-void rs_fatal0(char const *s, ...);
-void rs_error0(char const *s, ...);
-void rs_trace0(char const *s, ...);
-
-void rs_log0_nofn(int level, char const *fmt, ...);
-
-#ifdef __GNUC__
+#if defined(HAVE_VARARG_MACROS) && defined(__GNUC__)
+/*
+ * TODO: Don't assume this is a gcc thing; rather test in autoconf for
+ * support for __FUNCTION__. One simple way might just be to try compiling
+ * the definition of one of these functions!
+ *
+ * TODO: Also look for the C9X predefined identifier `_function', or
+ * whatever it's called.
+ */
void rs_log0(int level, char const *fn, char const *fmt, ...)
__attribute__ ((format(printf, 3, 4)));
#ifdef DO_RS_TRACE
# define rs_trace(fmt, arg...) \
do { rs_log0(RS_LOG_DEBUG, __FUNCTION__, fmt , ##arg); \
} while (0)
#else
-# define rs_trace(s, str...)
+# define rs_trace(fmt, arg...)
#endif /* !DO_RS_TRACE */
-/*
- * TODO: Don't assume this is a gcc thing; rather test in autoconf for
- * support for __FUNCTION__ and varargs macros. One simple way might
- * just be to try compiling the definition of one of these functions!
- *
- * TODO: Also look for the C9X predefined identifier `_function', or
- * whatever it's called.
- */
-
#define rs_log(l, s, str...) do { \
rs_log0((l), __FUNCTION__, (s) , ##str); \
} while (0)
#define rs_error(s, str...) do { \
rs_log0(RS_LOG_ERR, __FUNCTION__, (s) , ##str); \
} while (0)
#define rs_fatal(s, str...) do { \
rs_log0(RS_LOG_CRIT, __FUNCTION__, \
(s) , ##str); \
abort(); \
} while (0)
#else /************************* ! __GNUC__ */
-
+# define rs_trace rs_trace0
# define rs_fatal rs_fatal0
# define rs_error rs_error0
# define rs_log rs_log0_nofn
-
-# ifdef DO_RS_TRACE
-# define rs_trace rs_trace0
-# endif /* DO_RS_TRACE */
#endif /* ! __GNUC__ */
-
+void rs_trace0(char const *s, ...);
+void rs_fatal0(char const *s, ...);
+void rs_error0(char const *s, ...);
void rs_log0(int level, char const *fn, char const *fmt, ...);
-
+void rs_log0_nofn(int level, char const *fmt, ...);
enum {
RS_LOG_PRIMASK = 7, /**< Mask to extract priority
part. \internal */
RS_LOG_NONAME = 8 /**< \b Don't show function name in
message. */
};
-
/**
* \macro rs_trace_enabled()
*
* Call this before putting too much effort into generating trace
* messages.
*/
extern int rs_trace_level;
#ifdef DO_RS_TRACE
# define rs_trace_enabled() ((rs_trace_level & RS_LOG_PRIMASK) >= RS_LOG_DEBUG)
#else
# define rs_trace_enabled() 0
#endif