Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sbquery(1) — Sun WorkShop 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sbcleanup(1)

sbrowser(1)

sbtags(1)

sbinit(4)

SBQUERY(1)  —  USER COMMANDS

NAME

sbquery − command-line interface to Sun SourceBrowser

SYNOPSIS

sbquery [ −break_lock ] [ −files_only ] [ −filter ] [ −focus ] [ −help ]

[ −help_filter [ language ]] [ −help_focus ] [ −literal ] [ −max_memory size ]

[ −no_case ] [ −no_secondaries ] [ −no_source ] [ −no_update ] [ −o file ]

[ −pattern symbol ] [ −reg_expr ] [ −sh_pattern ] [ −show_db_dirs ]

[ −symbols_only ] [ −version ] symbol

AVAILABILITY

Available with ANSI C and Sun FORTRAN, Pascal, C++, and Assembler

DESCRIPTION

sbquery is the command-line interface to SourceBrowser, a source-level code browser. To use SourceBrowser, you issue queries that instruct SourceBrowser to find all occurrences of the symbol you have identified. These occurrences are called matches. 

To collect data for SourceBrowser, add the SourceBrowser option to the compiler command line. 

To issue a query from the command line: type sbquery, followed by any command-line options and their arguments, followed by the symbol you want to search for. SourceBrowser displays a listing of matches including the file in which the symbol appears, the line number, the function containing the symbol, and the source code containing the symbol. 

SourceBrowser includes two options designed to narrow your search. The Filter option is used to search for symbols based on how they are used in a program. For example, you could limit your search to declarations of variables. The Focus option limits your search to specific classes of code, such as particular programs, functions, or libraries. 

OPTIONS

−break_lock
Break the lock on a locked database. When you use this option, your database may be in an inconsistent state. To ensure consistency, remove the .sb subdirectory and recompile your program. 

−files_only
List the files where the symbols you are searching for appear.

−filter Limit your search for symbol to the specified filter.  For example,
sbquery −strings argv limits your search for argv to all references of strings.  To display a list of all filter options, use the −help_filter option. 

−focus
Focus your search for symbol on the specified class of code.  For example, sbquery −in_library void focuses your search for void on library units.  To display a list of all focus options, use the −help_focus option. 

−help
Display synopsis of sbquery command. 

−help_filter language
Issuing this option without arguments displays a list of languages for which filter options are available. To display a list of filter options for a language, type −help_filter, followed by the language name.  For example,
sbquery −help_filter ansi c displays all filter options for ANSI C.  To conduct a filtered query, type sbquery, followed by the filter option, followed by the symbol you want to search for. 

−help_focus
Display a list of focusing options. To issue a focused query, type sbquery followed by a focus option, followed by the symbol you want to search for. 

−literal
Match a special character to itself, not to a wildcard character. This option is especially useful when you want to search for a string that contains meta characters from other wildcard schemes.

−max_memory size
Specify the approximate amount of memory, in bytes, that should be allocated before SourceBrowser uses temporary files when building the index file.

−no_case
Instruct sbquery not to consider case when searching for symbols in the source code that match the query symbol. 

−no_secondaries
Do not return secondary matches. A secondary match is an identifier inside a macro. You might want to turn off secondary matches if you are doing a lot of filtered querying, and the symbols you are querying on are used in a lot of macros.

−no_source
Display only the filename and line number associated with each match. Do not display the source.

−no_update
Do not rebuild the index file when you issue a query following compilation.

−o file
Send output to a named file instead of to standard output.

−pattern symbol
Query on symbol, which may contain special characters, including a leading dash (-).  This allows you to query on symbols that look like command-line options.  For instance, you can query on the symbol -help , and sbquery distinguishes it from the regular option -help. 

−reg_expr
Use regular expressions when issuing a query that includes wildcards.

−sh_pattern
Use shell-style expressions when issuing a query that includes wildcards. See sh(1) for more information about shell-style pattern matching.  This wildcard setting is the default. 

−show_db_dirs
List all .sb directories.  SourceBrowser’s default is to build its database in the current working directory. 

−symbols_only
Display a list of all symbols that match the patterns specified in your search pattern.

−version
Display SourceBrowser’s current version number.

EXAMPLE

The command

sbquery

displays a synopsis of the sbquery command. 

The command

sbquery file

displays all lines that contain the symbol file. 

The command

sbquery -files_only hello

lists the files in which the symbol hello appears. 

The command

sbquery -in_function hello -no_case file

finds all instances in which file is used in the function hello.  sbquery ignores case. 

The command

sbquery -no_case -declaration file

finds all instances in which file is used in a declaration. 

The command

sbquery -reg_expr -symbols_only arg. 

displays a list of all symbols that match the regular expression arg., where "." matches any character. 

ENVIRONMENT

Environment variables store information SourceBrowser needs to know to browse the database. 

HOME The name of the user’s login directory. 

PWD The full pathname of the current directory. 

SUNPRO_SB_ATTEMPTS_MAX
The maximum number of times the index builder will try to access a locked database.

SUNPRO_SB_EX_FILE_NAME
The absolute pathname of the file sun_source_browser.ex . 

SUNPRO_SB_INIT_FILE_NAME
The absolute pathname of the .sbinit file. 

SEE ALSO

sbcleanup(1), sbrowser(1), sbtags(1), sbinit(4). 

Browsing Source Code

Sun Release 4.1  —  Last change: 05 Apr 1994

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026