Programming :: Libxml2: Removing Output On Stdout/stderr - Element CA Does Not Carry Attribute Maxlength

Jul 26, 2010

I'm using libxml2 to handle/manipulate some XML files. In order to check the consistency of a XML file, I have a DTD and I'm using the xmlValidateDtd method to compute the check.

However, when an error occures during the check (for example an attribute is missing in a XML tag), then libxml2 writes the error on the stdout/stderr. For exemple:

Code:

/home/XML/FreeFour.xml:18: element CA: validity error : Element CA does not carry attribute maxlength

The method return the right result (true or false depending on the check result), but occurring errors are written on the stdout/stderr, and I actually don't want that.

View 4 Replies


ADVERTISEMENT

Software :: Bash Output Stderr To 2 Files And Stdout?

Apr 5, 2011

I want to output the stdout and stderr in a logfile,moreover i do want to log stderr also to a separate logfile, and print str to the screen I searched arround and tried:

Code:

$ command 2>&1 > log | tee -a log log.err

But then in log first the stdout appears, and then stderr.

View 1 Replies View Related

General :: Script To Output Both The Stderr And Stdout To The Same Text File?

Aug 5, 2011

Am having issues getting the output from a script to be logged in a file. I need the script to output both the stderr and stdout to the same text file.

At present I have the following script:

Code:
#!/bin/bash
echo TR3_1 > printers.txt
snmpget -v 1 -c public 10.168.**.* SNMPv2-SMI::mib-2.43.10.2.1.4.1.1 &>> printers.txt

[Code].....

View 4 Replies View Related

Programming :: Cannot Redirect All Stdout And Stderr Into File

May 12, 2009

I have a little complex Makefile system. A parent Makefile call dozens of Makefiles in subdirctories. And the subdirctory Makefile calles shell script to do real building. I want to grab all output this Makefile system generate. So, i employ "make 2>&1 > make.log". but not all output messages are filed into make.log. The message generated by sub-makefile called shell script cannot be recorded into make.log. And another curiouse thing is, if i launch "make 2>&1 > make.log" in a perl script, all output do be sent into make.log.

View 2 Replies View Related

Programming :: Redirecting Stdin / Stdout And Stderr For Program Run As Fork()/execl()?

Nov 24, 2010

I'm trying to write a program that will fork a series of FTP sessions. For each session, there should be separate input and output files associated with stdin and stdout/stderr.
I keep reading how I should be able to do that with dup2() in the child process before the execl(), but it's not working for me. Could someone please explain what I've done wrong? The program also has a 30-second sniper alarm for testing and killing of FTPs that go dormant for too long.

The code: (ftpmon.c)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

[code]....

The output:

$ ftpmon
Connected to gila-crstest.gilacorp.com (172.16.20.8).
220 (vsFTPd 2.0.1)
ftp> waitpid(): Interrupted system call

Why am I getting the ftp> prompt? If the dup2() works, shouldn't it be taking input from my script and not my terminal? In stead, it does nothing, and winds up getting killed after 30 seconds. The log file is created, but it's empty after the run.

View 3 Replies View Related

Programming :: Redirecting Stdin / Stdout And Stderr And Finding Files Name And Other Stats?

Aug 8, 2010

I'm working on an application used for backup/archiving. That can be archiving contents on block devices, tapes, as well as regular files. The application stores data in hard packed low redundancy heaps with multiple indexes pointing out uniquely stored, (shared), fractions in the heap.

And the application supports taking and reverting to snapshot of total storage on several computers running different OS, as well as simply taking on archiving of single files. It uses hamming code diversity to defeat the disk rot, instead of using raid arrays which has proven to become pretty much useless when the arrays climb over some terabytes in size. It is intended to be a distributed CMS (content management system) for a diversity of platforms, with focus on secure storage/archiving. i have a unix shell tool that acts like gzip, cat, dd etc in being able to pipe data between applications.

Example:

dd if=/dev/sda bs=1b | gzip -cq > my.sda.raw.gz

the tool can handle different files in a struct array, like:

Code:

enum FilesOpenStatusValue {
FileIsClosed = 0,
FileIsOpen,

[code]....

Is there a better way of getting the file name of the redirected file, (respecting the fact that there may not always exist such a thing as a file name for a redirection pipe).
Should i work with inodes instead, and then take a completely different approach when porting to non-unix platforms? Why isn't there a system call like get_filename(stdin); ?

If you have any input on this, or some questions, then please don't hesitate to post in this thread. To add some offtopic to the thread - Here is a performance tip: When doing data shuffling on streams one should avoid just using some arbitrary record length, (like 512 bytes). Use stat() to get the recommended block size in stat.st_blksize and use copy buffers of that size to get optimal throughput in your programs.

View 4 Replies View Related

Programming :: Redirecting Stdout To File And Terminal And Stderr To File?

Apr 20, 2010

I have a script where I want to redirect stdout to the terminal and also to a log file aswell as redirecting stderr to the same log file but not the terminal.I have the following code which I found on the net which redirects both stderr and stdout to a file and the logfile,

Code: if [ -p $PIPE1 ]
then
rm $PIPE1

[code]...

View 3 Replies View Related

Software :: Get Stderr And Stdout Of A Program Into Separate Env Variables?

May 19, 2010

Code:

MY_STDOUT=`my-command`
MY_STDERR=`my-command >&2`

That is, i want to have to run my-command only once and get the same result. I've tried this:

Code:

YYY=$(XXX=`{ echo -n 111; echo 222 >&2; }` 2>&1); echo $XXX $YYY

where "{ echo -n 111; echo 222 >&2; }" is my-command. But it gives this output:

Code:

222
111

instead of "111 222". What's wrong in my script?

View 2 Replies View Related

General :: Redirect Stdout/stderr Of Multiple Commands In One Shot?

Jun 3, 2011

I have several commands in a bash script, and in the middle of the script there are several commands whose output and error streams I want to redirect to a file. I think I could simply add '>> myfile.txt' to the end of every command, but is there a way to set it before that block of commands, then reset the streams to their original state at the end of that block?

View 1 Replies View Related

Programming :: Pipe Output To 2 Files But Not STDOUT?

Mar 24, 2011

I want to have the output of a program go to 2 different files but not going to standard out. Is there a way to do this in bash? I know that in Z shell its really easy. omething like: Code: echo "test" >> file1 >> file2 Would work. But in Bash it doesn't seem that easy. I know that tee will send the output to 2 files but it also sends it to STDOUT.Something like:Code: echo "test" | tee -a file1 file2 Would put the word "test" in file1, file2, and STDOUT. Is there a way to just send the output to file1 and file2?

View 2 Replies View Related

Debian Programming :: Stdout Piped To Awk -> Terminal Output Stutters

May 5, 2013

I'm piping stdout from mplayer to awk, but the output stutters.

Code: Select allmplayer audiofile.m4a 2>&1 | awk -vRS="
" '$1 ~ /A:/ {print $0; fflush();}'

Instead of a steady output of lines to the terminal, output only occurs after a few seconds, between 6 or 12. This happens whether the input is from mplayer or avconv/ffmpeg. This never used to happen (a few years ago) so I wondered whether an awk update caused this to happen.

View 6 Replies View Related

Programming :: Expect: Prevent Output From Spawned Process To Appear On Stdout?

Jul 3, 2009

I have this expect process:

Code:
spawn -noecho telnet my.host.com
expect {

[code]...

View 3 Replies View Related

Programming :: Modify 1 Of My Ldap Attribute If Have 2 Same Attribute Under 1 Entry ?

Jan 26, 2011

Assume, I have the below LDAP entry

Code:

Which command should I use programmatically (in ldap.h) to change only ONE of the attributes above? say i only want to change the userPassword from value secret -> notasecret

Do we use?

Code:

And how?

View 1 Replies View Related

General :: Redirecting Output From Stderr?

Dec 1, 2010

I have seen a post where someone was explaining the virtuality of stdout and stderr and that it can be redirected with e.g. 2>file.txt but this apparently is not working for me!
I have a CUPS filter with fprintf(stderr,...)

View 5 Replies View Related

Programming :: Bash Output With Timestamp Removing Duplicates

Nov 20, 2010

I'm writing a bash script to auto run on boot in Tinycore.

This is a watered down version.

Code:

I need it to either not add the time stamp if the awk finds a duplicate or write over the time with the new time if awk finds a duplicate.

BTW this is all pretty much cut-and-paste scripting so please feel free to comment if you know a more elegant way.

View 3 Replies View Related

Software :: Qt Creater 4 - C++ & Stderr - Use QDebug() To Print Out Stderr Messages?

Jul 27, 2010

Can I use qDebug() to print out stderr messages? If I just use qDebug() << stderr; I get hex output.

View 1 Replies View Related

Programming :: Http Authentication With Libxml2

May 29, 2011

I'm trying to add HTTP authentication to my app (it's a rss reader). As the app is in written in C and uses Libxml2, I've been searching in Libxml2 doc, but it seems it's not possible. Maybe someone could point me to a link to relevant info about how I could achieve that?

View 6 Replies View Related

Programming :: Libxml2 : XmlFreeTextReader Crashes

Feb 22, 2011

I am using libxml2 (libxml2-2.7.6-1.fc10.x86_64 ) I get crash when I call xmlFreeTextReader after the XMl file is processed. Following is the sample code that I am using:

[Code]...

View 10 Replies View Related

Programming :: Use Libxml2 On MinGW - XmlFree Crashes

Oct 22, 2010

libxml2 works fine on Linux machines. On Windows, the distribution at [URL] is built for the Microsoft C compiler/linker. The tools pexport and dlltool supplied with MinGW work fine to enable linking to these libraries EXCEPT for static data within the DLL. libxml2 is written so that calls to xmlFree, xmlMalloc and xmlRealloc dispatch through static variables in the DLL - the actual function has another name. BUT, the link library that dlltool builds has its own .globl variable that never gets initialized, and calls to xmlFree(whoever) wind up at location 0.

SOLUTION: AFTER an initial call to xmlParseFile() or some other xml function that initializes the DLL's variables, add the line:

if(!xmlFree) xmlMemGet(&xmlFree,&xmlMalloc,&xmlRealloc,NULL) This will initialize the application's static pointers to the dll's routines. (The NULL pointer would return the address of xmlStrdup, but it's a function already, not a variable <???> so it works anyway).This solution is portable - if you run on a Linux machine where the pointers are properly initialized already, it won't hurt anything.

View 4 Replies View Related

Programming :: Arrays In The C Programming Language Are Pointers To The First Element Of The Array?

Mar 27, 2010

I wonder why arrays in the C programming language are pointers to the first element of the array, not the first element of the array itself?

View 14 Replies View Related

Fedora :: Update - Attribute Error Object Has No Attribute 'rsplit'

Aug 30, 2009

Recently installed Fedora 11 from CD on eeepc900HA. Update manager suggested 402 updates available. trying to update I get the following traceback error report:

Traceback (most recent call last):

On trying this process a second time after having selected specific packages I noticed that a prepare machine for upgrade package (not selected by me) seemed to be where the process stalled.

Trying a third time with attempt to upgrade some (random) python packages I get the same result via a system/admin/upgrade or download software .

View 3 Replies View Related

Programming :: Select The 3rd Element Of A Drop Down List?

Feb 9, 2011

I'm trying to make a very small script with greasemonkey to do some automatic things when a page loads. The first thing I need to do is to click on a link. I've done that. Then I need to select the 3rd element of a drop down list that appears a few moments (depending on the connection) after the link is pressed, without reloading the page (ajax or something like that). This I can't get to work, The select has no id or class, but I can get its xpath value. There is only one select on the page. I've tried both setTimeOut and the DOMNodeInserted event with no effect.

Code:
// ==UserScript==
// @name test
// @namespace "www.google.com"
// @include www.mywebpage.com
// ==/UserScript==

[Code]....

View 11 Replies View Related

Programming :: Makefile Index Of List Element?

Apr 5, 2011

So I have been trying for 8 hours to try to get the index of an element from a list in a Makefile. The problem is that after I get the index using all the methods I have tried, the index cant be used in the "word" function:

for instance:
$(OUTPUT2) : INDEX = $(shell echo $(OUTPUT2) | sed -r -e "s/[ ]+/
/g" | grep -n $@ | sed 's/^([0-9]*):.*/1/')

will create a variable INDEX defined specifically for each member of OUTPUT2, so that each output knows its index. Unfortunately, when I pass this $(INDEX) into word, it doesn't work:

$(OUTPUT2) : $(word $(INDEX), $(INPUT1)) $(word $(INDEX), $(INPUT2))
echo $(INAME) $(TMPBASE) $@
and I get the error:
Makefile:16: *** non-numeric first argument to `word' function: 'num'. Stop.

I feel like if I could just convert a string to a Makefile acceptable number this would just work....

View 6 Replies View Related

Programming :: Using Stdout For More Than One Task?

Jun 30, 2009

I want to parse my mail log file and reuse the results but I'm having a hard time structuring the syntax. Something like:

Code:

grep hostname /var/log/mail.log |
grep NOQUEUE: |
sed -e 's/hostname postfix/smtpd/[[0-9]*]: //g'

at this point I want to redirect what I have in hand to a file but also ... fork? or split? whatever the term, to continue onward so that I can pipe the results further into wc -l or sort or programX. without having to re-loop through that huge log file.

View 2 Replies View Related

Programming :: Count Occurrency Of Each Array Element - Perl?

May 10, 2010

Exist it a perl function to count how much each array element is into array?

View 14 Replies View Related

Programming :: Initialize Ksh Array When First Element Includes Hyphen?

Jul 19, 2011

I'm trying to create an array with variable including hyphenbut ksh refuses the first element

set -A allArgs
set +A allArgs ${allArgs[@]} -all
set +A allArgs ${allArgs[@]} -date

[code]...

View 5 Replies View Related

Programming :: Blacklist End Up In File And $a End Up In Stdout?

Jan 22, 2010

In this example, why does blacklist end up in the file blacklist and $a end up in stdout?

[code]...

The desired result is to have a file containing the results of lsmod which had the first word on the line beginning with snd_ copied into another file preceded by the word blacklist.

View 4 Replies View Related

Programming :: POSIX__Philosophers At Dinner: Error: Initializer Element Is Not Constant

Jun 23, 2010

I changed my post because I found that solution, and didn't want to bother for that. But, since I didnt find a way to delete the post, I thought of updating it: I am beginning to write the code for the philosophers problem. As you know, they can eat, think or wait for forks. When they have 2 forks, one by each side, they eat. Then they set the 2 forks as available, and think.

Each philosopher is a thread. My problem is that it gives segmentation fault, somehow, when I try to initialize. The thing I really don't understand, is why it sometimes gives segmentation fault on initialization #0!!! (But generally on initialization #1) I have set 5 initializations in total, defined by N, that is also the number of threads I'm working on.

PHP Code: #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<pthread.h>
#include<errno.h>
#include <time.h>
#define N 5
[Code]....

View 1 Replies View Related

Programming :: Capture The Stdout Of A Heredoc In A Variable?

Aug 12, 2010

Why doesn't this work?

Code:
cat | myvar=$(</dev/stdin) <<EOS
This is some content
EOS
echo "$myvar"

i have also tried several variants of cat in place of the redirection.

Code:
$(cat -)
$(cat)
$(cat /dev/stdin)

None of the variants print "This is some content"

I have a version that works:

Code:
myvar=$(cat <<EOS
This is some content
EOS
)
echo "$myvar"

but i don't like the syntax and it doesn't play nice in my editor with code folding.

View 5 Replies View Related

Programming :: Perl Beginner - Can't Get PerlMagick To Read Filename From Array Element?

Aug 21, 2010

it's been a while since I logged on here! I've been trying my hand at a little perl and have hit a brick wall.I'm using the Imagemagick module to manipulate some images. I can get the following to work without issue:

Code:
$teampath = "/var/www/team1";
$player=Image::Magick->new;

[code]...

View 1 Replies View Related







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