Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
a7f5907b
Commit
a7f5907b
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: move a general function to the utils.c file
parent
dfcb1268
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/files.c
+0
-11
src/files.c
src/proto.h
+1
-1
src/proto.h
src/utils.c
+11
-0
src/utils.c
with
12 additions
and
12 deletions
+12
-12
src/files.c
View file @
a7f5907b
...
...
@@ -2684,14 +2684,3 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
return
buf
;
}
#endif
/* ENABLE_TABCOMP */
/* Return the filename part of the given path. */
const
char
*
tail
(
const
char
*
path
)
{
const
char
*
slash
=
strrchr
(
path
,
'/'
);
if
(
slash
==
NULL
)
return
path
;
else
return
++
slash
;
}
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
a7f5907b
...
...
@@ -321,7 +321,6 @@ void free_chararray(char **array, size_t len);
char
*
input_tab
(
char
*
buf
,
bool
allow_files
,
size_t
*
place
,
bool
*
lastwastab
,
void
(
*
refresh_func
)(
void
),
bool
*
listed
);
#endif
const
char
*
tail
(
const
char
*
path
);
/* Some functions in global.c. */
size_t
length_of_list
(
int
menu
);
...
...
@@ -581,6 +580,7 @@ void complete_a_word(void);
/* All functions in utils.c. */
void
get_homedir
(
void
);
const
char
*
tail
(
const
char
*
path
);
char
*
concatenate
(
const
char
*
path
,
const
char
*
name
);
#ifdef ENABLE_LINENUMBERS
int
digits
(
ssize_t
n
);
...
...
This diff is collapsed.
Click to expand it.
src/utils.c
View file @
a7f5907b
...
...
@@ -53,6 +53,17 @@ void get_homedir(void)
}
}
/* Return the filename part of the given path. */
const
char
*
tail
(
const
char
*
path
)
{
const
char
*
slash
=
strrchr
(
path
,
'/'
);
if
(
slash
==
NULL
)
return
path
;
else
return
++
slash
;
}
/* Return a copy of the two given strings, welded together. */
char
*
concatenate
(
const
char
*
path
,
const
char
*
name
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help