12-10-2009
Quote:
Originally Posted by
DreamWarrior
I think the short answer is no. As far as I know, there is no way in C to dynamically control the call stack.
I've seen it done, like you say, in inline ASM. Very hairy ASM that's specific to carefully controlled circumstances under one configuration of one compiler of one version of one architecture. I tried building one myself, and quickly gave up when I spotted the optimizer stuffing arguments into registers instead of stack whenever it felt like it.
It should really be up to the one thing that really knows how function calls work at all times -- the compiler, plus macros in stdargs. It's one of the few severely un-orthogonal things left in C but there's obscure reasons this isn't possible on a few strange architectures, ergo it's not going to happen.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
can I call a function in bash script just as in C++
while
do
function()
done
function()
thanks,
Steffen (3 Replies)
Discussion started by: forever_49ers
3 Replies
2. Programming
Hi, Can anyone help me figure out the problem I'm having with a function call?
I have a header file, which sets an enum:
typedef enum {INFO, WARNING, FATAL} Levels;
int log_event (Levels, char *fmt, ...);
..then the function is called this way:
log_event(INFO, "Message text");
... (6 Replies)
Discussion started by: Stevhp
6 Replies
3. Shell Programming and Scripting
I have a function check_ok in my abc.sh. which return me 1 or 0 . I want to call this fuction through other shell script. this shell also send two parameter to calling function.
Can you please tell me how. I am very new in unix.
#!/bin/bash
date_equal()
{
sqlplus -silent... (4 Replies)
Discussion started by: Jamil Qadir
4 Replies
4. Shell Programming and Scripting
hello,
when i call function inside awk traitement it doesn't work, i don't have error execution but i don't get result and if i call the function outside awk traitement it work well..
there's something special in awk call function??
here is the example :
awk -F "," '{ {first=$1; sec=$2;... (3 Replies)
Discussion started by: kamel.seg
3 Replies
5. Shell Programming and Scripting
How we can start a process if doesn't exists before? (1 Reply)
Discussion started by: Zaxon
1 Replies
6. Infrastructure Monitoring
Hello,
I have a problem with package and name space.
require "/Mehran/DSGateEngineLib/general.pl";
use strict;
sub System_Status_Main_Service_Status_Intrusion_Prevention
{
my %idpstatus;
my @result;
&General_ReadHash("/var/dsg/idp/settings",\%idpstatus);
#print... (4 Replies)
Discussion started by: Zaxon
4 Replies
7. Shell Programming and Scripting
Hi foiks
i am unable to find what is wrong in my code
mu functionality is to exit from shell when i give 99 but it is not calling function ext
Could you please correct me.
read option
if ;
then
ext
else
echo "out"
fi
function ext
{
echo "tested 99 and exit... (12 Replies)
Discussion started by: kojo
12 Replies
8. Shell Programming and Scripting
Below is my script that is function properly per my conditions but I am facing one problem here that is when one function fails then Iy should not check other functions but it calls the other function too So anyone can help me how could i achieve this?
iNOUT i AM GIVING TO THE... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies
9. Shell Programming and Scripting
Hi all,
Does anyone know if it possible to append a parameter to a function name?
Something like the following:
function tnsrec_${SERVICE_NAME} {
code..
}
Any ideas? (6 Replies)
Discussion started by: jonnyd
6 Replies
10. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
2. Relevant commands, code, scripts, algorithms:
#! /bin/ksh
v="ORG_ID"
... (2 Replies)
Discussion started by: sujitdas2104
2 Replies
LEARN ABOUT FREEBSD
openpam_readlinev
OPENPAM_READLINEV(3) BSD Library Functions Manual OPENPAM_READLINEV(3)
NAME
openpam_readlinev -- read a line from a file and split it into words
LIBRARY
Pluggable Authentication Module Library (libpam, -lpam)
SYNOPSIS
#include <sys/types.h>
#include <stdio.h>
#include <security/pam_appl.h>
#include <security/openpam.h>
char **
openpam_readlinev(FILE *f, int *lineno, int *lenp);
DESCRIPTION
The openpam_readlinev() function reads a line from a file, splits it into words according to the rules described in the openpam_readword(3)
manual page, and returns a list of those words.
If lineno is not NULL, the integer variable it points to is incremented every time a newline character is read. This includes quoted or
escaped newline characters and the newline character at the end of the line.
If lenp is not NULL, the number of words on the line is stored in the variable to which it points.
RETURN VALUES
If successful, the openpam_readlinev() function returns a pointer to a dynamically allocated array of pointers to individual dynamically
allocated NUL-terminated strings, each containing a single word, in the order in which they were encountered on the line. The array is ter-
minated by a NULL pointer.
The caller is responsible for freeing both the array and the individual strings by passing each of them to free(3).
If the end of the line was reached before any words were read, openpam_readlinev() returns a pointer to a dynamically allocated array con-
taining a single NULL pointer.
The openpam_readlinev() function can fail and return NULL for one of four reasons:
o The end of the file was reached before any words were read; errno is zero, ferror(3) returns zero, and feof(3) returns a non-zero value.
o The end of the file was reached while a quote or backslash escape was in effect; errno is set to EINVAL, ferror(3) returns zero, and
feof(3) returns a non-zero value.
o An error occurred while reading from the file; errno is non-zero, ferror(3) returns a non-zero value and feof(3) returns zero.
o A malloc(3) or realloc(3) call failed; errno is set to ENOMEM, ferror(3) returns a non-zero value, and feof(3) may or may not return a
non-zero value.
SEE ALSO
openpam_readline(3), openpam_readword(3), pam(3)
STANDARDS
The openpam_readlinev() function is an OpenPAM extension.
AUTHORS
The openpam_readlinev() function and this manual page were developed by Dag-Erling Smorgrav <des@des.no>.
BSD
September 12, 2014 BSD