Sponsored Content
Top Forums Shell Programming and Scripting perl: why the return valure of stat and lstat are the same? Post 22275 by thehoghunter on Thursday 30th of May 2002 01:58:07 PM
Old 05-30-2002
I could not get lstat to work at all - it would always give "" for an answer - tried hard and soft links.

Why you get the same info may be explained by the description of lstat on Perldoc.com
thehoghunter
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Searching for SETUID and SETGID using PERL file find with lstat

About System and Perl: Sun Solaris 5.9 sparc, Perl 5.6.1 I've decided to use the perl file::find module to look for all the SETUID and SETGID files on my unix boxes. I wrote something like this: (I've shorted it a little to make it simple) #!/opt/perl/bin/perl use File::Find; find... (1 Reply)
Discussion started by: x96riley3
1 Replies

2. Shell Programming and Scripting

fuction return in perl

Hi All, I have a perl script(1.pl) that calls a c function defined in another file sample.c #!/usr/bin/perl my $re = 1; my @s = `/home/PERL_SCRIPTING/Rough/sample pline $re 10`; print "$_" foreach(@s); The sample.c is as bwlow: # include <stdio.h> int pline(int, int);... (4 Replies)
Discussion started by: jisha
4 Replies

3. Shell Programming and Scripting

perl : stdout is not return to screen

Hello All, I have a perl script , and the STDERR and additional FH is redirected to the STDOUT like below: open STDOUT ,">>$log" or die "$! :: $log\n"; open STDERR ,">&STDOUT" or die "$! :: Can redirect STDERR to STDOUT\n"; select STDERR; $|=1; open LOG ,">&STDOUT" or die "$! :: Can... (2 Replies)
Discussion started by: Alalush
2 Replies

4. Programming

lstat long path problem

Hi, We are using lstat in our project. But in case of the path length more than 1024, it's returning error ENAMETOOLONG. Is there any another system call which is supporting more than 1024 path and providing the same info as lstat. Thanks (2 Replies)
Discussion started by: Saurabh78
2 Replies

5. Shell Programming and Scripting

perl return ips after successful ping

Hi, I have this script in ksh, what it does is loop every ip in the nodes_nso and produced another variable up_nodes_nso of only ip's that are up. nodes_nso=$(cat /var/tmp/nodes.txt) echo "ICMP Tests:" up_nodes_nso="" for ip in ${nodes_nso} ; do ping ${ip} 3 > /dev/null if ; then ... (1 Reply)
Discussion started by: borderblaster
1 Replies

6. Programming

lstat problem

Hello, I have a little problem with lstat. I use the find utility, to find a path for a file in my system. After that,I take that path and I pass it in lstat, but lstat returns -1, and this error : no such file or directory. So I m trying to "ls" the path in the shell, but it also fails. ... (1 Reply)
Discussion started by: garag11
1 Replies

7. UNIX for Dummies Questions & Answers

lstat problem

Hello, I have a little problem with lstat. I use the find utility, to find a path for a file in my system. After that,I take that path and I pass it in lstat, but lstat returns -1, and this error : no such file or directory. So I m trying to "ls" the path in the shell, but it also fails. ... (2 Replies)
Discussion started by: garag11
2 Replies

8. Shell Programming and Scripting

[PERL] Cannot stat or move filename - £££F3AERO££.txt

Scenario: Users drop files into a directory which is regularly polled by my PERL process. On detecting a file my process will move it from the poll dir to a working directory. A user created a file with a £ symbol in the filename and my process now fails. e.g £££F3AERO££.txt ... (1 Reply)
Discussion started by: thefal9
1 Replies

9. Shell Programming and Scripting

unable to return multilple values in perl

hello friends, i have written one perl script.Which opens a file and search for some parameter's value and gets the status of these parameters. but while i am trying to return these value always i am getting false. Can any one please help me.. here is that function: =======================... (5 Replies)
Discussion started by: harpal singh
5 Replies

10. Shell Programming and Scripting

Return multiple values using for loop in perl

I am using a for loop to copy files from say DIR1 and DIR2 to DIR3.I have to check whether files are copied from DIR1 and DIR2 and print the respective message. @path=("$DIR1","$DIR2"); foreach (@path) { $rc=system("cp $_/*xml $DIR3"); if ($rc == 0) { print "Files were copied... (1 Reply)
Discussion started by: liyakathali
1 Replies
explain_lstat(3)					     Library Functions Manual						  explain_lstat(3)

NAME
explain_lstat - explain lstat(3) errors SYNOPSIS
#include <libexplain/lstat.h> const char *explain_lstat(const char *pathname, const struct stat *buf); void explain_message_lstat(char *message, int message_size, const char *pathname, const struct stat *buf); const char *explain_errno_lstat(int errnum, const char *pathname, const struct stat *buf); void explain_message_errno_lstat(char *message, int message_size, int errnum, const char *pathname, const struct stat *buf); DESCRIPTION
These functions may be used to obtains explanations for lstat(2) errors. explain_lstat const char *explain_lstat(const char *pathname, const struct stat *buf); The explain_lstat function is used to obtain an explanation of an error returned by the lstat(2) function. The least the message will con- tain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (lstat(pathname, &buf) < 0) { fprintf(stderr, '%s0, explain_lstat(pathname, &buf)); exit(EXIT_FAILURE); } pathname The original pathname, exactly as passed to the lstat(2) system call. buf The original buf, exactly as passed to the lstat(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_errno_lstat "const char *explain_errno_lstat(int errnum, const char *pathname, const struct stat *buf); The explain_errno_lstat function is used to obtain an explanation of an error returned by the lstat(2) function. The least the message will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (lstat(pathname, &buf) < 0) { int err = errno; fprintf(stderr, '%s0, explain_errno_lstat(err, pathname, &buf)); exit(EXIT_FAILURE); } errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. pathname The original pathname, exactly as passed to the lstat(2) system call. buf The original buf, exactly as passed to the lstat(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_message_lstat void explain_message_lstat(char *message, int message_size, const char *pathname, const struct stat *buf); The explain_message_lstat function is used to obtain an explanation of an error returned by the lstat(2) function. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (lstat(pathname, &buf) < 0) { char message[3000]; explain_message_lstat(message, sizeof(message), pathname, &buf); fprintf(stderr, '%s0, message); exit(EXIT_FAILURE); } message The location in which to store the returned message. Because a message return buffer has been supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. pathname The original pathname, exactly as passed to the lstat(2) system call. buf The original buf, exactly as passed to the lstat(2) system call. explain_message_errno_lstat void explain_message_errno_lstat(char *message, int message_size, int errnum, const char *pathname, const struct stat *buf); The explain_message_errno_lstat function is used to obtain an explanation of an error returned by the lstat(2) function. The least the message will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (lstat(pathname, &buf) < 0) { int err = errno; char message[3000]; explain_message_errno_lstat(message, sizeof(message), err, pathname, &buf); fprintf(stderr, '%s0, message); exit(EXIT_FAILURE); } message The location in which to store the returned message. Because a message return buffer has been supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. pathname The original pathname, exactly as passed to the lstat(2) system call. buf The original buf, exactly as passed to the lstat(2) system call. COPYRIGHT
libexplain version 0.52 Copyright (C) 2008 Peter Miller AUTHOR
Written by Peter Miller <pmiller@opensource.org.au> explain_lstat(3)
All times are GMT -4. The time now is 10:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy