campo-sirio/build/patchdef.cpp
Alessandro Bonazzi df52ecdc04 Patch level : 12.0 no-patch
Files correlati     :
Commento            :

sorgente patchdef
2020-06-23 21:21:59 +02:00

51 lines
721 B
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}