[Mageia-sysadm] [415] Import cleaned numlock

root at mageia.org root at mageia.org
Thu Feb 3 23:38:52 CET 2011


Revision: 415
Author:   dmorgan
Date:     2011-02-03 23:38:52 +0100 (Thu, 03 Feb 2011)
Log Message:
-----------
Import cleaned numlock

Added Paths:
-----------
    numlock/
    numlock/CLEANUP_PROGRESS.txt
    numlock/trunk/
    numlock/trunk/Makefile
    numlock/trunk/enable_X11_numlock.c
    numlock/trunk/man/
    numlock/trunk/man/C/
    numlock/trunk/man/C/enable_X11_numlock.1
    numlock/trunk/man/cs/
    numlock/trunk/man/cs/enable_X11_numlock.1
    numlock/trunk/man/et/
    numlock/trunk/man/et/enable_X11_numlock.1
    numlock/trunk/man/eu/
    numlock/trunk/man/eu/enable_X11_numlock.1
    numlock/trunk/man/fi/
    numlock/trunk/man/fi/enable_X11_numlock.1
    numlock/trunk/man/fr/
    numlock/trunk/man/fr/enable_X11_numlock.1
    numlock/trunk/man/it/
    numlock/trunk/man/it/enable_X11_numlock.1
    numlock/trunk/man/nl/
    numlock/trunk/man/nl/enable_X11_numlock.1
    numlock/trunk/man/ru/
    numlock/trunk/man/ru/enable_X11_numlock.1
    numlock/trunk/man/uk/
    numlock/trunk/man/uk/enable_X11_numlock.1
    numlock/trunk/numlock.init
    numlock/trunk/numlock.sh
    numlock/trunk/numlock.xinit

Added: numlock/CLEANUP_PROGRESS.txt
===================================================================
--- numlock/CLEANUP_PROGRESS.txt	                        (rev 0)
+++ numlock/CLEANUP_PROGRESS.txt	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,3 @@
+- License is GPL according to the relevant rpm spec written by Mandriva
+- Occurances of "Linux Mandrake Manual" (with slight variations) in the bundles
+  manpages


Property changes on: numlock/CLEANUP_PROGRESS.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Added: numlock/trunk/Makefile
===================================================================
--- numlock/trunk/Makefile	                        (rev 0)
+++ numlock/trunk/Makefile	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,42 @@
+NAME = numlock
+VERSION = 2.1.2
+
+TOP=
+CFLAGS=-g -O2 -Wall
+CC=gcc
+FLAGS=-lX11 -lXtst
+
+enable_X11_numlock: enable_X11_numlock.c
+	$(CC) $(CFLAGS) $(FLAGS) -o $@ $<
+
+all: enable_X11_numlock
+
+clean:
+	rm -f enable_X11_numlock core *.o
+
+install: all
+	install -d $(TOP)/usr/{bin,share/man/man1}/
+	install -d $(TOP)/etc/profile.d
+	install -d $(TOP)/$(INITRDDIR)
+	install -d $(TOP)/etc/X11/xinit.d
+
+	install -m755 enable_X11_numlock $(TOP)/usr/bin
+	install -m755 man/C/enable_X11_numlock.1 $(TOP)/usr/share/man/man1/
+	for i in man/??* ; do \
+	    install -d $(TOP)/usr/share/man/`basename $$i`/man1 ; \
+	    install -m 644 $$i/*.1 $(TOP)/usr/share/man/`basename $$i`/man1 ; \
+	done	
+
+	install -m755 numlock.init $(TOP)/$(INITRDDIR)/$(NAME)
+	install -m755 numlock.sh $(TOP)/etc/profile.d/
+	install -m755 numlock.xinit $(TOP)/etc/X11/xinit.d/numlock
+
+dis: clean
+	rm -rf $(NAME)-$(VERSION) ../$(NAME)-$(VERSION).tar*
+	mkdir -p $(NAME)-$(VERSION)
+	find . -not -name "$(NAME)-$(VERSION)"|cpio -pd $(NAME)-$(VERSION)/
+	find $(NAME)-$(VERSION) -type d -name .svn -o -name unused |xargs rm -rf
+	tar cf ../$(NAME)-$(VERSION).tar $(NAME)-$(VERSION)
+	bzip2 -9f ../$(NAME)-$(VERSION).tar
+	chmod 644 ../$(NAME)-$(VERSION).tar.bz2
+	rm -rf $(NAME)-$(VERSION)


Property changes on: numlock/trunk/Makefile
___________________________________________________________________
Added: svn:eol-style
   + native

Added: numlock/trunk/enable_X11_numlock.c
===================================================================
--- numlock/trunk/enable_X11_numlock.c	                        (rev 0)
+++ numlock/trunk/enable_X11_numlock.c	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,119 @@
+/****************************************************************************
+
+ NumlockX -  (C) 2000 Lubos Lunak <l.lunak at email.cz>
+ Released under the terms of the GNU General Public License
+
+ main.c  -
+ 
+ $Id: enable_X11_numlock.c 158725 2001-03-29 11:17:40Z gc $
+
+****************************************************************************/
+
+/* The NumLock state detection code is originally from KLeds by
+   Hans Matzen <hans at tm.informatik.uni-frankfurt.de>  */
+
+#define __main_C
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <X11/extensions/XTest.h>
+#include <X11/keysym.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define HAS_XKB 1
+#ifdef HAS_XKB
+#include <X11/XKBlib.h>
+#endif
+
+void usage( const char* argv0 )
+    {
+    printf( "NumlockX - (C) 2000 Lubos Lunak <l.lunak at email.cz>\n\n"
+#ifdef HAS_XKB
+        "Usage : %s [on|off|switch]\n"
+        "on     - sets NumLock on in X (default)\n"
+        "off    - sets NumLock off in X\n"
+        "switch - changes NumLock state in X\n"
+#else
+        "Usage : %s\n"
+        "Changes NumLock state in X\n"
+        "( NumLock state detection not available,"
+        " compiled without XKB )\n"
+#endif
+        "\n"
+        , argv0 );
+    }
+
+Display* disp;
+
+#ifdef HAS_XKB
+int get_numlock_state()
+    {
+    unsigned int states;
+    if( XkbGetIndicatorState( disp, XkbUseCoreKbd, &states) != Success )
+        {
+        printf("Error while reading Indicator status\n");
+        XCloseDisplay( disp );
+        exit( 3 );
+        }
+    return states & 0x02; /* NumLock appears to be bit1 */
+    }
+#endif
+
+void change_numlock()
+    {
+    XTestFakeKeyEvent( disp, XKeysymToKeycode( disp, XK_Num_Lock ), True, CurrentTime );
+    XTestFakeKeyEvent( disp, XKeysymToKeycode( disp, XK_Num_Lock ), False, CurrentTime );
+    }
+
+#ifdef HAS_XKB
+void set_on()
+    {
+    if( !get_numlock_state())
+        change_numlock();
+    }
+
+void set_off()
+    {
+    if( get_numlock_state())
+        change_numlock();
+    }
+#endif
+
+int main( int argc, char* argv[] )
+    {
+	if( argc > 2 )
+	    {
+        usage( argv[ 0 ] );
+        return 1;
+        }
+    disp = XOpenDisplay( NULL );
+    if( disp == NULL )
+        {
+        printf( "Error opening display\n" );
+        return 2;
+        }
+    if( argc == 1 )
+#if HAS_XKB
+        set_on();
+    else if( strncmp( argv[ 1 ], "on", 2 ) == 0 )
+        set_on();
+    else if( strncmp( argv[ 1 ], "of", 2 ) == 0 )
+        set_off();
+#else
+        change_numlock(); /* if( argc == 1 ) */
+#endif
+    else if( strncmp( argv[ 1 ], "switch", 6 ) == 0 )
+        change_numlock();
+    else
+        {
+        usage( argv[ 0 ] );
+        XCloseDisplay( disp );
+        return 1;
+        }
+    XCloseDisplay( disp );
+    return 0;
+    }


Property changes on: numlock/trunk/enable_X11_numlock.c
___________________________________________________________________
Added: svn:eol-style
   + native

Added: numlock/trunk/man/C/enable_X11_numlock.1
===================================================================
--- numlock/trunk/man/C/enable_X11_numlock.1	                        (rev 0)
+++ numlock/trunk/man/C/enable_X11_numlock.1	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,17 @@
+.TH Enable_X11_Numlock "9 Jan 2001" " Mageia Manual"
+.SH NAME
+enable_X11_numlock \- Enable X11 numlock
+.SH SYNOPSIS
+.BI enable_X11_numlock
+[on]
+[off]
+[switch]
+.SH DESCRIPTION
+The command
+.B enable_X11_numlock
+turns on, off, or switches the numlock under X. Default behaviour (e.g.
+when no option is given) is to turn it on.
+
+.SH "SEE ALSO"
+
+.BR X (1).

Added: numlock/trunk/man/cs/enable_X11_numlock.1
===================================================================
--- numlock/trunk/man/cs/enable_X11_numlock.1	                        (rev 0)
+++ numlock/trunk/man/cs/enable_X11_numlock.1	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,16 @@
+.TH Enable_X11_Numlock "9 Led 2001" "Manuál Mageia "
+.SH NÁZEV
+enable_X11_numlock \- Zapne klávesu klávesu NumLock v systému X11
+.SH SYNAPSE
+.BI enable_X11_numlock
+[on]
+[off]
+[switch]
+.SH POPIS
+Příkaz
+.B enable_X11_numlock
+zapne, vypne, nebo přepne klávesu NumLock v systému X. Výchozí chování (pokud není zadán žádný parametr) je klávesu NumLock zapnout.
+
+.SH "VIZ TAKÉ"
+
+.BR X(1).

Added: numlock/trunk/man/et/enable_X11_numlock.1
===================================================================
--- numlock/trunk/man/et/enable_X11_numlock.1	                        (rev 0)
+++ numlock/trunk/man/et/enable_X11_numlock.1	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,14 @@
+.TH "Enable_X11_Numlock" "9. jaanuar 2001" "Mageia i käsiraamat" "" ""
+.SH "NIMI"
+enable_X11_numlock \- X11 numlocki lubamine
+.SH "KOKKUVÕTE"
+.BI enable_X11_numlock
+[on]
+[off]
+[switch]
+.SH "KIRJELDUS"
+Käsk
+.B enable_X11_numlock
+lülitab numlock\-i X\-i all sisse, välja või lülitab vastavalt ümber. Vaikimisi (st ilma võtmeta) lülitatakse see sisse.
+.SH "VAATA KA"
+.BR X (1).

Added: numlock/trunk/man/eu/enable_X11_numlock.1
===================================================================
--- numlock/trunk/man/eu/enable_X11_numlock.1	                        (rev 0)
+++ numlock/trunk/man/eu/enable_X11_numlock.1	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,18 @@
+.TH Enable_X11_Numlock "2001eko urtarrilak 9" " Mageia-ren eskuliburua"
+.SH IZENA
+enable_X11_numlock \- X11 zenbaki-blokeoa gaitzen du
+.SH LABURPENA
+.BI enable_X11_numlock
+[aktibatu]
+[desaktibatu]
+[aldatu]
+.SH AZALPENA
+Komando honek,
+.BI enable_X11_numlock,
+Xren araberako zenbaki-blokeoa aktibatu, desaktibatu edo aldatu egiten du. Lehenetsita dagoen jokabidea
+(inolako aukerarik egiten ez denean) aktibatuta egotea da.
+
+.SH "IKUSI BAITA ERE"
+
+.BR X (1).
+

Added: numlock/trunk/man/fi/enable_X11_numlock.1
===================================================================
--- numlock/trunk/man/fi/enable_X11_numlock.1	                        (rev 0)
+++ numlock/trunk/man/fi/enable_X11_numlock.1	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,15 @@
+.TH Enable_X11_Numlock "9 Jan 2001" "Mageia  Manual"
+.SH NIMI
+enable_X11_numlock \- Ota X11 numlock käyttöön
+.SH YLEISKATSAUS
+.BI enable_X11_numlock
+[on]
+[off]
+[switch]
+.SH KUVAUS
+Komento
+.B enable_X11_numlock
+kytkee päälle/pois päältä tai vaihtaa numlock:in tilaa X:än alla.
+Oletustoiminto (jos optiota ei annettu) on numlock:in päällekytkeminen.
+.SH "KATSO MYÖS"
+.BR X (1).

Added: numlock/trunk/man/fr/enable_X11_numlock.1
===================================================================
--- numlock/trunk/man/fr/enable_X11_numlock.1	                        (rev 0)
+++ numlock/trunk/man/fr/enable_X11_numlock.1	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,18 @@
+.TH Enable_X11_Numlock "9 Jan 2001" " Mageia Manual"
+.SH NAME
+enable_X11_numlock \- Active la fonction « numlock » dans X11
+.SH SYNOPSIS
+.BI enable_X11_numlock
+[on]
+[off]
+[switch]
+.SH DESCRIPTION
+La commande
+.B enable_X11_numlock
+active, désactive, ou commute la fonction « numlock » dans X, respectivement.
+Le comportement par défaut (par ex. quand aucune option n'est spécifiée) est
+de l'activer.
+
+.SH "VOIR AUSSI"
+
+.BR X (1).

Added: numlock/trunk/man/it/enable_X11_numlock.1
===================================================================
--- numlock/trunk/man/it/enable_X11_numlock.1	                        (rev 0)
+++ numlock/trunk/man/it/enable_X11_numlock.1	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,17 @@
+.TH Enable_X11_Numlock "9 gen 2001" " Mageia Manual"
+.SH NOME
+enable_X11_numlock \- Abilita il numlock in X11
+.SH SINTASSI
+.BI enable_X11_numlock
+[on]
+[off]
+[switch]
+.SH DESCRIZIONE
+Il comando
+.B enable_X11_numlock
+attiva, disattiva o scambia lo stato del numlock sotto X. Il comportamento predefinito (per es. 
+se non si specifica un opzione) è di attivarlo.
+
+.SH "VEDI ANCHE"
+
+.BR X (1).

Added: numlock/trunk/man/nl/enable_X11_numlock.1
===================================================================
--- numlock/trunk/man/nl/enable_X11_numlock.1	                        (rev 0)
+++ numlock/trunk/man/nl/enable_X11_numlock.1	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,17 @@
+.TH Enable_X11_Numlock "9 Jan 2001" " Mageia Manual"
+.SH NAME
+enable_X11_numlock \- schakelt numlock onder X11 in en uit
+.SH SYNOPSIS
+.BI enable_X11_numlock
+[on]
+[off]
+[switch]
+.SH BESCHRIJVING
+De opdracht
+.B enable_X11_numlock
+schakelt numlock onder X in, uit of om. Standaard (dat wil zeggen:
+zonder opgegeven optie) wordt numlock ingeschakeld.
+
+.SH "ZIE OOK"
+
+.BR X (1).

Added: numlock/trunk/man/ru/enable_X11_numlock.1
===================================================================
--- numlock/trunk/man/ru/enable_X11_numlock.1	                        (rev 0)
+++ numlock/trunk/man/ru/enable_X11_numlock.1	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,20 @@
+.TH Enable_X11_Numlock "9 Jan 2001" " Mageia Manual"
+.SH НАЗВАНИЕ
+enable_X11_numlock \- включает X11 numlock
+.SH СИНТАКСИС
+.BI enable_X11_numlock
+[on]
+[off]
+[switch]
+.SH ОПИСАНИЕ
+Команда
+.B enable_X11_numlock
+включает, выключает или переключает numlock под Иксами. Действием по
+умолчанию (например, когда опции не заданы) является включение.
+
+.SH "СМ. ТАКЖЕ"
+
+.BR X (1).
+
+.SH ПЕРЕВОД
+Павел Марьянов <acid_jack at ukr.net>

Added: numlock/trunk/man/uk/enable_X11_numlock.1
===================================================================
--- numlock/trunk/man/uk/enable_X11_numlock.1	                        (rev 0)
+++ numlock/trunk/man/uk/enable_X11_numlock.1	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,22 @@
+.TH Enable_X11_Numlock "9 Jan 2001" " Mageia Manual"
+.SH НАЗВА
+enable_X11_numlock \- Дозволити фіксацію цифрової клавіатури в X11
+.SH ВИКОРИСТАННЯ
+.BI enable_X11_numlock
+[on]
+[off]
+[switch]
+.SH ОПИС
+Команда
+.B enable_X11_numlock
+вмикає, вимикає чи перемикає фіксатор цифрової додаткової клавіатури в
+X. Стандартний режим роботи (тобто коли не вказаний жоден з параметрів)
+\- ввімкнути фіксатор.
+
+.SH "ДИВ. ТАКОЖ"
+
+.BR X (1).
+.SH
+ПЕРЕКЛАД
+.br
+Дмитро Ковальов, <kov at tokyo.emai.ne.jp>

Added: numlock/trunk/numlock.init
===================================================================
--- numlock/trunk/numlock.init	                        (rev 0)
+++ numlock/trunk/numlock.init	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# Startup script for NumLock
+#
+# description: Locks NumLock key at init runlevel change
+# chkconfig: 3457 29 15
+#
+### BEGIN INIT INFO
+# Provides: numlock
+# Default-Start: 3 4 5 7
+# Short-Description: Locks NumLock key at init runlevel change
+# Description: Locks NumLock key at init runlevel change
+### END INIT INFO
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+#	The following file make bash to relock the numlock key when logging
+#	since login unlock it.
+SYSCONF_FILE=/var/lock/subsys/numlock
+#SYSCONF_FILE=/etc/sysconfig/numlock
+
+# See how we were called.
+case "$1" in
+  start)
+	echo -n "Starting numlock: "
+	echo_success
+	echo
+	touch $SYSCONF_FILE
+	
+	for tty in /dev/tty[1-8]; do
+		setleds -D +num < $tty
+	done
+
+	;;
+  stop)
+	echo -n "Disabling numlocks on ttys: "
+	for tty in /dev/tty[1-8]; do
+		setleds -D -num < $tty
+	done
+	echo_success
+	echo
+	rm -f $SYSCONF_FILE
+	;;
+  status)
+#	status NumLock
+#	echo "dead status as reported is normal since NumLock doesn't need to daemonize"
+	if [ -f $SYSCONF_FILE ]
+	then
+		echo "numlock is enabled"
+	else
+		echo "numlock is disabled"
+	fi
+	;;
+  restart)
+	$0 stop
+	$0 start
+	;;
+  reload)
+	echo -n "Reloading numlock: "
+	$0 start
+	echo
+	;;
+  *)
+	echo "Usage: $0 {start|stop|restart|reload|status}"
+	exit 1
+esac
+
+exit 0


Property changes on: numlock/trunk/numlock.init
___________________________________________________________________
Added: svn:executable
   + *

Added: numlock/trunk/numlock.sh
===================================================================
--- numlock/trunk/numlock.sh	                        (rev 0)
+++ numlock/trunk/numlock.sh	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,9 @@
+# Mageia configuration.
+#	ReLock the NumLock key if /etc/rc.d/init.d/numlock has been run.
+#	This is needed because login resets the tty.
+
+MY_TTY=`tty`
+case $MY_TTY in
+    /dev/tty[0-9]*)	[ -f /var/lock/subsys/numlock ] && setleds -D +num < $MY_TTY;;
+esac
+unset MY_TTY


Property changes on: numlock/trunk/numlock.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:eol-style
   + native

Added: numlock/trunk/numlock.xinit
===================================================================
--- numlock/trunk/numlock.xinit	                        (rev 0)
+++ numlock/trunk/numlock.xinit	2011-02-03 22:38:52 UTC (rev 415)
@@ -0,0 +1,28 @@
+#!/bin/sh
+#---------------------------------------------------------------
+# Project         : Mandrake
+# Module          : numlock
+# File            : numlock.xinit
+# Version         : $Id: numlock.xinit 241829 2008-04-03 04:15:25Z blino $
+# Author          : Frederic Lepied
+# Created On      : Wed Apr 12 08:39:24 2000
+#---------------------------------------------------------------
+
+#
+#  The following code used to execute enable_numlock if numlock was enabled
+#  on this host.  This screwed hosts which did not use numlock (laptops)
+#  but which tried to create XDMCP sessions to this host, as numlock would
+#  be turned on unconditionally.
+#
+#  The following code detects a $DISPLAY host other than what would be
+#  expected for a local X session on this host, and exempts it from the
+#  automatic execution of numlock.
+#
+DISPHOST=${DISPLAY%%:*}
+if  [ "$DISPHOST" = "" -o "$DISPHOST" = "localhost" -o "$DISPHOST" = "$HOSTNAME" ]; then
+  if [ -f /var/lock/subsys/numlock -a  -x /usr/bin/enable_X11_numlock ]; then
+      /usr/bin/enable_X11_numlock
+  fi
+fi
+
+# numlock ends here


Property changes on: numlock/trunk/numlock.xinit
___________________________________________________________________
Added: svn:executable
   + *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20110203/118bc66c/attachment-0001.html>


More information about the Mageia-sysadm mailing list