Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ macquery(1M) — A/UX 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought




macquery(1M) macquery(1M)
NAME macquery - post a Macintosh(Reg.) alert box to query the user SYNOPSIS macquery [-t timeout] [-a] [-c] [-n] [-s] resource-file alertID [parm1 ... parm4] DESCRIPTION macquery is invoked by shell scripts or commands that do not directly use the Macintosh Toolbox but still need to present a Macintosh interface when asking the user simple questions or giving the user information. It is used to post an alert box that asks a question or supplies information. The alert box may include static text, icons, and QuickDraw pictures, but should not include check boxes, radio buttons, editable text fields, or other more complex controls. (See Chapter 13 of Inside Macintosh, Volume I, for more information about alerts and controls.) Typically, Apple's ResEdit utility is used to create alert resource definitions. The command that invokes macquery must supply a resource filename resource-file and the ID alertID of an alert resource defined in that file. The alert is posted exactly as it is defined in the resource, unless a flag option indi- cates that one of the standard alert icons should also be displayed in the alert box. (See Inside Macintosh, Volume I, for more discussion of the various types of standard alerts.) Up to four parameter strings may be included in the argu- ments. These replace the corresponding special strings `^0' through `^3' in the strings in the alert definition. (See the discussion of the ParamText call in Inside Macintosh, Volume I, for further discussion of parameter strings usage.) When the user chooses an enabled button, macquery closes the alert and exits. The exit status indicates which button the user chose (or that an error occurred). See the section ``EXIT CODES'' for more information. FLAG OPTIONS The following flag options are interpreted by macquery: -t timeout Select the default button automatically if the user has not selected a button in the alert box after timeout seconds. The default button must be the first item in the alert definition and is indicated visually by a bold outline. April, 1990 1



macquery(1M) macquery(1M)
-a Post the alert box exactly as it is defined in the resource file. -c Post the alert box as a Caution alert box. -n Post the alert box as a Note alert box. -s Post the alert box as a Stop alert box. EXAMPLE Because fsck(1M) is not linked as an A/UX(Reg.) Toolbox com- mand, the Macintosh environment does not have to be running to run fsck. However, fsck can invoke macquery to ask the user whether to repair damaged file systems. If the Macintosh environment is not running, macquery exits quickly with an error exit status. In this case, if fsck is running on /dev/console, its prompt messages would be displayed on the screen, and fsck reads the user's response from /dev/console instead of using the exit status of macquery. The command that fsck uses to display the alert box is: /mac/bin/macquery -ttimeout -c /etc/fsck 129 file-system-mount-point In this example, the value of timeout is supplied as an ar- gument to fsck. The file-system-mount-point is the pathname at which the file system that needs repairs would be mount- ed, for example, "/". EXIT CODE The exit status is used both to indicate an error and to re- port which button the user clicked. If the exit status is 1, an error occurred. For example, the Macintosh environment is not running, or the resource file is missing. Diagnostic alert boxes or printed messages are posted. If the exit status is between 201 and 225, the user chose the corresponding item numbered between 1 and 25 in the alert resource. Thus, an exit status of 201 indicates that the default button was chosen. Constants named ANSWER_MIN and ANSWER_MAX have been defined for these values in /usr/include/apple/macquery.h for use by C programmers. FILES /mac/bin/macquery /mac/bin/%macquery /usr/include/apple/macquery.h 2 April, 1990



macquery(1M) macquery(1M)
SEE ALSO Inside Macintosh, Volumes I and V. April, 1990 3

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