Merge branch 'R_10_00' of http://10.65.20.33/sirio/CAMPO/campo into R_10_00
Patch level : 12.0 no-patch Files correlati : Commento : sorgente patchdef
This commit is contained in:
parent
2e52af5fc6
commit
fc054abd2b
51
src/utilities/patchdef.cpp
Normal file
51
src/utilities/patchdef.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <fstream.h>
|
||||
|
||||
|
||||
void patch(istream& i, ostream& o)
|
||||
{
|
||||
char lin[513];
|
||||
|
||||
while (i.good())
|
||||
{
|
||||
i.getline(lin, 512);
|
||||
|
||||
for(char* c = lin; isspace(*c); c++); // salta spazi iniziali
|
||||
|
||||
char instring = '\0';
|
||||
char wasspace = 0;
|
||||
|
||||
for (char* cur = lin; *c; c++)
|
||||
{
|
||||
if (*c == '!')
|
||||
{
|
||||
if (*(c + 1) == '!')
|
||||
{
|
||||
c++;
|
||||
*c = '#';
|
||||
}
|
||||
}
|
||||
if (*c == '#')
|
||||
{
|
||||
*cur++ = *c;
|
||||
while isspace(*(++c));
|
||||
}
|
||||
if (*c == ';')
|
||||
*cur++ = '\n';
|
||||
else
|
||||
*cur++ = *c;
|
||||
}
|
||||
*cur = '\0';
|
||||
|
||||
if (*lin) o << lin << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
patch(cin, cout);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user