mirror of
https://github.com/troglobit/libite.git
synced 2026-10-13 10:14:42 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94d547c9ec | ||
|
|
68cf8b6576 | ||
|
|
b6a55fcc46 | ||
|
|
5f29ef6413 | ||
|
|
627c47caff | ||
|
|
7c2ed556b9 | ||
|
|
6dec4e3858 | ||
|
|
dff92356b3 | ||
|
|
883c90112d | ||
|
|
a2c8dddaad | ||
|
|
14f547b638 | ||
|
|
6f2a03bba7 | ||
|
|
cdfffa312b | ||
|
|
50cb72018f | ||
|
|
e8a3117158 |
No files matched your search
+23
-1
@@ -3,6 +3,27 @@ Change Log
|
||||
|
||||
All notable changes to the project are documented in this file.
|
||||
|
||||
[v1.8.2][] - 2016-09-05
|
||||
-----------------------
|
||||
|
||||
### Changes
|
||||
- Updated build instructions in README.
|
||||
- Converted touch(), makedir(), makefifo(), and erase() from macros to
|
||||
inline functions. Also removed implicit logging to stderr on error.
|
||||
|
||||
### Fixes
|
||||
- Fix small memory leak in pidfile() ... at exit.
|
||||
- Fixes for building on musl libc
|
||||
|
||||
|
||||
[v1.8.1][] - 2016-06-25
|
||||
-----------------------
|
||||
|
||||
### Fixes
|
||||
|
||||
- `fparseln()`, portability fix for NetBSD
|
||||
- `pidfile()`, portability fix for NetBSD and OpenBSD
|
||||
|
||||
|
||||
[v1.8.0][] - 2016-06-06
|
||||
-----------------------
|
||||
@@ -195,7 +216,8 @@ problems this may cause!
|
||||
Initial extraction of frog DNA from [Finit][]. See [README][] for API details.
|
||||
|
||||
|
||||
[UNRELEASED]: https://github.com/troglobit/libite/compare/v1.8.0...HEAD
|
||||
[UNRELEASED]: https://github.com/troglobit/libite/compare/v1.8.1...HEAD
|
||||
[v1.8.1]: https://github.com/troglobit/libite/compare/v1.8.0...v1.8.1
|
||||
[v1.8.0]: https://github.com/troglobit/libite/compare/v1.7.0...v1.8.0
|
||||
[v1.7.0]: https://github.com/troglobit/libite/compare/v1.6.0...v1.7.0
|
||||
[v1.6.0]: https://github.com/troglobit/libite/compare/v1.5.1...v1.6.0
|
||||
|
||||
+23
-23
@@ -3,9 +3,9 @@ ACLOCAL_AMFLAGS = -I m4
|
||||
lib_LTLIBRARIES = libite.la
|
||||
pkgincludedir = $(includedir)/lite
|
||||
pkginclude_HEADERS = lite.h queue.h conio.h tree.h strlite.h strdupa.h strndupa.h strnlen.h
|
||||
libite_la_SOURCES = chomp.c copyfile.c dir.c fexist.c fisdir.c fmode.c fparseln.c \
|
||||
fsendfile.c ifconfig.c lfile.c makepath.c pidfile.c pidfilefn.c \
|
||||
progress.c reallocarray.c rsync.c strlcpy.c strlcat.c strtonum.c \
|
||||
libite_la_SOURCES = chomp.c copyfile.c dir.c fexist.c fisdir.c fmode.c fparseln.c \
|
||||
fsendfile.c ifconfig.c lfile.c makepath.c pidfile.c pidfilefn.c \
|
||||
progress.c reallocarray.c rsync.c strlcpy.c strlcat.c strtonum.c \
|
||||
tempfile.c tree.c
|
||||
|
||||
libite_la_CPPFLAGS = -D_GNU_SOURCE
|
||||
@@ -21,32 +21,32 @@ SUBDIRS = tests
|
||||
## Generate MD5 checksum file
|
||||
MD5 = md5sum
|
||||
md5-dist:
|
||||
@for file in $(DIST_ARCHIVES); do \
|
||||
$(MD5) $$file > $$file.md5; \
|
||||
@for file in $(DIST_ARCHIVES); do \
|
||||
$(MD5) $$file > $$file.md5; \
|
||||
done
|
||||
|
||||
## Check if tagged in git
|
||||
release-hook:
|
||||
if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \
|
||||
echo; \
|
||||
printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \
|
||||
printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \
|
||||
if [ "$$yorn" != "y" -a "$$yorn" != "Y" ]; then \
|
||||
printf "OK, aborting release.\n"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
echo; \
|
||||
else \
|
||||
echo; \
|
||||
printf "\e[1m\e[42mFound GIT release tag $(PACKAGE_VERSION)\e[0m\n"; \
|
||||
printf "\e[1m\e[44m>>Remember to push tags!\e[0m\n"; \
|
||||
echo; \
|
||||
if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \
|
||||
echo; \
|
||||
printf "\033[1m\033[41mCannot find release tag $(PACKAGE_VERSION)\033[0m\n"; \
|
||||
printf "\033[1m\033[5mDo release anyway?\033[0m "; read yorn; \
|
||||
if [ "$$yorn" != "y" -a "$$yorn" != "Y" ]; then \
|
||||
printf "OK, aborting release.\n"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
echo; \
|
||||
else \
|
||||
echo; \
|
||||
printf "\033[1m\033[42mFound GIT release tag $(PACKAGE_VERSION)\033[0m\n"; \
|
||||
printf "\033[1m\033[44m>>Remember to push tags!\033[0m\n"; \
|
||||
echo; \
|
||||
fi
|
||||
|
||||
## Target to run when building a release
|
||||
release: dist release-hook md5-dist
|
||||
@for file in $(DIST_ARCHIVES); do \
|
||||
printf "$$file \tDistribution tarball\n"; \
|
||||
printf "$$file.md5\t"; cat $$file.md5 | cut -f1 -d' '; \
|
||||
mv $$file* ../; \
|
||||
@for file in $(DIST_ARCHIVES); do \
|
||||
printf "$$file \tDistribution tarball\n"; \
|
||||
printf "$$file.md5\t"; cat $$file.md5 | cut -f1 -d' '; \
|
||||
mv $$file* ../; \
|
||||
done
|
||||
@@ -362,7 +362,8 @@ system:
|
||||
|
||||
./configure
|
||||
make -j5
|
||||
make install-strip
|
||||
sudo make install-strip
|
||||
sudo ldconfig
|
||||
|
||||
**Note:** When checking code from GitHub, use <kbd>./autogen.sh</kbd> to
|
||||
generate a `configure` script. It is a generated file and otherwise only
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
AC_INIT(libite, 1.8.0, https://github.com/troglobit/libite/issues)
|
||||
AC_INIT(libite, 1.8.2, https://github.com/troglobit/libite/issues)
|
||||
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
|
||||
AM_SILENT_RULES([yes])
|
||||
|
||||
|
||||
@@ -49,24 +49,24 @@
|
||||
#define WHITE 0x17
|
||||
|
||||
/* Esc[2JEsc[1;1H - Clear screen and move cursor to 1,1 (upper left) pos. */
|
||||
#define clrscr() fputs ("\e[2J\e[1;1H", stdout)
|
||||
#define clrscr() fputs ("\033[2J\033[1;1H", stdout)
|
||||
/* Esc[K - Erases from the current cursor position to the end of the current line. */
|
||||
#define clreol() fputs ("\e[K", stdout)
|
||||
#define clreol() fputs ("\033[K", stdout)
|
||||
/* Esc[2K - Erases the entire current line. */
|
||||
#define delline() fputs ("\e[2K", stdout)
|
||||
#define delline() fputs ("\033[2K", stdout)
|
||||
/* Esc[Line;ColumnH - Moves the cursor to the specified position (coordinates) */
|
||||
#define gotoxy(x,y) printf("\e[%d;%dH", y, x)
|
||||
#define gotoxy(x,y) printf("\033[%d;%dH", y, x)
|
||||
/* Esc[?25l (lower case L) - Hide Cursor */
|
||||
#define hidecursor() fputs ("\e[?25l", stdout)
|
||||
#define hidecursor() fputs ("\033[?25l", stdout)
|
||||
/* Esc[?25h (lower case H) - Show Cursor */
|
||||
#define showcursor() fputs ("\e[?25h", stdout)
|
||||
#define showcursor() fputs ("\033[?25h", stdout)
|
||||
|
||||
/* Esc[Value;...;Valuem - Set Graphics Mode */
|
||||
#define __set_gm(attr,color,val) \
|
||||
if (!color) \
|
||||
printf("\e[%dm", attr); \
|
||||
printf("\033[%dm", attr); \
|
||||
else \
|
||||
printf("\e[%d;%dm", color & 0x10 ? 1 : 0, (color & 0xF) + val)
|
||||
printf("\033[%d;%dm", color & 0x10 ? 1 : 0, (color & 0xF) + val)
|
||||
#define textattr(attr) __set_gm(attr, 0, 0)
|
||||
#define textcolor(color) __set_gm(RESETATTR, color, 30)
|
||||
#define textbackground(color) __set_gm(RESETATTR, color, 40)
|
||||
|
||||
+2
-5
@@ -24,11 +24,6 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: fparseln.c,v 1.10 2009/10/21 01:07:45 snj Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
@@ -36,7 +31,9 @@ __RCSID("$NetBSD: fparseln.c,v 1.10 2009/10/21 01:07:45 snj Exp $");
|
||||
#include <stdlib.h>
|
||||
#include "lite.h"
|
||||
|
||||
#ifndef _DIAGASSERT
|
||||
#define _DIAGASSERT(t)
|
||||
#endif
|
||||
|
||||
static int isescaped(const char *, const char *, int);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#ifndef LITE_H_
|
||||
#define LITE_H_
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h> /* uint8_t, uint16_t, uint32_t, INT32_MAX, etc. */
|
||||
#include <sys/stat.h>
|
||||
@@ -71,7 +71,7 @@ int mkpath (char *dir, mode_t mode);
|
||||
int makepath (char *dir);
|
||||
|
||||
int dir (const char *dir, const char *type, int (*filter) (const char *file), char ***list, int strip);
|
||||
int rsync (char *src, char *dst, int delete, int (*filter) (const char *file));
|
||||
int rsync (char *src, char *dst, int delete, int (*filter) (const char *file));
|
||||
|
||||
int pidfile (const char *basename);
|
||||
int pidfile_signal(const char *pidfile, int signal);
|
||||
@@ -86,17 +86,38 @@ void progress (int percent, int max_width);
|
||||
void progress_simple(int percent);
|
||||
|
||||
#ifndef touch
|
||||
# define touch(x) do { if (mknod((x), S_IFREG|0644, 0) && errno != EEXIST) warn("Failed creating %s", x); } while (0)
|
||||
static inline int touch(const char *path)
|
||||
{
|
||||
if (mknod((path), S_IFREG|0644, 0) && errno != EEXIST)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifndef makedir
|
||||
# define makedir(x, p) do { if (mkdir(x, p) && errno != EEXIST) warn("Failed creating directory %s", x); } while (0)
|
||||
static inline int makedir(const char *path, mode_t mode)
|
||||
{
|
||||
if (mkdir(path, mode) && errno != EEXIST)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifndef makefifo
|
||||
# define makefifo(x, p) do { if (mkfifo(x, p) && errno != EEXIST) warn("Failed creating FIFO %s", x); } while (0)
|
||||
static inline int makefifo(const char *path, mode_t mode)
|
||||
{
|
||||
if (mkfifo(path, mode) && errno != EEXIST)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifndef erase
|
||||
# define erase(x) do { if (remove(x) && errno != ENOENT) warn("Failed removing %s", x); } while (0)
|
||||
static inline int erase(const char *path)
|
||||
{
|
||||
if (remove(path) && errno != ENOENT)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef chardev
|
||||
# define chardev(x,m,maj,min) mknod((x), S_IFCHR|(m), makedev((maj),(min)))
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Updated by troglobit for libite/finit/uftpd projects 2016/03/19 */
|
||||
/* Updated by troglobit for libite/finit/uftpd projects 2016/07/04 */
|
||||
/* $OpenBSD: pidfile.c,v 1.11 2015/06/03 02:24:36 millert Exp $ */
|
||||
/* $NetBSD: pidfile.c,v 1.4 2001/02/19 22:43:42 cgd Exp $ */
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/stat.h> /* utimensat() */
|
||||
#include <sys/time.h> /* utimensat() on *BSD */
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <paths.h>
|
||||
@@ -121,8 +122,10 @@ pidfile(const char *basename)
|
||||
static void
|
||||
pidfile_cleanup(void)
|
||||
{
|
||||
|
||||
if (pidfile_path != NULL && pidfile_pid == getpid())
|
||||
if (pidfile_path != NULL && pidfile_pid == getpid()) {
|
||||
(void) unlink(pidfile_path);
|
||||
free(pidfile_path);
|
||||
pidfile_path = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+2
-2
@@ -25,8 +25,8 @@ static inline int test(int result, const char *fmt, ...)
|
||||
char buf[80];
|
||||
size_t len;
|
||||
va_list ap;
|
||||
const char success[] = " \e[1m[ OK ]\e[0m\n";
|
||||
const char failure[] = " \e[7m[FAIL]\e[0m\n";
|
||||
const char success[] = " \033[1m[ OK ]\033[0m\n";
|
||||
const char failure[] = " \033[7m[FAIL]\033[0m\n";
|
||||
const char dots[] = " .....................................................................";
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <err.h>
|
||||
#include "check.h"
|
||||
|
||||
int main(void)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <err.h>
|
||||
#include "check.h"
|
||||
|
||||
int main(void)
|
||||
|
||||
+31
-1
@@ -1,6 +1,36 @@
|
||||
#include <stdio.h>
|
||||
#include "check.h"
|
||||
|
||||
#define FSTAB "/etc/fstab"
|
||||
|
||||
static int fstab(void)
|
||||
{
|
||||
int field = 1;
|
||||
char *token, *dev;
|
||||
lfile_t *lf;
|
||||
|
||||
lf = lfopen(FSTAB, " \t\n");
|
||||
if (!lf) {
|
||||
perror("Failed opening " FSTAB);
|
||||
return 1;
|
||||
}
|
||||
|
||||
while ((token = lftok(lf))) {
|
||||
if (field == 1)
|
||||
dev = token;
|
||||
if (field == 6) {
|
||||
field = 0;
|
||||
printf("Found %s passno %d\n", dev, atoi(token));
|
||||
}
|
||||
|
||||
field++;
|
||||
}
|
||||
|
||||
lfclose(lf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int val;
|
||||
@@ -33,5 +63,5 @@ int main(void)
|
||||
}
|
||||
printf("nobody is uid %d\n", val);
|
||||
|
||||
return 0;
|
||||
return fstab();
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <err.h>
|
||||
#include <paths.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
#include <stdlib.h> /* atexit() */
|
||||
#include <unistd.h> /* usleep() */
|
||||
#include "conio.h"
|
||||
|
||||
#include "check.h"
|
||||
#include "../conio.h"
|
||||
|
||||
#define MAX_WIDTH 80
|
||||
#define msleep(msec) usleep(msec * 1000)
|
||||
|
||||
Reference in new issue
Block a user