mirror of
https://github.com/troglobit/libite.git
synced 2026-10-14 10:19:31 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e18edea93 | ||
|
|
9c89daf770 | ||
|
|
b3d4674bf7 | ||
|
|
aa4576d5ea | ||
|
|
ae56c9e33c | ||
|
|
3387c737be | ||
|
|
8d90ede158 | ||
|
|
b1fe8a1271 | ||
|
|
044c2621ac | ||
|
|
7396dd83c7 | ||
|
|
e5fe988cdc | ||
|
|
824da13977 | ||
|
|
efb1470008 | ||
|
|
d2d0792c06 | ||
|
|
711c59e3a6 | ||
|
|
f85ff3c835 | ||
|
|
16ea69adb4 | ||
|
|
ae492581f8 | ||
|
|
d16385415c | ||
|
|
d27518c5b8 | ||
|
|
724926896a | ||
|
|
ef04307b4a | ||
|
|
5d035d955e | ||
|
|
b65175782d | ||
|
|
c27a8e7ec6 | ||
|
|
d231c1e1eb | ||
|
|
247fb67274 | ||
|
|
c716cc5835 | ||
|
|
e81ce85867 | ||
|
|
549f325c21 | ||
|
|
2a6adeebcd | ||
|
|
cb2beacf2c | ||
|
|
256b6ba038 | ||
|
|
61d9b5fac7 | ||
|
|
38ad841389 | ||
|
|
f1a1a21569 | ||
|
|
7f3f4df9e9 | ||
|
|
02a42a1cad | ||
|
|
28c11f010a | ||
|
|
20d8d40285 | ||
|
|
4dc24f37e3 | ||
|
|
11f8846f63 | ||
|
|
41778fb3ce | ||
|
|
59d1f0d60c | ||
|
|
afc4289326 | ||
|
|
67267659f7 | ||
|
|
188509d811 | ||
|
|
c10cd67266 | ||
|
|
82db75cac6 | ||
|
|
51970ff86e | ||
|
|
d6fa3cde96 | ||
|
|
9d50de3ec7 | ||
|
|
2aed5a6b3f | ||
|
|
f873635cfe | ||
|
|
c3d5588298 | ||
|
|
a65b2dfd71 | ||
|
|
6e8d8fc32c | ||
|
|
966aee09cd | ||
|
|
f93e298875 | ||
|
|
c8ec83f20c | ||
|
|
835e09a9fe | ||
|
|
13ffe87d10 | ||
|
|
72d1cb6501 | ||
|
|
83ace4f12d | ||
|
|
9bdc5e94b5 | ||
|
|
83047d4413 | ||
|
|
b2c2d032e8 | ||
|
|
7f053f7624 | ||
|
|
b15a14e920 | ||
|
|
7e8534e36b | ||
|
|
3989d91d36 | ||
|
|
fe3673a5e1 | ||
|
|
1bdcb1bfe4 | ||
|
|
75d3f1978e | ||
|
|
c07bfbda58 | ||
|
|
0ef509c393 | ||
|
|
5620faf7bf | ||
|
|
b6a9ed3c6d | ||
|
|
9d63302337 | ||
|
|
02d9d9f8c1 | ||
|
|
9f92a9d572 | ||
|
|
f0e3ed3342 | ||
|
|
34f23a77f8 | ||
|
|
261cf3a01b | ||
|
|
2c9c13bd07 | ||
|
|
59ce0c0dc4 | ||
|
|
a603208da9 | ||
|
|
eaac01871b | ||
|
|
8cefa12675 | ||
|
|
5893010074 | ||
|
|
d84bcb3847 | ||
|
|
a9a3a2dda1 | ||
|
|
20af39300c | ||
|
|
7b612cda83 | ||
|
|
60406c33f6 | ||
|
|
1d21b11802 | ||
|
|
a3badc85f8 | ||
|
|
ac936448f5 | ||
|
|
3a26ab28b2 | ||
|
|
123108fbf9 | ||
|
|
3545d63d2e | ||
|
|
3e921d72e5 |
No files matched your search
+1
-9
@@ -1,16 +1,8 @@
|
|||||||
*~
|
*~
|
||||||
*.d
|
|
||||||
*.o
|
|
||||||
*.so
|
|
||||||
*.so.*
|
|
||||||
*.a
|
|
||||||
.deps
|
|
||||||
.libs
|
|
||||||
ID
|
ID
|
||||||
GPATH
|
GPATH
|
||||||
GRTAGS
|
GRTAGS
|
||||||
GTAGS
|
GTAGS
|
||||||
tmp/
|
|
||||||
compile
|
compile
|
||||||
config.*
|
config.*
|
||||||
configure
|
configure
|
||||||
@@ -25,5 +17,5 @@ Makefile.in
|
|||||||
aclocal.m4
|
aclocal.m4
|
||||||
ar-lib
|
ar-lib
|
||||||
autom4te.cache
|
autom4te.cache
|
||||||
libite*
|
|
||||||
test-driver
|
test-driver
|
||||||
|
libite.pc
|
||||||
+19
@@ -10,6 +10,25 @@ compiler:
|
|||||||
- gcc
|
- gcc
|
||||||
- clang
|
- clang
|
||||||
|
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
|
||||||
|
# via the "travis encrypt" command using the project repo's public key
|
||||||
|
- secure: "EcWeDUONZnl7IHBWD2rc92LwTWGIlqBZ7wQrLfe3mFXOnB+IZjJIBnDsJDnHDWwA8fGF9NaJbRz4BThroafueUwkDXNyvph1Mdaxm6mdMPyjNJ4H1AFkd9Fz0LYdLNXCPl43tm6s1BR6OWts17lWF6sMnMmIu8gUgXJVg2qsDBl3O9eCoRvQ/h4elLfXZ03fHi4XzzzQvZVyDCg8MCzXIgHJzdkv4llpiCLWQExFbIAVy39euDnx+UuWYB7WDdUbOc7HkkUwf0/vX9PhKVQFKOkXn1ddN0iCsWRH3ti5KXWrBeRO3RPu6Z5YtR8l1WK7iqCYOLuMBW23tXsBQsIW09f1+fFgJ8Ig5hHRRbDinbTUb+mHUJZmNv9ZTc3hPYH4Fyev/ljk42VVDdIBy9AqO42jj8VGmDmiIq47aqNJZUGYZgQlGXGqk9MtavJrqEVcFSgyfEtI+c4n4fzvMRpcEwjnbp482s1xNzHQZ1GQI77Td5UUXXWyNSCoQoE/VpkAesYJAw8KwXOXveDr3Qu0HhuQu1oyLmWHlZHYDu+TInjY81gpGw9Cm7/SdFoA0Ag49PlAXdPRymbP01B50MqrCTxtXEHtdXxhrkDvaoUp7heSuvO0fS+mI5F7eQ4Ji2JdyRSt1KpXVNAyL1FrO/yznM3EwcXPmWmrc+QjFtC9vY4="
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-
|
||||||
|
|
||||||
|
addons:
|
||||||
|
coverity_scan:
|
||||||
|
project:
|
||||||
|
name: "troglobit/libite"
|
||||||
|
description: "That missing frog DNA you've been looking for"
|
||||||
|
notification_email: troglobit@gmail.com
|
||||||
|
build_command_prepend: "./autogen.sh && ./configure --prefix=/tmp --disable-silent-rules"
|
||||||
|
build_command: "make clean all"
|
||||||
|
branch_pattern: dev
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./autogen.sh
|
- ./autogen.sh
|
||||||
- ./configure --prefix=/tmp --disable-silent-rules
|
- ./configure --prefix=/tmp --disable-silent-rules
|
||||||
|
|||||||
+100
-7
@@ -3,6 +3,97 @@ Change Log
|
|||||||
|
|
||||||
All notable changes to the project are documented in this file.
|
All notable changes to the project are documented in this file.
|
||||||
|
|
||||||
|
[v2.3.0][] - 2021-02-12
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
- Add support for `fremove()`, formatted `remove()` replacement
|
||||||
|
- Add support for `truncatef()`, formatted `truncate()` replacement
|
||||||
|
- Add tar.gz archives to distribution
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Handle `ETIMEDOUT` error for `connect()` call in `telnet_open()`
|
||||||
|
|
||||||
|
|
||||||
|
[v2.2.0][] - 2020-03-16
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
- Add support for `systemf()`, formatted string `system()` replacement
|
||||||
|
- Add support for `fmkpath()`, formatted string `mkpath()`
|
||||||
|
- Add support for `fopenf()`, formatted string `fopen()` replacement
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Fix possible memory leak in `rsync()`, found by Coverity Scan
|
||||||
|
- Check return value of `fstat()` to prevent bogus destination file
|
||||||
|
times when using `copyfile()`, found by Coverity Scan
|
||||||
|
|
||||||
|
|
||||||
|
[v2.1.2][] - 2020-02-22
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Fix Debian package upgrade from libite -> libite5
|
||||||
|
|
||||||
|
|
||||||
|
[v2.1.1][] - 2020-02-22
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
- Add test/example for `printhdr()`
|
||||||
|
- Update copyright years
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- chomp: Check for beginning of string while removing \n's
|
||||||
|
|
||||||
|
|
||||||
|
[v2.1.0][] - 2019-08-26
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
- Add support for `strmatch()` and `strnmatch()`
|
||||||
|
- Add support for `yorn()`, safe yes-or-no prompt
|
||||||
|
- Add support for telnet expect/session APIs
|
||||||
|
- Add modified `printhdr()` which takes ANSI attribute
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Fix `pidfile_signal()`: always return result of `kill()`, or the
|
||||||
|
result of `remove()` if we successfully sent `SIGKILL`
|
||||||
|
- Fix `strtonum()`: POSIX `strtoll()` returns `EINVAL`, check that
|
||||||
|
- Fix #13, support C++ `extern "C" {}` for header files
|
||||||
|
|
||||||
|
|
||||||
|
[v2.0.2][] - 2018-05-10
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Fix issue #12, missing includes in `strlite.h` for standalone use
|
||||||
|
- FTBFS `strtonum.c` on older systems w/o `LLONG_MAX` and `LLONG_MIN`
|
||||||
|
|
||||||
|
|
||||||
|
[v2.0.1][] - 2017-12-22
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
- Add missing `initscr()` declaration, regression in [v2.0.0][]
|
||||||
|
- Add `#ifdef` guards around `min()` and `max()` macros
|
||||||
|
- Add `const` to `char *` args in multiple API:s:
|
||||||
|
- `fexist()`
|
||||||
|
- `fgetint()`
|
||||||
|
- `fisslashdir()`
|
||||||
|
- `copyfile()`
|
||||||
|
- `movefile()`
|
||||||
|
- `ifconfig()`
|
||||||
|
- `lfopen()`
|
||||||
|
- `lfgetkey()`
|
||||||
|
- `lfgetint()`
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Fix #9, uncommon location of `which` command in unit test
|
||||||
|
- Fix #10, supply unit test with a default `$PATH`
|
||||||
|
- Fix #11, `touch()` command cannot handle relative paths when updating
|
||||||
|
the mtime of an existing file
|
||||||
|
|
||||||
|
|
||||||
[v2.0.0][] - 2017-11-22
|
[v2.0.0][] - 2017-11-22
|
||||||
-----------------------
|
-----------------------
|
||||||
@@ -292,7 +383,15 @@ problems this may cause!
|
|||||||
Initial extraction of frog DNA from [Finit][]. See [README][] for API details.
|
Initial extraction of frog DNA from [Finit][]. See [README][] for API details.
|
||||||
|
|
||||||
|
|
||||||
[UNRELEASED]: https://github.com/troglobit/libite/compare/v2.0.0...HEAD
|
[UNRELEASED]: https://github.com/troglobit/libite/compare/v2.3.0...HEAD
|
||||||
|
[v2.3.0]: https://github.com/troglobit/libite/compare/v2.2.1...v2.3.0
|
||||||
|
[v2.2.1]: https://github.com/troglobit/libite/compare/v2.2.0...v2.2.1
|
||||||
|
[v2.2.0]: https://github.com/troglobit/libite/compare/v2.1.2...v2.2.0
|
||||||
|
[v2.1.2]: https://github.com/troglobit/libite/compare/v2.1.1...v2.1.2
|
||||||
|
[v2.1.1]: https://github.com/troglobit/libite/compare/v2.1.0...v2.1.1
|
||||||
|
[v2.1.0]: https://github.com/troglobit/libite/compare/v2.0.2...v2.1.0
|
||||||
|
[v2.0.2]: https://github.com/troglobit/libite/compare/v2.0.1...v2.0.2
|
||||||
|
[v2.0.1]: https://github.com/troglobit/libite/compare/v2.0.0...v2.0.1
|
||||||
[v2.0.0]: https://github.com/troglobit/libite/compare/v1.9.3...v2.0.0
|
[v2.0.0]: https://github.com/troglobit/libite/compare/v1.9.3...v2.0.0
|
||||||
[v1.9.3]: https://github.com/troglobit/libite/compare/v1.9.2...v1.9.3
|
[v1.9.3]: https://github.com/troglobit/libite/compare/v1.9.2...v1.9.3
|
||||||
[v1.9.2]: https://github.com/troglobit/libite/compare/v1.9.1...v1.9.2
|
[v1.9.2]: https://github.com/troglobit/libite/compare/v1.9.1...v1.9.2
|
||||||
@@ -320,9 +419,3 @@ Initial extraction of frog DNA from [Finit][]. See [README][] for API details.
|
|||||||
[Inadyn]: https://github.com/troglobit/inadyn/
|
[Inadyn]: https://github.com/troglobit/inadyn/
|
||||||
[Mg]: https://github.com/troglobit/mg
|
[Mg]: https://github.com/troglobit/mg
|
||||||
[README]: https://github.com/troglobit/libite/blob/v1.0.0/README.md
|
[README]: https://github.com/troglobit/libite/blob/v1.0.0/README.md
|
||||||
|
|
||||||
<!--
|
|
||||||
-- Local Variables:
|
|
||||||
-- mode: markdown
|
|
||||||
-- End:
|
|
||||||
-->
|
|
||||||
@@ -1,10 +1,5 @@
|
|||||||
Much of the code in libite (-lite) is written by Claudio Matsuoka for Finit
|
|
||||||
and released under the MIT/X11 license. Joachim Nilsson later improved on
|
|
||||||
the Finit code base and included pieces of software released under the ISC
|
|
||||||
and BSD licenses. See each respective file for license details.
|
|
||||||
|
|
||||||
Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
Copyright (c) 2008-2016 Joachim Nilsson <troglobit@gmail.com>
|
Copyright (c) 2008-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+35
-31
@@ -1,44 +1,48 @@
|
|||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
doc_DATA = README.md LICENSE
|
doc_DATA = README.md LICENSE ChangeLog.md
|
||||||
EXTRA_DIST = README.md LICENSE ChangeLog.md
|
EXTRA_DIST = README.md LICENSE ChangeLog.md
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = libite.pc
|
pkgconfig_DATA = libite.pc
|
||||||
SUBDIRS = src tests
|
SUBDIRS = src tests
|
||||||
|
|
||||||
## Generate .deb package
|
|
||||||
package:
|
|
||||||
@dpkg-buildpackage -uc -us -B
|
|
||||||
|
|
||||||
## Generate MD5 checksum file
|
|
||||||
MD5 = md5sum
|
|
||||||
md5-dist:
|
|
||||||
@for file in $(DIST_ARCHIVES); do \
|
|
||||||
$(MD5) $$file > $$file.md5; \
|
|
||||||
done
|
|
||||||
|
|
||||||
## Check if tagged in git
|
## Check if tagged in git
|
||||||
release-hook:
|
release-hook:
|
||||||
if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \
|
@if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \
|
||||||
echo; \
|
echo; \
|
||||||
printf "\033[1m\033[41mCannot find release tag $(PACKAGE_VERSION)\033[0m\n"; \
|
printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \
|
||||||
printf "\033[1m\033[5mDo release anyway?\033[0m "; read yorn; \
|
printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \
|
||||||
if [ "$$yorn" != "y" -a "$$yorn" != "Y" ]; then \
|
if [ "$$yorn" != "y" -a "$$yorn" != "Y" ]; then \
|
||||||
printf "OK, aborting release.\n"; \
|
printf "OK, aborting release.\n"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi; \
|
fi; \
|
||||||
echo; \
|
echo; \
|
||||||
else \
|
else \
|
||||||
echo; \
|
echo; \
|
||||||
printf "\033[1m\033[42mFound GIT release tag $(PACKAGE_VERSION)\033[0m\n"; \
|
printf "\e[1m\e[42mFound GIT release tag $(PACKAGE_VERSION)\e[0m\n"; \
|
||||||
printf "\033[1m\033[44m>>Remember to push tags!\033[0m\n"; \
|
printf "\e[1m\e[44m>>Remember to push tags!\e[0m\n"; \
|
||||||
echo; \
|
echo; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# lintian --profile debian -i -I --show-overrides ../$PKG.changes
|
||||||
|
package build-deb:
|
||||||
|
@dpkg-buildpackage -uc -us -B
|
||||||
|
|
||||||
## Target to run when building a release
|
## Target to run when building a release
|
||||||
release: distcheck release-hook md5-dist
|
release: release-hook distcheck package
|
||||||
@for file in $(DIST_ARCHIVES); do \
|
@for file in $(DIST_ARCHIVES); do \
|
||||||
printf "$$file \tDistribution tarball\n"; \
|
md5sum $$file > ../$$file.md5; \
|
||||||
printf "$$file.md5\t"; cat $$file.md5 | cut -f1 -d' '; \
|
sha256sum $$file > ../$$file.sha256; \
|
||||||
mv $$file* ../; \
|
done
|
||||||
|
@mv $(DIST_ARCHIVES) ../
|
||||||
|
@echo
|
||||||
|
@echo "Resulting release files:"
|
||||||
|
@echo "================================================================="
|
||||||
|
@for file in $(DIST_ARCHIVES); do \
|
||||||
|
printf "%-32s Distribution tarball\n" $$file; \
|
||||||
|
printf "%-32s " $$file.md5; cat ../$$file.md5 | cut -f1 -d' '; \
|
||||||
|
printf "%-32s " $$file.sha256; cat ../$$file.sha256 | cut -f1 -d' '; \
|
||||||
|
done
|
||||||
|
@for file in `cd ..; ls $(PACKAGE)*_$(VERSION)*`; do \
|
||||||
|
printf "%-32s Debian/Ubuntu package\n" $$file; \
|
||||||
done
|
done
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
-lite | Frog DNA, basically
|
-lite | Frog DNA, basically
|
||||||
===========================
|
===========================
|
||||||
[![Travis Status][]][Travis]
|
[![Travis Status][]][Travis] [![Coverity Status]][Coverity Scan]
|
||||||
|
|
||||||
|
|
||||||
Table of Contents
|
Table of Contents
|
||||||
-----------------
|
-----------------
|
||||||
@@ -12,7 +11,7 @@ Table of Contents
|
|||||||
* [Generic Functions](#generic-functions)
|
* [Generic Functions](#generic-functions)
|
||||||
* [OpenBSD Functions](#openbsd-functions)
|
* [OpenBSD Functions](#openbsd-functions)
|
||||||
* [Build & Install](#origin--references)
|
* [Build & Install](#origin--references)
|
||||||
* [TODO](#todo)
|
* [Origin & References](#origin--references)
|
||||||
|
|
||||||
|
|
||||||
> **NOTE:** Incompatible changes in v2.0 compared to v1.x!
|
> **NOTE:** Incompatible changes in v2.0 compared to v1.x!
|
||||||
@@ -20,24 +19,19 @@ Table of Contents
|
|||||||
Introduction
|
Introduction
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Libite is a lightweight library of *frog DNA*. It can be used to fill
|
Libite is a lightweight library of *frog DNA* that can be used to fill
|
||||||
the gaps in any dinosaur project. It holds useful functions and macros
|
the gaps in any dinosaur project. It holds useful functions and macros
|
||||||
developed by both [Finit][1] and the [OpenBSD][2] project. Most notably
|
developed by both [Finit][1] and the [OpenBSD][2] project. Most notably
|
||||||
the string functions: [strlcpy(3)][3], [strlcat(3)][3] and the highly
|
the string functions: [strlcpy(3)][3], [strlcat(3)][3] and the highly
|
||||||
useful *BSD [sys/queue.h][4] and [sys/tree.h][7] API's.
|
useful *BSD [sys/queue.h][4] and [sys/tree.h][7] API's.
|
||||||
|
|
||||||
Libite is the frog DNA missing in GNU libc. However, -lite does not aim
|
Libite holds many of the missing pieces in GNU libc, although -lite does
|
||||||
to become another [GLIB][5]! One noticeable gap in GLIBC is the missing
|
not aim to become another [GLIB][5]. One noticeable gap in GLIBC is the
|
||||||
`_SAFE` macros in the BSD `sys/queue.h` API — highly recommended
|
`_SAFE` macros available in the BSD `sys/queue.h` API — highly
|
||||||
when traversing lists to delete/free nodes.
|
recommended when traversing lists to delete/free nodes.
|
||||||
|
|
||||||
The code is open sourced under a mix of the [MIT/X11 license][MIT], the
|
The code is open sourced under a mix of permissive Open Source licenses:
|
||||||
[ISC license][ISC] used by OpenBSD, and [BSD licenses][BSD], all of them
|
[MIT/X11 license][MIT], [ISC license][ISC], and [BSD licenses][BSD].
|
||||||
are extremely liberal and can be used freely in proprietary software if
|
|
||||||
needed.
|
|
||||||
|
|
||||||
For an introduction to why Libite happened, and how you can use it, see
|
|
||||||
[this blog post][6].
|
|
||||||
|
|
||||||
|
|
||||||
Using -lite
|
Using -lite
|
||||||
@@ -186,6 +180,22 @@ Generic Functions
|
|||||||
|
|
||||||
Check for the existence of a directory, returns True(1) or False(0).
|
Check for the existence of a directory, returns True(1) or False(0).
|
||||||
|
|
||||||
|
- `fopenf(mode, fmt, ...)`
|
||||||
|
|
||||||
|
Like `fopen()`, but takes a formatted string as argument. This
|
||||||
|
greatly simplifies operations that usually consist of composing a
|
||||||
|
filename from parts into a dynamic buffer before actually opening
|
||||||
|
the file.
|
||||||
|
|
||||||
|
> **Notice:** the swapped order of `pathname` and `mode`!
|
||||||
|
|
||||||
|
- `fremove(fmt, ...)`
|
||||||
|
|
||||||
|
Like `remove()`, but takes a formatted string as argument. This
|
||||||
|
greatly simplifies operations that usually consist of composing a
|
||||||
|
filename from parts into a dynamic buffer before actually removing
|
||||||
|
the file.
|
||||||
|
|
||||||
- `fsendfile(src, dst, len)`
|
- `fsendfile(src, dst, len)`
|
||||||
|
|
||||||
Copy data between file streams, very similar to `fcopyfile()`, but
|
Copy data between file streams, very similar to `fcopyfile()`, but
|
||||||
@@ -228,6 +238,12 @@ Generic Functions
|
|||||||
|
|
||||||
Like `makepath()`, but also takes a `mode_t` permission mode argument.
|
Like `makepath()`, but also takes a `mode_t` permission mode argument.
|
||||||
|
|
||||||
|
- `fmkpath(mode, fmt, ...)`
|
||||||
|
|
||||||
|
Like `mkpath()`, but takes a formatted string as argument.
|
||||||
|
|
||||||
|
> **Notice:** the swapped order of `pathname` and `mode`!
|
||||||
|
|
||||||
- `movefile(src, dst)`
|
- `movefile(src, dst)`
|
||||||
|
|
||||||
Like `copyfile()`, but renames `src` to `dst`, or recreates symlink
|
Like `copyfile()`, but renames `src` to `dst`, or recreates symlink
|
||||||
@@ -289,6 +305,27 @@ Generic Functions
|
|||||||
`delete`, it is now called `opt`. The APIs are 100% compatible if the
|
`delete`, it is now called `opt`. The APIs are 100% compatible if the
|
||||||
value `1` was used.
|
value `1` was used.
|
||||||
|
|
||||||
|
- `strmatch(str, list)`, `strnmatch(str, list, len)`
|
||||||
|
|
||||||
|
Find matching string in an array of strings. Returns index in array on
|
||||||
|
match, or `-1` on error or not found. `strnmatch()` takes an extra arg
|
||||||
|
to compare only `len` number of characters from `str`.
|
||||||
|
|
||||||
|
- `systemf(fmt, ...)`
|
||||||
|
|
||||||
|
Like `system()`, but takes a formatted string as argument. This
|
||||||
|
greatly simplifies operations that usually consist of composing a
|
||||||
|
command from parts into a dynamic buffer before calling it.
|
||||||
|
|
||||||
|
- `telnet_open(addr, port), telnet_close(ctx), telnet_expect(ctx, script, output)`
|
||||||
|
|
||||||
|
Poor mans telnet expect in C. Opens connection to a Telnet service;
|
||||||
|
FTP, Telnet, similar, and run an expect-like script.
|
||||||
|
|
||||||
|
- `telnet_session(addr, port, script output)`
|
||||||
|
|
||||||
|
Wrapper for the above three in one API.
|
||||||
|
|
||||||
- `tempfile()`
|
- `tempfile()`
|
||||||
|
|
||||||
Secure replacement for `tmpfile()`. Creates an invisible temporary
|
Secure replacement for `tmpfile()`. Creates an invisible temporary
|
||||||
@@ -298,6 +335,13 @@ Generic Functions
|
|||||||
**Note:** Requires Linux v3.11, or later, will fall back to the old
|
**Note:** Requires Linux v3.11, or later, will fall back to the old
|
||||||
and unsafe `tmpfile()` on older systems.
|
and unsafe `tmpfile()` on older systems.
|
||||||
|
|
||||||
|
- `truncatef(length, fmt, ...)`
|
||||||
|
|
||||||
|
Like `truncate()`, but takes a formatted string as argument. This
|
||||||
|
simplifies some operations when the filename otherwise have to be
|
||||||
|
composed from parts into a separate array before calling the real
|
||||||
|
function.
|
||||||
|
|
||||||
- `which(cmd)`, `whichp(cmd)`
|
- `which(cmd)`, `whichp(cmd)`
|
||||||
|
|
||||||
C implementation of UNIX which(1). Returns a malloc'ed string with the
|
C implementation of UNIX which(1). Returns a malloc'ed string with the
|
||||||
@@ -308,6 +352,11 @@ Generic Functions
|
|||||||
**Note:** `which("/bin/ps aux")` will return `/bin/ps`, or `TRUE`,
|
**Note:** `which("/bin/ps aux")` will return `/bin/ps`, or `TRUE`,
|
||||||
provided of course `/bin/ps` exists.
|
provided of course `/bin/ps` exists.
|
||||||
|
|
||||||
|
- `yorn(fmt, ...)`
|
||||||
|
|
||||||
|
Pose a question to user, appended with `(y/N)?`, returns `TRUE` for
|
||||||
|
yes (both `y` and `Y` are handled) and `FALSE` for everything else.
|
||||||
|
|
||||||
|
|
||||||
GNU Functions
|
GNU Functions
|
||||||
-------------
|
-------------
|
||||||
@@ -383,40 +432,38 @@ Build & Install
|
|||||||
|
|
||||||
This library was initially built for and developed on GNU/Linux systems
|
This library was initially built for and developed on GNU/Linux systems
|
||||||
as a light weight utility library, these days NetBSD should also work.
|
as a light weight utility library, these days NetBSD should also work.
|
||||||
Libite (LITE) employs the de facto standard GNU configure and build
|
|
||||||
system:
|
|
||||||
|
|
||||||
./configure
|
./configure
|
||||||
make -j5
|
make -j5
|
||||||
sudo make install-strip
|
sudo make install-strip
|
||||||
sudo ldconfig
|
sudo ldconfig
|
||||||
|
|
||||||
**Note:** When checking code from GitHub, use <kbd>./autogen.sh</kbd> to
|
**Note:** When checking out code from GIT, use <kbd>./autogen.sh</kbd>
|
||||||
generate a `configure` script. It is a generated file and otherwise only
|
to generate a `configure` script. It is a generated file and otherwise
|
||||||
included in released tarballs.
|
only included in released tarballs.
|
||||||
|
|
||||||
|
Origin & References
|
||||||
|
-------------------
|
||||||
|
|
||||||
TODO
|
Much of the code in libite (-lite) is written by [Claudio Matsuoka][]
|
||||||
----
|
for [Finit][original finit] and released under the MIT/X11 license.
|
||||||
|
Joachim Nilsson later improved on the [Finit][] code base and included
|
||||||
- Improve documentation, possibly use kdoc or gdoc2 to generate docs from API.
|
pieces of software released under the ISC and BSD licenses. See each
|
||||||
- Continuously, update OpenBSD functions/macros.
|
respective file for license details.
|
||||||
|
|
||||||
[1]: https://github.com/troglobit/finit
|
[1]: https://github.com/troglobit/finit
|
||||||
[2]: http://www.openbsd.org/
|
[2]: http://www.openbsd.org/
|
||||||
[3]: http://www.openbsd.org/cgi-bin/man.cgi?query=strlcpy
|
[3]: http://www.openbsd.org/cgi-bin/man.cgi?query=strlcpy
|
||||||
[4]: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/LIST_EMPTY.3
|
[4]: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/LIST_EMPTY.3
|
||||||
[5]: https://developer.gnome.org/glib/
|
[5]: https://developer.gnome.org/glib/
|
||||||
[6]: http://troglobit.com/blog/2015/07/02/howto-using-lite-with-a-git-based-application/
|
|
||||||
[7]: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/SPLAY_FOREACH.3
|
[7]: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/SPLAY_FOREACH.3
|
||||||
[MIT]: https://en.wikipedia.org/wiki/MIT_License
|
[MIT]: https://en.wikipedia.org/wiki/MIT_License
|
||||||
[ISC]: https://en.wikipedia.org/wiki/ISC_license
|
[ISC]: https://en.wikipedia.org/wiki/ISC_license
|
||||||
[BSD]: https://en.wikipedia.org/wiki/BSD_licenses
|
[BSD]: https://en.wikipedia.org/wiki/BSD_licenses
|
||||||
[Travis]: https://travis-ci.org/troglobit/libite
|
[Travis]: https://travis-ci.org/troglobit/libite
|
||||||
[Travis Status]: https://travis-ci.org/troglobit/libite.png?branch=master
|
[Travis Status]: https://travis-ci.org/troglobit/libite.png?branch=master
|
||||||
|
[Coverity Scan]: https://scan.coverity.com/projects/20602
|
||||||
<!--
|
[Coverity Status]: https://img.shields.io/coverity/scan/20602.svg
|
||||||
-- Local Variables:
|
[Claudio Matsuoka]: https://github.com/cmatsuoka
|
||||||
-- mode: markdown
|
[original finit]: http://helllabs.org/finit/
|
||||||
-- End:
|
[Finit]: https://github.com/troglobit/finit
|
||||||
-->
|
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
TODO ... in no particular order
|
TODO ... in no particular order
|
||||||
===============================
|
===============================
|
||||||
|
|
||||||
|
* Improve documentation, possibly use kdoc or gdoc2 to generate docs from API
|
||||||
|
* Continuously, update OpenBSD functions/macros
|
||||||
* Investigate adding FreeBSD pidfile_open() et al
|
* Investigate adding FreeBSD pidfile_open() et al
|
||||||
* Investigate FreeBSD libutil library, could be useful for porting between unices
|
* Investigate FreeBSD libutil library, could be useful for porting between unices
|
||||||
|
|
||||||
|
|
||||||
+5
-3
@@ -1,5 +1,6 @@
|
|||||||
AC_INIT(libite, 2.0.0, https://github.com/troglobit/libite/issues)
|
AC_INIT(libite, 2.3.0, https://github.com/troglobit/libite/issues)
|
||||||
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
|
AC_CONFIG_AUX_DIR(aux)
|
||||||
|
AM_INIT_AUTOMAKE([1.11 foreign dist-xz])
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
|
|
||||||
AC_CONFIG_SRCDIR(src/lite.h)
|
AC_CONFIG_SRCDIR(src/lite.h)
|
||||||
@@ -8,7 +9,8 @@ AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile libite.pc])
|
|||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AM_PROG_AR
|
AC_PROG_INSTALL
|
||||||
|
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||||
LT_INIT
|
LT_INIT
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
+6
-2
@@ -1,6 +1,10 @@
|
|||||||
|
*.log
|
||||||
|
*.substvars
|
||||||
|
.debhelper/*
|
||||||
tmp/*
|
tmp/*
|
||||||
libuev/*
|
libite/*
|
||||||
libuev*
|
libite5/*
|
||||||
|
libite-dev/*
|
||||||
autoreconf*
|
autoreconf*
|
||||||
debhelper*
|
debhelper*
|
||||||
files
|
files
|
||||||
|
|||||||
Vendored
+64
@@ -1,3 +1,67 @@
|
|||||||
|
libite (2.3.0) stable; urgency=medium
|
||||||
|
|
||||||
|
* New functions:
|
||||||
|
- Add support for fremove(), formatted remove() replacement
|
||||||
|
- Add support for truncatef(), formatted truncate() replacement
|
||||||
|
* Fixes
|
||||||
|
- Handle ETIMEDOUT error for connect() call in telnet_open()
|
||||||
|
|
||||||
|
-- Joachim Wiberg <troglobit@gmail.com> Fri, 12 Feb 2021 08:03:47 +0100
|
||||||
|
|
||||||
|
libite (2.2.0) stable; urgency=medium
|
||||||
|
|
||||||
|
* New functions:
|
||||||
|
- systemf(), formatted string system() replacement
|
||||||
|
- fmkpath(), formatted string mkpath() replacement
|
||||||
|
- fopenf(), formatted string fopen() replacement
|
||||||
|
* Fixes
|
||||||
|
- possible memory leak in rsync()
|
||||||
|
- Check return value of fstat() to prevent bogus destination file
|
||||||
|
times when using copyfile()
|
||||||
|
|
||||||
|
-- Joachim Nilsson <troglobit@gmail.com> Mon, 16 Mar 2020 15:42:02 +0100
|
||||||
|
|
||||||
|
libite (2.1.2) stable; urgency=high
|
||||||
|
|
||||||
|
* Fix upgrade of base package, new library name to match SONAME
|
||||||
|
breaks upgrade from libite_2.0.x.deb to libite5_2.1.x.deb
|
||||||
|
|
||||||
|
-- Joachim Nilsson <troglobit@gmail.com> Sat, 22 Feb 2020 15:04:27 +0100
|
||||||
|
|
||||||
|
libite (2.1.1) stable; urgency=medium
|
||||||
|
|
||||||
|
* Fix to chomp(), ensure stopping before beginning of string
|
||||||
|
* Added example of printhdr()
|
||||||
|
* Update copyright years
|
||||||
|
* Add missing libite5.symbols file, found by lintian
|
||||||
|
* Fix package short description, found by linitian
|
||||||
|
|
||||||
|
-- Joachim Nilsson <troglobit@gmail.com> Sat, 22 Feb 2020 13:52:24 +0100
|
||||||
|
|
||||||
|
libite (2.1.0) unstable; urgency=medium
|
||||||
|
|
||||||
|
* New functions; strmatch(), strnmatch(), yorn(), telnet expect APIs
|
||||||
|
* Fixes to pidfile_signal(), strtonum() and C++ linking
|
||||||
|
|
||||||
|
-- Joachim Nilsson <troglobit@gmail.com> Mon, 26 Aug 2019 20:21:46 +0200
|
||||||
|
|
||||||
|
libite (2.0.2) unstable; urgency=medium
|
||||||
|
|
||||||
|
* Fix issues with using `strlite.h` standalone
|
||||||
|
* Fix build issue with `strtonum.c` older GLIBC
|
||||||
|
|
||||||
|
-- Joachim Nilsson <troglobit@gmail.com> Thu, 10 May 2018 19:12:57 +0200
|
||||||
|
|
||||||
|
libite (2.0.1-1) unstable; urgency=medium
|
||||||
|
|
||||||
|
* New upstream release, v2.0.1, fixes to:
|
||||||
|
- touch(), cannot handle relative paths when updating mtime
|
||||||
|
- unit test for which()
|
||||||
|
- add missing initscr() declaration in conio.h
|
||||||
|
- ifdef guards around min()/max() macros
|
||||||
|
|
||||||
|
-- Joachim Nilsson <troglobit@gmail.com> Fri, 22 Dec 2017 12:11:41 +0100
|
||||||
|
|
||||||
libite (2.0.0-1) unstable; urgency=low
|
libite (2.0.0-1) unstable; urgency=low
|
||||||
|
|
||||||
* New upstream release, v2.0.0, fixes to:
|
* New upstream release, v2.0.0, fixes to:
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
9
|
10
|
||||||
Vendored
+25
-21
@@ -1,29 +1,29 @@
|
|||||||
Source: libite
|
Source: libite
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Joachim Nilsson <troglobit@gmail.com>
|
Maintainer: Joachim Nilsson <troglobit@gmail.com>
|
||||||
Build-Depends: dpkg-dev (>= 1.14.9), debhelper (>= 9), dh-autoreconf
|
Build-Depends: debhelper (>= 10), libtool
|
||||||
Standards-Version: 3.9.6
|
Standards-Version: 4.3.0
|
||||||
Section: libs
|
Section: libs
|
||||||
Homepage: https://github.com/troglobit/libite/
|
Homepage: https://github.com/troglobit/libite/
|
||||||
Vcs-Git: https://github.com/troglobit/libite.git
|
Vcs-Git: https://github.com/troglobit/libite.git
|
||||||
Vcs-Browser: https://github.com/troglobit/libite/
|
Vcs-Browser: https://github.com/troglobit/libite/
|
||||||
|
|
||||||
Package: libite-dev
|
Package: libite-dev
|
||||||
Priority: extra
|
Priority: optional
|
||||||
Section: libdevel
|
Section: libdevel
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ${misc:Depends}, libite (= ${binary:Version})
|
Depends: ${misc:Depends}, libite5 (= ${binary:Version})
|
||||||
Description: static library, header files, and docs for libite
|
Description: static library, header files, and docs for libite
|
||||||
Static library, header files, and documentation for libite.
|
Static library, header files, and documentation for libite.
|
||||||
.
|
.
|
||||||
Libite is a lightweight library of frog DNA. It can be used to fill the
|
Libite is a lightweight library of frog DNA. It can be used to fill
|
||||||
gaps in any dinosaur project. It holds useful functions and macros
|
the gaps in any dinosaur project. It holds useful functions and macros
|
||||||
developed by both Finit and the OpenBSD project. Most notably the
|
developed by both Finit and the OpenBSD project. Most notably the
|
||||||
string functions: strlcpy(3), strlcat(3) and the highly useful *BSD
|
string functions: strlcpy(3), strlcat(3) and the highly useful *BSD
|
||||||
sys/queue.h and sys/tree.h API's.
|
sys/queue.h and sys/tree.h API's.
|
||||||
.
|
.
|
||||||
Libite is the frog DNA missing in GNU libc. However, -lite does not aim
|
Libite is the frog DNA missing in GNU libc. However, -lite does not
|
||||||
to become another GLIB! One noticeable gap in GLIBC is the missing
|
aim to become another GLIB! One noticeable gap in GLIBC is the missing
|
||||||
_SAFE macros in the BSD sys/queue.h API — highly recommended when
|
_SAFE macros in the BSD sys/queue.h API — highly recommended when
|
||||||
traversing lists to delete/free nodes.
|
traversing lists to delete/free nodes.
|
||||||
.
|
.
|
||||||
@@ -31,21 +31,25 @@ Description: static library, header files, and docs for libite
|
|||||||
license used by OpenBSD, and BSD licenses, all of them are extremely
|
license used by OpenBSD, and BSD licenses, all of them are extremely
|
||||||
liberal and can be used freely in proprietary software if needed.
|
liberal and can be used freely in proprietary software if needed.
|
||||||
|
|
||||||
Package: libite
|
Package: libite5
|
||||||
|
Replaces: libite
|
||||||
|
Conflicts: libite
|
||||||
|
Provides: libite
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||||
Description: That missing frog DNA you've been looking for. MIT/X11/ISC/BSD License.
|
Description: That missing frog DNA you've been looking for
|
||||||
Libite is a lightweight library of frog DNA. It can be used to fill the
|
Libite, or -lite, is a lightweight library of frog DNA. It can be used
|
||||||
gaps in any dinosaur project. It holds useful functions and macros
|
to fill the gaps in any dinosaur project. It holds useful functions
|
||||||
developed by both Finit and the OpenBSD project. Most notably the
|
and macros developed by both Finit and the OpenBSD project. Most
|
||||||
string functions: strlcpy(3), strlcat(3) and the highly useful *BSD
|
notably the string functions: strlcpy(3), strlcat(3) and the highly
|
||||||
sys/queue.h and sys/tree.h API's.
|
useful *BSD sys/queue.h and sys/tree.h API's.
|
||||||
.
|
.
|
||||||
Libite is the frog DNA missing in GNU libc. However, -lite does not aim
|
Libite is the frog DNA missing in GNU libc. However, -lite does not
|
||||||
to become another GLIB! One noticeable gap in GLIBC is the missing
|
aim to become another GLIB! One noticeable gap in GLIBC is the missing
|
||||||
_SAFE macros in the BSD sys/queue.h API — highly recommended when
|
_SAFE macros in the BSD sys/queue.h API — highly recommended when
|
||||||
traversing lists to delete/free nodes.
|
traversing lists to delete/free nodes.
|
||||||
.
|
.
|
||||||
The code is open sourced under a mix of the MIT/X11 license, the ISC
|
The code is open source software under a mix of the MIT/X11 license,
|
||||||
license used by OpenBSD, and BSD licenses, all of them are extremely
|
the ISC license used by OpenBSD, and BSD licenses, all of them are
|
||||||
liberal and can be used freely in proprietary software if needed.
|
extremely liberal and can be used freely in proprietary software if
|
||||||
|
needed.
|
||||||
Vendored
+24
-12
@@ -4,7 +4,7 @@ Source: https.//github.com/troglobit/libite/
|
|||||||
Files: *
|
Files: *
|
||||||
Copyright:
|
Copyright:
|
||||||
2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
2008-2016 Joachim Nilsson <troglobit@gmail.com>
|
2008-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
License: MIT
|
License: MIT
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -25,19 +25,19 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
|
|
||||||
Files: chomp.c
|
Files: chomp.c
|
||||||
Copyright: 2014-2015 Joachim Nilsson <troglobit@gmail.com>
|
Copyright: 2014-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
License: ISC
|
License: ISC
|
||||||
|
|
||||||
Files: conio.h
|
Files: conio.h
|
||||||
Copyright: 2009-2013 Joachim Nilsson <troglobit@gmail.com>
|
Copyright: 2009-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
License: ISC
|
License: ISC
|
||||||
|
|
||||||
Files: dir.c
|
Files: dir.c
|
||||||
Copyright: 2008-2016 Joachim Nilsson <troglobit@gmail.com>
|
Copyright: 2008-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
License: ISC
|
License: ISC
|
||||||
|
|
||||||
Files: lfile.c
|
Files: lfile.c
|
||||||
Copyright: 2015-2016 Joachim Nilsson <troglobit@gmail.com>
|
Copyright: 2015-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
License: ISC
|
License: ISC
|
||||||
|
|
||||||
Files: pidfile.c
|
Files: pidfile.c
|
||||||
@@ -53,7 +53,7 @@ Copyright: 2008 Otto Moerbeek <otto@drijf.net>
|
|||||||
License: ISC
|
License: ISC
|
||||||
|
|
||||||
Files: rsync.c
|
Files: rsync.c
|
||||||
Copyright: 2011, 2012 Joachim Nilsson <troglobit@gmail.com>
|
Copyright: 2011-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
License: ISC
|
License: ISC
|
||||||
|
|
||||||
Files: strdupa.h strndupa.h
|
Files: strdupa.h strndupa.h
|
||||||
@@ -61,23 +61,35 @@ Copyright: 2009 William Ahern
|
|||||||
License: MIT
|
License: MIT
|
||||||
|
|
||||||
Files: strlcat.c strlcpy.c
|
Files: strlcat.c strlcpy.c
|
||||||
Copyright: 998, 2015 Todd C. Miller <Todd.Miller@courtesan.com>
|
Copyright: 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||||
License: MIT
|
License: MIT
|
||||||
|
|
||||||
|
Files: strmatch.c
|
||||||
|
Copyright: 2009-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
|
License: ISC
|
||||||
|
|
||||||
Files: strnlen.c
|
Files: strnlen.c
|
||||||
Copyright: 2016 Joachim Nilsson <troglobit@gmail.com>
|
Copyright: 2016-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
License: ISC
|
License: ISC
|
||||||
|
|
||||||
Files: strtonum.c
|
Files: strtonum.c
|
||||||
Copyright: 2004 Ted Unangst and Todd Miller
|
Copyright: 2004 Ted Unangst and Todd Miller
|
||||||
License: ISC
|
License: ISC
|
||||||
|
|
||||||
Files: tempfile.c
|
Files: telnet.c
|
||||||
Copyright: 2015-2016 Joachim Nilsson <troglobit@gmail.com>
|
Copyright: 2010-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
License: ISC
|
License: ISC
|
||||||
|
|
||||||
Files: tree.c
|
Files: tempfile.c
|
||||||
Copyright: 2015 Joachim Nilsson <troglobit@gmail.com>
|
Copyright: 2015-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
|
License: ISC
|
||||||
|
|
||||||
|
Files: tree.h
|
||||||
|
Copyright: 2002 Niels Provos <provos@citi.umich.edu>
|
||||||
|
License: BSD-2-clause
|
||||||
|
|
||||||
|
Files: yorn.c
|
||||||
|
Copyright: 2009-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
License: ISC
|
License: ISC
|
||||||
|
|
||||||
Files: tests/*.c
|
Files: tests/*.c
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
Vendored
+50
@@ -0,0 +1,50 @@
|
|||||||
|
libite.so.5 libite5 #MINVER#
|
||||||
|
* Build-Depends-Package: libite-dev
|
||||||
|
__pidfile_name@Base 2.0.0
|
||||||
|
__pidfile_path@Base 2.0.0
|
||||||
|
chomp@Base 2.0.0
|
||||||
|
copyfile@Base 2.0.0
|
||||||
|
dir@Base 2.0.0
|
||||||
|
fcopyfile@Base 2.0.0
|
||||||
|
fexist@Base 2.0.0
|
||||||
|
fgetint@Base 2.0.0
|
||||||
|
fisdir@Base 2.0.0
|
||||||
|
fmkpath@Base 2.2.0
|
||||||
|
fopenf@Base 2.2.0
|
||||||
|
fparseln@Base 2.0.0
|
||||||
|
fremove@Base 2.3.0
|
||||||
|
fsendfile@Base 2.0.0
|
||||||
|
ifconfig@Base 2.0.0
|
||||||
|
initscr@Base 2.0.0
|
||||||
|
lfclose@Base 2.0.0
|
||||||
|
lfgetint@Base 2.0.0
|
||||||
|
lfgetkey@Base 2.0.0
|
||||||
|
lfopen@Base 2.0.0
|
||||||
|
lftok@Base 2.0.0
|
||||||
|
makepath@Base 2.0.0
|
||||||
|
mkpath@Base 2.0.0
|
||||||
|
movefile@Base 2.0.0
|
||||||
|
pidfile@Base 2.0.0
|
||||||
|
pidfile_poll@Base 2.0.0
|
||||||
|
pidfile_read@Base 2.0.0
|
||||||
|
pidfile_signal@Base 2.1.0
|
||||||
|
progress@Base 2.0.0
|
||||||
|
progress_simple@Base 2.0.0
|
||||||
|
reallocarray@Base 2.0.0
|
||||||
|
rsync@Base 2.0.0
|
||||||
|
sdbuf@Base 2.0.0
|
||||||
|
strlcat@Base 2.0.0
|
||||||
|
strlcpy@Base 2.0.0
|
||||||
|
strmatch@Base 2.1.0
|
||||||
|
strnmatch@Base 2.1.0
|
||||||
|
strtonum@Base 2.1.0
|
||||||
|
systemf@Base 2.2.0
|
||||||
|
telnet_close@Base 2.1.0
|
||||||
|
telnet_expect@Base 2.1.0
|
||||||
|
telnet_open@Base 2.1.0
|
||||||
|
telnet_session@Base 2.1.0
|
||||||
|
tempfile@Base 2.0.0
|
||||||
|
truncatef@Base 2.3.0
|
||||||
|
which@Base 2.0.0
|
||||||
|
whichp@Base 2.0.0
|
||||||
|
yorn@Base 2.1.0
|
||||||
Vendored
+7
-1
@@ -1,8 +1,14 @@
|
|||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
# Uncomment this to turn on verbose mode.
|
# Uncomment this to turn on verbose mode.
|
||||||
#export DH_VERBOSE=1
|
#export DH_VERBOSE=1
|
||||||
|
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@ --with autoreconf
|
dh $@ --with autoreconf
|
||||||
|
|
||||||
|
override_dh_installchangelogs:
|
||||||
|
dh_installchangelogs ChangeLog.md
|
||||||
|
|
||||||
|
override_dh_auto_install:
|
||||||
|
dh_auto_install
|
||||||
|
find debian -name LICENSE -delete
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
compression=xz
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
*.la
|
||||||
|
.libs/*
|
||||||
|
libite_la*
|
||||||
+7
-4
@@ -2,10 +2,10 @@ lib_LTLIBRARIES = libite.la
|
|||||||
|
|
||||||
libite_la_CPPFLAGS = -D_GNU_SOURCE
|
libite_la_CPPFLAGS = -D_GNU_SOURCE
|
||||||
libite_la_CFLAGS = -W -Wall -Wextra
|
libite_la_CFLAGS = -W -Wall -Wextra
|
||||||
libite_la_LDFLAGS = $(AM_LDFLAGS) -version-info 5:0:0
|
libite_la_LDFLAGS = $(AM_LDFLAGS) -version-info 7:0:2
|
||||||
libite_la_SOURCES = chomp.c copyfile.c \
|
libite_la_SOURCES = chomp.c copyfile.c \
|
||||||
conio.c conio.h \
|
conio.c conio.h \
|
||||||
dir.c \
|
dir.c fopenf.c fremove.c \
|
||||||
fexist.c fisdir.c \
|
fexist.c fisdir.c \
|
||||||
fparseln.c fsendfile.c \
|
fparseln.c fsendfile.c \
|
||||||
ifconfig.c lfile.c \
|
ifconfig.c lfile.c \
|
||||||
@@ -14,11 +14,14 @@ libite_la_SOURCES = chomp.c copyfile.c \
|
|||||||
reallocarray.c rsync.c \
|
reallocarray.c rsync.c \
|
||||||
strlcpy.c strlcat.c strtonum.c \
|
strlcpy.c strlcat.c strtonum.c \
|
||||||
strdupa.h strndupa.h strnlen.h \
|
strdupa.h strndupa.h strnlen.h \
|
||||||
tempfile.c which.c \
|
strmatch.c systemf.c \
|
||||||
|
telnet.c tempfile.c truncatef.c \
|
||||||
|
yorn.c which.c \
|
||||||
lite.h strlite.h \
|
lite.h strlite.h \
|
||||||
queue.h tree.h
|
queue.h tree.h
|
||||||
|
|
||||||
|
|
||||||
## Distribute these header files in the <lite/...> name space
|
## Distribute these header files in the <lite/...> name space
|
||||||
pkgincludedir = $(includedir)/lite
|
pkgincludedir = $(includedir)/lite
|
||||||
pkginclude_HEADERS = lite.h queue.h conio.h tree.h strlite.h strdupa.h strndupa.h strnlen.h
|
pkginclude_HEADERS = lite.h queue.h conio.h tree.h strlite.h strdupa.h \
|
||||||
|
strndupa.h strnlen.h
|
||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
/* Perl inspired chomp() implementation.
|
/* Perl inspired chomp() implementation.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2015 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2014-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
* @str: String to chomp
|
* @str: String to chomp
|
||||||
*
|
*
|
||||||
* This function is like Perl chomp, but it's set to chop of all
|
* This function is like Perl chomp, but it's set to chop of all
|
||||||
* trailing newlines.
|
* trailing newlines. Useful in combination with fgets().
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* If @str is a valid pointer this function returns @str, otherwise
|
* If @str is a valid pointer this function returns @str, otherwise
|
||||||
@@ -39,7 +39,7 @@ char *chomp(char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
p = str + strlen(str) - 1;
|
p = str + strlen(str) - 1;
|
||||||
while (*p == '\n')
|
while (p >= str && *p == '\n')
|
||||||
*p-- = 0;
|
*p-- = 0;
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* A conio.h like implementation for VTANSI displays.
|
/* A conio.h like implementation for VTANSI displays.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2009-2017 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2009-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
|||||||
+30
-6
@@ -1,6 +1,6 @@
|
|||||||
/* A conio.h like implementation for VTANSI displays.
|
/* A conio.h like implementation for VTANSI displays.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2009-2017 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2009-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@@ -15,6 +15,11 @@
|
|||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CONIO_H_
|
#ifndef CONIO_H_
|
||||||
#define CONIO_H_
|
#define CONIO_H_
|
||||||
|
|
||||||
@@ -75,17 +80,36 @@
|
|||||||
#define textcolor(color) __set_gm(RESETATTR, color, 30)
|
#define textcolor(color) __set_gm(RESETATTR, color, 30)
|
||||||
#define textbackground(color) __set_gm(RESETATTR, color, 40)
|
#define textbackground(color) __set_gm(RESETATTR, color, 40)
|
||||||
|
|
||||||
/* Print table heading @line to @fp, with optional leading newline */
|
void initscr(int *row, int *col);
|
||||||
|
|
||||||
|
/* Print table heading @line to @fp, with optional leading newline
|
||||||
|
* Example:
|
||||||
|
* _________________ <-- Empty line with UNDERSCORE to frame first heading
|
||||||
|
* First heading <-- In normal/RESETATTR
|
||||||
|
* SUBHEADING <-- In REVERSE and with capital letters like 'top'
|
||||||
|
*/
|
||||||
|
static inline void printhdr(FILE *fp, const char *line, int nl, int attr)
|
||||||
|
{
|
||||||
|
if (attr < 0 || attr > 8)
|
||||||
|
attr = REVERSE;
|
||||||
|
|
||||||
|
fprintf(fp ?: stdout,
|
||||||
|
"%s\033[%dm%s%*s\033[0m\n",
|
||||||
|
nl ? "\n" : "", attr, line,
|
||||||
|
SCREEN_WIDTH - (int)strlen(line), "");
|
||||||
|
}
|
||||||
|
|
||||||
static inline void printheader(FILE *fp, const char *line, int nl)
|
static inline void printheader(FILE *fp, const char *line, int nl)
|
||||||
{
|
{
|
||||||
fprintf(fp ?: stdout,
|
printhdr(fp, line, nl, REVERSE);
|
||||||
"%s\033[7m%s%*s\033[0m\n",
|
|
||||||
nl ? "\n" : "",
|
|
||||||
line, SCREEN_WIDTH - (int)strlen(line), "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONIO_H_ */
|
#endif /* CONIO_H_ */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
* indent-tabs-mode: t
|
* indent-tabs-mode: t
|
||||||
|
|||||||
+17
-14
@@ -27,7 +27,7 @@
|
|||||||
#include "lite.h"
|
#include "lite.h"
|
||||||
|
|
||||||
/* Tests if dst is a directory, if so, reallocates dst and appends src filename returning 1 */
|
/* Tests if dst is a directory, if so, reallocates dst and appends src filename returning 1 */
|
||||||
static int adjust_target(char *src, char **dst)
|
static int adjust_target(const char *src, char **dst)
|
||||||
{
|
{
|
||||||
int isdir = 0;
|
int isdir = 0;
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ static int adjust_target(char *src, char **dst)
|
|||||||
char *tmp, *ptr = strrchr(src, '/');
|
char *tmp, *ptr = strrchr(src, '/');
|
||||||
|
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
ptr = src;
|
ptr = (char *)src;
|
||||||
else
|
else
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
@@ -85,7 +85,9 @@ static void set_mtime(int in, int out)
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
struct timespec tv[2];
|
struct timespec tv[2];
|
||||||
|
|
||||||
fstat(in, &st);
|
if (fstat(in, &st))
|
||||||
|
return;
|
||||||
|
|
||||||
tv[0] = st.st_atim;
|
tv[0] = st.st_atim;
|
||||||
tv[1] = st.st_mtim;
|
tv[1] = st.st_mtim;
|
||||||
futimens(out, tv);
|
futimens(out, tv);
|
||||||
@@ -115,9 +117,9 @@ static void set_mtime(int in, int out)
|
|||||||
* may also indicate that @src was empty. If @src is a directory @errno
|
* may also indicate that @src was empty. If @src is a directory @errno
|
||||||
* will be set to %EISDIR since copyfile() is not recursive.
|
* will be set to %EISDIR since copyfile() is not recursive.
|
||||||
*/
|
*/
|
||||||
ssize_t copyfile(char *src, char *dst, int len, int opt)
|
ssize_t copyfile(const char *src, const char *dst, int len, int opt)
|
||||||
{
|
{
|
||||||
char *buffer;
|
char *buffer, *dest = (char *)dst;
|
||||||
int sym = (opt & LITE_FOPT_COPYFILE_SYM) != 0;
|
int sym = (opt & LITE_FOPT_COPYFILE_SYM) != 0;
|
||||||
int keep_mtim = (opt & LITE_FOPT_KEEP_MTIME) != 0;
|
int keep_mtim = (opt & LITE_FOPT_KEEP_MTIME) != 0;
|
||||||
int in, out, isdir = 0, saved_errno = 0;
|
int in, out, isdir = 0, saved_errno = 0;
|
||||||
@@ -137,7 +139,7 @@ ssize_t copyfile(char *src, char *dst, int len, int opt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check if target is a directory, then append src filename. */
|
/* Check if target is a directory, then append src filename. */
|
||||||
isdir = adjust_target(src, &dst);
|
isdir = adjust_target(src, &dest);
|
||||||
|
|
||||||
/* Check if the source file is a symlink ... */
|
/* Check if the source file is a symlink ... */
|
||||||
if (stat(src, &st)) {
|
if (stat(src, &st)) {
|
||||||
@@ -154,7 +156,7 @@ ssize_t copyfile(char *src, char *dst, int len, int opt)
|
|||||||
size = -1;
|
size = -1;
|
||||||
} else {
|
} else {
|
||||||
buffer[size] = 0;
|
buffer[size] = 0;
|
||||||
size = !symlink(buffer, dst);
|
size = !symlink(buffer, dest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +177,7 @@ ssize_t copyfile(char *src, char *dst, int len, int opt)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
out = open(dst, O_WRONLY | O_CREAT | O_TRUNC, st.st_mode);
|
out = open(dest, O_WRONLY | O_CREAT | O_TRUNC, st.st_mode);
|
||||||
if (out < 0) {
|
if (out < 0) {
|
||||||
close(in);
|
close(in);
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
@@ -194,7 +196,7 @@ ssize_t copyfile(char *src, char *dst, int len, int opt)
|
|||||||
exit:
|
exit:
|
||||||
free(buffer);
|
free(buffer);
|
||||||
if (isdir)
|
if (isdir)
|
||||||
free(dst);
|
free(dest);
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
@@ -216,17 +218,18 @@ exit:
|
|||||||
* Returns:
|
* Returns:
|
||||||
* POSIX OK(0), or non-zero with errno set.
|
* POSIX OK(0), or non-zero with errno set.
|
||||||
*/
|
*/
|
||||||
int movefile(char *src, char *dst)
|
int movefile(const char *src, const char *dst)
|
||||||
{
|
{
|
||||||
|
char *dest = (char *)dst;
|
||||||
int isdir, result = 0;
|
int isdir, result = 0;
|
||||||
|
|
||||||
/* Check if target is a directory, then append the src base filename. */
|
/* Check if target is a directory, then append the src base filename. */
|
||||||
isdir = adjust_target(src, &dst);
|
isdir = adjust_target(src, &dest);
|
||||||
|
|
||||||
if (rename(src, dst)) {
|
if (rename(src, dest)) {
|
||||||
if (errno == EXDEV) {
|
if (errno == EXDEV) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
copyfile(src, dst, 0, 1);
|
copyfile(src, dest, 0, 1);
|
||||||
if (errno)
|
if (errno)
|
||||||
result = 1;
|
result = 1;
|
||||||
else
|
else
|
||||||
@@ -237,7 +240,7 @@ int movefile(char *src, char *dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isdir)
|
if (isdir)
|
||||||
free(dst);
|
free(dest);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Functions for operating on files in directories.
|
/* Functions for operating on files in directories.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2016 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2008-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@
|
|||||||
* Returns:
|
* Returns:
|
||||||
* %TRUE(1) if the file exists, otherwise %FALSE(0).
|
* %TRUE(1) if the file exists, otherwise %FALSE(0).
|
||||||
*/
|
*/
|
||||||
int fexist(char *file)
|
int fexist(const char *file)
|
||||||
{
|
{
|
||||||
if (!file) {
|
if (!file) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
|||||||
+5
-5
@@ -25,17 +25,17 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fexist - Check if a file exists and is a directory.
|
* fisdir - Check if a path exists and is a directory.
|
||||||
* @file: File to look for, with full path.
|
* @path: Path to file or directory
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* %TRUE(1) if the file exists and is a directory, otherwise %FALSE(0).
|
* %TRUE(1) if @path exists and is a directory, otherwise %FALSE(0).
|
||||||
*/
|
*/
|
||||||
int fisdir(const char *file)
|
int fisdir(const char *path)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
if (!stat(file, &sb) && S_ISDIR(sb.st_mode))
|
if (!stat(path, &sb) && S_ISDIR(sb.st_mode))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/* Formatted fopen()
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fopenf - Open a file based on the formatted string and optional arguments
|
||||||
|
* @mode: Last argument in optional list, if omitted EINVAL
|
||||||
|
* @fmt: Formatted string to be composed into a pathname
|
||||||
|
*
|
||||||
|
* This function is an extension to the fopen() family, lessening the burden
|
||||||
|
* of first having to compose the filename from parts in a seprate buffer.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* Upon successful completion fopenf() a FILE pointer. Otherwise, NULL
|
||||||
|
* is returned and errno is set to indicate the error.
|
||||||
|
*/
|
||||||
|
FILE *fopenf(const char *mode, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
char *file;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
len = vsnprintf(NULL, 0, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
file = alloca(len + 1);
|
||||||
|
if (!file) {
|
||||||
|
errno = ENOMEM;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vsnprintf(file, len + 1, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
return fopen(file, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local Variables:
|
||||||
|
* indent-tabs-mode: t
|
||||||
|
* c-file-style: "linux"
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/* Formatted fremove()
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fremove - Remove a file based on the formatted string and optional arguments
|
||||||
|
* @fmt: Formatted string to be composed into a pathname
|
||||||
|
*
|
||||||
|
* This function is an extension to remove(), lessening the burden of
|
||||||
|
* first having to compose the filename from parts in a seprate buffer.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* Return value for remove(3).
|
||||||
|
*/
|
||||||
|
int fremove(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
char *file;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
len = vsnprintf(NULL, 0, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
file = alloca(len + 1);
|
||||||
|
if (!file) {
|
||||||
|
errno = ENOBUFS;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vsnprintf(file, len + 1, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
return remove(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local Variables:
|
||||||
|
* indent-tabs-mode: t
|
||||||
|
* c-file-style: "linux"
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
+1
-1
@@ -52,7 +52,7 @@ ssize_t fsendfile(FILE *src, FILE *dst, size_t len)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = (char *)malloc(BUFSIZ);
|
buf = malloc(BUFSIZ);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
/* Fastinit (finit) ifconfig() implementation.
|
/* Fastinit (finit) ifconfig() implementation.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008 Claudio Matsuoka <http://helllabs.org/finit/>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <http://helllabs.org/finit/>
|
||||||
* Copyright (C) 2009-2014 Joachim Nilsson <joachim.nilsson@westermo.se>
|
* Copyright (C) 2009-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -43,7 +43,7 @@ extern size_t strlcpy(char *dst, const char *src, size_t siz);
|
|||||||
* Returns:
|
* Returns:
|
||||||
* POSIX OK(0) on success, or non-zero on error.
|
* POSIX OK(0) on success, or non-zero on error.
|
||||||
*/
|
*/
|
||||||
int ifconfig(char *ifname, char *addr, char *mask, int up)
|
int ifconfig(const char *ifname, const char *addr, const char *mask, int up)
|
||||||
{
|
{
|
||||||
int sd, ret = -1;
|
int sd, ret = -1;
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
|
|||||||
+16
-18
@@ -1,6 +1,6 @@
|
|||||||
/* Parse UNIX /etc configuration files like /etc/protocols and /etc/services
|
/* Parse UNIX /etc configuration files like /etc/protocols and /etc/services
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2016 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2015-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@@ -24,7 +24,8 @@
|
|||||||
typedef struct lfile {
|
typedef struct lfile {
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
char *sep, *save;
|
char *save;
|
||||||
|
const char *sep;
|
||||||
} lfile_t;
|
} lfile_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,7 +36,7 @@ typedef struct lfile {
|
|||||||
* Returns:
|
* Returns:
|
||||||
* Pointer to a &lftile_t parser context, or %NULL on error.
|
* Pointer to a &lftile_t parser context, or %NULL on error.
|
||||||
*/
|
*/
|
||||||
lfile_t *lfopen(char *file, char *sep)
|
lfile_t *lfopen(const char *file, const char *sep)
|
||||||
{
|
{
|
||||||
lfile_t *lf;
|
lfile_t *lf;
|
||||||
|
|
||||||
@@ -92,23 +93,20 @@ char *lftok(lfile_t *lf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
token = strtok_r(NULL, lf->sep, &lf->save);
|
token = strtok_r(NULL, lf->sep, &lf->save);
|
||||||
if (!token) {
|
if (token)
|
||||||
while (fgets(lf->buf, sizeof(lf->buf), lf->fp)) {
|
return token;
|
||||||
if (lf->buf[0] == '#')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
token = strtok_r(lf->buf, lf->sep, &lf->save);
|
while (fgets(lf->buf, sizeof(lf->buf), lf->fp)) {
|
||||||
if (!token)
|
if (lf->buf[0] == '#')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
token = strtok_r(lf->buf, lf->sep, &lf->save);
|
||||||
|
if (token)
|
||||||
return token;
|
return token;
|
||||||
}
|
|
||||||
|
|
||||||
errno = ENOENT;
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return token;
|
errno = ENOENT;
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -125,7 +123,7 @@ char *lftok(lfile_t *lf)
|
|||||||
* Returns:
|
* Returns:
|
||||||
* The value to @key, or %NULL if not found.
|
* The value to @key, or %NULL if not found.
|
||||||
*/
|
*/
|
||||||
char *lfgetkey(lfile_t *lf, char *key)
|
char *lfgetkey(lfile_t *lf, const char *key)
|
||||||
{
|
{
|
||||||
char *token;
|
char *token;
|
||||||
|
|
||||||
@@ -151,7 +149,7 @@ char *lfgetkey(lfile_t *lf, char *key)
|
|||||||
* Returns:
|
* Returns:
|
||||||
* The positive integer value for @key, or -1 if not found.
|
* The positive integer value for @key, or -1 if not found.
|
||||||
*/
|
*/
|
||||||
int lfgetint(lfile_t *lf, char *key)
|
int lfgetint(lfile_t *lf, const char *key)
|
||||||
{
|
{
|
||||||
char *token = lfgetkey(lf, key);
|
char *token = lfgetkey(lf, key);
|
||||||
|
|
||||||
@@ -173,7 +171,7 @@ int lfgetint(lfile_t *lf, char *key)
|
|||||||
* Returns:
|
* Returns:
|
||||||
* The positive integer value for @key, or -1 if not found.
|
* The positive integer value for @key, or -1 if not found.
|
||||||
*/
|
*/
|
||||||
int fgetint(char *file, char *sep, char *key)
|
int fgetint(const char *file, const char *sep, const char *key)
|
||||||
{
|
{
|
||||||
int val = -1;
|
int val = -1;
|
||||||
lfile_t *lf;
|
lfile_t *lf;
|
||||||
|
|||||||
+36
-12
@@ -1,7 +1,7 @@
|
|||||||
/* Collection of frog DNA
|
/* Collection of frog DNA
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2016 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2008-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -22,10 +22,16 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef LITE_H_
|
#ifndef LITE_H_
|
||||||
#define LITE_H_
|
#define LITE_H_
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <fcntl.h> /* Definition of AT_* constants for utimensat() */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h> /* uint8_t, uint16_t, uint32_t, INT32_MAX, etc. */
|
#include <stdint.h> /* uint8_t, uint16_t, uint32_t, INT32_MAX, etc. */
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -51,28 +57,33 @@
|
|||||||
#define LITE_FOPT_KEEP_MTIME 0x02
|
#define LITE_FOPT_KEEP_MTIME 0x02
|
||||||
|
|
||||||
typedef struct lfile lfile_t;
|
typedef struct lfile lfile_t;
|
||||||
|
typedef struct sdbuf sdbuf_t;
|
||||||
|
|
||||||
char *chomp (char *str);
|
char *chomp (char *str);
|
||||||
char *fparseln (FILE *, size_t *, size_t *, const char[3], int);
|
char *fparseln (FILE *, size_t *, size_t *, const char[3], int);
|
||||||
|
|
||||||
int fexist (char *file);
|
int fexist (const char *file);
|
||||||
int fisdir (const char *file);
|
int fisdir (const char *path);
|
||||||
|
|
||||||
|
FILE *fopenf (const char *mode, const char *fmt, ...);
|
||||||
|
int fremove (const char *fmt, ...);
|
||||||
FILE *tempfile (void);
|
FILE *tempfile (void);
|
||||||
ssize_t copyfile (char *src, char *dst, int len, int opt);
|
ssize_t copyfile (const char *src, const char *dst, int len, int opt);
|
||||||
int movefile (char *src, char *dst);
|
int movefile (const char *src, const char *dst);
|
||||||
int fcopyfile (FILE *src, FILE *dst);
|
int fcopyfile (FILE *src, FILE *dst);
|
||||||
ssize_t fsendfile (FILE *src, FILE *dst, size_t len);
|
ssize_t fsendfile (FILE *src, FILE *dst, size_t len);
|
||||||
|
int truncatef (off_t length, const char *fmt, ...);
|
||||||
|
|
||||||
int ifconfig (char *ifname, char *addr, char *mask, int up);
|
int ifconfig (const char *ifname, const char *addr, const char *mask, int up);
|
||||||
|
|
||||||
lfile_t*lfopen (char *file, char *sep);
|
lfile_t*lfopen (const char *file, const char *sep);
|
||||||
void lfclose (lfile_t *lf);
|
void lfclose (lfile_t *lf);
|
||||||
char *lftok (lfile_t *lf);
|
char *lftok (lfile_t *lf);
|
||||||
char *lfgetkey (lfile_t *lf, char *key);
|
char *lfgetkey (lfile_t *lf, const char *key);
|
||||||
int lfgetint (lfile_t *lf, char *key);
|
int lfgetint (lfile_t *lf, const char *key);
|
||||||
int fgetint (char *file, char *sep, char *key);
|
int fgetint (const char *file, const char *sep, const char *key);
|
||||||
|
|
||||||
|
int fmkpath (mode_t mode, const char *fmt, ...);
|
||||||
int mkpath (const char *dir, mode_t mode);
|
int mkpath (const char *dir, mode_t mode);
|
||||||
int makepath (const char *dir);
|
int makepath (const char *dir);
|
||||||
|
|
||||||
@@ -89,6 +100,15 @@ void *reallocarray(void *optr, size_t nmemb, size_t size);
|
|||||||
void progress (int percent, int max_width);
|
void progress (int percent, int max_width);
|
||||||
void progress_simple(int percent);
|
void progress_simple(int percent);
|
||||||
|
|
||||||
|
int systemf (const char *fmt, ...);
|
||||||
|
|
||||||
|
sdbuf_t*telnet_open (int addr, short port);
|
||||||
|
int telnet_close (sdbuf_t *ctx);
|
||||||
|
int telnet_expect (sdbuf_t *ctx, char *script[], FILE *output);
|
||||||
|
int telnet_session (int addr, short port, char *script[], FILE *output);
|
||||||
|
|
||||||
|
int yorn (const char *fmt, ...);
|
||||||
|
|
||||||
char *which (const char *cmd);
|
char *which (const char *cmd);
|
||||||
int whichp (const char *cmd);
|
int whichp (const char *cmd);
|
||||||
|
|
||||||
@@ -99,7 +119,7 @@ static inline int touch(const char *path)
|
|||||||
{
|
{
|
||||||
if (mknod((path), S_IFREG|0644, 0)) {
|
if (mknod((path), S_IFREG|0644, 0)) {
|
||||||
if (errno == EEXIST)
|
if (errno == EEXIST)
|
||||||
return utimensat(0, path, NULL, 0);
|
return utimensat(AT_FDCWD, path, NULL, 0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -164,7 +184,7 @@ static inline int erase(const char *path)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Does directory end with a slash? */
|
/* Does directory end with a slash? */
|
||||||
static inline int fisslashdir(char *dir)
|
static inline int fisslashdir(const char *dir)
|
||||||
{
|
{
|
||||||
if (!dir)
|
if (!dir)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -182,6 +202,10 @@ static inline int fisslashdir(char *dir)
|
|||||||
|
|
||||||
#endif /* LITE_H_ */
|
#endif /* LITE_H_ */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
* indent-tabs-mode: t
|
* indent-tabs-mode: t
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "lite.h"
|
#include "lite.h"
|
||||||
@@ -46,6 +48,40 @@ int mkpath(const char *dir, mode_t mode)
|
|||||||
return mkdir(dir, mode);
|
return mkdir(dir, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fmkpath - Formatted version of mkpath()
|
||||||
|
* @mode: A &mode_t mode to create directories with
|
||||||
|
* @fmt: Formatted string to be composed into a pathname
|
||||||
|
*
|
||||||
|
* Note:
|
||||||
|
* Notice the swapped arguments, compared to mkpath()!
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* POSIX OK(0) on success, otherwise -1 with @errno set.
|
||||||
|
*/
|
||||||
|
int fmkpath(mode_t mode, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
char *path;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
len = vsnprintf(NULL, 0, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
path = alloca(len + 1);
|
||||||
|
if (!path) {
|
||||||
|
errno = ENOMEM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
len = vsnprintf(path, len + 1, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
return mkpath(path, mode);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* makepath - Create all components of the specified directory.
|
* makepath - Create all components of the specified directory.
|
||||||
* @dir: Directory to create.
|
* @dir: Directory to create.
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
/* Functions for dealing with PID files (client side)
|
/* Functions for dealing with PID files (client side)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2009-2015 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2009-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@@ -111,10 +111,10 @@ int pidfile_signal(const char *pidfile, int signal)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
ret = kill(pid, signal);
|
ret = kill(pid, signal);
|
||||||
if ((ret == -1) || (signal == SIGTERM) || (signal == SIGKILL))
|
if (!ret && signal == SIGKILL)
|
||||||
(void)remove(pidfile);
|
ret = remove(pidfile);
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Simple termios based progress bar
|
/* Simple termios based progress bar
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2015 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2012-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
|||||||
@@ -32,6 +32,11 @@
|
|||||||
* @(#)queue.h 8.5 (Berkeley) 8/20/94
|
* @(#)queue.h 8.5 (Berkeley) 8/20/94
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _SYS_QUEUE_H_
|
#ifndef _SYS_QUEUE_H_
|
||||||
#define _SYS_QUEUE_H_
|
#define _SYS_QUEUE_H_
|
||||||
|
|
||||||
@@ -531,3 +536,7 @@ struct { \
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#endif /* !_SYS_QUEUE_H_ */
|
#endif /* !_SYS_QUEUE_H_ */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
+8
-6
@@ -1,6 +1,6 @@
|
|||||||
/* Micro "rsync" implementation.
|
/* Micro "rsync" implementation.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011, 2012 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2011-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@@ -107,20 +107,22 @@ int rsync(char *src, char *dst, int opt, int (*filter)(const char *file))
|
|||||||
snprintf(source, sizeof(source), "%s%s%s", src, fisslashdir(src) ? "" : "/", files[i]);
|
snprintf(source, sizeof(source), "%s%s%s", src, fisslashdir(src) ? "" : "/", files[i]);
|
||||||
if (fisdir(source)) {
|
if (fisdir(source)) {
|
||||||
char dst2[256];
|
char dst2[256];
|
||||||
struct stat st;
|
struct stat sb;
|
||||||
|
|
||||||
strcat(source, "/");
|
strcat(source, "/");
|
||||||
if (stat(source, &st))
|
if (stat(source, &sb)) {
|
||||||
return 1;
|
result++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (mdir(dst2, sizeof(dst2), dst, files[i], &st)) {
|
if (mdir(dst2, sizeof(dst2), dst, files[i], &sb)) {
|
||||||
result++;
|
result++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsync(source, dst2, opt, filter);
|
rsync(source, dst2, opt, filter);
|
||||||
if (keep_mtim)
|
if (keep_mtim)
|
||||||
set_mtime(dst2, &st);
|
set_mtime(dst2, &sb);
|
||||||
|
|
||||||
continue; /* Next file/dir in @src to copy... */
|
continue; /* Next file/dir in @src to copy... */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,12 @@
|
|||||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
* ==========================================================================
|
* ==========================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef LITE_STRDUPA_H
|
#ifndef LITE_STRDUPA_H
|
||||||
#define LITE_STRDUPA_H
|
#define LITE_STRDUPA_H
|
||||||
|
|
||||||
@@ -50,3 +56,7 @@
|
|||||||
#endif /* !HAVE_STRDUPA */
|
#endif /* !HAVE_STRDUPA */
|
||||||
|
|
||||||
#endif /* LITE_STRDUPA_H */
|
#endif /* LITE_STRDUPA_H */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
+33
-16
@@ -1,6 +1,6 @@
|
|||||||
/* Collection of frog DNA
|
/* Collection of frog DNA
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2016 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2008-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -21,14 +21,42 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef LITE_STRING_H_
|
#ifndef LITE_STRING_H_
|
||||||
#define LITE_STRING_H_
|
#define LITE_STRING_H_
|
||||||
|
|
||||||
|
#include <stdint.h> /* uint8_t, uint16_t, uint32_t, INT32_MAX, etc. */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/param.h> /* MAX(), isset(), setbit(), TRUE, FALSE, et consortes. :-) */
|
||||||
|
|
||||||
#include "strdupa.h"
|
#include "strdupa.h"
|
||||||
#include "strndupa.h"
|
#include "strndupa.h"
|
||||||
#include "strnlen.h"
|
#include "strnlen.h"
|
||||||
|
|
||||||
|
#ifndef min
|
||||||
|
#define min(a,b) \
|
||||||
|
({ \
|
||||||
|
__typeof__ (a) _a = (a); \
|
||||||
|
__typeof__ (b) _b = (b); \
|
||||||
|
_a < _b ? _a : _b; \
|
||||||
|
})
|
||||||
|
#endif
|
||||||
|
#ifndef max
|
||||||
|
#define max(a,b) \
|
||||||
|
({ \
|
||||||
|
__typeof__ (a) _a = (a); \
|
||||||
|
__typeof__ (b) _b = (b); \
|
||||||
|
_a > _b ? _a : _b; \
|
||||||
|
})
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int strnmatch (const char *str, const char **list, size_t num);
|
||||||
|
int strmatch (const char *str, const char **list);
|
||||||
|
|
||||||
#ifndef strlcpy
|
#ifndef strlcpy
|
||||||
size_t strlcpy (char *dst, const char *src, size_t siz);
|
size_t strlcpy (char *dst, const char *src, size_t siz);
|
||||||
#endif
|
#endif
|
||||||
@@ -82,19 +110,8 @@ static inline int string_case_compare(const char *a, const char *b)
|
|||||||
return strlen (a) == strlen (b) && !strcasecmp (a, b);
|
return strlen (a) == strlen (b) && !strcasecmp (a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define min(a,b) \
|
|
||||||
({ \
|
|
||||||
__typeof__ (a) _a = (a); \
|
|
||||||
__typeof__ (b) _b = (b); \
|
|
||||||
_a < _b ? _a : _b; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define max(a,b) \
|
|
||||||
({ \
|
|
||||||
__typeof__ (a) _a = (a); \
|
|
||||||
__typeof__ (b) _b = (b); \
|
|
||||||
_a > _b ? _a : _b; \
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* LITE_STRING_H_ */
|
#endif /* LITE_STRING_H_ */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/* Simple string matcher function, finds partial matches.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* strnmatch - Finds matching strings from a finite list
|
||||||
|
* @str: String to look for
|
||||||
|
* @list: List of strings to search.
|
||||||
|
* @num: Number of entries in @list.
|
||||||
|
*
|
||||||
|
* This function searches the @list of strings for @str. If a (partial) match
|
||||||
|
* is found it returns the index in the @list.
|
||||||
|
*
|
||||||
|
* Very similar in function to strmatch(), but works for sets of strings that
|
||||||
|
* are not %NULL terminated.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* -1 on error, otherwise the index to the matching string.
|
||||||
|
*/
|
||||||
|
int strnmatch(const char *str, const char **list, size_t num)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if (!str || !list) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < num; i++) {
|
||||||
|
if (!strncasecmp (str, list[i], strlen (str)))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
errno = ENOENT;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* strmatch - Finds matching strings from a list
|
||||||
|
* @str: String to look for
|
||||||
|
* @list: %NULL terminated list of strings to search.
|
||||||
|
*
|
||||||
|
* This function searches the @list of strings for @str. If a (partial) match
|
||||||
|
* is found it returns the index in the @list.
|
||||||
|
*
|
||||||
|
* Please note, the @list MUST be terminated by a %NULL element. If that is
|
||||||
|
* not possible for you, we recommend using strnmatch() instead.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* -1 on error, otherwise the index to the matching string.
|
||||||
|
*/
|
||||||
|
int strmatch(const char *str, const char **list)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if (!list) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; list[i]; i++)
|
||||||
|
;
|
||||||
|
|
||||||
|
return strnmatch(str, list, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local Variables:
|
||||||
|
* indent-tabs-mode: t
|
||||||
|
* c-file-style: "linux"
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
@@ -23,6 +23,12 @@
|
|||||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
* ==========================================================================
|
* ==========================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef LITE_STRNDUPA_H_
|
#ifndef LITE_STRNDUPA_H_
|
||||||
#define LITE_STRNDUPA_H_
|
#define LITE_STRNDUPA_H_
|
||||||
|
|
||||||
@@ -51,3 +57,7 @@
|
|||||||
#endif /* !HAVE_STRNDUPA */
|
#endif /* !HAVE_STRNDUPA */
|
||||||
|
|
||||||
#endif /* GNU_STRING_STRNDUPA_H */
|
#endif /* GNU_STRING_STRNDUPA_H */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
+10
-1
@@ -1,6 +1,6 @@
|
|||||||
/* strnlen.h - Re-implementation of GLIBC strnlen()
|
/* strnlen.h - Re-implementation of GLIBC strnlen()
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2016-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@@ -15,6 +15,11 @@
|
|||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef LITE_STRNLEN_H_
|
#ifndef LITE_STRNLEN_H_
|
||||||
#define LITE_STRNLEN_H_
|
#define LITE_STRNLEN_H_
|
||||||
|
|
||||||
@@ -41,3 +46,7 @@ static inline size_t xstrnlen(const char *str, size_t lim)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* LITE_STRNLEN_H_ */
|
#endif /* LITE_STRNLEN_H_ */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
+10
-1
@@ -26,6 +26,15 @@
|
|||||||
#define TOOSMALL 2
|
#define TOOSMALL 2
|
||||||
#define TOOLARGE 3
|
#define TOOLARGE 3
|
||||||
|
|
||||||
|
#ifndef LLONG_MAX
|
||||||
|
# define LLONG_MAX 0x7fffffffffffffffLL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LLONG_MIN
|
||||||
|
# define LLONG_MIN (-0x7fffffffffffffffLL - 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
long long
|
long long
|
||||||
strtonum(const char *numstr, long long minval, long long maxval,
|
strtonum(const char *numstr, long long minval, long long maxval,
|
||||||
const char **errstrp)
|
const char **errstrp)
|
||||||
@@ -49,7 +58,7 @@ strtonum(const char *numstr, long long minval, long long maxval,
|
|||||||
error = INVALID;
|
error = INVALID;
|
||||||
} else {
|
} else {
|
||||||
ll = strtoll(numstr, &ep, 10);
|
ll = strtoll(numstr, &ep, 10);
|
||||||
if (numstr == ep || *ep != '\0')
|
if (errno == EINVAL || numstr == ep || *ep != '\0')
|
||||||
error = INVALID;
|
error = INVALID;
|
||||||
else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval)
|
else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval)
|
||||||
error = TOOSMALL;
|
error = TOOSMALL;
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/* Formatted system() which returns actual return status of command
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
int systemf(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
char *cmd;
|
||||||
|
int len, status;
|
||||||
|
int rc = -1;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
len = vsnprintf(NULL, 0, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
cmd = alloca(++len);
|
||||||
|
if (!cmd) {
|
||||||
|
errno = ENOMEM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vsnprintf(cmd, len, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
status = system(cmd);
|
||||||
|
|
||||||
|
rc = WEXITSTATUS(status);
|
||||||
|
if (!WIFEXITED(status)) {
|
||||||
|
if (WIFSIGNALED(status) &&
|
||||||
|
(WTERMSIG(status) == SIGINT ||
|
||||||
|
WTERMSIG(status) == SIGQUIT)) {
|
||||||
|
errno = EINTR;
|
||||||
|
rc = -1;
|
||||||
|
} else if (!rc) {
|
||||||
|
/*
|
||||||
|
* Alert callee that command didn't complete
|
||||||
|
* successfully. Some programs don't change
|
||||||
|
* their exit code when signaled.
|
||||||
|
*/
|
||||||
|
rc = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local Variables:
|
||||||
|
* indent-tabs-mode: t
|
||||||
|
* c-file-style: "linux"
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
+298
@@ -0,0 +1,298 @@
|
|||||||
|
/* Poor mans telnet expect in C.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <poll.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
#include "lite.h"
|
||||||
|
|
||||||
|
#define EXPECT_DEBUG 0
|
||||||
|
#define EXPECT_POLL_TIMEOUT 3000 /* 3 sec timeout waiting for server. */
|
||||||
|
|
||||||
|
#if EXPECT_DEBUG
|
||||||
|
# define TELL(fmt, args...) fprintf (stderr, fmt "\n", ##args)
|
||||||
|
#else
|
||||||
|
# define TELL(fmt, args...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct sdbuf {
|
||||||
|
int sd;
|
||||||
|
char *buf;
|
||||||
|
} sdbuf;
|
||||||
|
|
||||||
|
/* Open telnet connection to @addr:@port and connect. */
|
||||||
|
sdbuf_t *telnet_open(int addr, short port)
|
||||||
|
{
|
||||||
|
struct sockaddr_in *sin;
|
||||||
|
struct sockaddr s;
|
||||||
|
sdbuf_t *ctx;
|
||||||
|
int saved;
|
||||||
|
int retries = 10;
|
||||||
|
|
||||||
|
ctx = (sdbuf_t *)malloc(sizeof(sdbuf_t));
|
||||||
|
if (!ctx) {
|
||||||
|
// perror("Failed allocating expect ctxect");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->buf = (char *)malloc(BUFSIZ);
|
||||||
|
if (!ctx->buf) {
|
||||||
|
// perror("Failed allocating expect buffer");
|
||||||
|
free(ctx);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->sd = socket(PF_INET, SOCK_STREAM, 0);
|
||||||
|
if (-1 == ctx->sd) {
|
||||||
|
saved = errno;
|
||||||
|
// perror ("Failed creating socket");
|
||||||
|
free(ctx->buf);
|
||||||
|
free(ctx);
|
||||||
|
|
||||||
|
errno = saved;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
retry:
|
||||||
|
sin = (struct sockaddr_in *)&s;
|
||||||
|
sin->sin_family = AF_INET;
|
||||||
|
sin->sin_port = port;
|
||||||
|
sin->sin_addr.s_addr = addr;
|
||||||
|
if (-1 == connect(ctx->sd, &s, sizeof(s))) {
|
||||||
|
if (ETIMEDOUT == errno && retries-- > 0) {
|
||||||
|
sleep(1);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
|
saved = errno;
|
||||||
|
// perror ("Cannot connect to telnet daemon");
|
||||||
|
telnet_close(ctx);
|
||||||
|
errno = saved;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
int telnet_close(sdbuf_t *ctx)
|
||||||
|
{
|
||||||
|
free(ctx->buf);
|
||||||
|
close(ctx->sd);
|
||||||
|
free(ctx);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int wait_substr(sdbuf_t *ctx, char *str)
|
||||||
|
{
|
||||||
|
struct pollfd pfd = { ctx->sd, POLLIN, 0 };
|
||||||
|
ssize_t len, tot = 0;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
err = poll(&pfd, 1, EXPECT_POLL_TIMEOUT);
|
||||||
|
if (err <= 0) {
|
||||||
|
if (0 == err)
|
||||||
|
errno = ETIMEDOUT;
|
||||||
|
|
||||||
|
if (EINTR == errno)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// perror("No prompt");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = read(ctx->sd, &ctx->buf[tot], BUFSIZ);
|
||||||
|
if (len <= 0) {
|
||||||
|
errno = ENOMSG;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tot += len;
|
||||||
|
ctx->buf[tot] = 0;
|
||||||
|
TELL("Got line: '%s' is it '%s'?", ctx->buf, str);
|
||||||
|
|
||||||
|
if (strstr(ctx->buf, str))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* telnet_expect - Poor man's telnet expect
|
||||||
|
* @ctx: Telnet session context from telnet_open()
|
||||||
|
* @script: %NULL terminated list of expect and response strings
|
||||||
|
* @output: Optional output from session
|
||||||
|
*
|
||||||
|
* Issues @script sequence on telnet session specified in @ctx, with
|
||||||
|
* optional @output from session.
|
||||||
|
*
|
||||||
|
* The @script consists of strings of expect and response pairs. For
|
||||||
|
* example, expect "ogin: " followed by response "root\n", expect
|
||||||
|
* "assword: "with response "secret\n", concluded by %NULL.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* POSIX OK(0) or non-zero on error.
|
||||||
|
*/
|
||||||
|
int telnet_expect(sdbuf_t *ctx, char *script[], FILE *output)
|
||||||
|
{
|
||||||
|
struct pollfd fd = { ctx->sd, POLLIN, 0 };
|
||||||
|
ssize_t len;
|
||||||
|
int i, first = 1, cont = 1, result = 0;
|
||||||
|
|
||||||
|
for (i = 0; script[i]; i++) {
|
||||||
|
/* when expecting the empty string, just wipe any available input */
|
||||||
|
if (!strlen(script[i])) {
|
||||||
|
result = poll(&fd, 1, 0);
|
||||||
|
if (result > 0)
|
||||||
|
lseek(ctx->sd, 0, SEEK_END);
|
||||||
|
} else {
|
||||||
|
if (wait_substr(ctx, script[i])) {
|
||||||
|
result = ENOMSG;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
|
||||||
|
if (strlen(script[i])) {
|
||||||
|
TELL("Sending line: '%s'", script[i]);
|
||||||
|
if (-1 == write(ctx->sd, script[i], strlen(script[i]))) {
|
||||||
|
errno = ENOSPC;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (cont) {
|
||||||
|
char *ptr = ctx->buf;
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
|
result = poll(&fd, 1, EXPECT_POLL_TIMEOUT);
|
||||||
|
if (result <= 0) {
|
||||||
|
if (0 == result)
|
||||||
|
errno = ETIMEDOUT;
|
||||||
|
|
||||||
|
if (EINTR == errno)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// perror ("No result");
|
||||||
|
result = errno;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On VERY long outputs we need to send some love back to the
|
||||||
|
* server, otherwise it terminates the connection. --Jocke
|
||||||
|
*/
|
||||||
|
if (-1 == write(ctx->sd, "\n", 1))
|
||||||
|
goto retry;
|
||||||
|
|
||||||
|
len = read(ctx->sd, ctx->buf, BUFSIZ);
|
||||||
|
if (len == -1) {
|
||||||
|
retry:
|
||||||
|
if (EINTR == errno)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
result = errno;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ctx->buf[len] = 0;
|
||||||
|
|
||||||
|
TELL("Read line: '%s'", ctx->buf);
|
||||||
|
|
||||||
|
/* Skip first line -- only an echo of the last command */
|
||||||
|
if (first) {
|
||||||
|
first = 0;
|
||||||
|
ptr = strchr(ctx->buf, '\n');
|
||||||
|
if (ptr)
|
||||||
|
ptr++;
|
||||||
|
else
|
||||||
|
ptr = ctx->buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
TELL("Comparing '%s' with '%s'", ptr, script[i - 2]);
|
||||||
|
|
||||||
|
/* Skip last line -- only the returning prompt. */
|
||||||
|
tmp = strstr(ptr, script[i - 2]);
|
||||||
|
if (tmp) {
|
||||||
|
TELL("OK, last line. Good bye!");
|
||||||
|
result = 0;
|
||||||
|
cont = 0;
|
||||||
|
*tmp = 0;
|
||||||
|
|
||||||
|
tmp = strrchr(ptr, '\n');
|
||||||
|
if (tmp)
|
||||||
|
*++tmp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (output && *ptr) {
|
||||||
|
if (EOF == fputs(ptr, output)) {
|
||||||
|
/* Only happens when /tmp is full :( */
|
||||||
|
result = ENOSPC;
|
||||||
|
/* We must complete read-out of descriptor */
|
||||||
|
output = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* telnet_session - Very simple expect-like implementation for telnet.
|
||||||
|
* @addr: Must be in network byte order, use htonl().
|
||||||
|
* @port: IP port to connect to, use htons().
|
||||||
|
* @script: Expect like script of paired 'expect', 'response' strings.
|
||||||
|
* @output: A &FILE pointer to a tmpfile() for output from the last command.
|
||||||
|
*
|
||||||
|
* This is a very simple expect-like implementation for querying and
|
||||||
|
* operating daemons remotely over telnet.
|
||||||
|
*
|
||||||
|
* The @script is a query-response type of list of strings leading up to
|
||||||
|
* a final command, which output is then written to the given @output file.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* POSIX OK(0), or non-zero with errno set on error.
|
||||||
|
*/
|
||||||
|
int telnet_session(int addr, short port, char *script[], FILE *output)
|
||||||
|
{
|
||||||
|
sdbuf_t *sdbuf;
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
sdbuf = telnet_open(addr, port);
|
||||||
|
if (!sdbuf)
|
||||||
|
return errno;
|
||||||
|
|
||||||
|
if (telnet_expect(sdbuf, script, output))
|
||||||
|
result = errno;
|
||||||
|
|
||||||
|
telnet_close(sdbuf);
|
||||||
|
|
||||||
|
return errno = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local Variables:
|
||||||
|
* indent-tabs-mode: t
|
||||||
|
* c-file-style: "linux"
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* A secure tmpfile() replacement.
|
/* A secure tmpfile() replacement.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2016 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2015-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
|||||||
@@ -24,6 +24,11 @@
|
|||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _SYS_TREE_H_
|
#ifndef _SYS_TREE_H_
|
||||||
#define _SYS_TREE_H_
|
#define _SYS_TREE_H_
|
||||||
|
|
||||||
@@ -746,3 +751,7 @@ name##_RB_MINMAX(struct name *head, int val) \
|
|||||||
(x) = (y))
|
(x) = (y))
|
||||||
|
|
||||||
#endif /* _SYS_TREE_H_ */
|
#endif /* _SYS_TREE_H_ */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/* Formatted truncate()
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* truncatef - Truncate a file based on the formatted string
|
||||||
|
* @length: Size in bytes to truncate file to, zero to empty it
|
||||||
|
* @fmt: Formatted string to be composed into a pathname
|
||||||
|
*
|
||||||
|
* This is an extension to the truncate() family, lessening the burden
|
||||||
|
* of having to compose the filename from parts in a seprate buffer.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
|
||||||
|
* Upon successful completion truncate() returns POSIX OK(0), otherwise,
|
||||||
|
* -1 is returned and errno is set to indicate the error.
|
||||||
|
*/
|
||||||
|
int truncatef(off_t length, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
char *file;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
len = vsnprintf(NULL, 0, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
file = alloca(len + 1);
|
||||||
|
if (!file) {
|
||||||
|
errno = ENOMEM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vsnprintf(file, len + 1, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
return truncate(file, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local Variables:
|
||||||
|
* indent-tabs-mode: t
|
||||||
|
* c-file-style: "linux"
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* C implementation of UNIX which(1)
|
/* C implementation of UNIX which(1)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 Joachim Nilsson <troglobit@gmail.com>
|
* Copyright (c) 2017-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
|||||||
+92
@@ -0,0 +1,92 @@
|
|||||||
|
/* Safe yes-or-no with prompt
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2020 Joachim Nilsson <troglobit@gmail.com>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdio_ext.h> /* __fpurge() */
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
static char rawgetch(void)
|
||||||
|
{
|
||||||
|
struct termios savemodes, modmodes;
|
||||||
|
char val;
|
||||||
|
|
||||||
|
if (!isatty(STDIN_FILENO))
|
||||||
|
return getchar();
|
||||||
|
|
||||||
|
/* Backup terminal settings. */
|
||||||
|
if (tcgetattr(STDIN_FILENO, &savemodes) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* "stty cbreak -echo" */
|
||||||
|
modmodes = savemodes;
|
||||||
|
modmodes.c_lflag &= ~ICANON;
|
||||||
|
modmodes.c_lflag &= ~ECHO;
|
||||||
|
modmodes.c_cc[VMIN] = 1;
|
||||||
|
modmodes.c_cc[VTIME] = 0;
|
||||||
|
|
||||||
|
/* Set terminal in raw mode. */
|
||||||
|
if (tcsetattr(STDIN_FILENO, TCSANOW, &modmodes) < 0) {
|
||||||
|
tcsetattr(STDIN_FILENO, TCSANOW, &savemodes);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
val = getchar();
|
||||||
|
|
||||||
|
/* Restore terminal to previous state. */
|
||||||
|
tcsetattr(STDIN_FILENO, TCSANOW, &savemodes);
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* yorn - Pose a a Yes or No question and return answer
|
||||||
|
* @fmt: Standard printf() style argument(s).
|
||||||
|
*
|
||||||
|
* This function prints the given question on screen, waits for user
|
||||||
|
* input in the form of yes or no.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* True(1) or False(0). True if the answer is yes.
|
||||||
|
*/
|
||||||
|
int yorn(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
char yorn;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vfprintf(stderr, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
__fpurge(stdin);
|
||||||
|
yorn = rawgetch();
|
||||||
|
printf("%c\n", yorn);
|
||||||
|
fflush(stdout);
|
||||||
|
if (yorn != 'y' && yorn != 'Y')
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local Variables:
|
||||||
|
* indent-tabs-mode: t
|
||||||
|
* c-file-style: "linux"
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
+23
-15
@@ -1,17 +1,25 @@
|
|||||||
|
*.o
|
||||||
*.log
|
*.log
|
||||||
*.trs
|
*.trs
|
||||||
chomp
|
.deps/
|
||||||
copyfile
|
/chomp
|
||||||
dir
|
/copyfile
|
||||||
fexist
|
/dir
|
||||||
fisdir
|
/fexist
|
||||||
fsendfile
|
/fisdir
|
||||||
lfile
|
/fopenf
|
||||||
makepath
|
/fsendfile
|
||||||
pidfile
|
/lfile
|
||||||
progress
|
/makepath
|
||||||
rsync
|
/pidfile
|
||||||
tempfile
|
/printhdr
|
||||||
touch
|
/progress
|
||||||
tree
|
/rsync
|
||||||
which
|
/str
|
||||||
|
/strmatch
|
||||||
|
/systemf
|
||||||
|
/tempfile
|
||||||
|
/touch
|
||||||
|
/tree
|
||||||
|
/which
|
||||||
|
/yorn
|
||||||
+17
-2
@@ -1,21 +1,36 @@
|
|||||||
EXTRA_DIST = check.h
|
EXTRA_DIST = check.h \
|
||||||
|
data/fexist/dir/.placeholder data/fexist/executable data/fexist/link \
|
||||||
|
data/fexist/regular data/lfile/fstab data/lfile/group data/lfile/passwd \
|
||||||
|
data/lfile/protocols data/lfile/services data/which/executable \
|
||||||
|
data/which/executable-link data/which/regular
|
||||||
CLEANFILES = *~ *.trs *.log
|
CLEANFILES = *~ *.trs *.log
|
||||||
|
|
||||||
|
TESTS_ENVIRONMENT = ([ -d data ] || ln -sf $(srcdir)/data) &&
|
||||||
|
|
||||||
|
clean-local:
|
||||||
|
-find -type l -name data -exec rm {} \;
|
||||||
|
|
||||||
TESTS =
|
TESTS =
|
||||||
TESTS += chomp
|
TESTS += chomp
|
||||||
TESTS += copyfile
|
TESTS += copyfile
|
||||||
TESTS += dir
|
TESTS += dir
|
||||||
TESTS += fexist
|
TESTS += fexist
|
||||||
TESTS += fisdir
|
TESTS += fisdir
|
||||||
|
TESTS += fopenf
|
||||||
TESTS += fsendfile
|
TESTS += fsendfile
|
||||||
TESTS += lfile
|
TESTS += lfile
|
||||||
TESTS += makepath
|
TESTS += makepath
|
||||||
TESTS += pidfile
|
TESTS += pidfile
|
||||||
TESTS += touch
|
TESTS += printhdr
|
||||||
TESTS += progress
|
TESTS += progress
|
||||||
TESTS += rsync
|
TESTS += rsync
|
||||||
|
TESTS += str
|
||||||
|
TESTS += strmatch
|
||||||
|
TESTS += systemf
|
||||||
|
TESTS += touch
|
||||||
TESTS += tempfile
|
TESTS += tempfile
|
||||||
TESTS += which
|
TESTS += which
|
||||||
|
TESTS += yorn
|
||||||
|
|
||||||
check_PROGRAMS = $(TESTS)
|
check_PROGRAMS = $(TESTS)
|
||||||
|
|
||||||
|
|||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
nonexistence
|
||||||
Whitespace-only changes.
Executable
Whitespace-only changes.
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
regular
|
||||||
Whitespace-only changes.
@@ -0,0 +1,3 @@
|
|||||||
|
UUID=xxxxxxxxxx / xfs defaults 0 1
|
||||||
|
/dev/sda1 /boot/efi vfat umask=0077 0 1
|
||||||
|
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
root:x:0:
|
||||||
|
daemon:x:1:
|
||||||
|
bin:x:2:
|
||||||
|
sys:x:3:
|
||||||
|
adm:x:4:
|
||||||
|
tty:x:5:
|
||||||
|
disk:x:6:
|
||||||
|
lp:x:7:
|
||||||
|
mail:x:8:
|
||||||
|
news:x:9:
|
||||||
|
uucp:x:10:
|
||||||
|
man:x:12:
|
||||||
|
proxy:x:13:
|
||||||
|
kmem:x:15:
|
||||||
|
dialout:x:20:
|
||||||
|
fax:x:21:
|
||||||
|
voice:x:22:
|
||||||
|
cdrom:x:24:
|
||||||
|
floppy:x:25:
|
||||||
|
tape:x:26:
|
||||||
|
sudo:x:27:
|
||||||
|
audio:x:29:
|
||||||
|
dip:x:30:
|
||||||
|
www-data:x:33:
|
||||||
|
backup:x:34:
|
||||||
|
operator:x:37:
|
||||||
|
list:x:38:
|
||||||
|
irc:x:39:
|
||||||
|
src:x:40:
|
||||||
|
gnats:x:41:
|
||||||
|
shadow:x:42:
|
||||||
|
utmp:x:43:
|
||||||
|
video:x:44:
|
||||||
|
sasl:x:45:
|
||||||
|
plugdev:x:46:
|
||||||
|
staff:x:50:
|
||||||
|
games:x:60:
|
||||||
|
users:x:100:
|
||||||
|
nogroup:x:65534:
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
root:x:0:0:root:/root:/bin/bash
|
||||||
|
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
|
||||||
|
bin:x:2:2:bin:/bin:/usr/sbin/nologin
|
||||||
|
sys:x:3:3:sys:/dev:/usr/sbin/nologin
|
||||||
|
sync:x:4:65534:sync:/bin:/bin/sync
|
||||||
|
games:x:5:60:games:/usr/games:/usr/sbin/nologin
|
||||||
|
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
|
||||||
|
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
|
||||||
|
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
|
||||||
|
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
|
||||||
|
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
|
||||||
|
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
|
||||||
|
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
|
||||||
|
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
|
||||||
|
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
|
||||||
|
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
|
||||||
|
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
|
||||||
|
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
# Internet (IP) protocols
|
||||||
|
#
|
||||||
|
# Updated from http://www.iana.org/assignments/protocol-numbers and other
|
||||||
|
# sources.
|
||||||
|
# New protocols will be added on request if they have been officially
|
||||||
|
# assigned by IANA and are not historical.
|
||||||
|
# If you need a huge list of used numbers please install the nmap package.
|
||||||
|
|
||||||
|
ip 0 IP # internet protocol, pseudo protocol number
|
||||||
|
hopopt 0 HOPOPT # IPv6 Hop-by-Hop Option [RFC1883]
|
||||||
|
icmp 1 ICMP # internet control message protocol
|
||||||
|
igmp 2 IGMP # Internet Group Management
|
||||||
|
ggp 3 GGP # gateway-gateway protocol
|
||||||
|
ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'')
|
||||||
|
st 5 ST # ST datagram mode
|
||||||
|
tcp 6 TCP # transmission control protocol
|
||||||
|
egp 8 EGP # exterior gateway protocol
|
||||||
|
igp 9 IGP # any private interior gateway (Cisco)
|
||||||
|
pup 12 PUP # PARC universal packet protocol
|
||||||
|
udp 17 UDP # user datagram protocol
|
||||||
|
hmp 20 HMP # host monitoring protocol
|
||||||
|
xns-idp 22 XNS-IDP # Xerox NS IDP
|
||||||
|
rdp 27 RDP # "reliable datagram" protocol
|
||||||
|
iso-tp4 29 ISO-TP4 # ISO Transport Protocol class 4 [RFC905]
|
||||||
|
dccp 33 DCCP # Datagram Congestion Control Prot. [RFC4340]
|
||||||
|
xtp 36 XTP # Xpress Transfer Protocol
|
||||||
|
ddp 37 DDP # Datagram Delivery Protocol
|
||||||
|
idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport
|
||||||
|
ipv6 41 IPv6 # Internet Protocol, version 6
|
||||||
|
ipv6-route 43 IPv6-Route # Routing Header for IPv6
|
||||||
|
ipv6-frag 44 IPv6-Frag # Fragment Header for IPv6
|
||||||
|
idrp 45 IDRP # Inter-Domain Routing Protocol
|
||||||
|
rsvp 46 RSVP # Reservation Protocol
|
||||||
|
gre 47 GRE # General Routing Encapsulation
|
||||||
|
esp 50 IPSEC-ESP # Encap Security Payload [RFC2406]
|
||||||
|
ah 51 IPSEC-AH # Authentication Header [RFC2402]
|
||||||
|
skip 57 SKIP # SKIP
|
||||||
|
ipv6-icmp 58 IPv6-ICMP # ICMP for IPv6
|
||||||
|
ipv6-nonxt 59 IPv6-NoNxt # No Next Header for IPv6
|
||||||
|
ipv6-opts 60 IPv6-Opts # Destination Options for IPv6
|
||||||
|
rspf 73 RSPF CPHB # Radio Shortest Path First (officially CPHB)
|
||||||
|
vmtp 81 VMTP # Versatile Message Transport
|
||||||
|
eigrp 88 EIGRP # Enhanced Interior Routing Protocol (Cisco)
|
||||||
|
ospf 89 OSPFIGP # Open Shortest Path First IGP
|
||||||
|
ax.25 93 AX.25 # AX.25 frames
|
||||||
|
ipip 94 IPIP # IP-within-IP Encapsulation Protocol
|
||||||
|
etherip 97 ETHERIP # Ethernet-within-IP Encapsulation [RFC3378]
|
||||||
|
encap 98 ENCAP # Yet Another IP encapsulation [RFC1241]
|
||||||
|
# 99 # any private encryption scheme
|
||||||
|
pim 103 PIM # Protocol Independent Multicast
|
||||||
|
ipcomp 108 IPCOMP # IP Payload Compression Protocol
|
||||||
|
vrrp 112 VRRP # Virtual Router Redundancy Protocol [RFC5798]
|
||||||
|
l2tp 115 L2TP # Layer Two Tunneling Protocol [RFC2661]
|
||||||
|
isis 124 ISIS # IS-IS over IPv4
|
||||||
|
sctp 132 SCTP # Stream Control Transmission Protocol
|
||||||
|
fc 133 FC # Fibre Channel
|
||||||
|
mobility-header 135 Mobility-Header # Mobility Support for IPv6 [RFC3775]
|
||||||
|
udplite 136 UDPLite # UDP-Lite [RFC3828]
|
||||||
|
mpls-in-ip 137 MPLS-in-IP # MPLS-in-IP [RFC4023]
|
||||||
|
manet 138 # MANET Protocols [RFC5498]
|
||||||
|
hip 139 HIP # Host Identity Protocol
|
||||||
|
shim6 140 Shim6 # Shim6 Protocol [RFC5533]
|
||||||
|
wesp 141 WESP # Wrapped Encapsulating Security Payload
|
||||||
|
rohc 142 ROHC # Robust Header Compression
|
||||||
@@ -0,0 +1,417 @@
|
|||||||
|
# Network services, Internet style
|
||||||
|
#
|
||||||
|
# Note that it is presently the policy of IANA to assign a single well-known
|
||||||
|
# port number for both TCP and UDP; hence, officially ports have two entries
|
||||||
|
# even if the protocol doesn't support UDP operations.
|
||||||
|
#
|
||||||
|
# Updated from https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml .
|
||||||
|
#
|
||||||
|
# New ports will be added on request if they have been officially assigned
|
||||||
|
# by IANA and used in the real-world or are needed by a debian package.
|
||||||
|
# If you need a huge list of used numbers please install the nmap package.
|
||||||
|
|
||||||
|
tcpmux 1/tcp # TCP port service multiplexer
|
||||||
|
echo 7/tcp
|
||||||
|
echo 7/udp
|
||||||
|
discard 9/tcp sink null
|
||||||
|
discard 9/udp sink null
|
||||||
|
systat 11/tcp users
|
||||||
|
daytime 13/tcp
|
||||||
|
daytime 13/udp
|
||||||
|
netstat 15/tcp
|
||||||
|
qotd 17/tcp quote
|
||||||
|
chargen 19/tcp ttytst source
|
||||||
|
chargen 19/udp ttytst source
|
||||||
|
ftp-data 20/tcp
|
||||||
|
ftp 21/tcp
|
||||||
|
fsp 21/udp fspd
|
||||||
|
ssh 22/tcp # SSH Remote Login Protocol
|
||||||
|
telnet 23/tcp
|
||||||
|
smtp 25/tcp mail
|
||||||
|
time 37/tcp timserver
|
||||||
|
time 37/udp timserver
|
||||||
|
whois 43/tcp nicname
|
||||||
|
tacacs 49/tcp # Login Host Protocol (TACACS)
|
||||||
|
tacacs 49/udp
|
||||||
|
domain 53/tcp # Domain Name Server
|
||||||
|
domain 53/udp
|
||||||
|
bootps 67/udp
|
||||||
|
bootpc 68/udp
|
||||||
|
tftp 69/udp
|
||||||
|
gopher 70/tcp # Internet Gopher
|
||||||
|
finger 79/tcp
|
||||||
|
http 80/tcp www # WorldWideWeb HTTP
|
||||||
|
kerberos 88/tcp kerberos5 krb5 kerberos-sec # Kerberos v5
|
||||||
|
kerberos 88/udp kerberos5 krb5 kerberos-sec # Kerberos v5
|
||||||
|
iso-tsap 102/tcp tsap # part of ISODE
|
||||||
|
acr-nema 104/tcp dicom # Digital Imag. & Comm. 300
|
||||||
|
pop3 110/tcp pop-3 # POP version 3
|
||||||
|
sunrpc 111/tcp portmapper # RPC 4.0 portmapper
|
||||||
|
sunrpc 111/udp portmapper
|
||||||
|
auth 113/tcp authentication tap ident
|
||||||
|
nntp 119/tcp readnews untp # USENET News Transfer Protocol
|
||||||
|
ntp 123/udp # Network Time Protocol
|
||||||
|
epmap 135/tcp loc-srv # DCE endpoint resolution
|
||||||
|
netbios-ns 137/tcp # NETBIOS Name Service
|
||||||
|
netbios-ns 137/udp
|
||||||
|
netbios-dgm 138/tcp # NETBIOS Datagram Service
|
||||||
|
netbios-dgm 138/udp
|
||||||
|
netbios-ssn 139/tcp # NETBIOS session service
|
||||||
|
netbios-ssn 139/udp
|
||||||
|
imap2 143/tcp imap # Interim Mail Access P 2 and 4
|
||||||
|
snmp 161/tcp # Simple Net Mgmt Protocol
|
||||||
|
snmp 161/udp
|
||||||
|
snmp-trap 162/tcp snmptrap # Traps for SNMP
|
||||||
|
snmp-trap 162/udp snmptrap
|
||||||
|
cmip-man 163/tcp # ISO mgmt over IP (CMOT)
|
||||||
|
cmip-man 163/udp
|
||||||
|
cmip-agent 164/tcp
|
||||||
|
cmip-agent 164/udp
|
||||||
|
mailq 174/tcp # Mailer transport queue for Zmailer
|
||||||
|
xdmcp 177/udp # X Display Manager Control Protocol
|
||||||
|
bgp 179/tcp # Border Gateway Protocol
|
||||||
|
smux 199/tcp # SNMP Unix Multiplexer
|
||||||
|
qmtp 209/tcp # Quick Mail Transfer Protocol
|
||||||
|
z3950 210/tcp wais # NISO Z39.50 database
|
||||||
|
ipx 213/udp # IPX [RFC1234]
|
||||||
|
ptp-event 319/udp
|
||||||
|
ptp-general 320/udp
|
||||||
|
pawserv 345/tcp # Perf Analysis Workbench
|
||||||
|
zserv 346/tcp # Zebra server
|
||||||
|
rpc2portmap 369/tcp
|
||||||
|
rpc2portmap 369/udp # Coda portmapper
|
||||||
|
codaauth2 370/tcp
|
||||||
|
codaauth2 370/udp # Coda authentication server
|
||||||
|
clearcase 371/udp Clearcase
|
||||||
|
ldap 389/tcp # Lightweight Directory Access Protocol
|
||||||
|
ldap 389/udp
|
||||||
|
svrloc 427/tcp # Server Location
|
||||||
|
svrloc 427/udp
|
||||||
|
https 443/tcp # http protocol over TLS/SSL
|
||||||
|
snpp 444/tcp # Simple Network Paging Protocol
|
||||||
|
microsoft-ds 445/tcp # Microsoft Naked CIFS
|
||||||
|
microsoft-ds 445/udp
|
||||||
|
kpasswd 464/tcp
|
||||||
|
kpasswd 464/udp
|
||||||
|
submissions 465/tcp ssmtp smtps urd # Submission over TLS [RFC8314]
|
||||||
|
saft 487/tcp # Simple Asynchronous File Transfer
|
||||||
|
isakmp 500/udp # IPSEC key management
|
||||||
|
rtsp 554/tcp # Real Time Stream Control Protocol
|
||||||
|
rtsp 554/udp
|
||||||
|
nqs 607/tcp # Network Queuing system
|
||||||
|
asf-rmcp 623/udp # ASF Remote Management and Control Protocol
|
||||||
|
qmqp 628/tcp
|
||||||
|
ipp 631/tcp # Internet Printing Protocol
|
||||||
|
#
|
||||||
|
# UNIX specific services
|
||||||
|
#
|
||||||
|
exec 512/tcp
|
||||||
|
biff 512/udp comsat
|
||||||
|
login 513/tcp
|
||||||
|
who 513/udp whod
|
||||||
|
shell 514/tcp cmd syslog # no passwords used
|
||||||
|
syslog 514/udp
|
||||||
|
printer 515/tcp spooler # line printer spooler
|
||||||
|
talk 517/udp
|
||||||
|
ntalk 518/udp
|
||||||
|
route 520/udp router routed # RIP
|
||||||
|
gdomap 538/tcp # GNUstep distributed objects
|
||||||
|
gdomap 538/udp
|
||||||
|
uucp 540/tcp uucpd # uucp daemon
|
||||||
|
klogin 543/tcp # Kerberized `rlogin' (v5)
|
||||||
|
kshell 544/tcp krcmd # Kerberized `rsh' (v5)
|
||||||
|
dhcpv6-client 546/udp
|
||||||
|
dhcpv6-server 547/udp
|
||||||
|
afpovertcp 548/tcp # AFP over TCP
|
||||||
|
nntps 563/tcp snntp # NNTP over SSL
|
||||||
|
submission 587/tcp # Submission [RFC4409]
|
||||||
|
ldaps 636/tcp # LDAP over SSL
|
||||||
|
ldaps 636/udp
|
||||||
|
tinc 655/tcp # tinc control port
|
||||||
|
tinc 655/udp
|
||||||
|
silc 706/tcp
|
||||||
|
kerberos-adm 749/tcp # Kerberos `kadmin' (v5)
|
||||||
|
#
|
||||||
|
domain-s 853/tcp # DNS over TLS [RFC7858]
|
||||||
|
domain-s 853/udp # DNS over DTLS [RFC8094]
|
||||||
|
rsync 873/tcp
|
||||||
|
ftps-data 989/tcp # FTP over SSL (data)
|
||||||
|
ftps 990/tcp
|
||||||
|
telnets 992/tcp # Telnet over SSL
|
||||||
|
imaps 993/tcp # IMAP over SSL
|
||||||
|
pop3s 995/tcp # POP-3 over SSL
|
||||||
|
#
|
||||||
|
# From ``Assigned Numbers'':
|
||||||
|
#
|
||||||
|
#> The Registered Ports are not controlled by the IANA and on most systems
|
||||||
|
#> can be used by ordinary user processes or programs executed by ordinary
|
||||||
|
#> users.
|
||||||
|
#
|
||||||
|
#> Ports are used in the TCP [45,106] to name the ends of logical
|
||||||
|
#> connections which carry long term conversations. For the purpose of
|
||||||
|
#> providing services to unknown callers, a service contact port is
|
||||||
|
#> defined. This list specifies the port used by the server process as its
|
||||||
|
#> contact port. While the IANA can not control uses of these ports it
|
||||||
|
#> does register or list uses of these ports as a convienence to the
|
||||||
|
#> community.
|
||||||
|
#
|
||||||
|
socks 1080/tcp # socks proxy server
|
||||||
|
proofd 1093/tcp
|
||||||
|
rootd 1094/tcp
|
||||||
|
openvpn 1194/tcp
|
||||||
|
openvpn 1194/udp
|
||||||
|
rmiregistry 1099/tcp # Java RMI Registry
|
||||||
|
lotusnote 1352/tcp lotusnotes # Lotus Note
|
||||||
|
ms-sql-s 1433/tcp # Microsoft SQL Server
|
||||||
|
ms-sql-s 1433/udp
|
||||||
|
ms-sql-m 1434/tcp # Microsoft SQL Monitor
|
||||||
|
ms-sql-m 1434/udp
|
||||||
|
ingreslock 1524/tcp
|
||||||
|
datametrics 1645/tcp old-radius
|
||||||
|
datametrics 1645/udp old-radius
|
||||||
|
sa-msg-port 1646/tcp old-radacct
|
||||||
|
sa-msg-port 1646/udp old-radacct
|
||||||
|
kermit 1649/tcp
|
||||||
|
groupwise 1677/tcp
|
||||||
|
l2f 1701/udp l2tp
|
||||||
|
radius 1812/tcp
|
||||||
|
radius 1812/udp
|
||||||
|
radius-acct 1813/tcp radacct # Radius Accounting
|
||||||
|
radius-acct 1813/udp radacct
|
||||||
|
cisco-sccp 2000/tcp # Cisco SCCP
|
||||||
|
nfs 2049/tcp # Network File System
|
||||||
|
nfs 2049/udp # Network File System
|
||||||
|
gnunet 2086/tcp
|
||||||
|
gnunet 2086/udp
|
||||||
|
rtcm-sc104 2101/tcp # RTCM SC-104 IANA 1/29/99
|
||||||
|
rtcm-sc104 2101/udp
|
||||||
|
gsigatekeeper 2119/tcp
|
||||||
|
gris 2135/tcp # Grid Resource Information Server
|
||||||
|
cvspserver 2401/tcp # CVS client/server operations
|
||||||
|
venus 2430/tcp # codacon port
|
||||||
|
venus 2430/udp # Venus callback/wbc interface
|
||||||
|
venus-se 2431/tcp # tcp side effects
|
||||||
|
venus-se 2431/udp # udp sftp side effect
|
||||||
|
codasrv 2432/tcp # not used
|
||||||
|
codasrv 2432/udp # server port
|
||||||
|
codasrv-se 2433/tcp # tcp side effects
|
||||||
|
codasrv-se 2433/udp # udp sftp side effect
|
||||||
|
mon 2583/tcp # MON traps
|
||||||
|
mon 2583/udp
|
||||||
|
dict 2628/tcp # Dictionary server
|
||||||
|
f5-globalsite 2792/tcp
|
||||||
|
gsiftp 2811/tcp
|
||||||
|
gpsd 2947/tcp
|
||||||
|
gds-db 3050/tcp gds_db # InterBase server
|
||||||
|
icpv2 3130/tcp icp # Internet Cache Protocol
|
||||||
|
icpv2 3130/udp icp
|
||||||
|
isns 3205/tcp # iSNS Server Port
|
||||||
|
isns 3205/udp # iSNS Server Port
|
||||||
|
iscsi-target 3260/tcp
|
||||||
|
mysql 3306/tcp
|
||||||
|
ms-wbt-server 3389/tcp
|
||||||
|
nut 3493/tcp # Network UPS Tools
|
||||||
|
nut 3493/udp
|
||||||
|
distcc 3632/tcp # distributed compiler
|
||||||
|
distcc 3632/udp
|
||||||
|
daap 3689/tcp # Digital Audio Access Protocol
|
||||||
|
daap 3689/udp
|
||||||
|
svn 3690/tcp subversion # Subversion protocol
|
||||||
|
svn 3690/udp subversion
|
||||||
|
suucp 4031/tcp # UUCP over SSL
|
||||||
|
suucp 4031/udp
|
||||||
|
sysrqd 4094/tcp # sysrq daemon
|
||||||
|
sysrqd 4094/udp
|
||||||
|
sieve 4190/tcp # ManageSieve Protocol
|
||||||
|
epmd 4369/tcp # Erlang Port Mapper Daemon
|
||||||
|
epmd 4369/udp
|
||||||
|
remctl 4373/tcp # Remote Authenticated Command Service
|
||||||
|
remctl 4373/udp
|
||||||
|
f5-iquery 4353/tcp # F5 iQuery
|
||||||
|
f5-iquery 4353/udp
|
||||||
|
ipsec-nat-t 4500/udp # IPsec NAT-Traversal [RFC3947]
|
||||||
|
iax 4569/tcp # Inter-Asterisk eXchange
|
||||||
|
iax 4569/udp
|
||||||
|
mtn 4691/tcp # monotone Netsync Protocol
|
||||||
|
mtn 4691/udp
|
||||||
|
radmin-port 4899/tcp # RAdmin Port
|
||||||
|
radmin-port 4899/udp
|
||||||
|
sip 5060/tcp # Session Initiation Protocol
|
||||||
|
sip 5060/udp
|
||||||
|
sip-tls 5061/tcp
|
||||||
|
sip-tls 5061/udp
|
||||||
|
xmpp-client 5222/tcp jabber-client # Jabber Client Connection
|
||||||
|
xmpp-server 5269/tcp jabber-server # Jabber Server Connection
|
||||||
|
cfengine 5308/tcp
|
||||||
|
mdns 5353/udp # Multicast DNS
|
||||||
|
postgresql 5432/tcp postgres # PostgreSQL Database
|
||||||
|
freeciv 5556/tcp rptp # Freeciv gameplay
|
||||||
|
amqps 5671/tcp # AMQP protocol over TLS/SSL
|
||||||
|
amqp 5672/tcp
|
||||||
|
amqp 5672/udp
|
||||||
|
amqp 5672/sctp
|
||||||
|
x11 6000/tcp x11-0 # X Window System
|
||||||
|
x11-1 6001/tcp
|
||||||
|
x11-2 6002/tcp
|
||||||
|
x11-3 6003/tcp
|
||||||
|
x11-4 6004/tcp
|
||||||
|
x11-5 6005/tcp
|
||||||
|
x11-6 6006/tcp
|
||||||
|
x11-7 6007/tcp
|
||||||
|
gnutella-svc 6346/tcp # gnutella
|
||||||
|
gnutella-svc 6346/udp
|
||||||
|
gnutella-rtr 6347/tcp # gnutella
|
||||||
|
gnutella-rtr 6347/udp
|
||||||
|
sge-qmaster 6444/tcp sge_qmaster # Grid Engine Qmaster Service
|
||||||
|
sge-execd 6445/tcp sge_execd # Grid Engine Execution Service
|
||||||
|
mysql-proxy 6446/tcp # MySQL Proxy
|
||||||
|
babel 6696/udp # Babel Routing Protocol
|
||||||
|
ircs-u 6697/tcp # Internet Relay Chat via TLS/SSL
|
||||||
|
afs3-fileserver 7000/tcp bbs # file server itself
|
||||||
|
afs3-fileserver 7000/udp bbs
|
||||||
|
afs3-callback 7001/tcp # callbacks to cache managers
|
||||||
|
afs3-callback 7001/udp
|
||||||
|
afs3-prserver 7002/tcp # users & groups database
|
||||||
|
afs3-prserver 7002/udp
|
||||||
|
afs3-vlserver 7003/tcp # volume location database
|
||||||
|
afs3-vlserver 7003/udp
|
||||||
|
afs3-kaserver 7004/tcp # AFS/Kerberos authentication
|
||||||
|
afs3-kaserver 7004/udp
|
||||||
|
afs3-volser 7005/tcp # volume managment server
|
||||||
|
afs3-volser 7005/udp
|
||||||
|
afs3-errors 7006/tcp # error interpretation service
|
||||||
|
afs3-errors 7006/udp
|
||||||
|
afs3-bos 7007/tcp # basic overseer process
|
||||||
|
afs3-bos 7007/udp
|
||||||
|
afs3-update 7008/tcp # server-to-server updater
|
||||||
|
afs3-update 7008/udp
|
||||||
|
afs3-rmtsys 7009/tcp # remote cache manager service
|
||||||
|
afs3-rmtsys 7009/udp
|
||||||
|
font-service 7100/tcp xfs # X Font Service
|
||||||
|
http-alt 8080/tcp webcache # WWW caching service
|
||||||
|
puppet 8140/tcp # The Puppet master service
|
||||||
|
bacula-dir 9101/tcp # Bacula Director
|
||||||
|
bacula-fd 9102/tcp # Bacula File Daemon
|
||||||
|
bacula-sd 9103/tcp # Bacula Storage Daemon
|
||||||
|
xmms2 9667/tcp # Cross-platform Music Multiplexing System
|
||||||
|
nbd 10809/tcp # Linux Network Block Device
|
||||||
|
zabbix-agent 10050/tcp # Zabbix Agent
|
||||||
|
zabbix-trapper 10051/tcp # Zabbix Trapper
|
||||||
|
amanda 10080/tcp # amanda backup services
|
||||||
|
dicom 11112/tcp
|
||||||
|
hkp 11371/tcp # OpenPGP HTTP Keyserver
|
||||||
|
db-lsp 17500/tcp # Dropbox LanSync Protocol
|
||||||
|
dcap 22125/tcp # dCache Access Protocol
|
||||||
|
gsidcap 22128/tcp # GSI dCache Access Protocol
|
||||||
|
wnn6 22273/tcp # wnn6
|
||||||
|
|
||||||
|
#
|
||||||
|
# Datagram Delivery Protocol services
|
||||||
|
#
|
||||||
|
rtmp 1/ddp # Routing Table Maintenance Protocol
|
||||||
|
nbp 2/ddp # Name Binding Protocol
|
||||||
|
echo 4/ddp # AppleTalk Echo Protocol
|
||||||
|
zip 6/ddp # Zone Information Protocol
|
||||||
|
|
||||||
|
#=========================================================================
|
||||||
|
# The remaining port numbers are not as allocated by IANA.
|
||||||
|
#=========================================================================
|
||||||
|
|
||||||
|
# Kerberos (Project Athena/MIT) services
|
||||||
|
kerberos4 750/udp kerberos-iv kdc # Kerberos (server)
|
||||||
|
kerberos4 750/tcp kerberos-iv kdc
|
||||||
|
kerberos-master 751/udp kerberos_master # Kerberos authentication
|
||||||
|
kerberos-master 751/tcp
|
||||||
|
passwd-server 752/udp passwd_server # Kerberos passwd server
|
||||||
|
krb-prop 754/tcp krb_prop krb5_prop hprop # Kerberos slave propagation
|
||||||
|
zephyr-srv 2102/udp # Zephyr server
|
||||||
|
zephyr-clt 2103/udp # Zephyr serv-hm connection
|
||||||
|
zephyr-hm 2104/udp # Zephyr hostmanager
|
||||||
|
iprop 2121/tcp # incremental propagation
|
||||||
|
supfilesrv 871/tcp # Software Upgrade Protocol server
|
||||||
|
supfiledbg 1127/tcp # Software Upgrade Protocol debugging
|
||||||
|
|
||||||
|
#
|
||||||
|
# Services added for the Debian GNU/Linux distribution
|
||||||
|
#
|
||||||
|
poppassd 106/tcp # Eudora
|
||||||
|
poppassd 106/udp
|
||||||
|
moira-db 775/tcp moira_db # Moira database
|
||||||
|
moira-update 777/tcp moira_update # Moira update protocol
|
||||||
|
moira-ureg 779/udp moira_ureg # Moira user registration
|
||||||
|
spamd 783/tcp # spamassassin daemon
|
||||||
|
skkserv 1178/tcp # skk jisho server port
|
||||||
|
predict 1210/udp # predict -- satellite tracking
|
||||||
|
rmtcfg 1236/tcp # Gracilis Packeten remote config server
|
||||||
|
xtel 1313/tcp # french minitel
|
||||||
|
xtelw 1314/tcp # french minitel
|
||||||
|
support 1529/tcp # GNATS
|
||||||
|
cfinger 2003/tcp # GNU Finger
|
||||||
|
frox 2121/tcp # frox: caching ftp proxy
|
||||||
|
zebrasrv 2600/tcp # zebra service
|
||||||
|
zebra 2601/tcp # zebra vty
|
||||||
|
ripd 2602/tcp # ripd vty (zebra)
|
||||||
|
ripngd 2603/tcp # ripngd vty (zebra)
|
||||||
|
ospfd 2604/tcp # ospfd vty (zebra)
|
||||||
|
bgpd 2605/tcp # bgpd vty (zebra)
|
||||||
|
ospf6d 2606/tcp # ospf6d vty (zebra)
|
||||||
|
ospfapi 2607/tcp # OSPF-API
|
||||||
|
isisd 2608/tcp # ISISd vty (zebra)
|
||||||
|
afbackup 2988/tcp # Afbackup system
|
||||||
|
afbackup 2988/udp
|
||||||
|
afmbackup 2989/tcp # Afmbackup system
|
||||||
|
afmbackup 2989/udp
|
||||||
|
fax 4557/tcp # FAX transmission service (old)
|
||||||
|
hylafax 4559/tcp # HylaFAX client-server protocol (new)
|
||||||
|
distmp3 4600/tcp # distmp3host daemon
|
||||||
|
munin 4949/tcp lrrd # Munin
|
||||||
|
enbd-cstatd 5051/tcp # ENBD client statd
|
||||||
|
enbd-sstatd 5052/tcp # ENBD server statd
|
||||||
|
pcrd 5151/tcp # PCR-1000 Daemon
|
||||||
|
noclog 5354/tcp # noclogd with TCP (nocol)
|
||||||
|
noclog 5354/udp # noclogd with UDP (nocol)
|
||||||
|
hostmon 5355/tcp # hostmon uses TCP (nocol)
|
||||||
|
hostmon 5355/udp # hostmon uses UDP (nocol)
|
||||||
|
rplay 5555/udp # RPlay audio service
|
||||||
|
nrpe 5666/tcp # Nagios Remote Plugin Executor
|
||||||
|
nsca 5667/tcp # Nagios Agent - NSCA
|
||||||
|
mrtd 5674/tcp # MRT Routing Daemon
|
||||||
|
bgpsim 5675/tcp # MRT Routing Simulator
|
||||||
|
canna 5680/tcp # cannaserver
|
||||||
|
syslog-tls 6514/tcp # Syslog over TLS [RFC5425]
|
||||||
|
sane-port 6566/tcp sane saned # SANE network scanner daemon
|
||||||
|
ircd 6667/tcp # Internet Relay Chat
|
||||||
|
zope-ftp 8021/tcp # zope management by ftp
|
||||||
|
tproxy 8081/tcp # Transparent Proxy
|
||||||
|
omniorb 8088/tcp # OmniORB
|
||||||
|
omniorb 8088/udp
|
||||||
|
clc-build-daemon 8990/tcp # Common lisp build daemon
|
||||||
|
xinetd 9098/tcp
|
||||||
|
mandelspawn 9359/udp mandelbrot # network mandelbrot
|
||||||
|
git 9418/tcp # Git Version Control System
|
||||||
|
zope 9673/tcp # zope server
|
||||||
|
webmin 10000/tcp
|
||||||
|
kamanda 10081/tcp # amanda backup services (Kerberos)
|
||||||
|
amandaidx 10082/tcp # amanda backup services
|
||||||
|
amidxtape 10083/tcp # amanda backup services
|
||||||
|
smsqp 11201/tcp # Alamin SMS gateway
|
||||||
|
smsqp 11201/udp
|
||||||
|
xpilot 15345/tcp # XPilot Contact Port
|
||||||
|
xpilot 15345/udp
|
||||||
|
sgi-cmsd 17001/udp # Cluster membership services daemon
|
||||||
|
sgi-crsd 17002/udp
|
||||||
|
sgi-gcd 17003/udp # SGI Group membership daemon
|
||||||
|
sgi-cad 17004/tcp # Cluster Admin daemon
|
||||||
|
isdnlog 20011/tcp # isdn logging system
|
||||||
|
isdnlog 20011/udp
|
||||||
|
vboxd 20012/tcp # voice box system
|
||||||
|
vboxd 20012/udp
|
||||||
|
binkp 24554/tcp # binkp fidonet protocol
|
||||||
|
asp 27374/tcp # Address Search Protocol
|
||||||
|
asp 27374/udp
|
||||||
|
csync2 30865/tcp # cluster synchronization tool
|
||||||
|
dircproxy 57000/tcp # Detachable IRC Proxy
|
||||||
|
tfido 60177/tcp # fidonet EMSI over telnet
|
||||||
|
fido 60179/tcp # fidonet EMSI over TCP
|
||||||
|
|
||||||
|
# Local services
|
||||||
Executable
Whitespace-only changes.
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
executable
|
||||||
Whitespace-only changes.
+7
-4
@@ -5,10 +5,13 @@ int main(void)
|
|||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
struct { char *file; int exist; } arr[] = {
|
struct { char *file; int exist; } arr[] = {
|
||||||
{ "/etc/passwd", 1 },
|
{ "data/fexist/regular", 1 },
|
||||||
{ "/etc/kalle", 0 },
|
{ "data/fexist/executable", 1 },
|
||||||
{ "/sbin/init", 1 },
|
{ "data/fexist/link", 1 },
|
||||||
{ "/dev/null", 1 },
|
{ "data/fexist/nonexistence", 0 },
|
||||||
|
{ "data/fexist/broken-link", 0 },
|
||||||
|
{ "data/fexist/dir", 1 },
|
||||||
|
{ "/dev/null", 1 },
|
||||||
{ NULL, 0 },
|
{ NULL, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#include "check.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
char *dir = "/tmp";
|
||||||
|
char *file = "__foo__";
|
||||||
|
|
||||||
|
printf("Pass 1/2: fopenf() ===========================\n");
|
||||||
|
fp = fopenf("w", "%s/%s", dir, file);
|
||||||
|
if (fp) {
|
||||||
|
fputs("foo", fp);
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
fail_unless(fexist("/tmp/__foo__"));
|
||||||
|
|
||||||
|
printf("Pass 2/2: fremove() ==========================\n");
|
||||||
|
fremove("%s/%s", dir, file);
|
||||||
|
fail_unless(!fexist("/tmp/__foo__"));
|
||||||
|
|
||||||
|
printf("DONE =========================================\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+5
-5
@@ -1,7 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
|
||||||
#define FSTAB "/etc/fstab"
|
#define FSTAB "data/lfile/fstab"
|
||||||
|
|
||||||
static int fstab(void)
|
static int fstab(void)
|
||||||
{
|
{
|
||||||
@@ -42,28 +42,28 @@ int main(void)
|
|||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
val = fgetint("/etc/protocols", " \n\t", "udp");
|
val = fgetint("data/lfile/protocols", " \n\t", "udp");
|
||||||
if (val == -1) {
|
if (val == -1) {
|
||||||
perror("Failed locating 'udp' protocol");
|
perror("Failed locating 'udp' protocol");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
printf("udp has proto %d\n", val);
|
printf("udp has proto %d\n", val);
|
||||||
|
|
||||||
val = fgetint("/etc/services", " /\n\t", "ftp");
|
val = fgetint("data/lfile/services", " /\n\t", "ftp");
|
||||||
if (val == -1) {
|
if (val == -1) {
|
||||||
perror("Failed locating 'ftp' service");
|
perror("Failed locating 'ftp' service");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
printf("ftp is inet port %d\n", val);
|
printf("ftp is inet port %d\n", val);
|
||||||
|
|
||||||
val = fgetint("/etc/group", "x:\n", "utmp");
|
val = fgetint("data/lfile/group", "x:\n", "utmp");
|
||||||
if (val == -1) {
|
if (val == -1) {
|
||||||
perror("Failed locating group 'utmp'");
|
perror("Failed locating group 'utmp'");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
printf("utmp is gid %d\n", val);
|
printf("utmp is gid %d\n", val);
|
||||||
|
|
||||||
val = fgetint("/etc/passwd", "x:\n", "nobody");
|
val = fgetint("data/lfile/passwd", "x:\n", "nobody");
|
||||||
if (val == -1) {
|
if (val == -1) {
|
||||||
perror("Failed locating user 'nobody'");
|
perror("Failed locating user 'nobody'");
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
+33
-11
@@ -4,6 +4,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
|
||||||
|
#define BASEDIR "/tmp/libite-test"
|
||||||
|
|
||||||
int checkpath(const char *dir)
|
int checkpath(const char *dir)
|
||||||
{
|
{
|
||||||
char tmp[256];
|
char tmp[256];
|
||||||
@@ -32,28 +34,48 @@ int test_makepath(const char *dir)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int test_fmkpath(const char *subdir)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = fmkpath(0755, "%s/%s", BASEDIR, subdir);
|
||||||
|
if (!ret) {
|
||||||
|
char tmp[256];
|
||||||
|
|
||||||
|
snprintf(tmp, sizeof(tmp), "%s/%s", BASEDIR, subdir);
|
||||||
|
ret = checkpath(tmp);
|
||||||
|
} else
|
||||||
|
perror("Failed");
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int i, ret = 0;
|
int i, ret = 0;
|
||||||
char *list[] = {
|
char *list[] = {
|
||||||
"/tmp/libite-test/tok/",
|
BASEDIR "/tok/",
|
||||||
"/tmp/libite-test/tok2",
|
BASEDIR "/tok2",
|
||||||
"/tmp/libite-test/ab",
|
BASEDIR "/ab",
|
||||||
"/tmp/libite-test/b",
|
BASEDIR "/b",
|
||||||
"/tmp/libite-test/a/",
|
BASEDIR "/a/",
|
||||||
"/tmp/libite-test/a/b",
|
BASEDIR "/a/b",
|
||||||
"/tmp/libite-test/a/c/",
|
BASEDIR "/a/c/",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
printf("Testing makepath() ...\n");
|
mkdir(BASEDIR, 0755);
|
||||||
mkdir("/tmp/libite-test", 0755);
|
|
||||||
|
|
||||||
|
printf("Pass 1/2: makepath() =========================\n");
|
||||||
for (i = 0; list[i] && !ret; i++)
|
for (i = 0; list[i] && !ret; i++)
|
||||||
ret |= test_makepath(list[i]);
|
ret |= test_makepath(list[i]);
|
||||||
|
|
||||||
printf("\nCleaning up ...\n");
|
printf("Pass 2/2: fmkpath() ==========================\n");
|
||||||
system("rm -rf /tmp/libite-test");
|
for (i = 0; list[i] && !ret; i++)
|
||||||
|
ret |= test_fmkpath(list[i] + strlen(BASEDIR) + 1);
|
||||||
|
|
||||||
|
printf("Done: Cleaning up ============================\n");
|
||||||
|
system("rm -rf " BASEDIR);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#include <stdlib.h> /* atexit() */
|
||||||
|
#include <unistd.h> /* usleep() */
|
||||||
|
|
||||||
|
#include "check.h"
|
||||||
|
|
||||||
|
#define SCREEN_WIDTH 80
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
FILE *fp = stderr;
|
||||||
|
char buf[SCREEN_WIDTH];
|
||||||
|
|
||||||
|
printhdr(fp, "", 0, UNDERSCORE);
|
||||||
|
printhdr(fp, "Neighbor Table", 0, 0);
|
||||||
|
snprintf(buf, sizeof(buf), "%-15s %-15s %7s %-5s%10s %6s",
|
||||||
|
"Neighbor", "Interface", "Version", "Flags", "Uptime", "Expire");
|
||||||
|
printhdr(fp, buf, 0, REVERSE);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
#include "../src/strlite.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
char buf[10];
|
||||||
|
int val;
|
||||||
|
|
||||||
|
val = atonum("42");
|
||||||
|
if (val != 42)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (!string_match("eth1", "eth1234"))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (string_compare("eth1", "eth1234"))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (!string_case_compare("somestring", "SoMeSTRING"))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
strlcpy(buf, "tooloongstring", sizeof(buf));
|
||||||
|
if (buf[9] == 'r')
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#include "check.h"
|
||||||
|
#define SYSLOG_NAMES
|
||||||
|
#include <syslog.h>
|
||||||
|
|
||||||
|
#define SEVERITY_LEVEL { \
|
||||||
|
CHOOSE(SEVERITY_NONE, "none"), \
|
||||||
|
CHOOSE(SEVERITY_DEBUG, "debug"), \
|
||||||
|
CHOOSE(SEVERITY_INFO, "info"), \
|
||||||
|
CHOOSE(SEVERITY_NOTICE, "notice"), \
|
||||||
|
CHOOSE(SEVERITY_WARNING, "warning"), \
|
||||||
|
CHOOSE(SEVERITY_ERR, "err"), \
|
||||||
|
CHOOSE(SEVERITY_CRIT, "crit"), \
|
||||||
|
CHOOSE(SEVERITY_ALERT, "alert"), \
|
||||||
|
CHOOSE(SEVERITY_EMERG, "emerg") \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHOOSE(a, b) b
|
||||||
|
const char *levels[] = SEVERITY_LEVEL;
|
||||||
|
|
||||||
|
#undef CHOOSE
|
||||||
|
#define CHOOSE(a, b) a
|
||||||
|
typedef enum SEVERITY_LEVEL severity_level_t;
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
int num;
|
||||||
|
struct {
|
||||||
|
char *str;
|
||||||
|
int val;
|
||||||
|
} t[] = {
|
||||||
|
{ "warn", SEVERITY_WARNING },
|
||||||
|
{ "alert", SEVERITY_ALERT },
|
||||||
|
{ NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; t[i].str; i++) {
|
||||||
|
num = strmatch(t[i].str, levels);
|
||||||
|
fail_unless(num >= 0);
|
||||||
|
fail_unless(num == t[i].val);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#include <err.h>
|
||||||
|
#include "check.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
struct { char *cmd; int rc; } list[] = {
|
||||||
|
{ "false", 1 },
|
||||||
|
{ "true", 0 },
|
||||||
|
{ "kill -9 $$", 1 },
|
||||||
|
{ "kill -QUIT $$", -1 },
|
||||||
|
{ "kill -INT $$", -1 }
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0; i < NELEMS(list); i++) {
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
rc = systemf("%s", list[i].cmd);
|
||||||
|
if (rc != list[i].rc)
|
||||||
|
err(rc, "Failed command %s", list[i].cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local Variables:
|
||||||
|
* indent-tabs-mode: t
|
||||||
|
* c-file-style: "linux"
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
|
||||||
+7
-7
@@ -11,16 +11,16 @@ int main(void)
|
|||||||
int result = 0;
|
int result = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
struct tc test[] = {
|
struct tc test[] = {
|
||||||
{ "ls", 1 },
|
{ "executable", 1 },
|
||||||
{ "free", 1 },
|
{ "executable -h", 1 },
|
||||||
{ "modinfo", 1 },
|
{ "executable-link", 1 },
|
||||||
{ "useradd", 1 },
|
{ "regular", 0 },
|
||||||
{ "/bin/which", 1 },
|
{ "ls", 1 },
|
||||||
{ "/bin/ps aux", 1 },
|
{ "/usr/bin/which", 1 },
|
||||||
{ "/etc/passwd", 0 },
|
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setenv("PATH", "data/which:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin", 1);
|
||||||
for (i = 0; test[i].cmd; i++) {
|
for (i = 0; test[i].cmd; i++) {
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
#include "check.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int chan[2];
|
||||||
|
int status;
|
||||||
|
|
||||||
|
pipe(chan);
|
||||||
|
|
||||||
|
if (fork() > 0) {
|
||||||
|
dup2(chan[0], STDIN_FILENO);
|
||||||
|
if (yorn("Do you really wanna do this (y/N)? ")) {
|
||||||
|
printf("Affirmative!\n");
|
||||||
|
_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("OK, aborting!\n");
|
||||||
|
_exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
|
if (write(chan[1], "Y", 1) != 1)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
wait(&status);
|
||||||
|
|
||||||
|
return WEXITSTATUS(status);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user