Introduction
Introduction Statistics Contact Development Disclaimer Help
Move mkpath() higher up so we don't need to declare it - noice - small file bro…
git clone git://git.codemadness.org/noice
Log
Files
Refs
README
LICENSE
---
commit afc065206727ac56ec781becb20ecb573c15c625
parent 5629b4911354876c9b88fe668bd4b17382c79f75
Author: sin <[email protected]>
Date: Wed, 10 Feb 2016 15:38:22 +0000
Move mkpath() higher up so we don't need to declare it
Diffstat:
M noice.c | 41 +++++++++++++++--------------…
1 file changed, 20 insertions(+), 21 deletions(-)
---
diff --git a/noice.c b/noice.c
@@ -103,7 +103,6 @@ int idle;
void printmsg(char *);
void printwarn(void);
void printerr(int, char *);
-char *mkpath(char *, char *, char *, size_t);
#undef dprintf
int
@@ -361,6 +360,26 @@ canopendir(char *path)
return 1;
}
+char *
+mkpath(char *dir, char *name, char *out, size_t n)
+{
+ /* Handle absolute path */
+ if (name[0] == '/') {
+ strlcpy(out, name, n);
+ } else {
+ /* Handle root case */
+ if (strcmp(dir, "/") == 0) {
+ strlcpy(out, "/", n);
+ strlcat(out, name, n);
+ } else {
+ strlcpy(out, dir, n);
+ strlcat(out, "/", n);
+ strlcat(out, name, n);
+ }
+ }
+ return out;
+}
+
void
printent(struct entry *ent, int active)
{
@@ -444,26 +463,6 @@ dentfree(struct entry *dents)
free(dents);
}
-char *
-mkpath(char *dir, char *name, char *out, size_t n)
-{
- /* Handle absolute path */
- if (name[0] == '/') {
- strlcpy(out, name, n);
- } else {
- /* Handle root case */
- if (strcmp(dir, "/") == 0) {
- strlcpy(out, "/", n);
- strlcat(out, name, n);
- } else {
- strlcpy(out, dir, n);
- strlcat(out, "/", n);
- strlcat(out, name, n);
- }
- }
- return out;
-}
-
/* Return the position of the matching entry or 0 otherwise */
int
dentfind(struct entry *dents, int n, char *cwd, char *path)
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.