%{
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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) 1999-2000 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <locale.h>
extern char prompt[];
int base = 16;
int old_value = 0;
int value = 0;
int count = 0;
int last_op_type = 0;
#define TYPE_NONE 0
#define TYPE_INODE 1
#define TYPE_DIRENT 2
#define TYPE_BLOCK 3
#define TYPE_CD 4
int error_override = 0;
int register_array[256];
#define LONG_LIST 0x1
#define RECU_LIST 0x2
#define LIST_LS 0x4
#define FIND_DIR 0x1
#define FIND_NAME 0x2
#define FIND_INODE 0x4
#define FIND_DONE 0x8
char find_dir[1024];
char find_name[1024];
%}
%union
{
};
%left '-' '+'
%left '*' '%'
%%
{
ls_flags = 0;
}
;
| register
;
{
print_prompt();
}
;
{
if (last_op_type == TYPE_INODE) {
} else if (last_op_type == TYPE_DIRENT) {
} else {
}
}
;
register : '<' WORD
{
((($2[0] >= 'a') &&
($2[0] <= 'z')) ||
(($2[0] >= 'A') &&
($2[0] <= 'Z')))) {
} else {
gettext("Registers can"
" be only a-z or A-Z\n"));
}
}
| '>' WORD
{
((($2[0] >= 'a') &&
($2[0] <= 'z')) ||
(($2[0] >= 'A') &&
($2[0] <= 'Z')))) {
} else {
gettext("Registers can"
" be only a-z or A-Z\n"));
}
}
;
{
if (($3 == 8) || ($3 == 10) || ($3 == 16)) {
base = $3;
} else {
gettext("Requested %x Only"
" Oct, Dec and"
" Hex are Supported\n"), $3);
}
}
| BASE
{
gettext("Current Base in Decimal"
" : %d\n"), base);
}
;
{
}
;
{
char temp_cwd[MAXPATHLEN];
if (temp_cwd[0] != '/') {
gettext("cwd is invalid"
"setting to /\n"));
}
} else {
}
} else {
}
}
&fl) != 0) {
gettext("Could not locate inode"
" for path %s\n"), temp_cwd);
ricb_loc)) == 0) {
gettext("Failed to translate"
" prn %x loc %x\n"),
}
} else {
gettext("%s is not a"
" directory\n"), temp_cwd);
} else {
}
}
}
| CD
{
/*
* set current value to root icb
*/
ricb_loc)) == 0) {
gettext("Failed to translate "
"prn %x loc %x\n"),
} else {
}
}
;
{
}
}
;
{
}
;
{
(find_flags & FIND_DONE)) {
if (find_dir[0] != '/') {
char buf[1024];
(cwd[0] == '/')) {
} else {
}
}
}
find_flags = 0;
find_dir[0] = '\0';
find_name[0] = '\0';
find_in = 0;
}
;
{
}
{
if (find_flags == FIND_DIR) {
== 0) {
} else {
gettext("find dir-name {-name n | -inum n}\n"));
}
} else if (find_flags == FIND_NAME) {
find_flags |= FIND_DONE;
} else if (find_flags == FIND_INODE) {
0) {
find_flags |= FIND_DONE;
} else {
gettext("find dir-name {-name n | -inum n}\n"));
}
} else {
gettext("find dir-name {-name n | -inum n}\n"));
}
}
{
if (find_flags == FIND_INODE) {
find_in = $3;
find_flags |= FIND_DONE;
} else {
gettext("find dir-name {-name n | -inum n}\n"));
}
}
;
{
}
;
{
if (last_op_type == TYPE_CD) {
} else {
}
if (verify_inode(temp, 0) != 0) {
d_entry = 0;
}
}
;
{
}
}
;
{
/* Do nothing */
}
{
} else {
}
}
;
{
if (error_override == 0) {
error_override = 1;
gettext("error checking on\n"));
} else {
error_override = 0;
gettext("error checking off\n"));
}
}
;
{
}
;
{
}
;
{
exit (0);
}
;
{
print_desc(value, 0);
}
;
{
}
;
;
;
;
;
;
;
{
}
;
{
}
;
{
}
;
;
;
;
;
;
;
;
;
;
{
gettext("Invalid command\n"));
} else {
}
}
| '?' WORD
{
0) != 0) {
}
value) == 0) {
value);
}
} else {
gettext("Invalid command\n"));
}
}
;
{
value = $1;
count = 0;
}
{
value = $1;
count = $3;
}
;
{
if (last_op_type == TYPE_INODE) {
0) != 0) {
i_number ++;
}
} else if (last_op_type == TYPE_DIRENT) {
d_entry + 1) == 0) {
d_entry ++;
d_entry);
}
} else {
}
}
| '-'
{
if (last_op_type == TYPE_INODE) {
0) != 0) {
i_number --;
}
} else if (last_op_type == TYPE_DIRENT) {
d_entry - 1) == 0) {
d_entry --;
d_entry);
}
} else {
}
}
| '-' WORD
{
count = 0;
}
}
| '+' WORD
{
count = 0;
}
}
| '*' WORD
{
count = 0;
}
}
| '%' WORD
{
if (number == 0) {
gettext("Divide by zero ?\n"));
} else {
count = 0;
}
}
}
{
if ($3 == 0) {
gettext("Divide by zero ?\n"));
} else {
$$ = $1 / $3;
}
count = 0;
}
| WORD
{
count = 0;
$$ = number;
}
}
;
%%
{
*value = 0;
/*
* Decide on what base to be used
* and strip off the base specifier
*/
cbase = 0x10;
index = 2;
cbase = 0xa;
index = 2;
} else if (str[0] == '0') {
cbase = 0x8;
index = 1;
} else {
index = 0;
}
/*
* Verify if the string is integer
* and convert to a binary value
*/
if (cbase == 0x8) {
gettext("Invalid Octal Number %s\n"),
str);
return (1);
}
} else if (cbase == 0xa) {
gettext("Invalid Decimal Number %s\n"),
str);
return (1);
}
} else {
} else {
gettext("Invalid Hex Number %s\n"),
str);
return (1);
}
}
}
return (0);
}
void print_prompt();
void
{
}
run_fsdb()
{
if (yyparse() != 0)
return (-1);
return 0;
}