01-26-2008
reading the return value from S_ISDR
how to read the return value of S_ISDIR macro.
It works fine when used in if loop, but how to print the returned value.
Thanks
bishweshwar
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hallo
I want write a sh script but I have some troubles!
How can I write the Return value to a variable? I need an egrep command with the option -c, how many times it give the pattern. This return value shold be written in a variable.
Could you help me? (1 Reply)
Discussion started by: raphael.schwend
1 Replies
2. UNIX for Advanced & Expert Users
Hi this is an existing code written by somebody. Please help me in understanding the meaning of this
if (( $# != 1 )) (3 Replies)
Discussion started by: satgur
3 Replies
3. Programming
rm and cp return non zero values sometimes.
sprintf(tmp, "rm -rf %s/* 2>/dev/null\n", dest);
rc = system( tmp );
rc = 1 and errno =0
sprintf(tmp, "cp -r %s/* %s 2>/dev/null", source, dest);
rc = system( tmp );
rc = -1 and errno = 2.
The files exist and the paths are correct. I can... (7 Replies)
Discussion started by: latitude
7 Replies
4. Programming
hi
iam reading data from web page using request socket and curl socket.
now my problem is some the web page containg data as a image so how can i read the data from a image.
thank,inadvance.
sree (3 Replies)
Discussion started by: phani_sree
3 Replies
5. UNIX for Dummies Questions & Answers
Hi,
What does the above command means?
this is used in the following function
function _set_return_code
{
return ${1-0}
} (3 Replies)
Discussion started by: neeto
3 Replies
6. UNIX for Dummies Questions & Answers
Hi All,
Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'.
I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies
7. Shell Programming and Scripting
Hi guys,
I am newbie in unix, so I need your help.
I need to right unix function code that can read sample.txt. If sample.txt contains sentence such as "Error due to syntax." then it will return value.
I tried below code, but I got errors.
if
then
echo " There are... (4 Replies)
Discussion started by: adamenderik
4 Replies
8. Shell Programming and Scripting
ls xx > yy.log
echo $? can get the return value of "ls xx"
but if I use
ls xx |tee -a yy.log
I can't get the return value of "ls xx", and I get the return value of the whole cmd "ls xx |tee -a yy.log", it is always "0"
my question is how could I get the return value of "ls xx"... (1 Reply)
Discussion started by: yanglei_fage
1 Replies
9. Shell Programming and Scripting
I am using the popular bash shell.
Under the current interactive shell, i run the script like:
". ./myscript.txt" . After the current shell has finish the script, the shell will continue to work as I did previously. Actually I want the shell can return from the middle of the scripts it is... (1 Reply)
Discussion started by: Bill Zhao
1 Replies
10. Shell Programming and Scripting
Not sure where the problem is. I can run the script without any issue using the following command.
. /opt/app/scripts/cdc_migration.sh
But it fails with the below error when I try it this way
/opt/app/scripts/cdc_migration.sh
/opt/app/scripts/cdc_migration.sh: line 65: return: can only... (1 Reply)
Discussion started by: svajhala
1 Replies
LEARN ABOUT LINUX
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)
5 April 2008 PCAP_BREAKLOOP(3PCAP)