[53205] trunk/base/src/pextlib1.0

toby at macports.org toby at macports.org
Tue Jun 30 23:18:36 PDT 2009


Revision: 53205
          http://trac.macports.org/changeset/53205
Author:   toby at macports.org
Date:     2009-06-30 23:18:36 -0700 (Tue, 30 Jun 2009)
Log Message:
-----------
split pipe out into its own file

Modified Paths:
--------------
    trunk/base/src/pextlib1.0/Makefile
    trunk/base/src/pextlib1.0/Pextlib.c

Added Paths:
-----------
    trunk/base/src/pextlib1.0/pipe.c
    trunk/base/src/pextlib1.0/pipe.h

Modified: trunk/base/src/pextlib1.0/Makefile
===================================================================
--- trunk/base/src/pextlib1.0/Makefile	2009-07-01 06:17:52 UTC (rev 53204)
+++ trunk/base/src/pextlib1.0/Makefile	2009-07-01 06:18:36 UTC (rev 53205)
@@ -2,7 +2,7 @@
 		fs-traverse.o strcasecmp.o vercomp.o filemap.o \
 		sha1cmd.o curl.o rmd160cmd.o readline.o uid.o\
 		tracelib.o tty.o get_systemconfiguration_proxies.o\
-		sysctl.o readdir.o
+		sysctl.o readdir.o pipe.o
 SHLIB_NAME=	Pextlib${SHLIB_SUFFIX}
 INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/pextlib1.0
 

Modified: trunk/base/src/pextlib1.0/Pextlib.c
===================================================================
--- trunk/base/src/pextlib1.0/Pextlib.c	2009-07-01 06:17:52 UTC (rev 53204)
+++ trunk/base/src/pextlib1.0/Pextlib.c	2009-07-01 06:18:36 UTC (rev 53205)
@@ -112,6 +112,7 @@
 #include "sysctl.h"
 #include "strsed.h"
 #include "readdir.h"
+#include "pipe.h"
 
 #if HAVE_CRT_EXTERNS_H
 #include <crt_externs.h>
@@ -909,39 +910,6 @@
 }
 
 /**
- * Call pipe(2) to create a pipe.
- * Syntax is:
- * pipe
- *
- * Generate a Tcl error if something goes wrong.
- * Return a list with the file descriptors of the pipe. The first item is the
- * readable fd.
- */
-int PipeCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-	Tcl_Obj* result;
-	int fildes[2];
-
-	if (objc != 1) {
-		Tcl_WrongNumArgs(interp, 1, objv, NULL);
-		return TCL_ERROR;
-	}
-	
-	if (pipe(fildes) < 0) {
-		Tcl_AppendResult(interp, "pipe failed: ", strerror(errno), NULL);
-		return TCL_ERROR;
-	}
-	
-	/* build a list out of the couple */
-	result = Tcl_NewListObj(0, NULL);
-	Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(fildes[0]));
-	Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(fildes[1]));
-	Tcl_SetObjResult(interp, result);
-
-	return TCL_OK;
-}
-
-/**
  * symlink value target
  * Create a symbolic link at target pointing to value
  * See symlink(2) for possible errors

Added: trunk/base/src/pextlib1.0/pipe.c
===================================================================
--- trunk/base/src/pextlib1.0/pipe.c	                        (rev 0)
+++ trunk/base/src/pextlib1.0/pipe.c	2009-07-01 06:18:36 UTC (rev 53205)
@@ -0,0 +1,44 @@
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tcl.h>
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "pipe.h"
+
+/**
+ * Call pipe(2) to create a pipe.
+ * Syntax is:
+ * pipe
+ *
+ * Generate a Tcl error if something goes wrong.
+ * Return a list with the file descriptors of the pipe. The first item is the
+ * readable fd.
+ */
+int PipeCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+	Tcl_Obj* result;
+	int fildes[2];
+
+	if (objc != 1) {
+		Tcl_WrongNumArgs(interp, 1, objv, NULL);
+		return TCL_ERROR;
+	}
+	
+	if (pipe(fildes) < 0) {
+		Tcl_AppendResult(interp, "pipe failed: ", strerror(errno), NULL);
+		return TCL_ERROR;
+	}
+	
+	/* build a list out of the couple */
+	result = Tcl_NewListObj(0, NULL);
+	Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(fildes[0]));
+	Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(fildes[1]));
+	Tcl_SetObjResult(interp, result);
+
+	return TCL_OK;
+}

Added: trunk/base/src/pextlib1.0/pipe.h
===================================================================
--- trunk/base/src/pextlib1.0/pipe.h	                        (rev 0)
+++ trunk/base/src/pextlib1.0/pipe.h	2009-07-01 06:18:36 UTC (rev 53205)
@@ -0,0 +1 @@
+int PipeCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090630/ce0a6948/attachment-0001.html>


More information about the macports-changes mailing list