The shell runs c programs, not c functions. For example in the korn shell you could:
x=$(date)
But date is a complete program. It decodes any arguments passed to it. And it writes its output to stdout. You need to write a program that does all of these things as well. On HP-UX, cc is an old compiler. But here is code that will work with it that does what you want...
Sometimes, with larger projects, you will want to compile a function separately. You can use the -c flag to do this. But that's not what you want here.
And finally, with ksh-92, it is possible to write a c function and dynamically load it into the ksh executable and then invoke it from ksh. But you are probably using ksh-88 which comes standard with HP-UX. HP-UX does have /usr/dt/bin/dtksh which is a heavily extended version of ksh-92. But extending it further with user-written functions might be a bit much for you until you get some more c experience.
IE:
find / -type f -exec grep email@host {} /dev/null \;
or
find /home/domains/*/ -type d -exec chmod 777 {} \;
is the {} \; part of the -type funciton?
this is what i understand about the following commands.
1) start the find at the root dir.
a) only looking for flatfiles
b)... (4 Replies)
Discussion started by: Optimus_P
4 Replies
2. Post Here to Contact Site Administrators and Moderators
Neo,
eariler today i had tossed up a post then realized i didnt want it up so i tried to delete it and it wouldnt let me. is this a functionality that you have active? To allow a user to delete any topic they started would be a great thing, i think it will also help on not haveing double posts... (2 Replies)
Hi
I have a server SCO_SV mantrak 3.2 5.0.5 i386
and i use a terminal emulator called Kea 420 term !
when i log in to the session i am unable to use the funtions keys
then i reset the server and works fine just some minutes
any comment ?
i really apreciate your help
regards... (1 Reply)
Here are some desirable properties for cryptographic hash functions:
These properties below are generally considered prerequisites:
* Preimage resistant: given h it should be hard to find any m such that h = hash(m).
* Second preimage resistant: given an input m1, it should be hard... (1 Reply)
Hello everybody,
I have a small opensource project http://hpaftpd.sourceforge.net (single-threaded ftp-server). It tested with FreeBSD and Linux. Can anybody try it with another UNIX system ? I'm interesting about HP/UX and Solaris. I would very much appreciate receiving any results about it.
... (2 Replies)
Hi-
Here is the shell script that for some reason is not returning results:
#! /bin/ksh -
avg() {
AVG=0
typeset SUM=0
if
then
echo "You must have at least two numbers"
else
for NUM in "$*"
do
... (2 Replies)
I have just installed OpenBSD on a 333MHz PPC iMac G3. It has a 6GB HDD that has been partitioned as 1GB MacOS 8.5.1, 3GB MacOS X 10.3.9, 2GB OpenBSD 4.8. I now need to install a bootloader so that my computer can recognize the OpenBSD partition at startup. I have been trying to install... (0 Replies)
Hi,
I have this output:
$ type msq
msq is a function
I thought it an alias, can you tell me how to I can find this function and where ?
Thanks for help. I'm on RH and HP-UX
Best
T
Continued here (0 Replies)
Hello All,
I have code as follows :-
while true do
{opening a case1 statement}
1)
{opening another case2 statement}
{closing case 2}
2)
Showing error for "2)" as Syntax error at line 59 : `)' is not expected.
*)
{closing case 1}
... (5 Replies)
Hello
Current working script is :
#
# my_script BEGIN
#
function a_function {
FIRST_PARAM="$1"
DO_SOMETHING "$FIRST_PARAM"
}
export -f a_function
START_HERE="/home/some_user/Documents"
find $START_HERE" -exec bash -c 'a_function "$0" ' {} \; (5 Replies)
Discussion started by: jcdole
5 Replies
LEARN ABOUT LINUX
bswap_32
BSWAP(3) Linux Programmer's Manual BSWAP(3)NAME
bswap_16, bswap_32, bswap_64 - reverse order of bytes
SYNOPSIS
#include <byteswap.h>
bswap_16(x);
bswap_32(x);
bswap_64(x);
DESCRIPTION
These macros return a value in which the order of the bytes in their 2-, 4-, or 8-byte arguments is reversed.
RETURN VALUE
These macros return the value of their argument with the bytes reversed.
ERRORS
These macros always succeed.
CONFORMING TO
These macros are GNU extensions.
EXAMPLE
The program below swaps the bytes of the 8-byte integer supplied as its command-line argument. The following shell session demonstrates
the use of the program:
$ ./a.out 0x0123456789abcdef
0x123456789abcdef ==> 0xefcdab8967452301
Program source
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <inttypes.h>
#include <byteswap.h>
int
main(int argc, char *argv[])
{
uint64_t x;
if (argc != 2) {
fprintf(stderr, "Usage: %s <num>
", argv[0]);
exit(EXIT_FAILURE);
}
x = strtoul(argv[1], NULL, 0);
printf("0x%" PRIx64 " ==> 0x%" PRIx64 "
", x, bswap_64(x));
exit(EXIT_SUCCESS);
}
SEE ALSO byteorder(3), endian(3)Linux 2019-03-06 BSWAP(3)