X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=dotlock.c;h=8fdc11724409cb3865d7dace99651554b1464107;hp=eb761ad32f6f552a5e6ec064064e05852003bacb;hb=cac1491258e026b8c8459b2ad408a6bf2e8a03bc;hpb=96d53ff49c308769efbf708e1e65819077cb7af6 diff --git a/dotlock.c b/dotlock.c index eb761ad..8fdc117 100644 --- a/dotlock.c +++ b/dotlock.c @@ -44,10 +44,6 @@ #include #endif -#ifdef DL_STANDALONE -# include "reldate.h" -#endif - #define MAXLINKS 1024 /* maximum link depth */ #ifdef DL_STANDALONE @@ -55,8 +51,6 @@ # 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 @@ -85,6 +79,8 @@ extern int snprintf (char *, size_t, const char *, ...); #endif /* DL_STANDALONE */ +#include + static int DotlockFlags; static int Retry = MAXLOCKATTEMPT; @@ -126,10 +122,6 @@ static int dotlock_lock (const char *); #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; @@ -342,7 +334,7 @@ static void END_PRIVILEGED (void) static void usage (const char *av0) { - fprintf (stderr, "dotlock [Mutt-ng %s (%s)]\n", VERSION, ReleaseDate); + fprintf (stderr, "dotlock [Mutt-ng %s]\n", VERSION); fprintf (stderr, "usage: %s [-t|-f|-u|-d] [-p] [-r ] file\n", av0); fputs ("\noptions:" @@ -453,10 +445,10 @@ static int dotlock_prepare (char *bn, size_t l, const char *f, int _fd) dirname = "."; } - if (mutt_strlen (basename) + 1 > l) + if (m_strlen(basename) + 1 > l) return -1; - strfcpy (bn, basename, l); + m_strcpy(bn, l, basename); if (chdir (dirname) == -1) return -1; @@ -499,19 +491,19 @@ dotlock_expand_link (char *newpath, const char *path, const char *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 */ - strfcpy (newpath, link, _POSIX_PATH_MAX); + m_strcpy(newpath, _POSIX_PATH_MAX, link); 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 +539,14 @@ static int dotlock_deference_symlink (char *d, size_t l, const char *path) linkfile[len] = '\0'; dotlock_expand_link (linkpath, pathptr, linkfile); - strfcpy (realpath, linkpath, sizeof (realpath)); + m_strcpy(realpath, sizeof(realpath), linkpath); pathptr = realpath; } else break; } - strfcpy (d, pathptr, l); + m_strcpy(d, l, pathptr); return 0; }