Commit Graph

1897 Commits

Author SHA1 Message Date
Quentin Rameau
bd88854850 install: treat target as file by default instead of dir
When using 'install foo bar', bar should be treated as a file copy of
foo, not a directory to be created and into which install foo.
2016-02-18 10:48:16 +00:00
pekka.jylha.ollila@gmail.com
bb83eade39 Fix showing directories when -R flag is set in ls(1)
Here's a better version of the patch.
When the R flag is used with a single directory, the given directory name is
omitted. With multiple directories each directory name is listed.
Directories that start with './' and '../' are now also printed.
2016-02-17 19:49:07 +00:00
Eivind Uggedal
b97839751b install: only create parent dirs to dest given -D
Given the following commands:

    touch 1.txt; install -D 1.txt d/2.txt
    find d

The result without this fix:

    d
    d/2.txt
    d/2.txt/1.txt

The result with this patch applied:

    d
    d/2.txt
2016-02-17 08:59:19 +00:00
Mattias Andrée
4f701bcd8a tsort: clean up
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-02-17 08:56:54 +00:00
sin
1f6f1a8f4b Forgot to bump date for sort(1) manpage 2016-02-17 08:43:15 +00:00
sin
65159194fb Mark sort(1) as POSIX compliant 2016-02-17 08:39:11 +00:00
sin
1e81e214d6 tsort: Minor style fix 2016-02-17 08:28:32 +00:00
Mattias Andrée
b44d4d8edd Add tsort(1)
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-02-17 08:24:53 +00:00
pekka.jylha.ollila@gmail.com
fad1d35357 Add -d, -f and -i flags to sort(1)
Here's the patch with updated manpage and usage().
2016-02-16 09:56:48 +00:00
Eivind Uggedal
ae52820891 tar: make remove(3) non-fatal when extracting
Handles special cases like: .
2016-02-15 14:27:10 +00:00
Eivind Uggedal
e13f571d11 tar: support -f - for stdin/out 2016-02-15 10:20:12 +00:00
tty0
b107489bf2 ls: only display directory headers when more than one directory is specified 2016-02-15 09:59:09 +00:00
Mattias Andrée
d9c85a2d79 Makefile: add sbase-box-uninstall rule
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-02-15 09:49:54 +00:00
sin
6ca2a046f8 Fix uninstall target
The installed tool is called install not xinstall.
2016-02-15 09:44:27 +00:00
sin
835020b4bf Add Eivind Uggedal to LICENSE 2016-02-15 09:42:59 +00:00
Eivind Uggedal
3c2f8b0cfa tar: don't change modes for hardlinks on extraction
Changing timestamps, modes and ownership of hardlinks
makes no sense.
2016-02-15 09:41:58 +00:00
Eivind Uggedal
2f128ab050 install: bsd make compatibility 2016-02-15 09:41:58 +00:00
Mattias Andrée
db952ed18c New command with corresponding man page. Includes the flags:
-s strip binary
-d create directory
-D create missing directories
-t DIR target directory
-m MODE permission bits
-o USER set owner
-g GROUP set group

Installed files are copied, and default mode is 755.

Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-02-15 09:41:58 +00:00
izabera
038dffaa50 fix problems in sed
s/x/y/w file          <- chomp whitespace
s/x/y/1p              <- don't ignore first char after number
s[x[y[                <- [ is a valid delim
2016-02-14 15:05:18 +00:00
Mattias Andrée
60ef169a18 Makefile: uninstall [ command in the uninstall rule
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-02-12 09:50:24 +00:00
sin
73c8dfafe9 Fix pathchk manpage regarding exit status
Also, rename _attr to st.
2016-02-11 10:09:38 +00:00
sin
efabd56535 Minor cleanup for pathchk(1) 2016-02-11 10:01:58 +00:00
Mattias Andrée
b445614f70 Add pathchk(1)
New command, including man page.
UTF-8 compatible and should be POSIX-compliant.

Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-02-11 10:01:58 +00:00
Roberto E. Vargas Caballero
cfc37be486 Do not try to rematch patterns with ^ or $
It is impossible to rematch a pattern which has one (or both)
of these operators, so the simplest solucion is detect them
while we are compiling the regular expression and break the
match loop after the first iteration.
2016-01-23 08:38:03 +00:00
sin
0d955d3f23 grep: Change match any pattern to "^" 2016-01-20 17:27:35 +00:00
sin
0e9eee4fa3 Revert "If we have a match any pattern also match against blank lines"
Doesn't really make sense for grep . to match blank lines.
2016-01-20 15:06:05 +00:00
Roberto E. Vargas Caballero
cf868c8eeb Stop matching when lastmatch points to '\n'
This situation happens with something like s/$/test/,
where rm_so == rm_eo == 0. Without this check, ed
keeps looping forever.
2016-01-11 15:37:58 +00:00
Roberto E. Vargas Caballero
0b117ab6c0 Fix pattern substitution
Ed was falling doing substitution different of the first or all
(s//%/, s//%/\1, s//%/g), because it was not adding the matches
which were not going to be substituted.
2016-01-11 15:37:58 +00:00
Roberto E. Vargas Caballero
54ad6d512b Fix rematch()
Rematch() was incremnenting the last match always, even in the
cases when it was not matching anything. This patch detects
this situation and it updates it only when there is a match.
2016-01-11 15:37:58 +00:00
Roberto E. Vargas Caballero
78fd6ff239 Handle explicitly the case of line 0
Line 0 is a special line added to allow operations with
empty buffers, and we have to ensure that it is not going
to match any regular expression. The code was written in
a way that this case was handle implicitily, but this
solution was working only for the first file loaded in
ed, while the second file loaded in ed got a line with
a dirty seek field. This solution check explicitily
against invalid lines passed to makeline(), which
allows to simplify the common case.
2016-01-11 15:37:58 +00:00
sin
0fb1c6fd60 ed: Remove useless newlines 2016-01-11 15:37:58 +00:00
Quentin Rameau
eeeb7a6e53 grep: make E and F flags mutually exclusive
Don't make F the priority flag when both E and F are given, instead use
the last one.
2016-01-05 13:54:17 +00:00
sin
16159a61ac ed: Use snprintf() for constructing the scratch filename 2016-01-02 10:33:56 +00:00
sin
3300d5d47a ed: Use strlcpy/strlcat to construct the scratch filename 2016-01-02 09:46:48 +00:00
Roberto E. Vargas Caballero
36e2bdf517 ed: Use TMPDIR to locate the temporal file
The current behaviour of storing the scratch file in
the current directory is a bit painful, because it
generates files in all the directories where you
execute ed. BSD ed uses TMPDIR for this purpouse,
so if the user wants to put the scratch file in
other place different of /tmp it only has to set
this variable.
2016-01-02 09:46:48 +00:00
Roberto E. Vargas Caballero
cf0a0fc940 ed: Fix error introduced in b19d708
This patch introduced init() function, which removed the initialization
code of savfname in doread, but this is incorrect, because savfname
can be initialized with a r command if savfname is empty.
2016-01-02 09:46:48 +00:00
Roberto E. Vargas Caballero
6630bd97cf ed: Don't show '!' in exec with -s
POSIX indicates that this '!' is a diagnosis
that must not be printed when -s is supplied.
2016-01-02 09:46:48 +00:00
Roberto E. Vargas Caballero
b2ef7e73e0 ed: Correct error message when open file
"input/output" error was to general and could create confusion.
All the other ed implementations give a "cannot open input file"
2016-01-02 09:46:48 +00:00
Roberto E. Vargas Caballero
c5e28b5fe9 ed: Don't show size of files in no diagnosistic mode
-s flag disables such warnings.
2016-01-01 10:39:59 +00:00
Roberto E. Vargas Caballero
b19d708923 ed: add init()
These funcction initializes the scratch buffer, and in case of
having a file name parameter it loads the file in the scratch.
It also fixes a problem before this version, where the saved
filename was not set when the file didn't exist.
2016-01-01 10:39:59 +00:00
Roberto E. Vargas Caballero
03d27b7806 ed: Reset modflag in clearbuf()
For the same reason we don't care about the state of
the buffer in clearundo() we can reset modflag in
clearbuf(), because after calling it we don't want
to know anything about the previous state.
2016-01-01 10:39:59 +00:00
Roberto E. Vargas Caballero
58c9739532 ed: Move modflag=0 to clearundo()
When we discard the content of an undo buffer
is because we don't need it anymore, and it means
that we don't care about the modify state of the buffer
so we can reset the modflag in clearundo(), and
remove this assignation each time clearundo() is called.
2016-01-01 10:39:59 +00:00
sin
69855fe1bb Update copyright years 2016-01-01 10:39:59 +00:00
Roberto E. Vargas Caballero
b08660e1fd ed: Fix infinite recursion to undo() 2015-12-31 19:38:17 +00:00
Quentin Rameau
a02d66b8fc chown: fix user:group option parsing
Check that either user or group is correctly passed, and adapt
documention according to that.
2015-12-21 19:07:51 +00:00
Quentin Rameau
6e7743eb56 Cleanup usage() across sbase
Some tools didn't use argv0 for tool name, or usage() at all.
2015-12-21 18:07:25 +00:00
sin
00d7bf4ea5 flock: Check for waitpid() error 2015-12-21 14:13:36 +00:00
sin
0c3440253b flock: Close fd early for correct error propagation
Spotted by FRIGN.
2015-12-21 14:13:36 +00:00
FRIGN
e40fc2b176 Check argv0 in xvprintf()
You never know, given printf'ing NULL-strings might crash the
program, we shouldn't just pass argv0 blindly to it.
2015-12-21 14:13:36 +00:00
sin
3b1b50cffa Do not indent label 2015-12-21 09:55:01 +00:00