Programming :: How Error Handling Is Done In C

Jan 3, 2010

I wonder how error handling is done in C in real applications, by returning a error code when something goes wrong, or by using setjmp and longjmp, or something else?

View 10 Replies


ADVERTISEMENT

Programming :: Try/except Error Handling In Bash?

Jun 30, 2011

I found, in bash, something similar to 'try/except' in python. I've been using something like this:

Code:
if ! 'command';then
echo 'damn, there was an error'

[code]....

View 4 Replies View Related

Programming :: Bash SMB Script Error Handling

Jun 1, 2011

I have a script that connects to a windows server, downloads a file, appends to it and then re-uploads the updated file. I want to implement error handling. An email is to be generated indicating whether there was an error or not. This email should include all standard and error output as a body. The current script looks something like this:

Code:
function Email_ServerSupport {
for time in once; do
echo "Subject: Billing - smb copy to accounting" $1
cat /tmp/smbx
cat /tmp/smbxerr
done | mail $EMAILADDR
}

/usr/bin/cp /dev/null /tmp/smbx
/usr/bin/cp /dev/null /tmp/smbxerr
cd /tmp
/usr/sfw/bin/smbclient $LOCATION -A $AUTHFILE >>/tmp/smbx <<EOF
get $OUTFILE
exit
EOF
cat $INFILE >> $OUTFILE
/usr/sfw/bin/smbxclient $LOCATION -A $AUTHFILE >>/tmp/smbx <<EOF
put $OUTFILE

cat /tmp/smbx | grep -v "Domain" | grep -v "putting file" | grep -v "getting file" >> /tmp/smbxerr
if [ -s /tmp/smbxerr ]; then
Email_ServerSupport " ERROR"
exit
else
echo "Transfer successful."
Email_ServerSupport " SUCCESS"
fi

The reason for the grep -v's is because, from my understanding, when using smbclient, ALL output goes to stdout, even errors. For this reason, I need to filter out lines including "domain" "putting file" or "getting file", all of which aren't errors. The problem is that even though the script seems to catch errors successfully now and then, the success email ends up blank (/tmp/smbx is somehow empty). I'm also worried it could miss possible errors I haven't tested. I'm thinking it has to do with the way "EOF" functions. Is there any way to capture output from the "put" and "get" commands? I can't simply redirect the output, can I?

View 1 Replies View Related

Programming :: Perl Net- LDAP - Why Don't Work Any Error Handling

Nov 12, 2010

i have some perl codes for using ldap,but i don't know why don't work any error handling When i use msg->code for sample. an example:

[Code],,,,

In this case,if $msg->code return zero(or null) every thing work correctly but if it not zero don't give any message(eg."error result").What is problem?

View 1 Replies View Related

Programming :: C++: Getting And Handling Web Data?

Jan 29, 2010

I'm just starting out on a project relating to web search, to be done in C++. Which library should I use to help with downloading web pages into memory so that I can process them? The big thing is I want to be able to download the pages into variables/structures without actually putting them onto the hard disk.I googled and saw libcurl, but I was confused by some of the examples and wondering if this was really what I wanted.

View 2 Replies View Related

Programming :: Signal Handling In Pthread?

Mar 12, 2011

I have created a pthread, and installed a signal handler inside that, same way as we do in main( ) function. The thread's signal handler is a separate function. Surprisingly, it is not working, that is the thread's signal handler is not able to catch signals. Here is the code:

Code: #include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <signal.h>
typedef struct data

[Code]...

View 1 Replies View Related

Programming :: Exception Handling In Perl?

May 12, 2010

I writed Quote:

#!/usr/bin/perl -w
use Error qw(:try);
try {

[code]....

View 1 Replies View Related

Programming :: Ways Of Handling The ADT Interface?

Nov 30, 2010

During my read, "Code Complete",the author described the different ways of handling the ADT interface.He has wrote this passage:

Quote:

Option 2: Explicitly provide the data used by the ADT services. In this approach, you declare the data that the ADT uses within each routine that uses an ADT service. In other words, you create a Font data type that you pass to each of the ADT service routines. You must design the ADT service routines so that they use the Font data that's passed to them each time they're called. The client code doesn't need a font ID if you use this approach because it keeps track of the font data itself. (Even though the data is available directly from the Font data type, you should access it only with the ADT service routines.This is called keeping the structure "closed.") The advantage of this approach is that the ADT service routines don't have to look up font information based on a font ID. The disadvantage is that it exposes font data to the rest of the program, which increases the likelihood that client code will make use of the
ADT's implementation details that should have remained hidden within the ADT.

The problem is that it is a bit subtle in terms of coding for me. Can anybody give more concrete example, in working codes, especially in Java?

View 2 Replies View Related

Programming :: Libxml++ Enable Exception Handling

Oct 26, 2010

To parse several XML documents I'm using libxml++. I do programming for linux angstrom-armv5te. Because compiling libxml++ for this distribution and platform was impossible, I simply included the library to my project, which workes fine. Unfortunately I'm not able not use the exception handing which effects that a simple error inside a documents makes my whole program crash. This should not happen.

Is there a way to check the documents validity before parsing or better active the exception handling for doing this.

View 3 Replies View Related

Programming :: `find . -exec' Handling Backticks In Bash

May 15, 2011

i had a problem with the find command in bash (which i deem is close enough to a promming language, if not please move this thread :P). i tried to reduce the command to the problem. i want the backticks, or $() for that matter; to be evaluated by -exec of find, not by bash. is that a caveat of find?

Code:

$ find testd -exec echo `basename {}` ; #confused me
test
test/a
test/b

[code]...

edit: i found out whats causing this. `basename {}` gets evaluated by bash before find is invoked, returns {} and `find . -exec echo {} ;" is run. now my question is, how to escape this eveluation from happening before.

View 11 Replies View Related

Programming :: Bash: Handling Input From File And Keyboard?

Jan 20, 2009

I have this little shell script which copies file names taken from inputfile:

Code:
while read line; do
cp -i $line something

[code]...

View 4 Replies View Related

Ubuntu :: Mutt Not Handling Mailto: URLs / Getting Error?

Dec 10, 2010

Ubuntu Lucid amd64, mutt-1.5.20-7ubuntu1

I'm pretty sure the following used to work:

Code:
$ mutt mailto:url?subject="Whoop dee doo"
Now mutt exits silently with status=1. Tried setting EDITOR/VISUAL, no difference.

Edit: I had tempdir pointed at a non-existent directory in my .muttrc. Still annoying that there was no error message, but at least things are working again.

View 1 Replies View Related

Programming :: Bash Scripting Handling User Input Sections Automatically?

Jun 17, 2010

I have a system setup script for my Slackware installations that pulls all packages and source files from another machine and sets everything up to be identical between machines. The script works as expected but make it entirely unattended. How do I make the bash script deal with automatically selecting "Yes" for, for example "Install x(Yes/No): " when prompted by a make file?

View 3 Replies View Related

Ubuntu Installation :: Error: Exception Handling Disabled - Use Fexceptions To Enable

Sep 27, 2010

I want to compile ekiga 3.0.2 for ubuntu 10.04. But when I enter 'make' command in the terminal windows, it says that;

[Code]...

I tried to solve the problem by setting CFLAGS = -fexceptions, in the Makefile. But it didn't work.

View 1 Replies View Related

Programming :: Program Hang Stuck There Signal Handling On POSIX Message Queue UNIX C Pr

Jun 14, 2011

In a single main() function,so need signal handling. Use Posix Message Queue IPC mechanism , can ignore the priority and other linked list message,to implement the scenario:

View 1 Replies View Related

OpenSUSE :: K3b Incapable Of Handling M4a?

May 13, 2010

just noticed when I went to burn a cd (just got a new car and at the moment the stereo does't have a auxiliary port and I'm not about to use a shotty fm transmitter) that k3b spikes the cpu through the roof an freezes when I write/burn/convert a m4a media file... I'm using k3b version 1.91.0.

View 3 Replies View Related

General :: Commands For Logfile Handling?

Mar 28, 2011

I've got this log file and I need to get all sorts of information from it...

24 - [02/Sep/2010:00:01:16 +0200] - 10.1.53.62 - 200
23 - [02/Sep/2010:00:01:26 +0200] - 10.1.53.62 - 200
19 - [02/Sep/2010:00:01:56 +0200] - 10.1.53.62 - 200

[code]....

View 6 Replies View Related

Debian :: Iptables - Netfilter Queue Handling

Jul 17, 2015

I have created a nfq handler via nfq_open() and using the returned qhandle to bind my application program to a specific queue number that is configured in iptables. when i invoke nfq_create_queue() my program is stuck there and the back trace shows it is blocked in recvfrom()

bt

in recvfrom () from /lib/x86_64-linux-gnu/libpthread.so.0
in nfnl_recv () from /usr/lib/libnfnetlink.so.0
in nfnl_catch () from /usr/lib/libnfnetlink.so.0

View 0 Replies View Related

General :: Memory Handling Capacity Of 64 Bit Ubuntu?

Aug 3, 2010

What is the maximum amount of ddr that can be installed in a 64 bit ubuntu linux system computer?

View 1 Replies View Related

Ubuntu :: Is X11 Or GDM/KDM/XDM Handling The Login Screen In K/X - What About GDM2

Jun 7, 2010

I really have tried Googling this over many, many hours, and I still can't make sense of it all, especially since I keep reading conflicting info.

In 9.10, the Usplash boot splash was replaced by XSplash, which is based on X11, and when we all realised something was up with GDM (when we couldn't find a way to customise the login anymore), I read it was not GDM controlling that anymore, but X11. So, the way I read it (on many different sites), XSplash in 9.10 controlled both the boot splash and the login, even though the hacks for customising the login involve commands with "gdm" in them.

Now, in 10.04, the short-lived XSplash has been replaced by "Plymouth", and I get all that... as far as the boot splash goes. What I don't understand is the login process.

There is talk of GDM2 coming out, and I've seen people asking when this will be implemented in Ubuntu, but if the move is away from GDM altogether towards a boot/login process totally based on X11, will this happen?

More importantly, what is controlling the login now? Is it still GDM, or is it X11 that gdm commands work on or something? (The hacks people used in 9.10 still work in 10.04)

Also, because I have Xubuntu and Kubuntu in the same system, and have had things like KDM taking over login happen after upgrades, I have to ask what is controlling the boot process and login for Ubuntu's siblings? (To me they now look almost identical, so wonder if they're all X11 based)

View 2 Replies View Related

Ubuntu :: No Application Is Registered As Handling File?

Oct 20, 2010

I remember having the same problem with kde/Fedora a few years back, and I can't remember the solution. Trying to open any attachment in evolution gives the error "No application is registered as handling this file" and you have to save the attachment, and then open it as normal. I have checked all the file associations, and they are fine, and the same attachment in evolution under Gnome opens fine.

View 5 Replies View Related

Ubuntu :: Compile A Lib For Gpg Encryption For Handling Old Keys?

Aug 1, 2011

I have been using so far only 32bit ubuntu, but now for various reasons I have to change to 64bit I need to compile a lib for gpg encryption for handling old keys, namely .I have the idea.c file and had some instruction with which I was able to create the lib from it for the 32bit linux. The intruction was:

gcc -Wall -02 -shared -fPIC -o idea idea.c

this seems not to work under 64bit and the old lib does not work under 64bit either obviously. particularly the compiler tells me -02 option is unknown, does it matter? or what is -02 ?

View 3 Replies View Related

General :: Handling Wordbreaks In Bash Completion?

Feb 16, 2010

I am writing completion function for one PHP framework called symfony. It has command line interface with syntax:

Code:

symfony [options] [namespace:]action

I want to make action be autocompletable. The function is simplest so far:

Code:

function _symfony_commands()
{
[ -r "cache/completion/.sf" ] && cat cache/completion/.sf
}

[code]....

But, if there is : symbol which separate namespace from action problems coming:

symfony doct[TAB]
will be completed to
symfony doctrine:

But nothing happens if you want complete after : symbol. I've found out that for readline there is three words because it splits line with $COMP_WORDBREAKS

Code:

$ echo $COMP_WORDBREAKS
"'><=;|&(:

I played with $COMP_WORDS array and tried every thought I had to make it work, but failed.
What I should do to escape colon and make readline consider it as one word? Or there is way perhaps to workaround it?

View 2 Replies View Related

CentOS 5 :: Kernel Parameter Available For Interrupts Handling?

Sep 16, 2010

Is there any Kernel parameter available for interrupts handling, In the case of busy server how we can tune the kernel to handle interrupts effectively.

View 4 Replies View Related

General :: Mount - Filesystem Handling For Embedded Device?

Jan 21, 2011

I am developing a device that will run Linux as its operating system.The device is a small form factor X86 device with a flash drive exposed as a SATA-device. So it is not very dissimilar from any other PC running Linux.For several good reasons I am building my own "distribution", instead of using an existing one.What confuses me is how mount/umount of the root file system is handled.I boot my kernel with the commandline "root=/dev/sda1 rw" which works fine. But everytime I do poweroff or reboot Busybox complained about no /etc/fstab, so I decided to build one.Should I have an entry for my root file system? It seems like this is shadowed by the rootfs anyway. I.e. if I have the fstab entry "/dev/sda1 / ext2 1 1" mount still reports rootfs on / type rootfs (rw)/dev/root on / type ext2 (rw,relatime,errors=continue)My questions are:Do I need to worry? Will the drive be correctly unmounted by the kernel on poweroff/reboot?If I want to perform file system checking on boot, can I do that without resorting to an initrd?

View 1 Replies View Related

General :: Handling Network Plug / Unplug In (Debian)

Jun 15, 2011

I want to run a script when the switch goes down and an other when it goes up. Is there an easy way to pull this off in Debian (preferably with no other than system tools)? I suppose there is no difference (in the OS point of view) between unplugging ethernet cable and the switch losing power.

On an event I get lines like these in the syslog:
Jun 15 17:49:41 debian kernel: [ 5506.956130] igb: eth1 NIC Link is Down
...
Jun 15 17:49:45 debian kernel: [ 5511.168788] igb: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX

In FreeBSD you can pipe log messages (pre-filtered by regex patterns) to a program. What is the easiest way to replicate this on Debian (with as little additional software as possible)?

View 1 Replies View Related

General :: Debian - Server Does Not Appear To Be Handling Sessions Properly?

Jul 21, 2011

after installing Debian 6 on a server. When I try to install a software called ActiveCampaign, I get the following error ... "Your server does not appear to be handling sessions properly."I have install Apache, PHP, MySql and Perl already. Also, after the server restarts, I Webmin will not automatically start, even thou it is setup in the Webmin configuration to start with the server. I have to use /etc/init.d/webmin start from a command line after I su.

My last question is about ftp permissions. I have install proftpd and it seems to be working fine, but when I try to edit any file or upload, I can not. In order to upload and manipulate files, I am using WinSCP under root, wich is a big NO NO.Sorry for the three questions, but I figured I would ask all in one post, instead of creating multiple, since I already have your attention.

View 1 Replies View Related

Slackware :: Xfce LUKS Handling Randomly Fails?

May 24, 2010

Anyone else experiencing the random LUKS fails? Anyone know of a solution?I filed a bugBasically I have a USB hard drive with two LUKS partitions on it (sdb2, sdb3). When plugged in, it asks for the password in Xfce (like it did in Slackware 13.0), but instead of the previous "asks twice for password" bug, now it asks once, but nothing pops up on the desktop. It's rare to see either of them put an icon on the desktop (usually nothing results).

I see /dev/mapper/luks_crypto_{UUID} get populated, so they are successfully being unlocked (LUKS), but no icon appears, and no mount point for the volume label (i.e. /media/BACKUP /media/ASUS) is populated.Does anyone know how I could produce a more useful bug report? I'm wondering if "strace startxfce" would produce anything useful or if I should alias Thunar to "strace -o /tmp/thunar-`date`.txt" would be in order.

View 14 Replies View Related

Ubuntu Networking :: Firefox 5 And Ed2k System-wide Handling?

Jun 17, 2011

I'm trying to set up firefox system-wide to handle ed2k links properly, I'm following amule wiki howto at this page http://wiki.amule.org/index.php/Ed2k_links_handling but it seems a little outdated, I tried to create /usr/share/firefox/greprefs/all.js and /usr/local/share/firefox/greprefs/all.js but I got no results. I also tried to edit /usr/lib/xulrunner-1.9.2.17/greprefs/all.js with no luck. So where should I put ed2k handling strings to apply them system-wide ?

View 1 Replies View Related

Debian :: Handling Virtualisation And Finding Program(s) To Alternative To VMware?

Mar 13, 2009

I currently run a home sever using windows server 2008. On it I'm using VMware to run 2 virtual machines (currently running CentOS (which is Red Hat based) as web and mail servers. It's not a big setup, we only host our personal websites and a couple for some friends. Although server 2008 handles resouces much better than server 2003, it's still running windows, which as we know is far more inferior to a Linux server. I'm trying to convince the husband to let me run everything on Debian, but he wants to run it on Red Hat (which okay, isn't bad but our household is devided. We have long running arguments because he likes his boxes Red Hat based running KDE, and I like my Debian distros running Gnome!)

The host server is running on a standard pc box, it's got a 2.5 gigahertz dual core processor and 3 gig of ram, almost one TB storage. (don't ask why I'm including this drastically important info!) I want to run the entire network on Debian. So that would be the main host running Debian and the two virtual machines also. The host itself would need to run as a file and app server for our home network and the two vertuals as web and mail servers. (we run about 12 domains three of which are under heavy usage with Mysql databases, so we run two servers so we can dedicate more rescources to the virtual server that sucks the most juice.) I was wondering how Debian handles virtualisation and what program(s) would be a good alternative to VMware?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved