Hello community,
here is the log from the commit of package lilo
checked in at Tue Nov 14 00:28:01 CET 2006.
--------
--- arch/ppc/lilo/lilo.changes 2006-11-07 13:31:45.000000000 +0100
+++ /mounts/work_src_done/STABLE/lilo/lilo.changes 2006-11-13 14:30:55.000000000 +0100
@@ -1,0 +2,10 @@
+Mon Nov 13 14:30:07 CET 2006 - olh@suse.de
+
+- handle second ide port and cdrom device paths on pegasos (218692)
+
+-------------------------------------------------------------------
+Mon Nov 13 13:20:38 CET 2006 - olh@suse.de
+
+- implement tab completion for yaboot.conf section label names
+
+-------------------------------------------------------------------
Old:
----
lilo-10.1.20.tar.bz2
yaboot-10.1.20-r867.tar.bz2
New:
----
lilo-10.1.21.tar.bz2
yaboot-10.1.21-r892.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ lilo.spec ++++++
--- /var/tmp/diff_new_pack.1JlxRS/_old 2006-11-14 00:27:44.000000000 +0100
+++ /var/tmp/diff_new_pack.1JlxRS/_new 2006-11-14 00:27:44.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package lilo (Version 10.1.20)
+# spec file for package lilo (Version 10.1.21)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,7 +11,7 @@
# norootforbuild
Name: lilo
-%define yaboot_vers 10.1.20-r867
+%define yaboot_vers 10.1.21-r892
Group: System/Boot
License: BSD License and BSD-like, Other License(s), see package
Summary: The Linux Loader, a Boot Menu
@@ -23,8 +23,8 @@
Requires: powerpc-utils
Requires: binutils
Requires: parted
-Version: 10.1.20
-Release: 3
+Version: 10.1.21
+Release: 1
Source0: lilo-%{version}.tar.bz2
Source1: http://penguinppc.org/projects/yaboot/yaboot-%{yaboot_vers}.tar.bz2
# $Id: lilo.spec 870 2006-11-07 12:31:45Z olh $
@@ -157,6 +157,10 @@
%doc %{_mandir}/*/*
%changelog -n lilo
+* Mon Nov 13 2006 - olh@suse.de
+- handle second ide port and cdrom device paths on pegasos (218692)
+* Mon Nov 13 2006 - olh@suse.de
+- implement tab completion for yaboot.conf section label names
* Tue Nov 07 2006 - olh@suse.de
- remove chmod calls in install section, permissions come via files
* Tue Nov 07 2006 - olh@suse.de
++++++ lilo-10.1.20.tar.bz2 -> lilo-10.1.21.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/lilo-10.1.20/lilo.new new/lilo-10.1.21/lilo.new
--- old/lilo-10.1.20/lilo.new 2006-10-30 14:07:26.000000000 +0100
+++ new/lilo-10.1.21/lilo.new 2006-10-30 14:07:26.000000000 +0100
@@ -66,7 +66,7 @@
function Usage() {
cat <,
# 2005 Joachim Plack
@@ -62,7 +62,7 @@
shopt -s extglob
-read d myversion d <<< "$Date: 2006-10-20 12:33:29 +0000 (Fri, 20 Oct 2006) $"
+read d myversion d <<< "$Date: 2006-11-13 13:30:55 +0000 (Mon, 13 Nov 2006) $"
function error() {
@@ -92,9 +92,36 @@
echo $(( 0x$(read_qbyte "$1" 1) ))
}
+function get_port () {
+ local variant orig_offset
+ local i port offset
+
+ variant=$1
+ orig_offset=$2
+
+ offset=$orig_offset
+ for i in $variant[0-9]*
+ do
+ : i $i
+ port="${i#$variant}"
+ if test "$port" -lt "$offset"
+ then
+ offset=$port
+ fi
+ done
+ if test "$port" != "0"
+ then
+ echo $(( $orig_offset - $offset ))
+ fi
+}
# if no file path is given on cmd line check for root file system
file=/
+#
+sysfs_ide_media_type=
+of_ide_media_type=
+ide_port=
+ide_channel=
if [ "$#" -gt 0 ] ; then
until [ "$#" = 0 ] ; do
@@ -185,7 +212,7 @@
if [ ! -L "$file_sysfs_dir/device" ] ; then
# maybe a partition
if [ ! -L "$file_sysfs_dir/../device" ] ; then
- if [ -d "$file_sysfs_dir/md" ] ; then
+ if [ -d "$file_sysfs_dir/md" ] ; then
# TODO: think about whether we enable reading of
# $( yaboot-10.1.21-r892.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yaboot-10.1.20-r867/Changelog.SuSE new/yaboot-10.1.21-r892/Changelog.SuSE
--- old/yaboot-10.1.20-r867/Changelog.SuSE 2006-11-07 13:32:55.000000000 +0100
+++ new/yaboot-10.1.21-r892/Changelog.SuSE 2006-11-13 14:36:31.000000000 +0100
@@ -1,4 +1,158 @@
------------------------------------------------------------------------
+r892 | olh | 2006-11-13 12:24:01 +0000 (Mon, 13 Nov 2006) | 2 lines
+Changed paths:
+ M /trunk/lilo.changes
+ M /trunk/yaboot/include/cfg.h
+ M /trunk/yaboot/include/cmdline.h
+ M /trunk/yaboot/second/cfg.c
+ M /trunk/yaboot/second/cmdline.c
+ M /trunk/yaboot/second/yaboot.c
+
++- implement tab completion for yaboot.conf section label names
+
+------------------------------------------------------------------------
+r891 | olh | 2006-11-13 10:12:59 +0000 (Mon, 13 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/include/cmdline.h
+ M /trunk/yaboot/second/cmdline.c
+ M /trunk/yaboot/second/yaboot.c
+
+remove unused cmdinit function
+------------------------------------------------------------------------
+r890 | olh | 2006-11-13 10:12:16 +0000 (Mon, 13 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/second/yaboot.c
+
+cleanup local variables usage in get_params
+------------------------------------------------------------------------
+r889 | olh | 2006-11-13 10:11:22 +0000 (Mon, 13 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/include/cmdline.h
+ M /trunk/yaboot/second/cmdline.c
+ M /trunk/yaboot/second/yaboot.c
+
+use cmdlineedit instead of cmdedit in get_params
+------------------------------------------------------------------------
+r888 | olh | 2006-11-13 10:10:32 +0000 (Mon, 13 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/second/yaboot.c
+
+simplify single-key handling in get_params
+------------------------------------------------------------------------
+r887 | olh | 2006-11-13 10:09:45 +0000 (Mon, 13 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/second/yaboot.c
+
+only store ascii chars in the cmdline buffer in get_params
+------------------------------------------------------------------------
+r886 | olh | 2006-11-13 10:09:05 +0000 (Mon, 13 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/second/yaboot.c
+
+simplify timeout handling in get_params
+------------------------------------------------------------------------
+r885 | olh | 2006-11-13 10:08:29 +0000 (Mon, 13 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/second/yaboot.c
+
+move boot: banner printing to its own function
+------------------------------------------------------------------------
+r884 | olh | 2006-11-13 10:07:32 +0000 (Mon, 13 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/include/cmdline.h
+ M /trunk/yaboot/second/cmdline.c
+ M /trunk/yaboot/second/yaboot.c
+ M /trunk/yaboot/yaboot.deps
+
+ use the new buffer_edit function in check_password
+------------------------------------------------------------------------
+r883 | olh | 2006-11-13 10:04:10 +0000 (Mon, 13 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/second/cmdline.c
+
+add a new buffer_edit function
+------------------------------------------------------------------------
+r882 | olh | 2006-11-13 10:03:28 +0000 (Mon, 13 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/include/cmdline.h
+
+add the char_to_ascii function
+------------------------------------------------------------------------
+r881 | olh | 2006-11-13 10:02:38 +0000 (Mon, 13 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/Makefile
+
+fix type in make clean emtpy/empty
+------------------------------------------------------------------------
+r880 | olh | 2006-11-12 12:55:13 +0000 (Sun, 12 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/include/cmdline.h
+ M /trunk/yaboot/second/cfg.c
+ M /trunk/yaboot/second/cmdline.c
+ M /trunk/yaboot/second/yaboot.c
+
+add and use the char_is_tab function
+------------------------------------------------------------------------
+r879 | olh | 2006-11-12 12:52:44 +0000 (Sun, 12 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/include/cmdline.h
+ M /trunk/yaboot/second/cmdline.c
+ M /trunk/yaboot/second/yaboot.c
+
+add and use the char_is_backspace function
+------------------------------------------------------------------------
+r878 | olh | 2006-11-12 12:50:11 +0000 (Sun, 12 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/include/cmdline.h
+ M /trunk/yaboot/second/cfg.c
+ M /trunk/yaboot/second/cmdline.c
+ M /trunk/yaboot/second/yaboot.c
+ M /trunk/yaboot/yaboot.deps
+
+add and use the char_is_newline function
+------------------------------------------------------------------------
+r877 | olh | 2006-11-12 12:40:13 +0000 (Sun, 12 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/second/yaboot.c
+
+remove bogus bss comments
+------------------------------------------------------------------------
+r876 | olh | 2006-11-12 12:31:07 +0000 (Sun, 12 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/second/yaboot.c
+
+update CLAIM_END comment
+------------------------------------------------------------------------
+r875 | olh | 2006-11-12 12:29:01 +0000 (Sun, 12 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/second/yaboot.c
+
+check for password only once in get_params
+------------------------------------------------------------------------
+r874 | olh | 2006-11-12 12:24:16 +0000 (Sun, 12 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/second/yaboot.c
+
+join strings in get_params
+------------------------------------------------------------------------
+r873 | olh | 2006-11-12 12:21:55 +0000 (Sun, 12 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/second/yaboot.c
+
+remove bogus comment from get_params
+------------------------------------------------------------------------
+r872 | olh | 2006-11-12 12:20:25 +0000 (Sun, 12 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/second/cfg.c
+
+ remaining 0 -> NULL in cfg.c
+------------------------------------------------------------------------
+r871 | olh | 2006-11-09 12:45:38 +0000 (Thu, 09 Nov 2006) | 1 line
+Changed paths:
+ M /trunk/yaboot/second/yaboot.c
+
+add hard_coded_bootpath to simplify debugging
+------------------------------------------------------------------------
r867 | olh | 2006-11-07 12:06:07 +0000 (Tue, 07 Nov 2006) | 3 lines
Changed paths:
M /trunk/lilo/lilo-pmac.lib
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yaboot-10.1.20-r867/Makefile new/yaboot-10.1.21-r892/Makefile
--- old/yaboot-10.1.20-r867/Makefile 2006-11-07 13:32:55.000000000 +0100
+++ new/yaboot-10.1.21-r892/Makefile 2006-11-13 14:36:31.000000000 +0100
@@ -6,7 +6,7 @@
include Config
-VERSION = 10.1.20-r867
+VERSION = 10.1.21-r892
# Debug mode (spam/verbose)
DEBUG = 0
# make install vars
@@ -194,7 +194,7 @@
rm -f second/yaboot.debug
rm -f second/yaboot.chrp
rm -f second/yaboot.a
- rm -f second/empty.c second/emtpy.o
+ rm -f second/empty.c second/empty.o
rm -f util/split_of_path
rm -f tags
rm -f md5test
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yaboot-10.1.20-r867/include/cfg.h new/yaboot-10.1.21-r892/include/cfg.h
--- old/yaboot-10.1.20-r867/include/cfg.h 2006-09-22 23:05:49.000000000 +0200
+++ new/yaboot-10.1.21-r892/include/cfg.h 2006-11-13 13:24:01.000000000 +0100
@@ -26,7 +26,7 @@
extern int cfg_parse(char *buff, int len, int cpu);
extern char* cfg_get_strg(char *image, char *item);
extern int cfg_get_flag(char *image, char *item);
-extern void cfg_print_images(void);
+extern int cfg_print_images(char *buf, int len, int remaining);
extern char* cfg_get_default(void);
#endif
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yaboot-10.1.20-r867/include/cmdline.h new/yaboot-10.1.21-r892/include/cmdline.h
--- old/yaboot-10.1.20-r867/include/cmdline.h 2006-09-22 23:05:49.000000000 +0200
+++ new/yaboot-10.1.21-r892/include/cmdline.h 2006-11-13 13:24:01.000000000 +0100
@@ -25,9 +25,25 @@
#include
-extern void cmdinit();
-extern void cmdedit(void (*tabfunc) (void), int password);
+extern char *cmdlineinit(void);
+extern char *cmdlineedit(char *buf, void (*func) (const char *p, const int nl));
+extern char *passwdinit(void);
+extern char *passwordedit(char *buf);
-extern char cbuff[];
-extern char passwdbuff[];
+static inline int char_is_newline(int c)
+{
+ return c == '\n' || c == '\r';
+}
+static inline int char_is_backspace(int c)
+{
+ return c == '\b' || c == 0x7f;
+}
+static inline int char_is_tab(int c)
+{
+ return c == '\t';
+}
+static inline int char_to_ascii(int c)
+{
+ return c > 0x7f ? 0 : c < ' ' ? 0 : c;
+}
#endif
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yaboot-10.1.20-r867/second/cfg.c new/yaboot-10.1.21-r892/second/cfg.c
--- old/yaboot-10.1.20-r867/second/cfg.c 2006-09-22 23:05:49.000000000 +0200
+++ new/yaboot-10.1.21-r892/second/cfg.c 2006-11-13 13:24:01.000000000 +0100
@@ -25,6 +25,7 @@
#include
#include
#include
+#include
/* Imported functions */
extern int strcasecmp(const char *s1, const char *s2);
@@ -99,6 +100,8 @@
static char *endp;
static CONFIG *curr_table = cf_options;
static jmp_buf env;
+static int tab_completion_len;
+static char *tab_completion_buf;
static struct IMAGES {
CONFIG table[sizeof(cf_image) / sizeof(cf_image[0])];
@@ -164,14 +167,14 @@
return here;
}
while (1) {
- while (ch = next(), ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r')
- if (ch == '\n' || ch == '\r')
+ while (ch = next(), ch == ' ' || char_is_tab(ch) || char_is_newline(ch))
+ if (char_is_newline(ch))
line_num++;
if (ch == EOF || ch == (int)NULL)
return NULL;
if (ch != '#')
break;
- while (ch = next_raw(), (ch != '\n' && ch != '\r'))
+ while (ch = next_raw(), !char_is_newline(ch))
if (ch == EOF)
return NULL;
line_num++;
@@ -195,7 +198,7 @@
break;
case '\n':
case '\r':
- while ((ch = next()), ch == ' ' || ch == '\t') ;
+ while ((ch = next()), ch == ' ' || char_is_tab(ch)) ;
if (!ch)
continue;
again(ch);
@@ -207,12 +210,12 @@
default:
cfg_error("Bad use of \\ in quoted string");
}
- } else if ((ch == '\n') || (ch == '\r'))
+ } else if (char_is_newline(ch))
cfg_error("newline is not allowed in quoted strings");
*here++ = ch;
}
cfg_error("Quoted string is too long");
- return 0; /* not reached */
+ return NULL; /* not reached */
}
here = buf;
escaped = 0;
@@ -223,10 +226,10 @@
if (ch == '\n')
line_num++;
else
- *here++ = ch == '\t' ? ' ' : ch;
+ *here++ = char_is_tab(ch) ? ' ' : ch;
escaped = 0;
} else {
- if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' || ch == '#' || ch == '=' || ch == EOF) {
+ if (ch == ' ' || char_is_tab(ch) || char_is_newline(ch) || ch == '#' || ch == '=' || ch == EOF) {
again(ch);
*here = 0;
return strdup(buf);
@@ -237,7 +240,7 @@
ch = next();
}
cfg_error("Token is too long");
- return 0; /* not reached */
+ return NULL; /* not reached */
}
static void cfg_return_token(char *token)
@@ -315,8 +318,14 @@
cfg_warn("Duplicate entry '%s'", walk->name);
if (walk->type == cft_flag)
walk->data = &flag_set;
- else if (walk->type == cft_strg)
+ else if (walk->type == cft_strg) {
walk->data = value;
+ if (strcmp(item, "label") == 0 || strcmp(item, "alias") == 0) {
+ int len = strlen(value);
+ if (len > tab_completion_len)
+ tab_completion_len = len;
+ }
+ }
}
break;
}
@@ -345,7 +354,7 @@
return 0;
while (1) {
if (!cfg_next(&item, &value))
- return 1;
+ break;
if (!cfg_set(item, value)) {
#ifdef DEBUG
prom_printf("Can't set item %s to value %s\n", item, value);
@@ -353,6 +362,9 @@
}
free(item);
}
+ if (tab_completion_len)
+ tab_completion_buf = malloc(tab_completion_len + 2);
+ return !!tab_completion_buf;
}
static char *cfg_get_strg_i(CONFIG * table, char *item)
@@ -362,7 +374,7 @@
for (walk = table; walk->type != cft_end; walk++)
if (walk->name && !strcasecmp(walk->name, item))
return walk->data;
- return 0;
+ return NULL;
}
char *cfg_get_strg(char *image, char *item)
@@ -389,7 +401,7 @@
return ret;
}
}
- return 0;
+ return NULL;
}
int cfg_get_flag(char *image, char *item)
@@ -412,33 +424,117 @@
printl_count = 0;
}
-void cfg_print_images(void)
+int cfg_print_images(char *buf, int len, int remaining)
{
struct IMAGES *p;
- char *label, *alias;
-
- char *ret = cfg_get_strg_i(cf_options, "default");
- int defflag = 0;
-
- printl_count = 0;
- for (p = images; p; p = p->next) {
- label = cfg_get_strg_i(p->table, "label");
- if (!label) {
- label = cfg_get_strg_i(p->table, "image");
- alias = strrchr(label, '/');
- if (alias)
- label = alias + 1;
+ char *label, *alias, *image, *last_match;
+ char *def;
+ int label_match_count, curlen, following_char, print_matching_labels;
+
+ printl_count = print_matching_labels = 0;
+ following_char = -1;
+ curlen = len;
+ if (len)
+ memcpy(tab_completion_buf, buf, len);
+ tab_completion_buf[len] = '\0';
+ def = cfg_get_strg_i(cf_options, "default");
+
+ do {
+ label_match_count = 0;
+ last_match = NULL;
+ for (p = images; p; p = p->next) {
+ label = cfg_get_strg_i(p->table, "label");
+ alias = cfg_get_strg_i(p->table, "alias");
+ image = NULL;
+ if (!label && !alias) {
+ if (len)
+ continue;
+ image = cfg_get_strg_i(p->table, "image");
+ if (!image)
+ continue;
+ alias = strrchr(image, '/');
+ if (alias) {
+ image = alias + 1;
+ alias = NULL;
+ }
+ }
+ if (len) {
+ if (label && strlen(label) < remaining && memcmp(label, tab_completion_buf, curlen) == 0) {
+ if (print_matching_labels) {
+ print_matching_labels++;
+ printlabel(label, strcmp(def, label) == 0);
+ } else {
+ if (following_char >= 0) {
+ if (label[curlen] == following_char) {
+ label_match_count++;
+ if (!last_match)
+ last_match = label;
+ } else {
+ print_matching_labels = 1;
+ label_match_count = 0;
+ break;
+ }
+ } else {
+ if (!last_match)
+ last_match = label;
+ label_match_count++;
+ }
+ }
+ }
+ if (alias && strlen(alias) < remaining && memcmp(alias, tab_completion_buf, curlen) == 0) {
+ if (print_matching_labels) {
+ print_matching_labels++;
+ printlabel(alias, strcmp(def, alias) == 0);
+ } else {
+ if (following_char >= 0) {
+ if (alias[curlen] == following_char) {
+ label_match_count++;
+ if (!last_match)
+ last_match = alias;
+ } else {
+ print_matching_labels = 1;
+ label_match_count = 0;
+ break;
+ }
+ } else {
+ if (!last_match)
+ last_match = alias;
+ label_match_count++;
+ }
+ }
+ }
+ } else {
+ if (label)
+ printlabel(label, strcmp(def, label) == 0);
+ if (alias)
+ printlabel(alias, strcmp(def, alias) == 0);
+ }
}
- if (!strcmp(ret, label))
- defflag = 1;
- else
- defflag = 0;
- alias = cfg_get_strg_i(p->table, "alias");
- printlabel(label, defflag);
- if (alias)
- printlabel(alias, 0);
+ if (label_match_count) {
+ if (label_match_count == 1) {
+ sprintf(tab_completion_buf, "%s ", last_match);
+ memcpy(buf, tab_completion_buf, strlen(tab_completion_buf) + 1);
+ prom_printf("%s", buf + curlen);
+ label_match_count = 0;
+ } else {
+ if (following_char >= 0) {
+ tab_completion_buf[curlen] = following_char;
+ curlen++;
+ tab_completion_buf[curlen] = '\0';
+ prom_printf("%s", tab_completion_buf + curlen - 1);
+ }
+ following_char = last_match[curlen];
+ }
+ } else
+ following_char = -1;
}
- prom_printf("\n");
+ while (label_match_count || print_matching_labels == 1);
+
+ if (print_matching_labels > 1 && printl_count)
+ prom_printf("\n");
+ if (len)
+ memcpy(buf, tab_completion_buf, strlen(tab_completion_buf) + 1);
+ return strlen(tab_completion_buf) - len;
}
char *cfg_get_default(void)
@@ -449,7 +545,7 @@
if (ret)
return ret;
if (!images)
- return 0;
+ return NULL;
ret = cfg_get_strg_i(images->table, "label");
if (!ret) {
ret = cfg_get_strg_i(images->table, "image");
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yaboot-10.1.20-r867/second/cmdline.c new/yaboot-10.1.21-r892/second/cmdline.c
--- old/yaboot-10.1.20-r867/second/cmdline.c 2006-09-22 23:05:49.000000000 +0200
+++ new/yaboot-10.1.21-r892/second/cmdline.c 2006-11-13 13:24:01.000000000 +0100
@@ -28,61 +28,119 @@
#include
#include
#include
+#include
+#include
#define CMD_LENG 512
-char cbuff[CMD_LENG];
-char passwdbuff[CMD_LENG];
+static char *cmdbuff;
+static char *passwdbuff;
extern int useconf;
-void cmdinit()
+char *passwdinit(void)
{
- cbuff[0] = 0;
- passwdbuff[0] = 0;
+ if (!passwdbuff)
+ passwdbuff = malloc(CMD_LENG);
+ if (passwdbuff)
+ passwdbuff[0] = 0;
+ return passwdbuff;
}
-void cmdedit(void (*tabfunc) (void), int password)
+char *cmdlineinit(void)
{
- int x, c;
- char *buff = password ? passwdbuff : cbuff;
- for (x = 0; x < CMD_LENG - 1; x++) {
- if (buff[x] == 0)
- break;
- else if (password)
+ if (!cmdbuff)
+ cmdbuff = malloc(CMD_LENG);
+ if (cmdbuff)
+ cmdbuff[0] = 0;
+ return cmdbuff;
+}
+
+static int tabfunc(char *buf, const int len, void (*func) (const char *p, const int nl))
+{
+ int label_len, print_label, c;
+ int ret_len, pb, nl;
+ char *p;
+ ret_len = 0;
+ pb = nl = 1;
+ if (len > 0) {
+ print_label = 0;
+ p = buf;
+ for (c = 0; c < len; c++) {
+ if (buf[c] == ' ') {
+ if (print_label) {
+ print_label = 0;
+ break;
+ }
+ p++;
+ continue;
+ }
+ print_label = 1;
+ }
+ if (print_label) {
+ label_len = len - (int)(p - buf);
+ ret_len = cfg_print_images(p, label_len, CMD_LENG - len - 1);
+ if (ret_len) {
+ if (buf[len + ret_len - 1] != ' ')
+ nl = 0;
+ else
+ pb = 0;
+ }
+ }
+ } else
+ cfg_print_images(NULL, 0, 0);
+ if (pb)
+ (*func) (buf, nl);
+ return ret_len + len;
+}
+
+static char *buffer_edit(char *buf, void (*func) (const char *p, const int nl))
+{
+ int len, c;
+ len = strlen(buf);
+ if (func)
+ prom_printf(buf);
+ else {
+ for (c = 0; c < len; c++)
prom_printf("*");
}
- if (!password)
- prom_printf(buff, x);
for (;;) {
c = prom_getchar();
if (c == -1)
break;
- if (c == '\n' || c == '\r') {
+ if (char_is_newline(c))
break;
- }
- if (c == '\t' && !x && tabfunc)
- (*tabfunc) ();
- if (c == '\b' || c == 0x7F) {
- if (x > 0) {
- --x;
- buff[x] = 0;
+ if (char_is_tab(c) && func)
+ len = tabfunc(buf, len, func);
+ else if (char_is_backspace(c)) {
+ if (len > 0) {
+ --len;
+ buf[len] = 0;
prom_printf("\b \b");
}
- } else if ((c & 0xE0) != 0) {
- if (x < CMD_LENG - 1) {
- buff[x] = c;
- buff[x + 1] = 0;
- if (password)
- prom_printf("*");
+ } else {
+ c = char_to_ascii(c);
+ if (c && len < CMD_LENG - 2) {
+ buf[len] = c;
+ buf[len + 1] = 0;
+ if (func)
+ prom_printf(buf + len);
else
- prom_printf(buff + x);
- x++;
- }
- if (x == 1 && !password && useconf) {
- if (cfg_get_flag(cbuff, "single-key"))
- break;
+ prom_printf("*");
+ len++;
}
}
}
- buff[x] = 0;
+
+ buf[len] = 0;
+ return buf;
+}
+
+char *passwordedit(char *buf)
+{
+ return buffer_edit(buf, NULL);
+}
+
+char *cmdlineedit(char *buf, void (*func) (const char *p, const int nl))
+{
+ return buffer_edit(buf, func);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yaboot-10.1.20-r867/second/yaboot.c new/yaboot-10.1.21-r892/second/yaboot.c
--- old/yaboot-10.1.20-r867/second/yaboot.c 2006-10-31 22:15:28.000000000 +0100
+++ new/yaboot-10.1.21-r892/second/yaboot.c 2006-11-13 13:24:01.000000000 +0100
@@ -54,6 +54,17 @@
#include
#include
+#if 0
+static void hard_coded_bootpath(char *buf)
+{
+ prom_printf("original bootpath: '%s'\n using hardcoded bootpath: ", buf);
+ sprintf(buf, "/pci@8000000f8000000/ide@4,1/disk@0");
+ prom_printf("'%s'\n", buf);
+}
+#else
+#define hard_coded_bootpath(p) do { } while(0)
+#endif
+
#define CONFIG_FILE_MAX 0x8000 /* 32k */
#define BOOTPATH_LEN 1024
@@ -67,7 +78,7 @@
#define MALLOCADDR ((2 * 1024 * 1024) + (512 * 1024))
#define MALLOCSIZE ((1 * 1024 * 1024) + (512 * 1024))
-#define CLAIM_END (128 * 1024 * 1024) /* FIXME: look at /memory/available */
+#define CLAIM_END (128 * 1024 * 1024) /* FIXME: look at /memory/reg */
typedef struct {
union {
@@ -94,9 +105,6 @@
static struct path_description default_device;
static int _cpu;
-#define DEFAULT_TIMEOUT -1
-
-/* Entry, currently called directly by crt0 (bss not inited) */
extern char __bss_start[];
extern char _start[];
@@ -643,14 +651,6 @@
return *c1 ? c1 : NULL;
}
-static void maintabfunc(void)
-{
- if (useconf) {
- cfg_print_images();
- prom_printf("boot: %s", cbuff);
- }
-}
-
static void word_split(char **linep, char **paramsp)
{
char *p;
@@ -744,12 +744,14 @@
static void check_password(char *str)
{
int i;
+ char *passwdbuff = passwdinit();
+ if (!passwdbuff)
+ return;
prom_printf("\n%s", str);
for (i = 0; i < 3; i++) {
prom_printf("\nPassword: ");
- passwdbuff[0] = 0;
- cmdedit((void (*)(void))0, 1);
+ passwordedit(passwdbuff);
prom_printf("\n");
#ifdef USE_MD5_PASSWORDS
if (!strncmp(password, "$1$", 3)) {
@@ -773,78 +775,75 @@
prom_interpret("reset-all");
}
+static void print_boot(const char *p, const int nl)
+{
+ prom_printf("%sboot: %s", nl ? "\n": "", p ? p : "");
+}
+
+static void print_all_labels(void)
+{
+ if (useconf) {
+ cfg_print_images(NULL, 0, 0);
+ print_boot(NULL, 0);
+ }
+}
+
static int get_params(struct boot_param_t *params)
{
struct path_description img_def_device;
- char *p, *q;
- int c;
- char *imagename = NULL, *label;
- int timeout;
- int beg, end;
- int singlekey = 0;
- int restricted = 0;
+ char *p, *q, *cmdbuff, *imagename, *label;
+ int c, timeout, restricted;
+ cmdbuff = cmdlineinit();
+ if (!cmdbuff)
+ return 1;
+
+ imagename = label = NULL;
+ restricted = c = 0;
memcpy(&img_def_device, &default_device, sizeof(img_def_device));
memset(params, 0, sizeof(*params));
params->args = "";
- cmdinit();
+ print_boot(NULL, 0);
- timeout = DEFAULT_TIMEOUT;
- if (useconf && (q = cfg_get_strg(NULL, "timeout")) != 0 && *q != 0)
- timeout = simple_strtol(q, NULL, 0);
-
- prom_printf("boot: ");
- c = -1;
- if (timeout != -1) {
- beg = prom_getms();
+ if (useconf && (p = cfg_get_strg(NULL, "timeout")) && *p) {
+ timeout = simple_strtol(p, NULL, 0);
if (timeout > 0) {
- end = beg + 100 * timeout;
+ timeout = prom_getms() + 100 * timeout;
do {
c = prom_nbgetchar();
- } while (c == -1 && prom_getms() <= end);
+ } while (c == -1 && prom_getms() <= timeout);
}
- if (c == -1)
+ if (c == -1 || !c)
c = '\n';
- else if (c != '\n' && c != '\t' && c != '\r' && c != '\b') {
- cbuff[0] = c;
- cbuff[1] = 0;
- }
- }
-
- if (c != -1 && c != '\n' && c != '\r') {
- if (c == '\t') {
- maintabfunc();
- } else if (c >= ' ') {
- cbuff[0] = c;
- cbuff[1] = 0;
- if ((cfg_get_flag(cbuff, "single-key")) && useconf) {
- imagename = cbuff;
- singlekey = 1;
- prom_printf("%s\n", cbuff);
- }
+ else if (!char_is_newline(c) && !char_is_tab(c) && !char_is_backspace(c)) {
+ cmdbuff[0] = c = char_to_ascii(c);
+ cmdbuff[1] = 0;
}
}
- if (c == '\n' || c == '\r') {
- if (!imagename)
- imagename = cfg_get_default();
+ if (char_is_newline(c)) {
+ imagename = cfg_get_default();
if (imagename)
prom_printf("%s", imagename);
prom_printf("\n");
- } else if (!singlekey) {
- cmdedit(maintabfunc, 0);
- prom_printf("\n");
- imagename = cbuff;
- word_split(&imagename, ¶ms->args);
+ } else {
+ if (c >= ' ' && useconf && cfg_get_flag(cmdbuff, "single-key")) {
+ imagename = cmdbuff;
+ prom_printf("%s\n", cmdbuff);
+ } else {
+ if (char_is_tab(c))
+ print_all_labels();
+ cmdlineedit(cmdbuff, print_boot);
+ prom_printf("\n");
+ imagename = cmdbuff;
+ word_split(&imagename, ¶ms->args);
+ }
}
- /* chrp gets this wrong, force it -- Cort */
if (useconf && (!imagename || imagename[0] == 0))
imagename = cfg_get_default();
- label = 0;
-
if (useconf) {
set_default_device(cfg_get_strg(NULL, "device"), cfg_get_strg(NULL, "partition"), &img_def_device);
if (cfg_get_flag(NULL, "restricted"))
@@ -856,10 +855,10 @@
set_default_device(cfg_get_strg(label, "device"), cfg_get_strg(label, "partition"), &img_def_device);
if (cfg_get_flag(label, "restricted"))
restricted = 1;
- if (label) {
- if (params->args && password && restricted)
- check_password("To specify arguments for this image " "you must enter the password.");
- else if (password && !restricted)
+ if (label && password) {
+ if (params->args && restricted)
+ check_password("To specify arguments for this image you must enter the password.");
+ else if (!restricted)
check_password("This image is restricted.");
}
params->args = make_params(label, params->args);
@@ -1109,6 +1108,7 @@
if (bootpath) {
memset(bootpath, 0, BOOTPATH_LEN);
prom_get_chosen("bootpath", bootpath, BOOTPATH_LEN - 1);
+ hard_coded_bootpath(bootpath);
DEBUG_F("/chosen/bootpath = %s\n", bootpath);
if (bootpath[0] == 0) {
prom_printf("Couldn't determine boot device\n");
@@ -1178,7 +1178,6 @@
void *malloc_base;
prom_handle cpus[1];
- /* OF seems to do it, but I'm not very confident */
memset(__bss_start, 0, _end - __bss_start);
/* Initialize OF interface */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yaboot-10.1.20-r867/yaboot.deps new/yaboot-10.1.21-r892/yaboot.deps
--- old/yaboot-10.1.20-r867/yaboot.deps 2006-09-22 22:35:55.000000000 +0200
+++ new/yaboot-10.1.21-r892/yaboot.deps 2006-11-13 11:07:32.000000000 +0100
@@ -45,6 +45,7 @@
include/stdlib.h \
include/string.h \
include/types.h \
+ include/cmdline.h \
include/prom.h
second/cmdline.o: \
@@ -52,6 +53,8 @@
include/types.h \
include/prom.h \
include/string.h \
+ include/cmdline.h \
+ include/stdlib.h \
include/cfg.h
second/crt0.o: \
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org