Whoops, reading too slow.

On Tue, Apr 06, 2010 at 05:41:59PM +0100, Nicholas Marriott wrote:
> Hi
> 
> You'll have to implement wordexp(3) in libc too before this does us any
> good.
> 
> 
> On Tue, Apr 06, 2010 at 03:49:58PM +0930, Matthew Haub wrote:
> > Hello,
> > 
> > On Fri, Apr 02, 2010 at 07:08:43PM -0700, Philip Guenther wrote:
> > > are we still tracking the upstream less(1) and if so, is the
> > > behavioral change acceptable there?
> > 
> > On Sat, Apr 03, 2010 at 03:37:46PM +1030, Matthew Haub wrote:
> > > We no longer track upstream less(1). The last sync was 7 years ago.
> > 
> > On Sat, Apr 03, 2010 at 07:34:40AM +0100, Nicholas Marriott wrote:
> > > Yes, but is that for a reason or just because nobody has updated it?
> > 
> > Todd Miller would be the person to ask. Either way I've emailed the less
> > maintainer to see whether he would be interested in using wordexp over
> > lessecho on systems that support it.
> > 
> > On Fri, Apr 02, 2010 at 07:08:43PM -0700, Philip Guenther wrote:
> > > if you want this, you should just implement wordexp(3) in libc and
> > > then use that.
> > 
> > Done. This patch uses wordexp as a drop in replacement for glob when
> > available.
> > 
> > Matthew
> > 
> > Index: configure
> > ===================================================================
> > RCS file: /cvs/src/usr.bin/less/configure,v
> > retrieving revision 1.3
> > diff -u configure
> > --- configure       13 Apr 2003 18:26:25 -0000      1.3
> > +++ configure       6 Apr 2010 04:26:47 -0000
> > @@ -4456,7 +4456,7 @@
> >  
> >  
> >  
> > -for ac_func in fsync memcpy popen _setjmp sigprocmask sigsetmask stat 
> > strchr strstr system
> > +for ac_func in fsync memcpy popen _setjmp sigprocmask sigsetmask stat 
> > strchr strstr system wordexp
> >  do
> >  as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
> >  echo "$as_me:$LINENO: checking for $ac_func" >&5
> > Index: configure.ac
> > ===================================================================
> > RCS file: /cvs/src/usr.bin/less/configure.ac,v
> > retrieving revision 1.1.1.1
> > diff -u configure.ac
> > --- configure.ac    13 Apr 2003 18:21:21 -0000      1.1.1.1
> > +++ configure.ac    6 Apr 2010 04:26:48 -0000
> > @@ -211,7 +211,7 @@
> >  
> >  # Checks for library functions.
> >  AC_TYPE_SIGNAL
> > -AC_CHECK_FUNCS([fsync memcpy popen _setjmp sigprocmask sigsetmask stat 
> > strchr strstr system])
> > +AC_CHECK_FUNCS([fsync memcpy popen _setjmp sigprocmask sigsetmask stat 
> > strchr strstr system wordexp])
> >  
> >  # Some systems have termios.h but not the corresponding functions.
> >  AC_CHECK_FUNC(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS))
> > Index: defines.h.in
> > ===================================================================
> > RCS file: /cvs/src/usr.bin/less/defines.h.in,v
> > retrieving revision 1.2
> > diff -u defines.h.in
> > --- defines.h.in    14 Apr 2003 14:33:57 -0000      1.2
> > +++ defines.h.in    6 Apr 2010 04:26:48 -0000
> > @@ -346,6 +346,9 @@
> >  /* Define HAVE_VOID if your compiler supports the "void" type. */
> >  #undef HAVE_VOID
> >  
> > +/* Define to 1 if you have the `wordexp' function. */
> > +#undef HAVE_WORDEXP
> > +
> >  /* Define to 1 if you have the `_setjmp' function. */
> >  #undef HAVE__SETJMP
> >  
> > Index: filename.c
> > ===================================================================
> > RCS file: /cvs/src/usr.bin/less/filename.c,v
> > retrieving revision 1.13
> > diff -u filename.c
> > --- filename.c      6 Dec 2006 05:03:29 -0000       1.13
> > +++ filename.c      6 Apr 2010 04:26:48 -0000
> > @@ -37,6 +37,9 @@
> >  #include <signal.h>
> >  #endif
> >  
> > +#if HAVE_WORDEXP
> > +#include <wordexp.h>
> > +#endif
> >  #if HAVE_STAT
> >  #include <sys/stat.h>
> >  #ifndef S_ISDIR
> > Index: lglob.h
> > ===================================================================
> > RCS file: /cvs/src/usr.bin/less/lglob.h,v
> > retrieving revision 1.3
> > diff -u lglob.h
> > --- lglob.h 22 Apr 2003 22:57:13 -0000      1.3
> > +++ lglob.h 6 Apr 2010 04:26:48 -0000
> > @@ -23,7 +23,18 @@
> >   */
> >  
> >  #include <glob.h>
> > +#include "defines.h"
> >  
> > +#if HAVE_WORDEXP
> > +#define    GLOB_FLAGS                      (WRDE_NOCMD)
> > +#define    DECL_GLOB_LIST(list)            wordexp_t list; int i; int 
> > list##error;
> > +#define    GLOB_LIST_FAILED(list)          list##error != 0
> > +#define    SCAN_GLOB_LIST(list,p)          i = 0; i < list.we_wordc; i++
> > +#define    INIT_GLOB_LIST(list,p)          p = list.we_wordv[i]
> > +#define    GLOB_LIST_DONE(list)            wordfree(&list)
> > +#define    GLOB_LIST(path,list)            list##error = \
> > +                                       wordexp(path,&list,GLOB_FLAGS)
> > +#else
> >  #define GLOB_FLAGS                 (GLOB_NOCHECK|GLOB_BRACE|GLOB_TILDE)
> >  #define    DECL_GLOB_LIST(list)            glob_t list;  int i;
> >  #define    GLOB_LIST(filename,list)        
> > glob(filename,GLOB_FLAGS,0,&list)
> > @@ -31,3 +42,4 @@
> >  #define    SCAN_GLOB_LIST(list,p)          i = 0;  i < list.gl_pathc;  i++
> >  #define    INIT_GLOB_LIST(list,p)          p = list.gl_pathv[i]
> >  #define    GLOB_LIST_DONE(list)            globfree(&list)
> > +#endif

Reply via email to