replace linkfile functionality with command-line options

Instead of running:
$ xlink linkfile.txt
where the linkfile looks like:
---
[Objects]
foo.o
bar.o

[Libraries]
foo.l
bar.l

[Output]
baz.gb
---
we now do:
$ xlink -o baz.gb -l foo.l -l bar.l foo.o bar.o
This commit is contained in:
bentley
2010-01-15 10:52:38 -07:00
parent b223905e67
commit 755572c111

View File

@@ -118,19 +118,23 @@ main(int argc, char *argv[])
int ch;
char *ep;
SLONG argn = 0;
if (argc == 1)
usage();
while ((ch = getopt(argc, argv, "m:n:s:t:z:")) != -1) {
while ((ch = getopt(argc, argv, "l:m:n:o:s:t:z:")) != -1) {
switch (ch) {
case 'l':
lib_Readfile(optarg);
break;
case 'm':
SetMapfileName(optarg);
break;
case 'n':
SetSymfileName(optarg);
break;
case 'o':
out_Setname(optarg);
break;
case 's':
options |= OPT_SMART_C_LINK;
strcpy(smartlinkstartsymbol, optarg);
@@ -171,16 +175,18 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
if (argc == 1) {
ProcessLinkfile(argv[argc - 1]);
AddNeededModules();
AssignSections();
CreateSymbolTable();
Patch();
Output();
CloseMapfile();
} else
if (argc == 0)
usage();
for (int i = 0; i < argc; ++i)
obj_Readfile(argv[i]);
AddNeededModules();
AssignSections();
CreateSymbolTable();
Patch();
Output();
CloseMapfile();
return (0);
}