05-16-2008
Thanks!
Hi,
I also was reading that in another not UNIX operating systems (i.e. window$) sprintf doesn't guarantee the insertion of a null terminator, hence my confusion!
Thank you very much!
7 More Discussions You Might Find Interesting
1. Solaris
********************************
Following is not the real issue. The issue is with popen.
Plz continue forward with the thread to get a better picture.
********************************
Hi,
I am working on a customised ftp application. In it we have used sprintf to store a UNIX command... (7 Replies)
Discussion started by: diganta
7 Replies
2. Shell Programming and Scripting
I'm writing a script to archive data. First, the files are all rsync'd to the archive directory via NFS mounts(I know not the most efficient, but the only choice in this situation), then I use md5sum to validate the transfers. During execution of the script, it will exit for no apparent reason. It... (6 Replies)
Discussion started by: mph
6 Replies
3. Shell Programming and Scripting
Dear all,
I am new to perl script and would need some help for my 1st script. I wrote a script to search sprintf(buf,"%s", sourcestring) and replace with snprintf(buf, sizeof(buf),"%s", sourcestring). As snprintf() requires an extra argument, so it is not a simple search-and-replace. I need to... (1 Reply)
Discussion started by: ChaMeN
1 Replies
4. Shell Programming and Scripting
Hi,
anyone knows the perl search-and-replace expression for
strcpy (char * destination, const char * source ); to
strncpy ( char * destination, const char * source, size_t num ); ?
the first and second arguments are the same (destination and source), the difference being that strncpy... (1 Reply)
Discussion started by: ChaMeN
1 Replies
5. Shell Programming and Scripting
Hi All,
is there a way or script that i can check my AIX 5.3 OS will restart before i made restart? is there a script that can check all the startup files are ok before restarting. it is because i was stuck last time when i restart my PC because some startup files were missing:o. (2 Replies)
Discussion started by: malcomex999
2 Replies
6. Shell Programming and Scripting
hi all,
i have a situation where i run ssh command from a unix machine to execute few scripts on 2 other unix machines.
my problem is, the scripts that i run will start few commands on the 2 servers and will quit....i am able to quit from the script but i have to give ctrl+c (on the... (10 Replies)
Discussion started by: niteesh_!7
10 Replies
7. AIX
http://ep.yimg.com/ay/iercomputer/ibm-39j5022-ultra320-scsi-adapter-dual-channel-pci-x-fc5736-3.gif
I have bought this controller.
Simple and fast question: I will put on this controller a external LTO tape,which is terminated with a terminator.
I have to put another terminator on PCI-controller... (1 Reply)
Discussion started by: Linusolaradm1
1 Replies
LEARN ABOUT MOJAVE
pcap_breakloop
PCAP_BREAKLOOP(3PCAP) PCAP_BREAKLOOP(3PCAP)
NAME
pcap_breakloop - force a pcap_dispatch() or pcap_loop() call to return
SYNOPSIS
#include <pcap/pcap.h>
void pcap_breakloop(pcap_t *);
DESCRIPTION
pcap_breakloop() sets a flag that will force pcap_dispatch() or pcap_loop() to return rather than looping; they will return the number of
packets that have been processed so far, or -2 if no packets have been processed so far.
This routine is safe to use inside a signal handler on UNIX or a console control handler on Windows, as it merely sets a flag that is
checked within the loop.
The flag is checked in loops reading packets from the OS - a signal by itself will not necessarily terminate those loops - as well as in
loops processing a set of packets returned by the OS. Note that if you are catching signals on UNIX systems that support restarting system
calls after a signal, and calling pcap_breakloop() in the signal handler, you must specify, when catching those signals, that system calls
should NOT be restarted by that signal. Otherwise, if the signal interrupted a call reading packets in a live capture, when your signal
handler returns after calling pcap_breakloop(), the call will be restarted, and the loop will not terminate until more packets arrive and
the call completes.
Note also that, in a multi-threaded application, if one thread is blocked in pcap_dispatch(), pcap_loop(), pcap_next(), or pcap_next_ex(),
a call to pcap_breakloop() in a different thread will not unblock that thread; you will need to use whatever mechanism the OS provides for
breaking a thread out of blocking calls in order to unblock the thread, such as thread cancellation in systems that support POSIX threads.
Note that pcap_next() and pcap_next_ex() will, on some platforms, loop reading packets from the OS; that loop will not necessarily be ter-
minated by a signal, so pcap_breakloop() should be used to terminate packet processing even if pcap_next() or pcap_next_ex() is being used.
pcap_breakloop() does not guarantee that no further packets will be processed by pcap_dispatch() or pcap_loop() after it is called; at most
one more packet might be processed.
If -2 is returned from pcap_dispatch() or pcap_loop(), the flag is cleared, so a subsequent call will resume reading packets. If a posi-
tive number is returned, the flag is not cleared, so a subsequent call will return -2 and clear the flag.
SEE ALSO
pcap(3PCAP), pcap_loop(3PCAP), pcap_next_ex(3PCAP)
8 March 2015 PCAP_BREAKLOOP(3PCAP)