Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ksherlock committed Feb 9, 2016
1 parent 1864ad2 commit 47fe656
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
12 changes: 8 additions & 4 deletions flags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,13 @@ def escape_cstr(x)
help = data['help']
options = data['options']
case_insensitive = data['case_insensitive'] || false
name = data['name'] || ''

# prevent warnings for unused vars.
options = options
help = help
case_insensitive = case_insensitive
name = name

# options is an array of items which may be hashes, strings, or numbers.
# normalize them.
Expand Down Expand Up @@ -189,7 +191,9 @@ def escape_cstr(x)

b = binding # bind help, options for ERB.

#io = $stdout;
io = basename ? File.open(basename + ".c", "w") : $stdout
#io = File.open(basename + ".c", "w") unless basename.nil?
io.write(code.result(b))

io.close unless io == $stdout
Expand Down Expand Up @@ -232,7 +236,7 @@ def escape_cstr(x)
#include <string.h>
#include <stdlib.h>

#include "<%= basename + '.h' %>"
#include "<%= basename ? basename + '.h' : '' %>"

void FlagsHelp(void)
{
Expand Down Expand Up @@ -288,7 +292,7 @@ def escape_cstr(x)
% if help && !options.find_index {|x| x.char == 'h' }
case 'h':
FlagsHelp();
break;
exit(0);
% end
% #
% options.each do |opt|
Expand All @@ -310,7 +314,7 @@ def escape_cstr(x)
{
if (++i >= argc)
{
fputs("option requires an argument -- <%= opt.char %>\n", stderr);
fputs("### <%= name %> - \"-<%= opt.char %>\" requires an argument.\n", stderr);
exit(1);
}
optarg = argv[i];
Expand All @@ -329,7 +333,7 @@ def escape_cstr(x)
% end # options.each

default:
fprintf(stderr, "illegal option -- %c\n", c);
fprintf(stderr, "### <%= name %> - \"-%c\" is not an option.", c);
exit(1);
}

Expand Down
14 changes: 12 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,23 @@ LIBS = \

# LDFLAGS = -d -c 'MPS ' -t MPST

all: Help GetEnv Duplicate SetFile OverlayIIgs ListRez ListRezIIgs MakeEnums ReadGlobal Parameters Echo
TARGETS = Help GetEnv Delete Duplicate SetFile OverlayIIgs ListRez ListRezIIgs\
MakeEnums ReadGlobal Parameters Echo

all: $(TARGETS)

clean:
rm -f *.o
rm -f Help GetEnv Duplicate SetFile OverlayIIgs MakeEnums ReadGlobal
rm -f $(TARGETS)
rm -f libc/libc libc/*.o

dist/Tools.tgz: $(TARGETS)
cp $^ dist/Tools/
rm -f $@
cd dist; tar cfz Tools.tgz Tools/
#zip -r Tools.zip Tools


libc/libc: libc/strcasecmp.c.o
$(MPW) Lib $(LIBFLAGS) -o $@ $^

Expand Down

0 comments on commit 47fe656

Please sign in to comment.