FINDTEXT.C 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
  12. */
  13. #include <stdio.h>
  14. #include <ctype.h>
  15. #include <io.h>
  16. int main(int argc, char * argv[] )
  17. {
  18. char string[100];
  19. int n;
  20. char c;
  21. int in_rcs;
  22. FILE * fp;
  23. if ( argc < 2 ) {
  24. printf( "Findtext by JAS. Usage: Findtext binaryfilename\n" );
  25. return 1;
  26. }
  27. fp = fopen( argv[1], "rb" );
  28. n = 0;
  29. in_rcs = 0;
  30. while( fread( &c, 1, 1, fp )==1 ) {
  31. if ( in_rcs ) {
  32. if ( c == '$' ) {
  33. string[n] = 0;
  34. printf( "'%s'\n", string );
  35. in_rcs = 0;
  36. n = 0;
  37. }
  38. string[n++] = c;
  39. } else {
  40. if ( (c == '$') && (n==0) ) {
  41. string[n++] = c;
  42. } else if ( (c == 'I') && (n==1) ) {
  43. string[n++] = c;
  44. } else if ( (c == 'd') && (n==2) ) {
  45. string[n++] = c;
  46. } else if ( (c == ':') && (n==3) ) {
  47. string[n++] = c;
  48. in_rcs = 1;
  49. } else {
  50. n = 0;
  51. }
  52. }
  53. // if ( isprint(c)) {
  54. // if ( n > 78 ) {
  55. // string[n] = 0;
  56. // printf( "'%s'\n", string );
  57. // n = 0;
  58. // }
  59. // string[n++] = c;
  60. // } else {
  61. // if ( n > 4 ) {
  62. // string[n] = 0;
  63. // printf( "'%s'\n", string );
  64. // n = 0;
  65. // }
  66. // }
  67. }
  68. fclose(fp);
  69. return 0;
  70. }
  71.