ajsys.c

Datatypes: none


Datatype: none

System utility functions

Sections: Argument list manipulation functions System cast functions System functions for files Wrappers to commands Wrappers to C functions executing commands executing programs Miscellaneous system functions piped commands exit


Section: Argument list manipulation functions

Function for manipulating argument list.

Functions: ajSysArglistBuildC ajSysArglistBuildS ajSysArglistFree


Function ajSysArglistBuildC

Generates a program name and argument list from a command line string.

Synopsis

Prototype
AjBool ajSysArglistBuildC (
      const char* cmdlinetxt,
      char** Pname,
      char*** PParglist
);

TypeNameRead/WriteDescription
const char*cmdlinetxtInputCommand line.
char**PnameOutputProgram name.
char***PParglistOutputArgument list.
AjBool RETURNajTrue on success.

Input
cmdlinetxt:(Input)Command line.
Output
Pname:(Output)Program name.
PParglist:(Output)Argument list.
Returns
AjBool:ajTrue on success.

Description

Generates a program name and argument list from a command line string.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysArglistBuildS

Generates a program name and argument list from a command line string.

Synopsis

Prototype
AjBool ajSysArglistBuildS (
      const AjPStr cmdline,
      char** Pname,
      char*** PParglist
);

TypeNameRead/WriteDescription
const AjPStrcmdlineInputCommand line.
char**PnameOutputProgram name.
char***PParglistOutputArgument list.
AjBool RETURNajTrue on success.

Input
cmdline:(Input)Command line.
Output
Pname:(Output)Program name.
PParglist:(Output)Argument list.
Returns
AjBool:ajTrue on success.

Description

Generates a program name and argument list from a command line string.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysArglistFree

Free memory in an argument list allocated by ajSysArgList

Synopsis

Prototype
void ajSysArglistFree (
      char*** PParglist
);

TypeNameRead/WriteDescription
char***PParglistOutputArgument list.
void RETURN

Output
PParglist:(Output)Argument list.
Returns
void:No return value

Description

Free memory in an argument list allocated by ajSysArgList

See Also

See other functions in this section

Availability

In release 6.4.0

Section: System cast functions

Function for casting one datatype to another.

Functions: ajSysCastItoc ajSysCastItouc


Function ajSysCastItoc

Convert Int to Char Needed for very fussy compilers i.e. Digital C

Synopsis

Prototype
char ajSysCastItoc (
      ajint v
);

TypeNameRead/WriteDescription
ajintvInputinteger
char RETURNCharacter cast

Input
v:(Input)integer
Returns
char:Character cast

Description

Convert Int to Char Needed for very fussy compilers i.e. Digital C

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysCastItouc

Convert Int to Unsigned Char Needed for very fussy compilers i.e. Digital C

Synopsis

Prototype
unsigned char ajSysCastItouc (
      ajint v
);

TypeNameRead/WriteDescription
ajintvInputinteger
unsigned char RETURNUnsigned character cast

Input
v:(Input)integer
Returns
unsigned char:Unsigned character cast

Description

Convert Int to Unsigned Char Needed for very fussy compilers i.e. Digital C

See Also

See other functions in this section

Availability

In release 6.4.0

Section: System functions for files

System functions for files.

Functions: ajSysFileRmrfC ajSysFileUnlinkC ajSysFileUnlinkS ajSysFileWhich ajSysFileWhichEnv ajSysGetHomedir ajSysGetHomedirFromName


Function ajSysFileRmrfC

Forcibly delete a directory tree

Synopsis

Prototype
AjBool ajSysFileRmrfC (
      const char* path
);

TypeNameRead/WriteDescription
const char*pathInputDirectory path
AjBool RETURNtrue if deleted false otherwise

Input
path:(Input)Directory path
Returns
AjBool:true if deleted false otherwise

Description

Forcibly delete a directory tree

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysFileUnlinkC

Deletes a file or link

Synopsis

Prototype
AjBool ajSysFileUnlinkC (
      const char* filename
);

TypeNameRead/WriteDescription
const char*filenameInputFilename in AjStr.
AjBool RETURNtrue if deleted false otherwise

Input
filename:(Input)Filename in AjStr.
Returns
AjBool:true if deleted false otherwise

Description

Deletes a file or link

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysFileUnlinkS

Deletes a file or link

Synopsis

Prototype
AjBool ajSysFileUnlinkS (
      const AjPStr filename
);

TypeNameRead/WriteDescription
const AjPStrfilenameInputFilename in AjStr.
AjBool RETURNtrue if deleted false otherwise

Input
filename:(Input)Filename in AjStr.
Returns
AjBool:true if deleted false otherwise

Description

Deletes a file or link

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysFileWhich

Gets the Basename of a file then searches $PATH sequentially until it finds a user-EXECUTABLE file of the same name.

Synopsis

Prototype
AjBool ajSysFileWhich (
      AjPStr* Pfilename
);

TypeNameRead/WriteDescription
AjPStr*PfilenameModifyFilename in AjStr, replaced by full pathname
AjBool RETURNTrue if executable found, false otherwise

Input & Output
Pfilename:(Modify)Filename in AjStr, replaced by full pathname
Returns
AjBool:True if executable found, false otherwise

Description

Gets the Basename of a file then searches $PATH sequentially until it finds a user-EXECUTABLE file of the same name.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysFileWhichEnv

Gets the Basename of a file then searches $PATH sequentially until it finds a user-EXECUTABLE file of the same name. Reentrant.

Synopsis

Prototype
AjBool ajSysFileWhichEnv (
      AjPStr* Pfilename,
      char* const[] env
);

TypeNameRead/WriteDescription
AjPStr*PfilenameModifyFilename in AjStr, replaced by full pathname
char* const[]envInputEnvironment
AjBool RETURNTrue if executable found, false otherwise

Input
env:(Input)Environment
Input & Output
Pfilename:(Modify)Filename in AjStr, replaced by full pathname
Returns
AjBool:True if executable found, false otherwise

Description

Gets the Basename of a file then searches $PATH sequentially until it finds a user-EXECUTABLE file of the same name. Reentrant.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysGetHomedir

Get the home directory of the current user

Synopsis

Prototype
char* ajSysGetHomedir (
      void
);

TypeNameRead/WriteDescription
char* RETURNHome directory or NULL

Returns
char*:Home directory or NULL

Description

Get the home directory of the current user

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysGetHomedirFromName

Get a home directory location from a username

Synopsis

Prototype
char* ajSysGetHomedirFromName (
      const char* username
);

TypeNameRead/WriteDescription
const char*usernameInputUsername
char* RETURNHome directory or NULL

Input
username:(Input)Username
Returns
char*:Home directory or NULL

Description

Get a home directory location from a username

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Wrappers to commands

Functions for invoking commands

Functions: ajSysCommandCopyC ajSysCommandCopyS ajSysCommandMakedirC ajSysCommandMakedirS ajSysCommandRemoveC ajSysCommandRemoveS ajSysCommandRemovedirC ajSysCommandRemovedirS ajSysCommandRenameC ajSysCommandRenameS


Function ajSysCommandCopyC

Copy a file

Synopsis

Prototype
AjBool ajSysCommandCopyC (
      const char* name,
      const char* name2
);

TypeNameRead/WriteDescription
const char*nameInputSource filename
const char*name2InputTarget filename
AjBool RETURNTrue on success

Input
name:(Input)Source filename
name2:(Input)Target filename
Returns
AjBool:True on success

Description

Copy a file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysCommandCopyS

Copy a file

Synopsis

Prototype
AjBool ajSysCommandCopyS (
      const AjPStr strname,
      const AjPStr strname2
);

TypeNameRead/WriteDescription
const AjPStrstrnameInputSource filename
const AjPStrstrname2InputTarget filename
AjBool RETURNTrue on success

Input
strname:(Input)Source filename
strname2:(Input)Target filename
Returns
AjBool:True on success

Description

Copy a file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysCommandMakedirC

Delete a file

Synopsis

Prototype
AjBool ajSysCommandMakedirC (
      const char* name
);

TypeNameRead/WriteDescription
const char*nameInputDirectory
AjBool RETURNTrue on success

Input
name:(Input)Directory
Returns
AjBool:True on success

Description

Delete a file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysCommandMakedirS

Delete a file

Synopsis

Prototype
AjBool ajSysCommandMakedirS (
      const AjPStr strname
);

TypeNameRead/WriteDescription
const AjPStrstrnameInputDirectory
AjBool RETURNTrue on success

Input
strname:(Input)Directory
Returns
AjBool:True on success

Description

Delete a file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysCommandRemoveC

Delete a file

Synopsis

Prototype
AjBool ajSysCommandRemoveC (
      const char* name
);

TypeNameRead/WriteDescription
const char*nameInputFilename
AjBool RETURNTrue on success

Input
name:(Input)Filename
Returns
AjBool:True on success

Description

Delete a file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysCommandRemoveS

Delete a file

Synopsis

Prototype
AjBool ajSysCommandRemoveS (
      const AjPStr strname
);

TypeNameRead/WriteDescription
const AjPStrstrnameInputFilename
AjBool RETURNTrue on success

Input
strname:(Input)Filename
Returns
AjBool:True on success

Description

Delete a file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysCommandRemovedirC

Delete a file

Synopsis

Prototype
AjBool ajSysCommandRemovedirC (
      const char* name
);

TypeNameRead/WriteDescription
const char*nameInputDirectory
AjBool RETURNTrue on success

Input
name:(Input)Directory
Returns
AjBool:True on success

Description

Delete a file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysCommandRemovedirS

Delete a file

Synopsis

Prototype
AjBool ajSysCommandRemovedirS (
      const AjPStr strname
);

TypeNameRead/WriteDescription
const AjPStrstrnameInputDirectory
AjBool RETURNTrue on success

Input
strname:(Input)Directory
Returns
AjBool:True on success

Description

Delete a file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysCommandRenameC

Rename a file

Synopsis

Prototype
AjBool ajSysCommandRenameC (
      const char* name,
      const char* name2
);

TypeNameRead/WriteDescription
const char*nameInputSource filename
const char*name2InputTarget filename
AjBool RETURNTrue on success

Input
name:(Input)Source filename
name2:(Input)Target filename
Returns
AjBool:True on success

Description

Rename a file

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysCommandRenameS

Rename a file

Synopsis

Prototype
AjBool ajSysCommandRenameS (
      const AjPStr strname,
      const AjPStr strname2
);

TypeNameRead/WriteDescription
const AjPStrstrnameInputSource filename
const AjPStrstrname2InputTarget filename
AjBool RETURNTrue on success

Input
strname:(Input)Source filename
strname2:(Input)Target filename
Returns
AjBool:True on success

Description

Rename a file

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Wrappers to C functions

Functions for calling or substituting C-functions.

Functions: ajSysFuncFdopen ajSysFuncFgets ajSysFuncFopen ajSysFuncSocket ajSysFuncStrdup ajSysFuncStrtok ajSysFuncStrtokR


Function ajSysFuncFdopen

Place non-ANSI fdopen here

Synopsis

Prototype
FILE* ajSysFuncFdopen (
      ajint filedes,
      const char* mode
);

TypeNameRead/WriteDescription
ajintfiledesInputfile descriptor
const char*modeInputfile mode
FILE* RETURNfile pointer

Input
filedes:(Input)file descriptor
mode:(Input)file mode
Returns
FILE*:file pointer

Description

Place non-ANSI fdopen here

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysFuncFgets

An fgets replacement that will cope with Mac OSX <CR> files

Synopsis

Prototype
char* ajSysFuncFgets (
      char* buf,
      int size,
      FILE* fp
);

TypeNameRead/WriteDescription
char*bufOutputbuffer
intsizeInputmaximum length to read
FILE*fpModifystream
char* RETURNbuf or NULL

Input
size:(Input)maximum length to read
Output
buf:(Output)buffer
Input & Output
fp:(Modify)stream
Returns
char*:buf or NULL

Description

An fgets replacement that will cope with Mac OSX <CR> files

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysFuncFopen

An fopen replacement to cope with cygwin and windows

Synopsis

Prototype
FILE* ajSysFuncFopen (
      const char* name,
      const char* flags
);

TypeNameRead/WriteDescription
const char*nameInputfile to open
const char*flagsInputr/w/a flags
FILE* RETURNfile or NULL

Input
name:(Input)file to open
flags:(Input)r/w/a flags
Returns
FILE*:file or NULL

Description

An fopen replacement to cope with cygwin and windows

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysFuncSocket

Socket function coping with UNIX and WIN32

Synopsis

Prototype
SOCKRET ajSysFuncSocket (
      int domain,
      int type,
      int protocol
);

TypeNameRead/WriteDescription
intdomainInputDomain
inttypeInputType
intprotocolInputProtocol
SOCKRET RETURNUniversal (UNIX/WIN32) socket value

Input
domain:(Input)Domain
type:(Input)Type
protocol:(Input)Protocol
Returns
SOCKRET:Universal (UNIX/WIN32) socket value

Description

Socket function coping with UNIX and WIN32

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysFuncStrdup

Duplicate BSD strdup function for very strict ANSI compilers

Synopsis

Prototype
char* ajSysFuncStrdup (
      const char* dupstr
);

TypeNameRead/WriteDescription
const char*dupstrInputstring to duplicate
char* RETURNText string as for strdup

Input
dupstr:(Input)string to duplicate
Returns
char*:Text string as for strdup

Description

Duplicate BSD strdup function for very strict ANSI compilers

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysFuncStrtok

strtok that doesn't corrupt the source string

Synopsis

Prototype
char* ajSysFuncStrtok (
      const char* srcstr,
      const char* delimstr
);

TypeNameRead/WriteDescription
const char*srcstrInputsource string
const char*delimstrInputdelimiter string
char* RETURNpointer or NULL when nothing is found

Input
srcstr:(Input)source string
delimstr:(Input)delimiter string
Returns
char*:pointer or NULL when nothing is found

Description

strtok that doesn't corrupt the source string

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysFuncStrtokR

Reentrant strtok that doesn't corrupt the source string. This function uses a string buffer provided by the caller.

Synopsis

Prototype
char* ajSysFuncStrtokR (
      const char* srcstr,
      const char* delimstr,
      const char** ptrptr,
      AjPStr* buf
);

TypeNameRead/WriteDescription
const char*srcstrModifysource string
const char*delimstrInputdelimiter string
const char**ptrptrModifyptr save
AjPStr*bufOutputresult buffer
char* RETURNpointer or NULL

Input
delimstr:(Input)delimiter string
Output
buf:(Output)result buffer
Input & Output
srcstr:(Modify)source string
ptrptr:(Modify)ptr save
Returns
char*:pointer or NULL

Description

Reentrant strtok that doesn't corrupt the source string. This function uses a string buffer provided by the caller.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: executing commands

Functions for executing commands

Functions: ajSysExecC ajSysExecS ajSysExecEnvC ajSysExecEnvS ajSysExecLocaleC ajSysExecLocaleS ajSysExecOutnameC ajSysExecOutnameS ajSysExecOutnameAppendC ajSysExecOutnameAppendS ajSysExecOutnameErrC ajSysExecOutnameErrS ajSysExecOutnameErrAppendC ajSysExecOutnameErrAppendS ajSysExecPathC ajSysExecPathS ajSysExecRedirectC


Function ajSysExecC

Exec a command line as if from the C shell

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecC (
      const char* cmdlinetxt
);

TypeNameRead/WriteDescription
const char*cmdlinetxtInputThe command line
ajint RETURNExit status

Input
cmdlinetxt:(Input)The command line
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecS

Exec a command line as if from the C shell

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecS (
      const AjPStr cmdline
);

TypeNameRead/WriteDescription
const AjPStrcmdlineInputThe command line
ajint RETURNExit status

Input
cmdline:(Input)The command line
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecEnvC

Exec a command line as if from the C shell

This routine must be passed the environment received from main(ajint argc, char **argv, char **env) The environment is used to extract the PATH list (see ajWhich)

Note that the environment is passed through unaltered. The exec'd program is passed a new argv array

Synopsis

Prototype
ajint ajSysExecEnvC (
      const char* cmdlinetxt,
      char* const[] env
);

TypeNameRead/WriteDescription
const char*cmdlinetxtInputThe command line
char* const[]envInputThe environment
ajint RETURNExit status

Input
cmdlinetxt:(Input)The command line
env:(Input)The environment
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell

This routine must be passed the environment received from main(ajint argc, char **argv, char **env) The environment is used to extract the PATH list (see ajWhich)

Note that the environment is passed through unaltered. The exec'd program is passed a new argv array

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecEnvS

Exec a command line as if from the C shell

This routine must be passed the environment received from main(ajint argc, char **argv, char **env) The environment is used to extract the PATH list (see ajWhich)

Note that the environment is passed through unaltered. The exec'd program is passed a new argv array

Synopsis

Prototype
ajint ajSysExecEnvS (
      const AjPStr cmdline,
      char* const[] env
);

TypeNameRead/WriteDescription
const AjPStrcmdlineInputThe command line
char* const[]envInputThe environment
ajint RETURNExit status

Input
cmdline:(Input)The command line
env:(Input)The environment
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell

This routine must be passed the environment received from main(ajint argc, char **argv, char **env) The environment is used to extract the PATH list (see ajWhich)

Note that the environment is passed through unaltered. The exec'd program is passed a new argv array

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecLocaleC

Exec a command line as if from the C shell with a defined locale variable.

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecLocaleC (
      const char* cmdlinetxt,
      const char* localetxt
);

TypeNameRead/WriteDescription
const char*cmdlinetxtInputThe command line
const char*localetxtInputThe locale value
ajint RETURNExit status

Input
cmdlinetxt:(Input)The command line
localetxt:(Input)The locale value
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell with a defined locale variable.

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecLocaleS

Exec a command line as if from the C shell with a defined locale variable.

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecLocaleS (
      const AjPStr cmdline,
      const AjPStr localestr
);

TypeNameRead/WriteDescription
const AjPStrcmdlineInputThe command line
const AjPStrlocalestrInputThe locale value
ajint RETURNExit status

Input
cmdline:(Input)The command line
localestr:(Input)The locale value
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell with a defined locale variable.

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecOutnameC

Exec a command line as if from the C shell with standard output redirected to and overwriting a named file

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecOutnameC (
      const char* cmdlinetxt,
      const char* outfnametxt
);

TypeNameRead/WriteDescription
const char*cmdlinetxtInputThe command line
const char*outfnametxtInputThe output file name
ajint RETURNExit status

Input
cmdlinetxt:(Input)The command line
outfnametxt:(Input)The output file name
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell with standard output redirected to and overwriting a named file

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecOutnameS

Exec a command line as if from the C shell with standard output redirected to and overwriting a named file

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecOutnameS (
      const AjPStr cmdline,
      const AjPStr outfname
);

TypeNameRead/WriteDescription
const AjPStrcmdlineInputThe command line
const AjPStroutfnameInputThe output file name
ajint RETURNExit status

Input
cmdline:(Input)The command line
outfname:(Input)The output file name
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell with standard output redirected to and overwriting a named file

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecOutnameAppendC

Exec a command line as if from the C shell with standard output redirected and appended to a named file

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecOutnameAppendC (
      const char* cmdlinetxt,
      const char* outfnametxt
);

TypeNameRead/WriteDescription
const char*cmdlinetxtInputThe command line
const char*outfnametxtInputThe output file name
ajint RETURNExit status

Input
cmdlinetxt:(Input)The command line
outfnametxt:(Input)The output file name
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell with standard output redirected and appended to a named file

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecOutnameAppendS

Exec a command line as if from the C shell with standard output redirected and appended to a named file

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecOutnameAppendS (
      const AjPStr cmdline,
      const AjPStr outfname
);

TypeNameRead/WriteDescription
const AjPStrcmdlineInputThe command line
const AjPStroutfnameInputThe output file name
ajint RETURNExit status

Input
cmdline:(Input)The command line
outfname:(Input)The output file name
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell with standard output redirected and appended to a named file

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecOutnameErrC

Exec a command line as if from the C shell with standard output and standard error redirected to and overwriting a named file

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecOutnameErrC (
      const char* cmdlinetxt,
      const char* outfnametxt
);

TypeNameRead/WriteDescription
const char*cmdlinetxtInputThe command line
const char*outfnametxtInputThe output file name
ajint RETURNExit status

Input
cmdlinetxt:(Input)The command line
outfnametxt:(Input)The output file name
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell with standard output and standard error redirected to and overwriting a named file

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecOutnameErrS

Exec a command line as if from the C shell with standard output and standard error redirected to and overwriting a named file

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecOutnameErrS (
      const AjPStr cmdline,
      const AjPStr outfname
);

TypeNameRead/WriteDescription
const AjPStrcmdlineInputThe command line
const AjPStroutfnameInputThe output file name
ajint RETURNExit status

Input
cmdline:(Input)The command line
outfname:(Input)The output file name
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell with standard output and standard error redirected to and overwriting a named file

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecOutnameErrAppendC

Exec a command line as if from the C shell with standard output and standard error redirected and appended to a named file

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecOutnameErrAppendC (
      const char* cmdlinetxt,
      const char* outfnametxt
);

TypeNameRead/WriteDescription
const char*cmdlinetxtInputThe command line
const char*outfnametxtInputThe output file name
ajint RETURNExit status

Input
cmdlinetxt:(Input)The command line
outfnametxt:(Input)The output file name
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell with standard output and standard error redirected and appended to a named file

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecOutnameErrAppendS

Exec a command line as if from the C shell with standard output and standard error redirected and appended to a named file

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecOutnameErrAppendS (
      const AjPStr cmdline,
      const AjPStr outfname
);

TypeNameRead/WriteDescription
const AjPStrcmdlineInputThe command line
const AjPStroutfnameInputThe output file name
ajint RETURNExit status

Input
cmdline:(Input)The command line
outfname:(Input)The output file name
Returns
ajint:Exit status

Description

Exec a command line as if from the C shell with standard output and standard error redirected and appended to a named file

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecPathC

Exec a command line with a test for the program name in the current path

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecPathC (
      const char* cmdlinetxt
);

TypeNameRead/WriteDescription
const char*cmdlinetxtInputThe command line
ajint RETURNExit status

Input
cmdlinetxt:(Input)The command line
Returns
ajint:Exit status

Description

Exec a command line with a test for the program name in the current path

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecPathS

Exec a command line with a test for the program name in the current path

The exec'd program is passed a new argv array in argptr

Synopsis

Prototype
ajint ajSysExecPathS (
      const AjPStr cmdline
);

TypeNameRead/WriteDescription
const AjPStrcmdlineInputThe command line
ajint RETURNExit status

Input
cmdline:(Input)The command line
Returns
ajint:Exit status

Description

Exec a command line with a test for the program name in the current path

The exec'd program is passed a new argv array in argptr

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecRedirectC

Execute an application redirecting its stdin/out to pipe fds

Synopsis

Prototype
AjBool ajSysExecRedirectC (
      const char* cmdlinetxt,
      int** pipeto,
      int** pipefrom
);

TypeNameRead/WriteDescription
const char*cmdlinetxtInputCommand string. The string may end with a trailing pipe character.
int**pipetoOutputpipes to the process
int**pipefromOutputpipes from the process
AjBool RETURNTrue on success

Input
cmdlinetxt:(Input)Command string. The string may end with a trailing pipe character.
Output
pipeto:(Output)pipes to the process
pipefrom:(Output)pipes from the process
Returns
AjBool:True on success

Description

Execute an application redirecting its stdin/out to pipe fds

See Also

See other functions in this section

Availability

In release 6.4.0

Section: executing programs

Functions for executing programs

Functions: ajSysExecprogNowaitC ajSysExecprogNowaitS


Function ajSysExecprogNowaitC

Exec a command line with no parent wait

This routine must be passed a program, an argument list and an environment. The wait handling is performed by user-supplied parent process code and is therefore used by the Java Native Interface software.

Synopsis

Prototype
ajint ajSysExecprogNowaitC (
      const char* prog,
      char* const[] arg,
      char* const[] env
);

TypeNameRead/WriteDescription
const char*progInputThe command line
char* const[]argInputArgument list
char* const[]envInputAn environment
ajint RETURNExit status

Input
prog:(Input)The command line
arg:(Input)Argument list
env:(Input)An environment
Returns
ajint:Exit status

Description

Exec a command line with no parent wait

This routine must be passed a program, an argument list and an environment. The wait handling is performed by user-supplied parent process code and is therefore used by the Java Native Interface software.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysExecprogNowaitS

Exec a command line with no parent wait

This routine must be passed a program, an argument list and an environment. The wait handling is performed by user-supplied parent process code and is therefore used by the Java Native Interface software.

Synopsis

Prototype
ajint ajSysExecprogNowaitS (
      const AjPStr progstr,
      char* const[] arg,
      char* const[] env
);

TypeNameRead/WriteDescription
const AjPStrprogstrInputThe command line
char* const[]argInputArgument list
char* const[]envInputAn environment
ajint RETURNExit status

Input
progstr:(Input)The command line
arg:(Input)Argument list
env:(Input)An environment
Returns
ajint:Exit status

Description

Exec a command line with no parent wait

This routine must be passed a program, an argument list and an environment. The wait handling is performed by user-supplied parent process code and is therefore used by the Java Native Interface software.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Miscellaneous system functions

Miscellaneous system functions

Functions: ajSysCanon ajSysFdFromSocket ajSysSocketclose ajSysTimeoutSet ajSysTimeoutUnset


Function ajSysCanon

Sets or unsets TTY canonical mode

Synopsis

Prototype
void ajSysCanon (
      AjBool state
);

TypeNameRead/WriteDescription
AjBoolstateInputstate=true sets canon state=false sets noncanon
void RETURN

Input
state:(Input)state=true sets canon state=false sets noncanon
Returns
void:No return value

Description

Sets or unsets TTY canonical mode

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysFdFromSocket

Return a file descriptor from a UNIX of Windows socket

Synopsis

Prototype
FILE* ajSysFdFromSocket (
      const struct AJSOCKET sock,
      const char* mode
);

TypeNameRead/WriteDescription
const struct AJSOCKETsockInputAJAX socket structure
const char*modeInputOpening mode ("r" or "a")
FILE* RETURNFile descriptor

Input
sock:(Input)AJAX socket structure
mode:(Input)Opening mode ("r" or "a")
Returns
FILE*:File descriptor

Description

Return a file descriptor from a UNIX of Windows socket

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysSocketclose

Closes a UNIX or WIN32 socket

Synopsis

Prototype
void ajSysSocketclose (
      struct AJSOCKET sock
);

TypeNameRead/WriteDescription
struct AJSOCKETsockModifyAJAX socket structure
void RETURN

Input & Output
sock:(Modify)AJAX socket structure
Returns
void:No return value

Description

Closes a UNIX or WIN32 socket

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysTimeoutSet

Sets an alarm abort timeout for UNIX and Windows

Synopsis

Prototype
int ajSysTimeoutSet (
      struct AJTIMEOUT* ts
);

TypeNameRead/WriteDescription
struct AJTIMEOUT*tsModifyAJAX timeout structure
int RETURN0 = success -1 = error

Input & Output
ts:(Modify)AJAX timeout structure
Returns
int:0 = success -1 = error

Description

Sets an alarm abort timeout for UNIX and Windows

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysTimeoutUnset

Unsets an alarm abort timeout for UNIX and Windows

Synopsis

Prototype
int ajSysTimeoutUnset (
      struct AJTIMEOUT* ts
);

TypeNameRead/WriteDescription
struct AJTIMEOUT*tsModifyAJAX timeout structure
int RETURN0 = success -1 = error

Input & Output
ts:(Modify)AJAX timeout structure
Returns
int:0 = success -1 = error

Description

Unsets an alarm abort timeout for UNIX and Windows

See Also

See other functions in this section

Availability

In release 6.4.0

Section: piped commands

system command lines piped to a file

Functions: ajSysCreateInpipeC ajSysCreateInpipeS


Function ajSysCreateInpipeC

Return a new file object from which to read the output from a command.

Synopsis

Prototype
AjPFile ajSysCreateInpipeC (
      const char* cmdlinetxt
);

TypeNameRead/WriteDescription
const char*cmdlinetxtInputCommand string. The string may end with a trailing pipe character.
AjPFile RETURNNew file object.

Input
cmdlinetxt:(Input)Command string. The string may end with a trailing pipe character.
Returns
AjPFile:New file object.

Description

Return a new file object from which to read the output from a command.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSysCreateInpipeS

Return a new file object from which to read the output from a command.

Synopsis

Prototype
AjPFile ajSysCreateInpipeS (
      const AjPStr command
);

TypeNameRead/WriteDescription
const AjPStrcommandInputCommand string. The string may end with a trailing pipe character.
AjPFile RETURNNew file object.

Input
command:(Input)Command string. The string may end with a trailing pipe character.
Returns
AjPFile:New file object.

Description

Return a new file object from which to read the output from a command.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: exit

Functions called on exit from the program by ajExit to do any necessary cleanup and to report internal statistics to the debug file

Functions: ajSysExit


Function ajSysExit

Cleans up system internals memory

Synopsis

Prototype
void ajSysExit (
      void
);

TypeNameRead/WriteDescription
void RETURN

Returns
void:No return value

Description

Cleans up system internals memory

See Also

See other functions in this section

Availability

In release 6.4.0