Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/microcode/cyclades-z - print ascii if debug



details:   https://anonhg.NetBSD.org/src/rev/465619658eaf
branches:  trunk
changeset: 328363:465619658eaf
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Apr 01 15:33:22 2014 +0000

description:
- print ascii if debug
- fold to 8 columns
- don't exit with random values
- change sccs magic in the generated header file

diffstat:

 sys/dev/microcode/cyclades-z/cyzfirm2h.c |  23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diffs (61 lines):

diff -r 86aada9b7ae3 -r 465619658eaf sys/dev/microcode/cyclades-z/cyzfirm2h.c
--- a/sys/dev/microcode/cyclades-z/cyzfirm2h.c  Tue Apr 01 15:28:52 2014 +0000
+++ b/sys/dev/microcode/cyclades-z/cyzfirm2h.c  Tue Apr 01 15:33:22 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cyzfirm2h.c,v 1.11 2012/03/08 16:45:10 jakllsch Exp $  */
+/*     $NetBSD: cyzfirm2h.c,v 1.12 2014/04/01 15:33:22 christos Exp $  */
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: cyzfirm2h.c,v 1.11 2012/03/08 16:45:10 jakllsch Exp $");
+__RCSID("$NetBSD: cyzfirm2h.c,v 1.12 2014/04/01 15:33:22 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/mman.h>
@@ -51,7 +51,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-int    main(int argc, char *argv[]);
 static void    usage(void) __dead;
 
 int
@@ -116,11 +115,24 @@
        while (in_len != 0) {
                if (i == 0)
                        fprintf(out_file, "\t");
-               fprintf(out_file, "0x%02x,", *in_ptr);
+               if (*in_ptr == '@' && in_len > 4 &&
+                   memcmp(in_ptr, "@(#)", 4) == 0)
+                       fprintf(out_file, "0x%02x,", '_');
+               else
+                       fprintf(out_file, "0x%02x,", *in_ptr);
                in_ptr++;
                in_len--;
                i++;
-               if (i == 10) {
+               if (i == 8) {
+#ifdef DEBUG
+                       size_t j;
+                       fprintf(out_file, "\t/* ");
+                       for (j = 0; j < 8; j++) {
+                               unsigned char c = (in_ptr - 8)[j];
+                               fputc(isprint(c) ? c : '.', out_file);
+                       }
+                       fprintf(out_file, " */");
+#endif
                        fprintf(out_file, "\n");
                        i = 0;
                } else if (in_len != 0) {
@@ -130,6 +142,7 @@
        fprintf(out_file, "\n};\n\n");
 
        fprintf(out_file, "#endif /* _%s_ */\n", include_name);
+       return 0;
 }
 
 __dead static void



Home | Main Index | Thread Index | Old Index