06-30-2016
before i posted my query i commented all the parsing, processing and db statements and simply put echoes at the bottom so it would print the ssh command and all of the variables i expected to get set. the variables were all set as expected and so was the ssh command when i use strlen to determine if the $host variable was set. however, when i use either of the isset chunks the $server after the -host argument is null but the $server after the ConnectTimeout=60 is okay. i just don't get why my isset chunks won't put $server in both places i expect it to be when $host is not set. so let me ask this, do the two isset pieces look okay? thanks.
10 More Discussions You Might Find Interesting
1. Programming
hello,
i have a problem with strlen. I have written this:
for(y=13,z=0; cInBuf!=' ';y++)
{
cBuf=cInBuf;
z++;
}
len = strlen(cBuf);
out=len/2;
fprintf(outfile,"F%i",out);
If strlen is e.g. 22, it write F22. I want to write F2F2.
How can i do this?... (5 Replies)
Discussion started by: ACeD
5 Replies
2. Shell Programming and Scripting
Hello,
Just a little problem with the ksh function : strlen
I want to use this function in this little ksh program :
while read line ; do
TOTO=$line
TOTONB=strlen($TOTO)
echo $TOTONB (3 Replies)
Discussion started by: steiner
3 Replies
3. Shell Programming and Scripting
Hi all,
I have a perl script which declares two variables and calls another perl script which accesses those variables. But I am unable to access the variables in the called script. My script is as follows:
my $ENV{a}="20";
system("perl called.pl");
and my called.pl contains:
print... (3 Replies)
Discussion started by: gurukottur
3 Replies
4. Programming
In a declaration, I have:
const char comment_begin = "<!--";
const char comment_end = "-->";
const int comment_begin_len = strlen(comment_begin);
const int comment_end_len = strlen(comment_end);
When I compile, I get the warnings:
emhttpc.c:64: warning: initializer element is not... (10 Replies)
Discussion started by: cleopard
10 Replies
5. Programming
I have been getting some flack recently for my use of strlen() and strnlen(). Honestly I have always just taken their functionality for granted as being the easiest way of getting the length of a string. Is it really so much better to do pointer arithmetic? What am I gaining besides more... (3 Replies)
Discussion started by: jjinno
3 Replies
6. Shell Programming and Scripting
Hi!
Some minutes ago I've posted a question related with sed regexps because I need to catch information sended with forms with GET action. This is the post: https://www.unix.com/shell-programming-scripting/127800-regular-expression-sed.html
But now I have a new question. Does cgi scripts have... (0 Replies)
Discussion started by: GagleKas
0 Replies
7. Programming
My OS (Debian) and gcc use the UTF-8 locale. This code says that the char size is 1 byte but the size of 'a' is really 4 bytes.
int main(void)
{
setlocale(LC_ALL, "en_US.UTF-8");
printf("Char size: %i\nSize of char 'a': %i\nSize of Euro sign '€': %i\nLength of Euro sign: %i\n",... (8 Replies)
Discussion started by: cyler
8 Replies
8. AIX
Hello All,
I am getting this error while compiling my application on IBM AIX 5.3.
As I tried to define _XOPEN_SOURCE=500 in makefile, that didn't work.
Please help us to resolve the error. (0 Replies)
Discussion started by: mustus
0 Replies
9. Shell Programming and Scripting
Hi! I've a C program as shown below..
The line numbers and the statements of the program are separated by a space..
1 #include<stdio.h>
2 char a,b,c;
3 float x,y,z;
4 int main()
5 {
6 int d,e,f;
7 // further declarations
8 // further declarations
9 /* body*/
10 }
11 void fun1()
12... (1 Reply)
Discussion started by: abk07
1 Replies
10. Programming
Hello,
This function was copied into my code, which was compiled without error/warning, but when executed there is always Segmentation fault at the end after the output (which seems correct!):
void get_hashes(unsigned int hash, unsigned char *in)
{
unsigned char *str = in;
int pos =... (7 Replies)
Discussion started by: yifangt
7 Replies
LEARN ABOUT PHP
arrayaccess
ARRAYACCESS(3) 1 ARRAYACCESS(3)
The ArrayAccess interface
INTRODUCTION
Interface to provide accessing objects as arrays.
INTERFACE SYNOPSIS
ArrayAccess
ArrayAccess
Methods
o abstractpublic boolean ArrayAccess::offsetExists (mixed $offset)
o abstractpublic mixed ArrayAccess::offsetGet (mixed $offset)
o abstractpublic void ArrayAccess::offsetSet (mixed $offset, mixed $value)
o abstractpublic void ArrayAccess::offsetUnset (mixed $offset)
Example #1
Basic usage
<?php
class obj implements ArrayAccess {
private $container = array();
public function __construct() {
$this->container = array(
"one" => 1,
"two" => 2,
"three" => 3,
);
}
public function offsetSet($offset, $value) {
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
public function offsetExists($offset) {
return isset($this->container[$offset]);
}
public function offsetUnset($offset) {
unset($this->container[$offset]);
}
public function offsetGet($offset) {
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
}
$obj = new obj;
var_dump(isset($obj["two"]));
var_dump($obj["two"]);
unset($obj["two"]);
var_dump(isset($obj["two"]));
$obj["two"] = "A value";
var_dump($obj["two"]);
$obj[] = 'Append 1';
$obj[] = 'Append 2';
$obj[] = 'Append 3';
print_r($obj);
?>
The above example will output something similar to:
bool(true)
int(2)
bool(false)
string(7) "A value"
obj Object
(
[container:obj:private] => Array
(
[one] => 1
[three] => 3
[two] => A value
[0] => Append 1
[1] => Append 2
[2] => Append 3
)
)
PHP Documentation Group ARRAYACCESS(3)