Sponsored Content
Full Discussion: Recursion
Top Forums Programming Recursion Post 302263617 by joshighanshyam on Tuesday 2nd of December 2008 05:03:48 AM
Old 12-02-2008
Recursion

I want to halt a tail recursive function after certain validation. I want to come out of entire recursion without unwinding phase. How can i achieve that . The coding is done in C language.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

recursion

I'm using the UNIX csh and i wish to use recursion to nav my way up (or down as it is) a given folder. My little test script is called "r" and takes a folder as argv (or $1) #!/bin/tcsh -f set allFiles = `ls -A $argv` cd $argv while ($#allFiles) if (-d... (1 Reply)
Discussion started by: gsjf
1 Replies

2. Shell Programming and Scripting

recursion too deep

I am running a korn shell script which has a recursive function. The script ran for 117 iterations and ended up with the following error "recursion too deep". what should be done to avert this? Thanks in advance Swamy p.s. I am on UNIX MPRAS V4 (3 Replies)
Discussion started by: swamy455
3 Replies

3. Shell Programming and Scripting

Help Help Help in recursion

Hello every body. I am trying to find the factorial using the following code. But it is giving the syntax error. I tried very much but in vain. Thanks in advance for helping me factorial() { if then y=`expr $1 - 1` x=$(( $1 \* factorial $y ))... (6 Replies)
Discussion started by: murtaza
6 Replies

4. Shell Programming and Scripting

recursion script problem

Hi Guys,, I tried to create a recursive function in unix. The following is the code. #/bin/sh function(){ n=$1; if ; then out=1; echo "inside if for 0"; else out = `$n * function "$n-1"`; echo "inside if for $n-1; fi (3 Replies)
Discussion started by: mac4rfree
3 Replies

5. Programming

C Recursion (explain)

Hi, Question: how come the output is like that? Can explain to me abit. I am learning C. Thanks! #include <stdio.h> #include <string.h> void printit(char line_of_char, int index); int main() { char line_of_char; int index = -1; strcpy(line_of_char, "This is a string."); ... (5 Replies)
Discussion started by: seede
5 Replies

6. Shell Programming and Scripting

script recursion

Can someone please explain me why the following script calls it self recursively: #!/bin/bash echo Called $0 while this not: #!/bin/bash echo Called $($0) Thanks (6 Replies)
Discussion started by: superpointer
6 Replies

7. UNIX for Advanced & Expert Users

Recursion list for rm -R in find

In the following command: find / -ctime +3 -exec rm -R {}\; how is the recursion list built for the actual rm ? F'rinstance; I had a case where a user typed this as root using '/' instead of '.' so everything in the root level was going to be traversed. They hit <ctrl>C before too much was... (5 Replies)
Discussion started by: port43
5 Replies

8. Shell Programming and Scripting

Bash variable recursion

Not sure how to ask this question. I want concatenate strings and variable recursively into new variable. For example: infile01=/dir/subfolder/file01.txt infile02=/dir/subfolder/file02.txt infile03=/dir/subfolder/file03.txt for i in {01..03} do u=${"infile"$i} echo $u doneI got error... (7 Replies)
Discussion started by: yifangt
7 Replies

9. Solaris

BIND 9, disable recursion

Hi, I am trying to disable the recursion on DNS server (Solaris 10). I have added the lines in the named.conf as below: allow-query-cache { none; }; recursion no; Then restarted the solaris DNS services svcadm refresh svc:/network/dns/server:default Still I am able to... (0 Replies)
Discussion started by: snchaudhari2
0 Replies

10. UNIX for Beginners Questions & Answers

Copy directory withOUT recursion

Hi, I cannot find a way to copy a directory to another location with all attributes (mode, ownership, timestamps) but withOUT recursion (after so many years of working with Linux). Say I want to create /home/jail/tmp exactly like /tmp but with nothing in it. Here is what I tried: ... (7 Replies)
Discussion started by: chebarbudo
7 Replies
UNW_RESUME(3)						       Programming Library						     UNW_RESUME(3)

NAME
unw_resume -- resume execution in a particular stack frame SYNOPSIS
#include <libunwind.h> int unw_resume(unw_cursor_t *cp); DESCRIPTION
The unw_resume() routine resumes execution at the stack frame identified by cp. The behavior of this routine differs slightly for local and remote unwinding. For local unwinding, unw_resume() restores the machine state and then directly resumes execution in the target stack frame. Thus unw_resume() does not return in this case. Restoring the machine state normally involves restoring the ``preserved'' (callee-saved) regis- ters. However, if execution in any of the stack frames younger (more deeply nested) than the one identified by cp was interrupted by a sig- nal, then unw_resume() will restore all registers as well as the signal mask. Attempting to call unw_resume() on a cursor which identifies the stack frame of another thread results in undefined behavior (e.g., the program may crash). For remote unwinding, unw_resume() installs the machine state identified by the cursor by calling the access_reg and access_fpreg accessor callbacks as needed. Once that is accomplished, the resume accessor callback is invoked. The unw_resume routine then returns normally (that is, unlikely for local unwinding, unw_resume will always return for remote unwinding). Most platforms reserve some registers to pass arguments to exception handlers (e.g., IA-64 uses r15-r18 for this purpose). These registers are normally treated like ``scratch'' registers. However, if libunwind is used to set an exception argument register to a particular value (e.g., via unw_set_reg()), then unw_resume() will install this value as the contents of the register. In other words, the exception han- dling arguments are installed even in cases where normally only the ``preserved'' registers are restored. Note that unw_resume() does not invoke any unwind handlers (aka, ``personality routines''). If a program needs this, it will have to do so on its own by obtaining the unw_proc_info_t of each unwound frame and appropriately processing its unwind handler and language-specific data area (lsda). These steps are generally dependent on the target-platform and are regulated by the processor-specific ABI (applica- tion-binary interface). RETURN VALUE
For local unwinding, unw_resume() does not return on success. For remote unwinding, it returns 0 on success. On failure, the negative value of one of the errors below is returned. THREAD AND SIGNAL SAFETY
unw_resume() is thread-safe. If cursor cp is in the local address-space, this routine is also safe to use from a signal handler. ERRORS
UNW_EUNSPEC An unspecified error occurred. UNW_EBADREG A register needed by unw_resume() wasn't accessible. UNW_EINVALIDIP The instruction pointer identified by cp is not valid. UNW_BADFRAME The stack frame identified by cp is not valid. SEE ALSO
libunwind(3), unw_set_reg(3), sigprocmask(2) AUTHOR
David Mosberger-Tang Email: dmosberger@gmail.com WWW: http://www.nongnu.org/libunwind/. Programming Library 16 August 2007 UNW_RESUME(3)
All times are GMT -4. The time now is 07:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy