You may have to count your way along the array with two pointers. A source address and a target address for a replacement array. The source address gets incremented each time through a loop to copy an element from one to the other, but within the loop there would be an extra increment to the target address and an insert of the zero in the position you want. Something like this may assist:-
I hope that this helps. It may well not be the most efficient way, but it depends how big an array you have and how many times you will run this.
All,
I would like to add the first 10 elements of an array. Here is how I am doing it now (only included first few add ops):
#!/usr/bin/ksh
###Grab the array values out of a file###
TOTAL=`awk '/time/' /tmp/file.out | awk '{print $4}'`
set -A times $TOTAL
SUM=$((${times} + times... (3 Replies)
I need to remove an element from the below array variable TABLENAME.
#!/bin/ksh
set -A TABLENAME "mirf roxar keke mirs"
echo "the array is ${TABLENAME}"
If i need to remove say keke and have the final TABLENAME as below, how this could be achieved. Pls throw some light.
echo "Modified... (3 Replies)
Hi
I'm trying to create an array with variable including hyphen
but ksh refuses the first element
set -A allArgs
set +A allArgs ${allArgs} -all
set +A allArgs ${allArgs} -date
set +A allArgs ${allArgs} test
./test.ksh: -all: bad option(s)
It happens only when first element is like... (4 Replies)
set -A matched #find referenced files.
for i in ${file_names_html}
do
counter_j=0
for j in ${file_names_minus_index}
do
match=`cat $i | grep... (1 Reply)
Hi,
I have:
# Initialize variables
#!/usr/bin/ksh
FILENM=$1
INDEX=0
# read filename
echo "You are working with the Config file: $FILENM"
while read line
do
echo $line
data=$line
((INDEX=INDEX+1))
done <"$FILENM" (3 Replies)
Hello to all,
I'm trying to separate the string "str" using a regex within match function.
The substrings that I want to separate, begin with 22, 23, 24 or 25 and followed by 12 or 14 characters. And I want to
replace 22 with MJS, 23 with UYT, 24 with WER and 25 with PIL.
For this string... (4 Replies)
Hi, I have an ksh array(ARR). the elements to the array are file names. i need to go to each file in the array and manipulate the records.
for name in ${files}; do ---this loop is for all the file names in the array
for i in $(wc -l < $name); do --this loop is for all the records in... (20 Replies)
This question is for someone that's more familiar with Array Element.
I need to know if the maximum array element that can be assigned is 1024 and if its so, Is there a workaround solution when the counter exceeded 1024?
param_array="$param_nam"
counter=$counter+1
#to avoid space... (3 Replies)
Hi Team,
I have a CSV file which I have to read through and needs to insert the content within an XML file using Python ONLY ( as most of the code base we have in python only). I managed to find the first part, missing how to insert to XML under "specific" tags.
cat input.csv... (0 Replies)
Discussion started by: panyam
0 Replies
LEARN ABOUT SUNOS
ddi_device_copy
ddi_device_copy(9F) Kernel Functions for Drivers ddi_device_copy(9F)NAME
ddi_device_copy - copy data from one device register to another device register
SYNOPSIS
#include <sys/ddi.h>
#include <sys/sunddi.h>
int ddi_device_copy(ddi_acc_handle_t src_handle, caddr_t src_addr, ssize_t src_advcnt, ddi_acc_handle_t dest_handle, caddr_t dest_addr,
ssize_t dest_advcnt, size_t bytecount, uint_t dev_datasz);
INTERFACE LEVEL
Solaris DDI specific (Solaris DDI).
PARAMETERS
src_handle The data access handle of the source device.
src_addr Base data source address.
src_advcnt Number of dev_datasz units to advance on every access.
dest_handle The data access handle of the destination device.
dest_addr Base data destination address.
dest_advcnt Number of dev_datasz units to advance on every access.
bytecount Number of bytes to transfer.
dev_datasz The size of each data word. Possible values are defined as: "15">DDI_DATA_SZ01_ACC 1 byte data size
DDI_DATA_SZ02_ACC 2 bytes data size
DDI_DATA_SZ04_ACC 4 bytes data size
DDI_DATA_SZ08_ACC 8 bytes data size
DESCRIPTION
ddi_device_copy() copies bytecount bytes from the source address, src_addr, to the destination address, dest_addr. The attributes
encoded in the access handles, src_handle and dest_handle, govern how data is actually copied from the source to the destination. Only
matching data sizes between the source and destination are supported.
Data will automatically be translated to maintain a consistent view between the source and the destination. The translation may involve
byte-swapping if the source and the destination devices have incompatible endian characteristics.
The src_advcnt and dest_advcnt arguments specifies the number of dev_datasz units to advance with each access to the device addresses. A
value of 0 will use the same source and destination device address on every access. A positive value increments the corresponding device
address by certain number of data size units in the next access. On the other hand, a negative value decrements the device address.
The dev_datasz argument determines the size of the data word on each access. The data size must be the same between the source and destina-
tion.
RETURN VALUES
ddi_device_copy() returns:
DDI_SUCCESS Successfully transferred the data.
DDI_FAILURE The byte count is not a multiple dev_datasz.
CONTEXT
ddi_device_copy() can be called from user, kernel, or interrupt context.
SEE ALSO ddi_regs_map_free(9F), ddi_regs_map_setup(9F)
Writing Device Drivers
SunOS 5.10 15 Nov 1996 ddi_device_copy(9F)