/*
+ * Copyright notice from original mutt:
* Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1998-2000 Thomas Roessler <roessler@does-not-exist.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *
+ * This file is part of mutt-ng, see http://www.muttng.org/.
+ * It's licensed under the GNU General Public License,
+ * please see the file GPL in the top level source directory.
*/
/*
#include <getopt.h>
#endif
-#ifdef DL_STANDALONE
-# include "reldate.h"
-#endif
-
#define MAXLINKS 1024 /* maximum link depth */
#ifdef DL_STANDALONE
# 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
#endif /* DL_STANDALONE */
+#include <lib-lib/str.h>
+
static int DotlockFlags;
static int Retry = MAXLOCKATTEMPT;
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 <retries>] file\n", av0);
fputs ("\noptions:"
dirname = ".";
}
- if (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;
/* 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);
}
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;
}