system

Executes operating system commands.

Library:LibC
Classification:ANSI
Service:General C Services

Syntax

  #include <stdlib.h> 
   
  int system (
     const char   *command); 
  

Parameters

command

(IN) Points to a command to execute. On NetWare 6 and earlier, this string can be 1 to 512 bytes. On NetWare 6.5, this string can be 1 to 2048 bytes. If you compile your NLM to use POSIX semantics, the string can also be the name of an NLM to load.

Return Values

If successful in passing the command to the operating system, returns 0.

If command is a NULL pointer, returns a nonzero value, indicating that a command processor is available.

If the command string is too long, returns -1 and sets errno to the following:

Decimal

Constant

Description

65

ENAMETOOLONG

The command parameter exceeds the maximum length of bytes.

Remarks

This function always echoes input directly to the system console screen. Errors in executing the command are shown on the system console screen.

NOTE:If the console operator is typing, your string will be intermixed with the input from the console operator.

The system function can be used to execute any console command, for example:

  system ("NCF_FILE") /* executes an .NCF file */
  system ("DOWN")      /* brings the server down */
  

In a console command, no command-line options are allowed once redirection operators (< or >) have been employed.

If you compile your NLM with POSIX semantics, which is supported in NetWare 6.5 SP3 and later, the system function can also be used to load another NLM. For more information about the posixpre file and the POSIX semantics linker flag, see Selecting A Prelude File in Libraries for C (LibC), Volume 1.

See Also