1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-10 02:02:49 +03:00
Files
apache/os/win32/MakeModuleMak.cpp
Roy T. Fielding 6f96ad5227 Apache 1.3.9 baseline for the Apache 2.0 repository.
Obtained from: Apache 1.3.9 (minus unused files), tag APACHE_1_3_9
Submitted by: Apache Group


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83750 13f79535-47bb-0310-9956-ffa450edef68
1999-08-24 06:46:03 +00:00

60 lines
987 B
C++

#include <fstream.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void MakeMake(const char *szModule,const char *szSource)
{
ifstream ifs("Module.mak.tmpl",ios::nocreate);
assert(ifs.good());
char buf[1024];
sprintf(buf,"%s.mak",szModule);
ofstream ofs(buf,ios::trunc);
for( ; ; )
{
ifs.getline(buf,sizeof buf);
if(ifs.eof())
break;
for(char *s=buf ; *s ; )
{
char *p=strchr(s,'%');
if(!p)
{
ofs << s << '\n';
break;
}
if(!strncmp(p,"%Module%",8))
{
ofs.write(s,p-s);
ofs << szModule;
s=p+8;
}
else if(!strncmp(p,"%Source%",8))
{
ofs.write(s,p-s);
ofs << szSource;
s=p+8;
}
else
{
ofs.write(s,p-s+1);
s=p+1;
}
}
}
}
void main(int argc,char **argv)
{
if(argc < 2 || (argc%2) != 1)
{
cerr << argv[0] << " [<module name> <source file>]+\n";
exit(1);
}
for(int n=1 ; n < argc ; n+=2)
MakeMake(argv[n],argv[n+1]);
}