Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sbquery(1) — Sun WorkShop 4.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sbcleanup(1)

sbtags(1)

sbinit(4)

workshop(1)

SBQUERY(1)

NAME

sbquery − command-line interface to the Source Browsing mode of WorkShop

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 | -v ] symbol

AVAILABILITY

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

DESCRIPTION

sbquery is the command-line interface to the Source Browsing database source-level code browser. 

To generate a Source Browsing database, add the appropriate browser option to the compiler command line, −xsb or −sb. 

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

sbquery includes two types of options to help you narrow your search. The filter options are 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 options limit 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 to library units.  To display a list of all focus options, use the −help_focus option. 

−help
Display synopsis of sbquery command. 

−help_filter language
Use without arguments to display a list of languages for which filter options are available. To display a list of filter options for a specific 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 sbquery uses temporary files when building the index file. 

−no_case
Turns off case sensitivity when searching for symbols.

−no_secondaries
Return only the primary match. 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; the default for wildcard searches. See sh(1) for more information about shell-style pattern matching. 

−show_db_dirs
List all .sb directories.  sbquery’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 version information.

−v Display version information. 

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, ignoring 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 sbquery requires 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 tries 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), sbtags(1), sbinit(4), workshop(1). 
 

SunOS 4.2  —  Last change: 06 Jun 1996

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