You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@hyperreal.org on 1999/08/11 16:44:19 UTC
cvs commit: apache-apr/apr/test htdigest.dsp htdigest.c test.dsw
rbb 99/08/11 07:44:18
Modified: apr/file_io/win32 file_io.def fileio.h open.c readwrite.c
apr/lib apr_getpass.c lib.def lib.dsp
apr/test htdigest.c test.dsw
Added: apr/test htdigest.dsp
Log:
htdigest is now X-platform. :)
Revision Changes Path
1.5 +4 -0 apache-apr/apr/file_io/win32/file_io.def
Index: file_io.def
===================================================================
RCS file: /home/cvs/apache-apr/apr/file_io/win32/file_io.def,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- file_io.def 1999/07/02 19:09:15 1.4
+++ file_io.def 1999/08/11 14:44:05 1.5
@@ -33,4 +33,8 @@
ap_set_filedata @26
ap_get_os_file @27
ap_get_os_dir @28
+ ap_putc @29
+ ap_getc @30
+ ap_fprintf @31
+ ap_eof @32
1.2 +1 -0 apache-apr/apr/file_io/win32/fileio.h
Index: fileio.h
===================================================================
RCS file: /home/cvs/apache-apr/apr/file_io/win32/fileio.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- fileio.h 1999/06/03 19:43:44 1.1
+++ fileio.h 1999/08/11 14:44:07 1.2
@@ -88,6 +88,7 @@
char *lowerdemonfname;
int buffered;
int append;
+ int eof_hit;
/* mode_t protection;
uid_t user;
gid_t group;*/
1.5 +15 -12 apache-apr/apr/file_io/win32/open.c
Index: open.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/file_io/win32/open.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- open.c 1999/07/06 17:36:59 1.4
+++ open.c 1999/08/11 14:44:07 1.5
@@ -82,6 +82,7 @@
{
DWORD oflags = 0;
DWORD createflags = 0;
+ DWORD theerror;
/*mode_t mode = get_fileperms(perm);*/
(*dafile) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t));
@@ -106,10 +107,10 @@
(*dafile)->demonfname = canonical_filename((*dafile)->cntxt, fname);
(*dafile)->lowerdemonfname = strlwr((*dafile)->demonfname);
-
+
+ createflags = OPEN_ALWAYS;
if (flag & APR_CREATE) {
- createflags = OPEN_ALWAYS;
- if (flag & APR_EXCL) {
+ if (flag & APR_EXCL) {
createflags = CREATE_NEW;
}
}
@@ -133,17 +134,11 @@
NULL, createflags, FILE_ATTRIBUTE_NORMAL, 0);
if ((*dafile)->filehand == INVALID_HANDLE_VALUE) {
+ theerror = GetLastError();
return APR_EEXIST;
- }
-
- if (ap_getfileinfo(*dafile) == APR_SUCCESS) {
- ap_register_cleanup((*dafile)->cntxt, (void *)(*dafile), file_cleanup, NULL);
- return APR_SUCCESS;
}
- else {
- (*dafile)->filehand = INVALID_HANDLE_VALUE;
- return APR_ENOSTAT;
- }
+ (*dafile)->eof_hit = 0;
+ return APR_SUCCESS;
}
ap_status_t ap_close(struct file_t *file)
@@ -190,3 +185,11 @@
(*file)->filehand = *thefile;
return APR_SUCCESS;
}
+
+ap_status_t ap_eof(ap_file_t *fptr)
+{
+ if (fptr->eof_hit == 1) {
+ return APR_EOF;
+ }
+ APR_SUCCESS;
+}
1.4 +60 -0 apache-apr/apr/file_io/win32/readwrite.c
Index: readwrite.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/file_io/win32/readwrite.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- readwrite.c 1999/08/08 21:19:36 1.3
+++ readwrite.c 1999/08/11 14:44:08 1.4
@@ -119,3 +119,63 @@
}
*/
+ap_status_t ap_putc(ap_file_t *thefile, char ch)
+{
+ DWORD bwrote;
+
+ if (WriteFile(thefile->filehand, &ch, 1, &bwrote, NULL)) {
+ return APR_EEXIST;
+ }
+ return APR_SUCCESS;
+}
+
+ap_status_t ap_getc(ap_file_t *thefile, char *ch)
+{
+ DWORD bread;
+ if (!ReadFile(thefile->filehand, ch, 1, &bread, NULL)) {
+ return APR_EEXIST;
+ }
+ if (bread == 0) {
+ thefile->eof_hit = TRUE;
+ return APR_EOF;
+ }
+ return APR_SUCCESS;
+}
+
+static int printf_flush(ap_vformatter_buff_t *vbuff)
+{
+ /* I would love to print this stuff out to the file, but I will
+ * get that working later. :) For now, just return.
+ */
+ return -1;
+}
+
+API_EXPORT(int) ap_fprintf(struct file_t *fptr, const char *format, ...)
+{
+ int cc;
+ va_list ap;
+ ap_vformatter_buff_t vbuff;
+ char *buf;
+ int len;
+
+ buf = malloc(HUGE_STRING_LEN);
+ if (buf == NULL) {
+ return 0;
+ }
+ /* save one byte for nul terminator */
+ vbuff.curpos = buf;
+ vbuff.endpos = buf + len - 1;
+ va_start(ap, format);
+#if 0
+ cc = ap_vformatter(printf_flush, &vbuff, format, ap);
+ va_end(ap);
+ *vbuff.curpos = '\0';
+#endif
+ vsprintf(buf, format, ap);
+ len = strlen(buf);
+ cc = ap_write(fptr, buf, &len);
+ va_end(ap);
+ return (cc == -1) ? len : cc;
+}
+
+
1.2 +4 -1 apache-apr/apr/lib/apr_getpass.c
Index: apr_getpass.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/lib/apr_getpass.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- apr_getpass.c 1999/08/04 17:52:01 1.1
+++ apr_getpass.c 1999/08/11 14:44:11 1.2
@@ -60,8 +60,11 @@
* wrapper for the system library's getpass() routine; otherwise, we
* use one we define ourselves.
*/
-
+#ifndef WIN32
#include "apr_config.h"
+#else
+#include "apr_win.h"
+#endif
#include "apr_errno.h"
#include <sys/types.h>
#include <errno.h>
1.3 +1 -0 apache-apr/apr/lib/lib.def
Index: lib.def
===================================================================
RCS file: /home/cvs/apache-apr/apr/lib/lib.def,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- lib.def 1999/06/03 19:43:53 1.2
+++ lib.def 1999/08/11 14:44:12 1.3
@@ -57,3 +57,4 @@
ap_vformatter @55
ap_snprintf @56
ap_vsnprintf @57
+ ap_getpass @58
1.5 +4 -0 apache-apr/apr/lib/lib.dsp
Index: lib.dsp
===================================================================
RCS file: /home/cvs/apache-apr/apr/lib/lib.dsp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- lib.dsp 1999/08/08 21:19:39 1.4
+++ lib.dsp 1999/08/11 14:44:13 1.5
@@ -99,6 +99,10 @@
# End Source File
# Begin Source File
+SOURCE=.\apr_getpass.c
+# End Source File
+# Begin Source File
+
SOURCE=.\apr_md5.c
# End Source File
# Begin Source File
1.2 +8 -10 apache-apr/apr/test/htdigest.c
Index: htdigest.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/test/htdigest.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- htdigest.c 1999/08/04 17:52:17 1.1
+++ htdigest.c 1999/08/11 14:44:16 1.2
@@ -66,7 +66,6 @@
* by Alexei Kosut, based on htpasswd.c, by Rob McCool
*/
-#include "apr_config.h"
#include "apr_lib.h"
#include "apr_md5.h"
#include <sys/types.h>
@@ -78,7 +77,6 @@
#ifdef WIN32
#include <conio.h>
-#define unlink _unlink
#endif
#ifdef CHARSET_EBCDIC
@@ -92,6 +90,7 @@
#define MAX_STRING_LEN 256
char *tn;
+ap_context_t *cntxt;
static void getword(char *word, char *line, char stop)
{
@@ -162,7 +161,7 @@
if (strcmp(pwin, pwv) != 0) {
fprintf(stderr, "They don't match, sorry.\n");
if (tn) {
- unlink(tn);
+ ap_remove_file(cntxt, tn);
}
exit(1);
}
@@ -193,7 +192,7 @@
{
fprintf(stderr, "Interrupted.\n");
if (tn)
- unlink(tn);
+ ap_remove_file(cntxt, tn);
exit(1);
}
@@ -208,16 +207,15 @@
char x[MAX_STRING_LEN];
char command[MAX_STRING_LEN];
int found;
- ap_context_t *context;
- ap_create_context(NULL, NULL, &context);
+ ap_create_context(NULL, NULL, &cntxt);
tn = NULL;
signal(SIGINT, (void (*)(int)) interrupted);
if (argc == 5) {
if (strcmp(argv[1], "-c"))
usage();
- if (ap_open(context, argv[2], APR_WRITE | APR_CREATE, -1, &tfp) != APR_SUCCESS) {
+ if (ap_open(cntxt, argv[2], APR_WRITE | APR_CREATE, -1, &tfp) != APR_SUCCESS) {
fprintf(stderr, "Could not open passwd file %s for writing.\n",
argv[2]);
perror("ap_open");
@@ -232,12 +230,12 @@
usage();
tn = tmpnam(NULL);
- if (ap_open(context, tn, APR_WRITE | APR_CREATE, -1, &tfp)!= APR_SUCCESS) {
+ if (ap_open(cntxt, tn, APR_WRITE | APR_CREATE, -1, &tfp)!= APR_SUCCESS) {
fprintf(stderr, "Could not open temp file.\n");
exit(1);
}
- if (ap_open(context, argv[1], APR_READ, -1, &f) != APR_SUCCESS) {
+ if (ap_open(cntxt, argv[1], APR_READ, -1, &f) != APR_SUCCESS) {
fprintf(stderr,
"Could not open passwd file %s for reading.\n", argv[1]);
fprintf(stderr, "Use -c option to create new one.\n");
@@ -277,6 +275,6 @@
sprintf(command, "cp %s %s", tn, argv[1]);
#endif
system(command);
- unlink(tn);
+ ap_remove_file(cntxt, tn);
return 0;
}
1.6 +12 -0 apache-apr/apr/test/test.dsw
Index: test.dsw
===================================================================
RCS file: /home/cvs/apache-apr/apr/test/test.dsw,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- test.dsw 1999/08/08 21:19:48 1.5
+++ test.dsw 1999/08/11 14:44:17 1.6
@@ -27,6 +27,18 @@
###############################################################################
+Project: "htdigest"=".\htdigest.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "server"=".\server.dsp" - Package Owner=<4>
Package=<5>
1.1 apache-apr/apr/test/htdigest.dsp
Index: htdigest.dsp
===================================================================
# Microsoft Developer Studio Project File - Name="htdigest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=htdigest - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "htdigest.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "htdigest.mak" CFG="htdigest - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "htdigest - Win32 Release" (based on\
"Win32 (x86) Console Application")
!MESSAGE "htdigest - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "htdigest - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 ..\lib\Debug\lib.lib ..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib ..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib ..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib ..\signal\win32\Debug\signal.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "htdigest - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "htdigest"
# PROP BASE Intermediate_Dir "htdigest"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "htdigest"
# PROP Intermediate_Dir "htdigest"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\include" /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 ..\lib\Debug\lib.lib ..\misc\win32\Debug\misc.lib ..\threadproc\win32\Debug\threadproc.lib ..\file_io\win32\Debug\file_io.lib ..\time\win32\Debug\time.lib ..\locks\win32\Debug\locks.lib ..\network_io\win32\Debug\network_io.lib ..\signal\win32\Debug\signal.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "htdigest - Win32 Release"
# Name "htdigest - Win32 Debug"
# Begin Source File
SOURCE=.\htdigest.c
# End Source File
# End Target
# End Project