Re: [PATCH] Add timeout utility

2008-04-03 Thread Pádraig Brady
take 2 attached.
Note I kept the time interval parsing function
separate between `kill` and `timeout`, as they
operate on different types.

Pádraig.
>From 95c61d20933a749482c3d1d54eb3b1032735ab75 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?= <[EMAIL PROTECTED]>
Date: Fri, 28 Mar 2008 11:05:55 +
Subject: [PATCH] Add new program: timeout

* AUTHORS: Register as the author
* NEWS: Mention this change
* README: Add timeout command to list
* src/truncate.c: New command
* src/operand2sig.c: Split out function called by kill and timeout
* src/operand2sig.h: New operand2sig() function prototype
* src/Makefile.am: Add timeout command to list to build
* doc/coreutils.texi (timeout invocation): Add timeout info
* man/Makefile.am: Add timeout man page to list to build
* man/truncate.x: Add timeout man page template
* po/POTFILES.in: Add timeout to list to translate
* tests/misc/Makefile.am: Add timeout tests
* tests/misc/help-version: Add support for new timeout command
* tests/misc/timeout: check basic timeout operation
* tests/misc/timeout-parameters: check invalid parameter combinations

Signed-off-by: Pádraig Brady <[EMAIL PROTECTED]>
---
 AUTHORS   |1 +
 NEWS  |4 +
 README|4 +-
 doc/coreutils.texi|  242 +++---
 man/Makefile.am   |1 +
 man/timeout.x |6 +
 po/POTFILES.in|1 +
 src/Makefile.am   |5 +-
 src/kill.c|   47 +--
 src/operand2sig.c |   84 ++
 src/operand2sig.h |   19 +++
 src/timeout.c |  335 +
 tests/misc/Makefile.am|2 +
 tests/misc/help-version   |2 +
 tests/misc/timeout|   44 ++
 tests/misc/timeout-parameters |   55 +++
 16 files changed, 718 insertions(+), 134 deletions(-)
 create mode 100644 man/timeout.x
 create mode 100644 src/operand2sig.c
 create mode 100644 src/operand2sig.h
 create mode 100644 src/timeout.c
 create mode 100755 tests/misc/timeout
 create mode 100755 tests/misc/timeout-parameters

diff --git a/AUTHORS b/AUTHORS
index 807857f..87553fd 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -84,6 +84,7 @@ tac: Jay Lepreau, David MacKenzie
 tail: Paul Rubin, David MacKenzie, Ian Lance Taylor, Jim Meyering
 tee: Mike Parker, Richard M. Stallman, David MacKenzie
 test: Kevin Braunsdorf, Matthew Bradburn
+timeout: Padraig Brady
 touch: Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, Randy Smith
 tr: Jim Meyering
 true: Jim Meyering
diff --git a/NEWS b/NEWS
index 5250ed8..a326991 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ GNU coreutils NEWS-*- outline -*-
 
 * Noteworthy changes in release 6.?? (2008-??-??) [stable]
 
+** New programs
+
+  timeout: Run a command with bounded time.
+
 ** Bug fixes
 
   configure --enable-no-install-program=groups now works.
diff --git a/README b/README
index 7a608f4..6159dfd 100644
--- a/README
+++ b/README
@@ -13,8 +13,8 @@ The programs that can be built with this package are:
   link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
   od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
   runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf
-  sleep sort split stat stty su sum sync tac tail tee test touch tr true
-  tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes
+  sleep sort split stat stty su sum sync tac tail tee test timeout touch tr
+  true tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes
 
 See the file NEWS for a list of major changes in the current release.
 
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index f161c4d..61d0af1 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -111,6 +111,7 @@
 * tail: (coreutils)tail invocation. Output the last part of files.
 * tee: (coreutils)tee invocation.   Redirect to multiple files.
 * test: (coreutils)test invocation. File/string tests.
+* timeout: (coreutils)touch invocation. Run with time limit.
 * touch: (coreutils)touch invocation.   Change file timestamps.
 * tr: (coreutils)tr invocation. Translate characters.
 * true: (coreutils)true invocation. Do nothing, successfully.
@@ -190,7 +191,7 @@ Free Documentation License''.
 * Working context::pwd stty printenv tty
 * User information::   id logname whoami groups users who
 * System context:: date uname hostname hostid
-* Modified command invocation::chroot env nice nohup su
+* Modified command invocation::chroot env nice nohup su timeout
 * Process control::kill
 * Delaying::   sleep
 * Numeric operations:: factor seq
@@ -208,6 +209,7 @@ Common 

Re: cp -u vs. vfat's TWO seconds

2008-04-03 Thread Eric Blake
  jidanni.org> writes:

> JM> Don't blame Linux 
> JM> This is due to the FAT specification.
> Different filesystems have different time granularities. Why draw an
> artificial line above one second just because it is unfamiliar?

FAT is not a POSIX-compliant file system.  POSIX requires file systems to have 
a granularity of 1 second or less.  If anything, the conspiricy to wear out USB 
memory sticks faster is due to a rather poor industry decision to use such a 
stupid file system as the default.

That said, a lot of the problem is that most existing OS's don't provide easy 
access to what the underlying granularity of the current file system is.  The 
next version of POSIX is adding fpathconf(n,_PC_TIMESTAMP_RESOLUTION) to solve 
this problem, but it is not widely implemented yet.  If excess wear on your non-
compliant file system really bothers you that much, then consider submitting a 
patch that provides a replacement fpathconf for systems that don't yet 
implement _PC_TIMESTAMP_RESOLUTION, and which then teaches cp to use fpathconf 
to get the truncation right even with your 2-second resolution file system.

-- 
Eric Blake




___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


[PATCH] add new sort option --xargs (-x)

2008-04-03 Thread Bo Borgerson
Hi,

The number of inputs that can be handled by the sort utility is
currently limited by what may be passed in argv.

Due to the nature of sort, this limit can't be stepped around with
`xargs' as it could be with some other utilities.

My solution to this locally has been to add an option to the sort
utility, --xargs, which causes sort to treat STDIN as a source of
newline-separated arguments that supplement those on the command-line
(please see attached patch).

Consider the following example with an input directory containing
16384 input files each consisting of a single line with a single
character, one of 'a', 'b' or 'c':

$ src/sort -mu input/*
bash: src/sort: Argument list too long

$ find input/ -type f | xargs src/sort -mu
a
b
c
a
b
c

$ find input/ -type f | src/sort -mu --xargs
a
b
c

Is this an option that might be worth including in a future release?

Thanks,

Bo
From 8568528acd4b5eea20d06136aaaf7b18a36f03c0 Mon Sep 17 00:00:00 2001
From: Bo Borgerson <[EMAIL PROTECTED]>
Date: Thu, 3 Apr 2008 12:05:55 -0400
Subject: [PATCH] add new sort option --xargs (-x)

* src/sort.c: if --xargs option, add input to FILES
* tests/misc/sort-xargs: test new option
* tests/misc/Makefile.am: add new test file
* doc/coreutils.texi: describe new option
* NEWS: advertise new option

Signed-off-by: Bo Borgerson <[EMAIL PROTECTED]>
---
 NEWS   |4 +++
 doc/coreutils.texi |9 
 src/sort.c |   43 ++
 tests/misc/Makefile.am |1 +
 tests/misc/sort-xargs  |   49 
 5 files changed, 106 insertions(+), 0 deletions(-)
 create mode 100755 tests/misc/sort-xargs

diff --git a/NEWS b/NEWS
index e208b30..36d67f6 100644
--- a/NEWS
+++ b/NEWS
@@ -55,6 +55,10 @@ GNU coreutils NEWS-*- outline -*-
   options --general-numeric-sort/-g, --month-sort/-M, --numeric-sort/-n
   and --random-sort/-R, resp.
 
+  sort accepts a new option, --xargs (-x), that causes input to be treated
+  as a newline-separated list of files to supplement those passed on the
+  command-line.
+
 ** Improvements
 
   id and groups work around an AFS-related bug whereby those programs
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index ee7dbb2..eb3d41e 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -3803,6 +3803,15 @@ For example, @code{sort -n -u} inspects only the value of the initial
 numeric string when checking for uniqueness, whereas @code{sort -n |
 uniq} inspects the entire line.  @xref{uniq invocation}.
 
[EMAIL PROTECTED] -x
[EMAIL PROTECTED] --xargs
[EMAIL PROTECTED] -x
[EMAIL PROTECTED] --xargs
[EMAIL PROTECTED] xargs standard input arguments
+Treat the input as a set of newline-separated arguments to supplement
+those on command-line. Useful if the list of input files to sort exceeds
+the command-line argument list size limit.
+
 @item -z
 @itemx --zero-terminated
 @opindex -z
diff --git a/src/sort.c b/src/sort.c
index 8b2eec5..183f56c 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -121,6 +121,9 @@ static bool hard_LC_COLLATE;
 static bool hard_LC_TIME;
 #endif
 
+/* If true, treat STDIN as a source of files */
+static bool xargs = false;
+
 #define NONZERO(x) ((x) != 0)
 
 /* The kind of blanks for '-b' to skip in various options. */
@@ -222,6 +225,10 @@ static struct month monthtab[] =
   {"SEP", 9}
 };
 
+/* The maximum number of input files allowed for in an invocation
+   FIXME: This should be set more intelligently */
+#define NFILES_MAX 1048576
+
 /* During the merge phase, the number of files to merge at once. */
 #define NMERGE 16
 
@@ -358,6 +365,9 @@ Other options:\n\
   without -c, output only the first of an equal run\n\
 "), DEFAULT_TMPDIR);
   fputs (_("\
+  -x, --xargs   treat STDIN as a source of newline-separated\n\
+arguments to supplement arguments on the\n\
+command-line\n\
   -z, --zero-terminated end lines with 0 byte, not newline\n\
 "), stdout);
   fputs (HELP_OPTION_DESCRIPTION, stdout);
@@ -423,6 +433,7 @@ static struct option const long_options[] =
   {"field-separator", required_argument, NULL, 't'},
   {"temporary-directory", required_argument, NULL, 'T'},
   {"unique", no_argument, NULL, 'u'},
+  {"xargs", no_argument, NULL, 'x'},
   {"zero-terminated", no_argument, NULL, 'z'},
   {GETOPT_HELP_OPTION_DECL},
   {GETOPT_VERSION_OPTION_DECL},
@@ -3086,6 +3097,10 @@ main (int argc, char **argv)
 	}
 	  break;
 
+	case 'x':
+	  xargs = true;
+	  break;
+
 	case 'z':
 	  eolchar = 0;
 	  break;
@@ -3099,6 +3114,34 @@ main (int argc, char **argv)
 	}
 }
 
+  if (xargs)
+{
+  size_t xargc = argc;
+  char input_line[LINE_MAX];
+  int i, length;
+
+  while (fgets (input_line, LINE_MAX, stdin))
+	{
+
+	  if (nfiles >= NFILES_MAX)
+	error (SORT_FAILURE, 0, _("Too many input files"));
+
+	  if (nfiles >= xargc

Re: [PATCH] add new sort option --xargs (-x)

2008-04-03 Thread Jim Meyering
"Bo Borgerson" <[EMAIL PROTECTED]> wrote:
> The number of inputs that can be handled by the sort utility is
> currently limited by what may be passed in argv.
>
> Due to the nature of sort, this limit can't be stepped around with
> `xargs' as it could be with some other utilities.
>
> My solution to this locally has been to add an option to the sort
> utility, --xargs, which causes sort to treat STDIN as a source of
> newline-separated arguments that supplement those on the command-line
> (please see attached patch).

I suppose you have a real application where this is useful?
If so, please describe it -- motivation/justification helps ;-)

> Is this an option that might be worth including in a future release?

I think so.  du and wc each have the --files0-from=F option, added for
the same reason.  Any such option in sort should have the same name and
be implemented in the same way.

[haven't forgotten about --nmerge.  will get to it eventually ]


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


FYI, two changes for your timeout2 patch

2008-04-03 Thread Jim Meyering
Each was prompted by "make syntax-check" failure.
Tsk, tsk ;-)

>From 622746ce8235577c4547d89d503e2b2dcd6c6fff Mon Sep 17 00:00:00 2001
From: Jim Meyering <[EMAIL PROTECTED]>
Date: Thu, 3 Apr 2008 18:27:57 +0200
Subject: [PATCH] * po/POTFILES.in: Add src/operand2sig.c.


Signed-off-by: Jim Meyering <[EMAIL PROTECTED]>
---
 maint.mk   |2 +-
 po/POTFILES.in |1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/maint.mk b/maint.mk
index 6933a3c..f8ee6b5 100644
--- a/maint.mk
+++ b/maint.mk
@@ -31,7 +31,7 @@ GIT = git
 VC = $(GIT)
 VC-tag = git tag -s -m '$(VERSION)'

-VC_LIST = build-aux/vc-list-files
+VC_LIST = $(srcdir)/build-aux/vc-list-files -C $(srcdir)

 VC_LIST_EXCEPT = \
   $(VC_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; 
fi
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ddbeb4b..20f0919 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -83,6 +83,7 @@ src/nice.c
 src/nl.c
 src/nohup.c
 src/od.c
+src/operand2sig.c
 src/paste.c
 src/pathchk.c
 src/pinky.c
--
1.5.5.rc2.26.g7bba


>From 358c511a2c40e54d87da78ec76b5946c1ac7e309 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[EMAIL PROTECTED]>
Date: Thu, 3 Apr 2008 18:30:07 +0200
Subject: [PATCH] Avoid "make sc_tight_scope" failure.

* src/operand2sig.h (operand2sig): Mark as extern.

Signed-off-by: Jim Meyering <[EMAIL PROTECTED]>
---
 src/operand2sig.h |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/operand2sig.h b/src/operand2sig.h
index d3f9b10..165e6cb 100644
--- a/src/operand2sig.h
+++ b/src/operand2sig.h
@@ -15,5 +15,4 @@
You should have received a copy of the GNU General Public License
along with this program.  If not, see .  */

-int
-operand2sig (char const *operand, char *signame);
+extern int operand2sig (char const *operand, char *signame);
--
1.5.5.rc2.26.g7bba


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: [PATCH] add new sort option --xargs (-x)

2008-04-03 Thread Bo Borgerson
On Thu, Apr 3, 2008 at 12:18 PM, Jim Meyering <[EMAIL PROTECTED]> wrote:
>  I suppose you have a real application where this is useful?
>  If so, please describe it -- motivation/justification helps ;-)
>

Just a merge with a lot of source files.  It's the same motivation as
the nmerge patch.  I've actually got another patch as well that I'll
clean up and offer soon that allows a merge of > nmerge files to be
divided among sub-processes whose output is then merged by the parent,
which provides a performance benefit (if you've got the resources for
it).  I've got yet another patch that adds an option to open
compressed files through a decompression program, so I don't have to
set up fifos for a merge of gzipped files.

I've been maintaining these patches against sort for a while,
re-patching whenever a new release is published.  I figured it would
be worth a shot seeing if I could get any them incorporated into the
package upstream. :)

I'm also just generally interested in helping out with maintenance.  I
think I'm probably less experienced than most of the regular
contributors but I can help with simple stuff and when it comes to
coding I think doing is the best way of learning.

>  I think so.  du and wc each have the --files0-from=F option, added for
>  the same reason.  Any such option in sort should have the same name and
>  be implemented in the same way.

That seems reasonable enough.  Looks like readtokens0 does most of the
work for me. :)

How would you feel about also including a --filesn-from=F option to
support pipelines like the one in my example where the input is
newline separated?

>  [haven't forgotten about --nmerge.  will get to it eventually ]

Thanks. :)

Bo


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: [PATCH] add new sort option --xargs (-x)

2008-04-03 Thread Jim Meyering
"Bo Borgerson" <[EMAIL PROTECTED]> wrote:
>>  I think so.  du and wc each have the --files0-from=F option, added for
>>  the same reason.  Any such option in sort should have the same name and
>>  be implemented in the same way.
>
> That seems reasonable enough.  Looks like readtokens0 does most of the
> work for me. :)
>
> How would you feel about also including a --filesn-from=F option to
> support pipelines like the one in my example where the input is
> newline separated?

I'd rather not.  Instead, just pipe your list through tr '\n' '\0' first.
We had the same discussion back when I added --files0-from=F to du and wc.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: [PATCH] add new sort option --xargs (-x)

2008-04-03 Thread Jim Meyering
"Bo Borgerson" <[EMAIL PROTECTED]> wrote:
> On Thu, Apr 3, 2008 at 12:18 PM, Jim Meyering <[EMAIL PROTECTED]> wrote:
>>  I suppose you have a real application where this is useful?
>>  If so, please describe it -- motivation/justification helps ;-)
>
> Just a merge with a lot of source files.  It's the same motivation as
> the nmerge patch.  I've actually got another patch as well that I'll
> clean up and offer soon that allows a merge of > nmerge files to be
> divided among sub-processes whose output is then merged by the parent,
> which provides a performance benefit (if you've got the resources for
> it).  I've got yet another patch that adds an option to open
> compressed files through a decompression program, so I don't have to
> set up fifos for a merge of gzipped files.

Sounds interesting.
I suppose it can work with an arbitrary decompressor?

Note this relatively new option:

  --compress-program=PROG  compress temporaries with PROG;
  decompress them with PROG -d


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: [PATCH] add new sort option --xargs (-x)

2008-04-03 Thread Bo Borgerson
On Thu, Apr 3, 2008 at 2:05 PM, Jim Meyering <[EMAIL PROTECTED]> wrote:
 >  Sounds interesting.
 >  I suppose it can work with an arbitrary decompressor?
 >
 >  Note this relatively new option:
 >
 >   --compress-program=PROG  compress temporaries with PROG;
 >   decompress them with PROG -d
 >

 Yep.

 My current convention is:

  --magic-open=PROG[,PROG]...

 So if you want to merge a gzip'd file with a bzip2'd file you can use
 --magic-open=gzip,bzip2 (or just --magic-open, which enables all).

 For each regular file it checks magic and if it looks like a type that
 can be handled by one of PROG it opens a PROG -d -c -f (the -f is just
 in case the magic was a false-positive).

 Of course this re-introduces findprog into sort (for find_in_path),
 which may not be desirable.  A convention more similar to that used
 for --compress-program would eliminate this (and the magic-checking),
 but limit a given merge to files compressed with a single program.

 Bo


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: [PATCH] add new sort option --xargs (-x)

2008-04-03 Thread Bo Borgerson
Okay, here's a version that supports argument input in --files0-from=F style.

Bo
From 3108b79cbbb5d6c2fe3c2f8d5037f166cb0f1ca6 Mon Sep 17 00:00:00 2001
From: Bo Borgerson <[EMAIL PROTECTED]>
Date: Thu, 3 Apr 2008 18:42:57 -0400
Subject: [PATCH] Add new sort option --files0-from=F

src/sort.c: support new option
tests/misc/sort-files0-from: test new option
tests/misc/Makefile.am: indicate new test
docs/coreutils.texti: explain new option
NEWS: advertise new option

Signed-off-by: Bo Borgerson <[EMAIL PROTECTED]>
---
 NEWS|5 ++
 doc/coreutils.texi  |   16 +++
 src/sort.c  |   58 +++-
 tests/misc/Makefile.am  |1 +
 tests/misc/sort-files0-from |  105 +++
 5 files changed, 183 insertions(+), 2 deletions(-)
 create mode 100755 tests/misc/sort-files0-from

diff --git a/NEWS b/NEWS
index e208b30..492c4e9 100644
--- a/NEWS
+++ b/NEWS
@@ -55,6 +55,11 @@ GNU coreutils NEWS-*- outline -*-
   options --general-numeric-sort/-g, --month-sort/-M, --numeric-sort/-n
   and --random-sort/-R, resp.
 
+  sort accepts a new option, --files0-from=F, that specifies a file
+  containing a null-separated list of files to sort.  This list is used
+  instead of filenames passed on the command-line to avoid problems with
+  maximum command-line (argv) length.
+
 ** Improvements
 
   id and groups work around an AFS-related bug whereby those programs
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index ee7dbb2..5415394 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -3667,6 +3667,22 @@ Terminate with an error if @var{prog} exits with nonzero status.
 Whitespace and the backslash character should not appear in
 @var{prog}; they are reserved for future use.
 
[EMAIL PROTECTED] [EMAIL PROTECTED]
[EMAIL PROTECTED] [EMAIL PROTECTED]
[EMAIL PROTECTED] including files from @command{du}
+Rather than processing files named on the command line, process those
+named in file @var{FILE}; each name is terminated by a null byte.
+This is useful when the list of file names is so long that it may exceed
+a command line length limitation.
+In such cases, running @command{sort} via @command{xargs} is undesirable
+because it splits the list into pieces and gives each piece to a different
+instance of @command{sort}, with the resulting output being multiple sets
+of sorted data concatenated together.
+One way to produce a list of null-byte-terminated file names is with @sc{gnu}
[EMAIL PROTECTED], using its @option{-print0} predicate.
+
+Do not specify any @var{FILE} on the command line when using this option.
+
 @item -k @var{pos1}[,@var{pos2}]
 @itemx [EMAIL PROTECTED],@var{pos2}]
 @opindex -k
diff --git a/src/sort.c b/src/sort.c
index 8b2eec5..8342399 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -37,6 +37,7 @@
 #include "posixver.h"
 #include "quote.h"
 #include "randread.h"
+#include "readtokens0.h"
 #include "stdio--.h"
 #include "stdlib--.h"
 #include "strnumcmp.h"
@@ -304,8 +305,9 @@ usage (int status)
 {
   printf (_("\
 Usage: %s [OPTION]... [FILE]...\n\
+  or:  %s [OPTION]... --files0-from=F\n\
 "),
-	  program_name);
+	  program_name, program_name);
   fputs (_("\
 Write sorted concatenation of all FILE(s) to standard output.\n\
 \n\
@@ -342,6 +344,9 @@ Other options:\n\
   -C, --check=quiet, --check=silent  like -c, but do not report first bad line\n\
   --compress-program=PROG  compress temporaries with PROG;\n\
   decompress them with PROG -d\n\
+  --files0-from=Fread input from the files specified by\n\
+   NUL-terminated names in file F\n\
+  -L, --max-line-length  print the length of the longest line\n\
   -k, --key=POS1[,POS2] start a key at POS1, end it at POS2 (origin 1)\n\
   -m, --merge   merge already sorted files; do not sort\n\
 "), stdout);
@@ -395,7 +400,8 @@ enum
   CHECK_OPTION = CHAR_MAX + 1,
   COMPRESS_PROGRAM_OPTION,
   RANDOM_SOURCE_OPTION,
-  SORT_OPTION
+  SORT_OPTION,
+  FILES0_FROM_OPTION
 };
 
 static char const short_options[] = "-bcCdfgik:mMno:rRsS:t:T:uy:z";
@@ -407,6 +413,7 @@ static struct option const long_options[] =
   {"compress-program", required_argument, NULL, COMPRESS_PROGRAM_OPTION},
   {"dictionary-order", no_argument, NULL, 'd'},
   {"ignore-case", no_argument, NULL, 'f'},
+  {"files0-from", required_argument, NULL, FILES0_FROM_OPTION},
   {"general-numeric-sort", no_argument, NULL, 'g'},
   {"ignore-nonprinting", no_argument, NULL, 'i'},
   {"key", required_argument, NULL, 'k'},
@@ -2752,6 +2759,8 @@ main (int argc, char **argv)
   bool posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL);
   bool obsolete_usage = (posix2_version () < 200112);
   char **files;
+  char *files_from = NULL;
+  struct Tokens tok;
   char const *outfile = NULL;
 
   initialize_main (&argc, &argv);
@@ -2955,6 +2964,10 @@ main (int argc, char **argv)

problem with join command

2008-04-03 Thread kevin

I want to use join command with this 2 files :
test1:
1 a
2 a
3 a
45 a
78 a
152 a
1896 a

test2:
1 a
2 a
3 a
152 a
1896 a

When i do : join test1 test2
the result is :
1 a
2 a
3 a

and not :
1 a
2 a
3 a
152 a
1896 a

Thanks for your help

Kevin



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


problem with join command

2008-04-03 Thread kevin

I forget to give you the version of coreutils :
5.97-5.3ubuntu3

Thanks for your help



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: problem with join command

2008-04-03 Thread Bob Proulx
kevin wrote:
> I want to use join command with this 2 files :

> test1:
> 1 a
> 2 a
> 3 a
> 45 a
> 78 a
> 152 a
> 1896 a

The input files to join must be sorted.  The above is not.

Please see this reference for more information.

  
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#join-requires-sorted-input-files

Bob


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils