From c6d2b09f7673a33e75a4f5a38368e9684c2ecc79 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Fri, 28 Jan 2011 07:47:10 +0000 Subject: [PATCH] Move CLI portion of nvramtool into cli/ subdirectory as first step towards librarization. Also: update one regex wrapper user. Signed-off-by: Patrick Georgi Acked-by: Stefan Reinauer git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6310 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/nvramtool/Makefile | 12 ++++++++---- util/nvramtool/{ => cli}/nvramtool.8 | 0 util/nvramtool/{ => cli}/nvramtool.c | 5 ++--- util/nvramtool/{ => cli}/opts.c | 0 util/nvramtool/{ => cli}/opts.h | 0 5 files changed, 10 insertions(+), 7 deletions(-) rename util/nvramtool/{ => cli}/nvramtool.8 (100%) rename util/nvramtool/{ => cli}/nvramtool.c (99%) rename util/nvramtool/{ => cli}/opts.c (100%) rename util/nvramtool/{ => cli}/opts.h (100%) diff --git a/util/nvramtool/Makefile b/util/nvramtool/Makefile index 4ddce0f74c..673b394455 100644 --- a/util/nvramtool/Makefile +++ b/util/nvramtool/Makefile @@ -24,12 +24,16 @@ CC = gcc STRIP = strip INSTALL = /usr/bin/install PREFIX = /usr/local -CFLAGS = -O2 -g -Wall -W +CFLAGS = -O2 -g -Wall -W -I. #CFLAGS = -Os -Wall +CLI_OBJS = cli/nvramtool.o cli/opts.o + OBJS = cmos_lowlevel.o cmos_ops.o common.o compute_ip_checksum.o \ hexdump.o input_file.o layout.o layout_file.o lbtable.o \ - nvramtool.o opts.o reg_expr.o cbfs.o + reg_expr.o cbfs.o + +OBJS += $(CLI_OBJS) OS_ARCH = $(shell uname) ifeq ($(OS_ARCH), Darwin) @@ -43,7 +47,7 @@ $(PROGRAM): $(OBJS) $(STRIP) $(STRIP_ARGS) $(PROGRAM) clean: - rm -f $(PROGRAM) *.o + rm -f $(PROGRAM) $(OBJS) distclean: clean rm -f .dependencies @@ -55,7 +59,7 @@ install: $(PROGRAM) mkdir -p $(DESTDIR)$(PREFIX)/sbin $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8 - $(INSTALL) $(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8 + $(INSTALL) cli/$(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8 .PHONY: all clean distclean dep diff --git a/util/nvramtool/nvramtool.8 b/util/nvramtool/cli/nvramtool.8 similarity index 100% rename from util/nvramtool/nvramtool.8 rename to util/nvramtool/cli/nvramtool.8 diff --git a/util/nvramtool/nvramtool.c b/util/nvramtool/cli/nvramtool.c similarity index 99% rename from util/nvramtool/nvramtool.c rename to util/nvramtool/cli/nvramtool.c index cb717513ae..e3e7e8875a 100644 --- a/util/nvramtool/nvramtool.c +++ b/util/nvramtool/cli/nvramtool.c @@ -682,8 +682,7 @@ static void parse_assignment(char arg[], const char **name, const char **value) regmatch_t match[N_MATCHES]; regex_t assignment; - compile_reg_exprs(REG_EXTENDED | REG_NEWLINE, 1, assignment_regex, - &assignment); + compile_reg_expr(REG_EXTENDED | REG_NEWLINE, assignment_regex, &assignment); /* Does 'arg' conform to proper assignment syntax? If not, exit with a * usage message. @@ -699,7 +698,7 @@ static void parse_assignment(char arg[], const char **name, const char **value) *name = &arg[match[1].rm_so]; *value = &arg[match[2].rm_so]; - free_reg_exprs(1, &assignment); + regfree(&assignment); } /**************************************************************************** diff --git a/util/nvramtool/opts.c b/util/nvramtool/cli/opts.c similarity index 100% rename from util/nvramtool/opts.c rename to util/nvramtool/cli/opts.c diff --git a/util/nvramtool/opts.h b/util/nvramtool/cli/opts.h similarity index 100% rename from util/nvramtool/opts.h rename to util/nvramtool/cli/opts.h