th_read(3) C Library Calls th_read(3)NAME
th_read, th_write - read and write a file header block from a tar archive
SYNOPSIS
#include <libtar.h>
int th_read(TAR *t);
int th_write(TAR *t);
VERSION
This man page documents version 1.2 of libtar.
DESCRIPTION
The th_read() function reads the next block from the tar archive associated with the TAR handle t. It then sets the current tar header
associated with t to the contents of the block read.
The th_write() function writes the contents of the current tar header associated with t to the tar archive associated with t.
RETURN VALUE
On successful completion, th_read() and th_write() will return 0. On failure, they will return -1 and set errno to an appropriate value.
On EOF, th_read() will return 1.
ERRORS
th_read() and th_write() will fail if:
EINVAL Less than T_BLOCKSIZE blocks were read or written.
SEE ALSO tar_block_read(3), tar_block_write(3)University of Illinois Jan 2001 th_read(3)
Check Out this Related Man Page
tar_append_file(3) C Library Calls tar_append_file(3)NAME
tar_append_file, tar_append_eof, tar_append_regfile - append data to tar archives
SYNOPSIS
#include <libtar.h>
int tar_append_file(TAR *t, char *realname, char *savename);
int tar_append_regfile(TAR *t, char *realname);
int tar_append_eof(TAR *t);
VERSION
This man page documents version 1.2 of libtar.
DESCRIPTION
The tar_append_file() function creates a tar file header block describing the file named by the realname argument, but with the encoded
filename of savename. It then sets the current header associated with the TAR handle t to the newly created header block, and writes this
block to the tar archive associated with t. If the file named by realname is a regular file (and is not encoded as a hard link),
tar_append_file() will call tar_append_regfile() to append the contents of the file.
The tar_append_regfile() function appends the contents of a regular file to the tar archive associated with t. Since this function is
called by tar_append_file(), it should only be necessary for applications that construct and write the tar file header on their own.
The tar_append_eof() function writes an EOF marker (two blocks of all zeros) to the tar file associated with t.
RETURN VALUES
On successful completion, these functions will return 0. On failure, they will return -1 and set errno to an appropriate value.
ERRORS
The tar_append_*() functions will fail if:
EINVAL Less than T_BLOCKSIZE bytes were written to the tar archive.
EINVAL Less than T_BLOCKSIZE bytes were read from the realname file.
They may also fail if any of the following functions fail: lstat(), malloc(), open(), read(), th_write(), or the write function for the
file type associated with the TAR handle t.
SEE ALSO read(2), open(2), lstat(2), th_write(3)University of Illinois Jan 2001 tar_append_file(3)
I've discovered a very annoying problem in sh:
echo -en "one\ntwo\nthree" | while read VALUE
do
echo "${VALUE}"
done This will print one and two, but not three. The last line is IGNORED because it lacks a newline. This makes it hard to use sh for things like CGI scripting; you have... (6 Replies)
Hello mates:
I met problem with using read() & write(). I m trying to use read twice on client first time is the size of buffer, 2nd time is the buffer. I think I have to, coz I dnot know file size. So, I write twice on server as well -- 1st, filesize; 2nd, buffer.
The problem is, sometimes,... (11 Replies)
Hi all,
I'm sure this is quite a simple problem, but i'm completely new to shell scripting, so bare with me. Having problems with the read command. Here's what I have:
read -rp "Command to execute: " the_command
...
...
echo "$the_command"
...
...
eval "$the_command"
Now, say, for... (8 Replies)
Hi Guys,
I am just trying to read data from a file.
The command i tried worked well with AIX server. But in SunOS, it is not reading.
cat log.out |sed -n '4,4p'| read value;
+ sed -n 4,4p
+ cat log.out
+ read value
echo $value;
+ echo
This is the log of running the script.
... (13 Replies)
Hi,
i have a properties file a.prop where entry is like
PROCESS_IDX=0
Now in my shell schript i am doing like this.
#!/bin/sh
. a.prop
..............
-.......................
while read line
do
# tokenize the string by ",".
var=(`echo $line | tr ',' ' '`)
echo $PROCESS_IDX -->... (6 Replies)
Hello,
if I try this (in bash):
#!/bin/bash
cat leercaracter.sh | while read linea
do
# read character by character
echo $linea | while read -n 1 caracter
do
echo $caracter
done
done
New lines, spaces, tabs aren't showed by echo.
How can I 'echo' those characters?... (7 Replies)
I have problem with C programming. I want to send & receive data through serial communication. I send data(command) to device to get data from device but when receive data, it can't get altogether of data.
It get only some data. What should I do to get altogether of data?
If all of... (7 Replies)
Hello folks;
I have a script uses wget to query a link to get the temperature from sensor then email the results to me.
Here's the script:
"wget -q http://server/temp -O - | mail -s "Temp Update" moe@ocd.com"
normally the output from using wget looks like this:
Lab_1|69.8 | ... (8 Replies)
Hi everybody, I am new to shell script. Please help me with this problem.
I have a file test.txt with the content like this:
I have a shell script test.sh like this
#!/bin/sh
while read line
do
echo $line >> out.txt
done < test.txt
out.txt is expected to have the same content... (10 Replies)
I am trying to read a host name one at a time from a file which has a list of hostnames and do rsh and print . its not looping through the entire file. its breaking out after the first entry. If i comment out the rsh then it loops through file
#!/bin/ksh
filename="/tmp/hostnames";
while read -r... (11 Replies)
Hi Guys,
Happy New Year to you all!
I have a requirement to read an embedded new-line using KSH's read builtin.
Here is what I am trying to do:
run_sql "select guestid, address, email from guest" | while read id addr email
do
## Biz logic goes here
done
I can take care of any... (6 Replies)
Hi,
I was writing a script to accept input using read. When I put !#/usr/bin/ksh in the beginning of the script, it accepts only 258 characters. And I remove it, it accepts more. I'm wondering what the difference is.
Thanks in advance, (7 Replies)
hi, I've a problem on my C/C++ program with Posix Library.
I have to read data from the serial but I have incorrect data, in fact I get a bunch of zeros:
"2953.3174, 2785.2126, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0 , 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ,... (24 Replies)
Hello All,
im a newbie in scripting and i need some help
i need a script for reading some files into varibles.
Background
i want to do an
scp localmaschine/localpath/$nameoffile.xml user@server:/path/$nameoffile/*/$nameoffile.xml
i got 20 - 30 files with diferent names i cant... (8 Replies)
Hello,
I am running under ubuntu 14.04.
I have a python file bringing requested data. When I run, it asks me to enter query info. After that, it gives the data if anything matched can be found.
What I need to accomplish is, instead of entering the requested data from keyboard, to put all... (11 Replies)