home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
MAKEMB.ZIP
/
MAKEMB.C
next >
Wrap
C/C++ Source or Header
|
1990-09-08
|
1KB
|
46 lines
/* Builds the alc.mb file from alcmsg.txt. Actually, redirection of standard
input and output is used so any other combination of input and output can
be handled. */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
char
line[150],
prefix[4],
pattern[11];
void main(int argc, char *argv[])
{
int
i,
c;
if (argc < 3)
{
fprintf(stderr,"Usage: makemb outfile.exe infile.msg <msgtxt.src >msgbind.inp");
exit(1);
}
prefix[0] = 0;
while (gets(line) != NULL && prefix[0] == 0)
{
if (strlen(line) == 3)
if (isalpha(line[0]) && isalpha(line[1]) && isalpha(line[2]))
strcpy(prefix,line);
}
strcpy(pattern,prefix);
strcat(pattern,"%4d%c:");
putchar('>');
puts(argv[1]);
putchar('<');
puts(argv[2]);
while(gets(line) != NULL)
{
if (sscanf(line, pattern, &i, &c) == 2)
if (line[8] == ':')
printf("%s%04d\n",prefix,i);
}
}