Hi all,
Does anyone know how to ammend the .cshrc file in $HOME for your session to display the path as part of the command line? So that I dont need to keep on typing pwd to see where I am?
thanks
Ocelot (2 Replies)
This is probably the dumbest question you guys can get, but I'm trying, as a complete noob, to display the unix calendar for all the months without Saturday and Sunday showing. How can I remove those fields without having to type all the fields in individually such as:
cal -y | awk '{print $2,... (3 Replies)
Hi All,
I am using the following piece of script to print all the array elements in a script by name compare.sh:
31 len=${#array
};
32 j=0;
33 #echo "The length of the array is : $len"
34 while ; do
35 temp=${array}
36 echo "$temp"
37 let $j++
38 done
But I am getting the... (2 Replies)
Hi
I really hope someone can help with the below question.
Lets say that I have a file called output.txt and I want to display all of the lines which contain the word ‘disconnect'. I know that this can easily be obtained by using the following command:
grep -i disconnect output.txt
However,... (6 Replies)
Within AWK, how do you display a field of NR? Here's my code:
awk '(NR>1) && (P1=$1-w)>=100000 {print "increase of" " " P1*.0000179," " "kW at" " " 'NR*60/431900' " " "minutes" "\n" "change from" " " 'NR-10($1)' " " "kW to" " " 'NR+70($1)' "\n"}{w=$1}' filename
I can change NR and print... (3 Replies)
Hello all
I have a query (SQL) that returns a rather long field from an Oracle database. The field in question is defined on 400 characters but all these 400 cannot be displayed by the echo command. Thus when I launch the following command:
echo "SELECT FIELD01 FROM TABLE_NAME;" | sqlplus -s... (9 Replies)
Discussion started by: S. BASU
9 Replies
LEARN ABOUT DEBIAN
dynarr
DYNARR(3pub) C Programmer's Manual DYNARR(3pub)NAME
dynarr, dynarr_init, dynarr_resize, dynarr_free - simple dynamic arrays
SYNOPSIS
#include <publib.h>
void dynarr_init(struct dynarr *da, size_t elsize);
int dynarr_resize(struct dynarr *da, size_t newsize);
void dynarr_free(struct dynarr *da);
DESCRIPTION
These functions make it easier to use dynamic arrays, i.e., arrays that are allocated with malloc(3) and resized with realloc(3). Below is
a typical code fragment for implementing a dynamic array that is resized as more input is read.
char *p, *line;
size_t alloc, len;
len = 0;
alloc = 1024;
if ((line = malloc(alloc)) == NULL) abort();
while (fgets(line + len, alloc-len, stdin) != NULL) {
len = strlen(line);
alloc += 1024;
if ((p = realloc(alloc)) == NULL) abort();
alloc = p;
}
(The error handling is intentionally simplified.) Below is the above fragment with the dynarr(3).
struct dynarr da;
dynarr_init(&da);
while (fgets((char *)da.data + da.used, da.alloc-da.len, stdin) != NULL) {
da.used = strlen(da.data);
if (dynarr_resize(&da, da.alloc + 1024) == -1) abort();
}
The code is a bit simpler, and all the memory allocation details and most of the error checking code is hidden away.
The dynamic array is represented by a struct dynarr:
struct dynarr {
void *data;
size_t alloc, used;
};
The interface to the dynamic allocation has intentionally been made unopaque.
dynarr_init initializes a struct dynarr to be an empty array, dynarr_resize sets its size to be newsize, and dynarr_free frees the array
(it will become an empty array again).
RETURNS
dynarr_resize returns -1 if it failed, 0 if it succeeded. It does not change the array in any way if it failed.
SEE ALSO publib(3), malloc(3), realloc(3), strdup(3)AUTHOR
Lars Wirzenius (lars.wirzenius@helsinki.fi)
Publib C Programmer's Manual DYNARR(3pub)