i have to make a menu based program to allow iusers to select the system information about their machine that they want. All i have been taught is how to enter commands at the command prompt like simple commands such as pwd and cd directory to change directory (not even sure if that is right). But... (1 Reply)
Several months ago I found a link that explained the difference between how a Unix Systems Admin would do scripting compared to what a Unix Programmer would do.
It showed a basic script and then show several iterations that explained how the Systems Admin would change it to make it better. I was... (0 Replies)
Hi all,
I know the basics of C programming, but I dont know a single thing about how to write, compile and run C code in UNIX, also where liberaris are stored, how .headers files are being managed in unix, how to debug c code and what are the available GNU tools for c programming in linux env,... (6 Replies)
Hello,
I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
I have started reading the book Unix Network Programming, Volume 1: The Sockets Networking API. I downloaded all the source code and the readme says I must make the files.
zuro@zuro:~/book/unpv12e$ cd lib
zuro@zuro:~/book/unpv12e/lib$ make
gcc -g -O2 -D_REENTRANT -Wall -c -o... (5 Replies)
I have started reading the book Unix Network Programming, Volume 1: The Sockets Networking API. I downloaded all the source code and performed all the steps present in README file.Now when i compile my first program it give the following error.
sainandan@nandan:~/unpv13e/intro$ ./daytimetcpcli... (1 Reply)
Let's say I have a file written in C programming
...
int
function A (Param1, Param2)
{
....
}
How to grep this function?
I tried grep -ER '^functionA(.*)/n{' filename > result.txt
Not work :mad:
Please use CODE tags on all sample input, output, and code segments; not just on shell... (4 Replies)
Discussion started by: cmdcmd
4 Replies
LEARN ABOUT DEBIAN
plan9-hoc
HOC(1) General Commands Manual HOC(1)NAME
hoc - interactive floating point language
SYNOPSIS
hoc [ file ... ] [ -e expression ]
DESCRIPTION
Hoc interprets a simple language for floating point arithmetic, at about the level of BASIC, with C-like syntax and functions.
The named files are read and interpreted in order. If no file is given or if file is hoc interprets the standard input. The -e option
allows input to hoc to be specified on the command line, to be treated as if it appeared in a file.
Hoc input consists of expressions and statements. Expressions are evaluated and their results printed. Statements, typically assignments
and function or procedure definitions, produce no output unless they explicitly call print.
Variable names have the usual syntax, including the name by itself contains the value of the last expression evaluated. The variables E,
PI, PHI, GAMMA and DEG are predefined; the last is 59.25..., degrees per radian.
Expressions are formed with these C-like operators, listed by decreasing precedence.
^ exponentiation
! - ++ --
* / %
+ -
> >= < <= == !=
&&
||
= += -= *= /= %=
Built in functions are abs, acos, asin, atan (one argument), cos, cosh, exp, int, log, log10, sin, sinh, sqrt, tan, and tanh. The function
read(x) reads a value into the variable x and returns 0 at EOF; the statement print prints a list of expressions that may include string
constants such as "hello
".
Control flow statements are if-else, while, and for, with braces for grouping. Newline ends a statement. Backslash-newline is equivalent
to a space.
Functions and procedures are introduced by the words func and proc; return is used to return with a value from a function.
EXAMPLES
func gcd(a, b) {
temp = abs(a) % abs(b)
if(temp == 0) return abs(b)
return gcd(b, temp)
}
for(i=1; i<12; i++) print gcd(i,12)
SOURCE
/src/cmd/hoc
SEE ALSO bc(1), dc(1)
B. W. Kernighan and R. Pike, The Unix Programming Environment, Prentice-Hall, 1984
BUGS
Error recovery is imperfect within function and procedure definitions.
HOC(1)