lobase

Linux port of OpenBSDs userland.
Log | Files | Refs | README

commit ee1ccaa51bcc3d1df050086bbf8740c2dd165eee
parent ae786c3612374849bcb8fa090ec952e1913b0a39
Author: Duncaen <mail@duncano.de>
Date:   Fri, 19 May 2017 18:54:11 +0200

usr.bin/fmt: update to OPENBSD_6_1

Diffstat:
usr.bin/fmt/fmt.1 | 16++++++++--------
usr.bin/fmt/fmt.c | 100++++++++++++++++++++++++++++++++++++++++++-------------------------------------
2 files changed, 61 insertions(+), 55 deletions(-)

diff --git a/usr.bin/fmt/fmt.1 b/usr.bin/fmt/fmt.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fmt.1,v 1.29 2015/12/15 17:48:16 jmc Exp $ +.\" $OpenBSD: fmt.1,v 1.30 2016/10/24 13:46:58 schwarze Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)fmt.1 8.1 (Berkeley) 6/6/93 .\" -.Dd $Mdocdate: December 15 2015 $ +.Dd $Mdocdate: October 24 2016 $ .Dt FMT 1 .Os .Sh NAME @@ -142,15 +142,15 @@ evening the lines: .Sh ENVIRONMENT .Bl -tag -width LC_CTYPE .It Ev LC_CTYPE -The character set +The character encoding .Xr locale 1 . -It is used to decide which byte sequences form characters and what -their display width is. -If it is unset or set to +It decides which byte sequences form characters +and what their display width is. +If unset or set to .Qq C , .Qq POSIX , -or an unsupported value, each byte except the tab is assumed -to represent a character of display width 1. +or an unsupported value, each byte except the tab +is treated as a character of display width 1. .El .Sh EXIT STATUS .Ex -std diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c @@ -1,4 +1,55 @@ -/* $OpenBSD: fmt.c,v 1.36 2016/01/07 18:02:43 schwarze Exp $ */ +/* $OpenBSD: fmt.c,v 1.38 2017/02/20 15:48:00 schwarze Exp $ */ +/* + * This file is a derived work. + * The changes are covered by the following Copyright and license: + * + * Copyright (c) 2015, 2016 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2000 Paul Janzen <pjanzen@foatdi.net> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * + * The unchanged parts are covered by the following Copyright and license: + * + * Copyright (c) 1997 Gareth McCaughan. All rights reserved. + * + * Redistribution and use of this code, in source or binary forms, + * with or without modification, are permitted subject to the following + * conditions: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - If you distribute modified source code it must also include + * a notice saying that it has been modified, and giving a brief + * description of what changes have been made. + * + * Disclaimer: I am not responsible for the results of using this code. + * If it formats your hard disc, sends obscene messages to + * your boss and kills your children then that's your problem + * not mine. I give absolutely no warranty of any sort as to + * what the program will do, and absolutely refuse to be held + * liable for any consequences of your using it. + * Thank you. Have a nice day. + * + * + * Brief overview of the changes made by OpenBSD: + * Added UTF-8 support (2016). + * Added pledge(2) support (2015). + * ANSI function syntax and KNF (2004). + * Added -w option (2000). + * Some minor changes can be seen in the public OpenBSD CVS repository. + */ /* Sensible version of fmt * @@ -123,51 +174,6 @@ * been tested on my FreeBSD machine. Your mileage may vary. */ -/* Copyright (c) 1997 Gareth McCaughan. All rights reserved. - * - * Redistribution and use of this code, in source or binary forms, - * with or without modification, are permitted subject to the following - * conditions: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - If you distribute modified source code it must also include - * a notice saying that it has been modified, and giving a brief - * description of what changes have been made. - * - * Disclaimer: I am not responsible for the results of using this code. - * If it formats your hard disc, sends obscene messages to - * your boss and kills your children then that's your problem - * not mine. I give absolutely no warranty of any sort as to - * what the program will do, and absolutely refuse to be held - * liable for any consequences of your using it. - * Thank you. Have a nice day. - */ - -/* RCS change log: - * Revision 1.5 1998/03/02 18:02:21 gjm11 - * Minor changes for portability. - * - * Revision 1.4 1997/10/01 11:51:28 gjm11 - * Repair broken indented-paragraph handling. - * Add mail message header stuff. - * Improve comments and layout. - * Make usable with non-BSD systems. - * Add revision display to usage message. - * - * Revision 1.3 1997/09/30 16:24:47 gjm11 - * Add copyright notice, rcsid string and log message. - * - * Revision 1.2 1997/09/30 16:13:39 gjm11 - * Add options: -d <chars>, -l <width>, -p, -s, -t <width>, -h . - * Parse options with `getopt'. Clean up code generally. - * Make comments more accurate. - * - * Revision 1.1 1997/09/30 11:29:57 gjm11 - * Initial revision - */ - #include <ctype.h> #include <err.h> #include <locale.h> @@ -468,7 +474,7 @@ process_stream(FILE *stream, const char *name) tab_width - line_width; else if ((wcw = wcwidth(wc)) == -1) wcw = 1; - if (iswblank(wc)) { + if (iswblank(wc) && wc != 0xa0) { /* Skip whitespace at start of line. */ if (word_length == 0) { wordp += wcl;