/*
* 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
* Copyright (c) 1989 AT&T
* All Rights Reserved
*
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* UNIX HEADERS */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <libelf.h>
/* SIZE HEADER */
#include "defs.h"
/* RELEASE STRING */
#include "conv.h"
#include "sgs.h"
/* EXTERNAL VARIABLES DEFINED */
/* option is supplied */
int oneflag = 0;
char *fname;
char *archive;
int is_archive = 0;
static char *tool_name;
static void usagerr();
/*
* main(argc, argv)
*
* parses the command line
* opens, processes and closes each object file command line argument
*
* defines:
* - int numbase = HEX if the -x flag is in the command line
* = OCTAL if the -o flag is in the command line
* = DECIMAL if the -d flag is in the command line
*
* calls:
* - process(filename) to print the size information in the object file
* filename
*
* prints:
* - an error message if any unknown options appear on the command line
* - a usage message if no object file args appear on the command line
* - an error message if it can't open an object file
* or if the object file has the wrong magic number
*
* exits 1 - errors found, 0 - no errors
*/
int
{
/* UNIX FUNCTIONS CALLED */
extern void error();
/* SIZE FUNCTIONS CALLED */
extern void process();
/* EXTERNAL VARIABLES USED */
extern int numbase;
extern int errflag;
extern int oneflag;
extern int optind;
extern char *fname;
int c;
static int fd;
extern char *archive;
unsigned Vflag = 0;
/*
* Check for a binary that better fits this architecture.
*/
switch (c) {
case 'o':
else
"size: -x set, -o ignored\n");
break;
case 'd':
break;
case 'x':
else
"size: -o set, -x ignored\n");
break;
case 'f':
fflag++;
break;
case 'F':
Fflag++;
break;
case 'n':
nflag++;
break;
case 'V':
(const char *)SGU_PKG,
(const char *)SGU_REL);
Vflag++;
break;
case '?':
errflag++;
break;
default:
break;
}
}
usagerr();
}
}
oneflag++; /* only one file to process */
}
}
} else {
cmd = ELF_C_READ;
arf = 0;
/* error(fname, "cannot open"); */
return (FATAL);
}
} else {
archive = "";
}
/* BEGIN CSTYLED */
"%s: %s: invalid file type\n",
/* END CSTYLED */
exitcode++;
break;
} else {
}
/* BEGIN CSTYLED */
"%s: %s[%s]: invalid file type\n",
/* END CSTYLED */
exitcode++;
break;
} else {
is_archive++;
}
}
}
}
}
if (exitcode)
else
exit(0);
return (0);
}
static void
usagerr()
{
exitcode++;
}