pax_global_header00006660000000000000000000000064141206413350014511gustar00rootroot0000000000000052 comment=f0642d6331e89ca5a6ced8c0f1744428983e1780 moreutils-0.66/000077500000000000000000000000001412064133500134675ustar00rootroot00000000000000moreutils-0.66/.gitattributes000066400000000000000000000000541412064133500163610ustar00rootroot00000000000000debian/changelog merge=dpkg-mergechangelogs moreutils-0.66/COPYING000066400000000000000000000431051412064133500145250ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. moreutils-0.66/Makefile000066400000000000000000000027601412064133500151340ustar00rootroot00000000000000BINS=isutf8 ifdata ifne pee sponge mispipe lckdo parallel errno PERLSCRIPTS=vidir vipe ts combine zrun chronic MANS=sponge.1 vidir.1 vipe.1 isutf8.1 ts.1 combine.1 ifdata.1 ifne.1 pee.1 zrun.1 chronic.1 mispipe.1 lckdo.1 parallel.1 errno.1 CFLAGS?=-O2 -g -Wall INSTALL_BIN?=install -s PREFIX?=/usr ifneq (,$(findstring CYGWIN,$(shell uname))) DOCBOOKXSL?=/usr/share/sgml/docbook/xsl-stylesheets else DOCBOOKXSL?=/usr/share/xml/docbook/stylesheet/docbook-xsl endif DOCBOOK2XMAN=xsltproc --param man.authors.section.enabled 0 $(DOCBOOKXSL)/manpages/docbook.xsl all: $(BINS) $(MANS) clean: rm -f $(BINS) $(MANS) dump.c errnos.h errno.o \ is_utf8/*.o is_utf8/isutf8 isutf8: is_utf8/*.c is_utf8/*.h $(MAKE) -C is_utf8/ cp is_utf8/isutf8 . install: mkdir -p $(DESTDIR)$(PREFIX)/bin $(INSTALL_BIN) $(BINS) $(DESTDIR)$(PREFIX)/bin install $(PERLSCRIPTS) $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1 install $(MANS) $(DESTDIR)$(PREFIX)/share/man/man1 uninstall: for i in $(BINS) $(PERLSCRIPTS); do rm -f $(DESTDIR)$(PREFIX)/bin/$$i; done for i in $(MANS); do rm -f $(DESTDIR)$(PREFIX)/share/man/man1/$$i; done check: isutf8 ./is_utf8/test.sh %.1: %.docbook xmllint --noout --valid $< $(DOCBOOK2XMAN) $< errno.o: errnos.h errnos.h: echo '#include ' > dump.c $(CC) -E -dD dump.c | awk '/^#define E/ { printf "{\"%s\",%s},\n", $$2, $$2 }' > errnos.h rm -f dump.c errno.1: errno.docbook $(DOCBOOK2XMAN) $< %.1: % pod2man --center=" " --release="moreutils" $< > $@; moreutils-0.66/README000066400000000000000000000022351412064133500143510ustar00rootroot00000000000000This is a collection of the unix tools that nobody thought to write long ago, when unix was young. Currently it consists of these tools: chronic: runs a command quietly unless it fails combine: combine the lines in two files using boolean operations errno: look up errno names and descriptions ifdata: get network interface info without parsing ifconfig output isutf8: check if a file or standard input is utf-8 ifne: run a command if the standard input is not empty lckdo: execute a program with a lock held (deprecated) mispipe: pipe two commands, returning the exit status of the first parallel: run multiple jobs at once pee: tee standard input to pipes sponge: soak up standard input and write to a file ts: timestamp standard input vidir: edit a directory in your text editor vipe: insert a text editor into a pipe zrun: automatically uncompress arguments to command Its web page is here: http://joeyh.name/code/moreutils/ Your suggestions of additional tools to add to this collection are appreciated. The web page lists some that are under consideration but have not yet been included, I also welcome feedback on which of these to include. -- Joey Hess moreutils-0.66/chronic000077500000000000000000000042041412064133500150420ustar00rootroot00000000000000#!/usr/bin/perl =head1 NAME chronic - runs a command quietly unless it fails =head1 SYNOPSIS chronic [-ev] COMMAND... =head1 DESCRIPTION chronic runs a command, and arranges for its standard out and standard error to only be displayed if the command fails (exits nonzero or crashes). If the command succeeds, any extraneous output will be hidden. A common use for chronic is for running a cron job. Rather than trying to keep the command quiet, and having to deal with mails containing accidental output when it succeeds, and not verbose enough output when it fails, you can just run it verbosely always, and use chronic to hide the successful output. 0 1 * * * chronic backup # instead of backup >/dev/null 2>&1 */20 * * * * chronic -ve my_script # verbose for debugging =head1 OPTIONS =over 4 =item -v Verbose output (distinguishes between STDOUT and STDERR, also reports RETVAL) =item -e Stderr triggering. Triggers output when stderr output length is non-zero. Without -e chronic needs non-zero return value to trigger output. In this mode, chronic's return value will be C<2> if the command's return value is C<0> but the command printed to stderr. =back =head1 AUTHOR Copyright 2010 by Joey Hess Original concept and "chronic" name by Chuck Houpt. Code for verbose and stderr trigger by Tomas 'Harvie' Mudrunka 2016. Licensed under the GNU GPL version 2 or higher. =cut use warnings; use strict; use IPC::Run qw( start pump finish timeout ); use Getopt::Std; our $opt_e = 0; our $opt_v = 0; getopts('ev'); # only looks at options before the COMMAND if (! @ARGV) { die "usage: chronic COMMAND...\n"; } my ($out, $err); my $h = IPC::Run::start \@ARGV, \*STDIN, \$out, \$err; $h->finish; my $ret=$h->full_result; if ($ret >> 8) { # child failed showout(); exit ($ret >> 8); } elsif ($ret != 0) { # child killed by signal showout(); exit 1; } elsif ($opt_e && (length($err) > 0)) { showout(); exit 2; } else { exit 0; } sub showout { print "STDOUT:\n" if $opt_v; print STDOUT $out; print "\nSTDERR:\n" if $opt_v; STDOUT->flush(); print STDERR $err; STDERR->flush(); print "\nRETVAL: ".($ret >> 8)."\n" if $opt_v; } moreutils-0.66/combine000077500000000000000000000057471412064133500150460ustar00rootroot00000000000000#!/usr/bin/perl =head1 NAME combine - combine sets of lines from two files using boolean operations =head1 SYNOPSIS combine file1 and file2 combine file1 not file2 combine file1 or file2 combine file1 xor file2 _ file1 and file2 _ _ file1 not file2 _ _ file1 or file2 _ _ file1 xor file2 _ =head1 DESCRIPTION B combines the lines in two files. Depending on the boolean operation specified, the contents will be combined in different ways: =over 4 =item and Outputs lines that are in file1 if they are also present in file2. =item not Outputs lines that are in file1 but not in file2. =item or Outputs lines that are in file1 or file2. =item xor Outputs lines that are in either file1 or file2, but not in both files. =back "-" can be specified for either file to read stdin for that file. The input files need not be sorted, and the lines are output in the order they occur in file1 (followed by the order they occur in file2 for the two "or" operations). Bear in mind that this means that the operations are not commutative; "a and b" will not necessarily be the same as "b and a". To obtain commutative behavior sort and uniq the result. Note that this program can be installed as "_" to allow for the syntactic sugar shown in the latter half of the synopsis (similar to the test/[ command). It is not currently installed as "_" by default, but you can alias it to that if you like. =head1 SEE ALSO join(1) =head1 AUTHOR Copyright 2006 by Joey Hess Licensed under the GNU GPL. =cut use warnings; use strict; sub filemap { my $file=shift; my $sub=shift; open (IN, $file) || die "$file: $!\n"; while () { chomp; $sub->(); } close IN; } sub hashify { my $file=shift; my %seen; filemap $file, sub { $seen{$_}++ }; return \%seen; } sub compare_or { my ($file1, $file2) = @_; filemap $file1, sub { print "$_\n" }; filemap $file2, sub { print "$_\n" }; } sub compare_xor { my ($file1, $file2) = @_; my (@lines2, %seen2); filemap $file2, sub { push @lines2, $_; $seen2{$_} = 1; }; # Print all lines in file1 that are not in file2, # and mark lines that are in both files by setting # their value in %seen2 to 0. filemap $file1, sub { if (exists $seen2{$_}) { $seen2{$_} = 0; } else { print "$_\n"; } }; # Print all lines that are in file2 but not in file1. # The value of these lines in seen2 is set to 1. foreach (@lines2) { print "$_\n" if $seen2{$_}; } } sub compare_not { my ($file1, $file2) = @_; my $seen=hashify($file2); filemap $file1, sub { print "$_\n" unless $seen->{$_} }; } sub compare_and { my ($file1, $file2) = @_; my $seen=hashify($file2); filemap $file1, sub { print "$_\n" if $seen->{$_} }; } if (@ARGV >= 4 && $ARGV[3] eq "_") { delete $ARGV[3]; } if (@ARGV != 3) { die "Usage: combine file1 OP file2\n"; } my $file1=shift; my $op=lc shift; my $file2=shift; if ($::{"compare_$op"}) { no strict 'refs'; "compare_$op"->($file1, $file2); } else { die "unknown operation, $op\n"; } moreutils-0.66/debian/000077500000000000000000000000001412064133500147115ustar00rootroot00000000000000moreutils-0.66/debian/changelog000066400000000000000000000536211412064133500165720ustar00rootroot00000000000000moreutils (0.66) unstable; urgency=medium * vipe: When no output is piped into vipe, and stdin is connected to the terminal, don't read from stdin before opening the editor. This allows eg: vipe | command Thanks, Florian Pensec * chronic: With -v, flush stdout after printing "STDERR" header. Thanks, Adam Sjøgren -- Joey Hess Thu, 16 Sep 2021 09:12:42 -0400 moreutils (0.65) unstable; urgency=medium * vipe: Added --suffix option. Thanks, Pål Grønås Drange. * ifdata: fail when -ph is given but no hwaddr is available (Closes: #386755) Thanks, Nicolas Schier -- Joey Hess Sat, 02 Jan 2021 12:24:51 -0400 moreutils (0.64) unstable; urgency=medium * parallel: fix typo in usage message. * Makefile: Propagate compiler and linker flags when building is_utf8. * ts: Fix parsing of ISO-8601 dates. Thanks, David Laban. * parallel: Allow compiling with uClibc-ng, which does not have getloadavg. Thanks, Rosen Penev -- Joey Hess Thu, 20 Aug 2020 13:05:19 -0400 moreutils (0.63) unstable; urgency=medium * vipe: Clean up temp file even when it exits with an error. Thanks, Stig Palmquist. * ts: Fix ts -m %.s to not output negative microseconds. Thanks, Dima Kogan * sponge: Fix bug in -a mode that doubled original content of file when the temp file is located on a different filesystem. -- Joey Hess Wed, 09 Jan 2019 11:14:01 -0400 moreutils (0.62) unstable; urgency=medium * ts: Add -m option to use monotonic clock. Thanks, Ben Leinweber * ts: Added %.T format like %T but with hi-res. Thanks, Matt Koscica * pee: Ignore SIGPIPE and write errors caused by the command not consuming all its input. Closes: #697052 Thanks, Ole Jørgen Brønner * chronic: document return value semantics of -e option. Closes: #867167 Thanks, Daniel Shahaf * vidir: reword man page to more explicit mention 'file' args. Closes: #885221 Thanks, Daniel Shahaf * pee: Don't buffer input, bringing behavior into line with tee. Thanks, Sauerbeck Tilman -- Joey Hess Sun, 31 Dec 2017 12:02:05 -0400 moreutils (0.61) unstable; urgency=medium * chronic: Flush output more often to better preserve stdout,err ordering. Thanks, Miroslav Šustek -- Joey Hess Wed, 19 Apr 2017 10:23:11 -0400 moreutils (0.60) unstable; urgency=medium * New implementation of isutf8 by Julien Palard. - Noncharacters (ending with 0xFFFF and 0xFFFE) were considered invalid when encoded in utf8, according to the unicode standard they are valid: "However, they are not illegal in interchange, nor does their presence cause Unicode text to be ill-formed." - \xf4\xbf\xbf\xbf was considered valid UTF8, which is not: after 0xF4 the following byte should be between 80 and 8F. - This implementation does not try to decode the stream, so it checks it faster. - Add --list option. Closes: #691330 * Support bullding in Cygwin. Thanks, StalkR * OSX build fix. Thanks, Tony Kelman. -- Joey Hess Fri, 12 Aug 2016 19:15:57 -0400 moreutils (0.59) unstable; urgency=medium * Makefile: add DOCBOOKXSL setting. Thanks, Kevin Bullock * parallel: include signal.h to fix warning when building with clang Thanks, Kevin Bullock * chronic: Added -v option for more verbose output. Thanks, Tomas Mudrunka * chronic: Added -e option to display any stderr. Thanks, Tomas Mudrunka -- Joey Hess Sat, 02 Apr 2016 15:23:08 -0400 moreutils (0.58) unstable; urgency=medium * OpenBSD compile fix. Thanks, Michael Reed. * ts: Quiet perl's complaints about utf-8. Closes: #812143 Thanks, Nicolas Schier. -- Joey Hess Tue, 23 Feb 2016 17:11:52 -0400 moreutils (0.57) unstable; urgency=medium * Avoid using non-portable error() in ifdata, a portability reversion introduced in 0.56. -- Joey Hess Mon, 13 Jul 2015 18:29:06 -0400 moreutils (0.56) unstable; urgency=medium * ifdata: Fix error messages when a non-existent network interface is queried. Closes: #386754 Thanks, Nicolas Schier * errno.docbook: Fix typo. Closes: #749399 * vidir: Create missing target directories. Closes: #728688 Thanks, Nicolas Schier -- Joey Hess Wed, 03 Jun 2015 12:03:50 -0400 moreutils (0.55) unstable; urgency=medium * parallel: serialise output through internal pipe. Closes: #704125 Thanks, Nicolas Schier. * sponge: add append option '-a'. Closes: #623197 Thanks, Nicolas Schier. -- Joey Hess Mon, 19 Jan 2015 13:58:08 -0400 moreutils (0.54) unstable; urgency=medium * vidir: Fix bug in handling filenames that share a common prefix when renaming. Closes: #654326 Thanks, Kushal Kumaran -- Joey Hess Fri, 28 Nov 2014 11:25:32 -0400 moreutils (0.53) unstable; urgency=medium * Orphaned the Debian package. -- Joey Hess Sat, 08 Nov 2014 00:31:54 -0400 moreutils (0.52) unstable; urgency=medium * Fix docbook markup for parallel examples. Closes: #756377 * ts: Add -s option to make timestamp relative to start. Thanks, Adam Juraszek. -- Joey Hess Tue, 09 Sep 2014 14:12:05 -0400 moreutils (0.51) unstable; urgency=low * Fix ifdata to build on OS X. Thanks, Peter Eisentraut Closes: #575294 * use docbook-xsl for building man pages. Thanks, Peter Eisentraut for extensive patch set! Closes: #728831 * Fix ifdata, ifne, parallel to build on illumos. Thanks, Gabriele Giacone Closes: #733736 -- Joey Hess Thu, 27 Feb 2014 12:01:21 -0400 moreutils (0.50) unstable; urgency=low * Fix build on Hurd. Closes: #716653 (Thanks, Pino Toscano) -- Joey Hess Mon, 26 Aug 2013 13:00:24 -0400 moreutils (0.49) unstable; urgency=low * ts: Fix timezone used with -i * errno, isutf8: Fix zero-termination of option list, which could lead to getopt crash. Closes: #715867 (Thanks, Mayhem Team) -- Joey Hess Wed, 10 Jul 2013 16:21:41 -0400 moreutils (0.48) unstable; urgency=low * Allow overriding PREFIX and CFLAGS to make the build more flexible (Thanks, Ben Walton) * Typo. Closes: #697113 * ts: -i enables incremental timestamping. Thanks, Thomas Vander Stichele * ts: Support single-digit day dates. Thanks, Peter Lunicks * sponge: Check fclose to detect certian short reads. Closes: #704453 -- Joey Hess Sat, 04 May 2013 23:50:03 -0400 moreutils (0.47) unstable; urgency=low * errno: New utility that looks up errno numbers or names. -- Joey Hess Mon, 25 Jun 2012 16:31:17 -0400 moreutils (0.46) unstable; urgency=low * Typo. Closes: #649158 * combine: Avoid reading files twice, to support data coming from pipes. Closes: #667960 Thanks, Carsten Hey -- Joey Hess Mon, 09 Apr 2012 16:19:34 -0400 moreutils (0.45) unstable; urgency=low * ts: Support %.s for seconds sinch epoch with subsecond resolution. Closes: #619764 -- Joey Hess Sun, 19 Jun 2011 15:44:28 -0400 moreutils (0.44) unstable; urgency=low * pee: Propigate exit status of commands run. -- Joey Hess Thu, 10 Mar 2011 17:38:14 -0400 moreutils (0.43) unstable; urgency=low * chronic: New command, runs a command quietly, unless it fails. * Now depends on IPC::Run, used by chronic. -- Joey Hess Fri, 29 Oct 2010 15:54:37 -0400 moreutils (0.42) unstable; urgency=low * sponge: Guarantee that output file is always updated atomically, by renaming a temp file into place. Closes: #592144 * sponge: Ensure that output file permissions are always preserved if it already exists. * Typo. Closes: #596032 -- Joey Hess Wed, 06 Oct 2010 20:03:25 -0400 moreutils (0.41) unstable; urgency=low * ifdata.docbook: Mark interface as required in synopsis. Closes: #588397 * Add missing AUTHOR section to docbook man pages. * sponge: Correct bad use of fread that caused a trailing quantity of soaked data to be silently discarded when a temp file was used and sponge output to stdout. Closes: #595220 -- Joey Hess Thu, 02 Sep 2010 16:47:10 -0400 moreutils (0.40) unstable; urgency=low * lckdo: Now deprecated, since util-linux's flock(1) can do the same thing. * parallel: -i will now replace {} inside parameters, before the {} had to be a separate parameter. -- Joey Hess Tue, 06 Jul 2010 19:38:14 -0400 moreutils (0.39) unstable; urgency=low * parallel: Fix exit code handling when commands are specified after -- * parallel: Make -j 0 do something reasonable (start all jobs at once). * parallel: Fix to really avoid running new jobs when load is too high. * parallel: Fix logic error in code handling -l that could make parallel return a bogus 255 exit code when all jobs succeeded. Closes: #569617 * parallel: Allow a decimal load value to be specified with -l * Caps sillyness. Closes: #570815 * zrun: Add support for .xz files. -- Joey Hess Tue, 23 Feb 2010 15:51:26 -0500 moreutils (0.38) unstable; urgency=low * Description improvements. Closes: #549450 (Thanks, Justin B Rye) * parallel: Allow running independent commands, like `parallel -j3 -- ls df "echo hi"` * ifdata: Add FreeBSD kernel support, although some of the more esoteric interface options are not currently supported in FreeBSD. * parallel: Define WEXITED to allow building on FreeBSD kernel. * Thanks Enrico Tassi for the FreeBSD kernel support, which should be enough to get moreutils built on Debian kFreeBSD. Closes: #562609 -- Joey Hess Tue, 09 Feb 2010 15:50:42 -0500 moreutils (0.37) unstable; urgency=low * parallel: Clarify man page regarding CPUs. Closes: #536597 * parallel: Add -n option. Thanks, Pierre Habouzit. Closes: #537992 (As a side effect, fixes a segfault if -- was omitted.) * parallel.1: Typo fixes. Closes: #538147 -- Joey Hess Sat, 25 Jul 2009 10:18:40 +0200 moreutils (0.36) unstable; urgency=low * parallel: New program, contributed by Tollef Fog Heen, that can run multiple jobs in parallel, optionally checking load average. * mispipe: Fix closing of extra pipe FD before starting command so it is not inherited by daemons. Closes: #533448 (Thanks, Jeremie Koenig) -- Joey Hess Fri, 10 Jul 2009 11:01:41 -0400 moreutils (0.35) unstable; urgency=low * ifdata: Don't assume that all interface names are 6 characters or less, for instance "wmaster0" is longer. Increase the limit to 20 characters. Closes: #526654 (Thanks, Alan Pope) * isutf8: Reject UTF-8-encoded UTF-16 surrogates. Closes: #525301 (Thanks, Jakub Wilk and liw) -- Joey Hess Tue, 05 May 2009 15:06:41 -0400 moreutils (0.34) unstable; urgency=low * vipe: Avoid dying on empty input. Thanks, Anders Kaseorg Closes: #508491 -- Joey Hess Thu, 11 Dec 2008 15:11:23 -0500 moreutils (0.33) unstable; urgency=low * Support installing moreutils into prefixes other than /usr (Evan Broder) * Fix zrun breakage introduced last version. Closes: #504129 -- Joey Hess Fri, 31 Oct 2008 17:01:03 -0400 moreutils (0.32) unstable; urgency=low * zrun: Can be linked to zsomeprog to run the equivilant of zrun someprog. Closes: #411623 (Stefan Fritsch) * zrun: Add support for lzma and lzo. (Stefan Fritsch) * Fix pod error in vidir(1). -- Joey Hess Sun, 26 Oct 2008 23:43:30 -0400 moreutils (0.31) unstable; urgency=low * pee.1: Document difference with tee in stdout. * ts: Support displaying fractional seconds via a "%.S" conversion specification. Closes: #482789 -- Joey Hess Sat, 28 Jun 2008 23:19:31 -0400 moreutils (0.30) unstable; urgency=low * debhelper v7; rules file minimisation * Use DESTDIR instead of PREFIX. * Add a DOCBOOK2XMAN setting. (Greg KH) * ifne: Add -n which makes it run the command if stdin is empty. * ifne: If no command is specified, print usage information. -- Joey Hess Wed, 14 May 2008 19:37:42 -0400 moreutils (0.29) unstable; urgency=low * Add ifne, contributed by Javier Merino. * sponge, ifne: Ensure that suspending/resuming doesn't result in partial writes of the data, by using fwrite() rather than write(). * sponge: Handle large data sizes by using a temp file rather than by consuming arbitrary amounts of memory. Patch by Brock Noland. * ts: Allow both -r and a format to be specified, to parse dates and output in a specified format. * ts: Fix bug in timezone regexp. -- Joey Hess Tue, 15 Apr 2008 15:30:52 -0400 moreutils (0.28) unstable; urgency=low * Moved to a git repository. * vidir: Applied patch from Stefan Fritsch (one part of #412176): - Check for control characters (especially newlines) in filenames and error out, since this can greatly confuse the editor or vidir. - If the source of a rename does not exist (and thus the rename will fail anyway), vidir should not move an existing target file to a tmpfile. - If a directory is renamed, vidir should take that into account when renaming files in this directory. - If a directory name is passed as name/ to vidir, vidir should not add second slash after the name. * vidir: Add support for unlinking directories. To recursivly delete a directory and its contents, pipe find to vidir, and delete the directory and its contents in the editor. Closes: #412176 * Add example to man page about recursive modification of directories. Closes: #390099 -- Joey Hess Sat, 02 Feb 2008 17:26:23 -0500 moreutils (0.27) unstable; urgency=low * vidir: Check exit codes of close. Closes: #463739 -- Joey Hess Sat, 02 Feb 2008 16:42:18 -0500 moreutils (0.26) unstable; urgency=low * isutf8: Correct inverted exit code when passed a file to check. Closes: #453306 -- Joey Hess Wed, 28 Nov 2007 14:19:32 -0500 moreutils (0.25) unstable; urgency=low * isutf8: Detect and reject overlong UTF-8 sequences. Closes: #440951 Many thanks to liw for the patch. -- Joey Hess Mon, 12 Nov 2007 11:58:07 -0500 moreutils (0.24) unstable; urgency=low * vidir: Force numbers to normalised integers. * vidir: Abort on unknown item numbers rather than deleting them. Closes: #442440 -- Joey Hess Sun, 16 Sep 2007 13:05:54 -0400 moreutils (0.23) unstable; urgency=low * Add pointer to join from combine's man page. Closes: #435516 * Don't strip binaries for debian package if built with DEB_BUILD_OPTIONS=nostrip. Closes: #437577 * Include Michael Tokarev's lckdo program and replace / conflict with the current lckdo package. (Robert Edmonds) Closes: #432906 * lckdo: Don't clear other flags when setting close on exec. -- Joey Hess Wed, 05 Sep 2007 21:45:25 -0400 moreutils (0.22) unstable; urgency=low * vidir, zrun: Don't put temp files in the current directory. Closes: #429367 -- Joey Hess Mon, 25 Jun 2007 16:11:27 -0400 moreutils (0.21) unstable; urgency=low * Patch from Sergej Pupykin fixing ifdata -pN. -- Joey Hess Mon, 25 Jun 2007 13:07:21 -0400 moreutils (0.20) unstable; urgency=low * Typo fixes from Ralf Wildenhues. * ifdata: Add -bips and -bops options contributed by André Appel, to print the number of bytes of incoming/outgoing traffic per second. -- Joey Hess Sat, 23 Dec 2006 15:55:45 -0500 moreutils (0.19) unstable; urgency=low * vidir: Don't ignore files whose names end in dots. Closes: #398141 Thanks, Bram Sanders. -- Joey Hess Sat, 11 Nov 2006 22:02:17 -0500 moreutils (0.18) unstable; urgency=low * mispipe.docbook: Typo. Closes: #386756 * spongs: Output to stdout if no file is specified, useful in a pipeline such as: cvs diff | sponge | patch -R -p0 Closes: #387501 -- Joey Hess Thu, 14 Sep 2006 15:13:46 -0400 moreutils (0.17) unstable; urgency=low * Add missing \n to sponge usage. Closes: #383944 * Add mispipe, contributed by Nathanael Nerode. Pipes together two commands, returning the exit status of the first. -- Joey Hess Thu, 7 Sep 2006 20:49:16 -0400 moreutils (0.16) unstable; urgency=low * Change the default ts format to include the month and day, for consistency with syslog format. * Add -r switch to ts, which makes it convert existing timestamps in the input into relative times, such as "15m2s ago". Many common date formats are supported. -- Joey Hess Sat, 19 Aug 2006 15:27:42 -0400 moreutils (0.15) unstable; urgency=low * Remove notes about potential tools from README, moved to wiki. * vidir: Don't abort if it sees an empty or all-whitespace line. * vidir: If just a filename is removed and the number is left, treat this the same as removing the whole line, and delete the file, instead of trying to rename the file to "". * vidir: Remove the periods after the item numbers. * vidir: Man page improvements. Closes: #378122 * combine: Man page improvements, to clarify even more that order does matter and that the operations are not commutative. Closes: #361123 * combine: The behavior of "or" was fairly strange if lines were repeated in a file. Changed behavior to just print all lines from both files, even if this means printing dups. Not sure I like this behavior either, but it's consistent with the very useful behaviors of "and" and "not". * vidir, vipe: Use /usr/bin/editor if it's present, and EDITOR and VISUAL arn't set, to comply with Debian policy. For portability, fall back to vi if there's no /usr/bin/editor. Closes: #378623 -- Joey Hess Tue, 25 Jul 2006 22:26:56 -0400 moreutils (0.14) unstable; urgency=low * vidir: Also support EDITOR or VISUAL that contains spaces and parameters. -- Joey Hess Wed, 12 Jul 2006 13:35:49 -0400 moreutils (0.13) unstable; urgency=low * ifdata: typo * vipe: Support EDITOR or VISUAL that contains spaces and parameters. -- Joey Hess Wed, 12 Jul 2006 12:53:44 -0400 moreutils (0.12) unstable; urgency=low * Really fix typo. Closes: #369485 * zrun: Add usage message. * ifdata: Fix bug in argument parsing that could make it segfault. * combine: Allow operators to be written in any case. -- Joey Hess Wed, 28 Jun 2006 14:04:49 -0400 moreutils (0.11) unstable; urgency=low * combine: better synopsis. Closes: #360544 * ifdata: basically rewritten by Adam Lackorzynski, code size is 40% smaller, macros removed, return checks added for all lib calls. Closes: #361728 * vidir: behave properly if passed a directory name to edit. Closes: #369156 * check-isutf8: needs to be a bash script, the way it encodes characters won't work with dash. * check-isutf8: exit nonzero if any tests fail -- Joey Hess Sat, 27 May 2006 19:12:50 -0400 moreutils (0.10) unstable; urgency=low * ifdata: patch from Adam Lackorzynski to translate French error messages to English and to convert some #defines to enums. * ifdata: patch from Adam Lackorzynski to avoid printing info for bogus interface. Closes: #360433 * Add zrun, contributed by Chung-chieh Shan (you might prefer to alias it to "z"). -- Joey Hess Sun, 2 Apr 2006 18:34:01 -0400 moreutils (0.9) unstable; urgency=low * ifdata: robustness patch from Adam Lackorzynski, in particular deal with /proc not mounted. Closes: #358930 * Typo fixes. Closes: #359039, #359040 * pee: don't send a copy of every line sent to every command to stdout. Seems best for it not to output anything to stdout on its on at all. Closes: #359041 -- Joey Hess Mon, 27 Mar 2006 13:45:45 -0500 moreutils (0.8) unstable; urgency=low * Back to Mithandir's C sponge, now fixed. * tss.1, ifdata.1: typo fix. Closes: #358557, #358556 * ifdata: patch from its author to make it behave properly on big endian systems. Closes: #358860 -- Joey Hess Fri, 24 Mar 2006 20:52:21 -0500 moreutils (0.7) unstable; urgency=low * Add pee (pipe tee) contributed by Miek Gieben. * ifdata: Patch from KELEMEN Peter to add support for printing hardware interface. Closes: #357646 -- Joey Hess Sat, 18 Mar 2006 14:17:08 -0500 moreutils (0.6) unstable; urgency=low * Revert to perl sponge since the C one corrupts larger files. Hopefully temporary.. -- Joey Hess Fri, 10 Mar 2006 15:33:43 -0500 moreutils (0.5) unstable; urgency=low * Added ifdata, by Benjamin BAYART (originally called ifcfg). * Made ifdata -Wall clean. * Made ifdata support -h and print usage on unknown options. * Cleaned up ifdata's behavior when asked to print info for nonexistant devices. Still needs improvement. * Indentation improvements. * Replaced and(1) and not(1) by combine, based on an idea by Matt Taggart. -- Joey Hess Tue, 7 Mar 2006 23:02:14 -0500 moreutils (0.4) unstable; urgency=low * Added versions of and(1) and not(1) that support arbitrary numbers of input files. -- Joey Hess Sun, 5 Mar 2006 22:28:13 -0500 moreutils (0.3) unstable; urgency=low * Switch sponge to a C implementation by mithandir. * Added a list of prospective tools that I am considering adding to the README file. -- Joey Hess Fri, 3 Mar 2006 18:09:46 -0500 moreutils (0.2) unstable; urgency=low * Build dep on docbook-xml. -- Joey Hess Sun, 19 Feb 2006 18:40:56 -0500 moreutils (0.1) unstable; urgency=low * First release. -- Joey Hess Sun, 12 Feb 2006 17:11:21 -0500 moreutils-0.66/debian/compat000066400000000000000000000000021412064133500161070ustar00rootroot000000000000009 moreutils-0.66/debian/control000066400000000000000000000027251412064133500163220ustar00rootroot00000000000000Source: moreutils Section: utils Priority: optional Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.9.0), docbook-xml, docbook-xsl, libxml2-utils, xsltproc Maintainer: Nicolas Schier Standards-Version: 3.9.6 Vcs-Git: git://git.joeyh.name/moreutils Homepage: http://joeyh.name/code/moreutils/ Package: moreutils Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, libipc-run-perl Suggests: libtime-duration-perl, libtimedate-perl Conflicts: lckdo Replaces: lckdo Description: additional Unix utilities This is a growing collection of the Unix tools that nobody thought to write long ago, when Unix was young. . So far, it includes the following utilities: - chronic: runs a command quietly unless it fails - combine: combine the lines in two files using boolean operations - errno: look up errno names and descriptions - ifdata: get network interface info without parsing ifconfig output - ifne: run a program if the standard input is not empty - isutf8: check if a file or standard input is utf-8 - lckdo: execute a program with a lock held - mispipe: pipe two commands, returning the exit status of the first - parallel: run multiple jobs at once - pee: tee standard input to pipes - sponge: soak up standard input and write to a file - ts: timestamp standard input - vidir: edit a directory in your text editor - vipe: insert a text editor into a pipe - zrun: automatically uncompress arguments to command moreutils-0.66/debian/copyright000066400000000000000000000072121412064133500166460ustar00rootroot00000000000000Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Source: Contributed by many folks. Files: * Copyright: 2006-2015 Joey Hess License: GPL-2+ Files: is_utf8/* Copyright: 2016 Julien Palard License: BSD-2-Clause Files: sponge.* Copyright: 2006 Tollef Fog Heen License: GPL-2 Files: ifdata.c Copyright: 2002 Benjamin BAYART License: GPL-2+ Files: pee.c Copyright: 2006 Miek Gieben License: GPL-2+ Files: zrun Copyright: 2006 Chung-chieh Shan License: GPL-2+ Files: mispipe.c Copyright: 2004 Nathanael Nerode License: GPL-2+ or Expat Files: lckdo.c lckdo.docbook Copyright: Michael Tokarev License: other Public domain Files: ifne.c ifne.docbook Copyright: 2008 Javier Merino License: GPL-2+ Files: parallel.c Copyright: 2008 Tollef Fog Heen License: GPL-2 Files: errno.c errno.docbook Copyright: 2012 Lars Wirzenius License: GPL-2+ Files: physmem.c Copyright: 2000, 2001, 2003, 2005, 2006 Free Software Foundation, Inc. License: GPL-2+ License: GPL-2 The full text of the GPL is distributed as COPYING in moreutils's source, and is distributed in /usr/share/common-licenses/GPL-2 on Debian systems. License: GPL-2+ The full text of the GPL is distributed as COPYING in moreutils's source, and is distributed in /usr/share/common-licenses/GPL-2 on Debian systems. License: Expat * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. License: BSD-2-clause # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. moreutils-0.66/debian/docs000066400000000000000000000000071412064133500155610ustar00rootroot00000000000000README moreutils-0.66/debian/rules000077500000000000000000000002201412064133500157630ustar00rootroot00000000000000#!/usr/bin/make -f # Prevent the makefile from stripping, in case it's being built in # unstripped mode. export INSTALL_BIN=install %: dh $@ moreutils-0.66/errno.c000066400000000000000000000117561412064133500147720ustar00rootroot00000000000000/* * errno.c -- look up errno names and descriptions * Copyright 2012 Lars Wirzenius (liw@iki.fi) * * 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., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include static struct { const char *name; int code; } errnos[] = { #include "errnos.h" }; static const int num_errnos = sizeof(errnos) / sizeof(errnos[0]); static void report(const char *name, int code) { printf("%s %d %s\n", name, code, strerror(code)); } static bool report_from_name(const char *name) { int i; for (i = 0; i < num_errnos; ++i) { if (strcasecmp(errnos[i].name, name) == 0) { report(errnos[i].name, errnos[i].code); return true; } } return false; } static bool report_from_code(int code) { int i; for (i = 0; i < num_errnos; ++i) { if (errnos[i].code == code) { report(errnos[i].name, code); return true; } } return false; } static bool matches(int code, int num_words, char **words) { const char *text = strerror(code); int i; for (i = 0; i < num_words; ++i) { if (strcasestr(text, words[i]) == NULL) return false; } return true; } static void search(int num_words, char **words) { int i; for (i = 0; i < num_errnos; ++i) { if (matches(errnos[i].code, num_words, words)) report(errnos[i].name, errnos[i].code); } } static void search_all(int num_words, char **words) { FILE *f; /* Static buffers are ugly, but they're simple. If anyone has a locale name longer than a kilobyte, they will suffer, and they will complain, and then I will fix this. */ char line[1024]; f = popen("locale -a", "r"); if (f == NULL) { fprintf(stderr, "ERROR: Can't execute locale -a: %d: %s\n", errno, strerror(errno)); exit(EXIT_FAILURE); } while (fgets(line, sizeof line, f) != NULL) { line[strcspn(line, "\n")] = '\0'; setlocale(LC_ALL, line); search(num_words, words); } fclose(f); } static struct option options[] = { { "help", 0, NULL, 'h' }, { "list", 0, NULL, 'l' }, { "search", 0, NULL, 's' }, { "search-all-locales", 0, NULL, 'S' }, { 0, 0, 0, 0 } }; static void usage(void) { printf("Usage: errno [-lsS] [--list] [--search] [--search-all-locales] " "[keyword]\n"); } int main(int argc, char **argv) { int i; int exit_code; int index = 0; enum { lookup_mode, list_mode, search_mode, search_all_mode } mode = lookup_mode; setlocale(LC_ALL, ""); for (;;) { int c = getopt_long(argc, argv, "hlsS", options, &index); if (c == -1) break; switch (c) { case 'h': usage(); return EXIT_SUCCESS; case 'l': mode = list_mode; break; case 's': mode = search_mode; break; case 'S': mode = search_all_mode; break; case '?': break; default: fprintf(stderr, "getopt returned 0x%02x\n", c); return EXIT_FAILURE; } } exit_code = EXIT_SUCCESS; switch (mode) { case lookup_mode: for (i = optind; i < argc; ++i) { const char *arg = argv[i]; if (toupper(arg[0]) == 'E') { if (!report_from_name(arg)) exit_code = EXIT_FAILURE; } else if (isdigit(arg[0])) { if (!report_from_code(atoi(arg))) exit_code = EXIT_FAILURE; } else { fprintf(stderr, "ERROR: Not understood: %s\n", arg); exit_code = EXIT_FAILURE; } } break; case list_mode: for (i = 0; i < num_errnos; ++i) report(errnos[i].name, errnos[i].code); break; case search_mode: search(argc - optind, argv + optind); break; case search_all_mode: search_all(argc - optind, argv + optind); break; } return exit_code; } moreutils-0.66/errno.docbook000066400000000000000000000074451412064133500161700ustar00rootroot00000000000000
liw@liw.fi
Lars Wirzenius 2012-06-05
errno 1 moreutils moreutils errno look up errno names and descriptions errno name-or-code errno -ls --list errno -s --search word errno -S --search-all-locales word DESCRIPTION errno looks up errno macro names, errno codes, and the corresponding descriptions. For example, if given ENOENT on a Linux system, it prints out the code 2 and the description "No such file or directory". If given the code 2, it prints ENOENT and the same description. OPTIONS List all errno values. Search for errors whose description contains all the given words (case-insensitive). Like , but searches all installed locales. AUTHOR Lars Wirzenius SEE ALSO errno3
moreutils-0.66/ifdata.c000066400000000000000000000330221412064133500150630ustar00rootroot00000000000000#include #include #include #include #include #include #if defined(__linux__) #include #include #endif #if defined(__FreeBSD_kernel__) #include #endif #if defined(__GNU__) #include #endif #if defined(__APPLE__) || defined(__OpenBSD__) #define s6_addr16 __u6_addr.__u6_addr16 #include #endif #if defined(__sun) #define s6_addr16 _S6_un._S6_u8 #include #include #endif #include #include #include #include #include #include enum { DO_EXISTS = 1, DO_PEXISTS, DO_PADDRESS, DO_PMASK, DO_PMTU, DO_PCAST, DO_PALL, DO_PFLAGS, DO_SINPACKETS, DO_SINBYTES, DO_SINERRORS, DO_SINDROPS, DO_SINALL, DO_SINFIFO, DO_SINFRAME, DO_SINCOMPRESSES, DO_SINMULTICAST, DO_SOUTALL, DO_SOUTBYTES, DO_SOUTPACKETS, DO_SOUTERRORS, DO_SOUTDROPS, DO_SOUTFIFO, DO_SOUTCOLLS, DO_SOUTCARRIER, DO_SOUTMULTICAST, DO_PNETWORK, DO_PHWADDRESS, DO_BIPS, DO_BOPS }; struct if_stat { unsigned long long in_packets, in_bytes, in_errors, in_drops; unsigned long long in_fifo, in_frame, in_compress, in_multicast; unsigned long long out_bytes, out_packets, out_errors, out_drops; unsigned long long out_fifo, out_colls, out_carrier, out_multicast; }; void print_quad_ipv4(in_addr_t i) { i = ntohl(i); printf("%d.%d.%d.%d", (i & 0xff000000) >> 24, (i & 0x00ff0000) >> 16, (i & 0x0000ff00) >> 8, (i & 0x000000ff)); } void print_quad_ipv6(uint16_t *a) { printf("%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x", a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]); } void print_quad(struct sockaddr *adr) { switch (adr->sa_family) { case AF_INET: print_quad_ipv4(((struct sockaddr_in*)adr)->sin_addr.s_addr); break; case AF_INET6: print_quad_ipv6(((struct sockaddr_in6*)adr)->sin6_addr.s6_addr16); break; default: printf("NON-IP"); break; } } enum print_error_enum { PRINT_ERROR, PRINT_NO_ERROR, }; /** * return 0 success * 1 error */ static int do_socket_ioctl(const char *ifname, const unsigned long int request, struct ifreq *req, int *ioctl_errno, const enum print_error_enum print_error) { int sock, res; if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) == -1) return 1; strncpy(req->ifr_name, ifname, IFNAMSIZ); req->ifr_name[IFNAMSIZ - 1] = 0; if ((res = ioctl(sock, request, req)) == -1) { if (ioctl_errno) *ioctl_errno = errno; if (print_error == PRINT_ERROR) { if (errno == ENODEV) { fprintf(stderr, "No such network interface: %s\n", ifname); exit(1); } else fprintf(stderr, "ioctl on %s: %s\n", ifname, strerror(errno)); } close(sock); return 1; } close(sock); return 0; } int if_exists(const char *iface) { struct ifreq r; return !do_socket_ioctl(iface, SIOCGIFFLAGS, &r, NULL, PRINT_NO_ERROR); } #if defined(__linux__) void if_flags(const char *iface) { struct ifreq r; unsigned int i; const struct { unsigned int flag; char *name; } flags[] = { { IFF_UP, "Up" }, { IFF_BROADCAST, "Broadcast" }, { IFF_DEBUG, "Debugging" }, { IFF_LOOPBACK, "Loopback" }, { IFF_POINTOPOINT, "Ppp" }, { IFF_NOTRAILERS, "No-trailers" }, { IFF_RUNNING, "Running" }, { IFF_NOARP, "No-arp" }, { IFF_PROMISC, "Promiscuous" }, { IFF_ALLMULTI, "All-multicast" }, { IFF_MASTER, "Load-master" }, { IFF_SLAVE, "Load-slave" }, { IFF_MULTICAST, "Multicast" }, { IFF_PORTSEL, "Port-select" }, { IFF_AUTOMEDIA, "Auto-detect" }, { IFF_DYNAMIC, "Dynaddr" }, { 0xffff0000, "Unknown-flags" }, }; if (do_socket_ioctl(iface, SIOCGIFFLAGS, &r, NULL, PRINT_ERROR)) return; for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) printf("%s%s%s", (r.ifr_flags & flags[i].flag) ? "On " : "Off ", flags[i].name, sizeof(flags) / sizeof(flags[0]) - 1 == i ? "" : "\n"); } void if_hwaddr(const char *iface) { struct ifreq r; unsigned char *hwaddr; if (do_socket_ioctl(iface, SIOCGIFHWADDR, &r, NULL, PRINT_ERROR)) return; hwaddr = (unsigned char *)r.ifr_hwaddr.sa_data; if (!hwaddr[0] && !hwaddr[1] && !hwaddr[2] && !hwaddr[3] && !hwaddr[4] && !hwaddr[5]) { fprintf(stderr, "Error: %s: no hardware address\n", iface); exit(1); } printf("%02X:%02X:%02X:%02X:%02X:%02X", hwaddr[0], hwaddr[1], hwaddr[2], hwaddr[3], hwaddr[4], hwaddr[5]); } #endif static struct sockaddr *if_addr_value(const char *iface, struct ifreq *r, unsigned long int request) { int e; if (do_socket_ioctl(iface, request, r, &e, PRINT_NO_ERROR)) { if (e == EADDRNOTAVAIL) return &r->ifr_addr; return NULL; } return &r->ifr_addr; } struct sockaddr *if_addr(const char *iface, struct ifreq *r) { return if_addr_value(iface, r, SIOCGIFADDR); } struct sockaddr *if_mask(const char *iface, struct ifreq *r) { return if_addr_value(iface, r, SIOCGIFNETMASK); } struct sockaddr *if_bcast(const char *iface, struct ifreq *r) { return if_addr_value(iface, r, SIOCGIFBRDADDR); } struct sockaddr *if_network(const char *iface) { struct sockaddr *saddr; static struct ifreq req; unsigned int mask; if (!(saddr = if_mask(iface, &req))) return NULL; mask = ((struct sockaddr_in*)saddr)->sin_addr.s_addr; if (!(saddr = if_addr(iface, &req))) return NULL; ((struct sockaddr_in*)saddr)->sin_addr.s_addr &= mask; return saddr; } int ifd_if_mtu(const char *iface) { static struct ifreq req; if (do_socket_ioctl(iface, SIOCGIFMTU, &req, NULL, PRINT_ERROR)) return 0; return req.ifr_mtu; } #if defined(__linux__) static void skipline(FILE *fd) { int ch; do { ch = getc(fd); } while (ch != '\n' && ch != EOF); } struct if_stat *get_stats(const char *iface) { FILE *fd; struct if_stat *ifstat; char name[10]; if (!(ifstat = malloc(sizeof(struct if_stat)))) { perror("malloc"); return NULL; } if ((fd = fopen("/proc/net/dev", "r")) == NULL) { perror("fopen(\"/proc/net/dev\")"); free(ifstat); return NULL; } /* Skip header */ skipline(fd); skipline(fd); do { int items = fscanf(fd, " %20[^:]:%llu %llu %llu %llu %llu %llu %llu %llu " "%llu %llu %llu %llu %llu %llu %llu %llu", name, &ifstat->in_bytes, &ifstat->in_packets, &ifstat->in_errors, &ifstat->in_drops, &ifstat->in_fifo, &ifstat->in_frame, &ifstat->in_compress, &ifstat->in_multicast, &ifstat->out_bytes, &ifstat->out_packets, &ifstat->out_errors, &ifstat->out_drops, &ifstat->out_fifo, &ifstat->out_colls, &ifstat->out_carrier, &ifstat->out_carrier ); if (items == -1) break; if (items != 17) { fprintf(stderr, "Invalid data read, check!\n"); break; } if (!strncmp(name, iface, sizeof(name))) { fclose(fd); return ifstat; } } while (!feof(fd)); fclose(fd); free(ifstat); return NULL; } #endif const struct { char *option; unsigned int flag; unsigned int is_stat; char *description; } options[] = { { "-e", DO_EXISTS, 0, "Reports interface existence via return code" }, { "-p", DO_PALL, 0, "Print out the whole config of iface" }, { "-pe", DO_PEXISTS, 0, "Print out yes or no according to existence" }, { "-pa", DO_PADDRESS, 0, "Print out the address" }, { "-pn", DO_PMASK, 0, "Print netmask" }, { "-pN", DO_PNETWORK, 0, "Print network address" }, { "-pb", DO_PCAST, 0, "Print broadcast" }, { "-pm", DO_PMTU, 0, "Print mtu" }, #if defined(__linux__) { "-ph", DO_PHWADDRESS, 0, "Print out the hardware address" }, { "-pf", DO_PFLAGS, 0, "Print flags" }, { "-si", DO_SINALL, 1, "Print all statistics on input" }, { "-sip", DO_SINPACKETS, 1, "Print # of in packets" }, { "-sib", DO_SINBYTES, 1, "Print # of in bytes" }, { "-sie", DO_SINERRORS, 1, "Print # of in errors" }, { "-sid", DO_SINDROPS, 1, "Print # of in drops" }, { "-sif", DO_SINFIFO, 1, "Print # of in fifo overruns" }, { "-sic", DO_SINCOMPRESSES, 1, "Print # of in compress" }, { "-sim", DO_SINMULTICAST, 1, "Print # of in multicast" }, { "-so", DO_SOUTALL, 1, "Print all statistics on output" }, { "-sop", DO_SOUTPACKETS, 1, "Print # of out packets" }, { "-sob", DO_SOUTBYTES, 1, "Print # of out bytes" }, { "-soe", DO_SOUTERRORS, 1, "Print # of out errors" }, { "-sod", DO_SOUTDROPS, 1, "Print # of out drops" }, { "-sof", DO_SOUTFIFO, 1, "Print # of out fifo overruns" }, { "-sox", DO_SOUTCOLLS, 1, "Print # of out collisions" }, { "-soc", DO_SOUTCARRIER, 1, "Print # of out carrier loss" }, { "-som", DO_SOUTMULTICAST, 1, "Print # of out multicast" }, { "-bips",DO_BIPS, 1, "Print # of incoming bytes per second" }, { "-bops",DO_BOPS, 1, "Print # of outgoing bytes per second" }, #endif }; void usage(const char *name) { unsigned int i; fprintf(stderr, "Usage: %s [options] iface\n", name); for (i = 0; i < sizeof(options) / sizeof(options[0]); i++) { fprintf(stderr, " %5s %s\n", options[i].option, options[i].description); } } void add_do(int *ndo, int **todo, int act) { *todo = realloc(*todo, (*ndo+1) * sizeof(int)); (*todo)[*ndo] = act; *ndo += 1; } static void print_addr(struct sockaddr *sadr) { if (!sadr) { fprintf(stderr, "Error\n"); exit(1); } print_quad(sadr); } struct if_stat *ifstats, *ifstats2 = NULL; void please_do(int ndo, int *todo, const char *ifname) { int i; int exists; static struct ifreq req; if (!ndo) return; exists = if_exists(ifname); // printf("I have %d items in my queue.\n",ndo); for (i=0; iin_packets); break; case DO_SINBYTES: printf("%llu",ifstats->in_bytes); break; case DO_SINERRORS: printf("%llu",ifstats->in_errors); break; case DO_SINDROPS: printf("%llu",ifstats->in_drops); break; case DO_SINFIFO: printf("%llu",ifstats->in_fifo); break; case DO_SINFRAME: printf("%llu",ifstats->in_frame); break; case DO_SINCOMPRESSES: printf("%llu",ifstats->in_compress); break; case DO_SINMULTICAST: printf("%llu",ifstats->in_multicast); break; case DO_SINALL: printf("%llu %llu %llu %llu %llu %llu %llu %llu", ifstats->in_bytes, ifstats->in_packets, ifstats->in_errors, ifstats->in_drops, ifstats->in_fifo, ifstats->in_frame, ifstats->in_compress, ifstats->in_multicast); break; case DO_SOUTBYTES: printf("%llu",ifstats->out_bytes); break; case DO_SOUTPACKETS: printf("%llu",ifstats->out_packets); break; case DO_SOUTERRORS: printf("%llu",ifstats->out_errors); break; case DO_SOUTDROPS: printf("%llu",ifstats->out_drops); break; case DO_SOUTFIFO: printf("%llu",ifstats->out_fifo); break; case DO_SOUTCOLLS: printf("%llu",ifstats->out_colls); break; case DO_SOUTCARRIER: printf("%llu",ifstats->out_carrier); break; case DO_SOUTMULTICAST: printf("%llu",ifstats->out_multicast); break; case DO_BIPS: if (ifstats2 == NULL) { sleep(1); ifstats2 = get_stats(ifname); } printf("%llu", ifstats2->in_bytes-ifstats->in_bytes); break; case DO_BOPS: if (ifstats2 == NULL) { sleep(1); ifstats2 = get_stats(ifname); } printf("%llu", ifstats2->out_bytes-ifstats->out_bytes); break; case DO_SOUTALL: printf("%llu %llu %llu %llu %llu %llu %llu %llu", ifstats->out_bytes, ifstats->out_packets, ifstats->out_errors, ifstats->out_drops, ifstats->out_fifo, ifstats->out_colls, ifstats->out_carrier, ifstats->out_multicast); break; #endif default: printf("Unknown command: %d", todo[i]); break; } printf("\n"); } } int main(int argc, char *argv[]) { int ndo=0; int *todo=NULL; char *ifname=NULL; int narg = 0; int do_stats = 0; unsigned int i, found; if (argc == 1) { usage(*argv); return 1; } while (narg < argc - 1) { narg++; found = 0; for (i = 0; i < sizeof(options) / sizeof(options[0]); i++) { if (!strcmp(argv[narg], options[i].option)) { add_do(&ndo, &todo, options[i].flag); do_stats |= options[i].is_stat; found = 1; break; } } if (found) continue; if (argv[narg][0] == '-') { usage(*argv); return 1; } else { ifname = argv[narg]; break; } } if (narg + 1 < argc || !ifname) { usage(*argv); return 1; } #if defined(__linux__) if (do_stats && (ifstats = get_stats(ifname)) == NULL) { fprintf(stderr, "Error getting statistics for %s\n", ifname); return 1; } #endif please_do(ndo, todo, ifname); return 0; } moreutils-0.66/ifdata.docbook000066400000000000000000000166401412064133500162700ustar00rootroot00000000000000 Joey Hess 2006-03-07 ifdata 1 moreutils moreutils ifdata get network interface info without parsing ifconfig output ifdata options iface DESCRIPTION ifdata can be used to check for the existence of a network interface, or to get information about the interface, such as its IP address. Unlike ifconfig or ip, ifdata has simple to parse output that is designed to be easily used by a shell script. OPTIONS Print out a help summary. Test to see if the interface exists, exit nonzero if it does not. Prints out the whole configuration of the interface. Prints "yes" or "no" if the interface exists or not. Prints the IPv4 address of the interface. Prints the netmask of the interface. Prints the network address of the interface. Prints the broadcast address of the interface. Prints the MTU of the interface. Following options are Linux only. Prints the hardware address of the interface. Exit with a failure exit code if there is not hardware address for the given network interface. Prints the flags of the interface. Prints out all the input statistics of the interface. Prints the number of input packets. Prints the number of input bytes. Prints the number of input errors. Prints the number of dropped input packets. Prints the number of input fifo overruns. Print the number of compressed input packets. Prints the number of input multicast packets. Prints out all the output statistics of the interface. Prints the number of output packets. Prints the number of output bytes. Prints the number of output errors. Prints the number of dropped output packets. Prints the number of output fifo overruns. Print the number of output collisions. Prints the number of output carrier losses. Prints the number of output multicast packets. Prints the number of bytes of incoming traffic measured in one second. Prints the number of bytes of outgoing traffic measured in one second. AUTHOR Benjamin BAYART moreutils-0.66/ifne.c000066400000000000000000000057231412064133500145630ustar00rootroot00000000000000/* * * Copyright 2008 Javier Merino * 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., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #include #include #include #define streq(a, b) (!strcmp((a), (b))) static void stdin_to_stream(char *buf, ssize_t r, FILE *outf) { while (r > 0) { if (fwrite(buf, r*sizeof(char), 1, outf) < 1) { fprintf(stderr, "Write error\n"); exit(EXIT_FAILURE); } r = read(0, buf, BUFSIZ*sizeof(char)); } if (r == -1) { perror("read"); exit(EXIT_FAILURE); } } int main(int argc, char **argv) { ssize_t r; int run_if_empty; char **argv_exec; int fds[2]; int child_status; pid_t child_pid; char buf[BUFSIZ]; FILE *outf; if ((argc < 2) || ((argc == 2) && streq(argv[1], "-n"))) { fprintf(stderr, "Usage: ifne [-n] command [args]\n"); return EXIT_FAILURE; } if (streq(argv[1], "-n")) { run_if_empty = 1; argv_exec = &argv[2]; } else { run_if_empty = 0; argv_exec = &argv[1]; } r = read(0, buf, BUFSIZ*sizeof(char)); if ((r == 0) && !run_if_empty) return EXIT_SUCCESS; else if (r == -1) { perror("read"); return EXIT_FAILURE; } if (pipe(fds)) { perror("pipe"); return EXIT_FAILURE; } if (r && run_if_empty) { /* don't run the subcommand if we read something from stdin and -n was set */ /* But write stdin to stdout so ifne -n can be piped without sucking the stream */ stdin_to_stream(buf, r, stdout); return EXIT_SUCCESS; } child_pid = fork(); if (!child_pid) { /* child process: rebind stdin and exec the subcommand */ close(fds[1]); if (dup2(fds[0], 0)) { perror("dup2"); return EXIT_FAILURE; } execvp(*argv_exec, argv_exec); perror(*argv_exec); close(fds[0]); return EXIT_FAILURE; } else if (child_pid == -1) { perror("fork"); return EXIT_FAILURE; } /* Parent: write stdin to fds[1] */ close(fds[0]); outf = fdopen(fds[1], "w"); if (! outf) { perror("fdopen"); exit(1); } stdin_to_stream(buf, r, outf); fclose(outf); if (waitpid(child_pid, &child_status, 0) != child_pid) { perror("waitpid"); return EXIT_FAILURE; } if (WIFEXITED(child_status)) { return (WEXITSTATUS(child_status)); } else if (WIFSIGNALED(child_status)) { raise(WTERMSIG(child_status)); return EXIT_FAILURE; } return EXIT_FAILURE; } moreutils-0.66/ifne.docbook000066400000000000000000000046411412064133500157570ustar00rootroot00000000000000
cibervicho@gmail.com
Javier Merino 2008-05-01
ifne 1 moreutils moreutils ifne Run command if the standard input is not empty ifne [-n] command DESCRIPTION ifne runs the following command if and only if the standard input is not empty. OPTIONS Reverse operation. Run the command if the standard input is empty. Note that if the standard input is not empty, it is passed through ifne in this case. EXAMPLE find . -name core | ifne mail -s "Core files found" root AUTHOR Copyright 2008 by Javier Merino <cibervicho@gmail.com> Licensed under the GNU GPL
moreutils-0.66/is_utf8/000077500000000000000000000000001412064133500150505ustar00rootroot00000000000000moreutils-0.66/is_utf8/Makefile000066400000000000000000000034571412064133500165210ustar00rootroot00000000000000## ## Copyright (c) 2016 Julien Palard. ## All rights reserved. ## ## Redistribution and use in source and binary forms, with or without ## modification, are permitted provided that the following conditions ## are met: ## 1. Redistributions of source code must retain the above copyright ## notice, this list of conditions and the following disclaimer. ## 2. Redistributions in binary form must reproduce the above copyright ## notice, this list of conditions and the following disclaimer in the ## documentation and/or other materials provided with the distribution. ## ## THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ## IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ## OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ## IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ## INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ## NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ## THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ## NAME = isutf8 SRC = main.c is_utf8.c OBJ = $(SRC:.c=.o) VERSION = 0 MINOR = 0 RELEASE = 0 LIB_SRC = is_utf8.c LINKERNAME = lib$(NAME).so SONAME = $(LINKERNAME).$(VERSION) REALNAME = $(SONAME).$(MINOR).$(RELEASE) CC = gcc CFLAGS ?= -O3 -Wextra -Wall -ansi -Wstrict-prototypes $(NAME): $(OBJ) $(CC) $(CFLAGS) -o $(NAME) $(OBJ) $(LDFLAGS) IS_UTF8_LIB: $(CC) --shared -fPIC $(CFLAGS) $(LDFLAGS) $(LIB_SRC) -o $(LINKERNAME) all: @make $(NAME) clean: rm -f $(NAME) $(LINKERNAME) $(OBJ) $(LIB_OBJ) re: clean all moreutils-0.66/is_utf8/README.md000066400000000000000000000051361412064133500163340ustar00rootroot00000000000000isutf8 is a program and a c library to check if a given file (or stdin) contains only valid utf-8 sequences. # Compiling $ make # Demo $ isutf8 * -v isutf8: line 1, char 97, byte 96: Expecting bytes in the following ranges: 00..7F C2..F4. 40 00 40 00 00 00 00 00 C0 01 00 00 00 00 00 00 | @.@............. ^^ | ^ is_utf8.o: line 1, char 66, byte 65: Expecting bytes in the following ranges: 00..7F C2..F4. 00 40 00 0E 00 0B 00 48 85 F6 48 C7 02 00 00 00 | .@.....H..H..... ^^ | ^ libisutf8.so: line 1, char 153, byte 152: After a first byte of F0, expecting 2nd byte between 90 and BF. 68 12 20 00 00 00 00 00 F0 01 00 00 00 00 00 00 | h. ............. ^^^^^ | ^^ main.o: line 1, char 76, byte 75: Expecting bytes in the following ranges: 00..7F C2..F4. 56 41 55 41 54 55 53 48 83 EC 18 48 8B 5C 24 58 | VAUATUSH...H.\$X ^^ | ^ # Test a file `isutf8` returns 0 if the file is correctly encoded: $ isutf8 main.c $ echo $? 0 Some files here only contain ASCII or correctly encoded UTF8: $ isutf8 README.md $ isutf8 test.sh But an ELF is clearly not UTF8, a verbose error is printed: $ isutf8 isutf8 isutf8: line 1, char 97, byte 96: Expecting bytes in the following ranges: 00..7F C2..F4. `-v` adds some context: $ isutf8 -v isutf8 isutf8: line 1, char 97, byte 96: Expecting bytes in the following ranges: 00..7F C2..F4. 40 00 40 00 00 00 00 00 C0 01 00 00 00 00 00 00 | @.@............. ^^ | ^ # Test stdin `isutf8` reads on stdin if no file are given, also note that `bash` helps a lot with the `$''` syntax allowing you to write and test hexadecimal: $ echo $'\xe9' | isutf8 (standard input): line 1, char 0, byte 0: After a first byte between E1 and EC, expecting two following bytes. $ echo "Hellö world" | iconv -f utf8 -t latin1 | isutf8 (standard input): line 1, char 4, byte 4: Expecting bytes in the following ranges: 00..7F C2..F4. # Find UTF8 or non-UTF8 files As `isutf8` can take multiple arguments it's easy classify UTF8-compatible versus non UTF8-compatible files: List non-UTF8 compatible files: $ isutf8 --list * isutf8 is_utf8.o libisutf8.so main.o List UTF8-compatible files: $ isutf8 --list --invert * COPYRIGHT is_utf8.c is_utf8.h main.c Makefile README.md test.sh moreutils-0.66/is_utf8/is_utf8.c000066400000000000000000000260071412064133500166020ustar00rootroot00000000000000/* * Copyright (c) 2016 Julien Palard. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "is_utf8.h" /* Check if the given unsigned char * is a valid utf-8 sequence. Return value : If the string is valid utf-8, 0 is returned. Else the position, starting from 1, is returned. Source: http://www.unicode.org/versions/Unicode7.0.0/UnicodeStandard-7.0.pdf page 124, 3.9 "Unicode Encoding Forms", "UTF-8" Table 3-7. Well-Formed UTF-8 Byte Sequences ----------------------------------------------------------------------------- | Code Points | First Byte | Second Byte | Third Byte | Fourth Byte | | U+0000..U+007F | 00..7F | | | | | U+0080..U+07FF | C2..DF | 80..BF | | | | U+0800..U+0FFF | E0 | A0..BF | 80..BF | | | U+1000..U+CFFF | E1..EC | 80..BF | 80..BF | | | U+D000..U+D7FF | ED | 80..9F | 80..BF | | | U+E000..U+FFFF | EE..EF | 80..BF | 80..BF | | | U+10000..U+3FFFF | F0 | 90..BF | 80..BF | 80..BF | | U+40000..U+FFFFF | F1..F3 | 80..BF | 80..BF | 80..BF | | U+100000..U+10FFFF | F4 | 80..8F | 80..BF | 80..BF | ----------------------------------------------------------------------------- Returns the first erroneous byte position, and give in `faulty_bytes` the number of actually existing bytes taking part in this error. */ int is_utf8(unsigned char *str, size_t len, char **message, int *faulty_bytes) { size_t i = 0; *message = NULL; *faulty_bytes = 0; while (i < len) { if (str[i] <= 0x7F) /* 00..7F */ { i += 1; } else if (str[i] >= 0xC2 && str[i] <= 0xDF) /* C2..DF 80..BF */ { if (i + 1 < len) /* Expect a 2nd byte */ { if (str[i + 1] < 0x80 || str[i + 1] > 0xBF) { *message = "After a first byte between C2 and DF, expecting a 2nd byte between 80 and BF"; *faulty_bytes = 2; return i; } } else { *message = "After a first byte between C2 and DF, expecting a 2nd byte."; *faulty_bytes = 1; return i; } i += 2; } else if (str[i] == 0xE0) /* E0 A0..BF 80..BF */ { if (i + 2 < len) /* Expect a 2nd and 3rd byte */ { if (str[i + 1] < 0xA0 || str[i + 1] > 0xBF) { *message = "After a first byte of E0, expecting a 2nd byte between A0 and BF."; *faulty_bytes = 2; return i; } if (str[i + 2] < 0x80 || str[i + 2] > 0xBF) { *message = "After a first byte of E0, expecting a 3nd byte between 80 and BF."; *faulty_bytes = 3; return i; } } else { *message = "After a first byte of E0, expecting two following bytes."; *faulty_bytes = 1; return i; } i += 3; } else if (str[i] >= 0xE1 && str[i] <= 0xEC) /* E1..EC 80..BF 80..BF */ { if (i + 2 < len) /* Expect a 2nd and 3rd byte */ { if (str[i + 1] < 0x80 || str[i + 1] > 0xBF) { *message = "After a first byte between E1 and EC, expecting the 2nd byte between 80 and BF."; *faulty_bytes = 2; return i; } if (str[i + 2] < 0x80 || str[i + 2] > 0xBF) { *message = "After a first byte between E1 and EC, expecting the 3rd byte between 80 and BF."; *faulty_bytes = 3; return i; } } else { *message = "After a first byte between E1 and EC, expecting two following bytes."; *faulty_bytes = 1; return i; } i += 3; } else if (str[i] == 0xED) /* ED 80..9F 80..BF */ { if (i + 2 < len) /* Expect a 2nd and 3rd byte */ { if (str[i + 1] < 0x80 || str[i + 1] > 0x9F) { *message = "After a first byte of ED, expecting 2nd byte between 80 and 9F."; *faulty_bytes = 2; return i; } if (str[i + 2] < 0x80 || str[i + 2] > 0xBF) { *message = "After a first byte of ED, expecting 3rd byte between 80 and BF."; *faulty_bytes = 3; return i; } } else { *message = "After a first byte of ED, expecting two following bytes."; *faulty_bytes = 1; return i; } i += 3; } else if (str[i] >= 0xEE && str[i] <= 0xEF) /* EE..EF 80..BF 80..BF */ { if (i + 2 < len) /* Expect a 2nd and 3rd byte */ { if (str[i + 1] < 0x80 || str[i + 1] > 0xBF) { *message = "After a first byte between EE and EF, expecting 2nd byte between 80 and BF."; *faulty_bytes = 2; return i; } if (str[i + 2] < 0x80 || str[i + 2] > 0xBF) { *message = "After a first byte between EE and EF, expecting 3rd byte between 80 and BF."; *faulty_bytes = 3; return i; } } else { *message = "After a first byte between EE and EF, two following bytes."; *faulty_bytes = 1; return i; } i += 3; } else if (str[i] == 0xF0) /* F0 90..BF 80..BF 80..BF */ { if (i + 3 < len) /* Expect a 2nd, 3rd 3th byte */ { if (str[i + 1] < 0x90 || str[i + 1] > 0xBF) { *message = "After a first byte of F0, expecting 2nd byte between 90 and BF."; *faulty_bytes = 2; return i; } if (str[i + 2] < 0x80 || str[i + 2] > 0xBF) { *message = "After a first byte of F0, expecting 3rd byte between 80 and BF."; *faulty_bytes = 3; return i; } if (str[i + 3] < 0x80 || str[i + 3] > 0xBF) { *message = "After a first byte of F0, expecting 4th byte between 80 and BF."; *faulty_bytes = 4; return i; } } else { *message = "After a first byte of F0, expecting three following bytes."; *faulty_bytes = 1; return i; } i += 4; } else if (str[i] >= 0xF1 && str[i] <= 0xF3) /* F1..F3 80..BF 80..BF 80..BF */ { if (i + 3 < len) /* Expect a 2nd, 3rd 3th byte */ { if (str[i + 1] < 0x80 || str[i + 1] > 0xBF) { *message = "After a first byte of F1, F2, or F3, expecting a 2nd byte between 80 and BF."; *faulty_bytes = 2; return i; } if (str[i + 2] < 0x80 || str[i + 2] > 0xBF) { *message = "After a first byte of F1, F2, or F3, expecting a 3rd byte between 80 and BF."; *faulty_bytes = 3; return i; } if (str[i + 3] < 0x80 || str[i + 3] > 0xBF) { *message = "After a first byte of F1, F2, or F3, expecting a 4th byte between 80 and BF."; *faulty_bytes = 4; return i; } } else { *message = "After a first byte of F1, F2, or F3, expecting three following bytes."; *faulty_bytes = 1; return i; } i += 4; } else if (str[i] == 0xF4) /* F4 80..8F 80..BF 80..BF */ { if (i + 3 < len) /* Expect a 2nd, 3rd 3th byte */ { if (str[i + 1] < 0x80 || str[i + 1] > 0x8F) { *message = "After a first byte of F4, expecting 2nd byte between 80 and 8F."; *faulty_bytes = 2; return i; } if (str[i + 2] < 0x80 || str[i + 2] > 0xBF) { *message = "After a first byte of F4, expecting 3rd byte between 80 and BF."; *faulty_bytes = 3; return i; } if (str[i + 3] < 0x80 || str[i + 3] > 0xBF) { *message = "After a first byte of F4, expecting 4th byte between 80 and BF."; *faulty_bytes = 4; return i; } } else { *message = "After a first byte of F4, expecting three following bytes."; *faulty_bytes = 1; return i; } i += 4; } else { *message = "Expecting bytes in the following ranges: 00..7F C2..F4."; *faulty_bytes = 1; return i; } } message = NULL; return 0; } moreutils-0.66/is_utf8/is_utf8.h000066400000000000000000000027141412064133500166060ustar00rootroot00000000000000/* * Copyright (c) 2016 Julien Palard. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _IS_UTF8_H #define _IS_UTF8_H #include int is_utf8(unsigned char *str, size_t len, char **message, int *faulty_bytes); #endif /* _IS_UTF8_H */ moreutils-0.66/is_utf8/main.c000066400000000000000000000212221412064133500161370ustar00rootroot00000000000000/* * Copyright (c) 2016 Julien Palard. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #define _POSIX_C_SOURCE 200809L #include #include #include #include #include #include #include #include #include #include "is_utf8.h" #define VERSION "1.2" #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) static int show_str(const char *str, unsigned int max_length) { int printed = 0; while (max_length-- > 0) { printed += printf("%c", (*str >= ' ' && *str <= '~') ? (unsigned char)*str: '.'); str += 1; } return printed; } static int show_hex_str(const char *str, unsigned int max_length) { int printed = 0; while (max_length-- > 0) printed += printf("%.2X ", (unsigned char)*str++); return printed; } /*show_context(, 5, 279, 2, chars_before_error: 8, chars_after_error: -274) **/ static void show_context(char *str, int str_length, int err_pos_in_str, int faulty_bytes) { int chars_before_error = MIN(err_pos_in_str, 8); int chars_after_error = MIN(str_length - err_pos_in_str, 8); int printed = 0; printed = show_hex_str(str + err_pos_in_str - chars_before_error, chars_before_error + chars_after_error); /* Print up to error. */ printf("%*s | ", 3 * 16 - printed, ""); show_str(str + err_pos_in_str - chars_before_error, chars_before_error + chars_after_error); /* Print up to error. */ printf("\n"); printed = printf("%*s", (3 * chars_before_error), ""); printed += printf("%.*s", faulty_bytes * 2 + faulty_bytes - 1, "^^^^^^^^^^^^^^^^"); printf("%*s | ", 3 * 16 - printed, ""); printf("%*s", (chars_before_error), ""); printf("%.*s", faulty_bytes, "^^^^"); printf("\n\n"); } static void print_utf8_error( const char* file_path, int error_line, int error_column, int byte_no, char *str, int str_length, int err_pos_in_str, const char *message, int faulty_bytes, int quiet, int verbose, int list_only, int invert) { if (quiet) return; if (message && !invert) { if (list_only) printf("%s\n", file_path); else printf("%s: line %d, char %d, byte %d: %s\n", file_path, error_line, error_column, byte_no, message); if (verbose && !list_only) { show_context(str, str_length, err_pos_in_str, faulty_bytes); } } if (!message && invert) { printf("%s\n", file_path); } } #define handle_error(msg, target) \ do {retval = EXIT_FAILURE; perror(msg); goto target;} while (0) static int is_utf8_readline(FILE *stream, const char *file_path, int quiet, int verbose, int list_only, int invert) { char *string = NULL; size_t size = 0; ssize_t str_length; char *message = NULL; int lineno = 1; int pos = 0; int offset = 0; int faulty_bytes = 0; while ((str_length = getline(&string, &size, stream)) != -1) { pos = is_utf8((unsigned char*)string, str_length, &message, &faulty_bytes); if (message != NULL) { offset += pos; print_utf8_error(file_path, lineno, pos, offset, string, str_length, pos, message, faulty_bytes, quiet, verbose, list_only, invert); break; } offset += str_length; lineno += 1; } if (string != NULL) free(string); return message == NULL ? EXIT_SUCCESS : EXIT_FAILURE; } static void count_lines(const char *string, int length, int up_to, int *line, int *column) { int pos = 0; int line_start_at = 0; *line = 1; while (pos < length && pos < up_to) { if (string[pos] == '\n') { line_start_at = pos + 1; *line += 1; } pos += 1; } *column = 1 + up_to - line_start_at; } static int is_utf8_mmap(const char *file_path, int quiet, int verbose, int list_only, int invert) { char *addr; struct stat sb; int fd; int pos = 0; char *message; int retval = EXIT_SUCCESS; int error_column = 1; int error_line = 0; int faulty_bytes = 0; fd = open(file_path, O_RDONLY); if (fd == -1) handle_error("open", err_open); if (fstat(fd, &sb) == -1) /* To obtain file size */ handle_error("fstat", err_fstat); addr = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (addr == MAP_FAILED) { /* Can't nmap, maybe a pipe or whatever, let's try readline. */ close(fd); return is_utf8_readline(fopen(file_path, "r"), file_path, quiet, verbose, list_only, invert); } pos = is_utf8((unsigned char*)addr, sb.st_size, &message, &faulty_bytes); if (message != NULL) count_lines(addr, sb.st_size, pos, &error_line, &error_column); print_utf8_error(file_path, error_line, error_column, pos, addr, sb.st_size, pos, message, faulty_bytes, quiet, verbose, list_only, invert); if (message != NULL) retval = EXIT_FAILURE; munmap(addr, sb.st_size); err_fstat: close(fd); err_open: return retval; } static void usage(const char *program_name) { printf("Usage: %s [OPTION]... [FILE]...\n" "Check whether input files are valid UTF-8.\n" "\n" " -h, --help display this help text and exit\n" " -q, --quiet suppress all normal output\n" " -l, --list print only names of FILEs containing invalid UTF-8\n" " -i, --invert list valid UTF-8 files instead of invalid ones\n" " -v, --verbose print detailed error (multiple lines)\n" "\n" "This is version %s.\n", program_name, VERSION); } int main(int ac, char **av) { int quiet = 0; int exit_value = EXIT_SUCCESS; int i; int list_only = 0; int invert = 0; int verbose = 0; int opt; struct option options[] = { { "help", no_argument, NULL, 'h' }, { "quiet", no_argument, &quiet, 1 }, { "list-only", no_argument, &list_only, 1 }, { "invert", no_argument, &invert, 1 }, { "verbose", no_argument, &verbose, 1 }, { 0, 0, 0, 0 } }; while ((opt = getopt_long(ac, av, "hqliv", options, NULL)) != -1) { switch (opt) { case 0: break; case 'h': usage(av[0]); return EXIT_SUCCESS; case 'q': quiet = 1; break; case 'l': list_only = 1; break; case 'i': invert = 1; break; case 'v': verbose = 1; break; case '?': usage(av[0]); return EXIT_FAILURE; default: usage(av[0]); return EXIT_FAILURE; } } if (optind == ac) { return is_utf8_readline(stdin, "(standard input)", quiet, verbose, list_only, invert); } else { for (i = optind; i < ac; ++i) { if (is_utf8_mmap(av[i], quiet, verbose, list_only, invert) == EXIT_FAILURE) exit_value = EXIT_FAILURE; } return exit_value; } } moreutils-0.66/is_utf8/test.sh000077500000000000000000002464171412064133500164040ustar00rootroot00000000000000#!/bin/bash # Copyright (c) 2016 Julien Palard. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. utf8_test_file() { printf "." to_test="$1" should_return="$2" ./isutf8 <(printf "%s" "$to_test") 2>/dev/null >/dev/null error_number=$? if ! [ z"$error_number" == z"$should_return" ] then [ $should_return == 1 ] && printf "\nThis one should have failed:\n" || printf "\nThis one should succeed:\n" printf "%s" "$to_test" | hexdump -C printf "%s" "$to_test" | ./isutf8 <(printf "%s" "$to_test") exit 1 fi } utf8_test_pipe() { printf "." to_test="$1" should_return="$2" printf "%s" "$to_test" | ./isutf8 2>/dev/null >/dev/null error_number=$? if ! [ z"$error_number" == z"$should_return" ] then [ $should_return == 1 ] && printf "\nThis one should have failed:\n" || printf "\nThis one should succeed:\n" printf "%s" "$to_test" | hexdump -C printf "%s" "$to_test" | ./isutf8 - exit 1 fi } utf8_test() { utf8_test_pipe "$@" utf8_test_file "$@" } should_pass() { while [ -n "$1" ] do utf8_test "$1" 0 shift done } should_fail() { while [ -n "$1" ] do utf8_test "$1" 1 shift done } should_pass "Léa" "Maïté" "Pauline" "Élise" should_fail $'\xc9lise' $'Elis\xc9' # Tests from : # Table 3-7. Well-Formed UTF-8 Byte Sequences # ----------------------------------------------------------------------------- # | Code Points | First Byte | Second Byte | Third Byte | Fourth Byte | # | U+0000..U+007F | 00..7F | | | | should_pass $'\01' $'\02' q w e r t y "~" "foo" "bar" "baz" "123" 1 2 3 "," $'\n' $'\x0E' $'\x0F' $'\x7F' should_fail $'\x80' $'\x82' $'\x83' $'\xC0' $'\xC1' should_fail $'|\x80' $'|\x82' $'|\x83' $'|\xC0' $'|\xC1' should_fail $'\x80|' $'\x82|' $'\x83|' $'\xC0|' $'\xC1|' # | U+0080..U+07FF | C2..DF | 80..BF | | | should_pass $'\xC2\x80' $'\xC2\xBF' $'\xDF\x80' $'\xDF\xBF' should_fail $'\xC2\x79' $'\xC2\xC0' $'\xC2\xC3' should_pass $'---\xC2\x80' $'---\xC2\xBF' $'---\xDF\x80' $'---\xDF\xBF' should_fail $'\xC2\x79---' $'\xC2\xC0---' $'\xC2\xC3---' # | U+0800..U+0FFF | E0 | A0..BF | 80..BF | | should_pass $'\xE0\xA0\x80' $'\xE0\xA0\xBF' $'\xE0\xBF\x80' $'\xE0\xBF\xBF' should_fail $'\xE0\x99\x80' $'\xE0\xC5\xBF' $'\xE0\xBF\x78' $'\xE0\xBF\xEE' should_pass $'~~~~\xE0\xA0\x80' $'~~~~\xE0\xA0\xBF' $'~~~~\xE0\xBF\x80' $'~~~~\xE0\xBF\xBF' should_fail $'\xE0\x99\x80~~~~' $'\xE0\xC5\xBF~~~~' $'\xE0\xBF\x78~~~~' $'\xE0\xBF\xEE~~~~' # | U+1000..U+CFFF | E1..EC | 80..BF | 80..BF | | should_pass $'\xE1\x80\x80' $'\xE1\xBF\x80' $'\xE1\x80\xBF' $'\xE1\xBF\xBF' should_pass $'\xEC\x80\x80' $'\xEC\xBF\x80' $'\xEC\x80\xBF' $'\xEC\xBF\xBF' should_fail $'\xE1\x41\x80' $'\xE1\xC0\x80' $'\xE1\xC8\xBF' $'\xE1\xBF\xFE' # | U+D000..U+D7FF | ED | 80..9F | 80..BF | | should_pass $'\xED\x80\x80' $'\xED\x80\xBF' $'\xED\x9F\x80' $'\xED\x9F\xBF' should_fail $'\xED\x80\x50' $'\xED\x80\xC1' $'\xED\xBF\x80' $'\xED\xBF\xBF' # | U+E000..U+FFFF | EE..EF | 80..BF | 80..BF | | should_pass $'\xEE\x80\x80' $'\xEE\x80\xBF' $'\xEE\xBF\x80' $'\xEE\xBF\xBF' should_fail $'\xEE\x70\x80' $'\xEE\x80\x70' $'\xEE\xCF\x80' $'\xEE\xCF\xCF' # | U+10000..U+3FFFF | F0 | 90..BF | 80..BF | 80..BF | should_pass $'\xF0\x90\x80\x80' $'\xF0\xBF\x80\x80' $'\xF0\x90\x80\xBF' $'\xF0\xBF\xBF\xBF' should_fail $'\xF0\x70\x80\x80' $'\xF0\xCF\x70\x80' $'\xF0\xCF\x80\xCE' $'\xF0\xCF\xCF\xDF' should_fail $'\xF0\x80\x80\x80' # | U+40000..U+FFFFF | F1..F3 | 80..BF | 80..BF | 80..BF | should_pass $'\xF1\x80\x80\x80' $'\xF1\xBF\xBF\xBF' should_pass $'\xF2\x80\x80\x80' $'\xF2\xBF\xBF\xBF' should_pass $'\xF3\x80\x80\x80' $'\xF3\xBF\xBF\xBF' # | U+100000..U+10FFFF | F4 | 80..8F | 80..BF | 80..BF | should_pass $'\xF4\x80\x80\x80' $'\xF4\x8F\xBF\xBF' should_fail $'\xF4\x80\x80\x79' $'\xF4\xBF\xBF\xBF' # ----------------------------------------------------------------------------- should_fail $'\xf0-' $'\xf1-' $'\xf2-' $'\xf3-' $'\xE1-' $'\xEE-' $'\xED-' $'\xEF-' # Auto generated using: # #!/usr/bin/env python3 # # import random # # def random_byte_sequence(seq_len=32): # return bytes([random.randint(0x01, 0xff) for _ in range(seq_len)]) # # should_pass = b'' # for i in range(1000000): # some_bytes = random_byte_sequence(10) # try: # some_bytes.decode('utf-8') # should_pass += some_bytes # if len(should_pass) >= 50: # print("should_pass ${}".format(repr(should_pass)[1:])) # should_pass = b'' # except UnicodeDecodeError: # print("should_fail ${}".format(repr(some_bytes)[1:])) # should_pass $'F~\x15(\x13i.h\tYyn{V\x7f+KVs2\tpNujT\x17\x0eP\x17\x06bX83|-b[+8d@|\x11N\x0e|?!' should_pass $'\x03\x15\x067L!AW\x08x\xc2\x8eeNH\x11W0frpF\x12m\xec\x94\x859m\x18RP1FK\x0fs\x04Fj\xe3\xb3\x93+\xca\x81\xc4\x94KN' should_pass $'S\xda\xa2\x0c\x0c\x01\xda\xa7it%V\x7f\xdd\xb6\xe3\x86\xb5E\x13\x02\x1bJ\x02*a\x13C#@\x1c\x18V9b\xd1\x94Bu\x1b\xdd\x9a\x16xa\xd2\x89s\x02I' should_pass $' -\xc6\xa1\x13O2@1H\xd6\x98b\xdd\xb8\x06\x0f\x04|6ZOWOW7wOmqJ\xdc\x93\x05\xc2\x80\x05e\x13,\xc5\xb1s\xe0\xaf\x91{9r%' should_pass $'_\t\x1ea;5w\xef\xb9\xae\xc6\x8dT^C\x0c\x08\x15I-O58\x16X\x029F4$e)\x14\x1aO\xcd\x8e\x1dq\x10J\\\xd1\xaaw$\x17,\x7f0' should_pass $'3G\x19\x17JzG\tq(k\x029-QPN#ju\\\xcd\xbc>\x1b\x1fw\x7f\x10BbU)w\x13A\xc7\x85!-\\+B\x7fg@\xc8\x90f\x1f' should_pass $'Et\x010;ox\x19\x17\x13:\xd2\x92H-K\x194!\x15*:Q\x0c`\x15\x12%&\x0c\x1e"" g\r3L\xd3\x97CQ]\x0fb9qsp\n' should_pass $'\xc7\xbbdl\x02@\x7f\x18\xcb\xbd\xc6\xa2\xd8\xacpN3eY:\xcb\xa3x\x0b@\x12h*\xcb\x85\xc4\xb6O\x123xbf\x0e|V\xde\x8c\x01-O\xd1\xb2(z' should_pass $'-\xd7\x88Y\x1e5y\xed\x99\x97<\ni\xd5\xa2\x026V`1\xc2\x82N\x1b\x15jvq(6U\xdb\xaf&K\xc5\x92.%DPKF\x02z' should_pass $'\x0cfpkhj<\x7f^\x15\x14\r~Dn~\x1d\x19}xZ#B\x08D^%tW&1\xd4\x92\x153XFx\xd1\xb1Z&\x1c\x0b~\r\xce\xbejY' should_pass $'\x1ffHI&9\rd\x17\x12\\7ob\xd1\x99}[\x0ff\x10D\xc7\xab\x1cz\x02\x1a\x17D\x0c\x13j\xdc\x91\n/\x10D7Nja`= C=' should_pass $'\x17S\x11u3y\x0b(CC7\trO\xc5\xb0yA\nR\r6?u\xde\xa7H$;rUt\x07s\x1e\x1eBr\x06Q~\x15.\xde\xa8{\xd5\xa9sp' should_pass $'+\x08\x1fL#\x121\xc5\x9a-sG\xdb\x82T+\tH\x14\n(i\xc3\x9c\xd1\x80\x02\x0fJa\x1a!\x12\xd9\x8ac\x05&Y1a\x0bjR\tuH[\xc2\xb8' should_pass $'"& Q\x7f\x0e\x17\x0clQ\xe9\x9e\x9f}?;]8x\x0c \x19\xd3\xbf>+(~\xce\x9bXI\x06\t/z\x193S:\x11\x04"$\xdd\xa4?Aw.' should_pass $'\xe9\x97\x94|\xcd\xa7VGQl\x04%I)J{\xd7\xae\\GA<\x12">2\x13\x02\xc5\x9c\xdb\x9e\\\\Qn\r\xd1\x80oof)[D:\x01.U#' should_pass $'Bu\x1c\x1f\x0e\xee\x99\xb3b?_\x044Vh<\xc9\xaaC\x1b7\x1e\x1e5\xd7\x81R\x18c<\x10\x1f4==D,\x16\x13W\xf0\xa4\x8b\xa6\x18uwn\nb' should_pass $'\xd2\x99=v\x14[\x17\x05\x08\x18\xcc\x86Q\\\x1d\xd7\x84$\x1e{\xc6\x94\xd4\xa2\xc7\xaaE\xef\xad\xa8Qrta\x12$\x02:.\x0e%pJY\x14\x7fN=AO' should_pass $'\\3>\x05=gc\x171\x1cd{\xd7\xbe\x18\x1b6MX$\x1bY{\x1f\nc](+\x01nx\x04\x19|:\x1c4/Aih8\tD\xed\x8e\x8a\x0f]' should_pass $'\x1ek\x19%\x0ff\xd1\xb3\xc3\xbd\x18\x0b~c6d+Hu\x0e{\t1\xdf\xbcX\\pZ|8Hq\xd0\xa7.\x03\x11mH\x0eqPF\x13?VW*e' should_pass $'9f^:\x04r\xda\xbd!u;7{+\x07:\xd8\xb7G0Pq\x07`.B\xc2\xa9\xc3\xa1\x03cuh\x05-TqE"#y~s\x7fA.{6|' should_pass $'E\x0f/jnlI;%0lWk\x02ZG\x0b{8\x07Km\x0b@~D[z\xc3\x81h\x1aM\x11)\x1e=\x1f\x14LzW27Y\t4 7p' should_pass $'5\x11?w`i>;vg3\xd3\x8d\\\xca\xa8\x13Y-\n*3q}v&\xcf\x98P\r\n\x0e\x19\xe1\xa1\x84{\x0bGK\x08Q\x0cgw^1\x16UT&hL*H\x1f\xd8\x99\x01\x15\x1b\xdd\xa3SD\t' should_pass $'MCqAVJ\x14\x7f>#_8aQ\x14m\xc4\xa7H\x1b\x07\xda\x9fK9uTQ7Q9Ub\x07*\xcd\x96\x1c\xc9\x87}zS\xdb\x84\x11\x7fh(e' should_pass $'a4Av\x06/{)wd\xdd\x9fe\xc3\x8e%\x0b7\xd7\x9a\x13\xe4\xb9\x9avK\xc5\x8dzB\xcf\xab\x16\xd4\x91M\x0b=i+o\xd3\xaefdKF\x0b>j' should_pass $'{\x1dNF\r\xef\x8b\xafW`WgfxjK$\tvm5k73\x7f\x1d\xdf\xb4J !\x19\x1aAE\x17$0\xd1\x9ds\x0e\x03{!E\xd4\x82\x0fc' should_pass $'\x7fz\xd8\xbd \xdb\xbe\x12?\t\x10\x12gI/\nA\xde\xad@R,hH>_\x10\xe4\xaf\xaf[3\xe5\x8a\x9e\nTP/G\xd7\xad`43\r\xd0\xb8WV' should_pass $'tq\\F\x1cA\x06\x01/ej\x16#2TO`}f\x1d\x03:Dq=\x05X\x1f}gF\x0c3\x0eQ\x0ei\x03P\r>]\x011%W\x1dE(\x15' should_pass $'nz\xdf\x81\x16\x06u\x03\x1e*;\x02\x1e\x060R1AsBF\x044\x05}4pR\x1cdFRt\xdc\xbe-mcen\x16[\x11\n\xc9\x9c@v\x0cj' should_pass $'V_SW<\x0f\x03\xec\x9f\x82^\x11P0(\x18\x13\xc3\xa5kM\x1f2f\xce\x9bS\xc8\xb1;\xce\xa2\x1fq>\x06u%^}Hde4\x0b\x18\x0b(\xd0\x97' should_pass $'0\'\xd7\xa4>-\xe2\x8e\xb3w7\xc5\xb9cL)"&\xd9\x96Ceg{\x04D&V^q`K\x14\xc8\xb5I\x0e$N/x\xea\xac\x88x;/0\xcf\xb7' should_pass $'p+\x04h\x16\x1d\x01\x15\x17~\xd7\xb8MnP/R&?O|l@>\xd2\x85Tx\x11!\x134\xe3\xaa\xb6\xc2\x8c\ni(\x1a\xd1\x8d\x03)(>JI1' should_pass $'TWqf\x11\x01\x14f/\x06]\xde\xa0P#*w\xd3\x88#x}\x11a\x0bH\x19L\x1f8iod%Sv\x18o\xd0\x8fTI9f\x139y]R\x0b' should_pass $'\x06\r/,%\x1fw\xca\xa4\x05\x0e\x1c\\F\xda\x9d\x11*\x1f7>t$ \x1a\x155\xdc\xa9^|U#(\x7f\xcb\x8b+\x0cBp\x0f\xc7\xb9@n`K|\x1a' should_pass $'`U/\x04\x07N6uCV\x173\t\xc7\xbc #,oq\xe1\xb7\x82y&8y\\\x11qC$O?X\x01\x04\xd4\x81C=\\ \x12U\xe5\xb6\x80\xd5\x9a' should_pass $'4YED$0Y\xd2\x88$)Xd\r\xd9\xa06\x0b\nS;\x14a+\x1fx7\x02V\x1eHsW\x12\xcb\x94\xe5\x87\x8c)Cae`L\xc7\x9a\xe4\xbf\x8d' should_pass $'`\x04\x1d\x1b@XVM!04\x13j`\n\xda\xbe\x07\x10d\xe5\xa1\xb3\xca\xb6x\twtPC^\xd5\x82:\xd2\xb9/\xdb\xa3\tV[#Z?6^\r\x04' should_pass $'\x7f\x0fa2*KqhC!\xdf\xab&\x1c,t= \x1c\x0c[6p\x19\x03\x01[<~t\xd8\xa2\x19S\x16\x01.\x11[J\x022ku4?h7zT' should_pass $'\xd5\xab3[%\x1fL2` \xd1\xb2D%Q\x02X\x154!g \x1dUx\x1c#~&Dt\x03\xd8\xa1jWdk\x0f7R\x07-\x15/qQx N' should_pass $'\x1c\x19\x7fp"\x0c}\x188\x17\x07b\x16\xd9\xa4\x12b\xd4\x81)\x06\xf1\x88\x8b\xa6LM<\x1fM`\x11\xd1\xaa8C\xd4\x87\x1c\x1fi\xe7\x9b\xb8lT@\xd7\x86r' should_pass $'\xde\xb0\x07\x1f\x10\xc2\x84|oLm.?-_ "scb7G5\xd7\x8a;-8\x1c\x15$$\xd3\xab_\xca\xb7\x02nF\x19B,7-\xde\xafhM\x08' should_pass $'W' should_pass $'\xc2\x8c,)/m\x04b\x1f\x01E5\x04?J\xd8\xa3\x02\x160Njt\x15\r(t&0nrQ2T\x1e\xd1\x85\x17\x0cko\x12,\x16\x12\xc6\x91\x1c$E' should_pass $'Cm(zJ\x1d\xc4\x9aw=4dZL\x19\x19`\x12\x17*\x030\xdd\x9ef\x05NJ\x10Ed6\x1c+ \x0b!\xda\x84uuq2\x07\rJ\xdc\xaf\x1dB>>@X:W\xd0\xaa\x0f/+Yvl\r^(\x189\x10<1\x1d' should_pass $'\x07\x0c\x16\xd5\x8f>i\x165{\x04!\'\x03}\x19=UU\x0e8P4TdVj\x14Y\x1ft\xc3\xb6_\xd2\xb2{\xc6\x9c&58Fv u-W"\x10' should_pass $'M}\x18i9\xd6\xa7k\x17*/x}R~]+\xd2\x8e\x18\x104*_H\rn\x0e\xd3\xa0dc\xc5\xacp\xdc\xba\xe0\xae\xa7O\xea\xa5\x8e \xe8\xb0\xa5eO' should_pass $',)\\\xd7\x83\xc4\xacQ\x15;\x19\r\x1ag_\x1d\xde\xacP\x11K\x13\x0b;qNF:\t3@q}\xd2\xac\xef\xa3\xb8\x13\x14\x174L5\x01% 5F-' should_pass $'A\x07+&\x1eh\xdd\xbaaR\x1fbe\xe2\xa0\x9a\x0b\x07n\x7f\x7fL\x0c\x06=i\x0eLr6A\x086\x10=\x1e/\xcf\xabIG\x1f)$\xce\xbaYG\x11\x0b' should_pass $'Y\r.[\x05\rj$ez\':\x7f\x13&EELMR@m\x11\xd4\xa3\x06\xd1\x9f!N&5-8:yN{L\x05#"}o_\xd3\xa6\x05gN' should_pass $'\x05|RS\xf1\xa4\x9c\x82vGxq(\xcf\xa8\x08Z\x05id1Ot)\x1e0\xeb\xac\xb2/B}2\x1b=\x01\xc5\xb4AQ>a\xda\x9ed\xc5\x8d&\x0e\x1a' should_pass $'%pb\x14e@\xdc\xa1cV$;\x03\x02\xe9\x93\xbcB\tL\xd1\x8cYW\x1bp\x0c\xc3\xa4M^z\x15\rP\xcd\xa7i\x18\\,4\xdb\x86\xcd\x82aG]\x07' should_pass $'IX60\x0f\x1fDv\x01e6\x13\xd7\x98\xcb\x81\xdf\xb4:~\xe1\x96\x95cr\x05_@\xc5\xa0\x10iL%Lqxv\rW-!i\x1cv\xc9\x9d?BF' should_pass $'\x06Dwe6\n\x11h#QIdAW\xde\xa1\x18~9d=+u7M\x02`\x12Ym]\x15D\x1c\xcd\xa6nX \x16R\nBP]N\x10\xc5\x82\x0c' should_pass $'\x1b+\xd7\xa8[\x1dp\x05f\x1fu+W|yT\x1f\x04\x1b??9M\x05|S\xda\xb55+\x15%\x08!f\x03]2\x04\x12\t~3>!\xd5\xb5\x1e\xd5\x9e' should_pass $'*}6JtAi4|0{ia\xdb\x857\x17u#\x0fA#bS\t\xe0\xb4\x80%\x04\x1b\x03\xdc\xb1-[_H\x10nt\x19~c\x0be\x14\x03m(' should_pass $'\x1bV\x16\tOo\x13\xc3\x91\x1c%aT\xc6\x816\x13E^\x12otW\x0cfs\x11\xdd\xa6\x13\x19:?"{r01&W<<\xf1\x80\x99\x85\n\x1a \\' should_pass $'\xdd\x80u9\xc5\x88S.~v\xc2\x87D\xe2\x81\x8dWM\x01}Ks9A\x04w*\x11\x03\x1eT\x07\xc3\xb9\x0e?W>7\x0bKpq\x1cWQ@\x0e1^' should_pass $'r\t\xcd\xa2*P\x7f\x15kqaY_$"\xc2\xb9\x11\x169|hi\x02:\tl\xc5\x98Q\xe6\x93\x97\x10 k\x0b\xc5\x836\x0541\x1d\x02\x1c\x1e\x18"n' should_pass $'s\x1cG\x1a7`*(W\x18Ou\x13\x13\x7f>\x13D\xd1\xa23n\x0esW\xc9\x92`\x7f0o\xce\xbbiK95i4l\x14\x02{\x10ej:\x03\x03d' should_pass $'<\xd4\xb6\xc4\x95]*EZ<$\x06C/\x14Yu%\x0fih~jDeU\'=\x16jwbY*\x13HxQg\x10qH/\x07\x14+6%p"' should_pass $'!?\nS/uS\xe4\xa0\x8b.>J\x1bl(\x0f|\xc2\xaeo\x0e@\tXp\x1f>\xc9\x8cO\xd9\x8d`KMFRy\x1b\xc4\x88RCS>UWu ' should_pass $'k&\x01(VN-b\x0b\x0cBpx3r|Z"\xd0\xa2\x04\x02\xd1\x8ai7\x1a\xc8\x94F&=KU2O"\x17v/\x1d\xcb\xb4VLr_a\xec\xa3\xbc^E58\x04@\x7f<`C\x18\xd1\x9dju%' should_pass $'3Z\xdf\x86)%\x10->?I\x16rp\xd1\xb1\x1aC"\x14d\xc8\x9f\x19\xc8\xbd"=o\x12\xdd\xbb0>Bs\x0e<{aU~V\x10A[6\\8\x1f' should_pass $'\x01H\x1bJ%ik-|t;%9)\xe9\x84\xb5];\x06!\x1a{\x14txP\x04\x172\xce\xaa?+_Pj;M\x0bT|\x1aQ?\x1a\x07E1d' should_pass $'\xe1\xae\x9b{>(:z\xd0\x9f(\tGnuQ[9B@7\x0c4qriA!T2{^P\x13r@\x1c\n\x04`\x08kmv\x1e=E\x12\x13y' should_pass $'P87.E$BauB\x12\t%QU\xd6\xa11\xc4\xb9u+df_a#&CU\x0e\x12\x10~p\x138#8`3\x1dv?t\xcb\xb45Tw' should_pass $'\xc2\xb5\x198[>?zSJ<\xe8\x9f\xa1v\x02BT3hz\xea\x8b\xa7=~0}\re=\x07S9Hi\xc2\xb2+K\x15?""Y\x1d*\x13|G' should_pass $'Z\x1a"\xe8\x85\xbd6a\xc6\x9bZ\x07\xd8\xacGD\xc8\xaa,P^"X\x16~z5\xda\x8dz\x0c\x03\x15B\x0c||d\x14j\x0f\xe5\x99\xb3|T#\x03(e' should_pass $'\x04$Zu\x7f\x7f[7\x16w?^\n>\'\x1ePzy"\x06kO8n\x03\x1ce\x04\x1c\xcb\xb9Mzrx\x180l\x17\x1f\x19\x7fEmL\x05u\x1e2' should_pass $'\'110K::zL)9i.\x18f4p>\xcb\x97b\x18\x10K\xe7\x98\x9e"8)\xe4\x92\x9cd\x19f\tV*K#@DJ\x131\x1cr7j' should_pass $'*\x0fn~\xe4\x84\x89I3AX\x106\t\x103\x0c/.\'l H/YU\x18C"&s?\x11x\xe9\x81\x93A]Y7JU\x1a\xda\xbcz\x07\x01A' should_pass $'UWv\x1a>?\xdc\xa2\x10b(\x0b\x1cMo\x16bG\xc8\xbc\xde\x83/\x1e1p\xce\xa0,o\x17^\x17@\xcc\xbdZ("b\x19m@f\x10s?d~\xcd\x8c' should_pass $'\x085\xc5\x89r!~~gb!zj\x16\xdf\x8c\x01_\x17\x0f1?\x19(an)G\x11^J$IMW{b@W\x0f@\x07,M+/c@k\x04' should_pass $'f\xd6\xa7dX;6u\xda\xa2b\xc4\x8d\xcc\xb1v\x1d^\x10\t~m?\x1fHf5\x11qD(g\xd3\xaf~K\xd6\xba\x18Yr\x15I\x05\x10\xc5\xa5x\r<' should_pass $'JiwQ4A\xc4\xb0\x15\x1b\x06\x0euJ\xe9\xad\x86\x02aZyM\\9\x0f4*GW?k\x1c\xea\x81\x9cXY\n-ePW\x0br9u\x05^\xc4\xac' should_pass $'\x155A \xe3\xbb\xa3\x08!9\x08X\t\x7f\xe8\xb7\xbf\x08\xcf\x93\x01M!A]}\x07"\x1f\x18ac\x06d\x03\\dp\x13-g_IZ]m)\x12s<' should_pass $']T\x1cOh\x13~\x1dl\x02Vdj\x10\x113\x1dH\x19\x7fW_En<\x08=*JUyb\x1c)N\x1b\x04\x15+!\x05%\xc9\xa7k\xdb\xb3\x1a\x17Y' should_pass $' nGP\x16itv\n`(q:``\x06E\x14\x123d9!!w"\xc5\xa4wo$Q\xda\x80i`o\xc5\x9c:\x18-pO\xde\x8d\xe9\xbd\x9dJ' should_pass $'^\x05xG%/\xec\x86\xb5D\xc4\x91$11yeU4_]\x08RZ\tU]\xea\x93\x9f<"]qY\\\x7f\xca\xbf\xe1\x93\x83\xc7\x93$M\xc4\x91\x0f\x1f`:c*(' should_pass $'M%C\x07GW\xc5\x9ft>$-\xc4\x88\x07DrX\x19&\xe9\x9a\xbd\xc5\xa8P)}{Whk/\xc5\x9b\xcd\xa7q\x11!\\-N ,T1:o\x02' should_pass $'xa\x07\t\xeb\x8d\xa1\x19@\x07\x7f0e\x0e\xd0\x90\x0cV\x08n/\x11\xdc\x8ebF\x0c\x18{T7"J\xc3\x9e\x056q<\x1d(>/\x19$M0{qX' should_pass $'\xd4\x89\xcd\xa7HY\xdb\xbd\x15~f?K7(z\xdf\x90\x18.\x01\x19\x12Q\xe2\xb1\xbe}_(92 L8\xc4\xab\x1bjS/C7J\x10T\rZ7h' should_pass $'-*v\\.\x11v9\x0e\x1aj{Zoe,\x18gfu3[3\xc9\xb2\x1c\xc6\xae\x05*1P,P9\xcf\x8e\x15z\x031\x1f\x0e(\x1by:4~>' should_pass $'1-\x1c\xc5\xb9\xdf\xbd\xd5\x89<\x10e|/L\xdc\xa7b\xc3\xb4\xe5\x9e\xa2\xc9\x9bIG$:mL2=wek@B%\x1c\xdc\x8c\x1c\xc6\xaf&\x07XV\x1d' should_pass $':nN\x15\x10\x0fN])[=u9\x1f?1LCEyz@5\x1cc\xcd\xb8RG\x18;q6J\x0c\x02m46M=hfh\x16r@DWQ' should_pass $'b\x10sFE\xc9\xa6+)WX\'3u~j*\x16h\x1a\xef\xaf\x81\xd3\x9eG";\xd3\x8d3x (DitI>qA+\x1a\x05\x03,9\x17a\x12' should_pass $'\x0caOb/^S ke.\xc9\xaf=M\x07{\xc8\x971?y|E7\x15\x11!:\x1c!T)`w\x11/b\x03_oL\\\xc9\xb5mu)_m' should_pass $']8u4OZR:\x17^j>\xc2\xa2?y\xc6\xb8%\x10RE6Ek\n\x19UPFd*7Z,?G@-&q%\xda\x96\t8@5oY' should_pass $'JI\x12TY\xce\xa1\n\x02\x13S\xec\xbe\xbe"\x1eT\x01r\x7f\x10"}p]\x15? =]w\x1bc;\xc3\x99s\\\xea\x93\x83f\x15QL\x1c\\\xcc\xb3\x03s0\x0eQ\\Y\x11FM\x1e5y@.:\xc2\x92' should_pass $'OvWY\x04\x0f):x#\x16jO\x1bW\x06\xd3\x82Gs\x18\x1fNv\x16T?Y+[\xc2\x9b\xde\xa2=\x1c,c\tUo\x19\x1fGev\x16fJe' should_pass $'fP-p\th\n\x10?=]\x10F\t\xc9\x86\xd3\xbbX6URf?A\x11@\x19bw\x7f\x03G\xd3\xb8? j\x03[G\t\x16\x1e4\x1fX\x0b](' should_pass $'Un.t&\xe5\x94\xa0 \x06\nC\x17\x06Wu[mb\x1cLN&)<\xd5\xa8%5U\x0f~$l\x11J\xc9\x84\x07Fq\xcd\xaccO-/9\x17\x0b' should_pass $'OBG\t\xdc\xa5+E(q\xc8\x8d[)*4&|\x16A*NVY\xc9\xbb&J#bQE)\x0b"n8GPg3\xcd\xb1\x1ck\xc8\xacc\xcc\xa5' should_pass $'l2@\x10pjO%)\x1c\x1d@\t7U;x\xd7\x95\x168s\xd1\xb3o\x17\t\xc7\x9bGgo\x16|4eN\x0b\x193\x1939R:I@d=i' should_pass $'\x7f26v*F\x08N7>y\xd8\x8fG\x10!\x13Z\xcc\x87AM;\xe3\x8f\xa1x\x08C07\xf1\x88\xa2\xbb~\x0bn\xc7\x97\r\r\x1de\x13/o\x07;d' should_pass $'\ny,;en@\xdb\xb4xJZm=B\x03\xdc\xa2\x1aO\xeb\x94\xa2V\x0eKl*j#m\xeb\x8b\xb3l\x05@\n\\\\%S(N\xde\xb6\x1cOV3' should_pass $'\x06\x1cd:\x08h\x1c[,d\x1f`!a\x11\xdb\x9b*\x12\x1a\xcd\x84.#4sG4D\x05\x0bd\x14$\xdb\x80\x16\xe7\x91\xb17s\x15 JHH/\xcf\x81' should_pass $':\x14.liD\x18bF\t\xd3\xa1\x17\x15ykAx\xd3\xb4h4y6Xx\xe9\xa3\x8ecgR\x18\xcb\x981e\x1c\r\x0bD\x7fM2\xc4\xbb2$pF' should_pass $')(rgVR8>4B\x1b\x01<\xea\xaf\xaaN-\xc9\xb2ES-*}\x07&CX\x07\x12C\xda\x97CPtRj]7B\x18t\x14x\x16\x0emz' should_pass $'R\x11\xc3\xa2_k\xc2\xa1\x10q\x12zN$K:P\'\x10\x0f\x19N\xc9\xb7"9fX*Vc\xe6\x8a\xbew\x06\x1aD{+4\xd9\x9e~\xce\xb9\x04\xc4\x94-' should_pass $'"]\x15%\x02&\x06\\E[\xc6\x84C\x07VR\xc4\x83\x04hv.7\x19Is\xc8\xa7"|C,).A7\x05{W\r\x0bH?\xde\x9aV\x0eh\xc5\x98' should_pass $'y\xdf\xbb\\b}HHh\x05Q\x11\x03\x1e\t\x1a\x0e\x1cxb#\x18:JPS\x11\xc2\xa50:3k$\xf2\x81\x9c\x8f7x\x10Y50H~\xe7\x80\x82,' should_pass $'\x18\xd5\x8c\x0c)z8(HVo_pZY&+\x19\xcb\xb0r?\r\x7f\x0bD:^)zQv6$#\x0fHT\xc8\x8f*\x7f8\x12^2\tZ?l' should_pass $'=r}\n]n\x13T\x11H.R/\x0evP6*HE\xd2\x82CwXpB\xd9\x88EE\xe5\xb7\xb2M\x0c3\x03a\n6\x1el,\xe5\xb6\xbd*m0' should_pass $']d\xca\xb5s\xcb\xb1Mfw\x0fc4/X\nAG9+r\x0c\x0f3*\xd7\x84op"\x03pNw49\x07%\x02\x06Q\xd1\xbe\x01>ha\xc4\xa8l' should_pass $'N\xe4\x86\x9aeV\x15p\x16u\xd6\xa1\x16\xd2\xb5bo B/9q\xdf\x90\xd3\x9ai\xca\xaa1|zs[3k\x01E9\x1bo\nc$' should_pass $'\x14wO|:<\xd6\x9d\x7fOg;\x17\\DQ\x13L\x05)0\xde\x91"W7 21\x0cM\xd8\xa05~w=\x06EE\xcd\x8b\xc3\xb3\xc9\x8ar\xd7\xa3h' should_pass $'\\$an$Vg^Sg%\xc8\x90hE\x06P4P\x06P\x19"H\x06\x1d_w`\x0bs\xeb\xbf\x94\xd2\x91l~\x0cxYAd]+\x07LMxE' should_pass $'y\x0bl\x10YI;4\xd0\x92\xcb\xab\xcb\x9b\xc3\x8e&\x12uIHKt+\x0e\x1a&&\x0e\x02\x04=k*)O\x01%)m\nW%\xc4\x89B\xc8\x8a\x0c\x0e' should_pass $'E\x1a@\xc7\xaaNxot\x1b\x1dD\x15>8\x0b)\t>~\x1cZz\n\xe4\xb8\xa1\xd7\x94}W\x0eeo0g6\rW\t\xc6\x8d\x1f\xcf\x8aKjx_[' should_pass $'prPeSu"g\rPn,\x0e\xcb\xbcy&}\xc5\xae\xd5\xbbt++\xcc\xba\xc7\xbbK\x050\x1e\x7f$\x18"\x1ee\x03\xd0\x98!\x18<\\y\xcd\x83&' should_pass $'f;4m\xcb\x9fJ#j,kawNxE\x0eGx\x05\x07C\xc3\xaa]v\xc2\x86JS~s!\x08=b\x12;\x02\x16k\xea\xa5\x82Z\x14+f\x14V' should_pass $'<\x15\x0b[\x1e1Tg\x18:8nnz{T%\xd7\xb5\x14`pfoP\xcd\x86^[[Q_t\xc5\xb1\xe2\xa7\xbc\x07\x1b\x12+:\x04\xcd\xa2\x10@[8' should_pass $'>vGh){L8K:\xd8\x8bSD&nZ\x1626\xc9\xbaz\x17\x07>cq\x17?\x07W!{\xe6\xa9\xb1L?6\xe5\xb8\x99\x12\x7f5\x18x\x12j' should_pass $'FF\xcc\x8ddI^\xca\xa4z\x02Rz3X$*!$yB\xc7\x9cq\x18\xd2\x83\x12\x7fU-\xc7\x85k\xc4\x88G\x03/\x11\x18VM0#%L\xcb\xb4' should_pass $'(Q:a\x1f\rfS[Sd8\xd5\x88oj\x16 Ia\xe6\x98\x9bH\x0e\x06b!5@E<\xd3\x8b\n\xce\x8a7V\x1fvXYw*B8VyR' should_pass $'\x03j\xce\xac\x1f\xeb\x85\x89V\x12\xe7\xb3\x9c\x1ez\x1c7\x1cR\x17jr\xc4\x92\xc9\xa1}\xe6\xaa\xb7e\x07\x03L\x1d\x02\xd0\x80kThNxj0\x7fNGg\x11' should_pass $'x}RU0exDd\x10\xeb\xb0\x8cel\x18P{(\x08\n\xda\x86Ih\x06h\x18(GdtcbFY7~\x0f+\xc3\xacx\x1e\r\x0f5\x013;' should_pass $'\xd6\xbf5\xc5\xb4T\xe2\x86\x901S0p$@\x15{;c\x1bN\xd6\x9f\x05q \x13\xc4\xab,j0/{4\x07!Z\xca\x93\x13"[p\t\x14Q#Zx' should_pass $'\x04\xcd\x99d;\xd1\xa2\x06uJroY7$0Lx#X\x16Tax!\xe4\xbf\x932)\xc4\xa5\x0eo\xdf\xbb8O\x02\x04u\x04\x01\x1e\x17&\x08;\x05w' should_pass $'n-)\x1d\x7f\xce\x95\x1c\x01`+Dwb!4[\xee\xb0\x97\x1c+)(\x1e\x0b1_\x13S?]\\?\x021\xcb\x9a\x12%Icg\xc9\x84\x14~}@\x18' should_pass $'!%m\x1f.\x04G\x1c\x1eg>\x1e[\x11i\x06\x7fC<\x10`\x13zpI\x0e=2\x08e7 \x19;H\x13r7\x11\x04Ne\x0b\xd3\x9aG\x15b *' should_pass $'\\dux(r\x04\xd8\xb8w\'\x05Vm,|\xcf\xab\xcb\xb6TVW$\xcb\xb1\xd7\x93\x0f^Y`\trFH].TB\x1c\xd0\xae|nQK"\x0eC' should_pass $'n\x1f\x03K4~mQMK|\xdf\x8b\x03\x1aUUNJ>\x10\x13]q\xdd\x8f,^\n_\x0cc\x10b(H"_H+\x0e\xd7\x8d)O+H\x15E_' should_pass $'c\xc6\x9f\n\x1e\x01I~\xd6\xabNXi5H\\C\x162x\x05\x02\x1cit\xdd\x9e\x13LfSLi!a\xc8\x87w\x0fWIR4AA-\x18DPU3\x0c\xd6\x9b\x18\x1aT~:a+4' should_pass $'g6NzUljV`l\x05\x0e\x0e\xe2\x82\xa1\x0ep%W\x0czM\x01jMdQi\x12g^.zd\x1b\r5i8U\n\x1d~\xdc\x8c\xf3\x91\x84\x8b' should_pass $'<\t\x1c[k\x04\x15,\xd2\xaa25c\x10]\xde\x88`UJx\xf4\x80\x84\xbeZ~}w\x0en\t\x0f\xda\x97\xea\x9e\xb2\x18\x15@\x07U\x1fkRk\xe6\xb9\xaa' should_pass $'\x023!\xce\x90\\"\xd7\xba|E' should_pass $'\x13kl4`\xc5\xbbw5,<+W\x08\xc7\x89ef\x0cz> \x1bD*\\gbRPMv@J\x08G \xc6\x82|p\x16\xdf\x84\xc4\x90j42`' should_pass $'hbJe\xe7\x86\x9cmBE\xdc\xbc.W\x16A\xd0\xad3Z\x12aIR6\x0fm\x16!m I\x05\xd2\xa7C\xf3\xa1\x87\x94Y\xd2\x86y\xf1\xb6\xa8\xaf\n\x1c' should_pass $'E\xeb\x80\xaeho!c\x1f\x19\xd2\x85\xca\x8cw\xcc\xb1u\xc4\x9c.\x13\x07>ta\xdc\xa2%\x18S)\xed\x9f\xad~W:j.?5wPw\x1cv\x0eG:' should_pass $'\xca\xaa uu9l\x06yL\\~v\x0c\r66\x13V\x0f"\\\x16~\xc3\xbc09]-f\x06=Lz5t*~2H\x15p)t\xce\x8a' should_pass $'\xe2\x92\x91R2\x05\xd7\xad\x05\x06M\x1e\x18\x12\xe1\x93\x8akFK4B\x1ep4\x13D\x07\x1c\x07\x12\xe5\x98\xa7\r+\xdb\xa2^sl1PsI\x1a\xcc\xaerj' should_pass $'\xdc\x8eF\x1c\x0eihc~\x01l\x1a6/j\xc3\x8c=SF\x19\x1b &\xd5\x96\xd1\xb4[c!\x1bgo\xc3\x9d\x1alZXJ\xe7\xa3\xba>+F9Ay' should_pass $'@\x01J+0\xd1\x9dR`\x1fJ/{qPD\x1fEA\xe9\xab\x8bw\x17Y\xd9\xa9,8' should_pass $'Q*>{\xdb\xbfKb[i\x15#\x109h\xd2\xaf`V8.\xc9\xaff\xd3\x8b\xca\xa5\t\x0caV\xee\xb7\xa0M\x1bZ\xcf\xb0\x1d-\x1d\x13\xd7\x80D\x04\x1cV' should_pass $'>\x0ch\xea\xbe\x91w\x13B\x0cCDxc f\x16w_FGk\xc4\xa78^\x19\xd7\xa9q\x0b\x0b\xd6\x87ki-7\xea\xb7\x9d\xd1\x82z\x1b6?^>(\rv\x06=\x1c5\x11:\xd1\x82\x01\x03smI' should_pass $'dgP\xdb\x88:&#\xd8\xb3\x1amJ&w`7\tQc#0K\x07wqM3W-_"d\xdb\xa7(#\xee\xb5\x8et\x19\xd6\xa4\x1eC>T},' should_pass $'N\x05^.\xd3\x96*7\x0cBA\xd5\x87;\t!#\x1cm\t3P\\tG\x7f~Q}A\x1avo\xde\xbcBV\x10 \x15`NOK\\992%W' should_pass $'E"\xc8\x99O]\x13f4JB&\x1ap=\xd0\xa4\\q%,f(1O\x1c\x1c?`[O\x0f/\x11\\$y-_\r/#\x13\x19[:' should_pass $'L\x1e\xc7\x82lI\xcf\xb4I\x10-{H\x7f9\xc7\x8d\xc5\x8c@G?\xca\x9f\xe5\x89\x8f\x05p\x0b\xe9\x94\xaa[P4%B\x02#OcRc\x01E%O!"' should_pass $'Hz=s\x1bD"\xef\xa1\x98Gs\x16u\x1b\xc3\x82\t=k\x1bp\x06\x1fu}"@h_\xcb\xa1VA`+\x0ca}f9$.ba\x1a\x14J K' should_pass $'~}*5\x1b*y$p* nB\xe2\x81\xafRi@y$\r\xdd\xb7Q\xcc\xa2z-/j/dD{a\n2S\x7f]\x11\x18jw\x03D>M.' should_pass $'#z\x7f\xcd\x91n[^ItFA\x0cmIl)^H\x1dmG\'\x11Q\xdd\x9e!}{%\x02\'}9s\xed\x91\xbe\x1dF"HM,\r\xce\xa7_\x1d' should_pass $'d+}+ZI\x0f\x1c2O--r4y\xc2\xacl\x10eC\xd5\xa4bA\x16\xe8\xb8\x8e\x17\x1em\xde\x84db\x1b>\xc8\x8d W\x046pgj\x10s/' should_pass $'?N7\x1fv\x104t\x19\x14B)px\x14.G\xee\xa1\x8f"2Xl\xc7\xad\xd8\x85\x0f\x08TX.\x0e\x15RK\x04pjj\x07\x0bPT\x1f8\xe6\xa3\xbe\x7f1Q\xd5\xbd?P[sj\x7f=rLtI\r\xe7\xab\xb2>q\x0c\x05n*\x1a\x1d[Z' should_pass $'\x06J\x10r\xc3\x9b&{gE7\x05>"\xd3\x88W(\t+F\xd6\xbc\xd3\xa8^\x16\x12nV\x10BKn~6}\x0e<|Xv\\|\x19"\xc8\x8d' should_pass $'\x0f\x1e\x0b^k{w#nP4\x1c\xd8\xa6NIjjVK\\\\~\x04Y)\x02V\xc6\x8d,\x0fhLt\x13gu\x12\x06' should_pass $'r\x7f\x0erZ\xd2\xb9\t>2RA\xc8\xbePg:1\x11b\x04tx-Q>-,\t\x01;\xc4\xbe\n9\xcd\x83\xcb\x95}W"\x03\x15Li\x19<\x18s' should_pass $'\xd0\xadd\xd5\x98\xd2\xa3}Dv\x17u\x1d!OD\x17+e\nLZ>\x0b,o5\x10}J$W|\xdf\xbe``55\\$aAj$\xdb\xa32-\x18' should_pass $':\xd4\xb0\x1dOj\x16\xc3\xb1<\x0eo\x11\x0cC\x18PF%/\x1eLe*dYBKsVy+j:\x14\x1b\xdc\xae\xdb\x8e7\x06zAI}|D\x1al' should_pass $'\xc3\x94$3>XnKtCn!]\\Z@\x03]9\x0cO\\dx\xef\xa5\x85CT\x18\xed\x9a\xadg.\x1aFs\x0cJ5\xe8\xa1\xb5\x17}HUjO>|Q\xd3\xbe\x0c>\x08' should_pass $'!2%\x12\x1d&ud/\x01\x0fZh~\x1d\x13j\x18qlq"t5\x06\xd9\xb0\xcb\x9a8\xd7\x84\xcb\x93\xd3\x9c@\x17\n\x12\x1e\x04\xc4\x87\x0eWj\x07\x0e#' should_pass $'\n{\x1f\x1a\xcd\x90$G\x0fl<\x1f*\xde\xa7]}\x15|7\x04Q\xe7\xa0\xb7\x146#N\x17N8&"\x120\xc2\x829\x14?H\x1b`gDjhRr' should_pass $'W$\x1b0J\xdc\x82\x0f4u}K\xe9\x97\xaf\xe8\xa3\x97&J\x14\x0b\x05zii\x19+\x06^v\'}\x15e|aN\x02\x1b\xdd\xaa.;_1"P\x0cN' should_pass $'},\x0c<\xc6\xbaqwGQx\'\x0f{q\r6[C#"tV,R\r\xd8\x83nit>\xdf\x9a\x0eKS\x0f\xcf\xb6\x04&{/d\xd6\x95iH>' should_pass $'\xc8\x95P|b\xd0\xa79R\x0cF\x03[\x16E?o\xd7\x97Sb\x17\xca\x85\x13\tR9\xe6\x9a\x86\x02s\tw`9j]p\x10\'P\x03!o\x19~O\'\xc6\xa2"dJ,' should_pass $'`RsB)ImZ%\x13QP\xc5\x9b\xca\x99dw\x12\x10\x7f\x19j\x05@m\x1f\x05y{p\x15[iU\x17~2Ye\x15)#n=\x1bya -' should_pass $'\x06\xcd\xbf\xce\x83\x13d\x17R\x06T#\x11Li47\\\x14n[\'hl\xd7\xbb/\x14\nd9~b\x14q`\x0e\r\x17{>%.v' should_pass $',y\x0fE\x13N\x0eB\x12qD8tQk\x1dpgg#\x14\x0c\x12\x14|cRHrI<\x1eZ\xc4\x94C!\x0ewV5[F"Z\xd3\x92=\xd2\x93' should_pass $' \x1c\x1e\x02\x1a K?[}\x02\x13/!\x18\xd4\xa26 \x16Hn` \x19&\x7f\x10_6-IwPH\x0bt\x19\x1c\x05\x13\xdd\xb4\x13om\xc6\xa3\x7f\x04' should_pass $'lv/\xd4\x98\x12@\x1c\x16<&u\xec\xbe\xb9j@A.XZ&d\x1cR%%\x05zI_[tW\x10\x1f\xd9\xa2@m7\xe3\xb9\x99\x08(z<>i' should_pass $'\xe6\x80\x87FbK$)`x\x0b\x02hyS\x11_g\xd3\x9eJmy8U\xd4\x8dR\xdb\xa9\x01&\xdd\x89G+\xd5\x91wqyw*\x117C[v!s' should_pass $'6G\xc2\x8e]$"\x08nX\x0b\xd4\xb2\x1cvL5fu.]%\xd1\xbcyR\x1d,\x0c"\xc5\x80(O\xe4\xa5\x92\xda\x909c\x05SP!\x01\x06\xc4\x90I' should_pass $'^\xc4\x9cY@\x14\x0bR\\{fz6\\PtjJ[\x1b\x06\xc7\xb5' should_pass $'\xc2\x93tT[KhT5\x1cX\x02\xe5\x9f\xb5\x18\x0c5/xQ&\x0cXg%v_@\x17*"\x15\xde\xb3m\xde\x92Gs\x7fkq{\t?O;\nP' should_pass $' hZ-\xc2\xb1TvG4h$*-Vs\x13/\x18\rGC)\x03;)\x7frR|\x1aD\x1cJu9;\xce\xa7\x1e+$j\x1c\xe7\xa0\xb4FQP' should_pass $'9\x10aAp^_D$JR7:]\x1duJVBWd7C\n)]0T\x01(2>qdp\xd8\x91\xcc\x9f\xdf\x91Gj9aXZ\x07\xce\x8bF\xd6\x98ad' should_pass $'\x08\x1d,\x1bM\x0b`a=wMZ\xc8\x9eiZPd\x03\nA\xce\xb4\x03\x1b[)X]KoL\xdb\xaf"NM|i8E\x13\x06S|k\x15#&n' should_pass $'nH$\xe5\x87\xb4]\xcc\x9e\x1b\x05]v\x07\x1cC3Qf\x1eYf\xc5\x8b\x04uQ\x1a\x05\x04Pq\xd7\xa39\x1bRysAmb\x0f\xf1\x83\x90\xb9\x0b\x02o' should_pass $'9{_\xd1\xb1\x1f>GDINmfRP&W\x08\x1bm[/q\xd6\x87\x05"a(j\\QW\x08Dgz;:zxE\x1d\xca\xb2Pn\xc6\xa4c' should_pass $'9\xcf\x9cU.\x11\x0ey\x1e\x04\x08\xdb\xb1iNO2kwQ[\x1d=?m(\x1f=\x15^\x13}D\x01Y\xcd\x96?u#{eF"\xf1\x98\x9a\xa2S\x19' should_pass $'w\x13\t|shdh\xd3\xbc8\t\t\x1dq\x18Nn#92#\x0f*e\x17l\x03Ts\x15$\xcb\xb8\x02&\xe0\xb9\xa6x\n\xeb\xa8\x80\x02>k\x050\x18' should_pass $'-\xe1\xab\x8f>\x0f{\x0c\x7fnM\xef\xb9\xb5V5\n\x01&7\x08|v \xce\xa2\x19r`k\xcc\xb0\xc8\x9fr\x7f(zE\x0ee\x19%a0P0\xd3\xb6+' should_pass $'4\x04\x04:\xca\xa5k\xd1\xb6.\xd8\xb4N\x03\x11-I"\xca\xbdSA\x18/2i&ukr\x1a\x04\x1awf\'[\xd4\xae\x12EPJ!m+ToG\x17' should_pass $'ME}-DMp\x05:g\xdc\xb6S&:DK\x14An\xd0\x98\xd8\x96\x0eo\\\x13Jfc\x03\x7f)AJWQc\xc3\x9e\x17\x04B%\x0fs2Sq\x1cQ|\x1b\x19,~iE\xe5\xb5\x84M\x1c,Y\x11\\\x0e\xdb\x85X' should_pass $'e\x08v.~(>\x1bp\x07W\xdd\x97pAvF\\{)\xdd\x96\xc9\xbb\xf0\x9a\xb1\x96\x1d,8\x13lF\x0bN?n+Uj6=eJ%\x14\xd7\xa77' should_pass $'Q\x059cQ\\\x05|R\x19i\t#]\xc6\xbf\x1d_`dPd\x1bo\xdb\x9ea\x1f"\x06\x11\xf0\xa1\xbc\x8a\xdb\xb6\x1d\xe9\x9f\x9d0l9_\xc5\x95PMv^' should_pass $')}Fgn\x1c\x0f\x0eGY9\xd8\xb53Wko\x04\x1b\x1ePa%\x0c\x1c\x10h=:5%=\x13\xd3\xb6J\x0e\x12-\rj^D\n\xe3\xb6\x8bp\x0bG' should_pass $'%\xd9\x80E):j~c=^^\xcf\x91\x16\xc3\xb9\x1d)R\x07\x1fL\x17b3K}\xd4\x828/WYk\x10R\xcc\x82to\xc3\x86] Q.!5Y' should_pass $'\xc8\xab"\xee\x8c\xafwvx;sRtmv3.G\x04-$x\x17\ni\x14\xc7\x83u)^h;\xc4\xb4\xc5\x93\xc9\xa7DE%4j 2\x0crHd' should_pass $'\r]\r\x01A\x0bS\xdb\x95Iph\x05\xcb\xb8\x05:@r<\x0bkL:\xc6\xa9\x7f7\xc9\xae bvK:\x05TzKVgdiu\x18?\x086\x15w' should_pass $'o>{\xc5\xb1f&4rfrS\x14`\'rD"qJ\xc6\x87Q4\xe8\x8a\xae\x07"`gU\xc3\x834\x04Z!PA\r\x12\x0e\x0bzC)\xcf\x9eo' should_pass $'(\x13hpX\x06{I$hx^g|i\x02s\xd7\xbfy*\x1au\x0fVi\xce\xbdF5=r8\xc8\xb3\xc8\xa4\x04n\x17\x03\x10X\xc9\xba;}y9h' should_pass $'b#\x1e\xe5\xb3\x89\xc3\x9d~\rsZ\x10ky\x12\x17E\xd8\x9c4\xd6\xb0Z`11\xe3\xa7\xb8\xd9\x95\xd4\x9ca\x03\xd7\x8e\xcc\x90eH=\x0b\xdf\x81z=\xd8\xb8' should_pass $'\xd9\x8axv|\x13},1$\x1e"\xd2\x94\xe5\x93\xbd\xd9\x90TV/.\xd3\x94\rAH\x1cy\xee\x94\x98f\x15\x1djY\xd8\x87\xdc\x8b\xce\x9cg7|7T^' should_pass $'_5\x07}T\x017 2\x18\x15\x0b\x7f\x0f\'\xc9\xb58/D:HVi\x03\xef\x99\xb3\x1d\x0cMjO\x7f9N\xc8\x98$"\x17:\x0f\\\x0f\n%f\xc6\xb3' should_pass $'v\x11\x13"\x10\x17ur6d\x19%O\xcf\x8814d\xce\x88>p\x7f\xcf\x99Q\xcc\x9d\x18Re-{V\t@X\xe8\xa3\x9f\t\xd4\xa8\x08\x07]\xc4\x8d/N' should_pass $'So}\xe6\xa5\x90\xed\x8b\x91%2*8b\x14Zo\x1b:\x1aV=3R;\xd5\x95\x1c\x16M=jM9E"P^P\x15S\n!\x18|\x11Gy\x14\x13' should_pass $'tp[L\x0f;1\r$$\x18#\x0eU\x0b22X\x08\x04S\x16St|#BY\x05\x0f\n1HD>\xcc\x8eV*N\x01To~\xc6\x90{]3\x16' should_pass $'W\x10\r_"\\\x13\x1ag\x17|\x06R\r\n\x19\x0b+\')\x16t:st4^d\'/K2y8S\'=\xcf\xae(\x07\x05Cx\xd7\xbf\x02H/N' should_pass $'O\xdd\xba\x07\x0b\x12\xc7\xbdN!b|.Hr1\xcd\xaa\xd3\x8dkB7yLI\xd4\xa7*piv\x0eS\x0c@bR\xdd\x8frOr\x1cEH\x1b\x05Z=' should_pass $'eQ\xc4\x95\x04\x01\x11.6\\\x05a\xd1\xba|\x0bNz\x14t\x15\xe8\xa0\x85mx\x03g\x03p$\x11Bp2\x02,]!O\xcd\x80M\x07:X\x1cc\x15#' should_pass $'\x16Z\x18Of*\x1a;\x07\x03\xef\x9a\xa2\r]\xc3\x98^jH+GE\xdb\x9cb1\x1b?\x1b\xd7\x92?\x03Z_\x049\xce\x9c\x1f\xe2\xa1\xb4\x10\xda\xa1\x17*,' should_pass $'aMX\x0e"_H\xd1\x96\'\x02W\x7flopB\xe3\xae\x99JGM}' should_pass $'2={j\r\t\x16-)\x1bCZ\xd6\x98\xe4\xa0\x9c\x17.OY\x04M/\x1f=)\xed\x91\xac!n\x1bk\x1fi}#vbJY\xdc\x89hvG\t0\n' should_pass $'znW6Nm\xcc\x8d\x02{$\x14\xce\x93T-[\xe4\xa3\xa4Cm?>\x1fo\x04c(X_\x07J\x1b\xe2\xb9\xb78\x04\x1cb' should_pass $'\x10\x11Y\x16p\xdd\x91\x19\x15q<6ZD\x1bX.\xd2\xa1"QmyAJ\x03\x0e/\x18\x13rXd(\x18G\x1b\xc8\xbaPG\x0b)1\x05Es;\x0bl' should_pass $'\x1f\r!IM\xc7\xbdydf\x12\xd3\x81C$z\x02\x12^2\x02x\xc5\xa31\n\x17\xdf\xae\x08\t$vd\x0e\x0b\x06xQ./r#\xea\xa9\xa5;ff?' should_pass $'\x1f\x17KV*\x05;%\xdd\x98\x06R\r[\x1c+n\xd6\x95cx\xec\x9d\x9d\xe6\x84\x94\x10+R>\xc7\x93\x7f\x7fIE]A\x1a#?\x15\x15`\x0e1\x02\x18\x18' should_pass $'\x08\xd9\x85\xc8\xb8\x13S2|s\x1e\nl.?\nHq-\x01U"RoEnL\x19l\xc7\x85\xd3\x99' should_pass $'Sfu\xd3\xba\x05l\x05Hm__^PfI\x04a\n.\xdd\x8dml\xcd\x96Bp\x16O,1\xd0\x83)ZF\x04\x03&\xd3\x8d>*\x1d/2\x17y%' should_pass $'\x031f\x17h\x14$B.7K\xc2\x96*xk^\x02s.N?\xea\x97\x94\x0bl\xe5\x84\x98^i\x06>\xd3\xa9}a8\\Q@S\x0f\x15\x1fI&;Q' should_pass $'\xf1\x9e\xad\xab`\xc8\xa1\x04F;\x7f`X\x17\x1d8&L-\x01"J4r\x11\xc7\x99\xdd\xb4x|o\t\x106"G4ef\xd0\x94XG9\xec\xae\xb3\x17+' should_pass $'CXYT\xc5\x85A\xd7\xb8\x06"\x1e\x1f(\xd6\xb0U\xcf\xb1tg\xc9\x87\x1bC\x03uW\x14\x1a\x17\x04^.\xc2\x87V\x14\xde\x97\x01\x08J|e\xdf\xbd\xd0\x97;' should_pass $'\'\x06`O^x""b!S\xca\xa3TE\x07\x06O7gR\x7f6B\x06Uw\x1e\x0c7 \x0cCl9\x0e\x06+\x1ah2b\x02\x04t:0\x17F\x03x%Ct\x1bq4\x0bsFFL\x15Y\xcc\xb8' should_pass $' \xc7\x85 G?H\x017\r\x1aepp|9p}S\x11Q\x14JMm<\\\x7f\x7f?=\xda\xbd\x11\x7fI,\x07\x0csH,\xe5\xb5\xa9:A^\x0cR' should_pass $'jdYi\x11Y\xee\x8d\xb6`_#yq\x16U1\x1dHk\x11*u\x1bP\x0fl;{Cx4\x0elY9\x06\x17I\xc5\x80Un\t\x1b;b\x08\xcb\xbce=_\x19{k' should_pass $'M\x0c\x1dDLFwA_L\xe1\x99\x93\x04K\x1b<6\x7f\x16\x0c\x15|Q\x12@\x0b0+M\xc3\xa2\x1a!\xcc\x95S\x18}l\x13\xdf\xab\xce\x8bF4:8M' should_pass $':\x1eZ\xc7\xa1aB6(g4\xd1\xbaR\xd8\x8fV q\x10;. }2\x05n\xd0\xb8}\x19xmo?\xca\xbf5y\x1et4w\x0fp\xcb\x94\xe6\xa0\xa7' should_pass $'o\x13Fqd\xd6\x94\x07\x11\x0eu6n\xf4\x85\xb4\x88Zm\x15++\\\xe5\x9e\x81m\x173?\xdd\xbb\xdd\xb8h\xd5\x80%Y& \x0f\xcf\xb5\x01*\x02\xe2\xaa\xb3' should_pass $'\xc4\x84\xde\xb2\x0b\tkY\xdb\x8b>\xe1\xa2\x93uj\xd4\x90RZ\xdb\x85\t\x1e\n\x07$W^?}O\x14rr0%eX*I\x121.^VmBin' should_pass $'`?Gq\xd1\x88C|\x0e\x02\x1d\x11~A\xc7\xaeg6,`BeM\x1dd\x11|)\x18\nU"\xd5\xbeu\x7fr^lT<}.,\x0f\xf3\x92\x85\x8a8' should_pass $'\x0c8d\t=16\\B3Ca"vW6\xd7\x9baE\x1e\x19-\x1ba574\x11Tlco\xcc\xa54[zA`7\xcf\xb9^mL<#N\x18' should_pass $'c\xdf\x92W\x17WJG%Jh\xdd\x9aK?^b\x1e.:h~%B\x0bZ5\tY\x0b:1\x01=z#;ddh\x02\x0cKaG/5FR$' should_pass $'o{tK[9\x02h=xs\xdd\xb2Qs`HCT!E\x07bE~\xd8\x84\xce\xa1,Bt)\x7fv\xe6\x88\x98\x1d\x10m|p5;WWm\x0c\x18' should_pass $'\x1c\x01w=#\x1b(7.\x0e\xe8\xa2\x97I\x11\x7f\x1a\x0bW{\x0f.\x1e-h/\x11EJ\x02<:F8\xdd\xb7\x1d.\x19\x01\x1buW*#rH\xc8\xb5x' should_pass $'F&\x17o\x15~PQ]U\xf3\xbb\x99\xa9\xe6\x9f\xa2>_86`\x02#\x0e\x03\xd9\xbe\xcc\x863c\xd2\x93\x1b\xc4\x97"\x16\n\x11+e\xd4\x9dh-\x7fE;' should_pass $'<*W?B\xd4\xa18B\x13\x063[\xd9\x8eW4\xee\x9b\x83H0_$\x15i\x03\x1a\x188X\xe2\x9e\xbf\x1e\x16T\xee\x88\xa6\x1d3H\x15e-& at' should_pass $'"n]\xda\x9c)-QVU\xcc\x94zr)<\tB\x18\x14[\xc5\x82\xd1\x9d=~0\xd1\x9b\x1d\t,\x16\x11\xd0\x9dP\x10f\x1d \xcf\x96zI>\xe4\x99\x98' should_pass $'\x1370\x08c\x06\x7f\x1aV~EgJy?\x0e]zl!oD\x11\xd3\xbeC\x7f\r\x04m:\x1bs"}\x17p]J#CDI\x0c\x17#\x03\x10Dj' should_pass $'%h\x0e\x19u?\x0bjKfO\xe7\x91\x97YM\xf0\x95\xb8\xab\xde\xa3!c\xe1\xaa\x8a\x1aX+\xd1\x9a\xd2\x84\xdb\xaaj>88z\x17K\x01\x15{5{(m' should_pass $'\xde\xacz)\xd5\xb6o\x10JQI!v1LnDA\x1aTDL5c}\x15\x10>9t"r\xdf\x83N+uh!\x118l_\x02z,\x17\x12I\x04' should_pass $'{\rk3P~\xee\x86\xbewK\xed\x97\xba\x05T[ S)v\x1e\x18\x1aN/\xc4\xbdB\x0b?`@$]\x19\xc3\x94\xc6\xa5we\x0efx\xc6\x84p4V' should_pass $'\te\x0fx\x0e\x01\x05]\x1fx\x17k\xe8\x9c\xa6a\x1erP\x1euqkn\x0b\x1b\x07}&hk\x08]RS\t\xdc\xad\xdc\xba\x1dx\x1b=\x01\x0c0\xd4\xa5\x05' should_pass $'\r\x0e\xdf\xbe)S\t/\x18\x0b7I?1#H?\xde\x96\r>\x7ffTIAT9!H\x01\x1ffCoe;\x7f=\t\x1c\x1e\to3"9\x1d:\x07\x1d\x12' should_pass $'.\x12\x1d{`q\x7f\x1fR_B3\x0cT}\x10[;vRp/L\x01u`#SX99-\xd1\x96}IM\x15N\x1ehd\x1b)l\x15\xd3\xbba}' should_pass $'>j-\xdb\x9eP\'\xda\xba"vI\x16$1&\x19-SKK\x1e~0\xd5\x8f(j\x17HX4\x15_T9"&bCR^\xd5\xaf\x0cE=\xe8\xb2\x94' should_pass $'\x1d\xce\x8a7w0\xe2\x94\xbbD>\xd2\xbc.\xdf\xba$N\xc9\xa2\\oR&3\x1f/W\xd3\x82[\xe5\x80\xbdT\x08\x13ZHe\x0b\x05!^\xc6\xb85u\x03O' should_pass $'\x03\xd9\x87(r.\x04\x02-F\xdd\xa2]\x03\xd1\x8ea@\xd4\xa5h5;:Y\x1e\x0c35\x07\xdf\xa6#\x1fNC\x15K9mNzO\x0e\x08\xc3\x9f2:Z' should_pass $'^#\x7f;\xd4\xa5eb)\x19%f\x04\x1c%\t\xdb\x991\x04S\x08`0\xdb\x89aCfDpiN\x036Ua8/E&\x16&*b\x1f\x08ub<' should_pass $'9AB\xd7\x95>Je\xdc\xbe\x13\x19f|bj@$\x1fQFM\xec\x83\xaeY\x1f\x11C81|OU:U\xd0\x97\\-\x1bD?Z@[\x12\xdc\x9bO' should_pass $'\x12iqn~\x1fuWVQvr\x7fS=_0~^>Y\xd0\xbe/SqQ\\X "H\x06AQ\x01\x12| ezR\x11\x1f8\xd3\x9e\x1fC<' should_pass $'u\xc7\xb9\x19o\xee\xa1\x81N.\x0eD\x17,;a\x16T\x1eh]"\x0f\x0e2w\'\x07\xd0\x82:L\x12\x13][\xd1\xb6dwh\x01O\x1d>0\xd6\x97~\x17' should_pass $'"|\x12l5\x10)j0\x16!*J\x19#\x017b*^2cI&W\x1b\xe8\xa8\xb59(\x0bG$8^i<\x03_\x07{FZF}\xd1\x8asr}o' should_pass $'\xca\xbcRB\x0cx\xc8\xa0\th5\x04\x02\xeb\x8a\xa2\xd2\x8f1Cu\t\xe4\x86\x84z7zp(\xd0\x95G+\x03?8h\xc4\xb4\x07_8Q\xdc\x87\xe8\xba\xbf\\' should_pass $'Q.7v\x04?\x0cu4\x1eT\x01FE\x0b\x05O\x1d\xc7\xb5n\x1ad-J\x1cwI4EZ\n\xcc\xbf\x14p*o5"n\x08Y3>m\x161R8' should_pass $'\\R\x05/RU0\xcf\x9826?\nxOX5\xca\xbb2fc\x0e\x129xnM\x10;\x12\x1cgN\n-m\n\x19!rK$\xc2\xbdh\x17\x1b \x1a' should_pass $'$=\x16\x1c\'s\x7fn\x1d\rb"r\x13\x0b,A\x06\x12\x182f*Y(\x1c%#`l\x1e`\x15,v.\x19\x13\x11#2V\'O6#Rq=D' should_pass $'g\xd6\x8d9B>\x07\\\x1dF<:\x08\x10\xd2\xae@b\xda\xbd=\x01+\x03^ \xd8\x8eP\x10twK\x06\xc7\x97sV\x14\x133\x16\x15qy@P\nW\x02' should_pass $'mx`k04l\x1a`\x08\x05\x17*=3`/7\x1e\x1eeMA%l9Pb"y\x15\x1c$\x11bps(Sx\xcb\x9f|\x0er}+\xdb\x89\x14' should_pass $'s@.\x1c\n\x07o\n\x19[aB\xd1\x83j|\x0ecUnTi$\xce\x80\xe4\x82\xa2\xd3\xa8\x012)j4\x04^%\xd0\x81t`~>Bc\x02-z\x04' should_pass $'`\x10\x04\x0b\xd8\x96^O\x7f~Z=\x05"\tqA.\xdc\x8f\x1b\x1eR\x1b7\x01YFh\r71\xd6\x99\x08tPl$1\x02\x11]L\x0c|"\xd7\xbfO' should_pass $'E\xcf\xbfS~eREol9Br-kbYf4\x12\x1cc\x1ej>Da4\x13\xd8\xba\x06;g\x14\x1c\xc5\x91%\xd9\xb4-_{#H\x1aQ\xcc\xa4\x18\x03xocnm3CL\n' should_pass $'ZHj("w\x0b\'R$fi\xe5\x91\xa5SE\r\x01\x1dNa`Rod>:"\x1b\xc8\x9c\x04&\xec\xbc\x94q?&\x12\xd9\x81\x0bS\x08 \xd0\x8a\x07' should_pass $'T9FM\xdb\x9c\x1a\x07D>\x18\x02+k.mq5\x15F2i)d%,\x1dI\x0e{|\x08\x01,B\x02h\x15\xc4\x9a2\x14*\x0c\xd2\x9fwm&3' should_pass $'tMmJ[\x05<$s\x04<(\x0fs\x1dD?%7;G\x0fY\xc2\x8f27e\x12\x10\x1d5t[R8hGO]\x19\xdd\xae[C0.a\xdd\xa6' should_pass $'Q]!C\xef\x8b\xb5Y\r|O\x02=\xdb\x9f[\x0e\x1e(:_z\x108dk"\x12*A\x0cK\x02\xdc\xa8T\xc9\xa5[\x191]]%PUB!^(' should_pass $'wa9X\x0b-HY]#\x1br\xe2\xae\x9aq[]/Z!.#>\xe9\xb2\xafK\xc3\xa5V\x1c-4\x0bu(:-\x7f\xcb\x99M\x7fV\xcc\x89\xd7\x9f2' should_pass $'$<=tS\x12\xe0\xae\x8d\x07Zia\x18k\xcd\xba<\x0f0\tk\x11"~KE]~qI\nF\x0b\x7f\x14"\xcd\xa3_\x05v4(\x10\xdb\x84FPJ\x125]\x17^\xc6\x89' should_pass $'\x0e\xd2\xb7L*2\x7f \xdc\xbc\xd9\xb4n,\x1d\xde\xac?\t \x1f,&HgBOPN@\\MU\x14s\xcf\x9cR\xdb\x85ec\x102`\n\\)\x1aN' should_pass $'\xdf\xaa3oqh\xc5\xb3B\x04Sg\xeb\xa2\xadQ#K\x1f,$I2Wdl\x0b&\x0b)\x7f\x13O=4\x0b=vj/N*K5\xda\x8e\x1f(5h' should_pass $'#t\xe9\xa5\xa7Ue\nDR\x10\xd1\xa3[,t:;E\x06~\x05re\x1d2T-&j`c1!&,(\x01\xcd\x9afM(g\x15"c0@L' should_pass $'p4F(a2\x03&_\x127\x1f=ul\xda\xa1r S<(=\xc7\xb6\xe8\x9e\x80\x160^d$\x1ed>r|\x14\x1e&r\xc2\xa9\xd5\xba#\x1bM\x1bGP\xc2\xb3Gb<\x17\tB\rY*G/7\xd6\x80' should_pass $'\x7f\x10FDn0<\x0c\xdd\x94/8FT(~#\xe5\x94\x9d,A\xea\xb3\x9d?S\x04s\x13{\xc4\x97k\xd7\x9e\xc4\x88D2c\xc6\x9aQ\x1f>1R\x11\xcd\xbd\x10B_le:0[\x0e&:,x$M\xea\xbc\x85B).\x0b:' should_pass $',\xee\xa3\x92r@g\n\t(&{\xc8\x87q\x04\x04TxA\x05\x04)7\x05+ux*\x0b\rJ`#\x01La\x17\x0f\x03y%U\x11\xd1\xa9\x049e9' should_pass $'\x06\x01*F\x14D\xef\x93\xabI\x0f=C{?3j\x02\x15eUL\x0bA\x1b{d\xc5\xbeMn..0\x04\x15\x0fUh\x0e@{S\xc2\xad\x14\x02\x05R`' should_pass $'c\x05\t*|iKr\x10jbH\xd1\x93g\x1ch.\x1c@nFzm\x18i\x11/dW\xd5\xbb3\xd7\x86>Awc|R\x02\x12^br\xee\x8d\xba\x1b' should_pass $'U}.\\w\x19O3\x0c:,\x11\'ked&S<\xc9\xb9+' should_pass $'mV\xd6\xa7J\x03F*U@g\xe7\x9b\x8fq.U\x1e\x02\x11rN\x15\x15/\x03hgIS\x13\xc3\x98<\x0e\xeb\xb5\x96#U;\xdc\xba\t\x0c>\xc8\x81\x0bG' should_pass $'=\x02md\x163<\x04FU&\x18AfR\xdf\xb0L`\x14\xde\x96o7N$3L" \xc4\xa7h\xcc\xa7Cx\x13M\t\xe3\xb6\x88+[h6:\x1c\x08' should_pass $'\x1b?\x16\xe9\xa9\xb5GE\x18i%P}\xdb\xb9S\\^\x04KP\xe6\x89\xb1va;<%dq6\x0e\x15\xc7\x8cp\xd3\x90<\xe1\xaa\x92L49\xf2\xb8\x94\xbc' should_pass $'\xd0\x991\xcc\xbb6?\x12s_5B\n\x0f\xcd\xafm\xd1\xa1@z\xce\x9a\x19\x0bt71p@\x0c\x13\x12]<\xd6\xab\xd1\xbb1}\x1cFyV\x0bv_R[' should_pass $'n_Y+\\\x19\xd6\xb4R\x0cs\xef\x97\x9aBX\x1c\x18BV8_\x165\x14$\x13\xd1\xb0:J\x19%M\rr\nl]>]K$\x0fQY?\x01c<' should_pass $'>m\xd2\xa5cn\xc4\x84/,3\x13v\x088;wR\xdb\xbeX16R\x0b\xda\xa8ogdC\x1eyng\x1az\x03\x14\x0e!r<4p\xf1\xb6\x90\xbe@' should_pass $'M67\x0cg\xd0\x89\x03#h\xce\xab0-aj\x08\xd5\x87k\x17g\x080#l~6\xd8\x89DH\xec\x91\xb8\xca\x96\xd9\x94S\x0b\xd0\xb93Q>(\xd1\x986' should_pass $'~\x0fW\x1b\x05P,-i!`*Sns$\xc5\xbd^=\xc4\xb4(\n\x10|\xc7\x8f7h{fa:\x06x_H^is<\x053s0~\x12{H' should_pass $'m\xd5\x91C\x18&\xcd\xa9"Q\x0cStG`\xc4\xa2\x1b\xd7\x9f_[\\c\xcf\x86jMij\x05JB\x01\x17IG\x12#\x10i\xef\xb6\xa4UT-=N`' should_pass $'\x1buxi\xd3\xa2s\x02\xc2\x86e-ny?\x08+\x0bDwM\xce\x943)"\x10|\x11\n[fM1\x0b#}\x0e%3\'\x1d\x18yk\x12{\x0b\x7f6' should_pass $'qdF+r\x0c\x1cv\x10T+o8\xca\x94f8\x7f\rr~O\xd9\x9c\x10_' should_pass $'J2r0oo0:PB\r:/<\xee\x9c\x91\x1dC)\x19Z\xc8\x89sg\x08}=-;87\x1be\x0b,@>lT\x04+j9bp>t!' should_pass $'jv\x02[dV\xc4\xb1Ocu]\xcd\x86~`9"%9#\xcb\x95\xda\xba}\x17%D\x0cBWUYB\x7f\x1eSeFJW*x\x0c+09t\x1e' should_pass $'P5\n`-2;{\x1e\r}m-\x13\x0b\'\xcf\x82?,\x161\x04\x1a\x05>}6wm"\x10J5\xdb\x89\x0c\x1crBS?-939J\t\x02\x7f' should_pass $'@~5\xe7\xbf\xb1|\xeb\xb0\xb8.\x04\x1e6q\x1b\xdd\x96]%\xc5\x86\x08\x1dvX"o+0%\x02N_vr1{pji\x06\x12\x1ai.e<|\x1d' should_pass $'\x11t\xf2\xa4\xa3\x98\x03# ~C{PdCn\x17WgXz4\x07\xc8\xa9&{Sse\x0c\x0ce]{|\xc9\x8ckp3\xd7\xb4@c%\x19 \x18&' should_pass $'q.\x05\x02\'\xdc\xbf~3Pc@\x0b\x1a\x14\x1d\x1by63\x06*AcA\x0cq\x1dTC\xd7\xac\xde\xac6sQ"\xde\x8d\rf6\xdd\x90\x1b\x05\x11\x05+' should_pass $'u\xdd\x8aI\x7fd\x0cL{{mM+' should_pass $'x i=o\x10\xd5\x84\x07>f+E!\xe4\xab\xaba\x12\x04\xc3\xbbE;1DxeK/\xd2\x8c.\x12\x142C,q$tu\xd1\x8a(\x1d|\x14&6' should_pass $'uW!\xe0\xa2\xa6G>P%\x1b\x0c\xc5\x8cXM\x02\x07o`\xd0\x99!u\x1bv\x15i\\\x1c)-C\x18\x1a<-y~Gx.CO>\xc3\xa5\\*SUwG#\xd7\xa7pme' should_pass $'=r$\x0e~Weq\x13\x13dMH\x13SD5/\x02$7fl\x1a5|_H\xc4\xa4\x0fYq1ap7\x0f+]:\x131\x1ed:0\x0c\x0e-' should_pass $'VV\x17\x08=4b\x15iC\x08Y_sG[\xdd\x950QH\xea\xad\x91b\\\x1cZfr\x1e\x141:1F/\x1eN7g{Nv\x0c\x17>a|\x15' should_pass $'Td\x05A\x16A>f\r{\x04ni4BR2\xec\x8a\x9bA["\x16OgjC\x7f\r\na\\\x19\xc2\x8f\xdc\x9b\x018N!\xcd\x86y\xce\x84\x12T\x11' should_pass $'\x16\x07\r\x1b\xca\x82 &sW\x13\x1fX"&IP\x1d&YLiES2\x19-[^]\x17H\x049%\xf3\x8b\xb7\xa0q?\xd2\xbaz.bj\xee\xb0\x83' should_pass $'W@emy\xc2\xb8cM~\x7f9\x037\xe3\x85\x97jq$8\x17\rv\xd3\xb9brI_/0C^[\x02\x05\'_Yf\x040:\xcd\x95R9*"u\xc7\x8aau(\x10|"' should_pass $'oTj\x1b>\x13i\xd1\xb1\x03Ll\xca\xa3n\x105p\x13i\x15\ncv\\*\xef\x9c\x9e\x0b4Ob{\x10;h\xdb\xa7\x7f`0\x19na\x0e\xd4\xb5\xc8\x8d' should_pass $'\xe2\xb5\xb8"0[\xd7\xa1Y\x06+\x7f\x7f\x1ew\xf2\xb3\xaf\x9c}2%\r\x7fZd\rZVq\x05e\x0e\\\x05\x02wiz^a]\xdc\x88V\xe7\xbf\x83]Y' should_pass $'$ 43:\x02\xe7\xa3\x8a\x0e[?\x07\x1aH4\n-;V3\x1e\xde\xb37\xcd\xba\xd7\x91=sZ\xf3\x81\x92\x92:*l5\x7f\n\x14\x05\rPK p2' should_pass $'GF<:h`g\xe2\xa1\x8aT\x0b!\x06;\xd8\x95\x0bhz\xcc\xbdlFx\x0fz\xe4\xaf\xaer{ybo=dI\xd5\x9f\x18|v\xc5\xa0Q\xea\x86\xa6]' should_pass $'e\xc9\xa0Y4\x02\x05(\x1c6*\xcf\x843l|D\x05cuIHj\xdf\xb44;a\x06s2\x7fl\xdb\x8bot>\nGA[iFD\xde\x808\x1az' should_pass $'\x03|E^\x19\xd1\x95\x17}CrF]\xce\x98!E0\xd5\xac\x03\x12F5_\x07G7bUJz\x18dQ\x1f?\xd0\xbex\t\x06H}I`kD\x1eA' should_pass $'Q\x1a\x0f\xd7\x80\xd9\xa2%nB\x0fEmY\x1a\xd6\xa8\x05\x06T/Dv\xd4\x9a\x1b8\x1b5\x08\xdd\x8f\x02<\x06H\x104=L\xe6\xbb\xb9iT?Y\xd0\xb5>' should_pass $' S\x0b\x0eq)\x18tyx\x0b}UV-\xcd\xb4\x1f\n\xf2\xbf\x97\xa4#Z\x1eM5Cq]\x18s5\t.\x07:j\xc5\xaf\x1dJK\xce\xaa\x0b\x18S' should_pass $'\t)\x14s\xcf\xa1e\x08=xtiD\xe2\xac\x8d-(6s\nP".m\x05P(Sg\x1cA/AT\x15\x18~\x1f\x1f^M\x036e?7;*X' should_pass $'\x05?>\x1cM":\x0f\xc9\xa8;3\x143:xe\x17(u[\x13;$!Pc}kj \x06#I\x03R\x13\x10\x1b"i\x10=r\xd0\x94ypO' should_fail $'n\x84\xaf\xe7\xa3\xb3\x15<\x0c\x9a' should_fail $'D\x05\x8eQ\x1b\nr\x92\xd0\xd7' should_fail $'\xca\xff\x12\xdd\xa7(\x902\x0c\x19' should_fail $'\xadcX\xef\x84\xbd\xdfb\x9en' should_fail $'\x9f\x8b\xbcS\xc2\xe3O\x12i\xce' should_fail $'K\x16;\x13\xe1\x9bA\xdd\xa5\x99' should_fail $'>C\xfc\x9c\xcf\xb2k\x87\nU' should_fail $'\xd0\x1e\x93_\x13g\x90\xaes6' should_fail $'\x86\xbe\xb2\xf9\xeb5\xc7\xfeH*' should_fail $'\x96E\x07\xa6*\xe9\xb6r\x11R' should_fail $'\x08\xf3\xa1bg\xb5\xbe\xd0\x92K' should_fail $'w\xb4\xc2\xcf\xec\xd90\xf4\x1c\x08' should_fail $'\xda\xe8\xa4\x16\x8a\xccr\xb0\xc7\x9e' should_fail $'\x03\xfa\xf5\xdbwI/\x9092' should_fail $'\x9c\xf1\xcdkw\x1a\xc8\xc3*\xb8' should_fail $'5\xbax\x8b\x1e\x85\x10\xc0\xf42' should_fail $'i\xa2\xbazG\xc8l\xd1R\x17' should_fail $'\x97\xc2x\x95\xd1H\x9c%\xca\x98' should_fail $'\xa1\xea\x81^\xf3\xc3qE\xfc\xa1' should_fail $'\xed>\xcc$\xf3\r\xd6\x14\x18\xa5' should_fail $'\xb1%4H\x18.\x92\x80[\xa2' should_fail $'\x05\x80\xa8r\xf3\xf0\xa0z:\xc1' should_fail $'+\rGQ#x\x9d\xd3\xd8\x97' should_fail $'N\x16[\xf7\xbc\x7f\xafn\xf5M' should_fail $'\x19\x9a\xe4\x12\xc1\xd2Wq)w' should_fail $'\x91\xaaP\xa3[\xe5C\xfbR\xf0' should_fail $'\x1c*\x18|60\x8ec\xe4\xb9' should_fail $'\xee\x88\xcd\xe2\xcc\x9a]\xecb\xb8' should_fail $'zJF\xcfr"z?T\xd3' should_fail $'t\xa5\x7f\xe4\xdaiU\x94\xd0z' should_fail $'\xf3\xfeF\xe0\xe4\xf17\xe0\x1a\xd3' should_fail $'\x9e\xb5k~\xefTB\xbep\xfd' should_fail $'\xe17IY\xcd\x93\rl\xb9\xcf' should_fail $'Z\x12,\x04\xbbq\xcfz_@' should_fail $'O^p\xa7)P\x06f"\xea' should_fail $'\xee\x7fW\xb6p\xf4\x80\r)\xee' should_fail $'\x0b\xb4g\xda\x87\x91\x10\xacP\xe5' should_fail $'\x9c\x161\xd1\xb3%\xf8_\t\x9f' should_fail $'\x10&\xd1\x90\xd9m\x13\xcbA\xe5' should_fail $'B\x05?\xba\x08\xc7\x10)\xc5\x10' should_fail $'Dj\xa5\xf2X\xe8\xc2\xf4ij' should_fail $'\xf04\xbf*%\t\x94\xe6\x85\x0c' should_fail $'\xd5\x94\x9c\x17\xc6\x8aH[\xc8\xb5' should_fail $'I\x80w\xf24sz&\x9f\x1f' should_fail $'O\xc6\x06LS\xb5\xd8oEn' should_fail $'\xae\xf06\xeaGi\x81\xceF2' should_fail $'\xcb~\x8c\r\xf6t>\xce\xcd\xb8' should_fail $'\xbd{\xa6\xe2\xaf&7hCe' should_fail $'\x16f\xeb\xfe\xabP\xebyXd' should_fail $'\x1e\xeb\xcb\xefB\x15.y:!' should_fail $'0\xdf\x8b\x02\xee\xa9\x0b\xccb\xe9' should_fail $'B\xbe\x1d\x99\xf4O.\x87\x9b\xa6' should_fail $'o$\xf3\x12\x7f\x01=\xd6\xdc\xd6' should_fail $'r\xf2\x8c\xa7e\xfc\xe0=\xc0Z' should_fail $'$O\x9a2\x1a\x08]\xcbV\x93' should_fail $'H\x0e\xfb\xaf(\x98\x17v\xe7\xd6' should_fail $'\xc2L4\x0eF\xed,x\x93p' should_fail $'\x8e\xc8\xd3\x8baVq\xe3\rG' should_fail $'\xc8]K\x17\xbfMg\xe0KW' should_fail $'jm+\x9b3\xf7\x03\x0e\x82\xff' should_fail $'g{\xa7L\x12]\x01\xd1j\x0f' should_fail $'\xed\xa0\xaap\x0c$\xb3\xb8*\xb1' should_fail $'\xb3\x8b\x95\xb6\x14\xc6\xc9Cy\xcd' should_fail $'\x1f{|\x9a\xf3q\x08%u\xaf' should_fail $'\x1a\\\xbc\xc2\x82^ Ml&' should_fail $'\xe9\xf1r\xef\x83\xcd\xd6\x8ep\xc6' should_fail $'s\xf6"G\x88M5\x9fo\xae' should_fail $'g\xa5\xc2"q\xcc\xe1\x88\xc5\x9f' should_fail $'\xa47\xf3#\x15+\xf6.\xd7\xef' should_fail $'\xac\xd8\x06\xa2\xcd|\r\xca\x0f|' should_fail $'sr\x8e9,:\xc8E\x80m' should_fail $'\xb8\xd5\xc8\x1d\xcfkyP_$' should_fail $'<:a\x94\xaf\x85A,\xcf\xfb' should_fail $'\x1e\xa1\x0e\x18\xe4)\xd97\xd8\x90' should_fail $'\x02\x1d \xd3C\x05\xf2.\xd8\x1f' should_fail $'0\x90G\x98\x88\xee\xe8\x88\xf8\n' should_fail $'\x19)n$\xf4\xb8Rr{\x11' should_fail $'\xf9\x867\xff"\xc4\xc4\xceq\x9a' should_fail $'es\xf0o\xdd\xf2\xf2$\xebr' should_fail $'\xe6\x17\x08\xe6\x06\xa0q\x81\xb1\x81' should_fail $'\xc8\x9e\xdf\xe0w_\x1bG\xceb' should_fail $'M\x8d\xefx\xe2\xf3\x1f\x99,"' should_fail $'x\x9e\xebp\xf1,I\xfc\x02\xf1' should_fail $'\xf6\xd9_\xa6\x8bn\xbaZ|\xc0' should_fail $'4E\xdb\x082\x95C\xb9\xc0^' should_fail $'V\xa0\x04\xdf*K\x8dp\xe1\xbb' should_fail $'\te\xe7v\x045uk\x1c\xf4' should_fail $'?\xb5E\x03\xac\xcb\x8e|\xc6\xc1' should_fail $'\xe7\x16\xd5\x0e\x8f\x83`j\x02\x9e' should_fail $'\xa8\x13\xc8D\x03\xd4\x9e\x93l\xdd' should_fail $'\xd2 \x82\x0c\x17\xff\xab\x8fy3' should_fail $'\x199\x87\xc7\xd7Hy>5\xa6' should_fail $'\xeb\x7ff\xb7\x07@\x12"R6' should_fail $'\x7f\xc3H`\xec2,\xa7\xf2\xc6' should_fail $'\xe6\x13\xf1\x98\x19jm\x8e\x8fE' should_fail $'\xe3\xa9\xd6\xe9\xcf\xbbSEh\xed' should_fail $'\xbbl?=\x11\xa8\x7fS\x97\xc7' should_fail $'y\r\xc49\xb4\x1d9\xef\xff\x9b' should_fail $'F\xca\x04\x91\xb81\\U\x8f ' should_fail $'\xe8\xba1g)\xe8~\xbcIF' should_fail $'\xdf7\xbcPX\x1f\nj\xb7\xfb' should_fail $'\xb6\x16\xb6\x8f\n\xeaC\xc0\n!' should_fail $'\x98\x0b\xc0\x11\x03I,\x05\x81\xa6' should_fail $'\xb3\xeb\xa9\xc8\xfc\xdf\xae\x18Z\xfb' should_fail $'X\xf7a\xdcgQv+Z\xf1' should_fail $'G\x83\xc0w\xb3&C\xbf\x8a\xea' should_fail $'\x1d\x13\xd8Y\xd1\xacz[\xa04' should_fail $'\x15\x1e6\x96\x9f\xca?\xd1\xb6\xd8' should_fail $';\x0bT\xcf\xe4\xe8\xa2\x8e{\x9a' should_fail $'\xb5\x9f\x1b\x13\r\xe3\xe4\xbfWd' should_fail $'\x0b=z#>\xa9\x92\xc0\xe5\xc9' should_fail $'\xce\xad\x7fz\x8f\xa3\xb4\xcc\xdeg' should_fail $'V\x19CCSn\xce\x86\xdea' should_fail $'\xe4#tG\xc74hOT\xe7' should_fail $'09n\x19n\x1c\xb1C\xf8[' should_fail $'\xf0\x8c\xab\xb6+\xe8\xa9\x03\xb2S' should_fail $'2\xcem\xe1\xad\xbf\xca\xdf\xe46' should_fail $'\x8a\x81\xb5*\n:\xa2\x9d[\x9a' should_fail $'\xb0\xd3\xf5YK\x8a\xbbaa ' should_fail $'\x05\xc5\x14\xbf\xf7@_\xea\xf8\xc5' should_fail $'\x82NY\x87\xd66\x1f}=\xe0' should_fail $'\x83\xb7\x99\x11\xc1\xc0T\xb2V\xf4' should_fail $'\xb7\xb2\x16\xa4w\x93\xb3$x\x8b' should_fail $'y\x0b\xd0R\xb1+\xc1ZA\xeb' should_fail $'\xcaK\x17B\xc7\x15\xce\xd0Q\xff' should_fail $'\xb8\x89\x14d\xd2V\xd3w4k' should_fail $'\xa5O\x1e|\xe3Q\xbevR\xc7' should_fail $'\x9fYZ"\xa3t\x81y\xb9\x1f' should_fail $'_\xaf\xdf\x9d\xb3\x94\x13%\x01\xb8' should_fail $'\xeb\xea1\xe8\xff\xe4\xc6n*\x92' should_fail $'P\x19Qw\xcb\tx6\xe5\xdf' should_fail $'\xf1\x80w\xad5Y\x07\xd4\x92\xbc' should_fail $'\xfe\x8b\xa2d\x9c\xa9\xab\\\xc3\x97' should_fail $'\x1a\xe2)\xf6A)\x8a\x9c\xde$' should_fail $'RI1\x89A{g\xcb8\xdb' should_fail $'\x0e\x9b\xdd\xd9vv\xb0~B\x02' should_fail $'\x99\x89y\xb0\xdb\xa3\xe8\xb3[\x9c' should_fail $'\xfa\x82\x86\x88P\xd7\x90\xac\xd1`' should_fail $'\x0c\xb32v\x18mm\x1d\xc7\x90' should_fail $'\x80\x14H\x0fN\x17X\xe2\x14_' should_fail $';\xb5\x9c|\xd7p\xce:\xd7n' should_fail $'\r\xe8\xaap\xad\xf0r\xb6\x0e\xad' should_fail $'\xfc\xcc\x82\xb0\xd73T\xf0u\xa1' should_fail $'!\x90\xd1j7Ob\x1c\x84H' should_fail $'\xae\xd2*\xbc\xbc\x0cY\x9c\xe4+' should_fail $'N\xc2\x83pH\xa2m\x8a<\x98' should_fail $'\xf0~W2BSN\x81\x84\xc5' should_fail $'\xe8\xdb\xdc6\xa62",M\xc4' should_fail $'\xc7)\xf1`\x9c#/\x9d\x8e\x07' should_fail $'\xbc\x0f\xcec\xf5\x99\xd7\xf3\xd5\xc9' should_fail $'\xd1\xe5\x83\x84o-\xbfa\xda2' should_fail $'\xcd\xa2"x\xcdK[\xc2\x95\xa9' should_fail $'\xb3-\t\x13\xdc\xf3\xfb\x1b3\xb4' should_fail $'\xc4\xd4\xe5\x07Jr\xd2#\xe1\xe9' should_fail $'p\x7f\x7fK3\x82`{a\xd9' should_fail $'e\x0b\xfe!\xf0\xff\x06h\xbb\x80' should_fail $'\xec\xfdUt\x8a\x02\xea\xca\xa1\x0c' should_fail $'\xb5\xe0\x01\xd2i\xa5\xe5d\x9bM' should_fail $'D\x0f\xa8\x90\xda\x1d\xa6\xe5\xd9\x9b' should_fail $'\xdc`\x9bG7\xf3\xc2\xeaf\xb3' should_fail $'\x1c\xbd\xc5e\x92\xef$\xb9\x01\x05' should_fail $'(\x8f\x05!b9\nK\xc6\x90' should_fail $'\xf5x\xff\x9e\xb9\xbdN ^\x8a' should_fail $'\xd6\xc5=j\x99\x85b#\xd6\x02' should_fail $'\xd7\xec\rm\xc9 \xbd\x9cp\x91' should_fail $'+m\xf3\x07D\xd8\x01\xf5\xad\xa8' should_fail $'\x9ak\xa4\x9c~\x065E\x1b\xdf' should_fail $'p\x14\xc6\xd3gW\x14\x17\xc4\xbe' should_fail $'\xf0x\x8b\xdel\x98\xdbg\xe3\x95' should_fail $'\xa0\x0b0#\x98\xb2\xebZ\x9eC' should_fail $'\x04M\x85\x96GFO)\xab\xa3' should_fail $'{\xea\xdc\xaaj\xf6\xda\xb8\xae\xad' should_fail $'X\x1c\x15H\xff\xfc\xf9s\xd7a' should_fail $'\xc9\x9e\xbc\xfe\xb3K})\x14K' should_fail $'\x90\x15\x8cMR7\xeb-+\x11' should_fail $'\xeb\x8dq\x8ek3vT\xd4q\xd8\xf5D\x12\x9f' should_fail $'\x88\xd1\xb2\xbd\x08d\xf7\x03\x94\xd9' should_fail $'\xda\x19\xf5\xd8\x80AN\xf0\xfb\xd2' should_fail $'\xe0\xd5\x18\x99h`U+\xd7f' should_fail $'\x15^G\xb39\x0cK\x9b\xb8y' should_fail $'\xce\xf7\x87\x86\\\n>\xbeJe' should_fail $'\xf0\xd0j\xdd\xaf\x1a&y&z' should_fail $'\xd5: M\x01\xd9\xbf\x12Qm' should_fail $'j]\x86\x80\xe2\xf4+\xa5O\xa8' should_fail $'[\xb18\xafx+\xbck\x8e\x8d' should_fail $'\xd4R\xe4\xccF\xdep\x13>\x0f' should_fail $'\xbd\x07\x1d\x96%\n\xc8p\xfew' should_fail $'\xb8?\xd3q\x8c\xd3Y5G\xf0' should_fail $'D\x9f\xff\x8b\xc9f\x8aHn\x81' should_fail $' \xb0\xcfr\xb6\x89\xa3\xbd\xed%' should_fail $'A\xf1\xcc\x06\x08i]\xb5hJ' should_fail $'\x11\xb7\xb2\x10\xf8\xac\xbe\xe6O?' should_fail $'s\xd9HA\xd0\xf6N\x8c\xa9\x11' should_fail $'\x972\xc0\xa9,fM\x19\x82\x97' should_fail $'\xd0\xcb\xe0*\x19\x10\x08\xb7\x02-' should_fail $'\xb4\xc9\xdc\xdd$\xaao\x89(c' should_fail $'\x10\xca\x96\x9eN\x07<\xc74r' should_fail $'2\x8e\x17d\x06\xf6\x044\xf6\\' should_fail $'\xa0Z\xf9)\xa3\xcan\x9f\x1c\xf4' should_fail $'f\xc8DLWd\xfe\x1a\xbd\x81' should_fail $'\x93\x0f8z\xa4\x0f\x86\xcd\xff;' should_fail $'\xee\x8b8`\xceS\xf6\x10\xb4\xd8' should_fail $'[DEB\xde\x9c\xc1\xb3R\xf1' should_fail $'<\x10p\x89\xaaR\x1cW,j' should_fail $']\x06\xe0\x81\xd1\tk\xcf\x18\xd9' should_fail $'\xcd\x1a\xca\xe0,8\xfa\x9d\xb0S' should_fail $'N\x82\xc2\x96|B\xec\xa6\xe4\xbe' should_fail $'\x96\x0c\x17\xc8\xd5\x1b+\xf7Zx' should_fail $'\x8f2G;\xaa\x10_F\xccc' should_fail $'\x92\x8d\x06\xbca\x0e\xd9TY\xa1' should_fail $'\x9ar0\x95^>\xc9\x98}P' should_fail $'\x03jE\xea\xe8\x1e\xe8\xad+c' should_fail $'\xc4\xfa\xf3\xe4\x97|\xff)\x04\x0b' should_fail $'\x94`}+,\x02Z\x94-\x19' should_fail $'\xca\x0e\xc2(T\x17\x15\xab%\x95' should_fail $'&\xfc/D\xe0\\\xd0\xd7\xcf\xed' should_fail $'\x1eL\xd3\xde\x9a{\x02hy\xf0' should_fail $'v\xd6\xc8=Q\n\x07(\xf8E' should_fail $'\xf3\xca\xc1\xc5\xe9\x1a%im\xed' should_fail $';\xf8N\xc0U#\x84C`;' should_fail $')\xa9X\x8c\x82\x07Y`4\xbd' should_fail $'O\xba\xfb\x1f\xddc\x8e\xe7\x8f6' should_fail $'\xa1\xd2\r8\xaf\xec\xb9\x03\xc4*' should_fail $'x\xc8nR\x0c\xb0qT\xd2l' should_fail $'/\xcc\xffb\x98o}\x07\xfb%' should_fail $'\x15\x158w+\xa4\xd7\x0c6@' should_fail $'\x90\x8b\xf8\xc1\xb4\xb7\xc4\xdb=\x13' should_fail $'\xdb\x8a\xb3a\xd7.\xc4\xff\xdaA' should_fail $'l\xec\x11\x8b,>\xf4\xf2\xb8]' should_fail $'\x1a\x92CW\xad\xda\xed\xcb$\xaa' should_fail $'2\xf6\xb8\xba\xc8\xde\x0e\xf0\x8f\xa1' should_fail $'\x9f/\xf3\x1d\xd8Q\x10\xcbg\x07' should_fail $'\xbe\x97\x9az\xd7\r\x14U\x8f\x86' should_fail $'\xa9\xb1\x19\xe1h\x0f\xfc\xaa\xa9u' should_fail $'\xb5s{:\xc22\xab\x81\xa4\xc8' should_fail $'d\x85=\xcd+\x8b\xb8/\xae ' should_fail $'\xcd\x96\x08)]\xa5\x1f\xceK' should_fail $'\xe6XhSR;\xe45OV' should_fail $'g\xcc{\xd2\xb10gZ\xd4$' should_fail $'\xf3\xe8\xac\xe5\x12Z\xfdd\xe7\xe2' should_fail $'E\x10\xef(,\x0b\x02C9\x8a' should_fail $'i\xd6\xf3\xb6\xe9\xca\x12\xcf\x87\x86' should_fail $'Ikx@h\xe4\x90\xec\tC' should_fail $'\xda\xf1\xf7\xd3\xf0\r\x85/\\)' should_fail $'\x9cz\x90\xbcI\x9c\xc0\xaa\x96\xc4' should_fail $'m\xe0\x95j9,U\x05\t\xe8' should_fail $'3\xbc\xff\x91@\x11\x0e\xd9u\x19' should_fail $'\x9a\xbeg\xd8\x8b\xeeY\xb0\xf2\x8f' should_fail $'\xa7\x01t\x99;\x0euL\xa9\x88' should_fail $'\x86\x04{&nL\xb4\x86\x1e\x1f' should_fail $'\x12\x8f\xd3l\xdc\xcc@\x95\xdb.' should_fail $'$)\xb6C\x0e\xf6}\xb0F>' should_fail $'i\xbf\x9a1\xbb\xd54\xff\xfc\x90' should_fail $'D\x16\x10\x05\xdc\xbe\xda?\xe1\xbe' should_fail $'`\xa2\xbe\x1eP\x1a6\xb4\xc0<' should_fail $'}\xbbC\x0c\xc1j\x84$&\xe7' should_fail $'D\xf0*\x8aZ&\x89\x81y\xbe' should_fail $'kK=&\x1c$\xa3\xa6\x05\xe7' should_fail $'\xd7dR\x18\xbbc\x1c@:\x86' should_fail $'\xa2gb\xeaK,q\xd4\xf2\n' should_fail $'b\xbe\xbcCiT\xc4\x11Jp' should_fail $'P\xfem\x18\xce(\xf4\xa2\xf6\xbe' should_fail $'\xda\xd1\x86\xd0?wM\xaa9\\' should_fail $'\xbc#[&\xb2\x81\xe3\xa3\xa6\xd0' should_fail $'\x91\x17\xbf\xc2\x83\xe5i\x15\x07_' should_fail $'Qz8\xb7\t\x87\xed0\x14\xd6' should_fail $'\x90\xd7\x01&y\xb3\x88\xf9\x07\x96' should_fail $'\x99\xa4T\xb3\xe7\xe0Bw\xe9\x18' should_fail $'\x8d\xb6\x83\xedw:dtM\x14' should_fail $'\xb7\x91M\x94\x8d\xdc\x85Z\xf0\xae' should_fail $'9\xa0\xa8$\xce:W\xd5<\xc2' should_fail $',O\xc5\xd8\xfe\t\xcb\xdc\x1e5' should_fail $'\xc7\xd56:\xf7`h\xa1\x95#' should_fail $'\x1c\xcdfP\xcc>\x98*\xf8H' should_fail $'\xfc\x0f\xdb\xc5Ag\n%O\xab' should_fail $'\xb0t>\xfc3M\xf7\x05 c' should_fail $'\xc5\x7f\x99P\xb0\xa4\xa9@O\xca' should_fail $'`T\xc5qB@\x88\x83\xc8\xd4' should_fail $'\xb1\xd0\xa3I0r\xfa3\x0e\xed' should_fail $'\x184\xfd\xb5"\xc4\x14\xbb{/' should_fail $'\x8a\x7fsv\x97\xc3\xd2&`\x1f' should_fail $'\x8a\xf2\xdb\xd3r\xe1&gg*' should_fail $'nR\xcbJM\x18#6L\xfa' should_fail $'\x96G\x0b\x83\xf2\xfaU7\x18\xf5' should_fail $'\xfc\x80|]\xfd3\x86\xc9\x1aQ' should_fail $'\xd1>\xe3@\xb7\x14\xa9\x87P~' should_fail $'\xc6\xa5V\x02:2sD\x0f\xa2' should_fail $'7(\xd6?\xe9\xe4y#\x9f\xbd' should_fail $'=\xf5\x11\xa1(\xba!\xa3\xbb\xa5' should_fail $'\n/\x9a\xff1\x9f\xe2\xed\xc5\xe9' should_fail $'\x19L-\xa8\xe3;P^\xbf\xab' should_fail $'3\x9d\xfb\x0eqM,-\xfaP' should_fail $'\x14m\xee+9F\x99\xb3\xe7\xcd' should_fail $'T\r\xe2\xf6i4\x1a\xadiG' should_fail $'\x14\x84\xa5q\xd4\x94&\x86\x9e\x04' should_fail $'\xc9b\xa1\x84i)\xfdd\xa3\x99' should_fail $'\x1a&\xfc\x81\x1a<\x87\x14\x84\xb5' should_fail $'\\/t\xb3\xcd\x8f,=0u' should_fail $'\xf8\xe0Z\x12\xba\xa9\x99\xd2kK' should_fail $'0\xab~TDg\xe50\x9d5' should_fail $'\xcb\x82\x11\xaf;\xa6i?[(' should_fail $'\xed$\xda\x15h|/\x13\x8e\n' should_fail $'\\+\x11I\xa3u\xbbA\xb7*' should_fail $'\xa1\x87q\xfe\xb7\xf0%\x80\x8d4' should_fail $'7\x83\xa3H2p\xbf\xc2\x0b\x9b' should_fail $'\x10\xf1|\xcda\xf9\xa2NFB' should_fail $'\x01\x9b?\xe7\x1aQ\xf8\xae\xf4\x08' should_fail $'\xd8\xe9\xfb\x91X;kL\xd8T' should_fail $'\xc7\x99\\\xc51\x86\xd4&\xb8\x81' should_fail $'g\xfa\x12\x886\x8e\xdb\x08\xe3\xbe' should_fail $'\xfa\x96\x95\x918\x87\xaeqGv' should_fail $'\xba\x9a\xe3\xdd\xeceD\xbf\xdd\xec' should_fail $'p\\\x83\xfd\xba\t\xb6o\x02\x90' should_fail $'\x0c)\xe4\x94\x96q\x17\xf6\xafX' should_fail $'\xc7w\xb4,\x01\xc7\xe5\xc0\xbb\xa7' should_fail $'\x06\x17T=\xd5\x91\xa3c\xcb\x8b' should_fail $'\x03\xa1m\x14\x863\xd4\xcb\x88\xe7' should_fail $'\x924\xb7,P\x8b\xa6\xbc\xaa\xf4' should_fail $'\xc1\xec\xf5\xf1<\xb5\x15\x0f&\x94' should_fail $'3\xb6\x7f:\x11\x12Gz\x06o' should_fail $'\xbe[\xe8u\x17\xa5\xd0\x0b\x7fN' should_fail $'\x0e\x06\x02n\x1d\xd9\xad!\xa8\x1c' should_fail $'q.:\xd9SpB\xa7\x0e\xbd' should_fail $'\xcfK\xbe\xad\x05|\x01d\xf0\xde' should_fail $'D\xba\xffq\x83uM\x05!B' should_fail $'\xbd~-+\x85\x12\xe8a\x9a6' should_fail $'"G\xb5\xda\xd65T\xb8\xe0\xeb' should_fail $'@\xc4\xce\xfa\x8b\x01\rO\x8c\xe8' should_fail $'}$\x81D"\x86\xcdt\xf8\x89' should_fail $'X\x0f\xe4\x05Sl\xad\xf5P\x1e' should_fail $'\x1a\xb8Qa(\x95\x85#\xb7\xf5' should_fail $'Fq"\xc4\xfaQ\r\x03\x1d\x05' should_fail $'\x1b\x15\xe4nF{\xedm}\x9e' should_fail $'E\x1co\x03\x8b\xfa\x86\x0fA?' should_fail $'\x1c\xa4Kn\xc2D\xd0X\x12\x90' should_fail $'}\xc3A=\x87\xa8&\xcf*\xa8' should_fail $'\xf5F/\t\xe6\xf8\xcbT\x91\xe8' should_fail $'2\xd5\x8fV\x19\xa2$rC+' should_fail $'\x96\x8c\x88\xa0Nv\x95\xac\xe3\xb7' should_fail $'{.\xffG%3\x9dpuV' should_fail $'\x85f\x9bj\xec\xa1o\n]\x99' should_fail $'A\xf8S\x8dk\xc6\xe3\x84\xa3j' should_fail $'&\xe0\x10,*\x97\xeb\x1dW\xb1' should_fail $'Z\xa6\x05Q\xf5\xc0\xf1\xa5GF' should_fail $'\xd1{t\xab\x81\xcd\x8b\x9c\xf1\xef' should_fail $',\x80\xb4\xa29`Z\xf7U\xc7' should_fail $'X\xa9~\xa2B\x1e\xe3\x1b~ ' should_fail $'\xce.a7\xe1\x04\xf7\xb7\xe2\xef' should_fail $'U\xc8\x8eTr\x86\x01\x9e\r\x82' should_fail $'\x0b\x9f\xda\xe6\x1d\xb2\xdbh\xb2\xbb' should_fail $'\x18\xb4\xe1H\xbd\xd8+9\xe6\x95' should_fail $'dV\xc0\xbene\xbc\xca\xb7\xc1' should_fail $'f\xd8H\xcd=\xc9&Fb\x1c' should_fail $'\xfc\xe9\xf8\xe3\xd6\xd9\xb2h\xdb\xb4' should_fail $'\xe1``\x03\x1dt\x8c\x04\x8e\x90' should_fail $'\xbd\xd1P}+\x1d\xb5Z\xa8H\xab\xcb\xecy#' should_fail $'\xec\xec\x95?\x1d\x18mE\x06\x95' should_fail $'\xd24mI\xe4!D\xcfX\xff' should_fail $'qRi\xe5y\xfe\x01\xdfU\xf5' should_fail $'\xa2h\xd2\xc8\x81\xe5R_\x97\xb0' should_fail $'\xf4\x1b\x85<\x81e\xf6m\xc8g' should_fail $'4\x90\xb8J\x98\n\xe0\xe5\xa56' should_fail $'AO\xee\xd6\x0f\xb4\xb1=\xc9\x92' should_fail $'\xec\x06)a\x15.\xb99,\x14' should_fail $'SG\xc5f\xeb\xb8\xe1O\xe5\r' should_fail $'\xfb\xf5\xf4\x88f\x9e\x8d\x08\x19\xea' should_fail $'\xb1(\xd75\x02\x1a\xa3\xcc_\x94' should_fail $'\x90\xfbrI-5\x87\xc1\xed\x02' should_fail $'\xcc\x04\x8b,\x15\xec"\xa2\xc1\x9d' should_fail $'\x97\xefO\x8f\x16[qV\x192' should_fail $'B\x17\xf6\xf7\x95\xf6\x1b\xe6\x9ah' should_fail $'2\x14\x96\xf5+`\xa1\xce\xa4\x10' should_fail $'.E\xcd\xday\r\n\xd8,\\' should_fail $'\x12eb\x8eQ\xebhtI\xf1' should_fail $'R\xf2\x97\x8e\xe6\xa4\xe3\xb2\xb0l' should_fail $'\xaa\x8f\xd6\xf8uvO7\xa2\x9d' should_fail $'\xfc\xcb\xe9\xda\x1eI\xd5#\x97l' should_fail $'\xd9i\x9c\rx\xf7\xb6\xe1\x11\xb2' should_fail $'\x82\x8d#o?A\x19\xdf\xa3\xf3' should_fail $'\xf9\xb1,\x15\x89\x1dy\xb6\xd9\x89' should_fail $'\x07L\x08\x0b\xcb\x02\xb9(0q' should_fail $'\xe1\xa2W\xa1 \x82\xdc\xdc.\xb7' should_fail $'\xbc\x97\xa6=\x84\xd8\xf1\xe8\xd5k' should_fail $'\xde\x1e\xfa\xb7,\x1d\xbb\xb4\xb7\xf8' should_fail $'uS\x83jL\xb1\x08c\xdb\xa3' should_fail $'\xb6\x85Y\xb8\xf8w\xaaK\xe4@' should_fail $'\xa6]\x10f\xae^\x91\x1a\x85+' should_fail $'c\xb7\xc4d\xd5\x98\xfb\x17KQ' should_fail $'\xa7\x89J=\xe0\xe5S\x8bGK' should_fail $'#\xbf3\xc2\xf2\x08N\x17\x9b\xbc' should_fail $'\xfbY\xcd\x01\x97PJ{N\xfa' should_fail $'Qa\x80\xf9\x93\xea\xba\xb6\x86\x93' should_fail $'\x08\x8b$\x8c\xcbhk\xfcY\xbd' should_fail $'\xf6\xdc\x1e\xd4\x9a\xc7\xa7\xbc\x81;' should_fail $'\xd3\x86\xe8\xe8\xb6\n\xe1\xa2\x18\x1c' should_fail $'\x97As\xe7\xdex\xba\x7f\xf8\x08' should_fail $' \xb6qk\xa0\xdc\xbd\x12u\x16' should_fail $'\x0f\x1eu\x06\xf8S\xab\xadk_' should_fail $'\xc7\xd2\xc4C\x80Um\x0e\xc2\x0c' should_fail $'m,\x13a\xf8\x01d\x9f\xa3\x9e' should_fail $'c\xeeD\x93\x1e\x95k\xbbD]' should_fail $'!\x9f\x8bw\xdb\xef\xa5\x9d\x94(' should_fail $'=\x94\xf0\xad\xc6%\x93]v\n' should_fail $'~\x89h\xb6o\x1e\xb82\x13\xe5' should_fail $'a\xb6\x18J\xe5\x9a\xf4\x80\xc0G' should_fail $'0\x90K\x01A\xc0C\x98\xa1S' should_fail $'\xcd\xd1F\x12\x1f\xcb\xe0\x854\xfe' should_fail $'M\x8dKt\x15\xfb!\xa9!j' should_fail $'k\x0b\x8a\xda:k\x84\xf8\xff\xf8' should_fail $'J\x10\xd8\x1aq\xed\x96\r\xd2\xfe' should_fail $'v\xef\x8f\x8d\xd1\x87:l\xb8E' printf "\nAll tests are OK.\n" moreutils-0.66/isutf8.docbook000066400000000000000000000076341412064133500162650ustar00rootroot00000000000000 Lars Wirzenius liw@iki.fi Julien Palard julien@palard.fr isutf8 1 moreutils moreutils isutf8 check whether files are valid UTF-8 isutf8 file DESCRIPTION isutf8 checks whether files are syntactically valid UTF-8. Input is either files named on the command line, or the standard input. Notices about files with invalid UTF-8 are printed to standard output. OPTIONS Print out a help summary. Don't print messages telling which files are invalid UTF-8, merely indicate it with the exit status. Print only the names of files containing invalid UTF-8. Invert the selection: list UTF-8 compatible files. Also print an hexdump-like view of the error and some context. EXIT STATUS If the file is valid UTF-8, the exit status is zero. If the file is not valid UTF-8, or there is some error, the exit status is non-zero. AUTHOR Lars Wirzenius, Julien Palard SEE ALSO utf87 moreutils-0.66/lckdo.c000066400000000000000000000125131412064133500147310ustar00rootroot00000000000000/* lckdo.c: run a program with a lock held, * to prevent multiple processes running in parallel. * Use just like `nice' or `nohup'. * Written by Michael Tokarev * Public domain. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include /* compile with -DUSE_FLOCK to use flock() instead of fcntl() */ #if !defined(USE_FLOCK) && !defined(F_SETLKW) # define USE_FLOCK #endif #ifndef __GNUC__ # ifndef __attribute__ # define __attribute__(x) # endif #endif static char *progname; static void __attribute__((format(printf,3,4))) __attribute__((noreturn)) error(int errnum, int exitcode, const char *fmt, ...) { va_list ap; fprintf(stderr, "%s: ", progname); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); if (errnum) fprintf(stderr, ": %s\n", strerror(errnum)); else fputs("\n", stderr); exit(exitcode); } static const char *lckfile; static int quiet; static void sigalarm(int sig) { if (quiet) _exit(EX_TEMPFAIL); error(0, EX_TEMPFAIL, "lock file `%s' is already locked (timeout waiting)", lckfile); } int main(int argc, char **argv) { int fd; int c; int create = O_CREAT; int dofork = 1; int waittime = 0; int shared = 0; int test = 0; int fdn = -1; #ifndef USE_FLOCK struct flock fl; #endif if ((progname = strrchr(argv[0], '/')) == NULL) progname = argv[0]; else argv[0] = ++progname; if (argc == 1) { printf( "%s: execute a program with a lock set.\n" "Usage: %s [options] lockfile program [arguments]\n" "where options are:\n" " -w - if the lock is already held by another process,\n" " wait for it to complete instead of failing immediately\n" " -W sec - the same as -w but wait not more than sec seconds\n" " -e - execute the program directly, no fork/wait\n" " (keeps extra open file descriptor)\n" " -E nnn - set the fd# to keep open in -e case (implies -e)\n" " -n - do not create the lock file if it does not exist\n" " -q - produce no output if lock is already held\n" " -s - lock in shared (read) mode\n" " -x - lock in exclusive (write) mode (default)\n" " -t - test for lock existence" #ifndef USE_FLOCK " (just prints pid if any with -q)\n" #endif " (implies -n)\n" , progname, progname); return 0; } while ((c = getopt(argc, argv, "+wW:neE:sxtq")) != EOF) { switch(c) { case 'w': if (!waittime) waittime = -1; break; case 'W': if ((waittime = atoi(optarg)) < 1) error(0, EX_USAGE, "invalid wait time `%s'", optarg); break; case 't': test = 1; /* fall thru */ case 'n': create = 0; break; case 'E': if ((fdn = atoi(optarg)) < 0 || fdn == 2) error(0, EX_USAGE, "invalid fd# `%s'", optarg); /* fall thru */ case 'e': dofork = 0; break; case 's': shared = 1; break; case 'x': shared = 0; break; case 'q': quiet = 1; break; default: return EX_USAGE; } } argc -= optind; argv += optind; if (!argc || (!test && argc < 2)) error(0, EX_USAGE, "too few arguments given"); lckfile = *argv++; #ifdef USE_FLOCK create |= O_RDONLY; #else if (!test) create |= shared ? O_RDONLY : O_WRONLY; #endif fd = open(lckfile, create, 0666); if (fd < 0) { if (test && errno == ENOENT) { if (!quiet) printf("lockfile `%s' is not locked\n", lckfile); return 0; } error(errno, EX_CANTCREAT, "unable to open `%s'", lckfile); } if (!test && fdn >= 0) { /* dup it early to comply with stupid POSIX fcntl locking * semantics */ if (dup2(fd, fdn) < 0) error(errno, EX_OSERR, "dup2(%d,%d) failed", fd, fdn); close(fd); fd = fdn; } if (test) waittime = 0; else if (waittime > 0) { alarm(waittime); signal(SIGALRM, sigalarm); } #ifdef USE_FLOCK c = flock(fd, (shared ? LOCK_SH : LOCK_EX) | (waittime ? 0 : LOCK_NB)); if (test && c < 0 && (errno == EWOULDBLOCK || errno == EAGAIN || errno == EACCES)) { if (!quiet) printf("lockfile `%s' is locked\n", lckfile); else printf("locked\n"); return EX_TEMPFAIL; } #else memset(&fl, 0, sizeof(fl)); fl.l_type = shared ? F_RDLCK : F_WRLCK; c = fcntl(fd, test ? F_GETLK : waittime ? F_SETLKW : F_SETLK, &fl); if (test && c == 0) { if (fl.l_type == F_UNLCK) { if (!quiet) printf("lockfile `%s' is not locked\n", lckfile); return 0; } if (!quiet) printf("lockfile `%s' is locked by process %d\n", lckfile, fl.l_pid); else printf("%d\n", fl.l_pid); return EX_TEMPFAIL; } #endif if (waittime > 0) alarm(0); if (c < 0) { if (errno != EWOULDBLOCK && errno != EAGAIN && errno != EACCES) error(errno, EX_OSERR, "unable to lock `%s'", lckfile); else if (quiet) return EX_TEMPFAIL; else error(0, EX_TEMPFAIL, "lockfile `%s' is already locked", lckfile); } if (dofork) { pid_t pid; int flags = fcntl(fd, F_GETFD, 0); if (flags < 0) error(errno, EX_OSERR, "fcntl() failed"); fcntl(fd, F_SETFD, flags | FD_CLOEXEC); pid = fork(); if (pid < 0) error(errno, EX_OSERR, "unable to fork"); else if (pid) { if (wait(&c) < 0) error(errno, EX_OSERR, "wait() failed"); if (WIFSIGNALED(c)) error(0, EX_SOFTWARE, "%s: %s", *argv, strsignal(WTERMSIG(c))); return WEXITSTATUS(c); } } execvp(*argv, argv); error(errno, EX_OSERR, "unable to execute %s", *argv); } moreutils-0.66/lckdo.docbook000066400000000000000000000070651412064133500161350ustar00rootroot00000000000000
mjt@tls.msk.ru
Michael Tokarev 2007-08-15
lckdo 1 moreutils moreutils lckdo run a program with a lock held lckdo options lockfile program arguments DESCRIPTION lckdo runs a program with a lock held, in order to prevent multiple processes from running in parallel. Use just like nice or nohup. Now that util-linux contains a similar command named flock, lckdo is deprecated, and will be removed from some future version of moreutils. OPTIONS If the lock is already held by another process, wait for it to complete instead of failing immediately. The same as -w but wait not more than sec seconds. Execute the program directly without forking and waiting (keeps an extra file descriptor open). Set the file descriptor number to keep open when exec()ing (implies -e). Do not create the lock file if it does not exist. Produce no output if lock is already held. Lock in shared (read) mode. Lock in exclusive (write) mode (default). Test for lock existence. EXIT STATUS If the lock was successfully acquired, the return value is that of the program invoked by lckdo. If the lock couldn't be acquired, EX_TEMPFAIL is returned. If there was a problem opening/creating or locking the lock file, EX_CANTCREAT or EX_OSERR will be returned. AUTHOR Michael Tokarev
moreutils-0.66/mispipe.c000066400000000000000000000132361412064133500153060ustar00rootroot00000000000000/* * mispipe: written by Nathanael Nerode. * * Copyright 2004 Nathanael Nerode. * * Licensed under the GPL version 2 or above, and dual-licensed under the * following license: * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /* * Usage: mispipe * Run | , but return with the exit status of . * * This is designed for a very specific purpose: logging. * "foo | logger -t foo" * will return with the exit status of logger, not that of foo. * "mispipe foo 'logger -t foo'" * will return with the exit status of foo. */ /* * To do: * Make this into a fancy, internationalized, option-handling hellbeast. * (But why bother? It does its job quite well.) */ #include /* errno */ #include #include /* pipe(), fork(),... */ #include /* system() */ #include /* waitpid(), etc. */ #include #include /* va_list, for error() */ static const char* progname; /* Stores argv[0] */ static int filedes[2]; /* Stores pipe file descriptors */ /* Subroutine for 'warning' and 'error' which prefixes progname */ static void warning_prefix(void) { fputs(progname, stderr); fputs(": ", stderr); } /* Issue a warning, then die */ __attribute__(( noreturn, format (printf, 1, 2) )) static void error(const char* formatstr, ...) { va_list ap; va_start(ap, formatstr); warning_prefix(); vfprintf(stderr, formatstr, ap); va_end(ap); exit(1); } /* Issue a warning, then die, with errno */ __attribute__(( noreturn )) static void error_with_errno(const char* message) { int saved_errno; saved_errno=errno; warning_prefix(); fputs(message, stderr); fputs(": error number ", stderr); fprintf(stderr, "%i\n", saved_errno); exit(1); } /* Convert 'wait'/'system'-style exit status to 'exit'-style exit status */ __attribute__(( const )) static int shorten_status(int status_big) { if (WIFEXITED(status_big)) return WEXITSTATUS(status_big); if (WIFSIGNALED(status_big)) return 128+WTERMSIG(status_big); if (WIFSTOPPED(status_big)) return 128+WSTOPSIG(status_big); #ifdef WCOREDUMP if (WCOREDUMP(status_big)) error("Ow, somebody dumped core!"); #endif error("shorten_status got an invalid status (?!)"); } /* All the work for command 2. */ __attribute__(( noreturn )) static void subprocess2(const char* cmd) { /* Close the old standard input. */ if (close(0)) error_with_errno("Failed (in child) closing standard input"); /* Make the reading end of the pipe the new standard input. */ if (dup2(filedes[0], 0) == -1) error_with_errno("Failed (in child) redefining standard input"); /* Close the original file descriptor for it */ if (close(filedes[0])) error_with_errno("Failed (in child) closing filedes[0]"); /* Close the other end of the pipe. */ if (close(filedes[1])) error_with_errno("Failed (in child) closing filedes[1]"); /* Do the second command, and throw away the exit status. */ if (system(cmd)) {} /* Close the standard input. */ if (close(0)) error_with_errno("Failed (in child) closing standard output " " (while cleaning up)"); exit(0); } int main (int argc, const char ** argv) { int status_big; /* Exit status, 'wait' and 'system' style */ pid_t child2_pid; pid_t dead_pid; /* Set progname */ progname = argv[0]; /* Verify arguments */ if (argc != 3) error("Wrong number of args, aborting\n"); /* Open a new pipe */ if (pipe(filedes)) error_with_errno("pipe() failed"); /* Fork to run second command */ child2_pid = fork(); if (child2_pid == 0) subprocess2(argv[2]); if (child2_pid == -1) error_with_errno("fork() failed"); /* Run first command inline (seriously!) */ /* Close standard output. */ if (close(1)) error_with_errno("Failed closing standard output"); /* Make the writing end of the pipe the new standard output. */ if (dup2(filedes[1], 1) == -1) error_with_errno("Failed redefining standard output"); /* Close the original file descriptor for it. */ if (close(filedes[1])) error_with_errno("Failed closing filedes[1]"); /* Close the other end of the pipe. */ if (close(filedes[0])) error_with_errno("Failed closing filedes[0]"); /* Do the first command, and (crucially) get the status. */ status_big = system(argv[1]); /* Close standard output. */ if (close(1)) error_with_errno("Failed closing standard output (while cleaning up)"); /* Wait for the other process to exit. */ /* We don't care about the status. */ dead_pid = waitpid(child2_pid, NULL, WUNTRACED); if (dead_pid == -1) { error_with_errno("waitpid() failed"); } else if (dead_pid != child2_pid) { error("waitpid(): Who died? %i\n", dead_pid); } /* Return the desired exit status. */ return shorten_status(status_big); } moreutils-0.66/mispipe.docbook000066400000000000000000000050061412064133500165000ustar00rootroot00000000000000
neroden@fastmail.fm
Nathanael Nerode 2006-09-07
mispipe 1 moreutils moreutils mispipe pipe two commands, returning the exit status of the first mispipe "command1" "command2" DESCRIPTION mispipe pipes two commands together like the shell does, but unlike piping in the shell, which returns the exit status of the last command; when using mispipe, the exit status of the first command is returned. Note that some shells, notably bash, do offer a pipefail option, however, that option does not behave the same since it makes a failure of any command in the pipeline be returned, not just the exit status of the first. EXIT STATUS The exit status of the first command. If the process terminated abnormally (due to a signal), 128 will be added to its exit status. AUTHOR Nathanael Nerode
moreutils-0.66/parallel.c000066400000000000000000000207611412064133500154350ustar00rootroot00000000000000/* * parallel.c - run commands in parallel until you run out of commands * * Copyright © 2008 Tollef Fog Heen * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef __sun # include /* getloadavg() */ #endif #if !defined(WEXITED) #define WEXITED 0 #endif static pid_t pipe_child_stdout = 0; static pid_t pipe_child_stderr = 0; void usage() { printf("parallel [OPTIONS] command -- arguments\n\tfor each argument, " "run command with argument, in parallel\n"); printf("parallel [OPTIONS] -- commands\n\trun specified commands in parallel\n"); exit(1); } static void redirect(int fd, int target_fd, const char *name) { if (fd == target_fd) return; if (dup2(fd, target_fd) < 0) { fprintf(stderr, "unable to open %s from internal pipe: %s\n", name, strerror(errno)); exit(1); } close(fd); } void exec_child(char **command, char **arguments, int replace_cb, int nargs, int stdout_fd, int stderr_fd) { if (fork() != 0) { return; } redirect(stdout_fd, 1, "stdout"); redirect(stderr_fd, 2, "stderr"); if (command[0]) { char **argv; int argc = 0; int i; char *s; while (command[argc] != 0) { argc++; } if (! replace_cb) argc++; argv = calloc(sizeof(char*), argc + nargs); for (i = 0; i < argc; i++) { while (replace_cb && (s=strstr(command[i], "{}"))) { char *buf=malloc(strlen(command[i]) + strlen(arguments[0])); s[0]='\0'; sprintf(buf, "%s%s%s", command[i], arguments[0], s+2); command[i]=buf; } argv[i] = command[i]; } if (! replace_cb) memcpy(argv + i - 1, arguments, nargs * sizeof(char *)); execvp(argv[0], argv); exit(1); } else { int ret=system(arguments[0]); if (WIFEXITED(ret)) { exit(WEXITSTATUS(ret)); } else { exit(1); } } return; } #if defined(__CYGWIN__) typedef enum { P_ALL, P_PID, P_PGID } idtype_t; int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options) { pid_t pid; switch (idtype) { case P_PID: pid = id; break; case P_PGID: pid = -id; break; case P_ALL: pid = -1; break; default: errno = EINVAL; return -1; } int status; pid = waitpid(pid, &status, WEXITED | options); if (pid == -1) { return -1; } infop->si_pid = pid; infop->si_signo = SIGCHLD; if (WIFEXITED(status)) { infop->si_code = CLD_EXITED; infop->si_status = WEXITSTATUS(status); } else if (WIFSIGNALED(status)) { infop->si_code = CLD_KILLED; infop->si_status = WTERMSIG(status); #ifdef WCOREDUMP if (WCOREDUMP(status)) { infop->si_code = CLD_DUMPED; } #endif } else if (WIFSTOPPED(status)) { infop->si_code = CLD_STOPPED; infop->si_status = WSTOPSIG(status); } else if (WIFCONTINUED(status)) { infop->si_code = CLD_CONTINUED; infop->si_status = SIGCONT; } return 0; } #endif int wait_for_child(int options) { id_t id_ignored = 0; siginfo_t infop; infop.si_pid = 0; waitid(P_ALL, id_ignored, &infop, WEXITED | options); if (infop.si_pid == 0) { return -1; /* Nothing to wait for */ } if (infop.si_code == CLD_EXITED) { return infop.si_status; } return 1; } static int pipe_child(int fd, int orig_fd) { const char *fd_info = (orig_fd == 1) ? "out" : "err"; char buf[4096]; int r; while ((r = read(fd, buf, sizeof(buf))) >= 0) { int w; int len; len = r; do { w = write(orig_fd, buf, len); if (w < 0) { fprintf(stderr, "unable to write to std%s: " "%s\n", fd_info, strerror(errno)); exit(1); } len -= w; } while (len > 0); } fprintf(stderr, "unable to read from std%s: %s\n", fd_info, strerror(errno)); exit(1); } pid_t create_pipe_child(int *fd, int orig_fd) { int fds[2]; pid_t pid; if (pipe(fds)) { fprintf(stderr, "unable to create pipe: %s\n", strerror(errno)); exit(1); } *fd = fds[1]; pid = fork(); if (pid < 0) { fprintf(stderr, "unable to fork: %s\n", strerror(errno)); return pid; } if (pid) { close(fds[0]); return pid; } close(fds[1]); return pipe_child(fds[0], orig_fd); } #if defined(__CYGWIN__) || defined(__UCLIBC__) int getloadavg(double loadavg[], int nelem) { int fd, n, elem; char buf[128]; char const* p = buf; fd = open("/proc/loadavg", O_RDONLY); if (fd == -1) { return -1; } n = read(fd, buf, sizeof(buf)-1); if (close(fd) == -1 || n == -1) { return -1; } buf[n] = '\0'; for (elem = 0; elem < nelem; elem++) { char* end; double d = strtod(p, &end); if (p == end) { break; } loadavg[elem] = d; p = end; } return elem == 0 ? -1 : elem; } #endif int main(int argc, char **argv) { int maxjobs = -1; int curjobs = 0; double maxload = -1; int argsatonce = 1; int opt; char **command = calloc(sizeof(char*), argc); char **arguments = NULL; int argidx = 0; int arglen = 0; int cidx = 0; int returncode = 0; int replace_cb = 0; int stdout_fd = 1; int stderr_fd = 2; char *t; while ((argv[optind] && strcmp(argv[optind], "--") != 0) && (opt = getopt(argc, argv, "+hij:l:n:")) != -1) { switch (opt) { case 'h': usage(); break; case 'i': replace_cb = 1; break; case 'j': errno = 0; maxjobs = strtoul(optarg, &t, 0); if (errno != 0 || (t-optarg) != strlen(optarg)) { fprintf(stderr, "option '%s' is not a number\n", optarg); exit(2); } break; case 'l': errno = 0; maxload = strtod(optarg, &t); if (errno != 0 || (t-optarg) != strlen(optarg)) { fprintf(stderr, "option '%s' is not a number\n", optarg); exit(2); } break; case 'n': errno = 0; argsatonce = strtoul(optarg, &t, 0); if (errno != 0 || argsatonce < 1 || (t-optarg) != strlen(optarg)) { fprintf(stderr, "option '%s' is not a positive number\n", optarg); exit(2); } break; default: /* ’?’ */ usage(); break; } } if (replace_cb && argsatonce > 1) { fprintf(stderr, "options -i and -n are incompatible\n"); exit(2); } if (maxjobs < 0) { #ifdef _SC_NPROCESSORS_ONLN maxjobs = sysconf(_SC_NPROCESSORS_ONLN); #else #warning Cannot autodetect number of CPUS on this system: _SC_NPROCESSORS_ONLN not defined. maxjobs = 1; #endif } while (optind < argc) { if (strcmp(argv[optind], "--") == 0) { int i; optind++; arglen = argc - optind; arguments = calloc(sizeof(char *), arglen); if (! arguments) { exit(1); } for (i = 0; i < arglen; i++) { arguments[i] = strdup(argv[optind + i]); } optind += i; } else { command[cidx] = strdup(argv[optind]); cidx++; } optind++; } if (argsatonce > 1 && ! command[0]) { fprintf(stderr, "option -n cannot be used without a command\n"); exit(2); } pipe_child_stdout = create_pipe_child(&stdout_fd, 1); pipe_child_stderr = create_pipe_child(&stderr_fd, 2); if ((pipe_child_stdout < 0) || (pipe_child_stderr < 0)) exit(1); while (argidx < arglen) { double load; getloadavg(&load, 1); if ((maxjobs == 0 || curjobs < maxjobs) && (maxload < 0 || load < maxload)) { if (argsatonce > arglen - argidx) argsatonce = arglen - argidx; exec_child(command, arguments + argidx, replace_cb, argsatonce, stdout_fd, stderr_fd); argidx += argsatonce; curjobs++; } if (maxjobs == 0 || curjobs == maxjobs) { returncode |= wait_for_child(0); curjobs--; } if (maxload > 0 && load >= maxload) { int r; sleep(1); /* XXX We should have a better * heurestic than this */ r = wait_for_child(WNOHANG); if (r > 0) returncode |= r; if (r != -1) curjobs--; } } while (curjobs > 0) { returncode |= wait_for_child(0); curjobs--; } if (pipe_child_stdout) { kill(pipe_child_stdout, SIGKILL); wait_for_child(0); } if (pipe_child_stderr) { kill(pipe_child_stderr, SIGKILL); wait_for_child(0); } return returncode; } moreutils-0.66/parallel.docbook000066400000000000000000000076301412064133500166330ustar00rootroot00000000000000
id@joeyh.name
Joey Hess 2009-07-02
parallel 1 moreutils moreutils parallel run programs in parallel parallel options command -- argument ... parallel options -- command ... DESCRIPTION parallel runs the specified command, passing it a single one of the specified arguments. This is repeated for each argument. Jobs may be run in parallel. The default is to run one job per CPU. If no command is specified before the --, the commands after it are instead run in parallel. OPTIONS Use to limit the number of jobs that are run at the same time. Wait as needed to avoid starting new jobs when the system's load average is not below the specified limit. Normally the command is passed the argument at the end of its command line. With this option, any instances of "{}" in the command are replaced with the argument. Number of arguments to pass to a command at a time. Default is 1. Incompatible with -i EXAMPLE parallel sh -c "echo hi; sleep 2; echo bye" -- 1 2 3 This runs three subshells that each print a message, delay, and print another message. If your system has multiple CPUs, parallel will run some of the jobs in parallel, which should be clear from the order the messages are output. parallel -j 3 ufraw -o processed -- *.NEF This runs three ufraw processes at the same time until all of the NEF files have been processed. parallel -j 3 -- ls df "echo hi" This runs three independent commands in parallel. EXIT STATUS Its exit status is the combination of the exit statuses of each command ran, ORed together. (Thus, if any one command exits nonzero, parallel as a whole will exit nonzero.) NOTES All output to stdout and stderr is serialised through a corresponding internal pipe, in order to prevent annoying concurrent output behaviour. Note that serialisation is not done on any other file descriptors and file position based access to a nonstandard file descriptor might have unexpected results. AUTHOR Tollef Fog Heen
moreutils-0.66/pee.c000066400000000000000000000045141412064133500144100ustar00rootroot00000000000000#include #include #include #include #include #include #include /* Licensed under the GPL * Copyright (c) Miek Gieben, 2006 */ /* like tee(1), but then connect to other programs using * pipes _and_ output to standard output */ int close_pipes(FILE **p, size_t i) { int ret=EXIT_SUCCESS; size_t j; for (j = 0; j < i; j++) { int r = pclose(p[j]); if (WIFEXITED(r)) ret |= WEXITSTATUS(r); else ret |= 1; } return ret; } int main(int argc, char **argv) { int ignore_write_error = 1; int ignore_sigpipe = 1; size_t i, r; FILE **pipes; int *inactive_pipe; int inactive_pipes = 0; char buf[BUFSIZ]; while(argc > 1) { if (!strcmp(argv[1], "--no-ignore-sigpipe")) { argc--, argv++; ignore_sigpipe = 0; continue; } else if (!strcmp(argv[1], "--ignore-sigpipe")) { argc--, argv++; ignore_sigpipe = 1; continue; } else if (!strcmp(argv[1], "--no-ignore-write-errors")) { argc--, argv++; ignore_write_error = 0; continue; } else if (!strcmp(argv[1], "--ignore-write-errors")) { argc--, argv++; ignore_write_error = 1; continue; } break; } if (ignore_sigpipe && (signal(SIGPIPE, SIG_IGN) == SIG_ERR)) { fprintf(stderr, "Unable to ignore SIGPIPE\n"); exit(EXIT_FAILURE); } pipes = malloc(((argc - 1) * sizeof *pipes)); inactive_pipe = calloc((argc - 1), (sizeof *inactive_pipe)); if (!pipes || !inactive_pipe) exit(EXIT_FAILURE); for (i = 1; i < argc; i++) { pipes[i - 1] = popen(argv[i], "w"); if (!pipes[i - 1]) { fprintf(stderr, "Can not open pipe to '%s\'\n", argv[i]); close_pipes(pipes, argc); exit(EXIT_FAILURE); } setbuf(pipes[i - 1], NULL); } argc--; for (;;) { r = read(STDIN_FILENO, buf, BUFSIZ); /* Interrupted by signal? Try again. */ if (r == -1 && errno == EINTR) continue; /* Other error or EOF. */ if (r < 1) break; for(i = 0; i < argc; i++) { if (inactive_pipe[i]) continue; if (fwrite(buf, sizeof(char), r, pipes[i]) == r) continue; inactive_pipes++; if (!ignore_write_error) fprintf(stderr, "Write error to `%s\'\n", argv[i + 1]); if (!ignore_write_error || (inactive_pipes == argc)) { close_pipes(pipes, argc); exit(EXIT_FAILURE); } inactive_pipe[i] = 1; } } exit(close_pipes(pipes, argc)); } moreutils-0.66/pee.docbook000066400000000000000000000071401412064133500156040ustar00rootroot00000000000000
id@joeyh.name
Joey Hess 2016-12-20
pee 1 moreutils moreutils pee tee standard input to pipes pee --[no-]ignore-sigpipe --[no-]ignore-write-errors "command" DESCRIPTION pee is like tee but for pipes. Each command is run and fed a copy of the standard input. The output of all commands is sent to stdout. Note that while this is similar to tee, a copy of the input is not sent to stdout, like tee does. If that is desired, use pee cat ... OPTIONS Do (not) ignore SIGPIPE. Any command started by pee might cause a SIGPIPE when it exists. If you ignore SIGPIPE, you probably also want to ignore write errors (see below). Ignoring SIGPIPE is the default behaviour. Do (not) ignore write errors. When a command started by pee is no more accepting data via the pipe between itself and pee, a write error occurs in pee. If this error is not ignored, pee is going to terminate all child processes and exists. Ignoring write errors is the default behaviour. SEE ALSO tee1 , pipe7 AUTHOR Miek Gieben
moreutils-0.66/physmem.c000066400000000000000000000162051412064133500153210ustar00rootroot00000000000000/* Calculate the size of physical memory. Copyright (C) 2000, 2001, 2003, 2005, 2006 Free Software Foundation, Inc. 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Paul Eggert. */ #include #if HAVE_SYS_PSTAT_H # include #endif #if HAVE_SYS_SYSMP_H # include #endif #if HAVE_SYS_SYSINFO_H && HAVE_MACHINE_HAL_SYSINFO_H # include # include #endif #if HAVE_SYS_TABLE_H # include #endif #include #if HAVE_SYS_PARAM_H # include #endif #if HAVE_SYS_SYSCTL_H # include #endif #if HAVE_SYS_SYSTEMCFG_H # include #endif #ifdef _WIN32 # define WIN32_LEAN_AND_MEAN # include /* MEMORYSTATUSEX is missing from older windows headers, so define a local replacement. */ typedef struct { DWORD dwLength; DWORD dwMemoryLoad; DWORDLONG ullTotalPhys; DWORDLONG ullAvailPhys; DWORDLONG ullTotalPageFile; DWORDLONG ullAvailPageFile; DWORDLONG ullTotalVirtual; DWORDLONG ullAvailVirtual; DWORDLONG ullAvailExtendedVirtual; } lMEMORYSTATUSEX; typedef WINBOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*); #endif #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) /* Return the total amount of physical memory. */ double physmem_total (void) { #if defined _SC_PHYS_PAGES && defined _SC_PAGESIZE { /* This works on linux-gnu, solaris2 and cygwin. */ double pages = sysconf (_SC_PHYS_PAGES); double pagesize = sysconf (_SC_PAGESIZE); if (0 <= pages && 0 <= pagesize) return pages * pagesize; } #endif #if HAVE_PSTAT_GETSTATIC { /* This works on hpux11. */ struct pst_static pss; if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0)) { double pages = pss.physical_memory; double pagesize = pss.page_size; if (0 <= pages && 0 <= pagesize) return pages * pagesize; } } #endif #if HAVE_SYSMP && defined MP_SAGET && defined MPSA_RMINFO && defined _SC_PAGESIZE { /* This works on irix6. */ struct rminfo realmem; if (sysmp (MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0) { double pagesize = sysconf (_SC_PAGESIZE); double pages = realmem.physmem; if (0 <= pages && 0 <= pagesize) return pages * pagesize; } } #endif #if HAVE_GETSYSINFO && defined GSI_PHYSMEM { /* This works on Tru64 UNIX V4/5. */ int physmem; if (getsysinfo (GSI_PHYSMEM, (caddr_t) &physmem, sizeof (physmem), NULL, NULL, NULL) == 1) { double kbytes = physmem; if (0 <= kbytes) return kbytes * 1024.0; } } #endif #if HAVE_SYSCTL && defined HW_PHYSMEM { /* This works on *bsd and darwin. */ unsigned int physmem; size_t len = sizeof physmem; static int mib[2] = { CTL_HW, HW_PHYSMEM }; if (sysctl (mib, ARRAY_SIZE (mib), &physmem, &len, NULL, 0) == 0 && len == sizeof (physmem)) return (double) physmem; } #endif #if HAVE__SYSTEM_CONFIGURATION /* This works on AIX. */ return _system_configuration.physmem; #endif #if defined _WIN32 { /* this works on windows */ PFN_MS_EX pfnex; HMODULE h = GetModuleHandle ("kernel32.dll"); if (!h) return 0.0; /* Use GlobalMemoryStatusEx if available. */ if ((pfnex = (PFN_MS_EX) GetProcAddress (h, "GlobalMemoryStatusEx"))) { lMEMORYSTATUSEX lms_ex; lms_ex.dwLength = sizeof lms_ex; if (!pfnex (&lms_ex)) return 0.0; return (double) lms_ex.ullTotalPhys; } /* Fall back to GlobalMemoryStatus which is always available. but returns wrong results for physical memory > 4GB. */ else { MEMORYSTATUS ms; GlobalMemoryStatus (&ms); return (double) ms.dwTotalPhys; } } #endif /* Guess 64 MB. It's probably an older host, so guess small. */ return 64 * 1024 * 1024; } /* Return the amount of physical memory available. */ double physmem_available (void) { #if defined _SC_AVPHYS_PAGES && defined _SC_PAGESIZE { /* This works on linux-gnu, solaris2 and cygwin. */ double pages = sysconf (_SC_AVPHYS_PAGES); double pagesize = sysconf (_SC_PAGESIZE); if (0 <= pages && 0 <= pagesize) return pages * pagesize; } #endif #if HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC { /* This works on hpux11. */ struct pst_static pss; struct pst_dynamic psd; if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0) && 0 <= pstat_getdynamic (&psd, sizeof psd, 1, 0)) { double pages = psd.psd_free; double pagesize = pss.page_size; if (0 <= pages && 0 <= pagesize) return pages * pagesize; } } #endif #if HAVE_SYSMP && defined MP_SAGET && defined MPSA_RMINFO && defined _SC_PAGESIZE { /* This works on irix6. */ struct rminfo realmem; if (sysmp (MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0) { double pagesize = sysconf (_SC_PAGESIZE); double pages = realmem.availrmem; if (0 <= pages && 0 <= pagesize) return pages * pagesize; } } #endif #if HAVE_TABLE && defined TBL_VMSTATS { /* This works on Tru64 UNIX V4/5. */ struct tbl_vmstats vmstats; if (table (TBL_VMSTATS, 0, &vmstats, 1, sizeof (vmstats)) == 1) { double pages = vmstats.free_count; double pagesize = vmstats.pagesize; if (0 <= pages && 0 <= pagesize) return pages * pagesize; } } #endif #if HAVE_SYSCTL && defined HW_USERMEM { /* This works on *bsd and darwin. */ unsigned int usermem; size_t len = sizeof usermem; static int mib[2] = { CTL_HW, HW_USERMEM }; if (sysctl (mib, ARRAY_SIZE (mib), &usermem, &len, NULL, 0) == 0 && len == sizeof (usermem)) return (double) usermem; } #endif #if defined _WIN32 { /* this works on windows */ PFN_MS_EX pfnex; HMODULE h = GetModuleHandle ("kernel32.dll"); if (!h) return 0.0; /* Use GlobalMemoryStatusEx if available. */ if ((pfnex = (PFN_MS_EX) GetProcAddress (h, "GlobalMemoryStatusEx"))) { lMEMORYSTATUSEX lms_ex; lms_ex.dwLength = sizeof lms_ex; if (!pfnex (&lms_ex)) return 0.0; return (double) lms_ex.ullAvailPhys; } /* Fall back to GlobalMemoryStatus which is always available. but returns wrong results for physical memory > 4GB */ else { MEMORYSTATUS ms; GlobalMemoryStatus (&ms); return (double) ms.dwAvailPhys; } } #endif /* Guess 25% of physical memory. */ return physmem_total () / 4; } #if DEBUG # include # include int main (void) { printf ("%12.f %12.f\n", physmem_total (), physmem_available ()); exit (0); } #endif /* DEBUG */ /* Local Variables: compile-command: "gcc -DDEBUG -g -O -Wall -W physmem.c" End: */ moreutils-0.66/sponge.c000066400000000000000000000217411412064133500151330ustar00rootroot00000000000000/* * sponge.c - read in all available info from stdin, then output it to * file named on the command line * * Copyright © 2006 Tollef Fog Heen * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * */ #include #include #include #include #include /* MAX() */ #include #include #include #include #include /* SIZE_MAX */ #include #include #include #include "physmem.c" #define BUFF_SIZE 8192 #define MIN_SPONGE_SIZE BUFF_SIZE char *tmpname = NULL; void usage() { printf("sponge [-a] : soak up all input from stdin and write it " "to \n"); exit(0); } /* all the signal stuff copied from gnu sort */ /* The set of signals that are caught. */ static sigset_t caught_signals; /* Critical section status. */ struct cs_status { int valid; // was bool sigset_t sigs; }; /* Enter a critical section. */ static struct cs_status cs_enter (void) { struct cs_status status; status.valid = (sigprocmask(SIG_BLOCK, &caught_signals, &status.sigs) == 0); return status; } /* Leave a critical section. */ static void cs_leave (struct cs_status status) { if (status.valid) { /* Ignore failure when restoring the signal mask. */ sigprocmask(SIG_SETMASK, &status.sigs, NULL); } } static void cleanup () { if (tmpname) { unlink(tmpname); } } static void onexit_cleanup (void) { struct cs_status cs = cs_enter(); cleanup(); cs_leave(cs); } static void sighandler (int sig) { if (! SA_NOCLDSTOP) signal(sig, SIG_IGN); cleanup(); signal(sig, SIG_DFL); raise(sig); } /* taken from coreutils sort */ static size_t default_sponge_size (void) { /* Let MEM be available memory or 1/8 of total memory, whichever is greater. */ double avail = physmem_available(); double total = physmem_total(); double mem = MAX(avail, total / 8); struct rlimit rlimit; /* Let SIZE be MEM, but no more than the maximum object size or system resource limits. Avoid the MIN macro here, as it is not quite right when only one argument is floating point. Don't bother to check for values like RLIM_INFINITY since in practice they are not much less than SIZE_MAX. */ size_t size = SIZE_MAX; if (mem < size) size = mem; if (getrlimit(RLIMIT_DATA, &rlimit) == 0 && rlimit.rlim_cur < size) size = rlimit.rlim_cur; #ifdef RLIMIT_AS if (getrlimit(RLIMIT_AS, &rlimit) == 0 && rlimit.rlim_cur < size) size = rlimit.rlim_cur; #endif /* Leave a large safety margin for the above limits, as failure can occur when they are exceeded. */ size /= 2; #ifdef RLIMIT_RSS /* Leave a 1/16 margin for RSS to leave room for code, stack, etc. Exceeding RSS is not fatal, but can be quite slow. */ if (getrlimit(RLIMIT_RSS, &rlimit) == 0 && rlimit.rlim_cur / 16 * 15 < size) size = rlimit.rlim_cur / 16 * 15; #endif /* Use no less than the minimum. */ return MAX (size, MIN_SPONGE_SIZE); } void trapsignals (void) { ssize_t i = 0; static int const sig[] = { /* The usual suspects. */ SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, #ifdef SIGPOLL SIGPOLL, #endif #ifdef SIGPROF SIGPROF, #endif #ifdef SIGVTALRM SIGVTALRM, #endif #ifdef SIGXCPU SIGXCPU, #endif #ifdef SIGXFSZ SIGXFSZ, #endif }; int nsigs = sizeof(sig) / sizeof(sig[0]); #if SA_NOCLDSTOP struct sigaction act; sigemptyset(&caught_signals); for (i = 0; i < nsigs; i++) { sigaction(sig[i], NULL, &act); if (act.sa_handler != SIG_IGN) sigaddset(&caught_signals, sig[i]); } act.sa_handler = sighandler; act.sa_mask = caught_signals; act.sa_flags = 0; for (i = 0; i < nsigs; i++) if (sigismember(&caught_signals, sig[i])) sigaction(sig[i], &act, NULL); #else for (i = 0; i < nsigs; i++) if (signal(sig[i], SIG_IGN) != SIG_IGN) { signal(sig[i], sighandler); siginterrupt (sig[i], 1); } #endif } static void write_buff_tmp(char* buff, size_t length, FILE *fd) { if (fwrite(buff, length, 1, fd) < 1) { perror("error writing buffer to temporary file"); fclose(fd); exit(1); } } static void write_buff_tmp_finish (char* buff, size_t length, FILE *fd) { if (length) write_buff_tmp(buff, length, fd); if (fflush(fd) != 0) { perror("fflush"); exit(1); } } static void write_buff_out (char* buff, size_t length, FILE *fd) { if (fwrite(buff, length, 1, fd) < 1) { perror("error writing buffer to output file"); fclose(fd); exit(1); } } static void copy_file (FILE *infile, FILE *outfile, char *buf, size_t size) { ssize_t i; while ((i = read(fileno(infile), buf, size)) > 0) { write_buff_out(buf, i, outfile); } if (i == -1) { perror("read file"); fclose(infile); exit(1); } } static void copy_tmpfile (FILE *tmpfile, FILE *outfile, char *buf, size_t size) { if (lseek(fileno(tmpfile), 0, SEEK_SET)) { perror("could to seek to start of file"); fclose(tmpfile); exit(1); } copy_file(tmpfile, outfile, buf, size); if (fclose(tmpfile) != 0) { perror("read temporary file"); exit(1); } if (fclose(outfile) != 0) { perror("error writing buffer to output file"); exit(1); } } FILE *open_tmpfile (void) { struct cs_status cs; int tmpfd; FILE *tmpfile; mode_t mask; char *tmpdir; char const * const template="%s/sponge.XXXXXX"; trapsignals(); cs = cs_enter(); tmpdir = getenv("TMPDIR"); if (tmpdir == NULL) tmpdir = "/tmp"; /* Subtract 2 for `%s' and add 1 for the trailing NULL. */ tmpname=malloc(strlen(tmpdir) + strlen(template) - 2 + 1); if (! tmpname) { perror("failed to allocate memory"); exit(1); } sprintf(tmpname, template, tmpdir); mask=umask(077); tmpfd = mkstemp(tmpname); umask(mask); atexit(onexit_cleanup); // solaris on_exit(onexit_cleanup, 0); cs_leave(cs); if (tmpfd < 0) { perror("mkstemp failed"); exit(1); } tmpfile = fdopen(tmpfd, "w+"); if (! tmpfile) { perror("fdopen"); exit(1); } return tmpfile; } int main (int argc, char **argv) { char *buf, *bufstart, *outname = NULL; size_t bufsize = BUFF_SIZE; size_t bufused = 0; FILE *outfile, *tmpfile = 0; ssize_t i = 0; size_t mem_available = default_sponge_size(); int tmpfile_used=0; int append=0; int opt; while ((opt = getopt(argc, argv, "ha")) != -1) { switch (opt) { case 'h': usage(); break; case 'a': append=1; } } if (optind < argc) outname = argv[optind]; tmpfile = open_tmpfile(); bufstart = buf = malloc(bufsize); if (!buf) { perror("failed to allocate memory"); exit(1); } while ((i = read(0, buf, bufsize - bufused)) > 0) { bufused = bufused+i; if (bufused == bufsize) { if ((bufsize*2) >= mem_available) { write_buff_tmp(bufstart, bufused, tmpfile); bufused = 0; tmpfile_used = 1; } else { bufsize *= 2; bufstart = realloc(bufstart, bufsize); if (!bufstart) { perror("failed to realloc memory"); exit(1); } } } buf = bufstart + bufused; } if (i < 0) { perror("failed to read from stdin"); exit(1); } if (outname) { mode_t mode; struct stat statbuf; int exists = (lstat(outname, &statbuf) == 0); int regfile = exists && S_ISREG(statbuf.st_mode) && ! S_ISLNK(statbuf.st_mode); if (append && regfile) { char *tmpbuf = malloc(bufsize); if (!tmpbuf) { perror("failed to allocate memory"); exit(1); } outfile = fopen(outname, "r"); copy_file(outfile, tmpfile, tmpbuf, bufsize); fclose(outfile); } write_buff_tmp_finish(bufstart, bufused, tmpfile); /* Set temp file mode to match either * the old file mode, or the default file * mode for a newly created file. */ if (exists) { mode = statbuf.st_mode; } else { mode_t mask = umask(0); umask(mask); mode = 0666 & ~mask; } if (chmod(tmpname, mode) != 0) { perror("chmod"); exit(1); } /* If it's a regular file, or does not yet exist, * attempt a fast rename of the temp file. */ if ((regfile || ! exists) && rename(tmpname, outname) == 0) { tmpname=NULL; /* don't try to cleanup tmpname */ } else { /* Fall back to slow copy. */ outfile = fopen(outname, "w"); if (!outfile) { perror("error opening output file"); exit(1); } copy_tmpfile(tmpfile, outfile, bufstart, bufsize); } } else { if (tmpfile_used) { write_buff_tmp_finish(bufstart, bufused, tmpfile); copy_tmpfile(tmpfile, stdout, bufstart, bufsize); } else if (bufused) { /* buffer direct to stdout, no tmpfile */ write_buff_out(bufstart, bufused, stdout); } } return 0; } moreutils-0.66/sponge.docbook000066400000000000000000000054611412064133500163320ustar00rootroot00000000000000 Joey Hess 2006-02-19 sponge 1 moreutils moreutils sponge soak up standard input and write to a file sed '...' file | grep '...' | sponge [-a] file DESCRIPTION sponge reads standard input and writes it out to the specified file. Unlike a shell redirect, sponge soaks up all its input before writing the output file. This allows constructing pipelines that read from and write to the same file. sponge preserves the permissions of the output file if it already exists. When possible, sponge creates or updates the output file atomically by renaming a temp file into place. (This cannot be done if TMPDIR is not in the same filesystem.) If the output file is a special file or symlink, the data will be written to it, non-atomically. If no file is specified, sponge outputs to stdout. OPTIONS Replace the file with a new file that contains the file's original content, with the standard input appended to it. This is done atomically when possible. AUTHOR Colin Watson and Tollef Fog Heen moreutils-0.66/ts000077500000000000000000000110131412064133500140370ustar00rootroot00000000000000#!/usr/bin/perl =head1 NAME ts - timestamp input =head1 SYNOPSIS ts [-r] [-i | -s] [-m] [format] =head1 DESCRIPTION ts adds a timestamp to the beginning of each line of input. The optional format parameter controls how the timestamp is formatted, as used by L. The default format is "%b %d %H:%M:%S". In addition to the regular strftime conversion specifications, "%.S" and "%.s" and "%.T" are like "%S" and "%s" and "%T", but provide subsecond resolution (ie, "30.00001" and "1301682593.00001" and "1:15:30.00001"). If the -r switch is passed, it instead converts existing timestamps in the input to relative times, such as "15m5s ago". Many common timestamp formats are supported. Note that the Time::Duration and Date::Parse perl modules are required for this mode to work. Currently, converting localized dates is not supported. If both -r and a format is passed, the existing timestamps are converted to the specified format. If the -i or -s switch is passed, ts reports incremental timestamps instead of absolute ones. The default format changes to "%H:%M:%S", and "%.S" and "%.s" can be used as well. In case of -i, every timestamp will be the time elapsed since the last timestamp. In case of -s, the time elapsed since start of the program is used. The -m switch makes the system's monotonic clock be used. =head1 ENVIRONMENT The standard TZ environment variable controls what time zone dates are assumed to be in, if a timezone is not specified as part of the date. =head1 AUTHOR Copyright 2006 by Joey Hess Licensed under the GNU GPL. =cut use warnings; use strict; use POSIX q{strftime}; no warnings 'utf8'; $|=1; my $rel=0; my $inc=0; my $sincestart=0; my $mono=0; use Getopt::Long; GetOptions( "r" => \$rel, "i" => \$inc, "s" => \$sincestart, "m" => \$mono ) || die "usage: ts [-r] [-i | -s] [-m] [format]\n"; if ($rel) { eval q{ use Date::Parse; use Time::Duration; }; die $@ if $@; } my $use_format=@ARGV; my $format="%b %d %H:%M:%S"; if ($inc || $sincestart) { $format="%H:%M:%S"; $ENV{TZ}='GMT'; } $format=shift if @ARGV; # For subsecond resolution, Time::HiRes is needed. my $hires=0; if ($format=~/\%\.[SsT]/ || $mono) { require Time::HiRes; use Time::HiRes qw(CLOCK_MONOTONIC); $hires=1; } my $lastseconds = 0; my $lastmicroseconds = 0; my $monodelta; if ($mono) { my $raw_time = Time::HiRes::clock_gettime(CLOCK_MONOTONIC); $lastseconds = time; $lastmicroseconds = int(1000000 * ($raw_time - int($raw_time))); $monodelta = $lastseconds - int($raw_time); } elsif ($hires) { ($lastseconds, $lastmicroseconds) = Time::HiRes::gettimeofday(); } else { $lastseconds = time; } while (<>) { if (! $rel) { if ($hires) { my $f=$format; my $seconds; my $microseconds; if ($mono) { my $raw_time = Time::HiRes::clock_gettime(CLOCK_MONOTONIC) + $monodelta; $seconds = int($raw_time); $microseconds = int(1000000 * ($raw_time - $seconds)); } else { ($seconds, $microseconds) = Time::HiRes::gettimeofday(); } if ($inc || $sincestart) { my $deltaseconds = $seconds - $lastseconds; my $deltamicroseconds = $microseconds - $lastmicroseconds; if ($deltamicroseconds < 0) { $deltaseconds -= 1; $deltamicroseconds += 1000000; } if ($inc) { $lastseconds = $seconds; $lastmicroseconds = $microseconds; } $seconds = $deltaseconds; $microseconds = $deltamicroseconds; } my $s=sprintf("%06i", $microseconds); $f=~s/\%\.([SsT])/%$1.$s/g; print strftime($f, localtime($seconds)); } else { if ($inc || $sincestart) { my $seconds = time; my $deltaseconds = $seconds - $lastseconds; if ($inc) { $lastseconds = $seconds; } print strftime($format, localtime($deltaseconds)); } else { print strftime($format, localtime); } } print " ".$_; } else { s{\b( \d\d[-\s\/]\w\w\w # 21 dec 17:05 (?:\/\d\d+)? # 21 dec/93 17:05 [\s:]\d\d:\d\d # (time part of above) (?::\d\d)? # (optional seconds) (?:\s+[+-]\d\d\d\d)? # (optional timezone) | \w{3}\s+\d{1,2}\s+\d\d:\d\d:\d\d # syslog form | \d\d\d\d[-:]\d\d[-:]\d\dT\d\d:\d\d:\d\d.\d+Z? # ISO-8601 | (?:\w\w\w,?\s+)? # (optional Day) \d+\s+\w\w\w\s+\d\d+\s+\d\d:\d\d:\d\d # 16 Jun 94 07:29:35 (?:\s+\w\w\w|\s[+-]\d\d\d\d)? # (optional timezone) | \w\w\w\s+\w\w\w\s+\d\d\s+\d\d:\d\d # lastlog format )\b }{ $use_format ? strftime($format, localtime(str2time($1))) : concise(ago(time - str2time($1), 2)) }exg; print $_; } } moreutils-0.66/vidir000077500000000000000000000114161412064133500145350ustar00rootroot00000000000000#!/usr/bin/perl =head1 NAME vidir - edit directories and filenames =head1 SYNOPSIS B [B<--verbose>] [I|I|B<->]... =head1 DESCRIPTION B allows editing of directories and filenames in a text editor. If no I is specified, the filenames of the current directory are edited. When editing a directory, each item in the directory will appear on its own numbered line. These numbers are how vidir keeps track of what items are changed. Delete lines to remove files from the directory, or edit filenames to rename files. You can also switch pairs of numbers to swap filenames. Filenames to be edited may be given any combination of Is (which will be expanded to the non-recursive list of all files within I), Is, or I<->. If the latter is specified, B reads a list of filenames from stdin and displays those for editing. =head1 OPTIONS =over 4 =item -v, --verbose Verbosely display the actions taken by the program. =back =head1 EXAMPLES =over 4 =item vidir =item vidir *.jpeg Typical uses. =item find | vidir - Edit subdirectory contents too. To delete subdirectories, delete all their contents and the subdirectory itself in the editor. =item find -type f | vidir - Edit all files under the current directory and subdirectories. =back =head1 ENVIRONMENT VARIABLES =over 4 =item EDITOR Editor to use. =item VISUAL Also supported to determine what editor to use. =back =head1 AUTHOR Copyright 2006 by Joey Hess Licensed under the GNU GPL. =cut use File::Basename; use File::Path qw(make_path); use File::Spec; use File::Temp; use Getopt::Long; my $error=0; my $verbose=0; if (! GetOptions("verbose|v" => \$verbose)) { die "Usage: $0 [--verbose] [directory|file|-]\n"; } my @dir; if (! @ARGV) { push @ARGV, "." } foreach my $item (@ARGV) { if ($item eq "-") { push @dir, map { chomp; $_ } ; close STDIN; open(STDIN, "/dev/tty") || die "reopen: $!\n"; } elsif (-d $item) { $item =~ s{/?$}{/}; opendir(DIR, $item) || die "$0: cannot read $item: $!\n"; push @dir, map { "$item$_" } sort readdir(DIR); closedir DIR; } else { push @dir, $item; } } if (grep(/[[:cntrl:]]/, @dir)) { die "$0: control characters in filenames are not supported\n"; } my $tmp=File::Temp->new(TEMPLATE => "dirXXXXX", DIR => File::Spec->tmpdir); open (OUT, ">".$tmp->filename) || die "$0: cannot create ".$tmp->filename.": $!\n"; my %item; my $c=0; foreach (@dir) { next if /^(.*\/)?\.$/ || /^(.*\/)?\.\.$/; $item{++$c}=$_; print OUT "$c\t$_\n"; } @dir=(); close OUT || die "$0: cannot write ".$tmp->filename.": $!\n"; my @editor="vi"; if (-x "/usr/bin/editor") { @editor="/usr/bin/editor"; } if (exists $ENV{EDITOR}) { @editor=split(' ', $ENV{EDITOR}); } if (exists $ENV{VISUAL}) { @editor=split(' ', $ENV{VISUAL}); } $ret=system(@editor, $tmp); if ($ret != 0) { die "@editor exited nonzero, aborting\n"; } open (IN, $tmp->filename) || die "$0: cannot read ".$tmp->filename.": $!\n"; while () { chomp; if (/^(\d+)\t{0,1}(.*)/) { my $num=int($1); my $name=$2; if (! exists $item{$num}) { die "$0: unknown item number $num\n"; } elsif ($name ne $item{$num}) { next unless length $name; my $src=$item{$num}; my $dir=dirname($name); if (! (-e $src || -l $src) ) { print STDERR "$0: $src does not exist\n"; delete $item{$num}; next; } # deal with swaps if (-e $name || -l $name) { my $tmp=$name."~"; my $c=0; while (-e $tmp || -l $tmp) { $c++; $tmp=$name."~$c"; } if (! rename($name, $tmp)) { print STDERR "$0: failed to rename $name to $tmp: $!\n"; $error=1; } elsif ($verbose) { print "'$name' -> '$tmp'\n"; } foreach my $item (keys %item) { if ($item{$item} eq $name) { $item{$item}=$tmp; } } } if ((! -d $dir) && (! make_path($dir, { verbose => $verbose, }))) { print STDERR "$0: failed to create directory tree $dir: $!\n"; $error=1; } elsif (! rename($src, $name)) { print STDERR "$0: failed to rename $src to $name: $!\n"; $error=1; } else { if (-d $name) { foreach (values %item) { s,^\Q$src\E($|/),$name$1,; } } if ($verbose) { print "'$src' => '$name'\n"; } } } delete $item{$num}; } elsif (/^\s*$/) { # skip empty line } else { die "$0: unable to parse line \"$_\", aborting\n"; } } close IN || die "$0: cannot read ".$tmp->filename.": $!\n"; unlink($tmp.'~') if -e $tmp.'~'; sub rm { my $file = shift; if (-d $file && ! -l $file) { return rmdir $file; } else { return unlink $file; } } foreach my $item (reverse sort values %item) { if (! rm($item)) { print STDERR "$0: failed to remove $item: $!\n"; $error=1; } if ($verbose) { print "removed '$item'\n"; } } exit $error; moreutils-0.66/vipe000077500000000000000000000036701412064133500143660ustar00rootroot00000000000000#!/usr/bin/perl =head1 NAME vipe - edit pipe =head1 SYNOPSIS command1 | vipe | command2 =head1 DESCRIPTION vipe allows you to run your editor in the middle of a unix pipeline and edit the data that is being piped between programs. Your editor will have the full data being piped from command1 loaded into it, and when you close it, that data will be piped into command2. =head1 ARGUMENTS vipe takes an argument --suffix that can be used to provide a file extension to the temp file generated. This enables editors to provide syntax highlighting and activate modes. For example, you can call vipe like vipe --suffix csv to create a tempfile with .csv extensions which makes Emacs (or your favorite editor) launch in CSV major mode. =head1 ENVIRONMENT VARIABLES =over 4 =item EDITOR Editor to use. =item VISUAL Also supported to determine what editor to use. =back =head1 AUTHOR Copyright 2006 by Joey Hess Licensed under the GNU GPL. =cut use warnings; use strict; use File::Temp q{tempfile}; use Getopt::Long; $/=undef; my $suffix = ""; if (! GetOptions("suffix=s" => \$suffix)) { die "Usage: $0 [--suffix=extension]\n"; } $suffix = ".$suffix" if $suffix =~ m/^[^.]/; my ($fh, $tmp)=tempfile(UNLINK => 1, SUFFIX => $suffix); die "cannot create tempfile" unless $fh; if (! -t STDIN) { print ($fh ) || die "write temp: $!"; } close $fh; close STDIN; open(STDIN, "&STDOUT") || die "save stdout: $!"; close STDOUT; open(STDOUT, ">/dev/tty") || die "reopen stdout: $!"; my @editor="vi"; if (-x "/usr/bin/editor") { @editor="/usr/bin/editor"; } if (exists $ENV{EDITOR}) { @editor=split(' ', $ENV{EDITOR}); } if (exists $ENV{VISUAL}) { @editor=split(' ', $ENV{VISUAL}); } my $ret=system(@editor, $tmp); if ($ret != 0) { die "@editor exited nonzero, aborting\n"; } open (IN, $tmp) || die "$0: cannot read $tmp: $!\n"; print (OUT ) || die "write failure: $!"; close IN; moreutils-0.66/zrun000077500000000000000000000047261412064133500144240ustar00rootroot00000000000000#!/usr/bin/perl =head1 NAME zrun - automatically uncompress arguments to command =head1 SYNOPSIS zrun command file.gz [...] =head1 DESCRIPTION Prefixing a shell command with "zrun" causes any compressed files that are arguments of the command to be transparently uncompressed to temp files (not pipes) and the uncompressed files fed to the command. This is a quick way to run a command that does not itself support compressed files, without manually uncompressing the files. The following compression types are supported: gz bz2 Z xz lzma lzo If zrun is linked to some name beginning with z, like zprog, and the link is executed, this is equivalent to executing "zrun prog". =head1 BUGS Modifications to the uncompressed temporary file are not fed back into the input file, so using this as a quick way to make an editor support compressed files won't work. =head1 AUTHOR Copyright 2006 by Chung-chieh Shan =cut use warnings; use strict; use IO::Handle; use File::Spec; use File::Temp qw{tempfile}; my $program; if ($0 =~ m{(?:^|/)z([^/]+)$} && $1 ne 'run') { $program = $1; if (! @ARGV) { die "Usage: z$1 \nEquivalent to: zrun $1 \n"; } } else { $program = shift; if (! @ARGV) { die "Usage: zrun \n"; } } my @argument; my %child; foreach my $argument (@ARGV) { if ($argument =~ m{^(.*/)?([^/]*)\.(gz|Z|bz2|xz|lzo|lzma)$}s) { my $suffix = "-$2"; my @preprocess = $3 eq "bz2" ? qw(bzip2 -d -c) : $3 eq "xz" ? qw(xz -d -c) : $3 eq "lzo" ? qw(lzop -d -c) : $3 eq "lzma" ? qw(lzma -d -c) : qw(gzip -d -c); my ($fh, $tmpname) = tempfile(SUFFIX => $suffix, DIR => File::Spec->tmpdir, UNLINK => 1) or die "zrun: cannot create temporary file: $!\n"; if (my $child = fork) { $child{$child} = $argument; $argument = $tmpname; } elsif (defined $child) { STDOUT->fdopen($fh, "w"); exec @preprocess, $argument; } else { die "zrun: cannot fork to handle $argument: $!\n"; } } push @argument, $argument; } while (%child and (my $pid = wait) != -1) { if (defined(my $argument = delete $child{$pid})) { if ($? & 255) { die "zrun: preprocessing for $argument terminated abnormally: $?\n"; } elsif (my $code = $? >> 8) { die "zrun: preprocessing for $argument terminated with code $code\n"; } } } my $status = system $program ($program, @argument); if ($status & 255) { die "zrun: $program terminated abnormally: $?\n"; } else { my $code = $? >> 8; exit $code; }