-#define INIT_STDERR_LOGGING(loglevel_barrier) \
- __printf_2_3 void __log(int ll, const char* fmt,...) \
- { \
- va_list argp; \
- if (ll < loglevel_barrier) \
- return; \
- va_start(argp, fmt); \
- vfprintf(stderr, fmt, argp); \
- va_end(argp); \
- }
-
-/** version text used by various commands if -V switch was given */
-#define VERSION_TEXT(prefix) "para_" prefix " " PACKAGE_VERSION " (" CODENAME ")" "\n" \
- "Copyright (C) 2008 Andre Noll\n" \
- "This is free software with ABSOLUTELY NO WARRANTY." \
- " See COPYING for details.\n" \
- "Written by Andre Noll.\n" \
- "Report bugs to <maan@systemlinux.org>.\n"
-
-/** print out \p VERSION_TEXT and exit if version flag was given */
-#define HANDLE_VERSION_FLAG(_prefix, _args_info_struct) \
- if (_args_info_struct.version_given) { \
- printf("%s", VERSION_TEXT(_prefix)); \
- exit(EXIT_SUCCESS); \
- }
-/** sent by para_server for commands that expect a data file */
-#define AWAITING_DATA_MSG "\nAwaiting Data."
-/** sent by para_server if authentication was successful */
-#define PROCEED_MSG "\nProceed.\n"
-/** length of the \p PROCEED_MSG string */
-#define PROCEED_MSG_LEN strlen(PROCEED_MSG)
-/** sent by para_client to indicate the end of the command line */
-#define EOC_MSG "\nEnd of Command."
-/** sent by para_client, followed by the decrypted challenge number */
-#define CHALLENGE_RESPONSE_MSG "challenge_response:"
-
-/* exec */
-int para_exec_cmdline_pid(pid_t *pid, const char *cmdline, int *fds);
-
-/* time */
-int tv_diff(const struct timeval *b, const struct timeval *a, struct timeval *diff);
-long unsigned tv2ms(const struct timeval*);
-void d2tv(double, struct timeval*);
-void tv_add(const struct timeval*, const struct timeval *, struct timeval *);
-void tv_scale(const unsigned long, const struct timeval *, struct timeval *);
-void tv_divide(const unsigned long divisor, const struct timeval *tv,
- struct timeval *result);
-int tv_convex_combination(const long a, const struct timeval *tv1,
- const long b, const struct timeval *tv2,
- struct timeval *result);
-void ms2tv(const long unsigned n, struct timeval *tv);
-void compute_chunk_time(long unsigned chunk_num,
- struct timeval *chunk_tv, struct timeval *stream_start,
- struct timeval *result);
-
-__printf_2_3 void __log(int, const char*, ...);
+/*
+ * The values should be cast to an unsigned char first, then to int.
+ * Why? Because the isdigit (as do all other is/to functions/macros)
+ * expect a number from 0 upto and including 255 as their (int) argument.
+ * Because char is signed on most systems, casting it to int immediately
+ * gives the functions an argument between -128 and 127 (inclusive),
+ * which they will use as an array index, and which will thus fail
+ * horribly for characters which have their most significant bit set.
+ */
+#define adu_isspace(c) isspace((int)(unsigned char)(c))