diff options
author | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2018-04-14 13:07:01 +0200 |
---|---|---|
committer | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2018-04-14 13:07:01 +0200 |
commit | 2a2b8dbef01135f2c3a9223f3df8f847a6a531c9 (patch) | |
tree | cff6779644edece904d5313dcb5c4c742d7b74fc | |
parent | ed54c143edd38c7fcc8d36df6ec4d974c6c741ba (diff) | |
download | embedlog-2a2b8dbef01135f2c3a9223f3df8f847a6a531c9.tar.gz embedlog-2a2b8dbef01135f2c3a9223f3df8f847a6a531c9.tar.bz2 embedlog-2a2b8dbef01135f2c3a9223f3df8f847a6a531c9.zip |
change EL_FNAME to more logical EL_FPATH
-rw-r--r-- | examples/print-to-file.c | 2 | ||||
-rw-r--r-- | include/embedlog.h | 2 | ||||
-rw-r--r-- | man/el_init.3 | 2 | ||||
-rw-r--r-- | man/el_option.3 | 6 | ||||
-rw-r--r-- | man/el_print.3 | 2 | ||||
-rw-r--r-- | src/el-file.c | 2 | ||||
-rw-r--r-- | src/el-options.c | 2 | ||||
-rw-r--r-- | tst/test-el-file.c | 44 |
8 files changed, 31 insertions, 31 deletions
diff --git a/examples/print-to-file.c b/examples/print-to-file.c index aa2418e..961b73e 100644 --- a/examples/print-to-file.c +++ b/examples/print-to-file.c @@ -26,7 +26,7 @@ int main(void) goto error; } - if (el_option(EL_FNAME, WORKDIR"/log") != 0) + if (el_option(EL_FPATH, WORKDIR"/log") != 0) { /* * embedlog will try to open file now, this may fail for various of diff --git a/include/embedlog.h b/include/embedlog.h index c228acc..16d7dfe 100644 --- a/include/embedlog.h +++ b/include/embedlog.h @@ -100,7 +100,7 @@ enum el_option EL_TTY_DEV, EL_PREFIX, - EL_FNAME, + EL_FPATH, EL_FROTATE_NUMBER, EL_FROTATE_SIZE, EL_FILE_SYNC_EVERY, diff --git a/man/el_init.3 b/man/el_init.3 index 18552b8..dca5c64 100644 --- a/man/el_init.3 +++ b/man/el_init.3 @@ -76,7 +76,7 @@ Note: error handling has been ommited for clarity sake /* make opts to print to file */ el_ooption(&opts, EL_OUT, EL_OUT_STDERR); - el_ooption(&opts, EL_FNAME, "/tmp/test.log"); + el_ooption(&opts, EL_FPATH, "/tmp/test.log"); /* print messages */ el_print(ELI, "will print to stderr"); diff --git a/man/el_option.3 b/man/el_option.3 index d7f32d4..ae340a6 100644 --- a/man/el_option.3 +++ b/man/el_option.3 @@ -119,7 +119,7 @@ POSIX.1-2001 and any syslog daemon . RS Messages will be printed to file. To work user should set output file with -. BR EL_FNAME . +. BR EL_FPATH . Log rotation can be configured with . B EL_FROTATE_NUMBER and @@ -395,7 +395,7 @@ It is still mandatory to enable custom printing with . BR el_option (3) .RE .PP -.BI "EL_FNAME (" const " " char " " * "path)" +.BI "EL_FPATH (" const " " char " " * "path)" .RS Sets the .I path @@ -433,7 +433,7 @@ specified file without size limit. The only size limit is the one presented by the filesystem and architecture. . PP If this value is bigger than 0, file rotation will be enabled. All files will -have suffixes added to name set in EL_FNAME. For example, +have suffixes added to name set in EL_FPATH. For example, . IR program.log.0 . Files are enumareted from . I .0 diff --git a/man/el_print.3 b/man/el_print.3 index c7d6c78..e2d3a22 100644 --- a/man/el_print.3 +++ b/man/el_print.3 @@ -244,7 +244,7 @@ Any of the input parameters is invalid. .TP .B EBADF Loggig to file is enabled and filename was not set with -.B EL_FNAME +.B EL_FPATH option .TP .B EBADF diff --git a/src/el-file.c b/src/el-file.c index 0358b95..ae032f8 100644 --- a/src/el-file.c +++ b/src/el-file.c @@ -257,7 +257,7 @@ int el_file_open /* * to prevent any memory leak in case of double open, we first * close already opened file Such situation may happen when library - * user changes file name using EL_FNAME option, + * user changes file name using EL_FPATH option, */ fclose(options->file); diff --git a/src/el-options.c b/src/el-options.c index e54f30c..c51608c 100644 --- a/src/el-options.c +++ b/src/el-options.c @@ -261,7 +261,7 @@ static int el_vooption # if ENABLE_OUT_FILE - case EL_FNAME: + case EL_FPATH: value_str = va_arg(ap, const char *); VALID(EINVAL, value_str); options->fname = value_str; diff --git a/tst/test-el-file.c b/tst/test-el-file.c index d69326a..864ec65 100644 --- a/tst/test-el-file.c +++ b/tst/test-el-file.c @@ -106,7 +106,7 @@ static void test_prepare(void) el_option(EL_OUT, EL_OUT_FILE); el_option(EL_FROTATE_SIZE, 16); el_option(EL_FROTATE_NUMBER, 0); - el_option(EL_FNAME, WORKDIR"/log"); + el_option(EL_FPATH, WORKDIR"/log"); el_option(EL_FILE_SYNC_EVERY, 0); } @@ -190,7 +190,7 @@ static void file_reopen(void) el_option(EL_OUT, EL_OUT_FILE); el_option(EL_FROTATE_SIZE, 16); el_option(EL_FROTATE_NUMBER, 0); - el_option(EL_FNAME, WORKDIR"/log"); + el_option(EL_FPATH, WORKDIR"/log"); el_option(EL_FILE_SYNC_EVERY, 0); el_puts(s8); @@ -211,7 +211,7 @@ static void file_reopen_different_file(void) el_option(EL_OUT, EL_OUT_FILE); el_option(EL_FROTATE_SIZE, 16); el_option(EL_FROTATE_NUMBER, 0); - el_option(EL_FNAME, WORKDIR"/log-another"); + el_option(EL_FPATH, WORKDIR"/log-another"); el_option(EL_FILE_SYNC_EVERY, 0); el_puts(s8); @@ -245,7 +245,7 @@ static void file_filename_too_long(void) memset(path, 'a', sizeof(path)); path[sizeof(path) - 1] = '\0'; - mt_ferr(el_option(EL_FNAME, path), ENAMETOOLONG); + mt_ferr(el_option(EL_FPATH, path), ENAMETOOLONG); } @@ -267,7 +267,7 @@ static void file_path_too_long(void) path[sizeof(path) - 3] = 'l'; path[sizeof(path) - 2] = 'e'; path[sizeof(path) - 1] = '\0'; - mt_ferr(el_option(EL_FNAME, path), ENAMETOOLONG); + mt_ferr(el_option(EL_FPATH, path), ENAMETOOLONG); } @@ -291,7 +291,7 @@ static void file_print_after_cleanup(void) el_option(EL_OUT, EL_OUT_FILE); el_option(EL_FROTATE_SIZE, 16); el_option(EL_FROTATE_NUMBER, 0); - el_option(EL_FNAME, WORKDIR"/log"); + el_option(EL_FPATH, WORKDIR"/log"); el_option(EL_FILE_SYNC_EVERY, 0); el_cleanup(); mt_ferr(el_puts("whatev"), ENODEV); @@ -397,7 +397,7 @@ static void file_rotate_1_reopen(void) el_option(EL_OUT, EL_OUT_FILE); el_option(EL_FROTATE_SIZE, 16); el_option(EL_FROTATE_NUMBER, 1); - el_option(EL_FNAME, WORKDIR"/log"); + el_option(EL_FPATH, WORKDIR"/log"); el_option(EL_FILE_SYNC_EVERY, 0); el_puts(s8); @@ -540,7 +540,7 @@ static void file_rotate_2_reopen(void) el_option(EL_OUT, EL_OUT_FILE); el_option(EL_FROTATE_SIZE, 16); el_option(EL_FROTATE_NUMBER, 2); - el_option(EL_FNAME, WORKDIR"/log"); + el_option(EL_FPATH, WORKDIR"/log"); el_option(EL_FILE_SYNC_EVERY, 0); el_puts(s5); @@ -722,7 +722,7 @@ static void file_rotate_5_reopen(void) el_option(EL_OUT, EL_OUT_FILE); el_option(EL_FROTATE_SIZE, 16); el_option(EL_FROTATE_NUMBER, 5); - el_option(EL_FNAME, WORKDIR"/log"); + el_option(EL_FPATH, WORKDIR"/log"); el_option(EL_FILE_SYNC_EVERY, 0); el_puts(s9); @@ -811,7 +811,7 @@ static void file_rotate_5_rename_file_halfway(void) el_puts("rfv"); el_puts("tgb"); - el_option(EL_FNAME, WORKDIR"/log-another"); + el_option(EL_FPATH, WORKDIR"/log-another"); el_puts("123"); el_puts("456"); @@ -839,7 +839,7 @@ static void file_rotate_5_rename_file_halfway(void) static void file_no_dir_for_logs(void) { - mt_ferr(el_option(EL_FNAME, "/tmp/i-dont/exist"), ENOENT); + mt_ferr(el_option(EL_FPATH, "/tmp/i-dont/exist"), ENOENT); mt_ferr(el_puts("whatever"), EBADF); } @@ -872,13 +872,13 @@ static void file_dir_no_access(void) * root just doesn't give a fuck about no-write-permissions */ - mt_fok(el_option(EL_FNAME, "/tmp/embedlog-no-write/log")); + mt_fok(el_option(EL_FPATH, "/tmp/embedlog-no-write/log")); mt_fok(el_puts(s3)); mt_fok(file_check("/tmp/embedlog-no-write/log", s3)); } else { - mt_ferr(el_option(EL_FNAME, "/tmp/embedlog-no-write/log"), EACCES); + mt_ferr(el_option(EL_FPATH, "/tmp/embedlog-no-write/log"), EACCES); mt_ferr(el_puts(s3), EBADF); } unlink("/tmp/embedlog-no-write/log"); @@ -902,13 +902,13 @@ static void file_no_access_to_file(void) if (getuid() == 0) { - mt_fok(el_option(EL_FNAME, "/tmp/embedlog-no-write/log")); + mt_fok(el_option(EL_FPATH, "/tmp/embedlog-no-write/log")); mt_fok(el_puts(s5)); mt_fok(file_check("/tmp/embedlog-no-write/log", s5)); } else { - mt_ferr(el_option(EL_FNAME, "/tmp/embedlog-no-write/log"), EACCES); + mt_ferr(el_option(EL_FPATH, "/tmp/embedlog-no-write/log"), EACCES); mt_ferr(el_puts("whatever"), EBADF); } unlink("/tmp/embedlog-no-write/log"); @@ -923,7 +923,7 @@ static void file_no_access_to_file(void) static void file_rotate_no_dir_for_logs(void) { el_option(EL_FROTATE_NUMBER, 5); - mt_ferr(el_option(EL_FNAME, "/tmp/i-dont/exist"), ENOENT); + mt_ferr(el_option(EL_FPATH, "/tmp/i-dont/exist"), ENOENT); mt_ferr(el_puts("whatever"), EBADF); } @@ -987,13 +987,13 @@ static void file_rotate_dir_no_access(void) if (getuid() == 0) { - mt_fok(el_option(EL_FNAME, "/tmp/embedlog-no-write/log")); + mt_fok(el_option(EL_FPATH, "/tmp/embedlog-no-write/log")); mt_fok(el_puts(s3)); mt_fok(file_check("/tmp/embedlog-no-write/log.0", s3)); } else { - mt_ferr(el_option(EL_FNAME, "/tmp/embedlog-no-write/log"), EACCES); + mt_ferr(el_option(EL_FPATH, "/tmp/embedlog-no-write/log"), EACCES); mt_ferr(el_puts(s3), EBADF); } @@ -1019,13 +1019,13 @@ static void file_rotate_no_access_to_file(void) if (getuid() == 0) { - mt_fok(el_option(EL_FNAME, "/tmp/embedlog-no-write/log")); + mt_fok(el_option(EL_FPATH, "/tmp/embedlog-no-write/log")); mt_fok(el_puts(s8)); mt_fok(file_check("/tmp/embedlog-no-write/log.0", s8)); } else { - mt_ferr(el_option(EL_FNAME, "/tmp/embedlog-no-write/log"), EACCES); + mt_ferr(el_option(EL_FPATH, "/tmp/embedlog-no-write/log"), EACCES); mt_ferr(el_puts("whatever"), EBADF); } @@ -1047,7 +1047,7 @@ static void file_rotate_filename_too_long(void) memset(path, 'a', sizeof(path)); path[sizeof(path) - 1] = '\0'; el_option(EL_FROTATE_NUMBER, 5); - mt_ferr(el_option(EL_FNAME, path), ENAMETOOLONG); + mt_ferr(el_option(EL_FPATH, path), ENAMETOOLONG); } @@ -1070,7 +1070,7 @@ static void file_rotate_path_too_long(void) path[sizeof(path) - 2] = 'e'; path[sizeof(path) - 1] = '\0'; el_option(EL_FROTATE_NUMBER, 5); - mt_ferr(el_option(EL_FNAME, path), ENAMETOOLONG); + mt_ferr(el_option(EL_FPATH, path), ENAMETOOLONG); } |