Source-Changes-HG archive

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

[xsrc/trunk]: xsrc/local/programs/bdfload if there are comments in the bdf co...



details:   https://anonhg.NetBSD.org/xsrc/rev/4452398329b9
branches:  trunk
changeset: 7137:4452398329b9
user:      macallan <macallan%NetBSD.org@localhost>
date:      Tue Aug 23 18:28:14 2022 +0000

description:
if there are comments in the bdf copy them into the header output

diffstat:

 local/programs/bdfload/bdfload.c |  14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diffs (42 lines):

diff -r 3112fd93bcc1 -r 4452398329b9 local/programs/bdfload/bdfload.c
--- a/local/programs/bdfload/bdfload.c  Tue Aug 23 18:11:43 2022 +0000
+++ b/local/programs/bdfload/bdfload.c  Tue Aug 23 18:28:14 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bdfload.c,v 1.9 2022/08/23 18:11:43 macallan Exp $     */
+/*     $NetBSD: bdfload.c,v 1.10 2022/08/23 18:28:14 macallan Exp $    */
 
 /*
  * Copyright (c) 2018 Michael Lorenz
@@ -100,6 +100,8 @@
 int verbose = 0;
 int dump = 0;
 int header = 0;
+char commentbuf[2048] = "";
+int commentptr = 0;
 
 void
 dump_line(char *gptr, int stride)
@@ -172,6 +174,12 @@
                fprintf(stderr, "Can't open output file %s\n", filename);
                return -1;
        }
+       if (commentptr > 0) {
+               fprintf(output, "/*\n");
+               fputs(commentbuf, output);
+               fprintf(output, "*/\n\n");
+       }
+
        fprintf(output, "static u_char %s_data[];\n", fontname);
        fprintf(output, "\n");
        fprintf(output, "static struct wsdisplay_font %s = {\n", fontname);
@@ -246,6 +254,10 @@
                        strncpy(name, arg + 1, 64);
                        name[strlen(name) - 1] = 0;
                        if (verbose) printf("name: %s\n", name);
+               } else if (strcmp(line, "COMMENT") == 0) {
+                       commentptr += snprintf(&commentbuf[commentptr],
+                                             2048 - commentptr,
+                                             "%s\n", arg);
                } else if (strcmp(line, "FONTBOUNDINGBOX") == 0) {
                        int res;
                        res = sscanf(arg, "%d %d %d %d",



Home | Main Index | Thread Index | Old Index