projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
move some decoding functions right into the str module, with a bit more
[apps/madmutt.git]
/
dotlock.c
diff --git
a/dotlock.c
b/dotlock.c
index
eb761ad
..
6870553
100644
(file)
--- a/
dotlock.c
+++ b/
dotlock.c
@@
-55,8
+55,6
@@
# define LONG_STRING 1024
# define MAXLOCKATTEMPT 5
# define LONG_STRING 1024
# define MAXLOCKATTEMPT 5
-# define strfcpy(A,B,C) strncpy (A,B,C), *(A+(C)-1)=0
-
# ifdef USE_SETGID
# ifdef HAVE_SETEGID
# ifdef USE_SETGID
# ifdef HAVE_SETEGID
@@
-85,6
+83,8
@@
extern int snprintf (char *, size_t, const char *, ...);
#endif /* DL_STANDALONE */
#endif /* DL_STANDALONE */
+#include <lib-lib/str.h>
+
static int DotlockFlags;
static int Retry = MAXLOCKATTEMPT;
static int DotlockFlags;
static int Retry = MAXLOCKATTEMPT;
@@
-126,10
+126,6
@@
static int dotlock_lock (const char *);
#define check_flags(a) if (a & DL_FL_ACTIONS) usage (argv[0])
#define check_flags(a) if (a & DL_FL_ACTIONS) usage (argv[0])
-size_t mutt_strlen (const char* s) {
- return (s ? strlen (s) : 0);
-}
-
int main (int argc, char **argv)
{
int i;
int main (int argc, char **argv)
{
int i;
@@
-453,10
+449,10
@@
static int dotlock_prepare (char *bn, size_t l, const char *f, int _fd)
dirname = ".";
}
dirname = ".";
}
- if (m
utt_strlen
(basename) + 1 > l)
+ if (m
_strlen
(basename) + 1 > l)
return -1;
return -1;
-
strfcpy (bn, basename, l
);
+
m_strcpy(bn, l, basename
);
if (chdir (dirname) == -1)
return -1;
if (chdir (dirname) == -1)
return -1;
@@
-499,19
+495,19
@@
dotlock_expand_link (char *newpath, const char *path, const char *link)
/* link is full path */
if (*link == '/') {
/* link is full path */
if (*link == '/') {
-
strfcpy (newpath, link, _POSIX_PATH_MAX
);
+
m_strcpy(newpath, _POSIX_PATH_MAX, link
);
return;
}
if ((lb = strrchr (path, '/')) == NULL) {
/* no path in link */
return;
}
if ((lb = strrchr (path, '/')) == NULL) {
/* no path in link */
-
strfcpy (newpath, link, _POSIX_PATH_MAX
);
+
m_strcpy(newpath, _POSIX_PATH_MAX, link
);
return;
}
len = lb - path + 1;
memcpy (newpath, path, len);
return;
}
len = lb - path + 1;
memcpy (newpath, path, len);
-
strfcpy (newpath + len, link, _POSIX_PATH_MAX - len
);
+
m_strcpy(newpath + len, _POSIX_PATH_MAX - len, link
);
}
}
@@
-547,14
+543,14
@@
static int dotlock_deference_symlink (char *d, size_t l, const char *path)
linkfile[len] = '\0';
dotlock_expand_link (linkpath, pathptr, linkfile);
linkfile[len] = '\0';
dotlock_expand_link (linkpath, pathptr, linkfile);
-
strfcpy (realpath, linkpath, sizeof (realpath)
);
+
m_strcpy(realpath, sizeof(realpath), linkpath
);
pathptr = realpath;
}
else
break;
}
pathptr = realpath;
}
else
break;
}
-
strfcpy (d, pathptr, l
);
+
m_strcpy(d, l, pathptr
);
return 0;
}
return 0;
}