1*b30d1939SAndy FiddamanThe advanced software technology department has been collecting useful C 2*b30d1939SAndy Fiddamanroutines in a single library called libast. libast is used by nmake, the 3*b30d1939SAndy Fiddamannmake cpp (which is mainly based on another library (libpp)), CIA 4*b30d1939SAndy Fiddaman(C information abstractor from Robin Chen), and a collection of other 5*b30d1939SAndy Fiddaman/bin and /usr/bin commands that benefit from concentrating functionality 6*b30d1939SAndy Fiddamanin libast. 7*b30d1939SAndy Fiddaman 8*b30d1939SAndy FiddamanMore detail is available in the man pages. libast contains: 9*b30d1939SAndy Fiddaman 10*b30d1939SAndy Fiddaman (1) routines to support a generic environment for 11*b30d1939SAndy Fiddaman a variety of UNIX operating system variants 12*b30d1939SAndy Fiddaman 13*b30d1939SAndy Fiddaman (2) routines that update standard libc routines 14*b30d1939SAndy Fiddaman 15*b30d1939SAndy Fiddaman (3) routines shared between several commands 16*b30d1939SAndy Fiddaman 17*b30d1939SAndy FiddamanIf you already have nmake 2.0 or newer installed then use 18*b30d1939SAndy Fiddaman`nmake install' from this directory, otherwise use 19*b30d1939SAndy Fiddamanship/shipin from the root of the distribution directory tree. 20*b30d1939SAndy Fiddaman 21*b30d1939SAndy FiddamanSome of the routines not found in section 3: 22*b30d1939SAndy Fiddaman 23*b30d1939SAndy Fiddamanhash: generic, scoped hash table support 24*b30d1939SAndy Fiddaman 25*b30d1939SAndy Fiddaman hashalloc create a hash table or push new scope 26*b30d1939SAndy Fiddaman hashdump debug dump of one or all hash tables 27*b30d1939SAndy Fiddaman hashfree free a hashalloc()'d table 28*b30d1939SAndy Fiddaman hashlook low level name lookup 29*b30d1939SAndy Fiddaman hashscan entry generator for scoped table scan 30*b30d1939SAndy Fiddaman hashsize explicitly change table size (usually automatic) 31*b30d1939SAndy Fiddaman hashwalk apply function to each table entry 32*b30d1939SAndy Fiddaman memhash return hash code for n-char chunk of memory 33*b30d1939SAndy Fiddaman strhash return hash code for null terminated string 34*b30d1939SAndy Fiddaman 35*b30d1939SAndy Fiddamaninclude/ast: libast support headers 36*b30d1939SAndy Fiddaman 37*b30d1939SAndy Fiddaman align.h compile time type alignmnent support 38*b30d1939SAndy Fiddaman dirent.h POSIX directory(3) interface definitions 39*b30d1939SAndy Fiddaman error.h error() interface definitions 40*b30d1939SAndy Fiddaman ftw.h ftwalk() interface definitions 41*b30d1939SAndy Fiddaman hash.h hash*() interface definitions 42*b30d1939SAndy Fiddaman ls.h strls() interface definitions 43*b30d1939SAndy Fiddaman re.h re*() interface definitions 44*b30d1939SAndy Fiddaman tar.h POSIX ustar format interface definitions 45*b30d1939SAndy Fiddaman tm.h tm*() interface definitions 46*b30d1939SAndy Fiddaman 47*b30d1939SAndy Fiddamanmisc: 48*b30d1939SAndy Fiddaman 49*b30d1939SAndy Fiddaman cmdargs apply a sequence of cmd line option parsers 50*b30d1939SAndy Fiddaman cmdopen like popen() but stdin and stdout are specified 51*b30d1939SAndy Fiddaman cvtatoe convert ASCII to EBCDIC 52*b30d1939SAndy Fiddaman cvtetoa convert EBCDIC to ASCII 53*b30d1939SAndy Fiddaman error output generic error and trace messages 54*b30d1939SAndy Fiddaman ftwalk an ftw(3) that works -- used in new tw(1) 55*b30d1939SAndy Fiddaman getcwd uses $PWD if ok, doesn't use /bin/pwd 56*b30d1939SAndy Fiddaman getshell return full path of shell for cmdopen() 57*b30d1939SAndy Fiddaman ooptget optget() for obsolete ar(1) and tar(1) options 58*b30d1939SAndy Fiddaman optget YA getopt(3) but no argc or error message output 59*b30d1939SAndy Fiddaman pathaccess find file with specific acces on list of dirs 60*b30d1939SAndy Fiddaman pathcanon canonicalize path name in place 61*b30d1939SAndy Fiddaman pathcmd return full path name of executable using $PATH 62*b30d1939SAndy Fiddaman pathroot determine `related root' directory for command 63*b30d1939SAndy Fiddaman perror uses strerror() 64*b30d1939SAndy Fiddaman readargs append each line of file to argv[0] 65*b30d1939SAndy Fiddaman 66*b30d1939SAndy Fiddamanre: egrep(1) and ed(1) style re's from V9 67*b30d1939SAndy Fiddaman (not the good awk(1) algorithm) 68*b30d1939SAndy Fiddaman 69*b30d1939SAndy Fiddaman recomp compile re pattern 70*b30d1939SAndy Fiddaman reerror report re*() errors 71*b30d1939SAndy Fiddaman reexec match string using compiled re 72*b30d1939SAndy Fiddaman resub ed(1) style substitute using last reexec() 73*b30d1939SAndy Fiddaman 74*b30d1939SAndy Fiddamanstring: 75*b30d1939SAndy Fiddaman 76*b30d1939SAndy Fiddaman chresc return next char in string converting \ sequences 77*b30d1939SAndy Fiddaman ctoi convert char constant string to int 78*b30d1939SAndy Fiddaman strcopy like strcpy(3) but returns end of destination 79*b30d1939SAndy Fiddaman strdup malloc(3) and strcpy(3) smashed together 80*b30d1939SAndy Fiddaman strerror return error message string given errno 81*b30d1939SAndy Fiddaman stresc convert \ sequences in string in place 82*b30d1939SAndy Fiddaman streval evaluate C expression in string 83*b30d1939SAndy Fiddaman strls ls -l format support 84*b30d1939SAndy Fiddaman strmatch Korn shell file pattern match 85*b30d1939SAndy Fiddaman strmode return ls -l style output given st.st_mode 86*b30d1939SAndy Fiddaman strsignal return signal id string given SIG* number 87*b30d1939SAndy Fiddaman strtape convert generic tape unit to /dev/* file 88*b30d1939SAndy Fiddaman token generate space separated tokens in string 89*b30d1939SAndy Fiddaman 90*b30d1939SAndy Fiddamantm: time conversion support 91*b30d1939SAndy Fiddaman 92*b30d1939SAndy Fiddaman tmdate convert date string to time_t 93*b30d1939SAndy Fiddaman tmform format time_t to date string 94*b30d1939SAndy Fiddaman tmmake return current time_t 95*b30d1939SAndy Fiddaman tmtime convert struct tm to time_t 96