rpms/lv/devel lv-+num-option.patch, NONE, 1.1 lv-fastio.patch, NONE, 1.1 lv-lfs.patch, NONE, 1.1 .cvsignore, 1.10, 1.11

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Oct 31 06:35:15 UTC 2005


Author: tagoh

Update of /cvs/dist/rpms/lv/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv2599

Modified Files:
	.cvsignore 
Added Files:
	lv-+num-option.patch lv-fastio.patch lv-lfs.patch 
Log Message:


lv-+num-option.patch:
 lv.1          |   12 +++++++--
 src/command.c |   29 ++++++++++++++++++------
 src/command.h |    6 ++++
 src/conf.c    |   70 ++++++++++++++++++++++++++++++++++------------------------
 4 files changed, 79 insertions(+), 38 deletions(-)

--- NEW FILE lv-+num-option.patch ---
2005-05-02  GOTO Masanori  <gotom at debian.or.jp>

	* Add +num and +/pat option.

diff -Nuarp lv451/lv.1 lv451.gotom.+num/lv.1
--- lv451/lv.1	2004-01-16 21:23:33.000000000 +0900
+++ lv451.gotom.+num/lv.1	2005-05-02 21:17:52.000000000 +0900
@@ -11,7 +11,7 @@ lv \- a Powerful Multilingual File Viewe
 -V
 .br
 .B lv
-[-[+]acdfgiklmnqsuvz]
+[-acdfgiklmnqsuvz] [+acdfgiklmnqsuvz]
 .br
      [-A\fIcoding-system\fP] [-I\fIcoding-system\fP] [-K\fIcoding-system\fP]
 .br
@@ -21,7 +21,9 @@ lv \- a Powerful Multilingual File Viewe
 .br
      [-T\fInumber\fP] [-W\fIwidth\fP] [-H\fIheight\fP] [-E'\fIeditor'\fP] [-+]
 .br
-     [-] (\fIgrep pattern\fP) [\fIfiles ...\fP]
+     [+\fInumber\fP] [+/\fIgrep-pattern\fP]
+.br
+     [-] (\fIgrep-pattern\fP) [\fIfiles ...\fP]
 .SH DESCRIPTION
 .IP "\fIMultilingual file viewer\fP"
 \fIlv\fP is a powerful multilingual file viewer.
@@ -223,8 +225,12 @@ You can also turn OFF specified options,
 using ``+<option>'' like +c, +d, ... +z.
 .IP "-"
 Treat the following arguments as filenames
-.IP "\fIgrep pattern\fP"
+.IP "\fIgrep-pattern\fP"
 lv works like \fIgrep\fP (1) when its name is \fIlgrep\fP
+.IP "+\fInumber\fP"
+Jump to the specified line immediately when lv is invoked.
+.IP "+/\fIgrep-pattern\fP"
+Search  the specified pattern immediately when lv is invoked.
 .IP "-V"
 Show lv version
 .IP "-h"
diff -Nuarp lv451/src/command.c lv451.gotom.+num/src/command.c
--- lv451/src/command.c	2004-01-05 16:42:31.000000000 +0900
+++ lv451.gotom.+num/src/command.c	2005-05-02 20:45:18.000000000 +0900
@@ -66,8 +66,6 @@
 #define COM_FILE_PREV		'p'
 #define COM_FILE_NEXT		'n'
 
-#define IsNumber( c )		( (c) >= '0' && (c) <= '9' )
-
 #ifdef MSDOS
 #define HISTORY_SIZE		2
 #else
@@ -145,6 +143,22 @@ private void CommandCopyToHistory( str_t
     historyIndex = 0;
 }
 
+private int CommandGetChar()
+{
+  int ch;
+
+  if( FALSE == initcmd_mode ){
+    return ConsoleGetChar();
+  }
+
+  ch = initcmd_str[ initcmd_curp++ ];
+  if( initcmd_str[ initcmd_curp ] == NUL ){
+    initcmd_mode = FALSE;
+    free( initcmd_str );
+  }
+  return ch;
+}
+
 private i_str_t *CommandGetLine( file_t *f, byte prompt )
 {
   int ch, ptr, iptr, width, pre_width, index;
@@ -164,13 +178,14 @@ private i_str_t *CommandGetLine( file_t 
   pre_width = -1;
   for( ; ; ){
     ConsoleFlush();
-    ch = ConsoleGetChar();
+    ch = CommandGetChar();
     switch( ch ){
     case EOF:
     case BEL: /* C-g */
       if( NULL != istr )
 	IstrFree( istr );
       return NULL;
+    case LF: /* C-j */
     case CR: /* C-m */
       if( NULL == istr )
 	return NULL;
@@ -344,7 +359,7 @@ private boolean_t CommandGetNumber( unsi
     ConsolePrints( buf );
 
     ConsoleFlush();
-    ch = ConsoleGetChar();
+    ch = CommandGetChar();
     if( EOF == ch )
       return FALSE;
     else if( BS == ch || DEL == ch ){
@@ -902,7 +917,7 @@ private void CommandCursor( unsigned int
   flagLeft = flagRight = flagUp = flagDown = flagPpage = flagNpage = TRUE;
   step = 1;
   for( ; ; ){
-    ch = ConsoleGetChar();
+    ch = CommandGetChar();
     if( NULL == cur_left || ch != cur_left[ step ] )
       flagLeft = FALSE;
     if( NULL == cur_right || ch != cur_right[ step ] )
@@ -954,7 +969,7 @@ private void CommandColon( unsigned int 
   stream_t *st;
   file_list_t *next_target;
 
-  ch = ConsoleGetChar();
+  ch = CommandGetChar();
 
   if( COM_FILE_PREV == ch || COM_FILE_NEXT == ch ){
     if( 0 < arg ){
@@ -1179,7 +1194,7 @@ public void Command( file_t *file, byte 
     }
 
     ConsoleFlush();
-    com = ConsoleGetChar();
+    com = CommandGetChar();
     if( com < 0x00 || com > 0x7f )
       continue;
 
diff -Nuarp lv451/src/command.h lv451.gotom.+num/src/command.h
--- lv451/src/command.h	2003-11-13 12:08:19.000000000 +0900
+++ lv451.gotom.+num/src/command.h	2005-05-02 20:29:11.000000000 +0900
@@ -12,6 +12,12 @@
 
 public byte *editor_program;
 
+public boolean_t initcmd_mode;
+public char *initcmd_str;
+public int initcmd_curp;
+
+#define IsNumber( c )		( (c) >= '0' && (c) <= '9' )
+
 public boolean_t CommandInit();
 public void Command( file_t *file, byte **optional );
 
diff -Nuarp lv451/src/conf.c lv451.gotom.+num/src/conf.c
--- lv451/src/conf.c	2004-01-05 16:23:29.000000000 +0900
+++ lv451.gotom.+num/src/conf.c	2005-05-02 20:33:44.000000000 +0900
@@ -313,38 +313,52 @@ private void ConfArg( conf_t *conf, byte
     }
   } else if( TRUE == conf->options && '+' == **argv ){
     s = *argv + 1;
-    while( *s ){
-      switch( *s ){
+    if( *s == '/' || IsNumber( *s ) ){
+      size_t initcmd_len = strlen( s );
+      initcmd_mode = TRUE;
+      initcmd_curp = 0;
+      initcmd_str = Malloc( initcmd_len + 2 );
+      strcpy( initcmd_str, s );
+      if( *s == '/' ){
+	initcmd_str[ initcmd_len ] = CR;
+      } else if( IsNumber( *s ) && IsNumber( s[ initcmd_len - 1 ] ) ){
+	initcmd_str[ initcmd_len ] = 'g';
+      }
+      initcmd_str[ initcmd_len + 1 ] = NUL;
+    } else {
+      while( *s ){
+	switch( *s ){
 #ifndef MSDOS /* IF NOT DEFINED */
-      case 'm': unimap_iso8859 = FALSE; s++; continue;
+	case 'm': unimap_iso8859 = FALSE; s++; continue;
 #endif /* MSDOS */
-      case 'a': adjust_charset = FALSE; s++; continue;
-      case 'c': allow_ansi_esc = FALSE; s++; continue;
-      case 'd': casefold_search = FALSE; s++; continue;
-      case 'i': casefold_search = FALSE; s++; continue;
-      case 'f': regexp_search = TRUE; s++; continue;
-      case 'g': grep_mode = FALSE; s++; continue;
-      case 'k': kana_conv = FALSE; s++; continue;
-      case 'l': carefully_divide = TRUE; s++; continue;
-      case 'n': line_number = FALSE; s++; continue;
-      case 'q': no_scroll = TRUE; s++; continue;
-      case 's': smooth_paging = FALSE; s++; continue;
-      case 'u': allow_unify = FALSE; s++; continue;
-      case 'v': grep_inverted = FALSE; s++; continue;
-      case 'z': hz_detection = FALSE; s++; continue;
-      case SP:
-      case HT:
-	break;
-      default:
-	UnknownOption( s, location );
-      }
-      do {
-	s++;
-	if( '-' == *s || '+' == *s ){
-	  s++;
+	case 'a': adjust_charset = FALSE; s++; continue;
+	case 'c': allow_ansi_esc = FALSE; s++; continue;
+	case 'd': casefold_search = FALSE; s++; continue;
+	case 'i': casefold_search = FALSE; s++; continue;
+	case 'f': regexp_search = TRUE; s++; continue;
+	case 'g': grep_mode = FALSE; s++; continue;
+	case 'k': kana_conv = FALSE; s++; continue;
+	case 'l': carefully_divide = TRUE; s++; continue;
+	case 'n': line_number = FALSE; s++; continue;
+	case 'q': no_scroll = TRUE; s++; continue;
+	case 's': smooth_paging = FALSE; s++; continue;
+	case 'u': allow_unify = FALSE; s++; continue;
+	case 'v': grep_inverted = FALSE; s++; continue;
+	case 'z': hz_detection = FALSE; s++; continue;
+	case SP:
+	case HT:
 	  break;
+	default:
+	  UnknownOption( s, location );
 	}
-      } while( *s );
+	do {
+	  s++;
+	  if( '-' == *s || '+' == *s ){
+	    s++;
+	    break;
+	  }
+	} while( *s );
+      }
     }
   } else {
     if( TRUE == grep_mode && NULL == conf->pattern )

lv-fastio.patch:
 command.c    |   18 +++++-----
 configure.in |   11 ++++++
 fetch.c      |    2 -
 file.c       |   97 ++++++++++++++++++++++++++++++++++++++++++++++-------------
 file.h       |   32 ++++++++++++++++++-
 5 files changed, 128 insertions(+), 32 deletions(-)

--- NEW FILE lv-fastio.patch ---
diff -Nuarp -x Makefile -x 'gmon*' -x 'profile*' -x 'lv-*' lv451/src/command.c lv451.gotom/src/command.c
--- lv451/src/command.c	2004-01-05 16:42:31.000000000 +0900
+++ lv451.gotom/src/command.c	2005-05-06 21:27:02.000000000 +0900
@@ -497,7 +497,7 @@ private void CommandReload( unsigned int
   byte defaultCodingSystem;
   stream_t st;
 
-  if( NULL != f->sp ){
+  if( NULL != f->sp.iop ){
     label = "cannot reload non-regular files";
     return;
   }
@@ -506,9 +506,9 @@ private void CommandReload( unsigned int
     label = "cannot reload current file";
     return;
   } else {
-    fclose( f->fp );
+    fclose( f->fp.iop );
     st.fp = fp;
-    st.sp = f->sp;
+    st.sp = f->sp.iop;
     st.pid = f->pid;
   }
 
@@ -618,7 +618,7 @@ private void CommandEdit( unsigned int a
   byte *fileName;
   int lineNumber;
 
-  if( NULL != f->sp ){
+  if( NULL != f->sp.iop ){
     label = "cannot edit non-regular files";
     return;
   }
@@ -698,7 +698,7 @@ private void CommandPoll( unsigned int a
 
   kb_interrupted = FALSE;
 
-  if( NULL != f->sp ){
+  if( NULL != f->sp.iop ){
     label = "cannot poll non-regular files";
     return;
   }
@@ -718,8 +718,8 @@ private void CommandPoll( unsigned int a
     ConsoleSetAttribute( 0 );
     ConsoleFlush();
 
-    (void)fseek( f->fp, 0, SEEK_END );
-    pos = ftell( f->fp );
+    (void)IobufFseek( &f->fp, 0, SEEK_END );
+    pos = IobufFtell( &f->fp );
 
     ConsoleEnableInterrupt();
 
@@ -728,8 +728,8 @@ private void CommandPoll( unsigned int a
       if( kb_interrupted )
 	break;
 
-      (void)fseek( f->fp, 0, SEEK_END );
-      if( ftell( f->fp ) > pos ){
+      (void)IobufFseek( &f->fp, 0, SEEK_END );
+      if( IobufFtell( &f->fp ) > pos ){
 	// it grew
 	break;
       }
diff -Nuarp -x Makefile -x 'gmon*' -x 'profile*' -x 'lv-*' lv451/src/configure.in lv451.gotom/src/configure.in
--- lv451/src/configure.in	2004-01-05 15:35:44.000000000 +0900
+++ lv451.gotom/src/configure.in	2005-05-06 21:28:07.000000000 +0900
@@ -57,5 +57,16 @@ AC_DEFUN([AM_LANGINFO_CODESET],
 
 AM_LANGINFO_CODESET
 
+AC_MSG_CHECKING(whether fastio is used)
+AC_ARG_ENABLE(fastio,
+	[ --enable-fastio          tries to reduce stdio overhead],
+	[if ! test "$enableval" = no; then
+	 	AC_DEFINE(USE_INTERNAL_IOBUF, 1)
+		AC_MSG_RESULT(yes)
+	 else
+		AC_MSG_RESULT(no)
+	 fi],
+	[AC_MSG_RESULT(no)])
+
 dnl AC_OUTPUT(Makefile src/Makefile)
 AC_OUTPUT(Makefile)
diff -Nuarp -x Makefile -x 'gmon*' -x 'profile*' -x 'lv-*' lv451/src/fetch.c lv451.gotom/src/fetch.c
--- lv451/src/fetch.c	2004-01-05 16:30:15.000000000 +0900
+++ lv451.gotom/src/fetch.c	2005-05-06 20:03:44.000000000 +0900
@@ -151,7 +151,7 @@ private void PageLoad( file_t *f, int bl
 {
   int i;
 
-  if( fseek( f->fp, ptr, SEEK_SET ) )
+  if( IobufFseek( &f->fp, ptr, SEEK_SET ) )
     perror( "PageLoad()" ), exit( -1 );
 
   f->eof = FALSE;
diff -Nuarp -x Makefile -x 'gmon*' -x 'profile*' -x 'lv-*' lv451/src/file.c lv451.gotom/src/file.c
--- lv451/src/file.c	2004-01-05 16:30:15.000000000 +0900
+++ lv451.gotom/src/file.c	2005-05-06 21:36:20.000000000 +0900
@@ -68,6 +68,57 @@ public void FileFreeLine( file_t *f )
   }
 }
 
+#ifdef USE_INTERNAL_IOBUF
+public inline int IobufGetc( iobuf_t *iobuf )
+{
+  if( iobuf->cur >= iobuf->last ){
+    /* no stream buffer, reset and fill now */
+    iobuf->cur = 0;
+    iobuf->last = fread( iobuf->buf, sizeof( byte ), IOBUF_DEFAULT_SIZE, iobuf->iop );
+    if( iobuf->last <= 0 ){
+      return EOF;
+    }
+  }
+  return iobuf->buf[ iobuf->cur++ ];
+}
+
+public inline int IobufUngetc( int ch, iobuf_t *iobuf )
+{
+  if( iobuf->cur == 0 ){
+    /* XXX: it should be tied to fp sanely */
+    return EOF;
+  }
+  iobuf->buf[ --iobuf->cur ] = (byte)ch;
+  return ch;
+}
+
+public long IobufFtell( iobuf_t *iobuf )
+{
+  long ptr;
+  ptr = ftell( iobuf->iop );
+  if( iobuf->cur == iobuf->last ){
+    return ptr;
+  }
+  return ptr - ( iobuf->last - iobuf->cur );
+}
+
+public int IobufFseek( iobuf_t *iobuf, long off, int mode )
+{
+  iobuf->cur = iobuf->last = 0;  /* flush all iobuf */
+  return fseek( iobuf->iop, off, mode );
+}
+
+public int IobufFeof( iobuf_t *iobuf )
+{
+  if( iobuf->cur == iobuf->last ){
+    return feof( iobuf->iop );
+  } else {
+    return 1;
+  }
+}
+#endif
+
+
 /*
  * $B8=:_$N%U%!%$%k%]%$%s%?$+$i(B 1$B9T$rFI$_9~$s$G%P%C%U%!$K3JG<$9$k(B.
  * $B%3!<%I7O$N<+F0H=JL$NBP>]$H$J$k>l9g(B, $B<+F0H=JL$r9T$J$&(B.
@@ -93,21 +144,21 @@ public byte *FileLoadLine( file_t *f, in
   count = 0;
   idx = 0;
 
-  while( EOF != (ch = getc( f->fp )) ){
+  while( EOF != (ch = IobufGetc( &f->fp )) ){
     len++;
     load_array[ count ][ idx++ ] = (byte)ch;
     if( LF == ch ){
       /* UNIX style */
       break;
     } else if( CR == ch ){
-      if( LF == (ch = getc( f->fp )) ){
+      if( LF == (ch = IobufGetc( &f->fp )) ){
 	/* MSDOS style */
       } else if( EOF == ch ){
 	/* need to avoid EOF due to pre-load of that */
 	ch = LF;
       } else {
 	/* Mac style */
-	ungetc( ch, f->fp );
+	IobufUngetc( ch, &f->fp );
       }
       load_array[ count ][ idx - 1 ] = LF;
       break;
@@ -207,23 +258,23 @@ public boolean_t FileStretch( file_t *f,
   ptr = f->lastPtr;
   segment = f->lastSegment;
 
-  if( fseek( f->fp, ptr, SEEK_SET ) )
+  if( IobufFseek( &f->fp, ptr, SEEK_SET ) )
     perror( "FileStretch()" ), exit( -1 );
 
 #ifndef MSDOS /* IF NOT DEFINED */
-  if( NULL != f->sp ){
-    while( EOF != (ch = getc( f->sp )) ){
-      putc( ch, f->fp );
+  if( NULL != f->sp.iop ){
+    while( EOF != (ch = IobufGetc( &f->sp )) ){
+      IobufPutc( ch, &f->fp );
       count++;
       if( LF == ch || CR == ch || count == (LOAD_SIZE * LOAD_COUNT) ){
 	if( CR == ch ){
-	  if( LF != (ch = getc( f->sp )) )
-	    ungetc( ch, f->sp );
+	  if( LF != (ch = IobufGetc( &f->sp )) )
+	    IobufUngetc( ch, &f->sp );
 	  else
-	    putc( LF, f->fp );
+	    IobufPutc( LF, &f->fp );
 	}
 	count = 0;
-	if( 0 > (ptr = ftell( f->fp )) )
+	if( 0 > (ptr = IobufFtell( &f->fp )) )
 	  perror( "FileStretch()" ), exit( -1 );
 	if( ++line == LV_PAGE_SIZE ){
 	  f->totalLines += line;
@@ -249,21 +300,21 @@ public boolean_t FileStretch( file_t *f,
 	  return FALSE;
       }
     }
-    if( -1 != f->pid && feof( f->sp ) ){
+    if( -1 != f->pid && IobufFeof( &f->sp ) ){
       int status;
       wait( &status );
     }
   } else {
 #endif /* MSDOS */
-    while( EOF != (ch = getc( f->fp )) ){
+    while( EOF != (ch = IobufGetc( &f->fp )) ){
       count++;
       if( LF == ch || CR == ch || count == (LOAD_SIZE * LOAD_COUNT) ){
 	if( CR == ch ){
-	  if( LF != (ch = getc( f->fp )) )
-	    ungetc( ch, f->fp );
+	  if( LF != (ch = IobufGetc( &f->fp )) )
+	    IobufUngetc( ch, &f->fp );
 	}
 	count = 0;
-	if( 0 > (ptr = ftell( f->fp )) )
+	if( 0 > (ptr = IobufFtell( &f->fp )) )
 	  perror( "FileStretch()" ), exit( -1 );
 	if( ++line == LV_PAGE_SIZE ){
 	  f->totalLines += line;
@@ -301,7 +352,7 @@ public boolean_t FileStretch( file_t *f,
       segment++;
       f->totalLines += line;
       f->lastSegment = segment;
-      if( 0 > (f->lastPtr = ftell( f->fp )) )
+      if( 0 > (f->lastPtr = IobufFtell( &f->fp )) )
 	perror( "FileStretch()" ), exit( -1 );
     }
     f->done = TRUE;
@@ -325,7 +376,7 @@ public boolean_t FileSeek( file_t *f, un
     if( FALSE == FileStretch( f, segment ) )
       return FALSE;
 
-  if( fseek( f->fp, f->slot[ Frame( segment ) ][ Slot( segment ) ], SEEK_SET ) )
+  if( IobufFseek( &f->fp, f->slot[ Frame( segment ) ][ Slot( segment ) ], SEEK_SET ) )
     perror( "FileSeek()" ), exit( -1 );
 
   return TRUE;
@@ -392,8 +443,14 @@ public file_t *FileAttach( byte *fileNam
   f->fileNameI18N	= NULL;
   f->fileNameLength	= 0;
 
-  f->fp			= st->fp;
-  f->sp			= st->sp;
+  f->fp.iop		= st->fp;
+  f->sp.iop		= st->sp;
+#ifdef USE_INTERNAL_IOBUF
+  f->fp.cur		= 0;
+  f->fp.last		= 0;
+  f->sp.cur		= 0;
+  f->sp.last		= 0;
+#endif
   f->pid		= st->pid;
   f->lastSegment	= 0;
   f->totalLines		= 0L;
diff -Nuarp -x Makefile -x 'gmon*' -x 'profile*' -x 'lv-*' lv451/src/file.h lv451.gotom/src/file.h
--- lv451/src/file.h	2004-01-05 16:30:15.000000000 +0900
+++ lv451.gotom/src/file.h	2005-05-06 21:34:53.000000000 +0900
@@ -27,6 +27,10 @@
 #define FRAME_SIZE	4096U
 #endif /* MSDOS */
 
+#ifdef USE_INTERNAL_IOBUF
+# define IOBUF_DEFAULT_SIZE	256
+#endif
+
 typedef struct {
   int		ptr;
   int		width;
@@ -66,11 +70,20 @@ typedef struct {
 } find_t;
 
 typedef struct {
+  FILE		*iop;
+#ifdef USE_INTERNAL_IOBUF
+  byte		buf[ IOBUF_DEFAULT_SIZE ];
+  size_t	cur;
+  size_t	last;
+#endif
+} iobuf_t;
+
+typedef struct {
   byte		*fileName;
   i_str_t	*fileNameI18N;
   int		fileNameLength;
-  FILE		*fp;
-  FILE		*sp;
+  iobuf_t	fp;
+  iobuf_t	sp;
   int		pid;
   byte		inputCodingSystem;
   byte		outputCodingSystem;
@@ -137,4 +150,19 @@ public byte *FileName( file_t *f );
 
 public void FileInit();
 
+#ifndef USE_INTERNAL_IOBUF
+# define IobufGetc( a )		getc( (a)->iop )
+# define IobufUngetc( a, b )	ungetc( a, (b)->iop )
+# define IobufFtell( a )	ftell( (a)->iop )
+# define IobufFseek( a, b, c )	fseek( (a)->iop, b, c)
+# define IobufFeof( a )		feof( (a)->iop )
+#else
+public inline int IobufGetc( iobuf_t *iobuf );
+public inline int IobufUngetc( int ch, iobuf_t *iobuf );
+public long IobufFtell( iobuf_t *iobuf );
+public int IobufFseek( iobuf_t *iobuf, long off, int mode );
+public int IobufFeof( iobuf_t *iobuf );
+#endif
+#define IobufPutc( a, b )	putc( a, (b)->iop )
+
 #endif /* __FILE_H__ */

lv-lfs.patch:
 README           |    2 +-
 index.html       |    4 ++--
 relnote.html     |   10 +++++++++-
 src/command.c    |    2 +-
 src/configure.in |    4 ++++
 src/fetch.c      |    2 +-
 src/file.c       |   26 +++++++++++++++++---------
 src/file.h       |   24 ++++++++++++++++++------
 src/version.c    |    2 +-
 src/version.h    |    2 +-
 10 files changed, 55 insertions(+), 23 deletions(-)

--- NEW FILE lv-lfs.patch ---
2005-10-30  GOTO Masanori  <gotom at sanori.org>

	* src/command.c: Use offset_t typedef for encapsulating
	long vs long long on 32bit LFS systems.
	* src/fetch.c: Likewise.
	* src/file.c: Likewise.
	* src/file.h: Likewise.
	* src/file.c: Use HAVE_FSEEKO to switch whether LFS functions
	are available or not.  Don't use "0L" style constant
	initialization, because it conflicts with "long vs long long"
	issue, and C ensures to expand type from int to large type.
	* src/file.h: Include stdlib.h for using off_t.
	* src/version.h: Define version 4.51.a.
	* src/configure: Update by autoconf 2.50 series.
	* src/configure.in: Add checks for largefile and fseeko.
	* src/version.c: Update Copyright date from 2004 to 2005.
	* relnote.html: Likewise.
	* index.html: Likewise.
	* README: Likewise.
	* relnote.html: Add changelog for 4.51.a.

diff -Nuarp lv-4.51-gotom/src/command.c lv-4.51-gotom/src/command.c
--- lv-4.51-gotom/src/command.c	2005-10-30 00:26:22.000000000 +0900
+++ lv-4.51-gotom/src/command.c	2005-10-30 00:02:02.000000000 +0900
@@ -709,7 +709,7 @@ private void CommandBottomOfFile( unsign
 
 private void CommandPoll( unsigned int arg )
 {
-  long pos;
+  offset_t pos;
 
   kb_interrupted = FALSE;
 
diff -Nuarp lv-4.51-gotom/src/configure.in lv-4.51-gotom/src/configure.in
--- lv-4.51-gotom/src/configure.in	2005-10-30 00:26:22.000000000 +0900
+++ lv-4.51-gotom/src/configure.in	2005-10-29 23:57:07.000000000 +0900
@@ -57,6 +57,10 @@ AC_DEFUN([AM_LANGINFO_CODESET],
 
 AM_LANGINFO_CODESET
 
+# Checks for largefile support
+AC_SYS_LARGEFILE
+AC_FUNC_FSEEKO
+
 AC_MSG_CHECKING(whether fastio is used)
 AC_ARG_ENABLE(fastio,
 	[ --enable-fastio          tries to reduce stdio overhead],
diff -Nuarp lv-4.51-gotom/src/fetch.c lv-4.51-gotom/src/fetch.c
--- lv-4.51-gotom/src/fetch.c	2005-10-30 00:26:22.000000000 +0900
+++ lv-4.51-gotom/src/fetch.c	2005-10-30 00:02:10.000000000 +0900
@@ -147,7 +147,7 @@ private boolean_t LineDecode( file_t *f,
  * $B9T?t$r%-%c%C%7%e$K3JG<$9$k(B.
  */
 
-private void PageLoad( file_t *f, int block, long ptr )
+private void PageLoad( file_t *f, int block, offset_t ptr )
 {
   int i;
 
diff -Nuarp lv-4.51-gotom/src/file.c lv-4.51-gotom/src/file.c
--- lv-4.51-gotom/src/file.c	2005-10-30 00:26:22.000000000 +0900
+++ lv-4.51-gotom/src/file.c	2005-10-30 00:27:47.000000000 +0900
@@ -92,20 +92,28 @@ public inline int IobufUngetc( int ch, i
   return ch;
 }
 
-public long IobufFtell( iobuf_t *iobuf )
+public offset_t IobufFtell( iobuf_t *iobuf )
 {
-  long ptr;
+  offset_t ptr;
+# ifdef HAVE_FSEEKO
+  ptr = ftello( iobuf->iop );
+# else
   ptr = ftell( iobuf->iop );
+# endif
   if( iobuf->cur == iobuf->last ){
     return ptr;
   }
   return ptr - ( iobuf->last - iobuf->cur );
 }
 
-public int IobufFseek( iobuf_t *iobuf, long off, int mode )
+public int IobufFseek( iobuf_t *iobuf, offset_t off, int mode )
 {
   iobuf->cur = iobuf->last = 0;  /* flush all iobuf */
+# ifdef HAVE_FSEEKO
+  return fseeko( iobuf->iop, off, mode );
+# else
   return fseek( iobuf->iop, off, mode );
+# endif
 }
 
 public int IobufFeof( iobuf_t *iobuf )
@@ -248,7 +256,7 @@ public boolean_t FileStretch( file_t *f,
 {
   int ch, count;
   unsigned int segment, line;
-  long ptr;
+  offset_t ptr;
 
   if( TRUE == f->done )
     return FALSE;
@@ -283,7 +291,7 @@ public boolean_t FileStretch( file_t *f,
 	    if( FRAME_SIZE == ++f->lastFrame
 	       ||
 	       NULL == (f->slot[ f->lastFrame ]
-			= (long *)malloc( sizeof( long ) * SLOT_SIZE ))
+			= (offset_t *)malloc( sizeof( offset_t ) * SLOT_SIZE ))
 	       ){
 	      f->done = TRUE;
 	      f->truncated = TRUE;
@@ -322,7 +330,7 @@ public boolean_t FileStretch( file_t *f,
 	  if( 0 == Slot( ++segment ) ){
 	    if( FRAME_SIZE == ++f->lastFrame
 	       || NULL == (f->slot[ f->lastFrame ]
-			   = (long *)malloc( sizeof( long ) * SLOT_SIZE ))
+			   = (offset_t *)malloc( sizeof( offset_t ) * SLOT_SIZE ))
 	       ){
 	      f->done = TRUE;
 	      f->truncated = TRUE;
@@ -454,7 +462,7 @@ public file_t *FileAttach( byte *fileNam
   f->pid		= st->pid;
   f->lastSegment	= 0;
   f->totalLines		= 0L;
-  f->lastPtr		= 0L;
+  f->lastPtr		= 0;
 
   f->lastFrame		= 0;
 
@@ -489,8 +497,8 @@ public void FilePreload( file_t *f )
   for( i = 0 ; i < FRAME_SIZE ; i++ )
     f->slot[ i ] = NULL;
 
-  f->slot[ 0 ]		= (long *)Malloc( sizeof( long ) * SLOT_SIZE );
-  f->slot[ 0 ][ 0 ]	= 0L;
+  f->slot[ 0 ]		= (offset_t *)Malloc( sizeof( offset_t ) * SLOT_SIZE );
+  f->slot[ 0 ][ 0 ]	= 0;
 
   FileCacheInit( f );
   FileStretch( f, 0 );
diff -Nuarp lv-4.51-gotom/src/file.h lv-4.51-gotom/src/file.h
--- lv-4.51-gotom/src/file.h	2005-10-30 00:26:22.000000000 +0900
+++ lv-4.51-gotom/src/file.h	2005-10-30 00:29:16.000000000 +0900
@@ -9,6 +9,7 @@
 #define __FILE_H__
 
 #include <stdio.h>
+#include <stdlib.h>
 
 #include <itable.h>
 #include <ctable.h>
@@ -78,6 +79,12 @@ typedef struct {
 #endif
 } iobuf_t;
 
+#ifdef HAVE_FSEEKO
+typedef off_t	offset_t;
+#else
+typedef long	offset_t;
+#endif
+
 typedef struct {
   byte		*fileName;
   i_str_t	*fileNameI18N;
@@ -96,7 +103,7 @@ typedef struct {
   unsigned int	lastSegment;
   unsigned int	lastFrame;
   unsigned long	totalLines;
-  long		lastPtr;
+  offset_t	lastPtr;
   boolean_t	done;
   boolean_t	eof;
   boolean_t	top;
@@ -107,7 +114,7 @@ typedef struct {
   screen_t	screen;
   boolean_t	used[ BLOCK_SIZE ];
   page_t	page[ BLOCK_SIZE ];
-  long		*slot[ FRAME_SIZE ];
+  offset_t	*slot[ FRAME_SIZE ];
 } file_t;
 
 #ifdef MSDOS
@@ -153,14 +160,19 @@ public void FileInit();
 #ifndef USE_INTERNAL_IOBUF
 # define IobufGetc( a )		getc( (a)->iop )
 # define IobufUngetc( a, b )	ungetc( a, (b)->iop )
-# define IobufFtell( a )	ftell( (a)->iop )
-# define IobufFseek( a, b, c )	fseek( (a)->iop, b, c)
+# ifdef HAVE_FSEEKO
+#  define IobufFtell( a )	ftello( (a)->iop )
+#  define IobufFseek( a, b, c )	fseeko( (a)->iop, b, c)
+# else
+#  define IobufFtell( a )	ftell( (a)->iop )
+#  define IobufFseek( a, b, c )	fseek( (a)->iop, b, c)
+# endif
 # define IobufFeof( a )		feof( (a)->iop )
 #else
 public inline int IobufGetc( iobuf_t *iobuf );
 public inline int IobufUngetc( int ch, iobuf_t *iobuf );
-public long IobufFtell( iobuf_t *iobuf );
-public int IobufFseek( iobuf_t *iobuf, long off, int mode );
+public offset_t IobufFtell( iobuf_t *iobuf );
+public int IobufFseeko( iobuf_t *iobuf, offset_t off, int mode );
 public int IobufFeof( iobuf_t *iobuf );
 #endif
 #define IobufPutc( a, b )	putc( a, (b)->iop )
diff -Nuarp lv-4.51-gotom/src/version.c lv-4.51-gotom/src/version.c
--- lv-4.51-gotom/src/version.c	2004-01-05 16:21:26.000000000 +0900
+++ lv-4.51-gotom/src/version.c	2005-10-30 00:33:23.000000000 +0900
@@ -30,7 +30,7 @@ public void Banner()
 {
   fprintf( stderr,
 	  "# lv " VERSION "\n"
-	  "# All rights reserved. Copyright (C) 1996-2004 by NARITA Tomio\n"
+	  "# All rights reserved. Copyright (C) 1996-2005 by NARITA Tomio\n"
 	  "# ABSOLUTELY NO WARRANTY; for details type `lv -h'\n"
 	  );
 }
diff -Nuarp lv-4.51-gotom/src/version.h lv-4.51-gotom/src/version.h
--- lv-4.51-gotom/src/version.h	2004-01-16 21:25:57.000000000 +0900
+++ lv-4.51-gotom/src/version.h	2005-10-30 00:37:47.000000000 +0900
@@ -8,7 +8,7 @@
 #ifndef __VERSION_H__
 #define __VERSION_H__
 
-#define VERSION		"v.4.51 (Jan.16th,2004)"
+#define VERSION		"v.4.51.a (Oct.30th,2005)"
 
 public void Banner();
 
diff -Nuarp lv-4.51-gotom/src/version.h~ lv-4.51-gotom/src/version.h~
--- lv-4.51-gotom/README	2004-01-05 16:43:07.000000000 +0900
+++ lv-4.51-gotom/README	2005-10-30 00:34:58.000000000 +0900
@@ -6,7 +6,7 @@
 
 ------------------------------------------------------------------------------
 
-   All rights reserved. Copyright (C) 1996-2004 by NARITA Tomio.
+   All rights reserved. Copyright (C) 1996-2005 by NARITA Tomio.
 
    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
--- lv-4.51-gotom/relnote.html	2004-01-16 21:25:55.000000000 +0900
+++ lv-4.51-gotom/relnote.html	2005-10-30 00:43:51.000000000 +0900
@@ -11,7 +11,7 @@
 <BODY BGCOLOR=#ffffe0 TEXT=#c00090 LINK=#0090c0 VLINK=#e000a8 ALINK=#00c090>
 
 <P ALIGN=right>
-<FONT SIZE=-2>All rights reserved. Copyright (C) 1996-2004 by NARITA Tomio</FONT>
+<FONT SIZE=-2>All rights reserved. Copyright (C) 1996-2005 by NARITA Tomio</FONT>
 
 <HR>
 
@@ -30,6 +30,14 @@ Back to <A HREF="index.html">LV Homepage
 <HR WIDTH="50%">
 
 <UL>
+<li> ver 4.51.a (Oct.30th,2005) (Masanori GOTO version)<br>
+	<ul>
+	<li> Add largefile support, now lv can handle over 2GB files on 32 bit architectures that conform to Large File Summit.
+	<li> Use newer autoconf to generate configure.
+	<li> Add --enable-fastio configure option in order to accelerate speed and reduce getc calling overhead on some systems whose stdio functions are procedural, not simple inline expansion.
+	<li> Update copyright date to 2005.
+	<li> Add +num option that is useful for specifying line number like vi style.
+	</ul>
 <li> ver 4.51 (Jan.16th,2004) <br>
 	<ul>
 	<li> fixed keyboard-interrupt handling while reloading a file to avoid segmentation fault.
--- lv-4.51-gotom/index.html	2004-01-16 21:29:21.000000000 +0900
+++ lv-4.51-gotom/index.html	2005-10-30 00:34:44.000000000 +0900
@@ -11,7 +11,7 @@
 <BODY BGCOLOR=#ffffe0 TEXT=#c00090 LINK=#0090c0 VLINK=#e000a8 ALINK=#00c090>
 
 <P ALIGN=right>
-<FONT SIZE=-2>All rights reserved. Copyright (C) 1996-2004 by NARITA Tomio</FONT> <BR>
+<FONT SIZE=-2>All rights reserved. Copyright (C) 1996-2005 by NARITA Tomio</FONT> <BR>
 Last modified at Jan.16th,2004.
 
 <HR>
@@ -114,7 +114,7 @@ Copyright </H2>
 
 <DL> <DT> <DD>
 <PRE>
-All rights reserved. Copyright (C) 1996-2004 by NARITA Tomio.
+All rights reserved. Copyright (C) 1996-2005 by NARITA Tomio.
 
 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


Index: .cvsignore
===================================================================
RCS file: /cvs/dist/rpms/lv/devel/.cvsignore,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- .cvsignore	9 Sep 2004 08:06:59 -0000	1.10
+++ .cvsignore	31 Oct 2005 06:35:11 -0000	1.11
@@ -1 +1,4 @@
+*.rpm
+*.gz
+*.bz2
 lv451.tar.gz




More information about the fedora-cvs-commits mailing list