Parse DOS and *nix text files correctly.

svn path=/trunk/; revision=4708
This commit is contained in:
Eric Kohl 2003-05-18 12:12:07 +00:00
parent 19c81674a3
commit e568d2b165
3 changed files with 24 additions and 23 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: infcache.c,v 1.3 2003/04/17 10:41:02 chorns Exp $
/* $Id: infcache.c,v 1.4 2003/05/18 12:12:07 ekohl Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS hive maker
* FILE: tools/mkhive/infcache.c
@ -426,7 +426,11 @@ inline static int is_eof( struct parser *parser, const CHAR *ptr )
/* check if the pointer points to an end of line */
inline static int is_eol( struct parser *parser, const CHAR *ptr )
{
return (ptr >= parser->end || *ptr == CONTROL_Z || *ptr == '\r' /*'\n'*/);
// return (ptr >= parser->end || *ptr == CONTROL_Z || *ptr == '\r' /*'\n'*/);
return (ptr >= parser->end ||
*ptr == CONTROL_Z ||
*ptr == '\n' ||
(*ptr == '\r' && *(ptr + 1) == '\n'));
}
@ -544,20 +548,24 @@ static const CHAR *line_start_state( struct parser *parser, const CHAR *pos )
{
switch(*p)
{
// case '\n':
case '\r':
p++;
continue;
case '\n':
parser->line_pos++;
close_current_line( parser );
break;
case ';':
push_state( parser, LINE_START );
set_state( parser, COMMENT );
return p + 1;
case '[':
parser->start = p + 1;
set_state( parser, SECTION_NAME );
return p + 1;
default:
if (!isspace(*p))
{
@ -711,20 +719,23 @@ static const CHAR *eol_backslash_state( struct parser *parser, const CHAR *pos )
{
switch(*p)
{
// case '\n':
case '\r':
continue;
case '\n':
parser->line_pos++;
// parser->start = p + 1;
parser->start = p + 2;
parser->start = p + 1;
set_state( parser, LEADING_SPACES );
// return p + 1;
return p + 2;
return p + 1;
case '\\':
continue;
case ';':
push_state( parser, EOL_BACKSLASH );
set_state( parser, COMMENT );
return p + 1;
default:
if (isspace(*p))
continue;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: reginf.c,v 1.2 2003/04/17 10:41:02 chorns Exp $
/* $Id: reginf.c,v 1.3 2003/05/18 12:12:07 ekohl Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS hive maker
* FILE: tools/mkhive/reginf.h
@ -382,6 +382,8 @@ registry_callback (HINF hInf, PCHAR Section, BOOL Delete)
Ok = InfFindFirstLine (hInf, Section, NULL, &Context);
if (!Ok)
return FALSE;
for (;Ok; Ok = InfFindNextLine (&Context, &Context))
{

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: registry.c,v 1.3 2003/04/17 10:41:02 chorns Exp $
/* $Id: registry.c,v 1.4 2003/05/18 12:12:07 ekohl Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS hive maker
* FILE: tools/mkhive/registry.c
@ -27,7 +27,6 @@
/*
* TODO:
* - Implement RegDeleteKey().
* - Implement RegQueryMultipleValue().
* - Fix RegEnumValue().
*/
@ -700,15 +699,4 @@ RegGetValueCount (HKEY Key)
return Key->ValueCount;
}
#if 0
LONG
RegQueryMultipleValue(HKEY Key,
...)
{
return(ERROR_SUCCESS);
}
#endif
/* EOF */