Considering that you are passing a parameter to the begin function and using it as a key... if you pass anything that's an invalid key, then the begin function will break, which will break the rest of the script.
It would probably be easier/more robust to use objects to accomplish this task.
This way each object is it's own logging session, with it's own instance variables, one of which is a text string indicating the name of the session, the others are the message array, the filehandle and start and stop times.
This allows you great freedom to start and stop multiple logging sessions, and insulates you from having to use specific keys in your scripts to reference those sessions.
It's relatively trivial to convert your code to the object format, but also might be easier to use one of the many pre-existing Log classes and adapt for your use, just search CPAN.
about 2 months ago i installed mandrake linux 8.0 however due to my current internet setup (dial up upsteam, and cable downstream) i was never able to get it configured properly so i gave up untill i could change to an all cable isp...well that day is tomorrow!!!
what i would like to know is... (1 Reply)
ABC:10:A1:ABCA110
ABC:10:A1:ABCA110
ABC:20:A1:ABCA120
DEF:20:D1:DEFD120
GHI:30:G1:GHIG130
GHI:40:G1:GHIG140
JKL:30:J1:JKLJ130
MNO:10:M1:MNOM110
What I'm trying to do is look through a file that consists of four columns (as above). As you can see there are duplicates in
the file, i.e.... (2 Replies)
Hi guys,i urgently need help in this problem,i need to append one sentence to another line when it meet a certain word.
For example:
root: root time_last_login = 1191232080 root tty_last_login = /dev/vty0 root host_last_login = rep1nim root unsuccessful_login_count = 0 root... (10 Replies)
I'm trying to read the output of a .sql script (simple insert and commit oracle pl/slq script) to a log file using a shell script. My problem is I end up with a log file that looks like this:
sd12@phenix97:/detain/sd12/logs > cat 20071205_detain_20071206.log
12320496 rows created. Commit... (11 Replies)
I have string named texts which consist of section label “BOOK-SEC-“. Section starts from 1 to n, where n is a number. For this example conside the value of n is 9. That is, the string variable looks like
“BOOK-SEC-1... (2 Replies)
Hi All,
I have a script which i use in office. This script is used to log the work in users name.
For that in the script itself I have added that the infomration should append to the logfile everytime the script is run.
LOGFILE=/data/log/request1.txt
All these days it was... (3 Replies)
Lets say i have files like the following format :-
R0001.log
R0002.log
...
...
R00011.log
upto R000n.log, there are also a lot of text files with different names
now how can i find these files with in a range, i can do "ls R000*.log" and it will show me all the R000*.log files but what... (2 Replies)
Hi,
I am trying to insert a timestamp after all the file names in a folder,after the timestamp is created in the filename the file size is becoming zero bytes.
please tell me where I am doing it wrong.
I have declared the variable in starting of my script.
timestamp=`date... (1 Reply)
i have a number of java files containing
eg:
--------------myfile.java--------------
package zip.fun.myfiles;
import java.*
import something..;
import sdfdfdsa;
...
...
--------------------------------------------
Now I need to append / insert a line as follows:
... (10 Replies)
Hello,
I have text files to append and am able to do with cat.
cat file1 file2 >file3
and file3 works fine in UNIX (checked with vi and it looks fine) but when i open the same file in windows I see 2nd file appended as a single-line. In other words, all the lines of 2nd file appended to... (2 Replies)
Discussion started by: magnus29
2 Replies
LEARN ABOUT XFREE86
putctl
putctl(9F) Kernel Functions for Drivers putctl(9F)NAME
putctl - send a control message to a queue
SYNOPSIS
#include <sys/stream.h>
int putctl(queue_t *q, int type);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
q Queue to which the message is to be sent.
type Message type (must be control, not data type).
DESCRIPTION
putctl() tests the type argument to make sure a data type has not been specified, and then attempts to allocate a message block. putctl()
fails if type is M_DATA, M_PROTO, or M_PCPROTO, or if a message block cannot be allocated. If successful, putctl() calls the put(9E)
routine of the queue pointed to by q with the newly allocated and initialized messages.
RETURN VALUES
On success, 1 is returned. If type is a data type, or if a message block cannot be allocated, 0 is returned.
CONTEXT
putctl() can be called from user or interrupt context.
EXAMPLES
Example 1: Using putctl()
The send_ctl() routine is used to pass control messages downstream. M_BREAK messages are handled with putctl() (line 11). putctl1(9F)
(line 16) is used for M_DELAY messages, so that parm can be used to specify the length of the delay. In either case, if a message block
cannot be allocated a variable recording the number of allocation failures
is incremented (lines 12, 17). If an invalid message type is detected, cmn_err(9F) panics the system (line 21).
1 void
2 send_ctl(wrq, type, parm)
3 queue_t *wrq;
4 uchar_t type;
5 uchar_t parm;
6 {
7 extern int num_alloc_fail;
8
9 switch (type) {
10 case M_BREAK:
11 if (!putctl(wrq->q_next, M_BREAK))
12 num_alloc_fail++;
13 break;
14
15 case M_DELAY:
16 if (!putctl1(wrq->q_next, M_DELAY, parm))
17 num_alloc_fail++;
18 break;
19
20 default:
21 cmn_err(CE_PANIC, "send_ctl: bad message type passed");
22 break;
23 }
24 }
SEE ALSO put(9E), cmn_err(9F), datamsg(9F), putctl1(9F), putnextctl(9F)
Writing Device Drivers
STREAMS Programming Guide
SunOS 5.10 11 Apr 1991 putctl(9F)