TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Francisco Caselin Nava
from: Thomas Seeling
date: 1996-11-06 13:40:40
subject: Which Files Are Needed?

Hallo, Francisco!

*** Am 01. November 1996 um 22:51 schrieb Francisco Caselin Nava an All:

 FCN> What files are needed for download the GNU C/C++
 FCN> compiler for OS/2 minimal (PM Dev, TEX Mode, API Reference ETC.)?
You need at last

emxdev1.zip
emxdev2.zip
gnudev1.zip
gnudev2.zip
emxrt.zip

for programming C, compiling, linking and running programs.

C++ compiler is in
gppdev.zip

Objective C compiler is in
objcdev.zip

Convenient are the documentation files
emxdoc.zip
emxview.zip
gnudoc.zip
gnuinfo.zip
gnuview.zip

For programming with sockets you need
bsddev.zip
bsddoc.zip

Samples and test sources are in
emxample.zip
emxtest.zip

 FCN> If somebody can re-sendme the program source with the OS/2 *.MSG
 FCN> Decompiler files?

=== Cut ===
/*
 * OS/2 Message file decompiler
 * written by Cyril Pertsev, Jul 1996
 */
#include 
#include 
#include 
#include 

#define MSGF_SIG "\xFFMKMSGF"

long fsize ( FILE *file ) {
 long sav = ftell ( file ), size;

 fseek ( file, 0, SEEK_END );
 size = ftell ( file );
 fseek ( file, sav, SEEK_SET );
 return size;
}

int main ( int argc, char *argv[] ) {
 FILE *fmsgf, *fout;
 char fname[ _MAX_FNAME + _MAX_EXT + 2 ];
 char *buf, compname[4];
 long filesz;
 short nmsgs, *toc;
 int   i;

 if ( argc < 2 ) {
  fprintf ( stderr, "Usage %s \n", argv[0] );
  exit ( 1 );
 }

 if ( ( fmsgf = fopen ( argv[1], "rb" ) ) == NULL ) {
  fprintf ( stderr, "Error opening input file %s [%s]\n",
            argv[1], strerror ( errno ) );
  exit ( 1 );
 }

 if ( ( buf = malloc ( filesz = fsize ( fmsgf ) ) ) == NULL ) {
  fprintf ( stderr, "Can't allocate buffer memory\n" );
  exit ( 1 );
 }

 if ( fread ( buf, 1, filesz, fmsgf ) < filesz ) {
  fprintf ( stderr, "Error reading input file [%s]\n",
            strerror ( errno ) );
  exit ( 1 );
 }
 if ( memcmp ( buf, MSGF_SIG, sizeof ( MSGF_SIG ) ) != 0 ) {
  fprintf ( stderr, "This is not an OS/2 Message File\n" );
  exit ( 2 );
 }

 _splitpath ( argv[1], NULL, NULL, fname, NULL );
 strcat ( fname, ".cat" );
 if ( ( fout = fopen ( fname, "wb" ) ) == NULL ) {
  fprintf ( stderr, "Error opening output file %s [%s]\n",
            fname, strerror ( errno ) );
  exit ( 1 );
 }

 /* Get the component name (3 bytes at offset 8), store it as a 32-bit int */
 *((long*)compname) = *((long*)&buf[8]);
 compname[3] = 0;
 /* Get number of messages (2 bytes at offset 0B) */
 nmsgs = *((short*)(buf + 0x0B));
 /* Get table of contents (array of 16-bit ints at offset 1F) */
 /* each entry in an array is an offset of a corresponding msg within the file */
 FCN> If somebody have a program which open a file, search for a string
 FCN> on,
 toc = (short*)(buf + 0x1F );

 fprintf ( fout, "%s\r\n", compname );
 for ( i = 0; i < nmsgs; i++ ) {
  int msglen;
  char *msg;

  /* Get message length. If it is a last message, then length is until file end,
  else it is a difference between consecutive TOC entries (quite obvious, eh?).
  */
  msglen = ( i == nmsgs - 1 )? filesz - toc[i]: toc[i + 1] - toc[i];
  msg = malloc ( msglen );

  /* First char in a msg doesn't belong to a msg itself - it's a class of a
     message, so we skip it. Thus this toc[i]+1 expr.
  */
  memcpy ( msg, buf + toc[i] + 1, msglen );
  msg[msglen-1] = 0;

  /* print component name, msg number, msg class, and msg itself
     according to MKMSGF rules. RTFtoolkitM dox for them.
  */
  fprintf ( fout, "%s%4.4d%c: %s", compname, i + 1, buf[toc[i]], msg );
  free ( msg );
 }

 fclose ( fmsgf );
 fclose ( fout );
 free ( buf );
 exit ( 0 );
}
=== Cut ===

 FCN> replace it for another, and close the file?
Read k&r for basic C programming or use a tool like sed or grep from
the Gnu textutils/fileutils.


Tschau...Thomas

--- E3-32/1.11-32/2.51+
* Origin: Die TeX-Box +49-6034-930021 V.34 -930022 ISDN 24h (2:244/1130.42)
SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/317 800/1
@PATH: 244/1130 24/999 888 396/1 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.