Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JOBLOG V1.5 -- a terminal session logger, part 06/06

1 view
Skip to first unread message

Leonard J. Peirce

unread,
Apr 4, 1995, 3:00:00 AM4/4/95
to
Submitted-by: pei...@gumby.cc.wmich.edu (Leonard J. Peirce)
Posting-number: Volume 7, Issue 54
Archive-name: joblog/part06
Supersedes: joblog: Volume 1, Issue 102-106

-+-+-+-+-+-+-+-+ START OF PART 6 -+-+-+-+-+-+-+-+
Vied`20by`20the`20user
X`09`20`20`20`20`20`20and`20deleted`20from`20the`20JOBLOG$LOG`20directory.
X
X`09`20`20`20d)`20mail`20notification`20of`20the`20log`20file`20to`20someone
X
X`09`20`20`20`20`20`20The`20log`20file`20is`20move`20from`20the`20JOBLOG$LOG`20
Vdirectory`20to`20the
X`09`20`20`20`20`20`20staging`20directory`20pointed`20to`20by`20the`20JOBLOG$ST
VAGE`20directory.
X`09`20`20`20`20`20`20The`20log`20file`20will`20stay`20here`20until`201)`20it
V`20is`20picked`20up`20by`20the
X`09`20`20`20`20`20`20recipient`20using`20the`20/RETRIEVE`20qualifier`20to`20JO
VBLOG,`202)`20de-
X`09`20`20`20`20`20`20leted`20by`20the`20sender`20using`20the`20/DELETE`20quali
Vfier,`20or`203)`20de-
X`09`20`20`20`20`20`20leted`20automatically`20from`20a`20batch`20job`20using`20
Vthe`20/SKIM`20qualifer.
X
X`09`20`20`20`20`20`20The`20batch`20job`20should`20run`20JOBLOG/SKIM/WAIT=n/WAR
VN=m`20once`20per
X`09`20`20`20`20`20`20day`20to`20keep`20the`20staging`20directory`20cleaned`20o
Vut.`20`20The`20sender
X`09`20`20`20`20`20`20and`20the`20recipient`20will`20be`20warned`20via`20e-mail
V`20that`20there`20is`20a
X`09`20`20`20`20`20`20log`20file`20that`20hasn't`20been`20picked`20up`20after
V`20m`20days.`20`20The`20log
X`09`20`20`20`20`20`20file`20will`20be`20deleted`20from`20the`20staging`20area
V`20after`20n`20days`20and
X`09`20`20`20`20`20`20both`20the`20sender`20and`20the`20recipient`20are`20notif
Vied.
X
X`20`20`20All`20four`20of`20the`20choices`20in`20#3,`20as`20well`20as`20a`20num
Vber`20of`20other`20options,`20can
Xbe`20specified`20on`20the`20command`20line`20at`20startup.`20`20If`20dispositi
Von`20of`20the`20log`20file
Xisn't`20specified`20on`20the`20command`20line,`20the`20user`20will`20be`20prom
Vpted`20for`20it.`20`20See
Xthe`20help`20file`20for`20more`20information.
X
XA`20FEW`20WORDS`20ABOUT`20MAILING`20LOG`20FILES
X`20`20`20The`20first`20question`20is`20why`20aren't`20log`20files`20simply`20m
Vailed`20to`20the`20recipient?
XThe`20main`20reason`20is`20to`20give`20users`20an`20opportunity`20to`20delete
V`20log`20files`20if`20they
Xwant.`20`20This`20would`20be`20impossible`20to`20do`20if`20the`20log`20files
V`20were`20actually`20in
Xthe`20recipient's`20mail`20file.
X
X`20`20`20JOBLOG`20is`20setup`20so`20that`20only`20accounts`20that`20have`20a
V`20certain`20identifier`20can
Xreceive`20mailed`20logfiles.`20`20The`20identifiers`20here`20that`20allow`20an
V`20account`20to
Xreceive`20mailed`20log`20files`20are`20FACULTY,`20STAFF,`20and`20JOBLOG_RECIPI
VENT`20(the`20last
Xwe`20grant`20on`20a`20need`20basis).`20`20Also,`20users`20cannot`20mail`20log
V`20files`20to`20themselves
X(to`20prevent`20people`20from`20bypassing`20their`20disk`20quotas).`20`20And
V`20since`20student
Xaccounts`20here`20don't`20have`20any`20of`20the`20above`20identifiers,`20they
V`20can't`20mail`20log
Xfiles`20to`20each`20other.`20`20In`20a`20student`20environment,`20these`20migh
Vt`20be`20reasonable
Xrestrictions.`20`20If`20you`20want`20to`20change/delete/add`20identifiers,`20s
Vee`20the
Xvalid_ids`20array`20in`20the`20valid_recip()`20routine.
X
XINSTALLATION
X`20`20`201.`20`20If`20you`20wish`20to`20build`20JOBLOG`20with`20PHOTO`20mode,
V`20do`20one`20of`20the`20following:
X
X`09a)`20If`20you`20have`20MMS`20installed`20on`20your`20system,`20edit`20the
V`20DESCRIP.MMS
X`09`20`20`20file`20and`20change`20the`20CFLAGS`20definition`20to`20look`20like
V
X
X`09`20`20`20CFLAGS=/optimize=noinline/define=PHOTO_MODE
X
X`09b)`20If`20you`20don't`20MMS`20installed,`20edit`20the`20BUILD.COM`20file`20
Vand`20change
X`09`20`20`20the`20line`20with`20the`20CC`20command`20for`20JOBLOG.C`20to`20loo
Vk`20like
X
X`09`20`20`20$`20cc/optimize=inline/define=PHOTO_MODE
X
X`20`20`202.`20`20Build`20the`20executable:
X
X`09a)`20If`20you`20have`20MMS`20installed`20on`20your`20system,`20enter
X
X`09`09$`20MMS
X
X`09b)`20If`20you`20don't`20have`20MMS`20installed,`20enter
X
X`09`09$`20@BUILD
X
X`09There`20are`20some`20free`20versions`20of`20MAKE`20available`20for`20VMS`20
Vthat`20might
X`09work`20with`20the`20DESCRIP.MMS`20file,`20although`20I've`20never`20tried
V`20any.
X
X`20`20`203.`20`20Copy`20JOBLOG.EXE`20to`20it's`20final`20destination.`20`20SYS
V$SYSTEM`20is`20a`20reasonable
X`20`20`20`20`20`20`20location`20for`20most`20systems`20and`20will`20be`20used
V`20in`20the`20following`20example
X`20`20`20`20`20`20`20steps.`20`20If`20your`20final`20destination`20is`20differ
Vent,`20be`20sure`20to`20substitute
X`20`20`20`20`20`20`20wherever`20SYS$SYSTEM`20is`20used`20below.
X
X`20`20`20NOTE:`20`20Steps`203-8`20are`20not`20required`20for`20PHOTO`20mode.
X
X`20`20`204.`20`20Install`20JOBLOG`20using`20the`20INSTALL`20program.`20`20Ente
Vr
X
X`09$`20INSTALL
X
X`20`20`20`20`20`20`20and`20at`20the`20INSTALL>`20prompt`20enter
X
X`20`20`20`20`20`20`20INSTALL>`20ADD`20SYS$SYSTEM:JOBLOG.EXE/OPEN/HEADER/SHARE/
VPRIV=(SYSPRV,CMKRNL)
X
X`20`20`20`20`20`20`20Arrange`20for`20JOBLOG`20to`20be`20INSTALLed`20at`20syste
Vm`20boot`20time`20by`20adding`20the`20line
X`20`20`20`20`20`20`20from`20step`20#3`20to`20the`20appropriate`20startup`20fil
Ve.
X
X`20`20`205.`20`20Add`20a`20symbol`20definition`20to`20SYS$SYSTEM:SYLOGIN.COM
V`20for`20JOBLOG.`20`20For
X`20`20`20`20`20`20`20example,
X
X`09$`20JOBLOG`20:==`20$JOBLOG
X
X`20`20`20`20`20`20`20would`20work`20if`20JOBLOG`20is`20installed`20in`20SYS$SY
VSTEM.`20`20If`20it`20isn't,`20you'll
X`20`20`20`20`20`20`20have`20to`20use`20the`20full`20file`20specification.
X
X`20`20`206.`20`20Add`20the`20help`20file`20to`20the`20system`20help`20library.
V`20`20To`20do`20this,`20you`20must
X`20`20`20`20`20`20`20have`20exclusive`20access`20to`20SYS$HELP:HELPLIB.HLB.`20
V`20An`20ideal`20time`20would`20be
X`20`20`20`20`20`20`20when`20you`20have`20the`20machine`20to`20yourself`20and
V`20logins`20are`20disabled.`20`20If
X`20`20`20`20`20`20`20you're`20installing`20JOBLOG`20for`20the`20first`20time,
V`20the`20command`20for`20adding
X`20`20`20`20`20`20`20the`20help`20library`20is
X
X`09$`20LIBRARY/HELP/INSERT`20SYS$HELP:HELPLIB.HLB`20JOBLOG.HLP
X
X`20`20`20`20`20`20`20If`20JOBLOG's`20help`20file`20already`20exists`20in`20you
Vr`20help`20library,`20the`20command
X`20`20`20`20`20`20`20would`20be
X
X`09$`20LIBRARY/HELP/REPLACE`20SYS$HELP:HELPLIB.HLB`20JOBLOG.HLP
X
X`20`20`20`20`20`20`20If`20you`20don't`20have`20the`20system`20to`20yourself,
V`20you`20can:
X
X`20`20`20`20`20`20`20`20`20`201)`20Protect`20SYS$HELP:HELPLIB.HLB`20so`20that
V`20no`20one`20can`20access`20it,`20wait
X`09`20`20`20`20`20until`20everyone`20is`20done`20using`20it,`20insert`20the`20
Vhelp`20file,`20and`20reset
X`09`20`20`20`20`20the`20protection`20back`20to`20what`20it`20was`20when`20you
V`20started.`20`20A`20few
X`09`20`20`20`20`20people`20might`20get`20protection`20failures`20when`20runnin
Vg`20HELP`20but`20it
X`09`20`20`20`20`20beats`20shutting`20down`20your`20machine.
X`20
X`09`20`202)`20Copy`20SYS$HELP:HELPLIB.HLB`20to`20your`20own`20area,`20do`20the
V`20update,`20and
X`09`20`20`20`20`20copy`20it`20back`20to`20SYS$HELPLIB.HLB;n+1.`20`20Make`20sur
Ve`20the`20file`20pro-
X`09`20`20`20`20`20tection`20is`20correct`20and`20verify`20that`20the`20new`20h
Velp`20library`20is
X`09`20`20`20`20`20correct.`20`20Purge`20the`20file`20later`20at`20your`20conve
Vnience.
X
X`20`20`207.`20`20Create`20the`20two`20directories`20required`20for`20JOBLOG:
X
X`09-`20a`20directory`20where`20log`20files`20live`20while`20the`20user`20is`20
Vrunning`20JOBLOG;
X`09`20`20after`20a`20user`20exits`20JOBLOG,`20their`20log`20file`20will`20be
V`201)`20moved`20to
X`09`20`20another`20location`20(the`20user's`20area`20or`20the`20staging`20area
V)`20or`202)`20de-
X`09`20`20leted,`20either`20by`20the`20user`20or`20after`20printing.
X
X`09`20`20Example:`20`20SYS$SYSTEM:`5BJOBLOG_LOG`5D
X
X`09-`20a`20"staging"`20directory`20where`20log`20files`20live`20waiting`20to
V`20be`20picked`20up
X`09`20`20by`20the`20recipient`20specified`20by`20the`20user.
X
X`09`20`20Example:`20`20SYS$SYSTEM:`5BJOBLOG_STAGE`5D
X
X`20`20`20`20`20`20`20IMPORTANT:`20`20Both`20directories`20should`20be`20protec
Vted`20RWED,,,
X
X`20`20`208.`20`20Create`20two`20system-wide`20logical`20names`20pointing`20to
V`20the`20directories
X`20`20`20`20`20`20`20created`20in`20step`20#6.`20`20The`20logical`20names`20ar
Ve
X
X`09JOBLOG$LOG
X`09JOBLOG$STAGE
X
X`20`20`20`20`20`20`20Define`20them`20as`20follows:
X
X`09$`20DEFINE/SYSTEM/EXEC/TRANS=CONCEALED`20JOBLOG$LOG`20SYS$SYSTEM:`5BJOBLOG_
VLOG`5D
X`09$`20DEFINE/SYSTEM/EXEC/TRANS=CONCEALED`20JOBLOG$STAGE`20SYS$SYSTEM:`5BJOBLO
VG_STAGE`5D
X
X`20`20`20`20`20`20`20Arrange`20for`20these`20logicals`20to`20be`20defined`20at
V`20system`20boot`20time`20by`20adding
X`20`20`20`20`20`20`20the`20above`20definitions`20to`20the`20appropriate`20star
Vtup`20file.
X
X`20`20`209.`20`20Add`20an`20entry`20into`20a`20batch`20job`20that`20runs`20onc
Ve`20per`20day`20that`20will`20check
X`20`20`20`20`20`20`20the`20staging`20directory`20for`20old`20log`20files`20and
V`20notify`20the`20sender`20and
X`20`20`20`20`20`20`20recipient`20that`20they`20haven't`20been`20picked`20up.
X
X`09Example:`20`20$`20JOBLOG/SKIM/WAIT=10/WARN=7
X
X`20`20`20That`20should`20do`20it.`20`20Try`20running`20it`20and`20see`20if`20i
Vt`20works.`20`20If`20you`20have`20pro-
Xblems`20building/installing`20JOBLOG,`20feel`20free`20to`20call`20me`20or`20se
Vnd`20me`20e-mail`20and
Xlet`20me`20know`20how`20I`20blew`20it.`20`20I'll`20do`20what`20I`20can`20to`20
Vmake`20sure`20that`20it`20can`20be
Xinstalled`20at`20your`20site.
X
XHACKING`20ON`20THE`20CODE
X`20`20`20Since`20the`20source`20is`20distributed,`20feel`20free`20to`20hack`20
Von`20the`20code.`20`20There`20is
Xnothing`20very`20complicated`20in`20JOBLOG;`20the`20code`20itself`20is`20prett
Vy`20straightforward
X(at`20least`20I`20think`20so!`20:`5E).`20`20If`20you`20find`20a`20bug,`20you
V`20can`20either`201)`20fix`20it`20your-
Xself,`20contact`20me,`20and`20send`20me`20the`20fix,`20or`202)`20let`20me`20kn
Vow`20about`20it`20and`20I'll`20see
Xwhat`20I`20can`20do.`20`20I'll`20be`20sending`20out`20patches`20when`20appropr
Viate.
X
XCONCLUSION
X`20`20`20I`20put`20a`20lot`20of`20work`20into`20JOBLOG`20and`20I`20would`20app
Vreciate`20any`20comments/
Xsuggestions/flames`20that`20you`20might`20have.`20`20If`20you`20get`20it`20up
V`20and`20running,`20I
Xwould`20appreciate`20it`20if`20you`20would`20either`20send`20me`20e-mail`20or
V`20phone`20me,`20letting
Xme`20know`20that`20you`20installed`20it`20and`20what`20your`20thoughts`20are
V`20about`20it.
X--
XLeonard`20J.`20Peirce`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20Internet:`20
V`20pe...@mickey.acs.wmich.edu
XWestern`20Michigan`20University`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20pe...@wmich.edu
XUniversity`20Computing`20Services
XKalamazoo,`20MI`20`2049008`20`20`20`20`20`20`20`20`20`20`20`20Voice:`20`20`20
V`20`20(616)`20387-5469
$ call unpack README.TXT;31 1213537878 "" 23 10 11
$!
$ create 'f'
X/*****************************************************************************
V**
X******************************************************************************
V**
X
X`20`20`20Site:`09Western`20Michigan`20University
X`09`09University`20Computing`20Services
X
X`20`20`20System:`09General`20Purpose`20Subroutines
X`20`20
X`20`20`20Program:`09JOBLOG
X
X`20`20`20Version=01`09Level=00`0909/12/90`09Leonard`20J.`20Peirce
X
X`20`20`20Purpose:`09Three`20general`20purpose`20subroutines`20used`20by`20JOBL
VOG.`20`20If`20you
X`09`09want`20to`20use`20them`20for`20something`20else,`20feel`20free.`20`20I
V`20just
X`09`09didn't`20want`20to`20include`20them`20in`20JOBLOG.C`20since`20they`20alr
Veady
X`09`09exist`20in`20a`20object`20library`20here.
X
X`20`20`20Version=01`09Level=01`0901/18/91`09Leonard`20J.`20Peirce
X
X`20`20`20Purpose:`09Add`20strmcpy,`20str_pref_trim(),`20and`20str_post_trim().
V
X
X`20`20`20Version=01`09Level=02`0903/17/95`09Leonard`20J.`20Peirce
X
X`20`20`20Purpose:`09Change`20a`20variable`20from`20a`20register`20to`20automat
Vic`20in`20cat().
X
X`09`09Change`20a`20few`20comments`20that`20needed`20it.
X
X`20`20`20Arguments:`09See`20individual`20routines
X
X`20`20`20External`20variables:`09none
X
X`20`20`20WMU`20external`20functions:
X
X`20`20`20`20`20`20`20`20`20`20Defined:`09cat,strins,strlu,strmcpy,str_post_tri
Vm,str_pref_trim
X
X`20`20`20`20`20`20`20`20`20`20Called:`09none
X
X`20`20`20Files`20accessed:`09none
X
X`20`20`20Return`20codes:`09See`20individual`20routines
X
X`20`20`20Compiling`20instructions:`09See`20DESCRIP.MMS
X
X`20`20`20Linking`20instructions:`09See`20DESCRIP.MMS
X
X`20`20`20Other`20information:`09`09Copyright`20(c)`201990,`20Leonard`20J.`20Pe
Virce
X
X******************************************************************************
V**
X******************************************************************************
V*/
X
X/*****************************************************************************
V*/
X/*`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20*/
V
X/*`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20#`20
VI`20N`20C`20L`20U`20D`20E`20`20`20F`20I`20L`20E`20S`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20*/
X/*`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20*/
V
X/*****************************************************************************
V*/
X
X#include`20varargs
X#include`20ctype
X#include`20string
X
X/*****************************************************************************
V*/
X/*`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20*/
V
X/*`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20#`20D`20E`20F`20I`20N`20E`20S`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20*/
X/*`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20*/
V
X/*****************************************************************************
V*/
X
X/*****************************************************************************
V*/
X/*`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20*/
V
X/*`20`20`20`20`20`20`20`20`20`20S`20T`20R`20U`20C`20T`20U`20R`20E`20S`20,`20
V`20`20U`20N`20I`20O`20N`20S`20,`20`20`20T`20Y`20P`20E`20D`20E`20F`20S`20`20`20
V`20`20`20`20`20`20`20`20*/
X/*`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20*/
V
X/*****************************************************************************
V*/
X
X/*****************************************************************************
V*/
X/*`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20*/
V
X/*`20`20`20E`20X`20T`20E`20R`20N`20A`20L`20`20`20D`20E`20F`20I`20N`20I`20T`20I
V`20O`20N`20S`20`20`20`26`20`20`20D`20E`20C`20L`20A`20R`20A`20T`20I`20O`20N`20S
V`20`20`20`20*/
X/*`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20*/
V
X/*****************************************************************************
V*/
X
X`09`20char`09`20`20*cat(),
X`09`09`20`20*str_pref_trim(),
X`09`09`20`20*str_post_trim(),
X`09`09`20`20*strmcpy();
X
X`09`20int`09`20`20strins();
X
X`09`20void`09`20`20strlu();
X
X/*****************************************************************************
V*/
X/*`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20*/
V
X/*`20`20`20`20`20S`20T`20A`20T`20I`20C`20`20`20D`20E`20F`20I`20N`20I`20T`20I
V`20O`20N`20S`20`20`20`26`20`20`20D`20E`20C`20L`20A`20R`20A`20T`20I`20O`20N`20S
V`20`20`20`20`20`20*/
X/*`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20
V`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20*/
V
X/*****************************************************************************
V*/
X`0C
X/*****************************************************************************
V**
X******************************************************************************
V**
X
X`20`20Function:`09cat
X
X`20`20Purpose:`09This`20general-purpose`20subroutine`20will`20concatenate`20nu
Vll-
X`09`09terminated`20strings`20into`20one`20destination`20string.
X
X`20`20Formal`20Parameters:
X
X`09Name`09`09`09Description
X`09----`09`09`09-----------
X`09dest`09`09`09where`20new`20string`20is`20created
X`09source1,...sourcen`09input`20strings
X
X`20`20Global`20variables:
X
X`09Name`09`09`09Examine/Modify/Use/Read/Write
X`09----`09`09`09-----------------------------
X`09none
X
X`20`20Return`20Codes:
X
X`09Code`09`09`09Reason
X`09----`09`09`09------
X`09retval`09`09`09pointer`20to`20destination`20string
X`09nullptr`09`09`09null`20string`20pointer;`20returned`20when
X`09`09`09`09no`20arguments`20are`20passed
X
X******************************************************************************
V**
X******************************************************************************
V*/
X
Xchar`20*cat(va_alist)
X`09`09`09`09`09/*******`20`20`20FORMAL`20`20PARAMETERS`20`20`20*******/
X`09`20va_dcl`09`09`09`09/*`20variable-length`20parameter`20list`20`20`20`20`20
V*/
X
X`7B`09/***`20cat`20***/
X`09`09`09`09`09/********`20`20`20LOCAL`20`20VARIABLES`20`20`20********/
Xregister`20char`09`20`20*dest,`09`09/*`20pointer`20to`20destination`20string
V`20`20`20`20`20`20*/
X`09`09`20`20*source;`09`09/*`20pointer`20to`20current`20source`20string`20`20
V`20*/
X`09`20char`09`20`20*retval;`09`09/*`20to`20save`20pointer`20to`20destination
V`20`20`20`20`20*/
X`09`20int`09`20`20count;`09`09/*`20number`20of`20arguments`20passed`09`20`20
V`20`20`20`20*/
X`09`20va_list`20`20incrmtr;`09`09/*`20argument`20list`20incrementor`09`20`20
V`20`20`20`20*/
Xstatic`09`20char`09`20`20*nullptr`20=`20"";`09/*`20null`20string`20pointer`09
V`09`20`20`20`20`20`20*/
X
X
X`20`20`20va_start(incrmtr);`09`09`09/*`20begin`20everything....`09`09`20`20`20
V`20`20`20*/
X
X`20`20`20va_count(count);`09`09`09/*`20get`20number`20of`20arguments`09`20`20
V`20`20`20`20*/
X
X`20`20`20if(count`20==`200)`09`09`09/*`20were`20any`20arguments`20specified?
V`20`20`20`20`20`20*/
X`20`20`20`20`20`20return(nullptr);`09`09`09/*`20nope,`20get`20out`20of`20here.
V..`09`20`20`20`20`20`20*/
X
X`20`20`20dest`20=`20va_arg(incrmtr,char*);`09/*`20get`20the`20destination`20po
Vinter`09`20`20`20`20`20`20*/
X`20`20`20retval`20=`20dest;`09`09`09/*`20save`20pointer`20to`20destination`09
V`20`20`20`20`20`20*/
X
X`20`20`20source`20=`20va_arg(incrmtr,char*);`09/*`20get`20the`20first`20source
V`20pointer`09`20`20`20`20`20`20*/
X
X`20`20`20while(--count`20>`200)`09`09`09/*`20process`20all`20of`20the`20source
V`20strings`20`20*/
X`20`20`20`7B
X`20`20`20`20`20`20while(*dest++`20=`20*source++)`09/*`20cat`20the`20source`20t
Vo`20the`20destination`20`20*/
X`09`20;
X
X`20`20`20`20`20`20dest--;`09`09`09`09/*`20back`20over`20the`20null`20character
V`09`20`20`20`20`20`20*/
X`20`20`20`20`20`20source`20=`20va_arg(incrmtr,char*);`09/*`20get`20the`20next
V`20argument`09`20`20`20`20`20`20*/
X`20`20`20`7D
X
X`20`20`20*dest`20=`20'`5C0';`09`09`09/*`20terminate`20the`20destination`09`20
V`20`20`20`20`20*/
X`20`20`20va_end(incrmtr);`09`09`09/*`20end`20varargs`20session`09`09`20`20`20
V`20`20`20*/
X
X`20`20`20return(retval);`09`09`09/*`20return`20pointer`20to`20destination`20
V`20`20`20`20`20*/
X
X`7D`09/***`20cat`20***/
X`0C
X/*****************************************************************************
V**
X******************************************************************************
V**
X
X`20`20Function:`09strins
X
X`20`20Purpose:`09Insert`20a`20character`20string`20into`20another`20at`20a`20s
Vpecified
X`09`09position.
X
X`20`20Formal`20Parameters:
X
X`09Name`09`09`09Description
X`09----`09`09`09-----------
X`09str`09`09`09string`20to`20be`20updated;`20should`20be`20large
X`09`09`09`09enough`20to`20accomodate`20the`20new`20string
X`09new`09`09`09string`20to`20be`20inserted
X`09position`09`09place`20to`20insert`20new`20into`20str
X
X`20`20Global`20variables:
X
X`09Name`09`09`09Examine/Modify/Use/Read/Write
X`09----`09`09`09-----------------------------
X`09none
X
X`20`20Return`20Codes:
X
X`09Code`09`09`09Reason
X`09----`09`09`09------
X`09`20`200`09`09`09string`20insert`20successful
X`09`20-1`09`09`09unable`20to`20insert`20string`20because`20position
X`09`09`09`09points`20outside`20of`20str
X
X******************************************************************************
V**
X******************************************************************************
V*/
X
Xint`20strins(str,new,position)
X
Xregister`20char`09`20`20*str,
X`09`09`20`20*new;
Xregister`20int`09`20`20position;
X
X`7B`09/***`20strins`20***/
X`09`09`09`09`09/********`20`20`20LOCAL`20`20VARIABLES`20`20`20********/
Xregister`20int`09`20`20i,`09`09`09/*`20loop`20and`20array`20index`09`09`20`20
V`20`20`20`20*/
X`09`09`20`20j;`09`09`09/*`20temporary`20variable`09`09`20`20`20`20`20`20*/
X`09`20int`09`20`20new_len,`09`09/*`20length`20of`20string`20to`20insert`09`20
V`20`20`20`20`20*/
X`09`09`20`20str_len;`09`09/*`20length`20of`20str`09`09`20`20`20`20`20`20*/
X
X
X`20`20`20str_len`20=`20strlen(str);`09`09/*`20get`20length`20of`20current`20st
Vr`09`20`20`20`20`20`20*/
X
X`20`20`20if((position`20>`20str_len)`20`7C`7C`20(position`20<`200))
X`20`20`20`20`20`20i`20=`20-1;
X`20`20`20else
X`20`20`20`7B
X`20`20`20`20`20`20new_len`20=`20strlen(new);`09`09/*`20get`20length`20of`20str
Ving`20to`20insert`20`20`20`20`20*/
X`20`20`20`20`20`20i`20=`20new_len`20+`20str_len`20-`201;`09/*`20get`20where`20
Vto`20start`20when`20we`20shift`20`20`20*/
X`20`20`20`20`20`20*(str+i+1)`20=`20'`5C0';`20`09`09/*`20terminate`20it`20first
V`20`09`09`20`20`20`20`20`20*/
X`20`20`20`20`20`20j`20=`20str_len`20-`201;`09`09`09/*`20point`20to`20last`20ch
Var`20of`20str`09`20`20`20`20`20`20*/
X
X`20`20`20`20`20`20/*`20now`20shift`20everything`20over`20to`20make`20room`20fo
Vr`20the`20new`20string`20*/
X
X`20`20`20`20`20`20while(j`20>=`20position)
X`20`20`20`20`20`20`7B
X`09`20*(str+i)`20=`20*(str+j);
X`09`20--i;
X`09`20--j;
X`20`20`20`20`20`20`7D
X
X`20`20`20`20`20`20/*`20now`20add`20the`20new`20string`20in`20the`20right`20slo
Vt`20*/
X
X`20`20`20`20`20`20for(i`20=`200,j`20=`20position;`20*(new+i)`20!=`20'`5C0';`20
Vi++,j++)
X`20`20`20`20`20`20`20`20`20*(str+j)`20=`20*(new+i);`20`20`20`20`20`20
X
X`20`20`20`20`20`20i`20=`200;
X`20`20`20`7D
X
X`20`20`20return(i);
X
X`7D`09/***`20strins`20***/`20`20`20`20`20`20
X`0C
X/*****************************************************************************
V**
X******************************************************************************
V**
X
X`20`20Function:`09strlu
X
X`20`20Purpose:`09Convert`20all`20lower-case`20characters`20in`20a`20string`20t
Vo`20upper-case.
X
X`20`20Formal`20Parameters:
X
X`09Name`09`09`09Description
X`09----`09`09`09-----------
X`09source`09`09`09source`20string`20to`20be`20converted
X
X`20`20Global`20variables:
X
X`09Name`09`09`09Examine/Modify/Use/Read/Write
X`09----`09`09`09-----------------------------
X`09none
X
X`20`20Return`20Codes:
X
X`09Code`09`09`09Reason
X`09----`09`09`09------
X`09none
X
X******************************************************************************
V**
X******************************************************************************
V*/
X
Xvoid`20strlu(source)
X
Xregister`20char`09`20`20*source;
X
X`7B`09/***`20strlu`20***/
X
X`20`20`20while(*source)
X`20`20`20`7B
X`20`20`20`20`20`20*source`20=`20_toupper(*source);
X`20`20`20`20`20`20source++;
X`20`20`20`7D
X
X`20`20`20return;
X
X`7D`09/***`20strlu`20***/
X`0C
X/*****************************************************************************
V**
X******************************************************************************
V**
X
X`20`20Function:`09strmcpy
X
X`20`20Purpose:`09Copy`20at`20most`20m`20characters`20into`20the`20target`20str
Ving.`20`20The
X`09`09resultant`20string`20is`20guaranteed`20to`20be`20null-terminated.
X`09`09This`20provides`20an`20alternative`20to`20strncpy()`20which`20does`20not
V
X`09`09guarantee`20that`20strings`20are`20null-terminated.
X
X`20`20Formal`20Parameters:
X
X`09Name`09`09`09Description
X`09----`09`09`09-----------
X`09dest`09`09`09where`20new`20string`20is`20written
X`09source`09`09`09source`20for`20copy
X`09max`09`09`09maximum`20number`20of`20bytes`20to`20copy
X
X`20`20Global`20variables:
X
X`09Name`09`09`09Examine/Modify/Use/Read/Write
X`09----`09`09`09-----------------------------
X`09none
X
X`20`20Return`20Codes:
X
X`09Code`09`09`09Reason
X`09----`09`09`09------
X`09none
X
X******************************************************************************
V**
X******************************************************************************
V*/
X
Xchar`20*strmcpy(dest,source,max)
Xregister`20char`09`20`20*dest,
X`09`09`20`20*source;
Xregister`20int`09`20`20max;
X
X`7B`09/***`20strmcpy`20***/
X`09`09`09`09`09/********`20`20`20LOCAL`20`20VARIABLES`20`20`20********/
Xregister`20int`09`20`20i;`09`09`09/*`20loop`20and`20array`20index`09`09`20`20
V`20`20`20`20*/
X
X`20`20`20for(i`20=`200;i`20<`20max`20`26`26`20*(source+i);`20i++)
X`20`20`20`20`20`20*(dest+i)`20=`20*(source+i);
X
X`20`20`20*(dest+i)`20=`20'`5C0';`09`09`09/*`20terminate`20the`20destination`20
Vstring`20`20`20*/
X
X`20`20`20return(dest);
X
X`7D`09/***`20strmcpy`20***/
X`0C
X/*****************************************************************************
V**
X******************************************************************************
V**
X
X`20`20Function:`09str_pref_trim
X
X`20`20Purpose:`09Strip`20out`20leading`20whitespace`20from`20a`20string
X
X`20`20Formal`20Parameters:
X
X`09Name`09`09`09Description
X`09----`09`09`09-----------
X`09str`09`09`09string`20to`20be`20stripped
X
X`20`20Global`20variables:
X
X`09Name`09`09`09Examine/Modify/Use/Read/Write
X`09----`09`09`09-----------------------------
X`09none
X
X`20`20Return`20Codes:
X
X`09Code`09`09`09Reason
X`09----`09`09`09------
X`09str
X
X******************************************************************************
V**
X******************************************************************************
V*/
X
Xchar`20*str_pref_trim(str)
X`09`09`09`09`09/*******`20`20`20FORMAL`20`20PARAMETERS`20`20`20*******/
Xregister`20char`09`20`20*str;`09`09`09/*`20string`20to`20be`20trim`09`09`20`20
V`20`20`20`20*/
X
X`7B`09/***`20str_pref_trim`20***/
X`09`09`09`09`09/********`20`20`20LOCAL`20`20VARIABLES`20`20`20********/
Xregister`20char`09`20`20*ptr;`09`09`09/*`20temporary`20pointer`09`09`20`20`20
V`20`20`20*/
X
X
X`20`20`20ptr`20=`20str;
X
X`20`20`20while(isspace(*ptr))`09`09`09/*`20skip`20the`20leading`20whitespace
V`20first`20`20*/
X`20`20`20`20`20`20++ptr;
X
X`20`20`20while(*ptr)
X`20`20`20`20`20`20*ptr++`20=`20*str++;
X
X`20`20`20*str`20=`20'`5C0';`09`09`09`09/*`20make`20sure`20it's`20a`20string`09
V`20`20`20`20`20`20*/
X`20`20`20return(str);
X
X`7D`09/***`20str_pref_trim`20***/
X`0C
X/*****************************************************************************
V**
X******************************************************************************
V**
X
X`20`20Function:`09str_post_trim
X
X`20`20Purpose:`09Strip`20out`20trailing`20whitespace`20from`20a`20string
X
X`20`20Formal`20Parameters:
X
X`09Name`09`09`09Description
X`09----`09`09`09-----------
X`09str`09`09`09string`20to`20be`20stripped
X
X`20`20Global`20variables:
X
X`09Name`09`09`09Examine/Modify/Use/Read/Write
X`09----`09`09`09-----------------------------
X`09none
X
X`20`20Return`20Codes:
X
X`09Code`09`09`09Reason
X`09----`09`09`09------
X`09str
X
X******************************************************************************
V**
X******************************************************************************
V*/
X
Xchar`20*str_post_trim(str)
X`09`09`09`09`09/*******`20`20`20FORMAL`20`20PARAMETERS`20`20`20*******/
Xregister`20char`09`20`20*str;`09`09`09/*`20string`20to`20be`20trim`09`09`20`20
V`20`20`20`20*/
X
X`7B`09/***`20str_post_trim`20***/
X`09`09`09`09`09/********`20`20`20LOCAL`20`20VARIABLES`20`20`20********/
Xregister`20char`09`20`20*ptr;`09`09`09/*`20temporary`20pointer`09`09`20`20`20
V`20`20`20*/
X
X
X`20`20`20ptr`20=`20`26str`5Bstrlen(str)`20-`201`5D;
X
X`20`20`20while(isspace(*ptr))`09`09`09/*`20find`20first`20non-whitespace`20cha
Vr`20`20`20`20`20*/
X`20`20`20`20`20`20--ptr;
X
X`20`20`20*(ptr`20+`201)`20=`20'`5C0';`09`09`09/*`20chop`20off`20the`20whitespa
Vce`20characters`20*/
X`20`20`20return(str);
X
X`7D`09/***`20str_post_trim`20***/
X
$ call unpack SUBS.C;8 909043369 "" 26 11 11
$ v=f$verify(v)
$ exit

0 new messages