-const char encode_rcs[] = "$Id: encode.c,v 1.1 2001/05/13 21:57:06 administrator Exp $";
+const char encode_rcs[] = "$Id: encode.c,v 1.1.1.1 2001/05/15 13:58:51 oes Exp $";
/*********************************************************************
*
- * File : $Source: /home/administrator/cvs/ijb/encode.c,v $
+ * File : $Source: /cvsroot/ijbswa/current/encode.c,v $
*
* Purpose : Functions to encode and decode URLs, and also to
* encode cookies and HTML text.
*
* Revisions :
* $Log: encode.c,v $
+ * Revision 1.1.1.1 2001/05/15 13:58:51 oes
+ * Initial import of version 2.9.3 source tree
+ *
*
*********************************************************************/
\f
#include <stdio.h>
#include <string.h>
#include <malloc.h>
-\r
+
#include "encode.h"
const char encode_h_rcs[] = ENCODE_H_VERSION;
* Function : url_encode
*
* Description : Encodes a string so it can be used in a URL
- * query string. Replaces special characters with\r
+ * query string. Replaces special characters with
* the appropriate %xx codes.
*
* Parameters :
*
*********************************************************************/
char * url_encode(const char *s)
-{\r
- /* each input char can expand to at most 3 chars */\r
+{
+ /* each input char can expand to at most 3 chars */
char * buf = (char *) malloc((strlen(s) * 3) + 1);
-\r
+
if (buf)
- {\r
+ {
char c;
char * p = buf;
while( (c = *s++) != '\0')
}
*p = '\0';
-\r
+
}
-\r
+
return(buf);
}
{
char *buf = malloc(strlen(s) + 1);
char *q = buf;
-\r
- if (buf)\r
- {\r
+
+ if (buf)
+ {
while (*s)
{
switch (*s)
break;
}
}
- *q = '\0';\r
+ *q = '\0';
}
-\r
+
return(buf);
}