You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.6 KiB

8 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /**[txh]********************************************************************
  2. Copyright (c) 2003 by Salvador E. Tropea.
  3. Covered by the GPL license.
  4. Description:
  5. tlink have a really useless command line. This wrapper avoids all the
  6. complexities.
  7. Also: I failed to create a macro that expands to something that creates
  8. a response file. Looks like it only works outside macros. This program
  9. just collects the files from the specified directories and creates the
  10. library with all of them.
  11. ***************************************************************************/
  12. #include <stdio.h>
  13. #include <stdlib.h>
  14. #include <string.h>
  15. #include <dirent.h>
  16. #define MAX_FILE 256
  17. int main(int argc, char *argv[])
  18. {
  19. FILE *f;
  20. int i,ret;
  21. char *s;
  22. char b[MAX_FILE];
  23. DIR *d;
  24. struct dirent *de;
  25. if (argc<3)
  26. {
  27. printf("tlink wrapper\n");
  28. printf("Copyright (c) 2003 by Salvador E. Tropea. GPL.\n");
  29. printf("Usage: blink lib list_obj_files\n");
  30. return 1;
  31. }
  32. f=fopen("bcclink.lnk","wt");
  33. if (!f)
  34. {
  35. printf("Can't create response file\n");
  36. return 2;
  37. }
  38. for (i=2; i<argc; i++)
  39. {
  40. d=opendir(argv[i]);
  41. if (!d)
  42. {
  43. printf("Can't open directory %s\n",argv[i]);
  44. return 4;
  45. }
  46. while ((de=readdir(d))!=NULL)
  47. {
  48. //printf("%s\n",de->d_name);
  49. s=de->d_name;
  50. if (!strstr(s,".obj"))
  51. continue;
  52. fprintf(f,"+%s\\%s &\n",argv[i],s);
  53. }
  54. closedir(d);
  55. }
  56. fprintf(f,"+");
  57. fclose(f);
  58. unlink(argv[1]);
  59. s=(char *)malloc(strlen(argv[1])+32);
  60. sprintf(s,"tlib %s /E /P256 @bcclink.lnk",argv[1]);
  61. ret=system(s);
  62. if (!ret)
  63. unlink("bcclink.lnk");
  64. return ret;
  65. }