svn commit: samba r10576 - in branches/SAMBA_4_0/testprogs/win32: .
npecho testmailslot
jelmer at samba.org
jelmer at samba.org
Wed Sep 28 13:47:40 GMT 2005
Author: jelmer
Date: 2005-09-28 13:47:39 +0000 (Wed, 28 Sep 2005)
New Revision: 10576
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10576
Log:
Add testprog for named pipes. Also add GNUmakefile's for cross-compilation
using mingw32
Added:
branches/SAMBA_4_0/testprogs/win32/npecho/
branches/SAMBA_4_0/testprogs/win32/npecho/GNUmakefile
branches/SAMBA_4_0/testprogs/win32/npecho/NMakefile
branches/SAMBA_4_0/testprogs/win32/npecho/npecho_client.c
branches/SAMBA_4_0/testprogs/win32/testmailslot/GNUmakefile
branches/SAMBA_4_0/testprogs/win32/testmailslot/NMakefile
Removed:
branches/SAMBA_4_0/testprogs/win32/testmailslot/Makefile
Changeset:
Added: branches/SAMBA_4_0/testprogs/win32/npecho/GNUmakefile
===================================================================
--- branches/SAMBA_4_0/testprogs/win32/npecho/GNUmakefile 2005-09-28 12:29:44 UTC (rev 10575)
+++ branches/SAMBA_4_0/testprogs/win32/npecho/GNUmakefile 2005-09-28 13:47:39 UTC (rev 10576)
@@ -0,0 +1,20 @@
+INCLUDES=-I.
+CFLAGS=$(INCLUDES)
+
+all: npecho_client.exe npecho_server.exe
+
+CC = i586-mingw32msvc-gcc
+
+.SUFFIXES: .c .obj
+
+.c.obj:
+ $(CC) $(CFLAGS) -c $< -o $@
+
+clean:
+ del *~ *.obj *.exe
+
+npecho_client.exe: npecho_client.obj
+npecho_server.exe: npecho_server.obj
+
+%.exe:
+ $(CC) $(CFLAGS) -o $@ $< $(LIBS)
Property changes on: branches/SAMBA_4_0/testprogs/win32/npecho/GNUmakefile
___________________________________________________________________
Name: svn:executable
+ *
Added: branches/SAMBA_4_0/testprogs/win32/npecho/NMakefile
===================================================================
--- branches/SAMBA_4_0/testprogs/win32/npecho/NMakefile 2005-09-28 12:29:44 UTC (rev 10575)
+++ branches/SAMBA_4_0/testprogs/win32/npecho/NMakefile 2005-09-28 13:47:39 UTC (rev 10576)
@@ -0,0 +1,13 @@
+INCLUDES=-I
+CFLAGS=$(INCLUDES) -Zi -nologo
+
+all: npecho_client.exe npecho_server.exe
+
+clean:
+ del *~ *.obj *.exe
+
+npecho_client.exe: npecho_client.obj
+ $(CC) $(CFLAGS) -o npecho_client.exe npecho_client.obj $(LIBS)
+
+npecho_server.exe: npecho_server.obj
+ $(CC) $(CFLAGS) -o npecho_server.exe npecho_server.obj $(LIBS)
Property changes on: branches/SAMBA_4_0/testprogs/win32/npecho/NMakefile
___________________________________________________________________
Name: svn:executable
+ *
Added: branches/SAMBA_4_0/testprogs/win32/npecho/npecho_client.c
===================================================================
--- branches/SAMBA_4_0/testprogs/win32/npecho/npecho_client.c 2005-09-28 12:29:44 UTC (rev 10575)
+++ branches/SAMBA_4_0/testprogs/win32/npecho/npecho_client.c 2005-09-28 13:47:39 UTC (rev 10576)
@@ -0,0 +1,50 @@
+/*
+ * Simple Named Pipe Client
+ * (C) 2005 Jelmer Vernooij <jelmer at samba.org>
+ * Published to the public domain
+ */
+
+#include <windows.h>
+#include <stdio.h>
+
+#define ECHODATA "Black Dog"
+
+int main(int argc, char *argv[])
+{
+ HANDLE h;
+ DWORD numread = 0;
+ char outbuffer[512];
+
+ if (argc == 1) {
+ printf("Usage: %s pipename\n", argv[0]);
+ printf(" Where pipename is something like \\\\servername\\NPECHO\n");
+ return -1;
+ }
+
+ h = CreateFile(argv[1], GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+ if (h == INVALID_HANDLE_VALUE) {
+ printf("Error opening: %d\n", GetLastError());
+ return -1;
+ }
+
+ if (!WriteFile(h, ECHODATA, strlen(ECHODATA), NULL, NULL)) {
+ printf("Error writing: %d\n", GetLastError());
+ return -1;
+ }
+
+ if (!ReadFile(h, outbuffer, strlen(ECHODATA), NULL, NULL)) {
+ printf("Error reading: %d\n", GetLastError());
+ return -1;
+ }
+
+ printf("Read: %s\n", outbuffer);
+
+ if (!TransactNamedPipe(h, ECHODATA, strlen(ECHODATA), outbuffer, strlen(ECHODATA), &numread, NULL)) {
+ printf("TransactNamedPipe failed: %d!\n", GetLastError());
+ return -1;
+ }
+
+ printf("Result: %s\n", outbuffer);
+
+ return 0;
+}
Property changes on: branches/SAMBA_4_0/testprogs/win32/npecho/npecho_client.c
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:eol-style
+ native
Added: branches/SAMBA_4_0/testprogs/win32/testmailslot/GNUmakefile
===================================================================
--- branches/SAMBA_4_0/testprogs/win32/testmailslot/GNUmakefile 2005-09-28 12:29:44 UTC (rev 10575)
+++ branches/SAMBA_4_0/testprogs/win32/testmailslot/GNUmakefile 2005-09-28 13:47:39 UTC (rev 10576)
@@ -0,0 +1,15 @@
+INCLUDES=-I.
+CFLAGS=$(INCLUDES)
+CC=i586-mingw32msvc-gcc
+
+all: testmailslot.exe
+
+clean:
+ rm -f *~ *.obj testmailslot.exe
+
+.SUFFIXES: .obj .exe .c
+
+testmailslot.exe: testmailslot.c
+
+.c.exe:
+ $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
Deleted: branches/SAMBA_4_0/testprogs/win32/testmailslot/Makefile
===================================================================
--- branches/SAMBA_4_0/testprogs/win32/testmailslot/Makefile 2005-09-28 12:29:44 UTC (rev 10575)
+++ branches/SAMBA_4_0/testprogs/win32/testmailslot/Makefile 2005-09-28 13:47:39 UTC (rev 10576)
@@ -1,10 +0,0 @@
-INCLUDES=-I
-CFLAGS=$(INCLUDES) -Zi -nologo
-
-all: testmailslot.exe
-
-clean:
- del *~ *.obj testmailslot.exe
-
-testmailslot.exe: testmailslot.obj
- $(CC) $(CFLAGS) -o testmailslot.exe testmailslot.obj $(LIBS)
Copied: branches/SAMBA_4_0/testprogs/win32/testmailslot/NMakefile (from rev 10571, branches/SAMBA_4_0/testprogs/win32/testmailslot/Makefile)
More information about the samba-cvs
mailing list