diff mbox series

[5/6] Add plan9/wrap.c

Message ID d00bbdce0d5104f1793b7fa0dce14f678e9fb331.1564876327.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series Port git to Plan 9 | expand

Commit Message

John Passaro via GitGitGadget Aug. 3, 2019, 11:52 p.m. UTC
From: lufia <lufia@lufia.org>

Plan 9 has bind(1) instead of ln(1), but bind isn't persisted to the disk.
However it isn't efficient to copy git to git- subcommands such as git-add.
Therefore Plan 9 needs wrap.c to switch behavior by executable name.

Signed-off-by: lufia <lufia@lufia.org>
---
 plan9/wrap.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 plan9/wrap.c

Comments

brian m. carlson Aug. 4, 2019, 12:03 a.m. UTC | #1
On 2019-08-03 at 23:52:12, lufia via GitGitGadget wrote:
> From: lufia <lufia@lufia.org>
> 
> Plan 9 has bind(1) instead of ln(1), but bind isn't persisted to the disk.
> However it isn't efficient to copy git to git- subcommands such as git-add.
> Therefore Plan 9 needs wrap.c to switch behavior by executable name.

Does Plan 9 have symbolic links? The INSTALL_SYMLINKS option uses
symlinks instead, which should avoid the need for hard links.
Kyohei Kadota Aug. 4, 2019, 1:26 a.m. UTC | #2
2019-08-04(Sun) 9:03 brian m. carlson <sandals@crustytoothpaste.net>:
>
> On 2019-08-03 at 23:52:12, lufia via GitGitGadget wrote:
> > From: lufia <lufia@lufia.org>
> >
> > Plan 9 has bind(1) instead of ln(1), but bind isn't persisted to the disk.
> > However it isn't efficient to copy git to git- subcommands such as git-add.
> > Therefore Plan 9 needs wrap.c to switch behavior by executable name.
>
> Does Plan 9 have symbolic links? The INSTALL_SYMLINKS option uses
> symlinks instead, which should avoid the need for hard links.
> --
> brian m. carlson: Houston, Texas, US
> OpenPGP: https://keybase.io/bk2204

No, Plan 9 don't have a feature to create symbolic link.
I think Plan 9 will not be going to have hard- and symbolic- links.
http://doc.cat-v.org/plan_9/4th_edition/papers/lexnames
diff mbox series

Patch

diff --git a/plan9/wrap.c b/plan9/wrap.c
new file mode 100644
index 0000000000..589d13bf5d
--- /dev/null
+++ b/plan9/wrap.c
@@ -0,0 +1,16 @@ 
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#define _POSIX_SOURCE
+#include <unistd.h>
+
+int
+main(int argc, char *argv[])
+{
+	USED(argc);
+	if(execv("/bin/git", argv) < 0){
+		fprintf(stderr, "%s: %s\n", argv[0], strerror(errno));
+		return 1;
+	}
+	return 0; /* can't happen */
+}