Commit Graph

1908 Commits

Author SHA1 Message Date
Richard Ipsum
036449cdf1 grep: Fix exit status on use of -l 2019-05-20 12:38:54 -07:00
Richard Ipsum
5b92551057 cal: Centre month and year above calendar 2019-04-28 14:10:38 -07:00
Richard Ipsum
aae808fe5b cal: Fix grid alignment for years < 1000 2019-04-22 19:08:17 -07:00
Michael Forney
ef9f6f359a expr: Allocate arrays with reallocarray instead of VLA
The length of these arrays is user input, and this is the only use of
VLAs in sbase.
2019-04-16 17:44:08 -07:00
Michael Forney
3fec3e2f4c libutil: Add enreallocarray 2019-04-16 17:41:39 -07:00
Michael Forney
5d49332d4f libutf: Adjust runelen prototype to match definition
The `const` isn't useful here.
2019-04-16 17:27:38 -07:00
Richard Ipsum
09c2311b3a date: Fix default format string
From POSIX:

When no formatting operand is specified, the output in the POSIX
locale shall be equivalent to specifying:

           date "+%a %b %e %H:%M:%S %Z %Y"
2019-04-12 19:40:34 -07:00
Michael Forney
6b950e436b sort: Use regular double for -n
`long double` may require software emulation and the (possible) extra
precision is unnecessary here.
2019-03-13 11:59:33 -07:00
Stephen Gregoratto
c30255e50a Fix typo 2018-11-21 10:45:43 -08:00
David Phillips
99c7876310 On glibc, include sysmacros.h directly
On glibc, major, minor, and makedev are all defined in
sys/sysmacros.h with types.h only including this for historical
reasons. A future release of glibc will remove this behaviour,
meaning that major, minor, and makedev will no longer be defined
for us without including sysmacros.h.
2018-09-25 19:31:01 -07:00
Michael Forney
48d04ae446 find: Make -H and -L flag handling clearer 2018-09-25 19:16:19 -07:00
Mattias Andrée
d8656b0189 uname: check that no operands are specified
Signed-off-by: Mattias Andrée <maandree@kth.se>
2018-09-24 13:04:06 -07:00
Firas Khalil Khana
a1627b9419 ed: Changed delimiter to fix unterminated TODO comment 2018-09-23 11:02:31 +02:00
Roberto E. Vargas Caballero
6d3f18c821 ed: Add more bugs to TODO 2018-09-20 10:54:21 +02:00
Mattias Andrée
7441770cfd tty: fix exit value on error from 1 to 2
Signed-off-by: Mattias Andrée <maandree@kth.se>
2018-07-07 12:18:50 +01:00
Mattias Andrée
084b46ac51 dirname: support --
POSIX-2017 clarifies that -- and normal option parsing must be supported.
See EXAMPLES in basename(1p)

Signed-off-by: Mattias Andrée <maandree@kth.se>
2018-07-07 12:16:15 +01:00
Mattias Andrée
1d885159f2 basename: support --
POSIX-2017 clarifies that -- and normal option parsing must be supported.
See EXAMPLES in basename(1p).

Signed-off-by: Mattias Andrée <maandree@kth.se>
2018-07-07 12:16:11 +01:00
Roberto E. Vargas Caballero
f45156d5b4 Simplify expression in makeline()
This expression was wrong, but it was causing a false positive
in some compilers that couldn't see that error() cannot return.
The actual problem of the line is that it was too complex and it is better
to split it in simplex expressions.
2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
18f6c5e014 Add TODO 2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
ece6569297 Fix undo
Avoid incorrect values in the number of undo elements and restore lastln
value after an undo operation.
2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
cd9b149c8f Use nextln() in scroll() 2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
ebf740f962 Improve doglobal()
Don't use directly the line numbers and call to getlst()
when a line is matched.
2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
9781959581 Fix copy()
Copy was using directly the line numbers and incrementing them
without calling nextln(). It also didn't worry about how
line numbers are modified when we insert new lines.
2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
504dde1373 Allow overlapping transfer 2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
d849e6d4aa Rename addchar_() to addchar()
All the ocurrences of addchar() were moved to addchar_(),
so we can rename addchar_() and remove the old definition.
2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
3ce26f33c6 Move subline() to use String type 2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
77fe371fe4 Fix type of c in getrhs()
C is compared against EOF, so it cannot be char.
2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
0732529fef Fix type of c in execsh()
C is compared against EOF, so it cannot be char.
2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
a5d268c409 Move execsh() to use String type 2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
8d59405ae0 Move join() to use String type 2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
7c2eec7bd1 Move lastre to String type 2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
35cf3c79f2 Move text to String type 2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
f5cb020f06 Move cmdline to String type 2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
20794b570e Define new String type
Current handling of strings is a bit messy. This type is copied
from the sed implementation. Addchar_ is added to be able to live
with String and old style chars based in 3 different variables.
2018-07-03 09:31:46 +01:00
Roberto E. Vargas Caballero
651e2b0ee2 Set restore point before setting signal handlers 2018-07-03 09:31:46 +01:00
Michael Forney
d098ac4abc od: For the 'c' type, format non-printable charecters as octal
This is the behavior specified by POSIX.
2018-02-25 23:01:57 -08:00
Michael Forney
f83c468b55 od: Don't modify bytes in the line for the 'a' type
Subsequent types should still print the full 8-bit value.
2018-02-25 23:01:00 -08:00
Michael Forney
1ff2a54e8f ed: Write "?\n" and explanatory messages to stdout
This is the behavior specified by POSIX.
2018-02-24 00:09:40 -08:00
Samadi van Koten
44ccadcde3 Fix line buffering issue with ed prompt
This fixes an issue whereby ed would not output the prompt (when
enabled) until after exitting due to stdout being line-buffered.
2018-02-23 23:58:29 -08:00
Pieter Kockx
4b9c6645f5 sed: Fix parsing bug in find_delim
's/[[x=]//' was parsed as 's/[[=x]//' which (correctly)
raises an error because the "second delimiter is missing", here =].

The two got mixed up because the parser didn't return to
the "inside bracket"-state after encountering an opening bracket
while inside the bracket expression.
2017-11-10 18:19:32 -08:00
Pieter Kockx
a0a8791704 sed: Add usage 2017-11-10 18:19:04 -08:00
Michael Forney
38cc01b887 which: Minor simplification 2017-10-21 12:44:09 -07:00
Michael Forney
3b604b179c which: Don't look for paths with slashes in $PATH 2017-10-21 12:44:09 -07:00
Michael Forney
44265b29ce which: Move executable check to helper function 2017-10-21 12:44:09 -07:00
Pieter Kockx
5b66e55a83 which: handle relative/absolute pathnames 2017-10-21 12:44:09 -07:00
Pieter Kockx
d15f49e715 which: fix whitespace 2017-10-21 12:44:09 -07:00
Pieter Kockx
6eec2eb3b4 tr: Fix infinite loop
When `makeset` got a string containing square brackets
followed by at least one extra character, e.g. "[abc]d",
it entered an infinite loop because it was assumed
`j` could not exceed `len` without having been equal to `len`.
It can, however, when `m == len` and subsequently `j = m + 1`.
2017-10-21 12:44:09 -07:00
David Phillips
e1c56a6321 chmod: Use DIRFIRST
Previously, running `chmod 777` on a directory that had no read or
execute access (e.g. 111 or 000) would cause chmod to throw its
toys since it was trying to opendir before having added read permission
to the directory.
2017-10-01 11:54:24 -07:00
David Phillips
69b9c2444b libutil/recurse: only opendir if recursing
Previous behaviour was to call opendir regardless of if we are actually going
to be recursing into the directory. Additionally, some utilities that use
DIRFIRST benefit from running the function pointed to by fn before the call
to opendir. One such example is `chmod [-R] 777 dir` on a directory with mode
000, where it will be expected for chmod to first give itself rwx before
optionally listing the directory to traverse it.
2017-10-01 09:34:47 -07:00
Michael Forney
e6d3032131 tar: Fix a few weprintf/eprintf format strings
Thanks to Jim Beveridge for spotting the incorrect utimensat error.

Turns out there are a few other instances of this in the vicinity.
2017-09-09 17:34:43 -07:00