Skip to content

Commit

Permalink
Fix some compile errors when removing some log types from the build.
Browse files Browse the repository at this point in the history
  • Loading branch information
holger24 committed Jan 17, 2021
1 parent 2b4f3f0 commit ce80883
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 47 deletions.
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ UNINSTALL_HOOKS =

include src/common/Makemodule.am
include src/log/Makemodule.am
if WITH_ALDA
include src/log/alda/Makemodule.am
endif
if WITH_AFD_MON
include src/afd_mon/Makemodule.am
endif
Expand Down
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ AC_SUBST(AFD_RELEASE)
AC_TRY_COMPILE(,[long long i;],
AC_DEFINE(HAVE_LONG_LONG, 1, [Define if C compiler supports long long type.]))

compile_alda=false
dnl# --------------------------------------------------------------------------
dnl# Checking Configure Command Line Options
dnl# --------------------------------------------------------------------------
Expand All @@ -32,6 +33,7 @@ AC_ARG_ENABLE(input_log,
ac_cv_input_log=""],
[AC_DEFINE([_INPUT_LOG], [], [With input log support])
ac_cv_input_log="INPUT "
compile_alda=true
AM_CONDITIONAL(WITH_INPUT_LOG, true)])

AC_ARG_ENABLE(distribution_log,
Expand All @@ -48,6 +50,7 @@ AC_ARG_ENABLE(output_log,
ac_cv_output_log=""],
[AC_DEFINE([_OUTPUT_LOG], [], [With output log support])
ac_cv_output_log="OUTPUT "
compile_alda=true
AM_CONDITIONAL(WITH_OUTPUT_LOG, true)])

AC_ARG_ENABLE(confirmation_log,
Expand All @@ -64,6 +67,7 @@ AC_ARG_ENABLE(delete_log,
ac_cv_delete_log=""],
[AC_DEFINE([_DELETE_LOG], [], [With delete log support])
ac_cv_delete_log="DELETE "
compile_alda=true
AM_CONDITIONAL(WITH_DELETE_LOG, true)])

AC_ARG_ENABLE(production_log,
Expand All @@ -72,6 +76,7 @@ AC_ARG_ENABLE(production_log,
ac_cv_production_log=""],
[AC_DEFINE([_PRODUCTION_LOG], [], [With production log support])
ac_cv_production_log="PRODUCTION "
compile_alda=true
AM_CONDITIONAL(WITH_PRODUCTION_LOG, true)])

AC_ARG_ENABLE(maintainer_log,
Expand All @@ -98,6 +103,8 @@ AC_ARG_ENABLE(alda_cache_positioning,
[AM_CONDITIONAL(WITH_ALDA_CACHE_POSITIONING, false)
ac_cv_alda_cache=""])

AM_CONDITIONAL(WITH_ALDA, $compile_alda)

AC_ARG_ENABLE(ncurses_ui,
[ --disable-ncurses_ui disable nCurses support],
[ac_cv_ncurses_ui="no"],
Expand Down
56 changes: 36 additions & 20 deletions src/amg/handle_options.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* handle_options.c - Part of AFD, an automatic file distribution program.
* Copyright (c) 1995 - 2018 Holger Kiehl <[email protected]>
* Copyright (c) 1995 - 2021 Holger Kiehl <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -241,7 +241,7 @@ static void prepare_rename_ow(int, char **, off_t **),
#endif
int, char *, char *);
static int cleanup_rename_ow(int,
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
int, time_t, unsigned int,
unsigned int, char *,
#endif
Expand Down Expand Up @@ -277,7 +277,7 @@ handle_options(int position,
j;
off_t size;
char *options,
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
*p_option,
#endif
*ptr,
Expand All @@ -300,7 +300,7 @@ handle_options(int position,
if ((db[position].loptions_flag & RENAME_ID_FLAG) &&
(CHECK_STRNCMP(options, RENAME_ID, RENAME_ID_LENGTH) == 0))
{
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
p_option = options;
#endif
/*
Expand Down Expand Up @@ -574,7 +574,7 @@ handle_options(int position,
} /* for (j = 0; j < file_counter; j++) */

*files_to_send = cleanup_rename_ow(file_counter,
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
position, creation_time,
unique_number,
split_job_counter,
Expand Down Expand Up @@ -602,7 +602,7 @@ handle_options(int position,
{
char *p_rule;

#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
p_option = options;
#endif

Expand Down Expand Up @@ -905,7 +905,7 @@ handle_options(int position,
} /* for (j = 0; j < file_counter; j++) */

*files_to_send = cleanup_rename_ow(file_counter,
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
position, creation_time,
unique_number,
split_job_counter,
Expand Down Expand Up @@ -958,7 +958,7 @@ handle_options(int position,
*/

/* Determine the type of exec command, first the old one. */
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
p_option = options;
#endif
p_command = options + EXEC_ID_LENGTH;
Expand Down Expand Up @@ -1291,7 +1291,12 @@ handle_options(int position,
sched_priority,
#endif
"", &cpu_usage, &production_time,
clktck, exec_timeout,
#ifdef _PRODUCTION_LOG
clktck,
#else
0,
#endif
exec_timeout,
YES, YES)) != 0) /* ie != SUCCESS */
{
receive_log(WARN_SIGN, __FILE__, __LINE__, 0L,
Expand Down Expand Up @@ -1540,7 +1545,12 @@ handle_options(int position,
#ifdef HAVE_SETPRIORITY
sched_priority,
#endif
"", &cpu_usage, &production_time, clktck,
"", &cpu_usage, &production_time,
#ifdef _PRODUCTION_LOG
clktck,
#else
0,
#endif
exec_timeout, YES, YES)) != 0)
{
receive_log(WARN_SIGN, __FILE__, __LINE__, 0L,
Expand Down Expand Up @@ -1901,7 +1911,7 @@ handle_options(int position,
}

*files_to_send = cleanup_rename_ow(file_counter,
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
position, creation_time,
unique_number,
split_job_counter, options,
Expand Down Expand Up @@ -2004,7 +2014,7 @@ handle_options(int position,
p_file_name += MAX_FILENAME_LENGTH;
}
*files_to_send = cleanup_rename_ow(file_counter,
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
position, creation_time,
unique_number,
split_job_counter, options,
Expand Down Expand Up @@ -2035,7 +2045,7 @@ handle_options(int position,
*p_prefix_newname;

/* Get the prefix. */
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
p_option = options;
#endif
p_prefix = options + ADD_PREFIX_ID_LENGTH;
Expand Down Expand Up @@ -2084,7 +2094,7 @@ handle_options(int position,
p_file_name += MAX_FILENAME_LENGTH;
}
*files_to_send = cleanup_rename_ow(file_counter,
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
position, creation_time,
unique_number,
split_job_counter, p_option,
Expand Down Expand Up @@ -2120,7 +2130,7 @@ handle_options(int position,
char *new_name_buffer;

/* Get the prefix. */
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
p_option = options;
#endif
p_prefix = options + DEL_PREFIX_ID_LENGTH;
Expand Down Expand Up @@ -2167,7 +2177,7 @@ handle_options(int position,
p_file_name += MAX_FILENAME_LENGTH;
}
*files_to_send = cleanup_rename_ow(file_counter,
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
position, creation_time,
unique_number,
split_job_counter, p_option,
Expand Down Expand Up @@ -2488,7 +2498,7 @@ handle_options(int position,
p_file_name += MAX_FILENAME_LENGTH;
}
*files_to_send = cleanup_rename_ow(file_counter,
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
position, creation_time,
unique_number,
split_job_counter, options,
Expand Down Expand Up @@ -2561,7 +2571,7 @@ handle_options(int position,
p_file_name += MAX_FILENAME_LENGTH;
}
*files_to_send = cleanup_rename_ow(file_counter,
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
position, creation_time,
unique_number,
split_job_counter, options,
Expand Down Expand Up @@ -3115,7 +3125,9 @@ handle_options(int position,
struct tms tval;
struct rusage ru;
struct timeval cpu_usage;
#endif

#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
p_option = options;
#endif
if ((*(options + GRIB2WMO_ID_LENGTH) == ' ') ||
Expand Down Expand Up @@ -3254,7 +3266,7 @@ handle_options(int position,
char *p_extract_id,
*p_filter;

#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
p_option = options;
#endif
p_extract_id = options + EXTRACT_ID_LENGTH + 1;
Expand Down Expand Up @@ -3734,7 +3746,9 @@ handle_options(int position,
struct tms tval;
struct rusage ru;
struct timeval cpu_usage;
#endif

#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
p_option = options;
#endif
p_assemble_id = options + ASSEMBLE_ID_LENGTH + 1;
Expand Down Expand Up @@ -3936,7 +3950,9 @@ handle_options(int position,
struct tms tval;
struct rusage ru;
struct timeval cpu_usage;
#endif

#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
p_option = options;
#endif
p_convert_id = options + CONVERT_ID_LENGTH + 1;
Expand Down Expand Up @@ -4440,7 +4456,7 @@ prepare_rename_ow(int file_counter,
/*++++++++++++++++++++++++++ cleanup_rename_ow() ++++++++++++++++++++++++*/
static int
cleanup_rename_ow(int file_counter,
#ifdef _PRODUCTION_LOG
#if defined (_PRODUCTION_LOG) || defined (_DELETE_LOG)
int position,
time_t creation_time,
unsigned int unique_number,
Expand Down
42 changes: 30 additions & 12 deletions src/fd/get_file_names.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,15 @@ extern struct delete_log dl;

#if defined (_DELETE_LOG) || defined (_OUTPUT_LOG)
/* Local function prototypes. */
static void log_data(char *,
struct stat *,
# ifdef WITH_DUP_CHECK
static void log_data(char *, struct stat *, time_t, int, char);
# else
static void log_data(char *, struct stat *, time_t, char);
int,
# endif
# ifdef _OUTPUT_LOG
char,
# endif
time_t);
#endif


Expand Down Expand Up @@ -481,8 +485,11 @@ get_file_names(char *file_path, off_t *file_size_to_send)
# if defined (_DELETE_LOG) || defined (_OUTPUT_LOG)
else
{
log_data(p_dir->d_name, &stat_buf, now,
YES, OT_DUPLICATE_DELETE + '0');
log_data(p_dir->d_name, &stat_buf, YES,
# ifdef _OUTPUT_LOG
OT_DUPLICATE_DELETE + '0',
# endif
now);
}
# endif
}
Expand All @@ -503,8 +510,11 @@ get_file_names(char *file_path, off_t *file_size_to_send)
# if defined (_DELETE_LOG) || defined (_OUTPUT_LOG)
else
{
log_data(p_dir->d_name, &stat_buf, now,
YES, OT_DUPLICATE_STORED + '0');
log_data(p_dir->d_name, &stat_buf, YES,
# ifdef _OUTPUT_LOG
OT_DUPLICATE_STORED + '0',
# endif
now);
}
# endif
}
Expand All @@ -524,12 +534,18 @@ get_file_names(char *file_path, off_t *file_size_to_send)
else
{
#if defined (_DELETE_LOG) || defined (_OUTPUT_LOG)
log_data(p_dir->d_name, &stat_buf, now,
log_data(p_dir->d_name, &stat_buf,
# ifdef WITH_DUP_CHECK
is_duplicate, (is_duplicate == YES) ? (OT_DUPLICATE_DELETE + '0') : (OT_AGE_LIMIT_DELETE + '0'));
is_duplicate,
# ifdef _OUTPUT_LOG
(is_duplicate == YES) ? (OT_DUPLICATE_DELETE + '0') : (OT_AGE_LIMIT_DELETE + '0'),
# endif
# else
OT_AGE_LIMIT_DELETE + '0');
# ifdef _OUTPUT_LOG
OT_AGE_LIMIT_DELETE + '0',
# endif
# endif
now);
#endif
#ifndef _DELETE_LOG
if ((db.protocol & FTP_FLAG) || (db.protocol & SFTP_FLAG))
Expand Down Expand Up @@ -860,11 +876,13 @@ get_file_names(char *file_path, off_t *file_size_to_send)
static void
log_data(char *d_name,
struct stat *stat_buf,
time_t now,
# ifdef WITH_DUP_CHECK
int is_duplicate,
# endif
char output_type)
# ifdef _OUTPUT_LOG
char output_type,
# endif
time_t now)
{
# ifdef _DELETE_LOG
int prog_name_length;
Expand Down
Loading

0 comments on commit ce80883

Please sign in to comment.