[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hurd/console ChangeLog console.c display.c disp...
From: |
Marcus Brinkmann |
Subject: |
hurd/console ChangeLog console.c display.c disp... |
Date: |
Tue, 03 Jun 2003 17:19:01 -0400 |
CVSROOT: /cvsroot/hurd
Module name: hurd
Changes by: Marcus Brinkmann <address@hidden> 03/06/03 17:19:00
Modified files:
console : ChangeLog console.c display.c display.h
Log message:
2003-04-29 Marco Gerards <address@hidden>
* display.c (display_create): Added arguments width, height and
lines, variables with the same name were removed.
* display.h (display_creat): Add missing arguments to prototype.
* console.c (DEFAULT_WIDTH): New macro.
(DEFAULT_HEIGHT): Likewise.
(DEFAULT_LINES): Likewise.
(STRX): Likewise.
(STR): Likewise.
(struct cons): New members lines, width and height.
(vcons_lookup): Add missing arguments to display_create.
(options): Add options width, height and lines.
(parse_opt): Parse width, height and lines.
(netfs_append_args): Append arguments width, height and lines.
(netfs_append_args): Fix asprintf error checking.
(main): Initialize cons with default width, height and lines.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/console/ChangeLog.diff?tr1=1.45&tr2=1.46&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/console/console.c.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/console/display.c.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/console/display.h.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
Patches:
Index: hurd/console/ChangeLog
diff -u hurd/console/ChangeLog:1.45 hurd/console/ChangeLog:1.46
--- hurd/console/ChangeLog:1.45 Tue Dec 10 15:40:32 2002
+++ hurd/console/ChangeLog Tue Jun 3 17:19:00 2003
@@ -1,3 +1,21 @@
+2003-04-29 Marco Gerards <address@hidden>
+
+ * display.c (display_create): Added arguments width, height and
+ lines, variables with the same name were removed.
+ * display.h (display_creat): Add missing arguments to prototype.
+ * console.c (DEFAULT_WIDTH): New macro.
+ (DEFAULT_HEIGHT): Likewise.
+ (DEFAULT_LINES): Likewise.
+ (STRX): Likewise.
+ (STR): Likewise.
+ (struct cons): New members lines, width and height.
+ (vcons_lookup): Add missing arguments to display_create.
+ (options): Add options width, height and lines.
+ (parse_opt): Parse width, height and lines.
+ (netfs_append_args): Append arguments width, height and lines.
+ (netfs_append_args): Fix asprintf error checking.
+ (main): Initialize cons with default width, height and lines.
+
2002-12-10 Marcus Brinkmann <address@hidden>
* console.c (main): Don't use err without setting it.
Index: hurd/console/console.c
diff -u hurd/console/console.c:1.21 hurd/console/console.c:1.22
--- hurd/console/console.c:1.21 Tue Dec 10 15:40:33 2002
+++ hurd/console/console.c Tue Jun 3 17:19:00 2003
@@ -1,5 +1,5 @@
/* console.c -- A console server.
- Copyright (C) 1997, 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2002, 2003 Free Software Foundation, Inc.
Written by Miles Bader and Marcus Brinkmann.
This program is free software; you can redistribute it and/or
@@ -61,6 +61,13 @@
#define DEFAULT_BLINKING 0
#define DEFAULT_REVERSED 0
#define DEFAULT_CONCEALED 0
+#define DEFAULT_WIDTH 80
+#define DEFAULT_HEIGHT 25
+#define DEFAULT_LINES 50
+/* Stringification of a macro. */
+#define STRX(s) #s
+#define STR(s) STRX(s)
+
/* For the help output. */
#define DEFAULT_ATTRIBUTE_NAME "normal"
#define DEFAULT_FOREGROUND CONS_COLOR_WHITE
@@ -128,6 +135,11 @@
mach_port_t underlying;
/* A template for the stat information of all nodes. */
struct stat stat_template;
+
+ /* The amount of lines, width and height. */
+ unsigned int lines;
+ unsigned int width;
+ unsigned int height;
};
@@ -222,7 +234,8 @@
mutex_init (&vcons->lock);
err = display_create (&vcons->display, cons->encoding ?: DEFAULT_ENCODING,
- cons->attribute);
+ cons->attribute, cons->lines, cons->width,
+ cons->height);
if (err)
{
free (vcons->name);
@@ -1335,6 +1348,12 @@
" (default `" DEFAULT_ATTRIBUTE_NAME "')" },
{ "encoding", 'e', "NAME", 0, "Set encoding of virtual consoles to"
" NAME (default `" DEFAULT_ENCODING "')" },
+ { "width", 'w', "WIDTH", 0, "Set width to WIDTH (default `"
+ STR(DEFAULT_WIDTH) "')" },
+ { "height", 'h', "HEIGHT", 0, "Set height to HEIGHT (default `"
+ STR(DEFAULT_HEIGHT) "')" },
+ { "lines", 'l', "LINES", 0, "Set amount of scrollback lines to LINES "
+ "(default `" STR(DEFAULT_LINES) "')" },
{0}
};
@@ -1443,7 +1462,8 @@
cons_t cons = state->input ?: netfs_root_node->nn->cons;
error_t err;
int color = 0;
-
+ char *tail;
+
switch (opt)
{
default:
@@ -1479,6 +1499,33 @@
if (err)
argp_error (state, "Invalid attribute specifier: %s", arg);
break;
+
+ case 'l':
+ errno = 0;
+ cons->lines = strtoul (arg, &tail, 0);
+ if (tail == NULL || tail == arg || *tail != '\0')
+ argp_error (state, "LINES is not a number: %s", arg);
+ if (errno)
+ argp_error (state, "Overflow in argument LINES %s", arg);
+ break;
+
+ case 'w':
+ errno = 0;
+ cons->width = strtoul (arg, &tail, 0);
+ if (tail == NULL || tail == arg || *tail != '\0')
+ argp_error (state, "WIDTH is not a number: %s", arg);
+ if (errno)
+ argp_error (state, "Overflow in argument WIDTH %s", arg);
+ break;
+
+ case 'h':
+ errno = 0;
+ cons->height = strtoul (arg, &tail, 0);
+ if (tail == NULL || tail == arg || *tail != '\0')
+ argp_error (state, "HEIGHT is not a number: %s", arg);
+ if (errno)
+ argp_error (state, "Overflow in argument HEIGHT %s", arg);
+ break;
case 'e':
/* XXX Check validity of encoding. Can we perform all necessary
@@ -1513,29 +1560,54 @@
if (cons->encoding && strcmp (cons->encoding, DEFAULT_ENCODING))
{
char *buf;
- asprintf (&buf, "--encoding=%s", cons->encoding);
- if (buf)
- err = argz_add (argz, argz_len, buf);
+ if (asprintf (&buf, "--encoding=%s", cons->encoding) < 0)
+ err = ENOMEM;
else
- err = errno;
+ err = argz_add (argz, argz_len, buf);
+
}
if (!err && cons->attribute.fgcol != DEFAULT_FOREGROUND)
{
char *buf;
- asprintf (&buf, "--foreground=%s", color_names[cons->attribute.fgcol]);
- if (buf)
- err = argz_add (argz, argz_len, buf);
+ if (asprintf (&buf, "--foreground=%s",
+ color_names[cons->attribute.fgcol]) < 0)
+ err = ENOMEM;
else
- err = errno;
+ err = argz_add (argz, argz_len, buf);
+
}
if (!err && cons->attribute.bgcol != DEFAULT_BACKGROUND)
{
char *buf;
- asprintf (&buf, "--background=%s", color_names[cons->attribute.bgcol]);
- if (buf)
+ if (asprintf (&buf, "--background=%s",
+ color_names[cons->attribute.bgcol]) < 0)
+ err = ENOMEM;
+ else
err = argz_add (argz, argz_len, buf);
+ }
+ if (!err && cons->lines != DEFAULT_LINES)
+ {
+ char *buf;
+ if (asprintf (&buf, "--lines=%d", cons->lines) < 0)
+ err = ENOMEM;
else
- err = errno;
+ err = argz_add (argz, argz_len, buf);
+ }
+ if (!err && cons->width != DEFAULT_WIDTH)
+ {
+ char *buf;
+ if (asprintf (&buf, "--width=%d", cons->lines) < 0)
+ err = ENOMEM;
+ else
+ err = argz_add (argz, argz_len, buf);
+ }
+ if (!err && cons->height != DEFAULT_HEIGHT)
+ {
+ char *buf;
+ if (asprintf (&buf, "--height=%d", cons->height) < 0)
+ err = ENOMEM;
+ else
+ err = argz_add (argz, argz_len, buf);
}
if (!err && cons->attribute.intensity != DEFAULT_INTENSITY)
{
@@ -1588,6 +1660,7 @@
}
if (!err && attrp != attr)
err = argz_add (argz, argz_len, attr_str);
+
return err;
}
@@ -1930,6 +2003,9 @@
error (1, ENOMEM, "Cannot create console structure");
mutex_init (&cons->lock);
cons->encoding = NULL;
+ cons->width = DEFAULT_WIDTH;
+ cons->height = DEFAULT_HEIGHT;
+ cons->lines = DEFAULT_LINES;
cons->attribute.intensity = DEFAULT_INTENSITY;
cons->attribute.underlined = DEFAULT_UNDERLINED;
cons->attribute.blinking = DEFAULT_BLINKING;
Index: hurd/console/display.c
diff -u hurd/console/display.c:1.30 hurd/console/display.c:1.31
--- hurd/console/display.c:1.30 Thu Oct 10 08:26:04 2002
+++ hurd/console/display.c Tue Jun 3 17:19:00 2003
@@ -1,6 +1,6 @@
/* display.c - The display component of a virtual console.
Copyright (C) 1999 Kalle Olavi Niemitalo (emu.c from colortext 0.3).
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Written by Marcus Brinkmann and Kalle Olavi Niemitalo.
This file is part of the GNU Hurd.
@@ -1801,13 +1801,11 @@
being ENCODING. */
error_t
display_create (display_t *r_display, const char *encoding,
- conchar_attr_t def_attr)
+ conchar_attr_t def_attr, unsigned int lines,
+ unsigned int width, unsigned int height)
{
error_t err = 0;
display_t display;
- int width = 80;
- int height = 25;
- int lines = 50; /* XXX For now. */
*r_display = NULL;
display = calloc (1, sizeof *display);
Index: hurd/console/display.h
diff -u hurd/console/display.h:1.9 hurd/console/display.h:1.10
--- hurd/console/display.h:1.9 Thu Aug 29 19:57:44 2002
+++ hurd/console/display.h Tue Jun 3 17:19:00 2003
@@ -1,5 +1,5 @@
/* display.h - Interface to the display component of a virtual console.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Written by Marcus Brinkmann.
This file is part of the GNU Hurd.
@@ -30,8 +30,11 @@
/* Create a new virtual console display, with the system encoding
being ENCODING and the default colors being FOREGROUND and BACKGROUND. */
-error_t display_create (display_t *r_display, const char *encoding,
- conchar_attr_t attr);
+error_t
+display_create (display_t *r_display, const char *encoding,
+ conchar_attr_t def_attr, unsigned int lines,
+ unsigned int width, unsigned int height);
+
/* Destroy the display DISPLAY. */
void display_destroy (display_t display);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- hurd/console ChangeLog console.c display.c disp...,
Marcus Brinkmann <=