Changeset 917
- Timestamp:
- Jan 2, 2004, 3:24:00 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/emxomf/emxomfld.c
-
Property cvs2svn:cvs-rev
changed from
1.31
to1.32
r916 r917 653 653 654 654 655 /* Converts the file indicated by pf & pszFilename to omf closing f and 656 updating filename with the new (temporary filename). A successful 657 return from the function returns a pointe to the filestream for the 658 converted file. On failure NULL is returned, f is closed adn filename 659 is undefined. */ 660 661 static FILE *lx_to_omf (FILE *pf, char *pszFilename) 662 { 663 int rc; 664 char * pszNewFile; 665 name_list *pName; 666 667 fclose(pf); /* don't need this! */ 668 669 if (opt_t) 670 fprintf(stderr, "emxomfld: info: converting %s %s to an OMF import lib.\n", 671 "lib", pszFilename); 672 673 /* 674 * Make temporary file. 675 */ 676 pName = xmalloc(sizeof(name_list)); 677 pName->name = pszNewFile = xmalloc(_MAX_PATH); 678 if (make_tempfile(pszNewFile, "ldconv", ".lib")) 679 { 680 free(pszNewFile); 681 return NULL; 682 } 683 684 /* 685 * Do the conversion. 686 */ 687 rc = spawnlp(P_WAIT, "emximp.exe", "emximp.exe", 688 "-o", pszNewFile, pszFilename, NULL); 689 if (!rc) 690 { 691 /* open the file */ 692 pf = fopen(pszNewFile, "rb"); 693 if (pf) 694 { 695 /* add to auto delete list for removal on exit(). */ 696 pName->next = conv_list; 697 conv_list = pName; 698 699 strcpy(pszFilename, pszNewFile); 700 701 if (opt_t) 702 fprintf(stderr, "emxomfld: info: convert result '%s'.\n", 703 pszFilename); 704 return pf; 705 } 706 remove(pszNewFile); 707 } 708 free(pszNewFile); 709 free(pName); 710 711 fprintf (stderr, "emxomfld: a.out to omf conversion failed for '%s'.\n", 712 pszFilename); 713 exit (2); 714 return NULL; 715 } 716 717 718 655 719 /* Finds the full path of a OMF library or object file. 656 720 … … 671 735 a 'something.a' when 'libsomething.lib' is available. 672 736 737 We support linking with DLLs if they have a path as we're not yet ready 738 to start searching for them or anything of that kind of real UNIXy 739 behaviour. 740 673 741 Returns pointer to file stream and FULLNAME set to it's name on success. 674 742 Returns NULL and FULLNAME a copy of NAME on failure. … … 681 749 size_t pathlen, namelen = strlen (name); 682 750 const char *libpath, *x; 683 int i, has_ext = 0, has_path;751 int i, has_ext = 0, is_dll = 0, has_path; 684 752 685 753 /* Check if the file name has a path. If it has, we won't check the … … 687 755 has_path = (strpbrk (name, ":/\\") != NULL); 688 756 if (has_path) 689 has_ext = 1; 757 { 758 has_ext = 1; 759 x = strrchr (name, '.'); 760 if (x && !stricmp(x, ".dll")) 761 is_dll = 1; 762 } 690 763 else 691 764 { … … 747 820 if (autoconvert_flag && !check_omf (f)) 748 821 f = aout_to_omf (f, fullname, is_library); 822 else if (autoconvert_flag && is_dll && is_library) 823 f = lx_to_omf (f, fullname); 749 824 750 825 if (is_library && !check_omf_library (f) /* not sure if this makes sense */) … … 1209 1284 a.out files (to simplify their make files). */ 1210 1285 1211 else if (stricmp (ext, ".lib") == 0 || stricmp (ext, ".a") == 0 )1286 else if (stricmp (ext, ".lib") == 0 || stricmp (ext, ".a") == 0 || stricmp (ext, ".dll") == 0) 1212 1287 add_name_list (&add_lib_fnames, optarg); 1213 1288 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.