CVS commit: src/usr.sbin/sti
Module Name:src Committed By: dholland Date: Tue Aug 14 08:08:29 UTC 2012 Modified Files: src/usr.sbin/sti: sti.8 Log Message: Improve DESCRIPTION, fix up English usage. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sti/sti.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/sti/sti.8 diff -u src/usr.sbin/sti/sti.8:1.6 src/usr.sbin/sti/sti.8:1.7 --- src/usr.sbin/sti/sti.8:1.6 Fri Aug 28 21:19:13 2009 +++ src/usr.sbin/sti/sti.8 Tue Aug 14 08:08:29 2012 @@ -1,4 +1,4 @@ -.\" $NetBSD: sti.8,v 1.6 2009/08/28 21:19:13 hubertf Exp $ +.\" $NetBSD: sti.8,v 1.7 2012/08/14 08:08:29 dholland Exp $ .\" .\" Copyright (c) 2005 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 10, 2005 +.Dd August 14, 2012 .Dt STI 8 .Os .Sh NAME @@ -39,20 +39,20 @@ .Op Ar string ... .Sh DESCRIPTION .Nm -will send the provided -.Ar string -to the +connects to the specified .Ar tty -specified in the command line using +and uses the +.Dv TIOCSTI .Xr ioctl 2 -.Dv TIOCSTI , -or send the standard input if no -.Ar string -is supplied. +to enter text as if it were typed in. This .Xr ioctl 2 is limited to the superuser. .Pp +.Nm +will send the provided +.Ar string +if any; otherwise it sends the standard input. The .Ar string is interpreted using @@ -63,7 +63,7 @@ is interpreted using .Sh HISTORY The .Nm -first appeared at +command first appeared in .Nx 4.0 . .Sh AUTHORS The
CVS commit: src/usr.sbin/sti
Module Name:src Committed By: hubertf Date: Fri Aug 28 21:19:13 UTC 2009 Modified Files: src/usr.sbin/sti: sti.8 Log Message: improve wording a bit To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/sti/sti.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/sti/sti.8 diff -u src/usr.sbin/sti/sti.8:1.5 src/usr.sbin/sti/sti.8:1.6 --- src/usr.sbin/sti/sti.8:1.5 Wed Apr 30 13:11:03 2008 +++ src/usr.sbin/sti/sti.8 Fri Aug 28 21:19:13 2009 @@ -1,4 +1,4 @@ -.\" $NetBSD: sti.8,v 1.5 2008/04/30 13:11:03 martin Exp $ +.\" $NetBSD: sti.8,v 1.6 2009/08/28 21:19:13 hubertf Exp $ .\" .\" Copyright (c) 2005 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -46,9 +46,9 @@ specified in the command line using .Xr ioctl 2 .Dv TIOCSTI , -or send the standard input if a +or send the standard input if no .Ar string -is not supplied. +is supplied. This .Xr ioctl 2 is limited to the superuser.
CVS commit: src/usr.sbin/sti
Module Name:src Committed By: christos Date: Thu Aug 27 19:40:06 UTC 2009 Modified Files: src/usr.sbin/sti: sti.c Log Message: port to non NetBSD systems. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/sti/sti.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/sti/sti.c diff -u src/usr.sbin/sti/sti.c:1.7 src/usr.sbin/sti/sti.c:1.8 --- src/usr.sbin/sti/sti.c:1.7 Mon Apr 28 16:24:17 2008 +++ src/usr.sbin/sti/sti.c Thu Aug 27 15:40:06 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sti.c,v 1.7 2008/04/28 20:24:17 martin Exp $ */ +/* $NetBSD: sti.c,v 1.8 2009/08/27 19:40:06 christos Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -29,7 +29,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: sti.c,v 1.7 2008/04/28 20:24:17 martin Exp $"); +#ifdef __RCSID +__RCSID("$NetBSD: sti.c,v 1.8 2009/08/27 19:40:06 christos Exp $"); +#endif #include #include @@ -40,14 +42,21 @@ #include #include #include -#include #include +#ifdef __RCSID +#include +#else +#define setprogname(a) +extern const char *__progname; +#define getprogname() __progname +#endif static int unescape(const char **pp, int *state) { char ch, out; +#ifdef __RCSID while ((ch = *(*pp)++) != '\0') { switch(unvis(&out, ch, state, 0)) { case 0: @@ -65,6 +74,48 @@ } if (unvis(&out, '\0', state, UNVIS_END) == UNVIS_VALID) return out; +#else + switch ((ch = *(*pp)++)) { + case '\0': + goto out; + case '^': + ch = *(*pp)++; + return CTRL(ch); + case '\\': + switch (ch = *(*pp)++) { + case 'a': return '\a'; + case 'b': return '\b'; + case 'e': return '\e'; + case 'f': return '\f'; + case 't': return '\t'; + case 'n': return '\n'; + case 'r': return '\r'; + case 'v': return '\v'; + case '\\': return '\\'; + + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + out = 0; + if (ch >= '0' && ch < '8') { +out = out * 8 + ch - '0'; +ch = *(*pp)++; +if (ch >= '0' && ch < '8') { + out = out * 8 + ch - '0'; + ch = *(*pp)++; + if (ch >= '0' && ch < '8') + out = out * 8 + ch - '0'; +} + } + return out; + default: + break; + } + break; + default: + return ch; + } +out: +#endif errno = ENODATA; return -1; } @@ -127,10 +178,21 @@ if (argc == 0) { char *line; +#ifndef __RCSID + line = malloc(10240); + while (fgets(line, 10240, stdin) != NULL) { + char *p; + if ((p = strrchr(line, '\n')) != NULL) +*p = '\0'; + sendstr(fd, line); + } + free(line); +#else while ((line = fparseln(stdin, NULL, NULL, NULL, 0)) != NULL) { sendstr(fd, line); free(line); } +#endif } else { for (; argc--; argv++) { sendstr(fd, *argv);