From owner-svn-src-all@freebsd.org Tue Nov 19 03:15:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BF2C179E04; Tue, 19 Nov 2019 03:15:07 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47H9tM1p3Gz3QCC; Tue, 19 Nov 2019 03:15:07 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20FC941DB; Tue, 19 Nov 2019 03:15:07 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ3F7qU058218; Tue, 19 Nov 2019 03:15:07 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ3F7dA058217; Tue, 19 Nov 2019 03:15:07 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201911190315.xAJ3F7dA058217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 19 Nov 2019 03:15:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354843 - head/usr.bin/unifdef X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/usr.bin/unifdef X-SVN-Commit-Revision: 354843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 03:15:07 -0000 Author: cem Date: Tue Nov 19 03:15:06 2019 New Revision: 354843 URL: https://svnweb.freebsd.org/changeset/base/354843 Log: unifdef(1): Kill totally useless header No functional change. Deleted: head/usr.bin/unifdef/unifdef.h Modified: head/usr.bin/unifdef/unifdef.c Modified: head/usr.bin/unifdef/unifdef.c ============================================================================== --- head/usr.bin/unifdef/unifdef.c Tue Nov 19 02:11:00 2019 (r354842) +++ head/usr.bin/unifdef/unifdef.c Tue Nov 19 03:15:06 2019 (r354843) @@ -45,8 +45,17 @@ * it possible to handle all "dodgy" directives correctly. */ -#include "unifdef.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + static const char copyright[] = "@(#) $Version: unifdef-2.11 $\n" "@(#) $FreeBSD$\n" @@ -250,6 +259,21 @@ static const char *xstrdup(const char *, const ch #define endsym(c) (!isalnum((unsigned char)c) && c != '_') +static FILE * +mktempmode(char *tmp, int mode) +{ + int rc, fd; + + mode &= (S_IRWXU|S_IRWXG|S_IRWXO); + fd = mkstemp(tmp); + if (fd < 0) + err(2, "can't create %s", tmp); + rc = fchmod(fd, mode); + if (rc < 0) + err(2, "can't fchmod %s mode=0o%o", tmp, mode); + return (fdopen(fd, "wb")); +} + /* * The main program. */ @@ -388,7 +412,7 @@ processinout(const char *ifn, const char *ofn) if (ifn == NULL || strcmp(ifn, "-") == 0) { filename = "[stdin]"; linefile = NULL; - input = fbinmode(stdin); + input = stdin; } else { filename = ifn; linefile = ifn; @@ -397,7 +421,7 @@ processinout(const char *ifn, const char *ofn) err(2, "can't open %s", ifn); } if (strcmp(ofn, "-") == 0) { - output = fbinmode(stdout); + output = stdout; process(); return; } @@ -426,7 +450,7 @@ processinout(const char *ifn, const char *ofn) if (!altered && backext == NULL) { if (remove(tempname) < 0) warn("can't remove \"%s\"", tempname); - } else if (replace(tempname, ofn) < 0) + } else if (rename(tempname, ofn) < 0) err(2, "can't rename \"%s\" to \"%s\"", tempname, ofn); free(tempname); tempname = NULL;