diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-10-18 08:53:40 +0000 |
commit | d6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch) | |
tree | ece253b876159b39c620e62b6c9b1174642e070e /gnu/libexec/uucp/libunix/lcksys.c |
initial import of NetBSD tree
Diffstat (limited to 'gnu/libexec/uucp/libunix/lcksys.c')
-rw-r--r-- | gnu/libexec/uucp/libunix/lcksys.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/gnu/libexec/uucp/libunix/lcksys.c b/gnu/libexec/uucp/libunix/lcksys.c new file mode 100644 index 00000000000..ab2e2c825dd --- /dev/null +++ b/gnu/libexec/uucp/libunix/lcksys.c @@ -0,0 +1,62 @@ +/* lcksys.c + Lock and unlock a remote system. */ + +#include "uucp.h" + +#include "uudefs.h" +#include "uuconf.h" +#include "sysdep.h" +#include "system.h" + +/* Do the actual lock or unlock. */ + +static boolean fslock_sys P((boolean, const char *)); + +static boolean +fslock_sys (flock, zname) + boolean flock; + const char *zname; +{ + size_t clen; + char *z; + boolean fret; + + clen = strlen (zname); + +#if ! HAVE_LONG_FILE_NAMES + if (clen > 8) + clen = 8; +#endif + + z = zbufalc (sizeof "LCK.." + clen); + memcpy (z, "LCK..", sizeof "LCK.." - 1); + memcpy (z + sizeof "LCK.." - 1, zname, clen); + z[sizeof "LCK.." - 1 + clen] = '\0'; + + if (flock) + fret = fsdo_lock (z, FALSE, (boolean *) NULL); + else + fret = fsdo_unlock (z, FALSE); + + ubuffree (z); + + return fret; +} + +/* Lock a remote system. */ + +boolean +fsysdep_lock_system (qsys) + const struct uuconf_system *qsys; +{ + return fslock_sys (TRUE, qsys->uuconf_zname); +} + +/* Unlock a remote system. */ + +boolean +fsysdep_unlock_system (qsys) + const struct uuconf_system *qsys; +{ + return fslock_sys (FALSE, qsys->uuconf_zname); +} |