diff options
author | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2018-01-23 20:22:19 +0100 |
---|---|---|
committer | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2018-01-23 20:22:19 +0100 |
commit | 7dda17b28602e7f6794a30c122d1bf34632882f6 (patch) | |
tree | 0792648871efbce356cf5369f0ab14dcbbc9fdc6 | |
parent | d13951bb0b636f95690ae84ddd01317dc3a90ef3 (diff) | |
download | embedlog-7dda17b28602e7f6794a30c122d1bf34632882f6.tar.gz embedlog-7dda17b28602e7f6794a30c122d1bf34632882f6.tar.bz2 embedlog-7dda17b28602e7f6794a30c122d1bf34632882f6.zip |
add: generation of website
-rw-r--r-- | Makefile.am | 10 | ||||
-rw-r--r-- | man/el_cleanup.3 | 51 | ||||
-rw-r--r-- | man/el_init.3 | 112 | ||||
-rw-r--r-- | man/el_option.3 | 530 | ||||
-rw-r--r-- | man/el_overview.7 | 214 | ||||
-rw-r--r-- | man/el_print.3 | 356 | ||||
-rwxr-xr-x | man2html.sh | 80 | ||||
-rw-r--r-- | www/Makefile.am | 9 | ||||
-rw-r--r-- | www/custom.css | 59 | ||||
-rw-r--r-- | www/footer.in | 26 | ||||
-rw-r--r-- | www/header.in | 26 | ||||
-rw-r--r-- | www/index.in | 7 | ||||
l--------- | www/index.md | 1 |
13 files changed, 928 insertions, 553 deletions
diff --git a/Makefile.am b/Makefile.am index becc26f..735a09c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,10 @@ ACLOCAL_AMFLAGS=-I m4 -SUBDIRS = include src tst man examples -EXTRA_DIST = tap-driver +SUBDIRS = include src tst man examples www +EXTRA_DIST = tap-driver man2html.sh + +www: + ./man2html.sh + make www -C www + +.PHONY: www diff --git a/man/el_cleanup.3 b/man/el_cleanup.3 index d38cd44..c6bf9ed 100644 --- a/man/el_cleanup.3 +++ b/man/el_cleanup.3 @@ -1,39 +1,46 @@ .TH "el_cleanup" "3" "22 Sep 2017 (v1.0.0)" "bofc.pl" - .SH NAME -\fBel_cleanup\fR - cleans all resources allocated by \fBel_init()\fR and -\fBel_option\fR() calls. - +.PP +.B el_cleanup +- cleans all resources allocated by +.BR el_init (3) +and +.BR el_option (3) +calls. .SH SYNOPSIS - -.sh +.PP .BI "#include <embedlog.h>" - -.sh +.PP .BI "int el_cleanup(void)" .br .BI "int el_ocleanup(struct el_options *" options ")" - .SH DESCRIPTION -\fBel_cleanup\fR() flushes all remaining buffers and frees any resources -allocated through the life of the library. After clean up, library calls -cannot be used without initialization. - -\fBel_ocleanup\fR() works just the same, but accepts custom \fIoptions\fR -as argument - +.PP +.BR el_cleanup (3) +flushes all remaining buffers and frees any resources allocated through the +life of the library. +After clean up, library calls cannot be used without initialization. +.PP +.BR el_ocleanup (3) +works just the same, but accepts custom +.I options +as argument. .SH RETURN VALUE -0 upon successful cleanup or -1 on errors. When -1 was returned no resources -were freed, and library functions still can be used. - +.PP +Functions return 0 upon successful cleanup or -1 on errors. +When -1 was returned no resources were freed, and library functions still can be +used. .SH ERRORS -\fBel_cleanup\fR() function cannot fail. \fBel_ocleanup\fR() may return: - +.PP +.BR el_cleanup (3) +function cannot fail. +.BR el_ocleanup (3) +may return: .TP .B EINVAL Passed options object is not valid - .SH SEE ALSO +.PP .BR el_init (3), .BR el_overview (7), .BR el_option (3), diff --git a/man/el_init.3 b/man/el_init.3 index b964e44..7d34a0c 100644 --- a/man/el_init.3 +++ b/man/el_init.3 @@ -1,68 +1,78 @@ .TH "el_init" "3" "22 Sep 2017 (v1.0.0)" "bofc.pl" - .SH NAME -\fBel_init\fR - initializes library and options for printing. - +.PP +.B el_init +- initializes library and options for printing. .SH SYNOPSIS - -.sh +.PP .BI "#include <embedlog.h> - -.sh +.PP .BI "int el_init(void)" .br .BI "int el_oinit(struct options *" options ")" - .SH DESCRIPTION -\fBel_init()\fR initializes library and default options structure. This function -must be called once before using any other function. - -\fBel_oinit()\fR initializes only \fIoptions\fR structure passed to it. Only after -that functions that accepts \fIoptions\fR may be used. - +.PP +.BR el_init (3) +initializes static global option structure. This option structure is used by all +functions that don't accept +.I options +parameter. +If you want to use only one instance of +.BR embedlog , +this is the function you want to use. +.PP +.BR el_oinit (3) +initializes only +.I options +structure passed to it. Only after that functions that accepts +.I options +may be used. +If you want to have multiple embedlog instances (ie. one for program logs, +and one for queries) that stores logs differently - this is the function you +want to use. .SH RETURN VALUE - -Both functions will return 0 upon success and -1 on errors - +.PP +Both functions will return 0 upon success and -1 on errors. .SH ERRORS - .TP .B EINVAL -\fIoptions\fR is invalid (null) - +.I options +is invalid (null). .SH EXAMPLE -Error handling has been ommited for clarity sake - -.nf -#include <embedlog.h> - -int main(void) -{ - struct el_options opts; - - /* initialize both default and opts */ - el_init(); - el_oinit(&opts); - - /* make default logger to print to stderr */ - el_option(EL_OPT_OUT, EL_OUT_STDERR); - - /* make opts to print to file */ - el_ooption(&opts, EL_OPT_OUT, EL_OUT_STDERR); - el_ooption(&opts, EL_OPT_FNAME, "/tmp/test.log"); - - /* print messages */ - el_print(ELI, "will print to stderr"); - el_oprint(ELI, &opts, "will print to file /tmp/test.log"); - - /* cleanup after any initialization code (like fopen) */ - el_ocleanup(&opts); - el_cleanup(); - - return 0; -} - +.PP +Note: error handling has been ommited for clarity sake +.PP +.EX + #include <embedlog.h> + + int main(void) + { + struct el_options opts; + + /* initialize both default and opts */ + el_init(); + el_oinit(&opts); + + /* make default logger to print to stderr */ + el_option(EL_OUT, EL_OUT_STDERR); + + /* make opts to print to file */ + el_ooption(&opts, EL_OUT, EL_OUT_STDERR); + el_ooption(&opts, EL_FNAME, "/tmp/test.log"); + + /* print messages */ + el_print(ELI, "will print to stderr"); + el_oprint(ELI, &opts, "will print to file /tmp/test.log"); + + /* cleanup after any initialization code (like fopen) */ + el_ocleanup(&opts); + el_cleanup(); + + return 0; + } +.EE .SH SEE ALSO +.PP .BR el_init (3), .BR el_cleanup (3), .BR el_overview (7), diff --git a/man/el_option.3 b/man/el_option.3 index 78f1055..5996c36 100644 --- a/man/el_option.3 +++ b/man/el_option.3 @@ -1,36 +1,42 @@ .TH "el_option" "3" "22 Sep 2017 (v1.0.0)" "bofc.pl" - .SH NAME -\fBel_option\fR - sets optional configuration of the logger - +.B el_option +- sets optional configuration of the logger .SH SYNOPSIS - -.sh +.PP .B #include <embedlog.h> - -.sh +.PP .BI "int el_option(enum el_option " option ", " ... ")" .br -.BI "int el_ooption(struct el_options *" options "," -.BI "enum el_option " option ", " ... ")" - +.BI "int el_ooption(struct el_options *" options ", \ +enum el_option " option ", " ... ")" .SH DESCRIPTION -\fBel_option\fR allows user to configure logger's internal options, to tune -logging to users needs. - +.PP +.BR el_option (3) +allows user to configure logger's internal options, to tune logging to users +needs. .SH OPTIONS -\fIoption\fR can be (value inside parenthesis determines argument types of -variadic arguments \fI...\fR) - -.BI "EL_OPT_LEVEL (" enum " " el_level ")" -.RS 4 -\fBEL_OPT_LEVEL\fR sets what the current logging level shall be. Altough it -accepts \fBenum el_level\fR this can be whatever number from range <0, INT_MAX>. -The higher the level, the lower priority of the message. All messages that have -lower priority (higher number) then currently set \fIel_level\fR will not be -printed. There are 8 predefined levels, sorted by priority (highest first): - -. RS 4 +.PP +Below is a list of +.I option +that can be configured. +Value inside parenthesis determines argument types of variadic arguments +.I ... +.PP +.BI "EL_LEVEL (" enum " " el_level "level)" +.RS +. B EL_LEVEL +sets what the current logging level shall be. +Altough it accepts +. B enum el_level +type, this can be whatever number from range <0, INT_MAX>. +The higher the level, the lower priority of the message. +All messages that have lower priority (higher number) then currently set +. I level +will not be printed. +There are 8 predefined levels, sorted by priority (highest first): +. PP +. RS . B EL_FATAL, . br . B EL_ALERT, @@ -47,343 +53,411 @@ printed. There are 8 predefined levels, sorted by priority (highest first): . br . B EL_DBG . RE - +. PP If 8 print levels are not enough, one can define new levels, knowing that -\fBEL_FATAL\fR has int value of 0, and \fBEL_DBG\fR has int value of -7. User can also use debug level and add an integer like: \fBEL_DBG\fR + -\fIn\fR - where \fIn\fR can be any number from range <0, INT_MAX - 8>. - -If messages are printed with lower priority than \fBEL_DBG\fR they all -will be treated as messages printed with level \fBEL_DBG\fR, that means -message printed with level \fBEL_DBG\fR and \fBEL_DBG + 3\fR, will -be printed exactly the same, so same color (if colors are enabled) and if log -level printig is enabled, such messages will have same 'd/' prefix no matter +. B EL_FATAL +has int value of 0, and +. B EL_DBG +has int value of 7. +User can also use debug level and add an integer like: +. B EL_DBG ++ +. I n +- where +. I n +can be any number from range <0, INT_MAX - 8>. +. PP +If messages are printed with lower priority than +. B EL_DBG +they all will be treated as messages printed with level +. BR EL_DBG , +that means message printed with level +. B EL_DBG +and +. BR "EL_DBG + 3" , +will be printed exactly the same, so same color (if colors are enabled) and if +log level printig is enabled, such messages will have same 'd/' prefix no matter the level. - +. PP . B ERRORS -. RS 4 +. RS Setting log level cannot fail . RE .RE - -.BI "EL_OPT_OUT (" enum " " el_output ")" -.RS 4 -\fBEL_OPT_OUT\fR simply sets to what output(s) logs will be printed to -with any of the printing function. User can enable as many outputs as he -desires - it can be all inputs or even none (if one wants to surpress logging -for some time). To enable multiple outputs join values with \fBor\fR operator -(\fB|\fR). - +.PP +.BI "EL_OUT (" enum " " el_output ")" +.RS +. B EL_OUT +simply sets to what output(s) logs will be printed to with any of the printing +function. +User can enable as many outputs as he desires - it can be all inputs or even +none (if one wants to surpress logging for some time). +To enable multiple outputs join values with +. B or +operator ( +. B | +). +. PP Currently following \fIoutputs\fR can be enabled. - +. PP . B EL_OUT_STDERR -. RS 4 +. RS Messages will be printed to standard error output . RE - +. PP . B EL_OUT_SYSLOG -. RS 4 +. RS Messages will be sent to syslog facility. This requires system with implemented POSIX.1-2001 and any syslog daemon . RE - +. PP . B EL_OUT_FILE -. RS 4 -Messages will be printed to file. To work user should set output file with -\fBEL_OPT_FNAME\fR. Log rotation can be configured with -\fBEL_OPT_FROTATE_NUMBER\fR and \fREL_OPT_FROTATE_SIZE\fB options. +. RS +Messages will be printed to file. +To work user should set output file with +. BR EL_FNAME . +Log rotation can be configured with +. B EL_FROTATE_NUMBER +and +. R EL_FROTATE_SIZE +options. . RE - +. PP . B EL_OUT_NET -. RS 4 -Messages shall be printed to external server. This requires BSD Sockets to be -enabled on the clients system, and listening server. (TODO Not implemented yet) +. RS +Messages shall be printed to external server. +This requires BSD Sockets to be enabled on the clients system, and listening +server. +(TODO Not implemented yet) . RE - +. PP . B EL_OUT_TTY -. RS 4 +. RS Prints messages directly to configured serial console . RE - +. PP . B EL_OUT_ALL -. RS 4 +. RS Enables all supported outputs at once . RE - +. PP . B EL_OUT_NONE -. RS 4 +. RS Disables every output - logs won't be printed at all . RE - +. PP . B EL_OUT_CUSTOM -. RS 4 -Enables custom function to be called on log print. Pointer to custom function -needs to be set with \fBEL_CUSTOM_PUTS\fR option. +. RS +Enables custom function to be called on log print. +Pointer to custom function needs to be set with +. B EL_CUSTOM_PUTS +option. . RE - +. PP Many of the outputs can be configured for special needs, and some of them need -mandatory configuration. For information about output configuration see proper -option description - - +mandatory configuration. +For information about output configuration see proper option description +. PP . B ERRORS -. RS 4 +. RS . B EINVAL -. RS 4 -Specified \fIoutput\fR is invalid +. RS +Specified +. I output +is invalid . RE . RE - -. RS 4 +. PP +. RS . B ENODEV -. RS 4 -Specified \fIoutput\fR is not implemented on current system (support was not -compiled into library) +. RS +Specified +.I output +is not implemented on current system (support was not compiled into library) . RE . RE .RE - -.BI "EL_OPT_COLORS (" int ")" -.RS 4 +.PP +.BI "EL_COLORS (" int ")" +.RS If this is set to 1, output will be enriched with ANSI colors depending on the -message severity. This option needs terminal supporting colors. You can store -messages with colors to file, and then read them with colors on color-enabled -terminal. If this is set to 0, no colors will be added. - +message severity. +This option needs terminal supporting colors. +You can store messages with colors to file, and then read them with colors on +color-enabled terminal. +If this is set to 0, no colors will be added. +. PP . B ERRORS -. RS 4 +. RS . B EINVAL -. RS 4 +. RS Input argument is different than 1 or 0 . RE . RE .RE - -.BI "EL_OPT_TS (" enum " " el_option_timestamp ")" -.RS 4 +.PP +.BI "EL_TS (" enum " " el_option_timestamp ")" +.RS Allows timestamp to be added to each log message. Possible values are: - -. B EL_OPT_TS_OFF -. RS 4 +. PP +. B EL_TS_OFF +. RS Timestamp will not be added to messages . RE - -. B EL_OPT_TS_SHORT -. RS 4 -Short timestamp will be added to log in format \fB[1503661223.537631]\fR +. PP +. B EL_TS_SHORT +. RS +Short timestamp will be added to log in format +. B [1503661223.537631] . RE - -. B EL_OPT_TS_LONG -. RS 4 -Long timestamp will be added to log in format \fB[2017-08-25 11:40:23.537651]\fR +. PP +. B EL_TS_LONG +. RS +Long timestamp will be added to log in format +. B [2017-08-25 11:40:23.537651] . RE - +. PP . B ERRORS -. RS 4 +. RS . B EINVAL -. RS 4 +. RS Input argument is invalid . RE . RE .RE - -.BI "EL_OPT_TS_TM (" enum " " el_option_timestamp_timer ")" -.RS 4 +.PP +.BI "EL_TS_TM (" enum " " el_option_timestamp_timer ")" +.RS Sets the clock source for the timestamp print. - -. B EL_OPT_TS_TM_CLOCK -. RS 4 -Library will use value from \fBclock\fR() function. With this clock precission -varies from 10^-3[s] to 10^-9[s]. On POSIX systems, this clock has precision -of 10^-6[s]. This timer has a lot drawbacks, time value is unspecified at the -beggining of the program, timer is not incremented when thread is sleeping, -timer will overlap eventually (on 32bit systems with POSIX it takes around 72 -minutes for the clock to overlap). On the other hand this is the most precise -clock for pure c89 systems without POSIX. +. PP +. B EL_TS_TM_CLOCK +. RS +Library will use value from +. BR clock () +function. +With this clock precission varies from 10^-3[s] to 10^-9[s]. +On POSIX systems, this clock has precision of 10^-6[s]. +This timer has a lot drawbacks, time value is unspecified at the beggining of +the program, timer is not incremented when thread is sleeping, timer will +overlap eventually (on 32bit systems with POSIX it takes around 72 minutes for +the clock to overlap). +On the other hand this is the most precise clock for pure c89 systems without +POSIX. . RE - -. B EL_OPT_TS_TM_TIME -. RS 4 -Time is taken from \fBtime\fR() function. This returns current wall clock of -the system, it's precision is very low (1[s]), but it's pure c89 and it is -good for logging low frequent messages. This clock is susceptible to unexpected -time change (from NTP or by root itself). +. PP +. B EL_TS_TM_TIME +. RS +Time is taken from +. BR time () +function. +This returns current wall clock of the system, it's precision is very low +(1[s]), but it's pure c89 and it is good for logging low frequent messages. +This clock is susceptible to unexpected time change (from NTP or by root +itself). . RE - -. B EL_OPT_TS_TM_REALTIME -. RS 4 -Time is taken from \fBclock_gettime\fR() using \fBCLOCK_REALTIME\fR clock. -This required system with POSIX.1-2001. This time returns current system -wall clock, but it's precision is much higher that \fBEL_OPT_TS_TM_TIME\fR +. PP +. B EL_TS_TM_REALTIME +. RS +Time is taken from +. BR clock_gettime () +using +. B CLOCK_REALTIME +clock. +This required system with POSIX.1-2001. +This time returns current system wall clock, but it's precision is much higher +than +. B EL_TS_TM_TIME clock (depending on system it can vary from 10^-3[s] up to even 10^-9[s]). -Just like it is with \fBEL_OPT_TS_TM_TIME\fR this timestamp can jump forward of -backward if it is changed in the system. +Just like it is with +. B EL_TS_TM_TIME +this timestamp can jump forward of backward if it is changed in the system. . RE - -. B EL_OPT_TS_TM_MONOTONIC -. RS 4 -This clock is similar to \fBEL_OPT_TS_TM_REALTIME\fR but it shows time from -unspecified time and is not affected by time change (it can still be altered -with \fBadjtime\fR(3) or NTP) +. PP +. B EL_TS_TM_MONOTONIC +. RS +This clock is similar to +. B EL_TS_TM_REALTIME +but it shows time from unspecified time and is not affected by time change +(it can still be altered with +. BR adjtime () +or NTP) . RE - +. PP . B ERRORS -. RS 4 +. RS . B EINVAL -. RS 4 +. RS Input argument is invalid . RE . RE .RE - - -.BI "EL_OPT_PRINT_LEVEL (" int ")" -.RS 4 +.PP +.BI "EL_PRINT_LEVEL (" int ")" +.RS If this is set to 1, each log will have log level information prefix in format "l/" where 'l' is first character of level message is printed with, for example: - -. RS 4 +. PP +. RS c/this is critical message -.br +. br n/this is just a notice -.br +. br d/debug print . RE - +.PP If value is set to 0, level information will not be added, and above messages would like like this - -. RS 4 +.PP +. RS this is critical message -.br +. br this is just an notice -.br +. br debug print . RE - +. PP . B ERRORS -. RS 4 +. RS . B EINVAL -. RS 4 +. RS Input argument is different than 1 or 0 . RE . RE .RE - -.BI "EL_OPT_FINFO (" int ")" -.RS 4 +.PP +.BI "EL_FINFO (" int ")" +.RS If set to 1, adds information about log location to each message in format [some_file.c:123]. Setting this to 0, will result in no file information at all - +. PP . B ERRORS -. RS 4 +. RS . B EINVAL -. RS 4 +. RS Input argument is different than 1 or 0 . RE . RE .RE - +.PP .BI "EL_CUSTOM_PUTS (" int " "(*el_custom_puts)(const " " char " " *s) ") -.RS 4 -Sets function pointer for custom message print. Function will receive complete -messsage to print, just as it would be printed to ie. stderr or another -facility. Function cannot fail, if NULL is passed, custom function won't be -called. It is still mandatory to enable custom printing with -\fBel_enable_output\fR() +.RS +Sets function pointer for custom message print. +Function will receive complete messsage to print, just as it would be printed to +ie. stderr or another facility. +Function cannot fail, if NULL is passed, custom function won't be called. +It is still mandatory to enable custom printing with +. BR el_option (3) .RE - -.BI "EL_OPT_FNAME (" const " " char " " * ")" -.RS 4 +.PP +.BI "EL_FNAME (" const " " char " " * ")" +.RS Sets the file name for the logs. Logs will be stored in this file. If file rotation is enabled, a numer will be postfixed to each file. See -\fBEL_OPT_FROTATE_NUMBER\fR in this page for more details. - +. B EL_FROTATE_NUMBER +in this page for more details. +. PP . B ERRORS -. RS 4 +. RS . B EINVAL -. RS 4 +. RS Input parameter is NULL . RE - +. PP . B ENAMETOOLONG -. RS 4 +. RS File name is too long . RE - -Function can also fail and set \fIerrno\fR for any of the errors specified for -the routing \fBfopen(3)\fR - +. PP +Function can also fail and set +. I errno +for any of the errors specified for the routing +. BR fopen () . RE - +.PP If function fails, file is not opened and any calls that logs to file will result in failure. .RE - -.BI "EL_OPT_FROTATE_NUMBER (" long ")" -.RS 4 +.PP +.BI "EL_FROTATE_NUMBER (" long ")" +.RS If set to 0, file rotation will be disabled and logs will be printed into -specified file without size limit. The only size limit is the one presented -by the filesystem and architecture. - +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_OPT_FNAME. For example, -\fIprogram.log.0\fR. Files are enumareted from \fI.0\fR to \fI.n\fR, where -\fIn\fR is set rotate number. File with suffix \fI.0\fR is the oldest one, -and the higher the number, the newer the file is. If logger reaches maximum -number of files, oldest one with suffix \fI.0\fR will be deleted and suffixes -of the files will be decremented by 1 (ie. \fIlog.1\fR will be renamed to -\fIlog.0\fR, \fIlog.2\fR will be renamed to \fIlog.1\fR and so on. - +have suffixes added to name set in EL_FNAME. For example, +. IR program.log.0 . +Files are enumareted from +. I .0 +to +. IR .n , +where +. I n +is set rotate number. +File with suffix +. I .0 +is the oldest one, and the higher the number, the newer the file is. +If logger reaches maximum number of files, oldest one with suffix +. I .0 +will be deleted and suffixes of the files will be decremented by 1 (ie. +. I log.1 +will be renamed to +. IR log.0 , +. I log.2 +will be renamed to +. I log.1 +and so on. +. PP User can also pass 1 here, but if file reaches its size limit, it will be deleted and printing will continue from the empty file - +. PP . B ERRORS -. RS 4 +. RS . B EINVAL -. RS 4 +. RS Input parameter is less than 0 . RE . RE .RE - -.BI "EL_OPT_FROTATE_SIZE (" long ")" -.RS 4 -This defines size at which files will be rotated. If message being printed -would overflow rotate size, current file will be closed and new one will be -created, and current message will be stored in that new file. It is guaranteed -that file will not be bigger than value set in this option. If log printed -into file is bigger than configure rotate size, message will be truncated, to -prevent file bigger than configure rotate size. It's very rare situation as -it doesn't make a lot of sense to set rotate size to such small value. - +.PP +.BI "EL_FROTATE_SIZE (" long ")" +.RS +This defines size at which files will be rotated. +If message being printed would overflow rotate size, current file will be closed +and new one will be created, and current message will be stored in that new +file. +It is guaranteed that file will not be bigger than value set in this option. +If log printed into file is bigger than configure rotate size, message will be +truncated, to prevent file bigger than configure rotate size. +It's very rare situation as it doesn't make a lot of sense to set rotate size to +such small value. +. PP . B ERRORS -. RS 4 +. RS . B EINVAL -. RS 4 +. RS Value is less than 1 . RE . RE .RE - - .SH RETURN VALUE -On success 0 is returned. -1 is returned when some error occured - +.PP +On success 0 is returned. -1 is returned when any error occured. .SH ERRORS .TP .B EINVAL -Passed \fIoption\fR is invalid - +Passed +.I option +is invalid. .TP .B ENOSYS -Passed \fIoption\fR is not supported on this system (support was not compiled) - -.RE +Passed +.I option +is not supported on this system (support was not compiled)/ Also check for error description of specific option that failed for more informations - .SH SEE ALSO +.PP .BR el_init (3), .BR el_cleanup (3), .BR el_overview (7), diff --git a/man/el_overview.7 b/man/el_overview.7 index 4892ab5..3a4947b 100644 --- a/man/el_overview.7 +++ b/man/el_overview.7 @@ -1,20 +1,30 @@ .TH "el_overview" "7" "22 Sep 2017 (v1.0.0)" "bofc.pl" - .SH NAME -\fBel_overview\fR - quick overview of \fIembedlog\fR logging library - +.PP +.B el_overview +- quick overview of +.B embedlog +logging library .SH SYNOPSIS -\fBembedlog\fR - is a highly portable \fBc89\fR complaint logger (with -additional features for users with \fBc99\fR compilers and/or \fBPOSIX\fR -systems). This library is designed mainly for embedded devices, but can also be -used in high level OSes like \fBLinux\fR. - +.PP +.B embedlog +- is a highly portable +.B c89 +complaint logger (with additional features for users with +.B c99 +compilers and/or +.B POSIX +systems). +This library is designed mainly for embedded devices, but can also be +used in high level OSes like +.BR Linux . .SH DESCRIPTION +.PP Logger incorporates features like: - -.RS 4 +.PP +.RS - printing to different outputs (simultaneously) like: -.RS 4 +.RS - stderr .br - syslog @@ -29,7 +39,7 @@ Logger incorporates features like: string to print .RE - timestamping using following clocks: -.RS 4 +.RS - clock_t .br - time_t @@ -44,11 +54,10 @@ string to print .br - colorful output (for easy error spotting) .RE - .RE +.PP Library implements following functions: - -.sh +.PP .BI "int el_init(void)" .br .BI "int el_cleanup(void)" @@ -57,111 +66,124 @@ Library implements following functions: .br .BI "int el_puts(const char *" string ")" .br -.BI "int el_print(const char *" file ", size_t " line "," -.BI "enum el_level " level ", const char *" fmt ", " ... ")" -.br -.BI "int el_vprint(const char *" file ", size_t " line "," -.BI "enum el_level " level ", const char *" fmt ", va_list " ap ")" -.br -.BI "int el_pmemory(const char *" file ", size_t " line "," -.BI "enum el_level " level ", const void *" memory ", size_t " mlen ")" -.br -.BI "int el_perror(const char *" file ", size_t " line "," -.BI "enum el_level " level ", const char *" fmt ", " ... ")" - -Each functions has its equivalent function but accepting \fBoptions\fR as -argument. This is helpful if we want to have more than one, separated loggers -in a single program. Please see \fBel_option\fR(3) for more information. - -.sh +.BI "int el_print(const char *" file ", size_t " line ", \ +enum el_level " level ", const char *" fmt ", " ... ")" +.br +.BI "int el_vprint(const char *" file ", size_t " line ", \ +enum el_level " level ", const char *" fmt ", va_list " ap ")" +.br +.BI "int el_pmemory(const char *" file ", size_t " line ", \ +enum el_level " level ", const void *" memory ", size_t " mlen ")" +.br +.BI "int el_perror(const char *" file ", size_t " line ", \ +enum el_level " level ", const char *" fmt ", " ... ")" +.PP +Each functions has its equivalent function but accepting +.I options +as argument. +This is helpful if we want to have more than one, separated loggers in a single +program. +Please see +.BR el_option (3) +for more information. +.PP .BI "int el_oinit(struct el_options *" options ")" .br .BI "int el_ocleanup(struct el_options *" options ")" .br -.BI "int el_ooption(struct el_options *" options ", enum el_option " option "," -.BI "...)" +.BI "int el_ooption(struct el_options *" options ", enum el_option " option ", \ +\&...)" .br .BI "int el_oputs(struct el_options *" options ", const char *" string ")" .br -.BI "int el_oprint(const char *" file ", size_t " line "," -.BI "enum el_level " level ", struct el_options *" options "," -.BI "const char * "fnt ", " ... ")" +.BI "int el_oprint(const char *" file ", size_t " line ", \ +enum el_level " level ", struct el_options *" options ", \ +const char * "fnt ", " ... ")" .br -.BI "int el_ovprint(const char *" file ", size_t " line "," -.BI "enum el_level " level ", struct el_options *" options "," -.BI "const char *" fmt ", va_list " ap ")" +.BI "int el_ovprint(const char *" file ", size_t " line ", \ +enum el_level " level ", struct el_options *" options ", \ +const char *" fmt ", va_list " ap ")" .br -.BI "int el_opmemory(const char *" file ", size_t " line "," -.BI "enum el_level " level ", struct el_options *" options "," -.BI "const void *" memory ", size_t " mlen ")" +.BI "int el_opmemory(const char *" file ", size_t " line ", \ +enum el_level " level ", struct el_options *" options ", \ +const void *" memory ", size_t " mlen ")" .br -.BI "int el_operror(const char *" file ", size_t " line "," -.BI "enum el_level " level ", struct el_options *" options "," -.BI "const char *" fmt ", " ... ")" - +.BI "int el_operror(const char *" file ", size_t " line ", \ +enum el_level " level ", struct el_options *" options ", \ +const char *" fmt ", " ... ")" +.PP For more information about a function open manual page with functions name from -section 3 (ie. for el_oputs, you'd open \fBel_oputs\fR(3)) - -Every function that accepts 3 parameters \fIlevel\fR, \fIfile\fR and \fIline\fR +section 3 (ie. for el_oputs, you'd open +.BR el_oputs (3)) +.PP +Every function that accepts 3 parameters +.IR level , +.I file +and +.I line as its first arguments, can accept short macro that injects proper values into -function. Awailable macros are: - -.RS 4 -\fBELF\fR Fatal errors, usually precedes application crash +function. +Awailable macros are: +.PP +.RS +.BR ELF " Fatal errors, usually precedes application crash" .br -\fBELA\fR Alert, vey major error that should be fixed as soon as possible +.BR ELA " Alert, vey major error that should be fixed as soon as possible" .br -\fBELC\fR Critical +.BR ELC " Critical" .br -\fBELE\fR Error +.BR ELE " Error" .br -\fBELW\fR Warning +.BR ELW " Warning" .br -\fBELN\fR Normal log, but of high importance +.BR ELN " Normal log, but of high importance" .br -\fBELI\fR Information message, shouldn't spam too much here +.BR ELI " Information message, shouldn't spam too much here" .br -\fBELD\fR Debug messages, can spam as much as you'd like +.BR ELD " Debug messages, can spam as much as you'd like" .RE - +.PP So instead of calling - -.RS 4 -\fBel_print(__FILE__, __LINE__, EL_NOTICE, "Notice message");\fR -.RE - +.PP +.EX + el_print(__FILE__, __LINE__, EL_NOTICE, "Notice message"); +.EE +.PP You can simply call it like - -.RS 4 -\fBel_print(ELN, "Notice message");\fR -.RE - +.PP +.EX + el_print(ELN, "Notice message"); +.EE .SH EXAMPLE -Initial setup is very trivial. One should call init function and set at least -one output. Output can also be customized with proper options, see -\fBel_option\fR(3) for more details. - -.nf -#include <embedlog.h> - -int main(void) -{ - /* initialize library */ - el_init(); - - /* tell logger to print onto stderr */ - el_option(EL_OPT_OUT, EL_OUT_STDERR); - - /* print message with info severity */ - el_print(ELI, "answer is %d", 42); - - /* clean after ourselfs */ - el_cleanup(); - - return 0; -} - +.PP +Initial setup is very trivial. +One should call init function and set at least one output. +Output can also be customized with proper options, see +.BR el_option (3) +for more details. +.PP +.EX + #include <embedlog.h> + + int main(void) + { + /* initialize library */ + el_init(); + + /* tell logger to print onto stderr */ + el_option(EL_OUT, EL_OUT_STDERR); + + /* print message with info severity */ + el_print(ELI, "answer is %d", 42); + + /* clean after ourselfs */ + el_cleanup(); + + return 0; + } +.EE .SH SEE ALSO +.PP .BR el_overview (7), .BR el_init (3), .BR el_cleanup (3), diff --git a/man/el_print.3 b/man/el_print.3 index 0ffbc0a..e9568e3 100644 --- a/man/el_print.3 +++ b/man/el_print.3 @@ -1,49 +1,47 @@ .TH "el_print" "3" "22 sep 2017 (v1.0.0)" "bofc.pl" - .SH NAME -\fBel_print\fR, \fBel_vprint\fR, \fBel_puts\fR, \fBel_perror\fR - prints message -to previously configured outputs. - +.PP +.BR el_print , +.BR el_vprint , +.BR el_puts , +.B el_perror +- prints message to previously configured outputs. .SH SYNOPSIS - -.sh +.PP .B "#include <embedlog.h>" - -.sh +.PP .BI "int el_puts(const char *" message ")" .br -.BI "int el_print(const char *" file ", size_t " line "," -.BI "enum el_level " level ", const char *" fmt ", " ... ")" +.BI "int el_print(const char *" file ", size_t " line ", \ +enum el_level " level ", const char *" fmt ", " ... ")" .br -.BI "int el_vprint(const char *" file ", size_t " line "," -.BI "enum el_level " level ", const char *" fmt ", va_list " ap ")" +.BI "int el_vprint(const char *" file ", size_t " line ", \ +enum el_level " level ", const char *" fmt ", va_list " ap ")" .br -.BI "int el_perror(const char *" file ", size_t " line "," -.BI "enum el_level " level ", const char *" fmt ", " ... ")" +.BI "int el_perror(const char *" file ", size_t " line ", \ +enum el_level " level ", const char *" fmt ", " ... ")" .br -.BI "int el_pmemory(const char *" file ", size_t " line "," -.BI "enum el_level " level ", const void *" memory ", size_t " mlen ") - -.sh +.BI "int el_pmemory(const char *" file ", size_t " line ", \ +enum el_level " level ", const void *" memory ", size_t " mlen ") +.PP .BI "int el_oputs(struct el_options *" options ", const char *" message ")" .br -.BI "int el_oprint(const char *" file ", size_t " line "," -.BI "enum el_level " level ", struct el_options *" options "," -.BI "const char *" fmt ", " ... ")" +.BI "int el_oprint(const char *" file ", size_t " line ", \ +enum el_level " level ", struct el_options *" options ", \ +const char *" fmt ", " ... ")" .br -.BI "int el_ovprint(const char *" file ", size_t " line "," -.BI "enum el_level " level ", struct el_options *" options "," -.BI "const char *" fmt ", va_list " ap ")" +.BI "int el_ovprint(const char *" file ", size_t " line ", \ +enum el_level " level ", struct el_options *" options ", \ +const char *" fmt ", va_list " ap ")" .br -.BI "int el_operror(const char *" file ", size_t " line "," -.BI "enum el_level " level ", struct el_options *" options "," -.BI "const char *" fmt ", " ... ")" +.BI "int el_operror(const char *" file ", size_t " line ", \ +enum el_level " level ", struct el_options *" options ", \ +const char *" fmt ", " ... ")" .br -.BI "int el_pmemory(const char *" file ", size_t " line "," -.BI "enum el_level " level ", struct el_options *" options "," -.BI "const void *" memory ", size_t " mlen ")" - -.sh +.BI "int el_pmemory(const char *" file ", size_t " line ", \ +enum el_level " level ", struct el_options *" options ", \ +const void *" memory ", size_t " mlen ")" +.PP .BI "#define ELF " __FILE__ ", " __LINE__ ", " EL_FATAL .br .BI "#define ELA " __FILE__ ", " __LINE__ ", " EL_ALERT @@ -59,173 +57,223 @@ to previously configured outputs. .BI "#define ELI " __FILE__ ", " __LINE__ ", " EL_INFO .br .BI "#define ELD " __FILE__ ", " __LINE__ ", " EL_DBG -.br - -ish +.PP .BI "#define EL_DEBUG(" ... ") el_print(ELD, __VA_ARGS__) - +.PP Feature Test Macro - +.PP .BR "#define EL_DEBUG" () -.RS 4 +.RS __ISOC99_SOURCE .RE - .SH DESCRIPTION +.PP Functions print log into configured outputs. -\fBel_puts\fR() function prints \fImessage\fR that is simple string, -\fImessage\fR is not altered in anyway - that means no automatic log levels, -location of the log nor timestamp is printed - even if they are enabled. Logs -printed with this functions are not filtered by log level, and will always be -printed. Prints can still be suppressed by disabling output. - -\fBel_print\fR() function behaves similar to standard \fBprintf\fR(3) function -from the standard library, but it adds (if enabled) additional information, such -as \fIfile\fR and \fIline\fR number from where log is printed, log \fIlevel\fR, -and timestamp of the message. \fIfmt\fR and variadic variables \fI...\fR have -the same role as it is described in \fBprintf\fR(3) function. - -\fBel_vprint\fR() function behaves just like \fBel_print\fR() but it accepts -argument pointer \fIap\fR instead of variadic variables. Check \fBvprintf\fR(3) +.BR el_puts (3) +function prints +.I message +that is simple string, +.I message +is not altered in anyway - that means no automatic log levels, location of the +log nor timestamp is printed - even if they are enabled. +Logs printed with this functions are not filtered by log level, and will always +be printed. Prints can still be suppressed by disabling output. +.PP +.BR el_print (3) +function behaves similar to standard +.BR printf () +function from the standard library, but it adds (if enabled) additional +information, such as +.I file +and +.I line +number from where log is printed, log +.IR level , +and timestamp of the message. +.I fmt +and variadic variables +.I ... +have the same role as it is described in +.BR printf () +manual page. +.PP +.BR el_vprint (3) +function behaves just like +.BR el_print (3) +but it accepts argument pointer +.I ap +instead of variadic variables. +Check +.BR vprintf () for more information. - -\fBel_perror\fR() works the same way as \fBel_print\fR() but will also print -information about current errno that was set. If \fIfmt\fR is \fBNULL\fR, -only information about errno will be printed. It is similar to \fBperror\fR(3) +.PP +.BR el_perror (3) +works the same way as +.BR el_print (3) +but will also print information about current errno that was set. +If +.I fmt +is +.BR NULL , +only information about errno will be printed. +It is similar to +.BR perror () function. - -\fBel_pmemory\fR() is designed to print memory location in a nice hex+ascii -format that may look like this. In this example we print all ascii table, to -present printing of printable and non-printable values - -.RS 4 ------- ----------------------------------------------- ---------------- -.br -offset hex ascii -.br ------- ----------------------------------------------- ---------------- -.br -0x0000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................ -.br -0x0010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ................ -.br -0x0020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f !"#$%&'()*+,-./ -.br -0x0030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 0123456789:;<=>? -.br -0x0040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @ABCDEFGHIJKLMNO -.br -0x0050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f PQRSTUVWXYZ[\]^_ -.br -0x0060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f `abcdefghijklmno -.br -0x0070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f pqrstuvwxyz{|}~. -.br ------- ----------------------------------------------- ---------------- -.RE - -\fBel_print\fR(), \fBel_vprint\fR(), \fBel_perror\fR() and \fBel_pmemory\fR() -are filtered based on their \fIlevel\fR. - +.PP +.BR el_pmemory (3) +is designed to print memory location in a nice hex+ascii format that may look +like this. +In this example we print all ascii table, to present printing of printable and +non-printable values. +.PP +.EX + ------ ----------------------------------------------- ---------------- + offset hex ascii + ------ ----------------------------------------------- ---------------- + 0x0000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................ + 0x0010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ................ + 0x0020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f !"#$%&'()*+,-./ + 0x0030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 0123456789:;<=>? + 0x0040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @ABCDEFGHIJKLMNO + 0x0050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f PQRSTUVWXYZ[\]^_ + 0x0060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f `abcdefghijklmno + 0x0070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f pqrstuvwxyz{|}~. + ------ ----------------------------------------------- ---------------- +.EE +.PP +.BR el_print (3), +.BR el_vprint (3), +.BR el_perror (3) +and +.BR el_pmemory (3) +are filtered based on their +.IR level . +.PP All of above functions have their counterpart that also accepts custom -\fIoptions\fR object. This is useful if we want for example, print logs into -one file, and program queries into another. It can also be used to print -every level into different file. - -It is real pain in the ass to provice information about file in every print +.I options +object. +This is useful if we want for example, print logs into one file, and program +queries into another. +It can also be used to print every level into different file. +.PP +It is real pain in the ass to provide information about file in every print function. For that matter very simple macros have been provided. - -.RS 4 -.BR ELF " fatal " +.PP +.RS +.BR ELF " Fatal errors, usually precedes application crash" .br -.BR ELA " alert " +.BR ELA " Alert, vey major error that should be fixed as soon as possible" .br -.BR ELC " critical " +.BR ELC " Critical" .br -.BR ELE " error " +.BR ELE " Error" .br -.BR ELW " warning " +.BR ELW " Warning" .br -.BR ELN " notice " +.BR ELN " Normal log, but of high importance" .br -.BR ELI " information " +.BR ELI " Information message, shouldn't spam too much here" .br -.BR ELD " debug " -.RE - -These macros comprese first 3 parameters \fIfile\fR, \fIline\fR and -\fIlevel\fR into single, short parameter. For example instead calling this - -.RS 4 -el_print(__FILE__, __LINE__, EL_NOTICE, "notice message number %d", num); +.BR ELD " Debug messages, can spam as much as you'd like" .RE - +.PP +These macros comprese first 3 parameters +.IR file , +.I line +and +.I level +into single, short parameter. +For example instead calling this +.PP +.EX + el_print(__FILE__, __LINE__, EL_NOTICE, "notice message number %d", num); +.EE +.PP you can simply call - -.RS 4 -el_print(ELN, "notice message number %d", num); -.RE - -This solution works both for c89 and c99 standards. All side effects -(like from calling function or incrementing variable in print function call) -will take effect always regardless of set logging level. Also strings used in -functions will be compiled and put into binary - always. - -If user has access to c99 compiler, one can use \fBEL_DEBUG\fR for debuging -messages only. Later when application is compiled with NDEBUG, all side effects -as well as strings used will be stripped out from final binary - so no vital -information will be leaked in such way. This is not possible on c89 compiller -due to absence of variadic variables in preprocesor macros. - +.PP +.EX + el_print(ELN, "notice message number %d", num); +.EE +.PP +This solution works both for +.B c89 +and +.B c99 +standards. +All side effects (like from calling function or incrementing variable in print +function call) will take effect always regardless of set logging level. +Also strings used in functions will be compiled and put into binary - always. +.PP +If user has access to +.B c99 +compiler, one can use +.B EL_DEBUG +for debuging messages only. +Later when application is compiled with NDEBUG, all side effects as well as +strings used will be stripped out from final binary - so no vital information +will be leaked in such way. +This is not possible on +.B c89 +compiller due to absence of variadic variables in +preprocesor macros. .SH RETURN VALUE +.PP All functions return 0 when whole message has been successfuly printed to all -configured outputs. If message couldn't be printed, it was printed only -partially, or was not send to at least one configured output -1 is returned. +configured outputs. +If message couldn't be printed, it was printed only partially, or was not send +to at least one configured output -1 is returned. Note that only one error is returned even if there was multiple errors. - .SH ERRORS - +.PP All functions may return one of these on error - .TP .B EINVAL Any of the input parameters is invalid. - .TP .B EBADF -Loggig to file is enabled and filename was not set with \fBEL_OPT_FNAME\fR +Loggig to file is enabled and filename was not set with +.B EL_FNAME option - .TP .B EBADF Logging to file is enabled, file was opened sucessfuly, but log cannot be stored -into file. This usually happen that file was unlinked from the file system and -\fBembedlog\fR couldn't create new file again (no access to directory or -directory doesn't exist at all). Log is lost, but \fBembedlog\fR will try to -recreate log file everytime \fIel_print\fR is called. - +into file. +This usually happen that file was unlinked from the file system and +.B embedlog +couldn't create new file again (no access to directory or directory doesn't +exist at all). +Log is lost, but +.B embedlog +will try to recreate log file everytime +.BR el_print (3) +is called. .TP .B ENODEV All possible outputs are disabled - -.RE -\fBel_print\fR(), \fBel_vprint\fR(), \fBel_perror\fR() \fBel_pmemory\fR -may also return - +.PP +.BR el_print (3), +.BR el_vprint (3), +.BR el_perror (3) +and +.BR el_pmemory (3) +may also return: .TP .B ERANGE Message will not be logged as message log level is lower than configured one. - .TP .B ENOBUFS -Message is bigger than \fBEL_LOG_MAX\fR and will be truncated. - -.RE +Message is bigger than +.B EL_LOG_MAX +and will be truncated. +.PP When logging to file is enabled, all functions may also return errors -from \fBfwrite\fR(3) and if file rotation is enabled also from \fBfopen\fR(3) - +from +.BR fwrite () +and if file rotation is enabled also from +.BR fopen () .SH SEE ALSO +.PP .BR el_init (3), .BR el_cleanup (3), .BR el_overview (7), diff --git a/man2html.sh b/man2html.sh new file mode 100755 index 0000000..3ffd252 --- /dev/null +++ b/man2html.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +hostname="http://embedlog.kurwinet.pl" +out="$(pwd)/www/manuals" +root="$(pwd)" +ftmp="/tmp/mtest-man2html" + +cd "${root}/man" +mkdir "${out}" + +for m in *.[1-8] +do + n="${m##*.}" + echo "opening ${m}" + + if grep "\.so man${n}" "${m}" + then + sed -i "s/man${n}/man/" "${m}" + man2html -r -H "${hostname}" "${m}" > "${ftmp}" + sed -i "s/man\//man${n}\//g" "${m}" + else + man2html -r -H "${hostname}" "${m}" > "${ftmp}" + fi + + # get only body part of the file + body_only="$(sed -n '/<BODY>/,/<\/BODY>/p' "${ftmp}")" + echo "$body_only" > "${ftmp}" + + # remove leftover <body> and <h1>man</h1> tags from beginning + tail -n+3 "${ftmp}" > tmp; mv tmp "${ftmp}" + + # construct top page heading with page info, remove superflous info + name="$(basename ${m})" + name="${name%.*}" + version_info="$(head -n1 ${ftmp} | cut -f3 -d: | cut -f1 -d\<)" + tail -n+2 "${ftmp}" > tmp; mv tmp "${ftmp}" + sed -i "1s/^/<p class=\"info left\">${name}(${n})<\/p><p class=\"info center\">kurwinet manual pages<\/p><p class=\"info right\">${name}(${n})<\/p>\n<br><P> /" "${ftmp}" + + # remove uneeded links to non-existing index + sed -i 's/<A HREF="\.\.\/index.html">Return to Main Contents<\/A><HR>//' "${ftmp}" + sed -i 's/<A HREF="#index">Index<\/A>//g' "${ftmp}" + + # extract table of content and put it in the beginning of file + ## cache first two lines (page info) and remove them from file + tmp="$(head -n2 ${ftmp})" + tail -n+3 "${ftmp}" > tmp; mv tmp "${ftmp}" + + ## get table of content from file + toc="$(sed -n '/<DL>/,/<\/DL>/p' "${ftmp}")" + + toc="$(echo "${toc}" | sed 's/<DL>/<UL class="man-toc">/')" + toc="$(echo "${toc}" | sed 's/<\/DL>/<\/UL>/')" + toc="$(echo "${toc}" | sed 's/<DT>/<LI>/')" + toc="$(echo "${toc}" | sed 's/<DD>/<\/LI>/')" + + ## put table of content and first two lines into file and append hr + { echo -e "${tmp}\n${toc}\n<HR>"; cat "${ftmp}"; } > tmp; mv tmp "${ftmp}" + + ## remove table of content and some uneeded info from bottom of file + sed -i '/^<A NAME="index"> <\/A><H2>Index<\/H2>$/,$d' "${ftmp}" + head -n-3 "${ftmp}" > tmp; mv tmp "${ftmp}" + + # change deprecated name in <a> into id + sed -i 's/A NAME="/A ID="/g' "${ftmp}" + + # generate page info at bottom of page + echo "<p class=\"info left\"><a href=\"http://en.bofc.pl\">bofc.pl</a></p><p class=\"info center\">${version_info}</p><p class=\"info right\">${name}(${n})</p>" >> "${ftmp}" + + # convert all h2 into h1 headings + sed -i 's/H2>/H1>/g' "${ftmp}" + + # remove obsolete COMPACT from dl + sed -i 's/DL COMPACT/DL/g' "${ftmp}" + + # change ../man# to ./ as we have all mans in single directory + sed -i 's/\.\.\/man.\//.\//g' "${ftmp}" + + # move generated file into output directory for further processing + cp "${ftmp}" "${out}/${m}.html" +done diff --git a/www/Makefile.am b/www/Makefile.am new file mode 100644 index 0000000..e69e9cd --- /dev/null +++ b/www/Makefile.am @@ -0,0 +1,9 @@ +EXTRA_DIST = custom.css footer.in header.in index.in index.md + +www: + kursg -o out + chmod a+rX out -R + +make clean: + $(RM) -r out + $(RM) -r manuals diff --git a/www/custom.css b/www/custom.css new file mode 100644 index 0000000..d7f8075 --- /dev/null +++ b/www/custom.css @@ -0,0 +1,59 @@ +pre#logo +{ + font-size: 3px; + max-width: 100%; +} + +pre#logo-footer +{ + font-size: 1px; + max-width: 100%; +} + +div#footer a:hover, div#header a:hover +{ + color: red; + text-decoration: none; +} + +div.codehilite:before +{ + content: "// code"; +} + +img[alt=test-result-svg] +{ + float: right; +} + +p.info +{ + margin-top: 2ch; + margin-bottom: 2ch; + margin-left: 0ch; + margin-right: 0ch; + float: left; +} + +p.left +{ + text-align: left; + width: 33% +} + +p.center +{ + text-align: center; + width: 33% +} + +p.right +{ + text-align: right; + width: 34% +} + +ul.man-toc +{ + clear: both; +} diff --git a/www/footer.in b/www/footer.in new file mode 100644 index 0000000..bf90771 --- /dev/null +++ b/www/footer.in @@ -0,0 +1,26 @@ + <a href="http://en.bofc.pl"><pre id="logo-footer"> + +88888888 +8::::::8 8888888888888888 8888888 +8::::::8 8::::::::::::::::8 8:::::8 +8::::::8 8::::::::::::::::::8 8:::::8 + 8:::::8 8::::::8888888:::::8 8:::::8 + 8:::::888888888 88888888888 8:::::8 8888888888888888888888 88888 888888888 8::::8 + 8::::::::::::::88 88:::::::::::88 8:::::8 88:::::::::::::::8 8::::888:::::::::8 8::::8 + 8::::::::::::::::8 8:::::::::::::::88:::::::888888 8:::::::::::::::::8 8:::::::::::::::::8 8::::8 + 8:::::88888:::::::88:::::88888:::::88::::::::::::8 8:::::::888888:::::8 88::::::88888::::::8 8::::8 + 8:::::8 8::::::88::::8 8::::88::::::::::::8 8::::::8 8888888 8:::::8 8:::::8 8::::8 + 8:::::8 8:::::88::::8 8::::88:::::::888888 8:::::8 8:::::8 8:::::8 8::::8 + 8:::::8 8:::::88::::8 8::::8 8:::::8 8:::::8 8:::::8 8:::::8 8::::8 + 8:::::8 8:::::88::::8 8::::8 8:::::8 8::::::8 8888888 8:::::8 8::::::8 8::::8 + 8:::::888888::::::88:::::88888:::::88:::::::8 8:::::::888888:::::8 8:::::88888:::::::88::::::8 + 8::::::::::::::::8 8:::::::::::::::88:::::::8 8:::::::::::::::::8 ...... 8::::::::::::::::8 8::::::8 + 8:::::::::::::::8 88:::::::::::88 8:::::::8 88:::::::::::::::8 .::::. 8::::::::::::::88 8::::::8 + 8888888888888888 88888888888 888888888 8888888888888888 ...... 8::::::88888888 88888888 + 8:::::8 + 8:::::8 + 8:::::::8 + 8:::::::8 + 8:::::::8 + 888888888 + </pre></a> diff --git a/www/header.in b/www/header.in new file mode 100644 index 0000000..8e8cb25 --- /dev/null +++ b/www/header.in @@ -0,0 +1,26 @@ +<a href="/"><pre id="logo"> + 88888888 88888888 + 8::::::8 8::::::88888888 + 8::::::8 8::::::88:::::8 + 8::::::8 8::::::88:::::8 + 8:::::8 8:::::8 8:::::8 + 888888888888 8888888 8888888 8:::::888888888 888888888888 888888888:::::8 8::::8 88888888888 888888888 88888 + 88::::::::::::88 88:::::::8 8:::::::88 8::::::::::::::88 88::::::::::::88 88::::::::::::::8 8::::8 88:::::::::::88 8:::::::::888::::8 + 8::::::88888:::::888::::::::::88::::::::::88::::::::::::::::8 8::::::88888:::::88 8::::::::::::::::8 8::::8 8:::::::::::::::8 8:::::::::::::::::8 +8::::::8 8:::::88::::::::::::::::::::::88:::::88888:::::::88::::::8 8:::::88:::::::88888:::::8 8::::8 8:::::88888:::::88::::::88888::::::88 +8:::::::88888::::::88:::::888::::::888:::::88:::::8 8::::::88:::::::88888::::::88::::::8 8:::::8 8::::8 8::::8 8::::88:::::8 8:::::8 +8:::::::::::::::::8 8::::8 8::::8 8::::88:::::8 8:::::88:::::::::::::::::8 8:::::8 8:::::8 8::::8 8::::8 8::::88:::::8 8:::::8 +8::::::88888888888 8::::8 8::::8 8::::88:::::8 8:::::88::::::88888888888 8:::::8 8:::::8 8::::8 8::::8 8::::88:::::8 8:::::8 +8:::::::8 8::::8 8::::8 8::::88:::::8 8:::::88:::::::8 8:::::8 8:::::8 8::::8 8::::8 8::::88::::::8 8:::::8 +8::::::::8 8::::8 8::::8 8::::88:::::888888::::::88::::::::8 8::::::88888::::::888::::::88:::::88888:::::88:::::::88888:::::8 + 8::::::::88888888 8::::8 8::::8 8::::88::::::::::::::::8 8::::::::88888888 8:::::::::::::::::88::::::88:::::::::::::::8 8::::::::::::::::8 + 88:::::::::::::8 8::::8 8::::8 8::::88:::::::::::::::8 88:::::::::::::8 8:::::::::888::::88::::::8 88:::::::::::88 88::::::::::::::8 + 88888888888888 888888 888888 8888888888888888888888 88888888888888 888888888 8888888888888 88888888888 88888888::::::8 + 8:::::8 + 888888 8:::::8 + 8:::::88 88:::::8 + 8::::::888:::::::8 + 88:::::::::::::8 + 888::::::888 + 888888 +</pre></a> diff --git a/www/index.in b/www/index.in new file mode 100644 index 0000000..f20f16a --- /dev/null +++ b/www/index.in @@ -0,0 +1,7 @@ +in_title="embedlog.kurwinet.pl - c/c++ logger with embedded devices in mind" +in_description="Logger written in C89 targeting embedded systems. It's main goals are to be small and fast. Many features can be disabled during compilation to generate smaller binary." +in_keywords="c, embedded, logger, file, rotate, network" +in_author="Michał Łyszczek" +in_lang="en" +in_pygment=vim +in_style=man diff --git a/www/index.md b/www/index.md new file mode 120000 index 0000000..15926e3 --- /dev/null +++ b/www/index.md @@ -0,0 +1 @@ +../readme.md
\ No newline at end of file |