home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / unix / elm-2.4-pl20.tar.Z / elm-2.4-pl20.tar / lib / mk_lockname.c < prev    next >
C/C++ Source or Header  |  1992-10-03  |  2KB  |  49 lines

  1.  
  2. static char rcsid[] = "@(#)$Id: mk_lockname.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  3.  
  4. /*******************************************************************************
  5.  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  6.  *
  7.  *            Copyright (c) 1988-1992 USENET Community Trust
  8.  *            Copyright (c) 1986,1987 Dave Taylor
  9.  *******************************************************************************
  10.  * Bug reports, patches, comments, suggestions should be sent to:
  11.  *
  12.  *    Syd Weinstein, Elm Coordinator
  13.  *    elm@DSI.COM            dsinc!elm
  14.  *
  15.  *******************************************************************************
  16.  * $Log: mk_lockname.c,v $
  17.  * Revision 5.1  1992/10/03  22:41:36  syd
  18.  * Initial checkin as of 2.4 Release at PL0
  19.  *
  20.  *
  21.  ******************************************************************************/
  22.  
  23. #include <stdio.h>
  24. #include <fcntl.h>
  25. #include <errno.h>
  26. #include "defs.h"
  27.  
  28. static char lock_name[SLEN];
  29.  
  30. char * mk_lockname(file_to_lock)
  31. char *file_to_lock;
  32. {
  33.       /** Create the proper name of the lock file for file_to_lock,
  34.             which is presumed to be a spool file full path (see
  35.             get_folder_type()), and put it in the static area lock_name.
  36.             Return lock_name for informational purposes.
  37.        **/
  38.  
  39. #ifdef XENIX
  40.         /* lock is /tmp/[basename of file_to_lock].mlk */
  41.         sprintf(lock_name, "/tmp/%.10s.mlk", rindex(file_to_lock, '/')+1);
  42. #else
  43.         /* lock is [file_to_lock].lock */
  44.         sprintf(lock_name, "%s.lock", file_to_lock);
  45. #endif
  46.         return(lock_name);
  47. }
  48.  
  49.