strapp.c revision cee0fb94c0d4227de0a00efc162fb2739844b641
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mms_strapp.h"
#define MMS_ESCAPE_PAR_NUM 5
#define MMS_ESCAPE_DB_NUM 2
typedef struct mms_escape mms_escape_t;
struct mms_escape {
char ch;
char *sequence;
};
{ '\'', "'" },
{ '"', """ },
{ '>', ">" },
{ '<', "<" },
{ '&', "&" }
};
static char *
/*
* mms_strpar_escape_sequence(string)
*
* Convert plain text to xml parser mms_escape sequence.
*/
char *
mms_strpar_escape_sequence(char *string)
{
}
char *
{
int len;
char *p;
int i;
char *buf;
return (NULL);
}
return (NULL);
}
for (i = 0; i < MMS_ESCAPE_PAR_NUM; i++) {
p = buf;
*p = mms_escape_par[i].ch;
p++;
}
}
return (buf);
}
/*
* mms_str_escape_sequence(string)
*
* Convert plain text to mms_escape sequence.
*/
static char *
{
int i;
int j;
int k;
int m;
int len;
char *nstr;
int sub;
if (!string) {
return (NULL);
}
for (j = 0; j < escape_num; j++) {
}
}
}
return (NULL);
}
for (i = 0, m = 0; string[i] != '\0'; i++) {
for (k = 0; k < len; k++) {
}
sub = 1;
}
}
if (!sub) {
}
}
nstr[m] = '\0';
return (nstr);
}
/*
* mms_strnew(fmt, ...)
*
* Create a new string with variable number of arguments.
*/
char *
mms_strnew(const char *fmt, ...)
{
char *ptr;
return (NULL);
}
return (ptr);
}
/*
* mms_strapp(str, fmt, ...)
*
* Append string with variable number of arguments.
*/
char *
{
char *ptr;
return (NULL);
}
return (ptr);
}
/*
* mms_vstrapp(str, fmt, args)
*
* Append string with variable argument list.
*
* Typical usage example,
* a = strdup("start of ");
* a = strapp(a, "larger string");
*
* On error, str is freed.
*/
char *
{
int count;
int offset;
char *ptr;
return (NULL);
}
return (NULL);
}
return (NULL);
}
ptr[0] = '\0';
offset = 0;
} else {
return (NULL);
}
}
return (NULL);
}
return (ptr);
}
/*
*
* mms_strnapp(char *str, int n, char *str2)
*
* Parameters:
* str pointer to the string being appended to
* If str is not NULL, then it must point to a string which
* may be freed by free() or realloc().
* n number of characters to append
* str2 a string of any length to append to str.
*
* Return a new string with at most n characters from str2 appended to str.
*
* Return Values:
* Address of new string.
*
* Note: new string must be freed by caller.
*
*/
char *
{
char fmt[64];
int len;
char *rc;
if (n == 0) {
return (str);
}
/* Construct format to get n chars */
/* not enough space */
return (NULL);
}
return (rc);
}