Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Feb 28, 2017
0 parents commit 14aa1e5
Show file tree
Hide file tree
Showing 9 changed files with 1,745 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*~
ng2html.man
ng2html
*.o
340 changes: 340 additions & 0 deletions COPYING

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
all: ng2html ng2html.man

ng2html : ng2html.c cfgfile.c
gcc -Wall -O2 -s ng2html.c cfgfile.c -o ng2html

ng2html.man: ng2html.1
troff -man -T ascii ng2html.1 > ng2html.man

clean:
-rm -f core *.o *~ ng2html
23 changes: 23 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Welcome to v1.05 of ng2html.

ng2html was developed for and on Linux, however, it should compile
clean in most environments. I know for sure that it works under Dos
with DJGPP v2.0 or better and I'm told it compiles ok with Microsoft
C++ 4.1.

Note that if you are building ng2html under Dos with a 16bit compiler
you probably want to uncomment the line that reads:

/* #define _16_BIT_COMPILER_ */

You'll find it at around line 147.

Please read the manual page for full details, I've included the source
(ng2html.1) and a formatted version (ng2html.man).

Any feedback is welcome, contact me at [email protected].
The latest version of ng2html is always available from my pages
at:

US: http://www.acemake.com/hagbard
UK: http://www.hagbard.demon.co.uk
14 changes: 14 additions & 0 deletions THANKS
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Thanks to the following people for their feedback:

Brian Dukes <[email protected]> did a lot of testing for me
with Dos and with his help I managed to track down a problem with
the ReadLong() function. If you are using a Dos compiler to produce
16bit code then make sure you uncomment the "#define
_16_BIT_COMPLIER_" line near the top of the source.

Steve Pribut <[email protected]> reported that it compiles fine with
Microsoft C++ 4.1.

Rick Ratayczak <[email protected]> pointed out that ng2html was
producing some bad HTML in one or two places. Thanks to his
observation the output should be a lot cleaner now.
191 changes: 191 additions & 0 deletions cfgfile.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
/*
CFGFILE - CONFIG FILE READING LIBRARY
Copyright (C) 1996 David A Pearson
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the license, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

/*
* Modification history:
*
* $Log: cfgfile.c,v $
* Revision 1.2 1996/07/05 13:02:05 davep
* Minor changes to allow a clean compile when using -Wall.
*
* Revision 1.1 1996/04/02 16:16:35 davep
* Initial revision
*
*
*/

/* Standard header files. */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

/* Local header file. */

#include "cfgfile.h"

/* Handle those compilers that don't do strcasecmp(). */

#if defined( __MSDOS__ ) || defined( __EMX__ )
#define strcasecmp( x, y ) stricmp( x, y )
#endif

/* Config entry structure. */

typedef struct _cfgOPTIONS
{
char *id;
char *value;
struct _cfgOPTIONS *next;
} cfgOPTIONS;

/* Prorotype internal functions */

static cfgOPTIONS *cfgLastOption( cfgOPTIONS * );

/* This holds the list of config options. */

static cfgOPTIONS *cfgOptions = NULL;

/*
*/

void cfgAddOption( char *pszId, char *pszValue )
{
cfgOPTIONS *p;

if ( !cfgOptions )
{
cfgOptions = (cfgOPTIONS *) calloc( sizeof( cfgOPTIONS ), 1 );
cfgOptions->next = NULL;
p = cfgOptions;
}
else
{
p = cfgLastOption( cfgOptions );
p->next = (cfgOPTIONS *) calloc( sizeof( cfgOPTIONS ), 1 );
p = p->next;
p->next = NULL;
}

p->id = (char *) malloc( strlen( pszId ) + 1 );
p->value = (char *) malloc( strlen( pszValue ) + 1 );
strcpy( p->id, pszId );
strcpy( p->value, pszValue );
}

/*
*/

int cfgReadFile( char *pszFile )
{
int i = 0;
FILE *f = fopen( pszFile, "r" );
char szBuffer[ 512 ];

cfgReset();

if ( f != NULL )
{
while ( fgets( szBuffer, sizeof( szBuffer ), f ) )
{
szBuffer[ strlen( szBuffer ) - 1 ] = 0;
if ( *szBuffer && *szBuffer != ';' && *szBuffer != '#' )
{
char *pszSplit = szBuffer;

while ( *pszSplit && *pszSplit != '=' )
{
++pszSplit;
}

if ( *pszSplit )
{
*pszSplit = 0;
++pszSplit;

if ( *pszSplit )
{
cfgAddOption( szBuffer, pszSplit );
++i;
}
}
}
}
fclose( f );
}

return( i );
}

/*
*/

char *cfgGetSetting( char *pszId )
{
char *p = NULL;
cfgOPTIONS *cfg = cfgOptions;

while ( cfg && !p )
{
if ( strcasecmp( pszId, cfg->id ) == 0 )
{
p = cfg->value;
}
else
{
cfg = (cfgOPTIONS *) cfg->next;
}
}

return( p );
}

/*
*/

void cfgReset( void )
{
cfgOPTIONS *cfg = cfgOptions;
cfgOPTIONS *last;

while ( cfg )
{
if ( cfg->id ) free( cfg->id );
if ( cfg->value ) free( cfg->value );
last = cfg;
cfg = (cfgOPTIONS *) cfg->next;
free( last );
}
}

/*
*/

static cfgOPTIONS *cfgLastOption( cfgOPTIONS *p )
{
while ( p->next )
{
p = p->next;
}

return( p );
}
46 changes: 46 additions & 0 deletions cfgfile.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
CFGFILE - CONFIG FILE READING LIBRARY
Copyright (C) 1996 David A Pearson
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the license, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

/*
* Modification history:
*
* $Log: cfgfile.h,v $
* Revision 1.1 1996/04/02 16:16:53 davep
* Initial revision
*
*
*/

/* Ensure we only get included once. */

#ifndef __CFGFILE_H
#define __CFGFILE_H

/* Prototype functions found in the "library". */

void cfgAddOption( char *, char * );
int cfgReadFile( char * );
char *cfgGetSetting( char * );
void cfgReset( void );

#endif


81 changes: 81 additions & 0 deletions ng2html.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
.TH ng2html 1 "3rd January 1997" v1.05
.SH NAME
ng2html \- Norton Guide to HTML Document Converter.
.SH SYNOPSIS
\fBng2html\fP guide-path
.SH DESCRIPTION
\fBng2html\fP allows you to take a Norton Guide database file and convert
it into a number of HTML documents. This will then allow you to view the
contents of the guide with the Web browser of your choice.

When run against a guide \fBng2html\fP will generate a number of files
(depending on the size of the guide this could be a lot of files) each
containing a page from the guide. All links are generated by \fBng2html\fP
so you don't need to worry about that.

Note that by default the format of the name of the files, apart from the
menu and about details, is "ng%lx.html" (you can change this in the
source if you so desire) which means that on systems where you are
restricted in the number of characters this restriction will affect the
size of a guide you can process. On systems that use FAT (Dos or OS/2
for example) you will run out of names if the guide is more than 0xFFFFFF
bytes (around 16 megs) in size. This should not be a problem for most
people. If it is, use VFAT or HPFS and a compiler that can handle long
file names instead. :-)
.SS OPTIONS
.TP
\fIguide-path\fP
This is the path and name of the Norton Guide to be converted.
.SS CONFIGURATION FILE
You can customise the way ng2html works by using a configuration file.
The name and location of the configuration file depends on what you
set it to in the source. Look for the line that defines \fBCONFIG_FILE\fP.

Valid options are:
.TP
.B BODY=\fIbody-details\fP
If this option is used in the configuration file then the text after the
'=' is used in any generated HTML document as the <BODY> token. One
obvious use for this would be to allow for images as part of the background.
If you do use this option, ensure that what you provide is valid HTML,
ng2html makes no checks.
.TP
.B FRAMES=\fIyes|no|1|0\fP
If set to "yes" (a simple Y, y or 1 will do, everything else is ignored)
this option tells ng2html to generate frames aware HTML. When used, the
code will create two frames, the left hand side displaying the Norton
Guide menu and the right hand side displaying the contents of the
pages.
.TP
.B FRAMECOLS=\fIcols-spec\fP
If framed HTML code is being generated then this option can be used to
specify the FRAMECOLS for the frames. By default this is set to 30%,70%.
You can change this using this config option.
.SH AUTHOR
Dave Pearson \- [email protected]
.SH COPYRIGHT
NG2HTML NORTON GUIDE TO HTML DOCUMENT CONVERTER.
Copyright (C) 1996,1997 David A Pearson

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the license, or (at your option)
any later version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
675 Mass Ave, Cambridge, MA 02139, USA.
.SH BUGS
The conversion of box drawing characters and other "graphic" charcters that
so many guides rely on could be improved.

Because, depending on the guide, so many small files can be generated,
on some filesystems the resulting HTML can be a waste of diskspace.
.SH SEE ALSO
http://www.acemake.com/hagbard
http://www.hagbard.demon.co.uk
Loading

0 comments on commit 14aa1e5

Please sign in to comment.