Fix a long-standing cpp compatibility bug: The -DFOO argument
(without an explicit value) should define FOO to 1 not to the empty
string.
Add support for CRLF newlines, based on a suggestion from Mark Rushakoff.
Obtained from: http://dotat.at/prog/unifdef/
sockaddr structures. As such, we have top copy the data structure
into a local buffer before we can reference it, otherwise we have
unaligned references (these are fixed up automatically on some CPUs,
but not on others). We do this unconditionally to make the code
easier to read and understand.
Submitted by: Grzegorz Bernacki
about to be extracted already exists. The question, and interpretation
of the response is deliberately compatible with Info-Zip.
This change was originally obtained from NetBSD, but has three changes:
- better compatibility with Info-Zip in the handling of ^D
- Use getdelim() rather than getline()
- bug fix: != changed to == in the "file rename" code
I suspect the latter is also a bug in NetBSD, but I can't easily confirm
this.
PR: bin/143307
Reviewed by: rdivacky (change to unzip.c only)
Obtained from: NetBSD src/usr.bin/unzip/unzip.c 1.8
MFC after: 1 month
This structure is deprecated and only used by ftime(2), which is part of
libcompat. The second argument of get_date() is unused, which means we
can just remove it entirely.
ports tree extensively and it is probably a good idea to keep it
regardless of NO_MAIL setting.
Reported by: Alexander Best
Reviewed by: antoine
X-MFC-With: r203584
isolate common code used by tar and cpio (and useful to other
libarchive clients). The functions here are prefixed with
"lafe" (libarchive front-end) to indicate their use.
is sufficiently different that it was simpler to just put separate
reporting functions into read.c and write.c rather than try to have
a single all-purpose reporting function.
Switch to a custom function for converting int64_t to a string; in
the portable version, this saves a lot of configuration headaches
trying to decipher the platform printf().
use -b 2048 (1MiB block size). Setting the limit to 8192 should
allow some room for growth while still helping people who mistakenly
put in byte counts here instead of block counts.
The bc(1) program may need to deal with files when it's being run in
interactive mode, so we can not blindly use interactive mode (in turn
use libedit) but need to check if the input source is really the standard
input.
This commit should fix a regression where 'bc -l' would not parse the
mathlib.
Reported by: trasz
- Include a cpasswd script performing the same mechanisms as the cvpasswd
utility from CVSup.
PR: bin/114129
Submitted by: Petar Zhivkov Petrov <pesho.petrov -at- gmail.com>
MFC after: 1 month
Also, change the existing -vi behavior to send the filenames to
stderr rather than stdout, as GNU cpio does.
PR: bin/141175
Submitted by: Philip Kizer
MFC after: 14 days
revision 1.91
Fri Nov 7 01:01:46 2003 UTC by lukem
Add some subsections in the VARIABLE ASSIGNMENTS section.
In the "modifier description" list, show each modifier with the leading `:'.
Rationale: it's hard to search for modifiers without it, and we already do
the same thing in the -options and .makecommands lists. I now find it much
easier to find the description for a modifier in the man page.
Obtained from: NetBSD
kept for compatibility with 4.4BSD behavior.
- Sync SYNOPSIS with usage().
- Use an alternative way to represent short and long options which have
same semantics.
Reviewed by: gabor
compatibility level with the GNU counterparts and have shown to be mature
enough. For now, the GNU versions aren't removed from the tree, just detached
from the build.
Sponsored by: Google Summer of Code 2008
Portbuild run by: erwin
Approved by: delphij
I must have misread when I ported the original last(1) source code.
Instead of only processing the last 1024 entries, it reads them in in
chucks of 1024 entries at a time.
Unfortunately we cannot walk through the log file in reverse order,
which means we have to allocate a piece of memory to hold all the
entries. Call realloc() for each 128 entries we read.
Reported by: Andrzej Tobola <ato iem pw edu pl>
file can safely be the same as the input file. Idea from IRIX unifdef(1).
This version fixes a bug in the NetBSD unifdef which refuses to
write to a -o outfile which does not exist.
Obtained from: NetBSD
This utility allows users to convert their wtmp databases to the new
format. It makes no sense for users to keep their wtmp log files if they
are unable to view them.
It basically copies ut_line into ut_id as well. This makes it possible
for last(1) and ac(8) to match login records with their corresponding
logout record.
do for IPv4 addresses without having to explicetly specify that the
ARIN server should be used to get the initial information
PR: bin/128725
Submitted by: "Matt D. Harris" <mdh_lists@yahoo.com>
MFC after: 1 week
Let it print "-" when the TTY string is empty. In this case, it must
also make sure it doesn't match processes who also have no controlling
TTY. Otherwise it will print random kernel processes when trying to pick
the best matching process.
Eventually it should look at the value of ut_pid as well.
Because getutxent also matches the typical get*ent format of library
routines, I thought it would be a good idea to teach it how to read
utmpx databases. getent(1) just gives a raw dump, which is very useful
when debugging problems related to parsing/logging.
Basically there are three major things I changed about last(1):
- It should use ut_type instead of determining by hand what type of
record was given.
- It should now keep track of ut_id's instead of TTYs. This means the
ttylist has been renamed to the idlist, storing all the ut_id's it has
processed until the next reboot.
- I've removed the signal handler. Because our wtmp is rotated so often,
it makes little sense. Even on a simple piece of hardware it should be
capable of grinding through megabytes of logs in a second.
It was already ported to use libulog, which makes it simpler now. Be
sure to catch the error returned by setutxdb(). Otherwise it may perform
a lookup on the utx.active database.
- Make one-true-awk respect locale's collating order in [a-z]
bracket expressions, until a more complete fix (like handing
BREs) is ready.
- Don't require a space between -[fv] and its argument.
2) Deregister.
3) New style function definitions.
Some WARNS still remain here - some printf format warning on some
arches and the compiler can't see that a variable should always be
initialised.
are not used uninitialised.
2) Fix some constness problems.
3) Avoid a signedness problem by casting to size_t. If bn != stuff,
than stuff-1-bn should be > 0.
Do by specifying ".../" with '-m' or MAKESYSPATH (new) environment variable.
Reviewed by: <sjg@NetBSD.org>
Obtained from: NetBSD (+ embellishment by me, sent back to NetBSD)
Std 1003.1-2008. Both Linux and Solaris conforms to the new definitions,
so we better follow too (older glibc used old BSDish alphasort prototype
and corresponding type of the comparision function for scandir). While
there, change the definitions of the functions to ANSI C and fix several
style issues nearby.
Remove requirement for "sys/types.h" include for functions from manpage.
POSIX also requires that alphasort(3) sorts as if strcoll(3) was used,
but leave the strcmp(3) call in the function for now.
Adapt in-tree callers of scandir(3) to new declaration. The fact that
select_sections() from catman(1) could modify supplied struct dirent is
a bug.
PR: standards/142255
MFC after: 2 weeks
r195175. Remove all definitions, documentation, and usage.
fifo_misc.c:
Remove all kqueue tests as fifo_io.c performs all those that
would have remained.
Reviewed by: rwatson
MFC after: 3 weeks
X-MFC note: don't change vlan_link_state() function signature
I was considering committing all these patches one by one, but as
discussed with brooks@, there is no need to do this. If we ever
need/want to merge these changes back, it is still possible to do this
per application.
Unfortunately it also uses lastlog, which means we must resort to local
extensions of the utmpx-interface. Because the user name and TTY name
are now nul-terminated, there is no need to copy around strings as
often.
- Only set the fields in the ulog_utmpx structure that are valid for the
command in question. This means that strings like "shutdown" or "~"
are not visible to the user anymore.
- Rename UTXF_* to UTXI_*, indicating the indexation, instead of using
the `antique' filename. If we ever get rid of utmp, it makes little
sense calling it by its old name.
i386-fbsd.c. Add pipe(2) to syscall table to decode it's pointer
argument properly and re-add special handling for pipe(2) return value
to print_syscall_ret().
PR: bin/120870
Approved by: trasz (mentor)
- Prevent overflowing of the buffer length variable in getline() by
limiting its maximum value.
- Exit if reallocf(3) fails in getline(). Failure was silently
considered as end-of-file.
Reviewed by: ghelmer
Approved by: trasz (mentor)
limiting its maximum value.
- Exit if reallocf(3) fails in getline(). Failure was silently
considered as end-of-file.
Reviewed by: ghelmer
Approved by: trasz (mentor)
- Sort function prototypes;
- Apply static on all function bodies. To quote bde@:
> It is a good obfuscation to declare functions as static only in the
> prototype, so that you can't see the static for the actual function.
> The reverse obfuscation (with static only in the function definition)
> would make more sense, but is a constraint error.
Reviewed by: bde
to wcscoll(3). Newline characters could cause incorrect results when
comparing lines.
Also, if an input line didn't contain a newline character, it was
omitted from the output. According to my interpretation, SUSv3 requires
that the newline is always printed.
Add regression tests for the cases. [1]
PR: bin/140976
Submitted by: D'Arcy Cain (original version) [1]
Approved by: trasz (mentor)
We don't have UT_*SIZE anymore. One of the reasons for that is because
all strings are null terminated, there is no need for apps to copy
strings out of the utmpx structure. This means we can define W_DISP*SIZE
lengths for all columns.
While there, adjust the sizes a little. Steal some bytes from the
username column, while extending the hostname column quite a bit.
(Un)fortunately there is no standardized interface to switch between
utmp database files, so we must call ulog_setutxfile() here.
I'm also changing the column widths to magic numbers here. Display
layout should in this case not be derived from structure fields sizes.
Because I don't want struct utmpx ever to become too small, the fields
are too big to reserve all the space.
Because our implementation guarantees the strings inside struct utmpx to
be null terminated, we don't need to copy everything out, which makes
the code nicer to read.
Also set WARNS to 6 and add $FreeBSD$ to keep SVN happy.
Because our implementation guarantees the strings inside struct utmpx to
be null terminated, we don't need to copy everything out, which makes
the code nicer to read.
Also set WARNS to 6 and add $FreeBSD$ to keep SVN silent.
Instead of digging through the utmp database by hand, use proper API
calls to do so. Instead of parsing entries with a non-empty ut_user, we
now look at LOGIN_PROCESS entries.
If the number of nested #if blocks exceeds 64, nest() increments
the nesting depth and then reports an error. The message includes
the line number for the start of the current #if block, which is
read from past the end of the relevant array.
Avoid the out-of-bounds read by reporting the error and exiting
before the nesting depth has a chance to increase.
Submitted by: Jonathan Nieder <jrnieder@gmail.com>
The old code used a shell loop to convert each controlling macro
definition into a command-line argument, reading the macro definitions
file each time. The new code converts the list of controlling macros
into a sed script which can run through the list of macro definitions
in one go.
Add some explanatory comments, since the code is quite meta.
Use {} instead of () for redirecting a group of commands.
Submitted by: Jonathan Nieder <jrnieder@gmail.com>
Main highlights:
(A) The new -B option compresses blank lines around a deleted section
so that blank lines around "paragraphs" of code don't get doubled.
(B) Lenient evaluation of && and || so that #if expressions can be
evaluated even when some of their sub-expressions cannot be.
(C) The evaluator can now handle macros with arguments.
(D) Portability fixes, especially for unifdefall.
Contributions from:
Ben Hutchings at Solarflare Communications (A and B)
Anders H Kaseorg <andersk@mit.edu> (A and C)
Jonathan Nieder <jrnieder@gmail.com> (D)
Obtained from: http://dotat.at/prog/unifdef/
specific sysctls and ptrace interfaces.
This change switches a bit gcore POLA that is summarized here:
- now gcore can recognize threads within the process and handle dumps
on thread-scope
- the process to be analyzed will be stopped during its gcore run
- gcore may not work with processes which are actively being analyzed
by gdb or truss
- the ptrace interface may cause syscalls to return EINTR, thus
interferring with signals handling within the process
Side note: <janitor task> the interface can be further lifted in order to
get rid of the very last procfs interfaces remnants and made more
suitable for copying with sysctl/ptrace interface </janitor task>.
Obtained from: Sandvine Incorporated
Reviewed by: emaste, rwatson
Sponsored by: Sandvine Incorporated
MFC: 1 month
addresses, again. However, change a hostname into an IP address, only
when a host has just one A/AAAA RR.
Requested by: candy__at__kgc.co.jp
MFC after: 2 weeks
BZ_STREAM_END triggered re-init. Do it by introducing a new flag
to represent the 'cold' case after bzip2 state is reinitialized.
This fixes regression reported on -current@ as well as another one
I found during twiddling with gzip.
Reported by: swell.k gmail.com
MFC after: 1 week
ktrsyscall(). print_number() does decrement the number of arguments,
leading to infinite loops for negative values.
Reported by: Patrick Lamaiziere <patpr at davenulle dot org>,
Jonathan Pascal <jkpyvxmzsa at mailinator dot com>
Submitted by: jh
PR: bin/120055, kern/119564
MFC: 1 week
input to be in non-buffering mode so that input lines are logged
as they occur rather than being saved up until a buffer's worth of
input has been logged.
bspatch thus does not verify file hashes, and that consequently it
is recommended that users store hashes separately and verify files
before and after running bspatch.
Requested by: BugMagnet
MFC after: 1 week
the error and assume that the file doesn't exist. Touch could return
success with -c option even if the file existed and time was not set.
- If the first utimes_f() call fails with -A option, give up and don't
continue trying to set times to current time. [1]
- Set exit status to 1 when setting of timestamps fails for a directory
or symbolic link even though lstat()/stat() would succeed.
- Don't print bogus error message when rw() succeeds.
PR: bin/112213
Submitted by: jilles [1]
Reviewed by: jilles
Approved by: trasz (mentor)
otherwise sign extension leads to unlikely values when in the negative
range of the signed short structure fields that hold the statistics.
The type used to hold routing statistics is arguably also incorrect.
MFC after: 3 days
- Exit if getch() returns with an error other than EINTR. Otherwise
systat(1) may get stuck in an infinite loop if it doesn't receive
SIGHUP when terminal closes. [1]
- Remove attempt to clear stdio error indicators. getch() doesn't use
stdio, making it useless. [2]
- Remove unneeded masking of getch() return value. [2]
PR: bin/107171
Reviewed by: bde
Approved by: trasz (mentor)
Obtained from: OpenBSD [1]
Suggested by: bde [2]
MFC after: 1 month