Changeset 938
- Timestamp:
- Jan 7, 2004, 6:30:46 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/src/emx/src/emxomf/emxomfld.c (modified) (5 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/emxomf/emxomfld.c
-
Property cvs2svn:cvs-rev
changed from
1.33to1.34
r937 r938 34 34 #include <sys/utime.h> 35 35 #include <sys/moddef.h> 36 #include < emx/getopt.h>36 #include <getopt.h> 37 37 #include <alloca.h> 38 38 #include <sys/omflib.h> … … 178 178 #endif 179 179 extern int _System DosCopy (char *, char *, int); 180 181 /* Tell the user how to run this program. */182 183 static void usage (void)184 {185 fprintf (stderr, "emxomfld " VERSION INNOTEK_VERSION "\n"186 "Copyright (c) 1992-1996 by Eberhard Mattes\n"187 "Copyright (c) 2003 by InnoTek Systemberatung GmbH\n\n");188 189 fprintf (stderr,190 "Usage: emxomfld -o <file> [-l <lib>] [-L <libdir>] [-T <base>] [-igtsS]\n"191 " [-Zexe] [-Zdll] [-Zstack <size>] [-Zmap[=<map_file>]]\n"192 " [-Z[no-]autoconv] [-O <option>] <file>...\n"193 "\n"194 "Options:\n"195 " -Zno-autoconv / -Zautoconv:\n"196 " Turns off/on the automatic conversion of a.out libs and objs.\n"197 " default: -Zautoconv\n"198 "\n"199 "Environment variables:\n"200 " EMXOMFLD_TYPE:\n"201 " The type of linker we're using. Values: VAC365, VAC308, LINK386.\n"202 " VAC365 ilink.exe from IBM C and C++ Compilers for OS/2 v3.6 or later.\n"203 " VAC308 ilink.exe from Visual Age for C++ v3.08.\n"204 " LINK386 link386 form OS/2 install or DDK.\n"205 " EMXOMFLD_LINKER:\n"206 " Name of the linker to use and optionally extra parameters. Spaces in the\n"207 " linker name or path is not supported. Quotes are not supported either.\n"208 "The default values for these two variables are VAC365 and ilink.exe.\n");209 exit (1);210 }211 212 180 213 181 /* Allocate N bytes of memory. Quit on failure. This function is … … 1125 1093 } 1126 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1127 1176 1128 1177 /* Main function of emxomf. Parse the command line and call the IBM/M$ … … 1136 1185 char execname[512]; 1137 1186 name_list *pcur; 1187 1138 1188 1139 1189 /* Get options from response files (@filename) and wildcard (*.o) on the command. */ … … 1149 1199 1150 1200 files = 0; 1151 opterr = FALSE; optmode = GETOPT_KEEP; 1201 opterr = FALSE; 1202 /*optmode = GETOPT_KEEP; */ 1152 1203 if (argc < 2) 1153 1204 usage (); 1154 1205 1155 1206 /* Parse the command line options and other arguments. */ 1156 1157 while ((c = getopt (argc, argv, "o:O:itl:vL:T:sSxXZ:")) != EOF) 1158 switch (c) 1159 { 1160 case 't': 1161 case 'i': /* Trace the linking process, sending /INFO to the IBM/M$ linker. */ 1162 opt_t = TRUE; 1163 break; 1164 1165 case 'l': /* Add library */ 1166 add_name_list (&add_lib_fnames, optarg); 1167 break; 1168 1169 case 'o': /* Set output file name */ 1170 output_fname = optarg; 1171 break; 1172 1173 case 'L': /* Add library directory */ 1174 add_name_list (&add_libdirs, optarg); 1175 break; 1176 1177 case 'T': /* Set base address */ 1178 base = optarg; 1179 break; 1180 1181 case 's': /* Strip all symbols */ 1182 case 'S': /* Strip debugging symbols */ 1183 strip_symbols = TRUE; 1184 break; 1185 1186 case 'x': /* Discard all local symbols */ 1187 case 'X': /* Discard local symbols starting with L */ 1188 break; 1189 1190 case 'v': /* For compatibility */ 1191 break; 1192 1193 case 'O': /* Specify Linker option */ 1194 add_name_list (&add_options, optarg); 1195 break; 1196 1197 case 'Z': /* -Zdll, -Zexe, -Zmap, and -Zstack */ 1198 if (strcmp (optarg, "dll") == 0) 1207 //while ((c = getopt_long (argc, argv, "o:O:itl:vL:T:sSxX", longopts, &longind)) != EOF) 1208 while ((c = getopt_long_only (argc, argv, "-l:y:L:", longopts, &longind)) != EOF) 1209 { 1210 if (c == 0) 1211 c = longopts[longind].val; 1212 switch (c) 1213 { 1214 case '?': 1215 usage(); 1216 break; 1217 1218 case 0: /* Non-option argument */ 1219 1220 /* Extract the extension to see what to do with this 1221 argument. */ 1222 1223 ext = _getext (optarg); 1224 1225 if (ext == NULL) 1226 { 1227 /* GCC's temporary files don't have an extension. Add a 1228 dot to the end of the name to prevent the linker from 1229 adding `.obj'. */ 1230 1231 sprintf (tmp, "%s.", optarg); 1232 add_name_list (&add_obj_fnames, tmp); 1233 } 1234 1235 /* If it's a .def file, use it as module definition file 1236 (input). */ 1237 1238 else if (stricmp (ext, ".def") == 0) 1239 { 1240 if (def_fname != NULL) 1241 { 1242 fprintf (stderr, 1243 "emxomfld: multiple module definition files\n"); 1244 usage (); 1245 } 1246 def_fname = optarg; 1247 } 1248 1249 /* If it's a .res file, use it as binary resource file 1250 (input). */ 1251 1252 else if (stricmp (ext, ".res") == 0) 1253 { 1254 if (res_fname != NULL) 1255 { 1256 fprintf (stderr, 1257 "emxomfld: multiple binary resource files\n"); 1258 usage (); 1259 } 1260 res_fname = optarg; 1261 } 1262 1263 /* If it's a .lib file, use it as library file. We also 1264 accept .a files for those who use OMF files disguised as 1265 a.out files (to simplify their make files). */ 1266 1267 else if (stricmp (ext, ".lib") == 0 || stricmp (ext, ".a") == 0 || stricmp (ext, ".dll") == 0) 1268 add_name_list (&add_lib_fnames, optarg); 1269 1270 /* Otherwise, assume it's an object file. */ 1271 1272 else 1273 add_name_list (&add_obj_fnames, optarg); 1274 ++files; 1275 break; 1276 1277 case 't': 1278 case 'i': /* Trace the linking process, sending /INFO to the IBM/M$ linker. */ 1279 opt_t = TRUE; 1280 break; 1281 1282 case 'l': /* Add library */ 1283 add_name_list (&add_lib_fnames, optarg); 1284 break; 1285 1286 case 'o': /* Set output file name */ 1287 output_fname = optarg; 1288 break; 1289 1290 case 'L': /* Add library directory */ 1291 add_name_list (&add_libdirs, optarg); 1292 break; 1293 1294 case 'T': /* Set base address */ 1295 base = optarg; 1296 break; 1297 1298 case 's': /* Strip all symbols */ 1299 case 'S': /* Strip debugging symbols */ 1300 strip_symbols = TRUE; 1301 break; 1302 1303 case 'x': /* Discard all local symbols */ 1304 case 'X': /* Discard local symbols starting with L */ 1305 break; 1306 1307 case 'v': /* For compatibility */ 1308 break; 1309 1310 case 'O': /* Specify Linker option */ 1311 add_name_list (&add_options, optarg); 1312 break; 1313 1314 case OPT_ZDLL: 1199 1315 dll_flag = TRUE; 1200 else if (strcmp (optarg, "exe") == 0) 1316 break; 1317 1318 case OPT_ZEXE: 1201 1319 exe_flag = TRUE; 1202 else if (strcmp (optarg, "map") == 0) 1320 break; 1321 1322 case OPT_ZMAP: 1203 1323 map_flag = TRUE; 1204 else if (strncmp (optarg, "map=", 4) == 0) 1205 { 1206 if (map_fname != NULL) 1207 { 1208 fprintf (stderr, "emxomfld: multiple map files files\n"); 1209 usage (); 1210 } 1211 map_fname = optarg + 4; 1212 map_flag = TRUE; 1213 } 1214 else if (strcmp (optarg, "stack") == 0) 1215 { 1216 /* This makes assumptions on the internals of getopt(). */ 1217 1218 if (optind >= argc || argv[optind][0] == '-') 1219 usage (); 1220 errno = 0; 1221 stack_size = strtol (argv[optind], &t, 0); 1222 if (errno != 0 || *t != 0 || t == argv[optind]) 1223 usage (); 1224 ++optind; 1225 } 1226 else if (strcmp (optarg, "autoconv") == 0) 1324 if (optarg) 1325 { 1326 if (map_fname != NULL) 1327 { 1328 fprintf (stderr, "emxomfld: multiple map files files\n"); 1329 usage (); 1330 } 1331 map_fname = optarg; 1332 } 1333 break; 1334 1335 case OPT_ZSTACK: 1336 if (!optarg) 1337 usage (); 1338 errno = 0; 1339 stack_size = strtol (argv[optind], &t, 0); 1340 if (errno != 0 || *t != 0 || t == argv[optind]) 1341 usage (); 1342 break; 1343 1344 case OPT_ZAUTOCONV: 1227 1345 autoconvert_flag = 1; 1228 else if (strcmp (optarg, "no-autoconv") == 0) 1346 break; 1347 case OPT_ZNO_AUTOCONV: 1229 1348 autoconvert_flag = 0; 1230 else 1231 { 1232 fprintf (stderr, "emxomfld: invalid option (%s)\n", optarg); 1233 usage (); 1234 } 1235 break; 1236 1237 case 0: /* Non-option argument */ 1238 1239 /* Extract the extension to see what to do with this 1240 argument. */ 1241 1242 ext = _getext (optarg); 1243 1244 if (ext == NULL) 1245 { 1246 /* GCC's temporary files don't have an extension. Add a 1247 dot to the end of the name to prevent the linker from 1248 adding `.obj'. */ 1249 1250 sprintf (tmp, "%s.", optarg); 1251 add_name_list (&add_obj_fnames, tmp); 1252 } 1253 1254 /* If it's a .def file, use it as module definition file 1255 (input). */ 1256 1257 else if (stricmp (ext, ".def") == 0) 1258 { 1259 if (def_fname != NULL) 1260 { 1261 fprintf (stderr, 1262 "emxomfld: multiple module definition files\n"); 1263 usage (); 1264 } 1265 def_fname = optarg; 1266 } 1267 1268 /* If it's a .res file, use it as binary resource file 1269 (input). */ 1270 1271 else if (stricmp (ext, ".res") == 0) 1272 { 1273 if (res_fname != NULL) 1274 { 1275 fprintf (stderr, 1276 "emxomfld: multiple binary resource files\n"); 1277 usage (); 1278 } 1279 res_fname = optarg; 1280 } 1281 1282 /* If it's a .lib file, use it as library file. We also 1283 accept .a files for those who use OMF files disguised as 1284 a.out files (to simplify their make files). */ 1285 1286 else if (stricmp (ext, ".lib") == 0 || stricmp (ext, ".a") == 0 || stricmp (ext, ".dll") == 0) 1287 add_name_list (&add_lib_fnames, optarg); 1288 1289 /* Otherwise, assume it's an object file. */ 1290 1291 else 1292 add_name_list (&add_obj_fnames, optarg); 1293 ++files; 1294 break; 1295 1296 default: 1297 fprintf (stderr, "emxomfld: invalid option (%s)\n", argv[optind - 1]); 1298 usage (); 1299 } 1300 1349 1350 default: 1351 fprintf (stderr, "emxomfld: invalid option (%s)\n", argv[optind - 1]); 1352 usage (); 1353 } 1354 } 1301 1355 /* Set default value for output file. */ 1302 1356 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
