PROGRAMMERS WORKBENCH LIBRARY(3x,L) PROGRAMMERS WORKBENCH LIBRARY(3x,L) ------------------------------------------------------------------------------- programmers workbench library PURPOSE Provides subroutines for compatibility with existing programs. LIBRARY Programmers Workbench Library (libPW.a) DESCRIPTION The libpw subroutines are provided only for compatibility with existing programs. Their use in new programs is not recommended. any (c, s) Determines whether the string s contains the character c. anystr (s1, s2) Determines the offset in string s1 of the first character that also occurs in string s2. balbrk (s, open, close, end) Determines the offset in string s of the first character in the string end that occurs outside of a balanced string as defined by open and close. cat (dest, source1,..., 0) Concatenates the source strings and copy them to dest. clean_up ( ) Defaults the cleanup routine. curdir (s) Puts the full path name of the current directory in the string s. dname (p) Determines which directory contains the file p. fatal (msg) General purpose error handler. fdfopen (fd, mode) Same as the stdio fdopen subroutine. giveup (dump) Forces a core dump. Processed Nov. 7, 1990 PROGRAMMERS WORKBENCH LIBRARY(3x,L) 1 PROGRAMMERS WORKBENCH LIBRARY(3x,L) PROGRAMMERS WORKBENCH LIBRARY(3x,L) imatch (pref, s) Determines if the string pref is an initial substring of the string s. index (s1, s2) Determines the offset of the first occurrence in string s1 of string s2. lockit (lockfile, count, pid) Creates a lock file. move (s1, s2, n) Copies the first n characters of string s1 to string s2. patoi (s) Converts string s to int. patol (s) Converts string s to long. rename (oldname, newname) Renames the file oldname to newname. Note: The rename subroutine is no longer part of the Programmers Workbench Library (libPW.a) because AIX provides a rename system call (see "rename") that performs the same function. repeat (dest, s, n) Sets dest to the string s repeated n times. repl (s, old, new) Replaces each occurrence of the character old in string s with the character new. satoi (s, ip) Converts string s to int and save it in *ip. setsig ( ) Causes signals to be caught by setsig1. setsig1 (sig) General purpose signal handling routine. sname (s) Gets a pointer to the simple name of full path name s. strend (s) Finds the end of the string s. substr (s, dest, origin, len) Places a substring of string s in dest using the offset origin and the length len. Processed Nov. 7, 1990 PROGRAMMERS WORKBENCH LIBRARY(3x,L) 2 PROGRAMMERS WORKBENCH LIBRARY(3x,L) PROGRAMMERS WORKBENCH LIBRARY(3x,L) trnslat (s, old, new, dest) Copies string s into dest and replace any character in old with the corresponding characters in new. unlockit (lockfile, pid) Deletes the lock file. userdir (uid) Gets the user's login directory. userexit (code) Defaults user exit routine. username (uid) Gets the user's login name. verify (s1, s2) Determines the offset in string s1 of the first character that is not also in string s2. xalloc (asize) Allocates memory. xcreat (name, mode) Creates a file. xfree (aptr) Frees memory. xfreeall ( ) Frees all memory. xlink (f1, f2) Links files. xmsg (file, func) Calls the routine fatal with an appropriate error message. xopen (name, mode) Opens a file. xpipe (t) Creates a pipe. xunlink (f) Removes a directory entry. xwrite (fd, buffer, n) Writes n bytes to the file associated with fd from buffer. Processed Nov. 7, 1990 PROGRAMMERS WORKBENCH LIBRARY(3x,L) 3 PROGRAMMERS WORKBENCH LIBRARY(3x,L) PROGRAMMERS WORKBENCH LIBRARY(3x,L) zero (p, n) Zeros n bytes starting at address p. zeropad (s) Replaces the initial blanks with the character "'0'" in string s. In addition, NLS equivalents exist for the following routines: NCany NCmove NCtrnslat NCanystr NCpatoi NCverify NCbalbrk NCrepeat NCzero NCcat NCrepl NCzeropad NCimatch NCsatoi NCindex NCstrend NCsubstr These routines perform identical functions as the non-NLS routines except that they deal with NLchars rather than ordinary chars. RELATED INFORMATION In this book: "logname," "NLchar," and "regcmp, regex." Processed Nov. 7, 1990 PROGRAMMERS WORKBENCH LIBRARY(3x,L) 4