aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/ar/ar.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* ar: Avoid overwriting the stdout file stream pointerMark Johnston2022-01-271-1/+1
| | | | | | | | | | | | This doesn't work with musl, which defines stdout as FILE * const. Instead, explicitly pass the desired output stream to ar_read_archive(). No functional change intended. Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34064
* ar: accept but ignore 'T' optionEd Maste2022-01-031-2/+1
| | | | | | | | | | | | | | | | | | | In previous versions of BSD ar -T was an alias for -f -- use only the first 15 characters of archive member names. In GNU ar and LLVM ar -T creates a thin archive. The -f / old BSD ar -T functionality is not particularly useful, and ignoring -T still results in a usable and compatible (but not thin) archive. An exp-run found a few ports invoking ar -T but they all expect thin archives. In addition, -T will be used to specify thin archives after a migration to LLVM-ar. PR: 260523 [exp-run] Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33553
* ar: deprecate -T optionEd Maste2021-12-291-1/+5
| | | | | | | | | | | | | | | | | | Other ar implementations (GNU, LLVM) use -T to mean thin archive rather than use only the first fifteen characters of the archive member name. We support both -T and -f for this, with -f documented as an alias of -T. An exp-run showed that the ports invoking `ar -T` expect thin archives, not truncated names. Switch -f to be the documented flag for this behaviour, and emit a warning when -T is used. The warning will be changed to an error in the future (in main), once ports no longer use -T. PR: 260523 [exp-run] MFC after: 1 week Sponsored by: The FreeBSD Foundation
* ar: diff reduction against ELF Tool ChainEd Maste2021-08-131-21/+6
| | | | | | | | | | | | | Remove ar_mode_* wrappers and call ar_read_archive / ar_write_archive directly. (This was originally committed in d20e9e02db3d but reverted due to a regression, now fixed with an update from cy@.) Obtained from: ELF Tool Chain Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31496
* ar: diff reduction against ELF Tool ChainEd Maste2021-08-131-15/+10
| | | | | | | | | | Drop exit status from bsdar_errc. ELF Tool Chain always returns EXIT_FAILURE in bsdar_errc. Recommit of one part of d20e9e02db3d / review D31496. Obtained from: ELF Tool Chain Sponsored by: The FreeBSD Foundation
* Revert "ar: diff reduction against ELF Tool Chain"Ed Maste2021-08-121-16/+36
| | | | | | | This reverts commit d20e9e02db3dde383c3de1ce8cec3a8c35b3eee6. It caused port build failures. Reported by: cy
* ar: diff reduction against ELF Tool ChainEd Maste2021-08-111-36/+16
| | | | | | | | | | | | | - Drop exit status from bsdar_errc. ELF Tool Chain always returns EXIT_FAILURE in bsdar_errc. - Remove ar_mode_* wrappers and call ar_read_archive / ar_write_archive directly. Obtained from: ELF Tool Chain Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31496
* ar: provide error exit status upon failureEd Maste2021-08-101-29/+33
| | | | | | | | | | | | | | | Previously ar and ranlib returned with exit status 0 (success) in the case of a missing file or other error. Update to use error handling similar to that added by ELF Tool Chain after that project forked FreeBSD's ar. PR: PR257599 [exp-run] Reported by: Shawn Webb, gehmehgeh (on HardenedBSD IRC) Reviewed by: markj Obtained from: elftoolchain MFC after: 2 months Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31402
* usr.bin/ar: use standard 2-Clause FreeBSD licenseEd Maste2018-06-201-12/+14
| | | | | | | | | | | | | | Many licenses on ar files contained small variations from the standard FreeBSD license text. To avoid license proliferation switch to the usual 2-clause FreeBSD license after obtaining permission from all copyright holders. Approved by: jkoshy, kaiw, kientzle Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D14561 Notes: svn path=/head/; revision=335454
* usr.bin/ar: remove incorrect SPDX tagsEd Maste2018-06-191-2/+0
| | | | | | | | | | Three ar files have a non-standard variation of the BSD license, so remove their SPDX tags. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=335377
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* ar: enable reproducible output by default when invoked as 'ar -s'Ed Maste2016-06-161-1/+2
| | | | | | | | | | | | | | | | ar output is already deterministic by default for ar -q and ar -r, and when invoked as ranlib. Make ar -s equivalent to ranlib and enable deterministic output by default in that case too. PR: 210330 Reviewed by: bdrewery Approved by: re (gjb) MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6871 Notes: svn path=/head/; revision=301974
* Make code compile when basename() is POSIX compliant.Ed Schouten2016-05-191-2/+2
| | | | | | | | | | | | If basename() uses "char *", we shouldn't do the intermediate assignment, as that field is of type "const char *". Simply call basename() on the command line argument directly. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D6463 Notes: svn path=/head/; revision=300227
* ar: Deobfuscate a while loopEd Maste2015-08-311-1/+1
| | | | Notes: svn path=/head/; revision=287327
* ar: fix deterministic mode when running as ranlibEd Maste2015-08-311-0/+3
| | | | | | | | | | | This was broken by r286024. PR: 202741 Submitted by: fk@fabiankeil.de Obtained from: ElectroBSD Notes: svn path=/head/; revision=287324
* ar: Fix deterministic mode default with options other than -q or -rEd Maste2015-07-291-8/+18
| | | | | | | | | | Reported by: jhibbits Reviewed by: jhibbits Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3237 Notes: svn path=/head/; revision=286024
* ar: enable deterministic mode by defaultEd Maste2015-07-291-0/+2
| | | | | | | | | | | | | | | Ar cannot handle UIDs with more than 6 digits, and storing the mtime, uid, gid and mode provides little to negative value anyhow for ar's uses. Turn on deterministic (-D) mode by default; it can be disabled by the user with -U. PR: 196929 Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3190 Notes: svn path=/head/; revision=286010
* ar: add -U (unique) option to disable -D (deterministic) modeEd Maste2015-07-241-6/+12
| | | | | | | | | | | | | | | | This is required in order for us to support deterministic mode by default. If multiple -D or -U options are specified on the command line, the final one takes precedence. GNU ar also uses -U for this. An equivalent change will be applied to ELF Tool Chain's version of ar. PR: 196929 MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3175 Notes: svn path=/head/; revision=285844
* Update libarchive to 3.0.3Martin Matuska2012-02-251-2/+2
| | | | | | | | | | | | | | | | | Some of new features: - New readers: RAR, LHA/LZH, CAB reader, 7-Zip - New writers: ISO9660, XAR - Improvements to many formats, especially including ISO9660 and Zip - Stackable write filters to write, e.g., tar.gz.uu in a single pass - Exploit seekable input; new "seekable" Zip reader can exploit the Zip Central Directory when it's available; the old "streamable" Zip reader is still fully supported for cases where seeking is not possible. Full release notes available at: https://github.com/libarchive/libarchive/wiki/ReleaseNotes Notes: svn path=/head/; revision=232153
* Correct typos in comments, no functional changes.Benedict Reuschling2011-05-201-1/+1
| | | | | | | | | Found by: codespell Reviewed by: kaiw MFC after: 1 week Notes: svn path=/head/; revision=222122
* Add option -D for ranlib(1). When -D is speicified, ranlib(1) will generateKai Wang2010-11-281-1/+4
| | | | | | | | | | a deterministic archive symbol table (i.e. timestamp for the symbol table member header is set to 0). Submitted by: Erik Cederstrand Notes: svn path=/head/; revision=216014
* Add -D (deterministic) option to ar.Tim Kientzle2010-10-091-4/+9
| | | | | | | | | | | | When set, it forces all timestamps and owners to zero and modes to 0644. Useful for producing libraries that are bitwise identical across multiple build runs. Submitted by: Erik Cederstrand Reviewed by: Kai Wang Notes: svn path=/head/; revision=213643
* Removed ar(1)'s support for compressed archives. This change removesKai Wang2010-05-171-2/+2
| | | | | | | | | | | | | | | | | ar(1)'s dependencies on compressor libraries -lz, -lbz2 and -llzma and fixes building HEAD on some versions of FreeBSD[78]. Option -j and -z is now accepted but ignored. Compressed ar(1) archives are not useful without a ld(1) that can read them. Also, the current ar(1) compression scheme prevents random access of archive members and needs to be redesigned anyway. Submitted by: kientzle (original patch) Reviewed by: delphij Discussed on: -current mailing list Notes: svn path=/head/; revision=208189
* ANSIfy various tools in usr.bin/.Ed Schouten2010-01-021-4/+4
| | | | | | | | Most of these tools properly build at WARNS=6, except for their K&R function declarations. Fix this, so we can bump WARNS as well. Notes: svn path=/head/; revision=201382
* Act like ranlib if our name ends in ranlib. In particular,Tim Kientzle2009-03-201-2/+5
| | | | | | | | | | this works with some recent cross-building changes by Warner that install ranlib as, e.g., "arm-freebsd7.1-ranlib". Submitted by: John Hein Notes: svn path=/head/; revision=190162
* Add support for option "-M", which is used to operate ar(1) in aKai Wang2008-09-201-2/+10
| | | | | | | | | | | | | | | | | | script mode like the MRI(Microtec Research Inc.) "librarian" program. Originally this option is provided by Binutils ar(1) to ease the transition for developers who are used to writing "librarian" scripts. We added this option to BSD ar(1) because: 1. Further improve the compatibility with Binutils ar(1). 2. There are still a few software using this -M option. (at least one in our ports collection) Suggested by: rink & erwin Notes: svn path=/head/; revision=183218
* GNU ar did NOT implment option -q as a synonym of -r as the manualKai Wang2008-03-111-1/+2
| | | | | | | | | | | | | | | | | | | | page stated, thus BSD ar(1) option -q, which was implemented based on the GNU ar manual page, turns out to be incompatible with GNU ar -q. This change will make BSD ar(1) -q a *REAL* GNU ar -q: 1. It will update symbol table. (same as unfixed version) 2. It will NOT compare new members spcified in the command line args with existing members, instead, append them directly. Reported by: Johannes 5 Joemann <joemann@beefree.free.de> Reported by: Timothy Bourke <timbob@bigpond.com> Tested by: Johannes 5 Joemann <joemann@beefree.free.de> Reviewed by: jkoshy Approved by: jkoshy (mentor) Notes: svn path=/head/; revision=177064
* Since the program is installed as 'bsdranlib', we need toKai Wang2008-02-241-1/+2
| | | | | | | | | | | | check if it is invoked as 'bsdranlib'. Reported by: Michael Plass <mfp49_freebsd [AT] plass-family [DOT] net> Reviewed by: Michael Plass <mfp49_freebsd [AT] plass-family [DOT] net> Reviewed by: jkoshy Approved by: jkoshy (mentor) Notes: svn path=/head/; revision=176527
* Import ar(1) front-end. (aka 'BSD' ar)Kai Wang2008-02-211-0/+377
| | | | | | | | | | | | | | | | | | | | | Reviewed by: jkoshy Approved by: jkoshy (mentor) Tested by: erwin (ports build test on pointyhat) Sponsored by: Google Summer of Code 2007 Reviewed by (earlier version): Jaakko Heinonen <jh[AT]saunalahti.fi> Tested by (earlier version): Steve Kargl <sgk[AT]troutmask.apl.washington.edu> Tested by (earlier version): Martin Voros <martin_voros[AT]yahoo.com> Tested by (earlier version): swell.k[AT]gmail.com Tested by (earlier version): joel Tested by (earlier version): Alexey Shuvaev <shuvaev[AT]physik.uni-wuerzburg.de> Tested by (earlier version): Arjan van Leeuwen <avleeuwen[AT]gmail.com> Thanks to gabor@ for building ports for it. Thanks to erwin@ and kris@ for scheduling the ports build test on pointyhat. And thanks to many others for their feedback. Notes: svn path=/head/; revision=176434
* Finish the deorbital burn of the i386-only a.out toolchain.David E. O'Brien2003-06-271-246/+0
| | | | Notes: svn path=/head/; revision=116903
* WARNS=4Alfred Perlstein2002-07-141-3/+1
| | | | Notes: svn path=/head/; revision=99984
* remove __PWarner Losh2002-03-221-3/+3
| | | | Notes: svn path=/head/; revision=92920
* Style improvements recommended by Bruce as a follow up to someDavid Malone2001-12-101-5/+6
| | | | | | | | | | | of the recent WARNS commits. The idea is: 1) FreeBSD id tags should follow vendor tags. 2) Vendor tags should not be compiled (though copyrights probably should). 3) There should be no blank line between including cdefs and __FBSDIF. Notes: svn path=/head/; revision=87628
* Use __FBSDID().Mark Murray2001-12-021-4/+6
| | | | Notes: svn path=/head/; revision=87232
* WARNS=2 fixup.Mark Murray2001-12-021-3/+4
| | | | Notes: svn path=/head/; revision=87210
* Replace the local `rname' with the cannonical `basename'.David E. O'Brien2001-07-241-1/+2
| | | | Notes: svn path=/head/; revision=80285
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Eliminate compiler warnings from -WallArchie Cobbs1998-12-061-4/+4
| | | | Notes: svn path=/head/; revision=41555
* Convert man page to mdoc format. Cosmetic in usage string.Philippe Charnier1997-06-231-9/+12
| | | | Notes: svn path=/head/; revision=26834
* compare return value from getopt against -1 rather than EOF, per the finalWarner Losh1997-03-291-1/+1
| | | | | | | posix standard on the topic. Notes: svn path=/head/; revision=24360
* The -q option does not require a list of elements: the command 'ar q foo.a'Jean-Marc Zucconi1996-10-171-2/+2
| | | | | | | | is perfectly valid and eventually creates an empty archive. This is consistent with OSF1 V3.x, SunOS 4.x, ULTRIX 4.x and probably others. Notes: svn path=/head/; revision=19004
* Add setlocale LC_TIMEAndrey A. Chernov1995-10-241-0/+3
| | | | Notes: svn path=/head/; revision=11762
* Remove trailing whitespace.Rodney W. Grimes1995-05-301-1/+1
| | | | Notes: svn path=/head/; revision=8874
* BSD 4.4 Lite Usr.bin SourcesRodney W. Grimes1994-05-271-0/+237
Notes: svn path=/cvs2svn/branches/CHRISTOS/; revision=1590