* ========== Copyright Header Begin ==========================================
* Hypervisor Software File: aschk_main.c
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* - Do no alter or remove copyright notices
* - Redistribution and use of this software in source and binary forms, with
* or without modification, are permitted provided that the following
* - Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistribution in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of Sun Microsystems, Inc. or the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* This software is provided "AS IS," without a warranty of any kind.
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
* MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
* ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
* OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
* FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* You acknowledge that this software is not designed, licensed or
* intended for use in the design, construction, operation or maintenance of
* ========== Copyright Header End ============================================
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
#pragma ident "@(#)aschk_main.c 1.3 07/06/07 SMI"
static void check_file(char *fnamep
);
static void add_name_file(char *fnamep
);
bool_t flag_suppress_unknowns
;
main(int argc
, char **argv
)
flag_suppress_unknowns
= false;
flag_strict_mode
= false;
for (i
= 1; i
< argc
&& argv
[i
][0] == '-'; i
++) {
add_name_file(argv
[++i
]);
flag_suppress_unknowns
= true;
fprintf(stderr
, "Completed with %d warnings\n", warning_count
);
return ((warning_count
!= 0) ? 1 : 0);
fprintf(stderr
, "aschk [-s] [-u] [-n <chk file>] <testfile.s>"
"\t-u = suppress warnings for unknowns\n"
"\t-s = strict mode; non-zero exit if warning count >0\n"
"\t-n = specify name table file\n");
add_name_file(char *fnamep
)
fprintf(stderr
, "Opening: %s : %s\n", fnamep
, strerror(errno
));
while (fgets(linebuf
, MAXLINE
, fp
) != NULL
) {
/* skip comments and directives */
if (linebuf
[0] == '!' || linebuf
[0] == '#')
if (sscanf(linebuf
, "%4s %x %x %s\n", typestr
,
&offset
, &size
, symname
) != 4)
DBG(printf("Sym: %s\t@ 0x%x\tsize=0x%x\ttype=%s\n",
symname
, offset
, size
, typestr
));
case 'p': flags
|= Sym_pointer
; break;
case 'u': flags
|= Sym_unsigned
; break;
case 's': flags
|= Sym_signed
; break;
fprintf(stderr
, "Unknown check type for line %d\n",
if (typestr
[1] == 'c') flags
|= Sym_char
;
symp
= new_sym(flags
, symname
, offset
, size
);