mirror of
https://github.com/apache/httpd.git
synced 2025-08-10 02:02:49 +03:00
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
60 lines
987 B
C++
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]);
|
|
}
|
|
|