05-17-2002
it is not right through judging the errno values
thanks for your advice,but it is not right through judging the errno values,
example:
#include <stdio.h>
#include <errno.h>
main()
{
int ret;
char cmd[128];
strcpy(cmd,"compress /tmp/lll");
ret = system(cmd);
printf("after system errno[%d], ret[%d]\n", errno, ret);
exit(0);
}
if the fileˇ°/tmp/lllˇ± doesnot exist,execute this program,screen will
output:
compress: could not read /tmp/lll: No such file or directory (error 2)
after system errno[0], ret[256]
errno only represents the result of calling system function,not the result of the command (compress).
#include <stdio.h>
#include <errno.h>
main()
{
int ret;
char cmd[128];
strcpy(cmd,"compress /tmp/lll");
ret = system(cmd);
/* add this sentence"/
ret >>= 8
printf("after system errno[%d], ret[%d]\n", errno, ret);
if ( ret == 0 )
printf("compress success\n");
else
printf("compress failure\n");
exit(0);
}
is it right to judge whether the file compress is success though the ret >>= 8;
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Will UNIX Sytem 5, release 3 run on a Pentium (clock speed 100-200 MHz)?
thanks (5 Replies)
Discussion started by: samklyle
5 Replies
2. Shell Programming and Scripting
hi,
can any one help me to correct this function call.
awk -F "," '{ {first=$1; sec=$2; tro=$3;quat=$4 }
if (tro == "")
{
$3 = search "$file2" "$first" "$file3"
{print $1","$2","$3","$4} }
else
{print $1","$2","$3 $4}}' $file1 > $file
search ()
{ (2 Replies)
Discussion started by: kamel.seg
2 Replies
3. UNIX for Dummies Questions & Answers
I try to run java file on SCO Unix, but my Unix doesn't setup with JDK environment. I go to sun.com to download JDK for SCO Unix, but there is only JDK for HP-UNIX, is it ok for SCO Unix? If it's ok, how can I install it to my Unix after I download? If it's not ok, How can I do to run java file in... (0 Replies)
Discussion started by: wendyz
0 Replies
4. Shell Programming and Scripting
Hi,
I have a string corresponding to a function. How I can call that function without if statement?
Thanks in advance. (4 Replies)
Discussion started by: Zaxon
4 Replies
5. 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
6. 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
7. Shell Programming and Scripting
hi,
I want to know how to call a pl sql function testfunction(param1,..) that returns a value and grab that value in a shell variable.
Thnx in advance
---------- Post updated 03-30-10 at 11:58 AM ---------- Previous update was 03-29-10 at 03:49 PM ----------
thnx a lot jim (0 Replies)
Discussion started by: austinhell3_16
0 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
Hello All :)
I want to write a shell script to find the file system usage on multiple UNIX servers.
Commands: df -g fsJCAPS
Below script works fine and it displays results on terminal/console. I want to store /redirect output on to local server from where I'm running the script.
... (3 Replies)
Discussion started by: Mohammad Nawaz
3 Replies
10. Programming
Hi, I am complete new to C programming and shell scripting. I just wrote a simple C code to calculate integral using trapezoid rule. I am prompting user to pass me No. of equally spaced points , N , upper and lower limit. My code looks as follows so far:
#include<stdio.h>
#include<string.h>... (2 Replies)
Discussion started by: bjhjh
2 Replies
LEARN ABOUT FREEBSD
krb5_ccache_intro
krb5_ccache_intro(3) HeimdalKerberos5library krb5_ccache_intro(3)
NAME
krb5_ccache_intro - The credential cache functions
Kerberos credential caches
krb5_ccache structure holds a Kerberos credential cache.
Heimdal support the follow types of credential caches:
o SCC Store the credential in a database
o FILE Store the credential in memory
o MEMORY Store the credential in memory
o API A credential cache server based solution for Mac OS X
o KCM A credential cache server based solution for all platforms
Example
This is a minimalistic version of klist:
#include <krb5.h>
int
main (int argc, char **argv)
{
krb5_context context;
krb5_cc_cursor cursor;
krb5_error_code ret;
krb5_ccache id;
krb5_creds creds;
if (krb5_init_context (&context) != 0)
errx(1, 'krb5_context');
ret = krb5_cc_default (context, &id);
if (ret)
krb5_err(context, 1, ret, 'krb5_cc_default');
ret = krb5_cc_start_seq_get(context, id, &cursor);
if (ret)
krb5_err(context, 1, ret, 'krb5_cc_start_seq_get');
while((ret = krb5_cc_next_cred(context, id, &cursor, &creds)) == 0){
char *principal;
krb5_unparse_name(context, creds.server, &principal);
printf('principal: %s
', principal);
free(principal);
krb5_free_cred_contents (context, &creds);
}
ret = krb5_cc_end_seq_get(context, id, &cursor);
if (ret)
krb5_err(context, 1, ret, 'krb5_cc_end_seq_get');
krb5_cc_close(context, id);
krb5_free_context(context);
return 0;
}
Version 1.5.2 11 Jan 2012 krb5_ccache_intro(3)