Programming Guide



sm_shell

Executes a system call

int sm_shell(char *cmdstr, int wait);

cmdstr
The operating system command to execute; its syntax is system-dependent.

wait
Used only in character mode, specifies whether to display an acknowledgement message before returning to the Panther application:

Returns

Description

In character mode, sm_shell clears the screen and displays any output from the specified program; on GUI platforms, display output is system-dependent.

Return values are system-dependent. For example, UNIX systems typically supply sm_shell with the executed command's return value and reason for exiting by shifting and OR'ing two values together; under Windows, the WinExec Windows API function is used and a return value greater than 31 indicates success.

On Windows, the command string must contain a filename. For example, to run batch files, specify the file extension, as in run.bat. To generate a directory listing using the dir command, specify:

command.com /c dir

Example

# On a UNIX system, check a directory listing.
call sm_shell("ls -l", 1)
#open a file...

See Also

jm_system, sm_launch