diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2003-04-11 14:46:55 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2003-04-11 14:46:55 +0000 |
commit | ee3afa2e2ae017b22156164763a4099702ca472d (patch) | |
tree | d41c03f7bf2396e7e01147a9ffd75c7a0a71232c /cpukit/httpd/misc.c | |
parent | 2003-04-10 Till Straumann <strauman@slac.stanford.edu> (diff) | |
download | rtems-ee3afa2e2ae017b22156164763a4099702ca472d.tar.bz2 |
2002-04-10 Mike Siers <mikes@poliac.com>
* rtems_webserver/NOTES, rtems_webserver/asp.c,
rtems_webserver/balloc.c, rtems_webserver/default.c,
rtems_webserver/ej.h, rtems_webserver/ejIntrn.h,
rtems_webserver/ejlex.c, rtems_webserver/ejparse.c,
rtems_webserver/emfdb.c, rtems_webserver/emfdb.h,
rtems_webserver/form.c, rtems_webserver/h.c,
rtems_webserver/handler.c, rtems_webserver/license.txt,
rtems_webserver/md5.h, rtems_webserver/md5c.c,
rtems_webserver/mime.c, rtems_webserver/misc.c,
rtems_webserver/ringq.c, rtems_webserver/rom.c,
rtems_webserver/security.c, rtems_webserver/sock.c,
rtems_webserver/sym.c, rtems_webserver/uemf.c,
rtems_webserver/uemf.h, rtems_webserver/um.c, rtems_webserver/um.h,
rtems_webserver/url.c, rtems_webserver/value.c,
rtems_webserver/wbase64.c, rtems_webserver/webcomp.c,
rtems_webserver/webpage.c, rtems_webserver/webrom.c,
rtems_webserver/webs.c, rtems_webserver/webs.h,
rtems_webserver/websuemf.c, rtems_webserver/wsIntrn.h:
Update to GoAhead Webserver 2.1.4. The following URL is
the release notes from GoAhead.
http://data.goahead.com/Software/Webserver/2.1.4/release.htm
I have only done a minimal amount of testing (i.e. the network
demo program works fine). Please try this out and let me know
if it works. The patch needs to be applied on the
c/src/libnetworking/rtems_webserver directory.
Diffstat (limited to 'cpukit/httpd/misc.c')
-rw-r--r-- | cpukit/httpd/misc.c | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/cpukit/httpd/misc.c b/cpukit/httpd/misc.c index 58cee6ab84..872693593b 100644 --- a/cpukit/httpd/misc.c +++ b/cpukit/httpd/misc.c @@ -4,11 +4,13 @@ * Copyright (c) GoAhead Software Inc., 1995-2000. All Rights Reserved. * * See the file "license.txt" for usage and redistribution license requirements + * + * $Id$ */ /********************************* Includes ***********************************/ -#if UEMF +#ifdef UEMF #include "uemf.h" #else #include "basic/basicInternal.h" @@ -49,6 +51,9 @@ enum flag { static int dsnprintf(char_t **s, int size, char_t *fmt, va_list arg, int msize); +#if !defined(__rtems__) +static int strnlen(char_t *s, unsigned int n); +#endif static void put_char(strbuf_t *buf, char_t c); static void put_string(strbuf_t *buf, char_t *s, int len, int width, int prec, enum flag f); @@ -58,15 +63,15 @@ static void put_ulong(strbuf_t *buf, unsigned long int value, int base, /************************************ Code ************************************/ /* * "basename" returns a pointer to the last component of a pathname - * LINUX and LynxOS have their own basename function + * LINUX, LynxOS and Mac OS X have their own basename function */ -#if ! LINUX && ! LYNX && ! __rtems__ +#if (!defined (LINUX) && !defined (LYNX) && !defined (MACOSX)) char_t *basename(char_t *name) { char_t *cp; -#if NW || WIN +#if (defined (NW) || defined (WIN)) if (((cp = gstrrchr(name, '\\')) == NULL) && ((cp = gstrrchr(name, '/')) == NULL)) { return name; @@ -82,7 +87,7 @@ char_t *basename(char_t *name) return ++cp; } } -#endif /* ! LINUX & ! LYNX */ +#endif /* ! LINUX & ! LYNX & ! MACOSX */ /******************************************************************************/ /* @@ -99,7 +104,7 @@ char_t *dirname(char_t *buf, char_t *name, int bufsize) a_assert(buf); a_assert(bufsize > 0); -#if WIN || NW +#if (defined (WIN) || defined (NW)) if ((cp = gstrrchr(name, '/')) == NULL && (cp = gstrrchr(name, '\\')) == NULL) #else @@ -343,7 +348,11 @@ static int dsnprintf(char_t **s, int size, char_t *fmt, va_list arg, int msize) prec, f); } } else { + /* 04 Apr 02 BgP -- changed so that %X correctly outputs + * uppercase hex digits when requested. put_ulong(&buf, value, 16, 0, NULL, width, prec, f); + */ + put_ulong(&buf, value, 16, ('X' == c) , NULL, width, prec, f); } } @@ -408,6 +417,21 @@ static int dsnprintf(char_t **s, int size, char_t *fmt, va_list arg, int msize) /******************************************************************************/ /* + * Return the length of a string limited by a given length + */ + +#if !defined(__rtems__) +static int strnlen(char_t *s, unsigned int n) +{ + unsigned int len; + + len = gstrlen(s); + return min(len, n); +} +#endif + +/******************************************************************************/ +/* * Add a character to a string buffer */ @@ -527,13 +551,13 @@ static void put_ulong(strbuf_t *buf, unsigned long int value, int base, char_t *ascToUni(char_t *ubuf, char *str, int nBytes) { -#if UNICODE +#ifdef UNICODE if (MultiByteToWideChar(CP_ACP, 0, str, nBytes / sizeof(char_t), ubuf, nBytes / sizeof(char_t)) < 0) { return (char_t*) str; } #else - memcpy(ubuf, str, nBytes); + strncpy(ubuf, str, nBytes); #endif return ubuf; } @@ -547,13 +571,13 @@ char_t *ascToUni(char_t *ubuf, char *str, int nBytes) char *uniToAsc(char *buf, char_t *ustr, int nBytes) { -#if UNICODE +#ifdef UNICODE if (WideCharToMultiByte(CP_ACP, 0, ustr, nBytes, buf, nBytes, NULL, NULL) < 0) { return (char*) ustr; } #else - memcpy(buf, ustr, nBytes); + strncpy(buf, ustr, nBytes); #endif return (char*) buf; } |