Dash:
[t2-trunk.git] / package / boot / quik / lib_update.patch
blob5f0beb3bf1caa48ca324b784898941507becc53c
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../quik/lib_update.patch
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
7 #
8 # More information can be found in the files COPYING and README.
9 #
10 # This patch file is dual-licensed. It is available under the license the
11 # patched project is licensed under, as long as it is an OpenSource license
12 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
13 # of the GNU General Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at your option) any later
15 # version.
16 # --- T2-COPYRIGHT-NOTE-END ---
18 --- ./quik/quik.c 2002-06-05 08:04:29.000000000 -0400
19 +++ ./quik/quik.c 2002-12-14 19:04:12.000000000 -0500
20 @@ -225,7 +225,7 @@
21 strcat(buffer, path + 1);
22 return buffer;
23 } else
24 - return strdup(path);
25 + return (char *) strdup(path);
28 void write_block_table(char *device, char *config_file, int partno)
29 --- ./second/cfg.c 2002-06-05 08:04:29.000000000 -0400
30 +++ ./second/cfg.c 2002-12-14 18:53:49.000000000 -0500
31 @@ -98,10 +98,10 @@
32 va_list ap;
34 va_start (ap, msg);
35 - printf ("Config file error: ");
36 - vprintf (msg, ap);
37 + q_printf ("Config file error: ");
38 + q_vprintf (msg, ap);
39 va_end (ap);
40 - printf (" near line %d in file %s\n", line_num, file_name);
41 + q_printf (" near line %d in file %s\n", line_num, file_name);
42 longjmp (env, 1);
45 @@ -110,10 +110,10 @@
46 va_list ap;
48 va_start (ap, msg);
49 - printf ("Config file warning: ");
50 - vprintf (msg, ap);
51 + q_printf ("Config file warning: ");
52 + q_vprintf (msg, ap);
53 va_end (ap);
54 - printf (" near line %d in file %s\n", line_num, file_name);
55 + q_printf (" near line %d in file %s\n", line_num, file_name);
58 inline int getc ()
59 @@ -371,8 +371,8 @@
60 int len = strlen (label);
62 if (!printl_count)
63 - printf ("\n");
64 - printf ("%s", label);
65 + q_printf ("\n");
66 + q_printf ("%s", label);
67 while (len++ < 25)
68 putchar (' ');
69 printl_count++;
70 @@ -399,7 +399,7 @@
71 if (alias)
72 printlabel (alias);
74 - printf ("\nYou can also type in custom image locations, in the form\n"
75 + q_printf ("\nYou can also type in custom image locations, in the form\n"
76 "{prom_path;}partno/path_to_image or {prom_path;}{partno}[start-end]\n");
79 --- ./second/disk.c 2000-03-10 15:59:28.000000000 -0500
80 +++ ./second/disk.c 2002-12-14 18:54:37.000000000 -0500
81 @@ -10,7 +10,7 @@
83 current_dev = call_prom("open", 1, 1, device);
84 if (current_dev == (ihandle) 0 || current_dev == (ihandle) -1) {
85 - printf("\nCouldn't open %s\n", device);
86 + q_printf("\nCouldn't open %s\n", device);
87 return -1;
89 strcpy(current_devname, device);
90 @@ -53,7 +53,7 @@
91 * just a few partitions. -- Cort
93 if ( is_chrp )
94 - sprintf(bootdevice, "disk:0");
95 + q_sprintf(bootdevice, "disk:0");
96 if( open(bootdevice) )
99 @@ -61,7 +61,7 @@
100 * try this if disk:0 fails
101 * -- Cort
103 - sprintf(bootdevice, "/pci@fee00000/scsi@c/sd@8:0");
104 + q_sprintf(bootdevice, "/pci@fee00000/scsi@c/sd@8:0");
105 return open(bootdevice);
107 return 0;
108 --- ./second/file.c 2002-06-05 08:04:29.000000000 -0400
109 +++ ./second/file.c 2002-12-14 18:59:19.000000000 -0500
110 @@ -23,7 +23,7 @@
111 #include <sys/types.h>
112 #include <errno.h>
113 #include "quik.h"
114 -typedef int FILE;
115 +typedef int q_FILE;
116 #include <linux/ext2_fs.h>
117 #include <ext2fs/ext2fs.h>
118 #include <setjmp.h>
119 @@ -155,7 +155,7 @@
120 /* check the MSDOS partition magic */
121 if ( (blk[0x1fe] != 0x55) || (blk[0x1ff] != 0xaa) )
123 - printf("No MSDOS partition magic number on disk!\n");
124 + q_printf("No MSDOS partition magic number on disk!\n");
125 return 0;
127 if ( part >= 4 )
128 @@ -167,14 +167,14 @@
129 return 1;
132 -int sprintf (char *buf, char *fmt,...)
133 +int q_sprintf (char *buf, char *fmt,...)
135 strcpy (buf, fmt);
138 void com_err (const char *a, long i, const char *fmt,...)
140 - printf ((char *) fmt);
141 + q_printf ((char *) fmt);
144 static errcode_t linux_open (const char *name, int flags, io_channel * channel)
145 @@ -222,7 +222,7 @@
146 tempb = (((long long) block) * ((long long)bs)) + doff;
147 size = (count < 0) ? -count : count * bs;
148 if (read (data, size, tempb) != size) {
149 - printf ("\nRead error on block %d", block);
150 + q_printf ("\nRead error on block %d", block);
151 return EXT2_ET_SHORT_READ;
153 return 0;
154 @@ -253,7 +253,7 @@
155 static char rot[] = "\\|/-";
157 if (!(i % freq))
158 - printf ("%c\b", rot[(i / freq) % 4]);
159 + q_printf ("%c\b", rot[(i / freq) % 4]);
160 i++;
163 @@ -314,7 +314,7 @@
164 block_cnt = 0;
165 retval = ext2fs_block_iterate(fs, inode, 0, 0, dump_block, 0);
166 if (retval) {
167 - printf ("Error %d reading %s", retval, filename);
168 + q_printf ("Error %d reading %s", retval, filename);
169 return 0;
171 return dump_finish();
172 @@ -342,7 +342,7 @@
175 if (end == -1) {
176 - printf ("\n"
177 + q_printf ("\n"
178 "Ranges of physical blocks are specified as {prom_path:}{partno}[xx-yy]\n"
179 "where {} means optional part, partno defaults to 0 (i.e. whole disk)\n"
180 "and xx is the starting block (chunk of 512 bytes) and yy end (not\n"
181 @@ -369,7 +369,7 @@
185 - printf ("\nInternal error while loading blocks from device\n");
186 + q_printf ("\nInternal error while loading blocks from device\n");
187 return 0;
190 @@ -406,7 +406,7 @@
192 type = ext2;
193 if (retval = ext2fs_namei(fs, root, cwd, filename, &inode)) {
194 - printf("\nInode error #%d while loading file %s.", retval, filename);
195 + q_printf("\nInode error #%d while loading file %s.", retval, filename);
196 ext2fs_close(fs);
197 return 0;
199 --- ./second/main.c 2002-06-05 08:04:29.000000000 -0400
200 +++ ./second/main.c 2002-12-14 18:57:18.000000000 -0500
201 @@ -57,14 +57,14 @@
203 void fatal(const char *msg)
205 - printf("\nFatal error: %s\n", msg);
206 + q_printf("\nFatal error: %s\n", msg);
209 void maintabfunc (void)
211 if (useconf) {
212 cfg_print_images();
213 - printf("boot: %s", cbuff);
214 + q_printf("boot: %s", cbuff);
218 @@ -217,7 +217,7 @@
219 if (useconf && (q = cfg_get_strg(0, "timeout")) != 0 && *q != 0)
220 timeout = strtol(q, NULL, 0);
222 - printf("boot: ");
223 + q_printf("boot: ");
224 c = -1;
225 if (timeout != -1) {
226 beg = get_ms();
227 @@ -232,14 +232,14 @@
230 if (c == '\n') {
231 - printf("%s", imagename);
232 + q_printf("%s", imagename);
233 if (*params)
234 - printf(" %s", *params);
235 - printf("\n");
236 + q_printf(" %s", *params);
237 + q_printf("\n");
238 } else {
239 cmdinit();
240 cmdedit(maintabfunc, c);
241 - printf("\n");
242 + q_printf("\n");
243 strcpy(given_bootargs, cbuff);
244 given_bootargs_by_user = 1;
245 imagename = cbuff;
246 @@ -296,7 +296,7 @@
247 if (!*device)
248 *device = defdevice;
249 if (!*kname)
250 - printf(
251 + q_printf(
252 "Enter the kernel image name as [device:][partno]/path, where partno is a\n"
253 "number from 0 to 16. Instead of /path you can type [mm-nn] to specify a\n"
254 "range of disk blocks (512B)\n");
255 @@ -328,7 +328,7 @@
256 device = cfg_get_strg(0, "device");
257 if (load_file(device, part, kname, TMP_BUF, TMP_END, &len, 1, 0)) {
258 TMP_BUF[len] = 0;
259 - printf("\n%s", (char *)TMP_BUF);
260 + q_printf("\n%s", (char *)TMP_BUF);
264 @@ -377,7 +377,7 @@
266 if ( (unsigned long)prom_entry == 0x426f6f58 )
268 - printf("BootX launched us\n");
269 + q_printf("BootX launched us\n");
270 prom_entry = (void *)id;
272 * These should come from the bootx info.
273 @@ -391,7 +391,7 @@
275 memset(&__bss_start, 0, &_end - &__bss_start);
276 prom_init(prom_entry);
277 - printf("Second-stage QUIK loader\n");
278 + q_printf("Second-stage QUIK loader\n");
280 if (diskinit() == -1)
281 prom_exit();
282 @@ -403,24 +403,24 @@
283 fileok = load_file(0, quik_conf_part, quik_conf,
284 TMP_BUF, TMP_END, &len, 1, 0);
285 if (!fileok || (unsigned) len >= 65535)
286 - printf("\nCouldn't load %s\n", quik_conf);
287 + q_printf("\nCouldn't load %s\n", quik_conf);
288 else {
289 char *p;
290 if (cfg_parse(quik_conf, TMP_BUF, len) < 0)
291 - printf ("Syntax error or read error in %s.\n", quik_conf);
292 + q_printf ("Syntax error or read error in %s.\n", quik_conf);
293 useconf = 1;
294 p = cfg_get_strg(0, "init-code");
295 if (p)
296 call_prom("interpret", 1, 1, p);
297 p = cfg_get_strg(0, "init-message");
298 if (p)
299 - printf("%s", p);
300 + q_printf("%s", p);
301 p = cfg_get_strg(0, "message");
302 if (p)
303 print_message_file(p);
305 } else
306 - printf ("\n");
307 + q_printf ("\n");
309 for (;;) {
310 get_params(&device, &part, &kname, &params);
311 @@ -431,11 +431,11 @@
312 TMP_BUF, TMP_END, &image_len, 1, 0);
314 if (!fileok) {
315 - printf ("\nImage not found.... try again\n");
316 + q_printf ("\nImage not found.... try again\n");
317 continue;
319 if (image_len > TMP_END - TMP_BUF) {
320 - printf("\nImage is too large (%u > %u)\n", image_len,
321 + q_printf("\nImage is too large (%u > %u)\n", image_len,
322 TMP_END - TMP_BUF);
323 continue;
325 @@ -448,13 +448,13 @@
326 e->e_ident[EI_MAG1] == ELFMAG1 &&
327 e->e_ident[EI_MAG2] == ELFMAG2 &&
328 e->e_ident[EI_MAG3] == ELFMAG3)) {
329 - printf ("\n%s: unknown image format\n", kname);
330 + q_printf ("\n%s: unknown image format\n", kname);
331 continue;
334 if (e->e_ident[EI_CLASS] != ELFCLASS32
335 || e->e_ident[EI_DATA] != ELFDATA2MSB) {
336 - printf("Image is not a 32bit MSB ELF image\n");
337 + q_printf("Image is not a 32bit MSB ELF image\n");
338 continue;
340 len = 0;
341 @@ -470,7 +470,7 @@
342 len = p->p_offset + p->p_filesz - off;
344 if (len == 0) {
345 - printf("Cannot find a loadable segment in ELF image\n");
346 + q_printf("Cannot find a loadable segment in ELF image\n");
347 continue;
349 entry = e->e_entry & ADDRMASK;
350 @@ -488,9 +488,9 @@
352 close();
353 if (pause_after) {
354 - printf("%s", pause_message);
355 + q_printf("%s", pause_message);
356 prom_pause();
357 - printf("\n");
358 + q_printf("\n");
362 @@ -509,12 +509,12 @@
363 /* doesn't look like a procedure descriptor */
364 start += entry;
366 - printf("Starting at %x\n", start);
367 + q_printf("Starting at %x\n", start);
368 #ifdef BOOTINFO
369 /* setup the bootinfo */
370 binf.magic_start = bin.magic_end = BOOT_INFO_MAGIC;
371 - sprintf( binf.cmd_line, "%s", params );
372 - sprintf( binf.boot_loader, "Quik" );
373 + q_sprintf( binf.cmd_line, "%s", params );
374 + q_sprintf( binf.boot_loader, "Quik" );
375 if ( is_chrp )
376 binf._machine = _MACH_chrp;
377 else
378 --- ./second/printf.c 2000-03-10 15:59:28.000000000 -0500
379 +++ ./second/printf.c 2002-12-14 18:58:02.000000000 -0500
380 @@ -20,23 +20,23 @@
381 #include "quik.h"
383 static void printn(long, int);
384 -extern void vprintf(char *, va_list);
385 +extern void q_vprintf(char *, va_list);
388 * Scaled down version of C Library printf.
389 * Only %c %s %u %d (==%u) %o %x %D %O are recognized.
392 -void printf (char *fmt,...)
393 +void q_printf (char *fmt,...)
395 va_list x1;
397 va_start (x1, fmt);
398 - vprintf (fmt, x1);
399 + q_vprintf (fmt, x1);
400 va_end (x1);
403 -void vprintf (char *fmt, va_list adx)
404 +void q_vprintf (char *fmt, va_list adx)
406 register c;
407 char *s;