Permalink
Browse files

kbdmap: Sync with FreeBSD.

* Let bsd.prog.mk set SRCS and MAN to their default values.
* kbdmap.1 markup fixes and fix path for locale.alias.
* Spelling fix in a comment.
* Place quotes around the output, designed to be pasted into rc.conf.
* Fix fd leak in get_font().
* Use auto-sizing syntax appropriate for the new dialog(1).
* Update files with FreeBSD SVN tags.
* Output keymap choice to stderr so it is easier to parse.
* Use sizeof() for calculating the buffer size instead of hard-coded
  values.
* Fixed two bugs in Perl to C conversion that prevented locale name
  from being parsed correctly.

Obtained-from:   FreeBSD
  • Loading branch information...
Peter Avalos
Peter Avalos committed Mar 3, 2013
1 parent d4cbc55 commit ebfa7d96f28674f33a2481aa40c96306d29fc408
Showing with 31 additions and 35 deletions.
  1. +1 −3 usr.sbin/kbdmap/Makefile
  2. +1 −2 usr.sbin/kbdmap/TODO
  3. +19 −20 usr.sbin/kbdmap/kbdmap.1
  4. +9 −8 usr.sbin/kbdmap/kbdmap.c
  5. +1 −2 usr.sbin/kbdmap/kbdmap.h
View
@@ -1,9 +1,7 @@
-# $FreeBSD: src/usr.sbin/kbdmap/Makefile,v 1.13 2002/07/03 14:56:08 markm Exp $
-# $DragonFly: src/usr.sbin/kbdmap/Makefile,v 1.5 2005/01/17 01:49:24 cpressey Exp $
+# $FreeBSD: head/usr.sbin/kbdmap/Makefile 140941 2005-01-28 16:08:11Z ru $
PROG= kbdmap
LINKS= ${BINDIR}/kbdmap ${BINDIR}/vidfont
-MAN= kbdmap.1
MLINKS= kbdmap.1 vidfont.1
.include <bsd.prog.mk>
View
@@ -1,5 +1,4 @@
-$FreeBSD: /repoman/r/ncvs/src/usr.sbin/kbdmap/TODO,v 1.2 2000/09/13 09:16:57 dwmalone Exp $
-$DragonFly: src/usr.sbin/kbdmap/TODO,v 1.3 2004/06/21 01:37:42 cpressey Exp $
+$FreeBSD: head/usr.sbin/kbdmap/TODO 65807 2000-09-13 09:16:57Z dwmalone $
o remember some hackers to translate Languages.phrases into
Norwegian, Russian, Danish, Swedish
View
@@ -22,8 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/usr.sbin/kbdmap/kbdmap.1,v 1.31 2002/12/04 14:45:48 ru Exp $
-.\" $DragonFly: src/usr.sbin/kbdmap/kbdmap.1,v 1.5 2008/04/29 09:33:41 swildner Exp $
+.\" $FreeBSD: head/usr.sbin/kbdmap/kbdmap.1 191634 2009-04-28 20:20:13Z danger $
.Dd July 3, 2002
.Dt KBDMAP 1
.Os
@@ -35,13 +34,13 @@
.Nm
.Op Fl K
.Op Fl V
-.Op Fl d | Fl default
-.Op Fl h | Fl help
-.Op Fl l | Fl lang Ar language
-.Op Fl p | Fl print
-.Op Fl r | Fl restore
-.Op Fl s | Fl show
-.Op Fl v | Fl verbose
+.Op Fl d | default
+.Op Fl h | help
+.Op Fl l | lang Ar language
+.Op Fl p | print
+.Op Fl r | restore
+.Op Fl s | show
+.Op Fl v | verbose
.Sh DESCRIPTION
The
.Nm
@@ -77,26 +76,26 @@ Run as command
.It Fl V
Run as command
.Nm vidfont .
-.It Fl d , Fl default
+.It Fl d , default
Use default language.
Ignore
.Ev LANG
environment variable.
-.It Fl h , Fl help
+.It Fl h , help
Print options and exit.
-.It Fl l , Fl lang Ar language
+.It Fl l , lang Ar language
Use
.Ar language
-for description and menu
-.It Fl p , Fl print
-Print description of available keymaps or fonts
+for description and menu.
+.It Fl p , print
+Print description of available keymaps or fonts
to stdout and exit.
-.It Fl r , Fl restore
+.It Fl r , restore
Load default font from
.Pa /etc/rc.conf .
-.It Fl s , Fl show
+.It Fl s , show
Show currently supported languages and exit.
-.It Fl v , Fl verbose
+.It Fl v , verbose
More warnings.
.El
.Sh ENVIRONMENT
@@ -105,14 +104,14 @@ More warnings.
preferred language
.El
.Sh FILES
-.Bl -tag -width /usr/share/syscons/keymaps/INDEX.keymaps -compact
+.Bl -tag -width ".Pa /usr/share/syscons/keymaps/INDEX.keymaps" -compact
.It Pa /usr/share/syscons/keymaps/INDEX.keymaps
database for keymaps
.It Pa /usr/share/syscons/fonts/INDEX.fonts
database for fonts
.It Pa /etc/rc.conf
default font
-.It Pa /usr/X11/lib/X11/locale/locale.alias
+.It Pa /usr/share/locale/locale.alias
describe common
.Ev LANG
values
View
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/usr.sbin/kbdmap/kbdmap.c,v 1.2 2002/10/27 17:44:33 wollman Exp $
+ * $FreeBSD: head/usr.sbin/kbdmap/kbdmap.c 237257 2012-06-19 06:10:31Z eadler $
*/
#include <sys/types.h>
@@ -225,6 +225,7 @@ get_font(void)
}
}
}
+ fclose(fp);
} else
fprintf(stderr, "Could not open %s for reading\n", sysconfig);
@@ -287,7 +288,7 @@ do_kbdcontrol(struct keymap *km)
if (!x11)
system(kbd_cmd);
- printf("keymap=%s\n", km->keym);
+ fprintf(stderr, "keymap=\"%s\"\n", km->keym);
free(kbd_cmd);
}
@@ -334,7 +335,7 @@ show_dialog(struct keymap **km_sorted, int num_keymaps)
exit(1);
}
asprintf(&dialog, "/usr/bin/dialog --clear --title \"Keyboard Menu\" "
- "--menu \"%s\" -1 -1 10", menu);
+ "--menu \"%s\" 0 0 0", menu);
/* start right font, assume that current font is equal
* to default font in /etc/rc.conf
@@ -378,7 +379,7 @@ show_dialog(struct keymap **km_sorted, int num_keymaps)
fp = fopen(tmp_name, "r");
if (fp) {
char choice[64];
- if (fgets(choice, 64, fp) != NULL) {
+ if (fgets(choice, sizeof(choice), fp) != NULL) {
/* Find key for desc */
for (i=0; i<num_keymaps; i++) {
if (!strcmp(choice, km_sorted[i]->desc)) {
@@ -542,7 +543,7 @@ check_file(const char *keym)
}
/*
- * Read options from the relevent configuration file, then
+ * Read options from the relevant configuration file, then
* present to user.
*/
static void
@@ -567,16 +568,16 @@ menu_read(void)
/* en_US.ISO8859-1 -> en_..\.ISO8859-1 */
strlcpy(dialect, lang, sizeof(dialect));
- if (strlen(dialect) >= 6 && dialect[2] == '-') {
+ if (strlen(dialect) >= 6 && dialect[2] == '_') {
dialect[3] = '.';
dialect[4] = '.';
}
/* en_US.ISO8859-1 -> en */
strlcpy(lang_abk, lang, sizeof(lang_abk));
- if (strlen(lang_abk) >= 3 && lang_abk[2] == '-')
- lang_abk[2] = '.';
+ if (strlen(lang_abk) >= 3 && lang_abk[2] == '_')
+ lang_abk[2] = '\0';
fprintf(stderr, "lang_default = %s\n", lang_default);
fprintf(stderr, "dialect = %s\n", dialect);
View
@@ -23,8 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/usr.sbin/kbdmap/kbdmap.h,v 1.1 2002/07/03 14:56:08 markm Exp $
- * $DragonFly: src/usr.sbin/kbdmap/kbdmap.h,v 1.1 2004/06/21 01:37:42 cpressey Exp $
+ * $FreeBSD: head/usr.sbin/kbdmap/kbdmap.h 99357 2002-07-03 14:56:08Z markm $
*/

0 comments on commit ebfa7d9

Please sign in to comment.