04-03-2014
Since VM can be mapped anywhere, they started by putting the environment, code, constants, initialized vaiables and unitialized variables in the bottom of memory, the heap, and the stack is started at top top of memory. growing toward each other. I think signal flags and open files are really in the kernel, and the fd is just an offset into a kernel per-process array of pointers to open files, so many processes can have the same open file on one or more fd numbers. The loader puts the arguments' pointers in an array with a terminating null pointer and starts up main(). If you wrote in C++, static objects' constructors would run before main(). Suppose you call strcmp(x,y). The code will push the adresses of x and y into the stack, and maybe allow a return value space, and call the strcpy code. Often values pushed are promoted to 4 byte integer even if short or char. If strcpy has automatic variables, they are located below the stack pointer setting after the call arguments. For calls within calls, each set of arguments and auto variables is called a stack frame. So, even though nobody else knows the address of a subroutine's static variables, the compiler/linker knows. The subroutine could pass a pointer to it, or load a global pointer with its address, to make it visible to others. Some even return it, which is not usual since it might not be MT-Safe! For instance, if you return a char* of a static char[50] with a null terminated string in it, unless it is const, someone might rewrite it, and if it is a product of the call input arguments, the next call will change the value, usually to something the first recipient of the pointer did not ask for. Some of the time libraries are like this, and have newer, safe variations.
This User Gave Thanks to DGPickett For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
how can i determine that
what percentage of stack region is currently is used?
(i am using tru64 unix) (2 Replies)
Discussion started by: yakari
2 Replies
2. UNIX for Dummies Questions & Answers
str1="this oracle data base record"
str2="one two three four five"
Output:
this one
oracle two
data three
base four
record five
str1 and str2 have the same column but they are not fixed columns.
I can do it with "paste" but I do not want to create file everytime the
script runs from... (2 Replies)
Discussion started by: buddyme
2 Replies
3. UNIX for Advanced & Expert Users
Hello all,
I have a question about what you think the best practice is to determine what region you are running on when you have a system setup with a DEV/TEST, QA, and PROD regions running the same scripts in all.
So, when you run in DEV, you have a different directory structure, and you... (4 Replies)
Discussion started by: Rediranch
4 Replies
4. Shell Programming and Scripting
How can I find the regions between specific lines?
I have a file which contains lines like this:
chr1 0 17388 0
chr1 17388 17444 1
chr1 17444 17599 2
chr1 17599 17601 1
chr1 17601 569791 0
chr1 569791 569795 1
chr1 569795 569808 2
chr1 569808 569890 3
chr1 569890 570047 4 ... (9 Replies)
Discussion started by: linseyr
9 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I would like to know how can I get the ID of a feature if its genomic coordinates overlap the coordinates of another file. Example:
Get the 4th column (ID) of this file1:
chr1 10 100 gene1
chr2 3000 5000 gene2
chr3 200 1500 gene3
if it overlaps with a feature in this file2:
chr2... (1 Reply)
Discussion started by: fadista
1 Replies
6. AIX
Dears my rootvg is missed up i can not extend the /opt
as soon as i try to extend the Filesystem its give me that there is not enough space .
as there any way to change the REGION of the LVs in HDISK1 ?
lspv -p hdisk0
hdisk0:
PP RANGE STATE REGION LV NAME TYPE ... (8 Replies)
Discussion started by: thecobra151
8 Replies
7. Shell Programming and Scripting
Hello,
I am working on an Urdu to Hindi dictionary which has the following structure:
a=b
a=c
n=d
n=q
and so on.
i.e. Headword separated from gloss by a =
I am giving below a live sample
بتا=बता
بتا=बित्ता
بتا=बुत्ता
بتان=बतान
بتان=बितान
بتانا=बिताना
I need the following... (3 Replies)
Discussion started by: gimley
3 Replies
8. Programming
Perl script to merge cells
---------- Post updated at 12:59 AM ---------- Previous update was at 12:54 AM ----------
I am using below code to read files from a dir and print to excel.
open(my $in, '<', $file) or die "Could not open file: $!";
my $rowCount = 0;
my $colCount = 0;... (11 Replies)
Discussion started by: Jack_Bruce
11 Replies
9. Shell Programming and Scripting
I am preparing a morphological grammar of Marathi to be placed in open-source.
I have two files.
The first file called Adverbs contains a whole list of words, one word per line
A sample is given below:
आधी
इतक
इतपत
उलट
एवढ
ऐवजी
कड
कडनं
कडल
कडील
कडून
कडे
करता
करिता
खाल (2 Replies)
Discussion started by: gimley
2 Replies
10. Shell Programming and Scripting
I have a bi-lingual database of a large number of dictionaries. It so happens that in some a given string is in upper case and in others it is in lower case. An example will illustrate the issue.
toll Tax=पथ-कर
Toll tax=राहदारी कर
toll tax=टोल
I want to treat all three instances of toll tax... (3 Replies)
Discussion started by: gimley
3 Replies
LEARN ABOUT ULTRIX
strcmp
string(3) Library Functions Manual string(3)
Name
strcasecmp, strncasecmp, strcat, strncat, strcmp, strncmp, strcpy, strncpy, strlen, strchr, strrchr, strpbrk, strspn, strcspn, strstr, str-
tok, index, rindex - string operations
Syntax
#include <strings.h>
or
#include <string.h>
strcasecmp(s1, s2)
char *s1, *s2;
strncasecmp(s1, s2, n)
char *s1, *s2;
char *strcat(s1, s2)
char *s1, *s2;
char *strncat(s1, s2, n)
char *s1, *s2;
int strcmp(s1, s2)
unsigned char *s1, *s2;
int strncmp(s1, s2, n)
unsigned char *s1, *s2;
int n
char *strcpy(s1, s2)
char *s1, *s2;
char *strncpy(s1, s2, n)
char *s1, *s2;
int n
size_t strlen(s)
char *s;
char *strchr(s, c)
char *s;
int c;
char *strrchr(s, c)
char *s;
int c;
char *strpbrk(s1, s2)
char *s1, *s2;
size_t strspn(s1, s2)
char *s1, *s2;
size_t strcspn(s1, s2)
char *s1, *s2;
char *strtok(s1, s2)
char *s1, *s2;
char *index(s, c)
char *s, c;
char *rindex(s, c)
char *s, c;
char *strstr(s1, s2)
char *s1, *s2;
Description
The arguments s1, s2, and s point to strings (arrays of characters terminated by a null character). The functions and subroutines all
alter s1. These functions do not check for overflow of the array pointed to by s1.
The subroutine appends a copy of string s2 to the end of string s1. The subroutine copies at most n characters. Both return a pointer to
the null-terminated result.
The subroutine compares its arguments and returns an integer greater than, equal to, or less than 0, according as s1 is lexicographically
greater than, equal to, or less than s2. The subroutine makes the same comparison but looks at at most n characters. The and subroutines
are identical in function, but are case insensitive. The returned lexicographic difference reflects a conversion to lower-case.
The subroutine copies string s2 to s1, stopping after the null character has been copied. The subroutine copies exactly n characters,
truncating s2 or adding null characters to s1 if necessary. The result will not be null-terminated if the length of s2 is n or more. Each
function returns s1.
The subroutine returns the number of characters in s, not including the terminating null character.
The subroutine returns a pointer to the first occurrence of s2 (excluding the terminating null character) in s1, or a NULL pointer if s2
does not occur in s1. If the length of s2 is zero, returns s1.
The ( ) function returns a pointer to the first (last) occurrence of character c in string s, or a NULL pointer is c does not occur in the
string. The null character terminating a string is considered to be part of the string.
The subroutine returns a pointer to the first occurrence in string s1 of any character from string s2, or a NULL pointer if no character
from s2 exists in s1.
The ( ) subroutine returns the length of the initial segment of string s1 which consists entirely of characters from (not from) string s2.
The subroutine considers the string s1 to consist of a sequence of zero or more text tokens separated by spans of one or more characters
from the separator string s2. The first call (with pointer s1 specified) returns a pointer to the first character of the first token, and
will have written a null character into s1 immediately following the returned token. The function keeps track of its position in the
string between separate calls, so that subsequent calls (which must be made with the first argument a NULL pointer) will work through the
string s1 immediately following that token. In this way, subsequent calls will work through the string s1 until no tokens remain. The
separator string s2 may be different from call to call. When no token remains in s1, a NULL pointer is returned.
The ( ) subroutine returns a pointer to the first (last) occurrence of character c in string s, or zero if c does not occur in the string.
The <string.h> header file is provided for compatibility with System V; both <string.h> and <strings.h> refer to the same file.
The and subroutines do unsigned character comparisons.
string(3)