home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 3
/
CDPDIII.bin
/
fish
/
881-890
/
ff885
/
kcommodity
/
rcs2hst
/
rcs2hst.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-16
|
3KB
|
139 lines
/* $Revision Header built automatically *************** (do not edit) ************
**
** © Copyright by Dirk Federlein
**
** File : DH2:CC/wks/rcs2hst/rcs2hst.c
** Created on : Monday, 22-Mär-93 00:59:15
** Created by : Dirk Federlein
** Current revision : V1.0
**
**
** Purpose
** -------
** - RCS2HST:
** Translates KCommodity RCS headers into plain history files.
** Gets the .c file as source and writes an ASCII file
** containing the revision texts.
**
** Revision V1.0
** --------------
** created on Monday, 22-Mär-93 00:59:15 by Dirk Federlein. LogMessage :
** --- Initial release ---
**
*********************************************************************************/
#define REVISION "1.0"
#define REVDATE "22.03.93"
#define REVTIME "00:59:15"
#define AUTHOR "Dirk Federlein"
#define VERNUM 1
#define REVNUM 0
#define ARGTEMPLATE "INFILE/A, OUTFILE/A"
#define STARTSEQ "$Revision Header built automatically *************** (do not edit) ************"
#define ENDHEADSEQ "** Purpose"
#define ENDSEQ "******************************************************************************"
#define CPRSEQ "** © Copyright by"
#define FILESEQ "** File :"
#define REVSEQ "** Current revision :"
#define STARTUP "RCS2HST © Dirk Federlein 1993\n\n"
#include <stdio.h>
#include <exec/types.h>
#include <dos/dos.h>
#include <proto/dos.h>
char version = "$REV: RCS2HST V" REVISION " (" REVDATE ")";
main(int argc, char ** argv)
{
char * lptr = NULL;
char * cptr = NULL;
char linebuffer[128] = { 0 };
char copyrightbuffer[64] = { 0 };
char filebuffer[64] = { 0 };
char revbuffer[16] = { 0 };
LONG argarray[2] = { 0, 0 };
struct RDArgs * RDArgs = NULL;
FILE * infile = NULL;
FILE * outfile = NULL;
if (! ReadArgs(ARGTEMPLATE, argarray, NULL))
{
PrintFault(IoErr(), NULL);
exit (5);
}
printf (STARTUP);
printf ("Working...");
if (infile = fopen ((char *)argarray[0], "r"))
{
if (outfile = fopen ((char *)argarray[1], "w"))
{
/* --- Find RCS header -------------------------------------- */
do
{
if (!(lptr = fgets ( linebuffer, 128 , infile )))
goto end;
} while ( !strstr (lptr, STARTSEQ));
do
{
if (!(lptr = fgets ( linebuffer, 128 , infile )))
goto end;
if (cptr = strstr ( lptr, CPRSEQ ))
{
cptr += strlen(CPRSEQ);
strcpy ( copyrightbuffer, cptr );
}
if (cptr = strstr ( lptr, FILESEQ ))
{
cptr += strlen(FILESEQ);
strcpy ( filebuffer, cptr );
}
if ( cptr = strstr ( lptr, REVSEQ ))
{
cptr += strlen(REVSEQ);
strcpy ( revbuffer, cptr );
}
} while ( !strstr (lptr, ENDHEADSEQ));
fprintf ( outfile, " Programm : %s\n", filebuffer );
fprintf ( outfile, " Version : %s\n\n", revbuffer );
fprintf ( outfile, " Copyright by: %s\n\n\n", copyrightbuffer);
fprintf ( outfile, "Purpose\n" );
do
{
if (!(lptr = fgets ( linebuffer, 128 , infile )))
goto end;
if (!strstr (lptr, ENDSEQ))
fprintf ( outfile, "%s\n", lptr+3 );
} while ( !strstr (lptr, ENDSEQ));
end:
fclose (outfile);
}
fclose (infile);
}
FreeArgs ( RDArgs );
printf ("done.\n");
exit(0);
}