Author: oddsocks
Update of /cvs/extras/rpms/AGReader/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10578/devel
Modified Files:
.cvsignore sources
Added Files:
AGReader-1.1-gcc41.patch AGReader-1.1-keys.patch AGReader.spec
Log Message:
auto-import AGReader-1.1-9 on branch devel from AGReader-1.1-9.src.rpm
AGReader-1.1-gcc41.patch:
--- NEW FILE AGReader-1.1-gcc41.patch ---
--- AGReader/Sources/Text.h.gcc41 2001-12-05 21:42:45.000000000 +0100
+++ AGReader/Sources/Text.h 2006-05-27 10:48:23.000000000 +0200
@@ -21,4 +21,6 @@
/** Create a AGFile directly from a char stream **/
AGFile CreateTextFromStream(char *stream, char *title);
+void AdjustColors(AGNode node);
+
#endif
--- AGReader/Sources/Text.c.gcc41 2001-12-05 22:10:33.000000000 +0100
+++ AGReader/Sources/Text.c 2006-05-27 10:53:25.000000000 +0200
@@ -8,6 +8,7 @@
#include "AGNodes.h"
#include "AGObj.h"
#include "Text.h"
+#include "Input.h"
/** Redefines only functions that differs from AG_lib.c **/
@@ -15,11 +16,11 @@
AGFile CreateTextNodes(char *filename)
{
AGFile new;
- if( new = CreateFile( filename ) )
+ if( (new = CreateFile( filename )) )
{
AGNode node;
/* Only one node is defined for text file */
- if( (AGNode) new->Content = node = (AGNode) malloc(sizeof(*node)) )
+ if( (new->Content = (AGList)(node = (AGNode) malloc(sizeof(*node)))) )
{
memset(node, 0, sizeof(*node));
node->name = "MAIN";
@@ -45,7 +46,7 @@
{
AGFile new;
- if( new = CreateTextNodes( NULL ) )
+ if( (new = CreateTextNodes( NULL )) )
{
AGNode node = (AGNode) new->Content;
node->start = new->Buffer = stream;
@@ -102,7 +103,6 @@
static AGPara par;
static AGWord new;
char *buf, *p;
- long nb;
InitContext(&AGC, JM_NORMAL);
/* Alloc a first paragraph */
--- /dev/null 2006-05-27 07:46:48.810857750 +0200
+++ AGReader/Sources/Input.h 2006-05-27 10:48:23.000000000 +0200
@@ -0,0 +1,11 @@
+#ifndef INPUT_H
+#define INPUT_H
+
+#include "AGNodes.h"
+
+void Prompt( char *str );
+void SetTopLine( AGNode node );
+void ThrowError(char *msg, char *param);
+void ProcessKeys( void );
+
+#endif
--- AGReader/Sources/AGNodes.h.gcc41 2001-12-05 21:48:46.000000000 +0100
+++ AGReader/Sources/AGNodes.h 2006-05-27 10:48:23.000000000 +0200
@@ -124,8 +124,10 @@
char tabstop(short pos); /* Amount of spaces to add to reach tabstop */
void RenderAGNode(AGPara, short nbl, short left, short wid, char mode);
+void RenderLine(AGPara para, short start, short max, char ins_mode);
void ScrollDisplay(struct scrpos *, short pos);
void AGFileInfo(AGFile, char *obj, char *objs);
+char *FindAGLinkInfo(AGLink link, char *format);
/*** Special character may trashed the display ***/
AGWord DisableSpecialChar(AGPara par,AGWord old, unsigned char);
--- AGReader/Sources/Input.c.gcc41 2001-07-14 15:13:34.000000000 +0200
+++ AGReader/Sources/Input.c 2006-05-27 10:48:23.000000000 +0200
@@ -3,11 +3,13 @@
** by T.Pierron, 11/9/2000, free software **
****************************************************/
+#include <string.h>
#include "AGReader.h"
#include "AGNodes.h"
#include "Navig.h"
#include "IO_tty.h"
#include "Help.h"
+#include "Text.h"
static char InfDisp = 0; /* 1 if information screen is displayed */
static char TmpBuf[80]; /* Buffer used for various output */
@@ -32,7 +34,7 @@
printf("[%d;H[0;7m%4d%%%*s[0m[%d;6H",
terminfo.height,(node && node->maxlines > terminfo.height ?
- (100 * node->line) / (node->maxlines-terminfo.height+1) : 100),
+ (100 * node->line) / ((int)node->maxlines-terminfo.height+1) : 100),
terminfo.width-5,str,terminfo.height
);
if( svg[0] ) memcpy(str + plen, svg, 2);
@@ -81,6 +83,7 @@
void ThrowError(char *msg, char *param)
{
char *d, *s;
+ int i; /* silence warnings */
/* Frequently error message encountered */
if(msg == ERROR_NO_FREE_STORE) msg = "Not enough memory!";
@@ -95,7 +98,7 @@
/* If GUI isn't already set, display on stderr */
if( is_rawmode() ) *d='\0',Prompt(TmpBuf);
else /* fputs doesn't write any \n */
- *d++='\n',write(2,TmpBuf,d-TmpBuf);
+ *d++='\n',i=write(2,TmpBuf,d-TmpBuf);
}
/*** Toggle display between node and information ***/
@@ -106,7 +109,7 @@
if( InfDisp ) inf->node = old;
else
/* The node may not yet exists */
- if(strinfo = (AGList) FindAGNode(inf->file, STR_INFONAME))
+ if( (strinfo = (AGList) FindAGNode(inf->file, STR_INFONAME)) )
old = inf->node, inf->node = strinfo;
else return;
@@ -266,7 +269,7 @@
case '=':
/* Display line statistics */
sprintf(TmpBuf,"line %d of %d ",AGNODE(&terminfo)->line+1,
- AGNODE(&terminfo)->maxlines);
+ (int)AGNODE(&terminfo)->maxlines);
Prompt(TmpBuf);
break;
case 'b': case 'B':
--- AGReader/Sources/Navig.h.gcc41 2001-10-15 12:47:01.000000000 +0200
+++ AGReader/Sources/Navig.h 2006-05-27 10:48:23.000000000 +0200
@@ -30,6 +30,8 @@
/** Search for node/file pointed by link and display it **/
int Navigate( char *GuideName, AGLink );
+void SetActiveLine( AGNode node );
+
/** Function use to create file / node **/
typedef AGFile (*pfnCreateNodes)( char *path );
typedef char (*pfnCreateWords)( AGNode node );
--- AGReader/Sources/AGReader.h.gcc41 2001-03-21 11:28:39.000000000 +0100
+++ AGReader/Sources/AGReader.h 2006-05-27 10:48:23.000000000 +0200
@@ -60,5 +60,7 @@
#define QUIT_OK 0
#define QUIT_ERROR 1
+void quit(char *msg, int status);
+
#endif
--- AGReader/Sources/main.c.gcc41 2001-12-05 21:03:14.000000000 +0100
+++ AGReader/Sources/main.c 2006-05-27 10:48:23.000000000 +0200
@@ -10,6 +10,7 @@
#include "AGNodes.h"
#include "IO_tty.h"
#include "Navig.h"
+#include "Input.h"
struct scrpos terminfo; /* Information about visited node & screen */
@@ -96,5 +97,7 @@
} else
/* Errors will be displayed in Navigate() */
quit(NULL,QUIT_ERROR);
+
+ return 0;
}
--- AGReader/Sources/Navigate.c.gcc41 2001-10-16 15:24:18.000000000 +0200
+++ AGReader/Sources/Navigate.c 2006-05-27 10:56:17.000000000 +0200
@@ -12,6 +12,8 @@
#include "AGObj.h"
#include "Navig.h"
#include "Text.h"
+#include "Input.h"
+#include "IO_tty.h"
extern char buffer[ 512 ];
extern short *tabs;
@@ -25,15 +27,15 @@
/*** System-specific execute command ***/
int myExecute( char *fmt, char *arg )
{
- char *space, *drive, *dest;
+ char *space, *drive, *dest = NULL;
int pid;
/* Command comes from AmigaOS, try to convert to Unix */
if( strncasecmp(fmt, "Run ", 4) == 0 ) fmt += 4;
/* Get command name */
- if( space = strchr(fmt, ' ') ) *space = 0;
+ if( (space = strchr(fmt, ' ')) ) *space = 0;
/* Get device specifier */
- if( drive = strchr(fmt, ':') ) {
+ if( (drive = strchr(fmt, ':')) ) {
*drive = 0;
if(NULL != (dest = getenv( fmt )) ||
NULL != (dest = getenv( AGR_PATH_ENV_NAME )))
@@ -229,7 +231,7 @@
/*** Try to locate a file, depending where program runs ***/
char *LocateFile( char *guidename, char *filename )
{
- char *p, *path, isdev=0;
+ char *p = NULL, *path, isdev=0;
int fd;
/* Retrieve directory where remains the document */
@@ -289,7 +291,7 @@
if( (*path = LocateFile( GuideName, link->file )) != NULL )
{
extern char AGHeader[];
- unsigned char *p;
+ char *p;
/* Read a few bytes from this file */
if( (fd = open(*path,O_RDONLY)) == -1 )
@@ -317,9 +319,10 @@
/* Check for a few bytes, whether it's ASCII text */
for(p=buffer+len-1; (char *)p>=buffer; p--)
{
+ unsigned char u = *p;
/* Non-ISO-8859-1 characters */
- if( *p>126 && *p<160 ) break;
- if( *p<32 && *p!='\r' && *p!='\n' &&
*p!='\t' && *p!=27) break;
+ if( u>126 && u<160 ) break;
+ if( u<32 && u!='\r' && u!='\n' &&
u!='\t' && u!=27) break;
}
if((char *)p<buffer) return TEXT_FILE;
@@ -369,7 +372,6 @@
/*** Go back to the previous visited page ***/
void HistoryBack( struct scrpos *scr )
{
- extern long nballoc, nbfree;
/* It should have at least one node */
if( stack && stack->prev )
{
@@ -417,8 +419,11 @@
SetActiveLine(node);
/* Set the first displayed line */
FindNth(node, link->line, &terminfo);
- if(node != AGNODE(&terminfo));
- PushAGNode(terminfo.file, AGNODE(&terminfo) = node, 0);
+ if(node != (AGNode)terminfo.node) {
+ terminfo.node = node;
+ PushAGNode(terminfo.file,
+ terminfo.node, 0);
+ }
if( is_rawmode() ) ReRenderAGNode();
} else ThrowError("Can't find node `%s'.", link->node);
return 1;
--- AGReader/Sources/IO_tty.c.gcc41 2001-12-05 20:59:30.000000000 +0100
+++ AGReader/Sources/IO_tty.c 2006-05-27 10:48:23.000000000 +0200
@@ -4,6 +4,7 @@
***** but greatly simplified by T.Pierron ****
****************************************************************/
+#include <strings.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/time.h>
@@ -44,6 +45,7 @@
{
static struct termios save_term;
struct termios s;
+ int i; /* silence warnings */
/* Do not set twice the same mode!! */
if (old_st == on) return; old_st = on;
@@ -121,12 +123,12 @@
s.c_cc[VTIME] = 0;
/* let's enter in private mode */
- write(1,SET_PRIV,sizeof(SET_PRIV)-1);
+ i = write(1,SET_PRIV,sizeof(SET_PRIV)-1);
} else {
/* Restore saved modes */
s = save_term;
/* and old display mode */
- write(1,SET_PUB,sizeof(SET_PUB)-1);
+ i = write(1,SET_PUB,sizeof(SET_PUB)-1);
}
tcsetattr(2, TCSADRAIN, &s);
}
@@ -185,7 +187,8 @@
char getchr(void)
{
char c;
- read(tty, &c, sizeof(c));
+ if (read(tty, &c, sizeof(c)) != sizeof(c))
+ return 0;
return c;
}
--- AGReader/Sources/Makefile.gcc41 2001-07-10 12:41:17.000000000 +0200
+++ AGReader/Sources/Makefile 2006-05-27 10:48:23.000000000 +0200
@@ -21,7 +21,7 @@
$(CC) $(OBJECTS) -o $(EXE) $(LIBS) -g
final: $(OBJECTS)
- $(CC) $(OBJECTS) -o $(EXE) $(LIBS) -s
+ $(CC) $(OBJECTS) -o $(EXE) $(LIBS)
install:
cp $(EXE) $(HOME)/bin -f
--- AGReader/Sources/AGObj.c.gcc41 2001-05-10 23:01:03.000000000 +0200
+++ AGReader/Sources/AGObj.c 2006-05-27 10:48:23.000000000 +0200
@@ -5,6 +5,8 @@
** Started on 13/2/2001, free software under GNU PL **
********************************************************/
+#include <ctype.h>
+#include <string.h>
#include "AGReader.h"
#include "AGNodes.h"
#include "AGObj.h"
@@ -51,7 +53,7 @@
/* Makes them appear like web-page anchor */
new->style = DEF_LINKSTYLE;
- new->fgpen = LinkColor[ new->link->type ];
+ new->fgpen = LinkColor[ (int)new->link->type ];
/* Search content of command/node */
if( new->link->type != UNKNOWN_TYPE )
FindAGLinkInfo(new->link, p+strlen(LinkTokens[new->link->type-1]));
--- AGReader/Sources/AGObj.h.gcc41 2001-05-10 22:43:29.000000000 +0200
+++ AGReader/Sources/AGObj.h 2006-05-27 10:48:23.000000000 +0200
@@ -69,6 +69,8 @@
/*** Object containing series of tab stops in spaces ***/
AGWord NewTabs(AGPara par, AGWord old, char *fmt);
+void InsertAGWord(AGPara par, AGWord new, AGWord ins);
+
/** pfnInit parameter for NewObject ***/
void WrapOFF(AGObj, ObjPara *);
void ClearTabs(AGObj, ObjPara *);
--- AGReader/Sources/AG_lib.c.gcc41 2001-12-05 22:00:24.000000000 +0100
+++ AGReader/Sources/AG_lib.c 2006-05-27 10:51:25.000000000 +0200
@@ -7,11 +7,13 @@
#include <sys/stat.h>
#include <string.h>
+#include <ctype.h>
#include "AGReader.h"
#include "AGNodes.h"
#include "AGObj.h"
#include "IO_tty.h"
#include "Version.h"
+#include "Input.h"
/** Global buffer used to render one line of text **/
char buffer[512], ts, bgpen;
@@ -350,7 +352,7 @@
*buf = '\0'; if(p < buf) new = NewWord(par,new,p,&AGC);
p = ++buf;
- } else if(*buf == '@') /* Start of an AmigaGuide style modifier */
+ } else if(*buf == '@') { /* Start of an AmigaGuide style modifier */
if( buf[1] == '{' )
{
char **token; *buf='\0';
@@ -426,9 +428,8 @@
** already processed in CreateAGNodes(), so just skip them. */
while(*buf != '\n') buf++;
*buf='\0'; p = buf+1;
- }
+ } }
}
- eof:
for(; PREV(par); par = PREV(par));
node->AGContent = node->Shown = par;
node->column = node->line = 0;
@@ -441,7 +442,7 @@
if(len > width) len = width;
switch( (unsigned char)par->align & ~JMF_PREVIOUS )
{
- case JMF_CENTER: par->spaces = (width - len + indent >> 1); break;
+ case JMF_CENTER: par->spaces = (width - len + indent) >> 1; break;
case JMF_RIGHT: par->spaces = width - len; break;
default: par->spaces = indent + par->alinea;
}
@@ -453,7 +454,7 @@
{
AGPara new, next = NEXT(par);
AGWord wrd;
- if( new = NewPara(par, NULL) )
+ if( (new = NewPara(par, NULL)) )
{
if(next) PREV(next) = new, NEXT(new) = next;
/* Paragraph's indenting properties equal previous */
@@ -469,7 +470,7 @@
}
else /* Split the whole word */
{
- if(wrd = PREV(cut)) NEXT(wrd) = NULL;
+ if( (wrd = PREV(cut)) ) NEXT(wrd) = NULL;
new->line = cut; PREV(cut) = NULL;
}
}
@@ -485,8 +486,8 @@
if( wrd->style & FSF_SPLITTED ) wrd = FreeSplit(wrd);
else if(isspace( wrd->data[-1] )) wrd->data--;
for(ins=((AGPara)PREV(par))->line; NEXT(ins); ins=NEXT(ins));
- if( NEXT(ins) = wrd ) PREV(wrd) = ins;
- if( NEXT((AGPara)PREV(par)) = next )
+ if( (NEXT(ins) = wrd) ) PREV(wrd) = ins;
+ if( (NEXT((AGPara)PREV(par)) = next) )
PREV(next) = PREV(par);
free(par);
return ins;
@@ -496,14 +497,14 @@
char FormatPara( AGNode node, short width )
{
AGPara par; AGWord word; ObjPara op;
- short len, lg, spc, indent;
+ short len, lg, spc = 0, indent;
ts = node->tabsize; tabs = NULL;
node->width = ((op.limit = node->wordwrap) ? width : 0x7fff);
op.nidt = indent = 0;
for(par=node->AGContent; par; indent=op.nidt, par=NEXT(par))
{
- char *p, *q, nbwrd;
+ char *p = NULL, *q, nbwrd;
redo:for(len=indent+par->alinea, nbwrd=1, word=par->line; word; word=NEXT(word))
{
@@ -536,7 +537,7 @@
if( tmp && (tmp->align & JMF_PREVIOUS) && p)
{
/* This reduce a lot of computing with opaque resizing */
- if(word = tmp->line)
+ if( (word = tmp->line) )
for(t=word->data,spc=0; *t && !isspace(*t); t++, spc++);
if(len+spc <= width) {
AGReader-1.1-keys.patch:
--- NEW FILE AGReader-1.1-keys.patch ---
--- AGReader/Sources/Input.c.keys 2006-05-27 12:01:05.000000000 +0200
+++ AGReader/Sources/Input.c 2006-05-28 12:02:06.000000000 +0200
@@ -163,7 +163,11 @@
{
static char *Keys[] = {
"OA", "OB", "OC","OD", /* Cursor keys
*/
- "[5~","[6~","[H","[F",NULL /* PgDown, PgUp,
End, Home */
+ "[5~","[6~","[H","[F", /* PgDown, PgUp,
End, Home */
+ "[1~","[4~","OH","OF", /* 2x Alternative
End, Home */
+ "[11~","[12~", "[13~", /* F1, F2, F3 */
+ "OP" ,"OQ", "OR", /* Alternative F1, F2, F3
*/
+ "[[A","[[B","[[C", NULL /* Linux console F1, F2, F3
*/
};
static char *StrNode[] = {
"help", "index", "table of content"
@@ -178,7 +182,9 @@
/* Get a single char from stdin */
*p = getchr();
/* A escape char indicates beginning of command */
- if(*p == '\033') *(p=buffer) = '\033'; *++p = 0;
+ if(*p == '\033') *(p=buffer) = '\033';
+
+ *++p = 0;
/* Special sequence ? */
if( buffer[0]=='\033' )
@@ -202,6 +208,19 @@
case 5: scroll_vert(&terminfo, terminfo.height-2); break;
case 6: scroll_vert(&terminfo, -0x7fff); break;
case 7: scroll_vert(&terminfo, 0x7fff); break;
+ case 8: scroll_vert(&terminfo, -0x7fff); break;
+ case 9: scroll_vert(&terminfo, 0x7fff); break;
+ case 10: scroll_vert(&terminfo, -0x7fff); break;
+ case 11: scroll_vert(&terminfo, 0x7fff); break;
+ case 12: p[-1] = '1'; goto singleton;
+ case 13: p[-1] = '2'; goto singleton;
+ case 14: p[-1] = '3'; goto singleton;
+ case 15: p[-1] = '1'; goto singleton;
+ case 16: p[-1] = '2'; goto singleton;
+ case 17: p[-1] = '3'; goto singleton;
+ case 18: p[-1] = '1'; goto singleton;
+ case 19: p[-1] = '2'; goto singleton;
+ case 20: p[-1] = '3'; goto singleton;
}
p=buffer;
} else goto singleton;
--- NEW FILE AGReader.spec ---
Name: AGReader
Version: 1.1
Release: 9%{?dist}
Summary: Console reader for viewing AmigaGuide files
Group: Applications/Text
License: GPL
URL:
http://wuarchive.wustl.edu/aminet/misc/unix
Source0:
http://wuarchive.wustl.edu/aminet/misc/unix/%{name}.tgz
Patch0: AGReader-1.1-gcc41.patch
Patch1: AGReader-1.1-keys.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Provides: agreader = %{version}-%{release}
%description
A viewer for the UNIX console which can read and display AmigaGuide files. It
supports all of the v39 AmigaGuide specification possible and supports a large
subset of the v40 specifications.
%prep
%setup -q -n %{name}
%patch0 -p1
%patch1 -p1
%build
cd Sources
make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS"
%install
rm -rf %{buildroot}
cd Sources
mkdir -p %{buildroot}%{_bindir}
install -m0755 agr %{buildroot}%{_bindir}
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{_bindir}/agr
%doc Docs/agr.guide Docs/test.guide Docs/agr.html README
%changelog
* Sun May 28 2006 Ian Chapman <packages(a)amiga-hardware.com> 1.1-9%{?dist}
- Updated keys patch which fixes the keys under BOTH the console and an
xterm, courtesy of Hans de Goede
- Added provides to offer lower case alias in preparation for probable
policy change
* Sat May 27 2006 Ian Chapman <packages(a)amiga-hardware.com> 1.1-8.iss
- Added patch to fix compilation with gcc41 courtesy of Hans de Goede
- Added patch to fix Home, End, F1, F2, F3 keys courtesy of Hans de Goede
- Added rpmoptflags to make line
- Removed compat-gcc-32 buildrequires - obsoleted by gcc41 patch.
- Use %%{?dist} for most recent changelog entry - avoids incoherent changelog
versions if %%{?dist} macro is missing or different.
* Sat May 13 2006 Ian Chapman <packages(a)amiga-hardware.com> 1.1-7.iss
- Removed gcc32 patch. It's now specified on the make command line
- Replaced %{__rm} in clean section with rm
* Mon May 01 2006 Ian Chapman <packages(a)amiga-hardware.com> 1.1-6.iss
- Altered spec file to more closely follow Fedora build guidelines
* Tue Oct 25 2004 Ian Chapman <packages(a)amiga-hardware.com> 1.1-5.iss
- Fixes for deprecated fields with the latest version of rpmbuild
* Thu Dec 04 2003 Ian Chapman <packages(a)amiga-hardware.com> 1.1-4
- Minor fixes to changelog
- Fixed permissions on documentation directory
- Changed group to Applications/Text
* Sun Oct 05 2003 Ian Chapman <packages(a)amiga-hardware.com> 1.1-3
- Minor fixes to prep and clean
* Fri Jul 18 2003 Ian Chapman <packages(a)amiga-hardware.com> 1.1-2
- Fixed few harmless bugs in SPEC file. Improved use of Macros.
Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/AGReader/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 31 May 2006 17:14:35 -0000 1.1
+++ .cvsignore 31 May 2006 17:15:21 -0000 1.2
@@ -0,0 +1 @@
+AGReader.tgz
Index: sources
===================================================================
RCS file: /cvs/extras/rpms/AGReader/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources 31 May 2006 17:14:35 -0000 1.1
+++ sources 31 May 2006 17:15:21 -0000 1.2
@@ -0,0 +1 @@
+07eae411edf5e580773331a696e8f890 AGReader.tgz