1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)rename_.c	5.1	6/7/85
   7:  */
   8: 
   9: /*
  10:  * rename a file atomically
  11:  *
  12:  * synopsis:
  13:  *	integer function rename (from, to)
  14:  *	character*(*) from, to
  15:  *
  16:  * where:
  17:  *	return value will be zero normally, an error number otherwise.
  18:  */
  19: 
  20: #include "../libI77/f_errno.h"
  21: #include <sys/param.h>
  22: #ifndef MAXPATHLEN
  23: #define MAXPATHLEN  128
  24: #endif
  25: 
  26: long
  27: rename_ (from, to, frlen, tolen)
  28: char    *from, *to;
  29: long    frlen, tolen;
  30: {
  31:     char    frbuf[MAXPATHLEN];
  32:     char    tobuf[MAXPATHLEN];
  33: 
  34:     if (frlen <= 0 || tolen <= 0 || *from == ' ' || *to == ' ')
  35:         return ((long)(errno = F_ERARG));
  36:     if (frlen >= sizeof frbuf || tolen >= sizeof tobuf)
  37:         return ((long)(errno = F_ERARG));
  38:     g_char (from, frlen, frbuf);
  39:     g_char (to, tolen, tobuf);
  40:     if (rename (from, to) != 0)
  41:         return ((long)errno);
  42:     return (0L);
  43: }

Defined functions

rename_ defined in line 26; never used

Defined macros

MAXPATHLEN defined in line 23; used 3 times
Last modified: 1987-02-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 784
Valid CSS Valid XHTML 1.0 Strict