Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

errstr(2) [plan9 man page]

ERRSTR(2)							System Calls Manual							 ERRSTR(2)

NAME
errstr, werrstr - description of last system call error SYNOPSIS
#include <u.h> #include <libc.h> int errstr(char *err) void werrstr(char *fmt, ...) DESCRIPTION
When a system call fails it returns -1 and records a string describing the error in a per-process buffer. Errstr swaps the contents of that buffer with the contents of the array err. Err should contain at least ERRLEN characters (defined in <libc.h>). Usually errstr will be called with an empty string, but the exchange property provides a mechanism for libraries to set the return value for the next call to errstr. If no system call has generated an error since the last call to errstr with an empty string, the result is an empty string. The verb r in print(2) calls errstr and outputs the error string. Werrstr takes a print style format as its argument and uses it to format a string to pass to errstr. The string returned from errstr is discarded. SOURCE
/sys/src/libc/9syscall /sys/src/libc/9sys/werrstr.c DIAGNOSTICS
Errstr always returns 0. SEE ALSO
intro(2), perror(2) ERRSTR(2)

Check Out this Related Man Page

STRTONUM(3)						   BSD Library Functions Manual 					       STRTONUM(3)

NAME
strtonum -- reliably convert string value to an integer SYNOPSIS
#include <stdlib.h> long long strtonum(const char *nptr, long long minval, long long maxval, const char **errstr); DESCRIPTION
The strtonum() function converts the string in nptr to a long long value. The strtonum() function was designed to facilitate safe, robust programming and overcome the shortcomings of the atoi(3) and strtol(3) family of interfaces. The string may begin with an arbitrary amount of whitespace (as determined by isspace(3)) followed by a single optional '+' or '-' sign. The remainder of the string is converted to a long long value according to base 10. The value obtained is then checked against the provided minval and maxval bounds. If errstr is non-null, strtonum() stores an error string in *errstr indicating the failure. RETURN VALUES
The strtonum() function returns the result of the conversion, unless the value would exceed the provided bounds or is invalid. On error, 0 is returned, errno is set, and errstr will point to an error message. On success, *errstr will be set to NULL; this fact can be used to dif- ferentiate a successful return of 0 from an error. EXAMPLES
Using strtonum() correctly is meant to be simpler than the alternative functions. int iterations; const char *errstr; iterations = strtonum(optarg, 1, 64, &errstr); if (errstr != NULL) errx(1, "number of iterations is %s: %s", errstr, optarg); The above example will guarantee that the value of iterations is between 1 and 64 (inclusive). ERRORS
[ERANGE] The given string was out of range. [EINVAL] The given string did not consist solely of digit characters. [EINVAL] The supplied minval was larger than maxval. If an error occurs, errstr will be set to one of the following strings: too large The result was larger than the provided maximum value. too small The result was smaller than the provided minimum value. invalid The string did not consist solely of digit characters. SEE ALSO
atof(3), atoi(3), atol(3), atoll(3), sscanf(3), strtod(3), strtol(3), strtoul(3) STANDARDS
The strtonum() function is a BSD extension. The existing alternatives, such as atoi(3) and strtol(3), are either impossible or difficult to use safely. HISTORY
The strtonum() function first appeared in OpenBSD 3.6. BSD
April 29, 2004 BSD
Man Page

15 More Discussions You Might Find Interesting

1. Programming

Help with mySQL database by perl script

Hello; I was trying to set up a mysql database using following script, but never went through. The code seems fine without any syntax error as I tested it: perl -c Brapa0101-db.pl Brapa0101-db.pl syntax OKHowever, whenever I run it, an error message was tossed out: DBD::mysql::st execute... (7 Replies)
Discussion started by: yifangt
7 Replies

2. Shell Programming and Scripting

REGEX for a Full_PATH/Command --with-options

Hello All, I'm trying to match some user input. The User input will be a FULL Path, a Command/Script Name, and any options they choose... I was able to get this to Match somewhat but I want to be able to print an Error if, for example, the user enters a trailing "/" after the Command_name... (9 Replies)
Discussion started by: mrm5102
9 Replies

3. Solaris

Solaris 10 Sendemail with Attachment

Hello I need your kind help for configuring email on Solaris 10 so I can send reports from the system to my management and my colleagues. I have the IP address of the email server of my company and the port 2525. I went through many documents online with no luck. Can any one help me... (4 Replies)
Discussion started by: samer.odeh
4 Replies

4. Shell Programming and Scripting

Execute immediate in perl script

hi All, i have to modify a shell script written in Perl. i have to use execute immediate within this. i have to create a temporary table but it should have name like ar_data_$mmyyyy , how can i achieve this? any help on this would be highly appriciated. (6 Replies)
Discussion started by: lovelysethii
6 Replies

5. Shell Programming and Scripting

CGI Perl : while loop in CGI perl

Hi Team, I am trying to connect to database(succeeded ) and print the records on the browser using while loop. But the elements of array are not displayed instead while loop is displayed directly. Instead of the below I can embed html statements in print but I am looking for the below style as I... (1 Reply)
Discussion started by: scriptscript
1 Replies

6. Shell Programming and Scripting

Perl script database date convertion

Need assistance Below script get the output correctly I want to convert the date format .Below is the output . Any idea ? #!/usr/bin/perl -w use DBI; # Get a database handle by connecting to the database my $db = DBI->connect(... (3 Replies)
Discussion started by: ajayram_arya
3 Replies

7. Solaris

Oracle DB install failure

Hi all, I'm quite new to Solaris and I've been searching around everywhere to try and find the root of my Oracle DB install problem. It quits immediately when it runs isainfo when it gets a return of 3md64. To me this looks like there is a typo where ever isainfo pulls it's info from, but I... (13 Replies)
Discussion started by: asilv
13 Replies

8. Shell Programming and Scripting

Check data in mysql

Hi, I just would like to write a perl script , this perl script do the following . Check the parameter $data in a mysql database ( with user ID and password ) , if the $data is exist then return true , if not then return false , would advise how to write this script ? thanks ---------- Post... (1 Reply)
Discussion started by: ust3
1 Replies

9. UNIX for Dummies Questions & Answers

Finding SSL Cert Info

How do I find out the SSL cert info on the local server? How do I know if an ssl cert is installed on local server? How it was issued to? Who was the issuer? What's the expiration date? Any other relevant information? (1 Reply)
Discussion started by: scj2012
1 Replies

10. Shell Programming and Scripting

PERL: Calling a sub routine from another module - help!!!

Hi, I am an occasional PERL user. I am trying to call a sub routine (passing parameters) in perl module from a driver .pl file. I have been "tinkering" for a while now and have confused myself. Could someone please look at the code below and spot where I am going wrong. testPerl.pl ... (0 Replies)
Discussion started by: chris01010
0 Replies

11. Shell Programming and Scripting

PERL: DBI - Is it possible to get a "nicer" formatted return?

Hi, I am currently writing a perl module that will be passed queries from other scripts and use DBI to execute them on an Oracle Database. The problem I have is when it comes to the return. I am currently getting this from my code: FIELDA FIELDB FIELDC ... (6 Replies)
Discussion started by: chris01010
6 Replies

12. Shell Programming and Scripting

DBD::JDBC::db prepare failed: java.io.IOException: Unrecognized BER object identifier:

Hello, I am trying to write a perl script to access Solid LDAP database using JDBC. The script connects to the database but gives below error while running sql prepare command : try.pl connecting preparing................ DBD::JDBC::db prepare failed: java.io.IOException:... (0 Replies)
Discussion started by: PerlMonkey
0 Replies

13. Shell Programming and Scripting

Perl inserting random negative integer

Hi All, i have problem here whenever i run this perl script that is pasted here, it inserts a negative number in place of PO_nbr . What the script does is reads a pipe delimited file and then using some values on the file it will query db to get few other values and then it inserts the... (4 Replies)
Discussion started by: selvankj
4 Replies

14. Shell Programming and Scripting

Date-Manipulation-1

Hallo Team I can perform the task manually but i would like to automate this process. ok here goes. I have a perl script which runs every Wednesday every week and the name of the script is check_19.pl This is how the script looks like : #!/usr/bin/perl -w #use strict; use DBI; #... (1 Reply)
Discussion started by: kekanap
1 Replies

15. Shell Programming and Scripting

IP list specific port checker script

Hello again people, I currently searching for a code/script that will allow it to check if a specific port is open, lets say 123. Found a public script on a ftp but I dont know how and what to modify in it to suit my needs. (I think this is a evil code and I want to use it as an example). ... (3 Replies)
Discussion started by: galford
3 Replies