/*
* 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(c) 1988 AT&T
* All Rights Reserved
*
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include "mcs.h"
#include "extern.h"
#include "gelf.h"
/*
* Function prototypes.
*/
static void docompress(section_info_table *);
static void doappend(char *, section_info_table *);
static void doprint(char *, section_info_table *);
static void dozap(section_info_table *);
static int dohash(char *);
/*
* Apply the actions specified by the user.
*/
int
{
int act_index;
int ret = 0;
case ACT_ZAP:
break;
break;
case ACT_PRINT:
break;
break;
}
break;
case ACT_DELETE:
/*
* If I am strip command, this is the
* only action I can take.
*/
break;
/*
* If I am 'strip', I have to
* unset the candidate flag and
* unset the error return code.
*/
ret = 0;
} else {
ret++;
}
break;
/*
* If I am 'strip', I have to
* unset the candidate flag and
* unset the error return code.
*/
ret = 0;
} else {
ret++;
}
break;
/*
* I can not delete this
* section. I can only NULL
* this out.
*/
(cmd_info->no_of_nulled)++;
} else {
(cmd_info->no_of_delete)++;
}
break;
case ACT_APPEND:
ret++;
break;
ret++;
break;
}
(cmd_info->no_of_append)++;
break;
case ACT_COMPRESS:
/*
* If this section is already deleted,
* don't do anything.
*/
break;
ret++;
break;
ret++;
break;
}
(cmd_info->no_of_compressed)++;
break;
}
}
return (ret);
}
/*
* ACT_ZAP
*/
static void
{
}
}
}
/*
* ACT_PRINT
*/
static void
{
char *temp_string;
else
if (data == 0)
return;
if (temp_size == 0)
return;
while (temp_size--) {
char c = *temp_string++;
switch (c) {
case '\0':
(void) putchar('\n');
break;
default:
(void) putchar(c);
break;
}
}
(void) putchar('\n');
}
/*
* ACT_APPEND
*/
static void
{
char *p;
char *tp;
/*
* Get the length of the string to be added. We accept any
* string (even null), as this is arbitrary user defined text.
*
* The caller expects this routine to replace a NULL info->mdata
* field with a pointer to a freshly allocated copy. Any attempt
* to optimize away a null string append would have to deal with
* that, as failing to do so will cause a segfault when the NULL
* mdata field is dereferenced. Accepting null strings in
* this very unimportant case eliminates the need for that.
*/
/*
* Every modification operation will be done
* to a new Elf_Data descriptor.
*/
/*
* mdata is not allocated yet.
* Allocate the data and set it.
*/
}
/*
* Check if the section is deleted or not.
* Or if the size is 0 or not.
*/
/*
* The section was deleated.
* But now, the user wants to add data to this
* section.
*/
prog);
}
} else {
/*
* The user wants to add data to the section.
* I am not going to change the original data.
* Do the modification on the new one.
*/
if (p == NULL) {
prog);
}
}
} else {
/*
* mdata is already allocated.
* Modify it.
*/
/*
* The section was deleated.
* But now, the user wants to add data to this
* section.
*/
prog);
}
} else {
/*
* The user wants to add data to the section.
* I am not going to change the original data.
* Do the modification on the new one.
*/
if (p == NULL) {
prog);
}
}
}
}
/*
* ACT_COMPRESS
*/
static void
{
char *buf;
/*
* mdata is not allocated yet.
* Allocate the data and set it.
*/
char *p;
}
}
}
static char *
{
int hash;
int i;
int *hash_key;
char *strings;
hash_end = 200;
}
hash_num = 0;
next_str = 0;
while (temp_string_size < o_size) {
char c;
/*
* Get a string
*/
while ((c = *(temp_string++)) != '\0' &&
str_size *= 2;
if ((strings = (char *)
}
}
}
str_size *= 2;
if ((strings = (char *)
prog);
}
}
/*
* End get string
*/
for (i = 0; i < hash_num; i++) {
continue;
break;
}
if (i != hash_num) {
continue;
}
hash_end *= 2;
hash_end * sizeof (int));
prog);
}
}
}
/*
* Clean up
*/
/*
* Return
*/
/*
* string compressed.
*/
}
return (str);
}
static int
{
long sum;
unsigned shift;
int t;
sum = 1;
}
/* LINTED */
}