Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/config Simpfily code by assuming suffix is a single ...
details: https://anonhg.NetBSD.org/src/rev/224e39874162
branches: trunk
changeset: 803925:224e39874162
user: uebayasi <uebayasi%NetBSD.org@localhost>
date: Sun Nov 16 14:57:59 2014 +0000
description:
Simpfily code by assuming suffix is a single character.
diffstat:
usr.bin/config/mkmakefile.c | 19 ++++++++-----------
1 files changed, 8 insertions(+), 11 deletions(-)
diffs (54 lines):
diff -r 4d67403df291 -r 224e39874162 usr.bin/config/mkmakefile.c
--- a/usr.bin/config/mkmakefile.c Sun Nov 16 14:49:12 2014 +0000
+++ b/usr.bin/config/mkmakefile.c Sun Nov 16 14:57:59 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkmakefile.c,v 1.30 2014/11/16 14:49:12 uebayasi Exp $ */
+/* $NetBSD: mkmakefile.c,v 1.31 2014/11/16 14:57:59 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: mkmakefile.c,v 1.30 2014/11/16 14:49:12 uebayasi Exp $");
+__RCSID("$NetBSD: mkmakefile.c,v 1.31 2014/11/16 14:57:59 uebayasi Exp $");
#include <sys/param.h>
#include <ctype.h>
@@ -533,8 +533,9 @@
emitrules(FILE *fp)
{
struct files *fi;
- const char *cp, *fpath;
- int ch;
+ size_t len;
+ const char *fpath;
+ int suffix;
TAILQ_FOREACH(fi, &allfiles, fi_next) {
const char *prologue, *prefix, *sep;
@@ -542,6 +543,8 @@
if ((fi->fi_flags & FI_SEL) == 0)
continue;
fpath = srcpath(fi);
+ len = strlen(fpath);
+ suffix = fpath[len - 1];
prologue = prefix = sep = "";
if (*fpath != '/') {
if (fi->fi_prefix != NULL) {
@@ -557,13 +560,7 @@
if (fi->fi_mkrule != NULL) {
fprintf(fp, "\t%s\n\n", fi->fi_mkrule);
} else {
- fputs("\t${NORMAL_", fp);
- cp = strrchr(fpath, '.');
- cp = cp == NULL ? fpath : cp + 1;
- while ((ch = *cp++) != '\0') {
- fputc(toupper(ch), fp);
- }
- fputs("}\n\n", fp);
+ fprintf(fp, "\t${NORMAL_%c}\n\n", toupper(suffix));
}
}
}
Home |
Main Index |
Thread Index |
Old Index