serialconsole: update to 1.0
Add license information. Add PKG_INSTALL and PKG_BUILD_PARALLEL for consistency between packages. Minor cleanups. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
f7041ed34a
commit
0e510a1b9a
2 changed files with 10 additions and 76 deletions
|
@ -8,15 +8,19 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sc
|
||||
PKG_VERSION:=0.95
|
||||
PKG_RELEASE:=2
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@SF/serialconsole/sc
|
||||
PKG_HASH:=5ae99b370a5a3feb38372b383edc23012b5be5d81547aeb1ac52b408037c1d1c
|
||||
PKG_MAINTAINER:=Stefan Bethke <stb@lassitu.de>
|
||||
PKG_HASH:=2e7a27d588a51173dda3093381604e6f0a16bb04e95b00fd652f37c34c2c6d04
|
||||
|
||||
PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_MAINTAINER:=Stefan Bethke <stb@lassitu.de>
|
||||
PKG_LICENSE:=BSD-2-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
@ -35,7 +39,7 @@ endef
|
|||
|
||||
define Package/serialconsole/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/sc $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/bin/sc $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,serialconsole))
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
--- a/sc.c
|
||||
+++ b/sc.c
|
||||
@@ -34,6 +34,7 @@ static const char __rcsid[] =
|
||||
#include <sysexits.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
+#include <time.h>
|
||||
|
||||
|
||||
#if !defined(SC_VERSION)
|
||||
@@ -344,7 +345,7 @@ loop(int sfd, int escchr, int msdelay)
|
||||
FD_SET(STDIN_FILENO, fds+1);
|
||||
FD_SET(sfd, fds+1);
|
||||
while (scrunning) {
|
||||
- bcopy(fds+1, fds, sizeof(*fds));
|
||||
+ memcpy(fds, fds+1, sizeof(*fds));
|
||||
if ((i = select(sfd+1, fds, NULL, NULL, NULL)) < 0
|
||||
&& errno != EINTR) {
|
||||
warn("select()");
|
||||
@@ -353,7 +354,7 @@ loop(int sfd, int escchr, int msdelay)
|
||||
#else
|
||||
struct pollfd pfds[2];
|
||||
|
||||
- bzero(pfds, sizeof(pfds));
|
||||
+ memset(pfds, 0, sizeof(pfds));
|
||||
pfds[0].fd = STDIN_FILENO;
|
||||
pfds[0].events = POLLIN;
|
||||
pfds[1].fd = sfd;
|
||||
@@ -453,8 +454,10 @@ loop(int sfd, int escchr, int msdelay)
|
||||
continue;
|
||||
}
|
||||
i = write(sfd, &c, 1);
|
||||
- if(c == '\n' && msdelay > 0)
|
||||
- usleep(msdelay*1000);
|
||||
+ if(c == '\n' && msdelay > 0) {\
|
||||
+ struct timespec d = {msdelay / 1000, (msdelay % 1000 ) * 1000 * 1000};
|
||||
+ nanosleep(&d, NULL);
|
||||
+ }
|
||||
}
|
||||
if (i < 0) {
|
||||
warn("read/write");
|
||||
@@ -603,8 +606,8 @@ main(int argc, char **argv)
|
||||
if (strlen(path_dev) + strlen(tty) > PATH_MAX) {
|
||||
errx(EX_USAGE, "Device name \"%s\" is too long.", tty);
|
||||
}
|
||||
- bcopy(path_dev, buffer, strlen(path_dev)+1);
|
||||
- bcopy(tty, buffer+strlen(path_dev), strlen(tty)+1);
|
||||
+ memcpy(buffer, path_dev, strlen(path_dev)+1);
|
||||
+ memcpy(buffer+strlen(path_dev), tty, strlen(tty)+1);
|
||||
tty = buffer;
|
||||
}
|
||||
sfd = open(tty, O_RDWR);
|
||||
@@ -622,7 +625,7 @@ main(int argc, char **argv)
|
||||
err(EX_OSERR, "tcgetattr(%s)", tty);
|
||||
}
|
||||
/* configure serial port */
|
||||
- bcopy(&serialti, &tempti, sizeof(tempti));
|
||||
+ memcpy(&tempti, &serialti, sizeof(tempti));
|
||||
cfmakeraw(&tempti);
|
||||
tempti.c_cc[VMIN] = 1;
|
||||
tempti.c_cc[VTIME] = 0;
|
||||
@@ -660,7 +663,7 @@ main(int argc, char **argv)
|
||||
close(sfd);
|
||||
err(EX_OSERR, "fcntl() tty");
|
||||
}
|
||||
- bcopy(&consoleti, &tempti, sizeof(tempti));
|
||||
+ memcpy(&tempti, &consoleti, sizeof(tempti));
|
||||
cfmakeraw(&tempti);
|
||||
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &tempti)) {
|
||||
ec = EX_OSERR;
|
Loading…
Reference in a new issue