I want to get the screen width and cursor positions.
When I used curses, all the screen content was cleared.
So Can I use curses to get the screen size without clearing anything in the window?
Or is there any other alternative???
I can use only C or C++. (0 Replies)
Hi,
Pleae help me on this. Normally, when we say read username, the cursor will come in the first position of next line, but I want the output of the below
Normal usage
-------------
please enter username:
_
I want like the below
----------------------
please enter username:
... (2 Replies)
Hi to all!
I'm a teacher of maths and physics in an italian high school in Milan, Italy.
I need a simple program that read the position of mouse cursor in function of time and write the coordinates in a text file. The time resolution have to be something like 1/10 sec or better (I have to know... (2 Replies)
hi all,
am trying to modify a ksh script to group server names together depending on the cluster they sit in. currently the script does a
find . -name '*.pid'
to find all running servers and prints out their pids and names.
current output looks something like this :
serverA ... (1 Reply)
I need to get the cursor position, and put it inside a variable. Problem is, i don't have the tput command, or ncurses.
Apparently I was supposed to try the following:
echo -e '\E
But I don't get a value or anything. Please help. (3 Replies)
Hi there.
It's easier to explain this with a pseudo code, I hope this makes sense:
var1=hello
echo $var1
some kind of loop
echo loop counter
done
How do I hold the cursor position immediately behind the last output so I'd get something like:
hello123456789
DOS used to use ","... (5 Replies)
Discussion started by: MuntyScrunt
5 Replies
LEARN ABOUT MINIX
upscli_get
UPSCLI_GET(3) NUT Manual UPSCLI_GET(3)NAME
upscli_get - retrieve data from a UPS
SYNOPSIS
#include <upsclient.h>
int upscli_get(UPSCONN_t *ups, int numq, const char **query,
int *numa, char ***answer)
DESCRIPTION
The upscli_get() function takes the pointer ups to a UPSCONN_t state structure, and the pointer query to an array of numq query elements.
It builds a properly-formatted request from those elements and transmits it to upsd(8).
Upon success, the response will be split into separate components. A pointer to those components will be returned in answer. The number of
usable answer components will be returned in numa.
USES
This function implements the "GET" command in the protocol. As a result, you can use it to request many different things from the server.
Some examples are:
o GET NUMLOGINS <ups>
o GET UPSDESC <ups>
o GET VAR <ups> <var>
o GET TYPE <ups> <var>
o GET DESC <ups> <var>
o GET CMDDESC <ups> <cmd>
QUERY FORMATTING
To generate a request for GET NUMLOGINS su700, you would populate query and numq as follows:
int numq;
const char *query[2];
query[0] = "NUMLOGINS";
query[1] = "su700";
numq = 2;
All escaping of special characters and quoting of elements with spaces is handled for you inside this function.
ANSWER FORMATTING
The raw response from upsd to the above query would be NUMLOGINS su700 1. Since this is split up for you, the values work out like this:
numa = 3;
answer[0] = "NUMLOGINS"
answer[1] = "su700"
answer[2] = "1"
Notice that the value which you seek typically starts at answer[numq].
ERROR CHECKING
This function will check your query against the response from upsd(8). For example, if you send "VAR" "su700" "ups.status", it will expect
to see those at the beginning of the response.
If the results from upsd do not pass this case-insensitive test against your request, this function will return an error. When this
happens, upscli_upserror(3) will return UPSCLI_ERR_PROTOCOL.
ANSWER ARRAY LIFETIME
The pointers contained within the answer array are only valid until the next call to a upsclient function which references them. If you
need to use data from multiple calls, you must copy it somewhere else first.
The answer array and its elements may change locations, so you must not rely on previous addresses. You must only use the addresses which
were returned by the most recent call. You also must not attempt to use more than numa elements in answer. Such behavior is undefined, and
may yield bogus data or a crash.
The array will be deleted after calling upscli_disconnect(3). Any access after that point is also undefined.
RETURN VALUE
The upscli_get() function returns 0 on success, or -1 if an error occurs.
SEE ALSO upscli_list_start(3), upscli_list_next(3), upscli_strerror(3), upscli_upserror(3)Network UPS Tools 05/22/2012 UPSCLI_GET(3)