rbb 99/09/01 12:01:59
Modified: src/lib/apr configure.in src/lib/apr/file_io/unix fileacc.c open.c readwrite.c src/lib/apr/include apr_config.h.in apr_file_io.h Log: Fix some compile issues, and add a new function or two, because util.c needs them. Revision Changes Path 1.7 +1 -1 apache-2.0/src/lib/apr/configure.in Index: configure.in =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/configure.in,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- configure.in 1999/08/30 15:20:01 1.6 +++ configure.in 1999/09/01 19:01:49 1.7 @@ -197,7 +197,7 @@ dnl Checks for library functions. AC_CHECK_FUNCS(strcasecmp stricmp poll setsid) AC_CHECK_FUNCS(sigaction writev) -AC_CHECK_FUNC(getpass) +AC_CHECK_FUNCS(getpass) AC_CHECK_FUNC(_getch) dnl Start building stuff from our information 1.2 +34 -0 apache-2.0/src/lib/apr/file_io/unix/fileacc.c Index: fileacc.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/fileacc.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- fileacc.c 1999/08/17 15:59:36 1.1 +++ fileacc.c 1999/09/01 19:01:51 1.2 @@ -215,6 +215,40 @@ } /* ***APRDOC******************************************************** + * ap_status_t ap_get_filetype(ap_file_t *, ap_filetype_e) + * Return the type of the current file. + * arg 1) The currently open file. + * arg 2) The file type + */ +ap_status_t ap_get_filetype(struct file_t *file, ap_filetype_e *type) +{ + if (file != NULL) { + if (!file->stated) { + ap_getfileinfo(file); + } + if (S_ISREG(file->protection)) + *type = APR_REG; + if (S_ISDIR(file->protection)) + *type = APR_DIR; + if (S_ISCHR(file->protection)) + *type = APR_CHR; + if (S_ISBLK(file->protection)) + *type = APR_BLK; + if (S_ISFIFO(file->protection)) + *type = APR_PIPE; + if (S_ISLNK(file->protection)) + *type = APR_LNK; + if (S_ISSOCK(file->protection)) + *type = APR_SOCK; + return APR_SUCCESS; + } + else { + *type = APR_REG; + return APR_ENOFILE; + } +} + +/* ***APRDOC******************************************************** * ap_status_t ap_get_filedata(ap_file_t *, void *) * Return the data associated with the current file. * arg 1) The currently open file. 1.3 +2 -2 apache-2.0/src/lib/apr/file_io/unix/open.c Index: open.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/open.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- open.c 1999/08/18 13:33:24 1.2 +++ open.c 1999/09/01 19:01:52 1.3 @@ -95,7 +95,7 @@ * APR_CREATE create the file if not there * APR_APPEND file ptr is set to end prior to all writes * APR_TRUNCATE set length to zero if file exists - * APR_BINARY not a test file + * APR_BINARY not a text file * APR_BUFFERED buffer the data. Default is non-buffered * APR_EXCL return error if APR_CREATE and file exists * arg 4) Access permissions for file. @@ -103,7 +103,7 @@ * NOTE: If mode is APR_OS_DEFAULT, the system open command will be * called without any mode parameters. */ -ap_status_t ap_open(ap_context_t *cont, char *fname, ap_int32_t flag, ap_fileperms_t perm, struct file_t **new) +ap_status_t ap_open(ap_context_t *cont, const char *fname, ap_int32_t flag, ap_fileperms_t perm, struct file_t **new) { int oflags = 0; struct stat info; 1.3 +36 -0 apache-2.0/src/lib/apr/file_io/unix/readwrite.c Index: readwrite.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/readwrite.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- readwrite.c 1999/08/18 13:33:25 1.2 +++ readwrite.c 1999/09/01 19:01:52 1.3 @@ -221,6 +221,42 @@ return APR_SUCCESS; } +/* ***APRDOC******************************************************** + * ap_status_t ap_gets(ap_file_t *, char *, int) + * Get a string from a specified file. + * arg 1) The file descriptor to read from + * arg 2) The buffer to store the string in. + * arg 3) The length of the string + */ +ap_status_t ap_gets(ap_file_t *thefile, char *str, int len) +{ + ssize_t rv; + int i; + + if (thefile->buffered) { + if (fgets(str, len, thefile->filehand)) { + return APR_SUCCESS; + } + if (feof(thefile->filehand)) { + return APR_EOF; + } + return errno; + } + for (i = 0; i < len; i++) { + rv = read(thefile->filedes, &str[i], 1); + if (rv == 0) { + thefile->eof_hit = TRUE; + return APR_EOF; + } + else if (rv != 1) { + return errno; + } + if (str[i] == '\n' || str[i] == '\r') + break; + } + 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 1.6 +18 -3 apache-2.0/src/lib/apr/include/apr_config.h.in Index: apr_config.h.in =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_config.h.in,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- apr_config.h.in 1999/08/30 15:20:06 1.5 +++ apr_config.h.in 1999/09/01 19:01:58 1.6 @@ -100,6 +100,9 @@ /* Define if you have the getpagesize function. */ #undef HAVE_GETPAGESIZE +/* Define if you have the getpass function. */ +#undef HAVE_GETPASS + /* Define if you have the poll function. */ #undef HAVE_POLL @@ -121,6 +124,9 @@ /* Define if you have the <arpa/inet.h> header file. */ #undef HAVE_ARPA_INET_H +/* Define if you have the <conio.h> header file. */ +#undef HAVE_CONIO_H + /* Define if you have the <crypt.h> header file. */ #undef HAVE_CRYPT_H @@ -148,6 +154,9 @@ /* Define if you have the <io.h> header file. */ #undef HAVE_IO_H +/* Define if you have the <kernel/OS.h> header file. */ +#undef HAVE_KERNEL_OS_H + /* Define if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H @@ -223,6 +232,9 @@ /* Define if you have the <sys/select.h> header file. */ #undef HAVE_SYS_SELECT_H +/* Define if you have the <sys/signal.h> header file. */ +#undef HAVE_SYS_SIGNAL_H + /* Define if you have the <sys/socket.h> header file. */ #undef HAVE_SYS_SOCKET_H @@ -271,11 +283,14 @@ /* Define if you have the dl library (-ldl). */ #undef HAVE_LIBDL -/* Define if you have the kernel/OS.h header file (BEOS) */ -#undef HAVE_KERNEL_OS_H - /* Define if you have the pthread library (-lpthread). */ #undef HAVE_LIBPTHREAD + +/* Define if you have the socket library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define if you have the ufc library (-lufc). */ +#undef HAVE_LIBUFC #define API_EXPORT(type) type #define API_EXPORT_NONSTD(type) type #define API_VAR_IMPORT extern 1.3 +3 -1 apache-2.0/src/lib/apr/include/apr_file_io.h Index: apr_file_io.h =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_file_io.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- apr_file_io.h 1999/08/18 13:33:27 1.2 +++ apr_file_io.h 1999/09/01 19:01:58 1.3 @@ -107,7 +107,7 @@ typedef ap_int32_t ap_fileperms_t; /* Function definitions */ -ap_status_t ap_open(ap_context_t *, char *, ap_int32_t, ap_fileperms_t, ap_file_t **); +ap_status_t ap_open(ap_context_t *, const char *, ap_int32_t, ap_fileperms_t, ap_file_t **); ap_status_t ap_close(ap_file_t *); ap_status_t ap_remove_file(ap_context_t *, char *); ap_status_t ap_eof(ap_file_t *); @@ -117,6 +117,7 @@ ap_status_t ap_writev(ap_file_t *, const ap_iovec_t *, ap_ssize_t *); ap_status_t ap_putc(ap_file_t *, char); ap_status_t ap_getc(ap_file_t *, char *); +ap_status_t ap_gets(ap_file_t *, char *, int); API_EXPORT(int) ap_fprintf(ap_file_t *fptr, const char *format, ...) __attribute__((format(printf,2,3))); @@ -145,6 +146,7 @@ ap_status_t ap_dir_entry_ftype(ap_dir_t *, ap_filetype_e *); ap_status_t ap_get_filesize(ap_file_t *, ap_ssize_t *); +ap_status_t ap_get_filetype(ap_file_t *, ap_filetype_e *); ap_status_t ap_get_fileperms(ap_file_t *, ap_fileperms_t *); ap_status_t ap_get_fileatime(ap_file_t *,time_t *); ap_status_t ap_get_filectime(ap_file_t *,time_t *);