From owner-svn-ports-head@freebsd.org Wed Aug 9 12:08:40 2017 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B094EDCB808; Wed, 9 Aug 2017 12:08:40 +0000 (UTC) (envelope-from woodsb02@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89F436F824; Wed, 9 Aug 2017 12:08:40 +0000 (UTC) (envelope-from woodsb02@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v79C8dbw081614; Wed, 9 Aug 2017 12:08:39 GMT (envelope-from woodsb02@FreeBSD.org) Received: (from woodsb02@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v79C8d91081610; Wed, 9 Aug 2017 12:08:39 GMT (envelope-from woodsb02@FreeBSD.org) Message-Id: <201708091208.v79C8d91081610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: woodsb02 set sender to woodsb02@FreeBSD.org using -f From: Ben Woods Date: Wed, 9 Aug 2017 12:08:39 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r447625 - in head/sysutils: . chvt chvt/files X-SVN-Group: ports-head X-SVN-Commit-Author: woodsb02 X-SVN-Commit-Paths: in head/sysutils: . chvt chvt/files X-SVN-Commit-Revision: 447625 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 12:08:40 -0000 Author: woodsb02 Date: Wed Aug 9 12:08:39 2017 New Revision: 447625 URL: https://svnweb.freebsd.org/changeset/ports/447625 Log: Add new port sysutils/chvt The command chvt N makes /dev/ttyv(N-1) the foreground terminal. The key combination Ctrl-Alt-FN (with N in the range 1-12) has a similar effect. WWW: https://lists.debian.org/debian-bsd/2009/11/msg00006.html Added: head/sysutils/chvt/ head/sysutils/chvt/Makefile (contents, props changed) head/sysutils/chvt/files/ head/sysutils/chvt/files/chvt.c (contents, props changed) head/sysutils/chvt/pkg-descr (contents, props changed) Modified: head/sysutils/Makefile Modified: head/sysutils/Makefile ============================================================================== --- head/sysutils/Makefile Wed Aug 9 12:01:10 2017 (r447624) +++ head/sysutils/Makefile Wed Aug 9 12:08:39 2017 (r447625) @@ -154,6 +154,7 @@ SUBDIR += cfengine38 SUBDIR += cfengine39 SUBDIR += chgrep + SUBDIR += chvt SUBDIR += chyves SUBDIR += cinnamon-control-center SUBDIR += cinnamon-settings-daemon Added: head/sysutils/chvt/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/chvt/Makefile Wed Aug 9 12:08:39 2017 (r447625) @@ -0,0 +1,36 @@ +# Created by: Ben Woods +# $FreeBSD$ + +PORTNAME= chvt +PORTVERSION= 0.20091101 +CATEGORIES= sysutils +MASTER_SITES= # +DISTFILES= # + +MAINTAINER= woodsb02@FreeBSD.org +COMMENT= Change foreground virtual terminal + +LICENSE= GNUALLPERMISSIVE +LICENSE_NAME= GNU All-Permissive License +LICENSE_TEXT= See https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html +LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept + +PLIST_FILES= bin/chvt + +OPTIONS_DEFINE= SETUID +SETUID_DESC= Install setuid binary (does not require root priviledges) + +do-extract: + ${MKDIR} ${WRKSRC} +# ${CP} ${FILESDIR}/chvt.c ${WRKSRC}/ + +do-build: + cd ${WRKSRC} && ${CC} -o ${WRKSRC}/chvt ${FILESDIR}/chvt.c + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/chvt ${STAGEDIR}${PREFIX}/bin/chvt + +post-install-SETUID-on: + ${CHMOD} u+s ${STAGEDIR}${PREFIX}/bin/chvt + +.include Added: head/sysutils/chvt/files/chvt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/chvt/files/chvt.c Wed Aug 9 12:08:39 2017 (r447625) @@ -0,0 +1,68 @@ +/* chvt.c - change virtual terminal for [k]freebsd + Copyright (C) 2009 Werner Koch + + This file is free software; as a special exception the author gives + unlimited permission to copy and/or distribute it, with or without + modifications, as long as this notice is preserved. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, to the extent permitted by law; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. */ + +#include +#include +#include +#include +#include +#include +#include +#include + + +int +main (int argc, char **argv) +{ + int fd, screen; + + if (argc < 1 || argc > 2) + { + fputs ("Usage: chvt [VTNO]\n", stderr); + return 1; + } + if (argc == 2) + { + screen = atoi (argv[1]); + + if (screen < 1 || screen > 11) + { + fprintf (stderr, "chvt: invalid screen numver %d\n", screen); + return 1; + } + } + + fd = open ("/dev/ttyv0", O_RDWR, 0); + if (fd == -1) + { + fprintf (stderr, "chvt: error opening terminal: %s\n", strerror (errno)); + return 1; + } + if (argc == 2) + { + if (ioctl (fd, VT_ACTIVATE, screen)) + { + fprintf (stderr, "chvt: VT_ACTIVATE failed: %s\n", strerror (errno)); + return 1; + } + } + else + { + if (ioctl (fd, VT_GETACTIVE, &screen)) + { + fprintf (stderr, "chvt: VT_GETACTIVE failed: %s\n", strerror (errno)); + return 1; + } + printf ("%d\n", screen); + } + return 0; +} Added: head/sysutils/chvt/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/chvt/pkg-descr Wed Aug 9 12:08:39 2017 (r447625) @@ -0,0 +1,4 @@ +The command chvt N makes /dev/ttyv(N-1) the foreground terminal. +The key combination Ctrl-Alt-FN (with N in the range 1-12) has a similar effect. + +WWW: https://lists.debian.org/debian-bsd/2009/11/msg00006.html