delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/06/25/09:15:33

Message-ID: <395606D5.1A0F26D@softhome.net>
Date: Sun, 25 Jun 2000 15:19:17 +0200
From: Laurynas Biveinis <lauras AT softhome DOT net>
X-Mailer: Mozilla 4.73 [en] (Win98; U)
X-Accept-Language: lt,en
MIME-Version: 1.0
To: DJGPP Workers <djgpp-workers AT delorie DOT com>
Subject: Patch: lchown()
Reply-To: djgpp-workers AT delorie DOT com

Hello,

this patch adds a doing-nothing lchown(), as
a part of upcoming symlink support. This patch
is independent of the rest of symlinks and works,
as if 2.04 release would happen tomorrow.

The new wc204.txi entry will be updated as I add
other unix compatibility functions.

BTW Martin, how did you solve that diffing against
new files problem? I've tried 'cvs add lchown.c lchown.txh'
at first, but 'cvs diff' still does not see them.
I've made diffs manually for them this time.

Laurynas

--- /dev/null	Sun Jun 25 15:16:14 2000
+++ /cvs/djgpp/djgpp/src/libc/compat/unistd/lchown.c	Sun Jun 25 14:05:46 2000
@@ -0,0 +1,18 @@
+/* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
+#include <unistd.h>
+#include <errno.h>
+ 
+/* MS-DOS couldn't care less about file ownerships, so we could
+   always succeed.  At least fail for non-existent files
+   and for devices.  */
+ 
+int
+lchown(const char *path, uid_t owner, gid_t group)
+{
+  if (!__file_exists(path))       /* non-existent file */
+  {
+    errno = ENOENT;
+    return -1;
+  }
+  return 0;
+}
--- /dev/null	Sun Jun 25 15:17:48 2000
+++ /cvs/djgpp/djgpp/src/libc/compat/unistd/lchown.txh	Sun Jun 25 14:54:10 2000
@@ -0,0 +1,24 @@
+@node lchown, unix
+@subheading Syntax
+
+@example
+#include <unistd.h>
+
+int lchown(const char *file, int owner, int group);
+@end example
+
+@subheading Description
+
+This function does nothing under MS-DOS
+
+@subheading Return Value
+
+This function always returns zero if the file exists (it does not
+follow symbolic links), else it returns -1 and sets @code{errno} 
+to @code{ENOENT}.
+
+
+@subheading Portability
+
+@portability !ansi, !posix
+
Index: djgpp/src/docs/kb/wc204.txi
===================================================================
RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc204.txi,v
retrieving revision 1.6
diff -u -r1.6 wc204.txi
--- wc204.txi	2000/06/23 06:48:08	1.6
+++ wc204.txi	2000/06/25 13:07:18
@@ -54,3 +54,6 @@
 @findex fsdb AT r{, check for EXE extension}
 @code{fsdb} checks for executables and loads them even if
 the extension @file{.exe} isn't given in the command line.
+
+@findex lchown
+A new function, @code{lchown}, has been added for UNIX compatibility.
Index: djgpp/src/libc/libc.tex
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/libc.tex,v
retrieving revision 1.5
diff -u -r1.5 libc.tex
--- libc.tex	1999/11/28 11:20:47	1.5
+++ libc.tex	2000/06/25 13:07:20
@@ -115,6 +115,7 @@
 * getgroups::                Trivial.
 * getpwnam::                 Trivial.
 * getpwuid::                 Trivial.
+* lchown::                   Trivial.
 * mkfifo::                   Always fails.
 * mknod::                    Trivial.
 * nice::                     No-op.
Index: djgpp/src/libc/compat/unistd/makefile
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/compat/unistd/makefile,v
retrieving revision 1.3
diff -u -r1.3 makefile
--- makefile	2000/06/19 18:00:56	1.3
+++ makefile	2000/06/25 13:07:30
@@ -10,6 +10,7 @@
 SRC += gethostn.c
 SRC += getpages.c
 SRC += getwd.c
+SRC += lchown.c
 SRC += llseek.c
 SRC += nice.c
 SRC += sync.c

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019