Discussion:
Set/get console cursor position without use ncurses
(too old to reply)
Max
2012-11-19 08:15:42 UTC
Permalink
Hi all

I'm looking for a way to get and set the cursor position in a Linux
console application (pure console, not X11 console) but without use the
function move() exported by ncurses library. I want to manage the
cursor position directly from my C application without use any
additional library. Is there a way?

Thank you for the help

--
Tauno Voipio
2012-11-19 10:42:40 UTC
Permalink
Post by Max
Hi all
I'm looking for a way to get and set the cursor position in a Linux
console application (pure console, not X11 console) but without use the
function move() exported by ncurses library. I want to manage the
cursor position directly from my C application without use any
additional library. Is there a way?
Thank you for the help
Please think twice: You're saying 'I need the services of ncurses,
but do not want to use it'. You need to code much of the functionality
of ncurses.

Basically, you have to pick the terminal capabilities, get the cursor
control codes, and using them to emit suitable control sequences.
--
Tauno Voipio
Max
2012-11-19 16:04:40 UTC
Permalink
Post by Tauno Voipio
Please think twice: You're saying 'I need the services of ncurses,
but do not want to use it'. You need to code much of the functionality
of ncurses.
Since looking around it seem no one thought to find a way to move the
cursor without the help of ncourses move() function I used this
"standard call" as an example I need to get. ncurses have a lot of code
involving a large number af features I don't need at the moment. I
tried to check the code inside ncurses for move the cursor but it seem
really complicated (at least for me that I'm not expert in Linux
programming).
Post by Tauno Voipio
Basically, you have to pick the terminal capabilities, get the cursor
control codes, and using them to emit suitable control sequences.
This is the way I'm trying to follow at the moment but how is possible
to send control codes and get the reply directly to the console from C
code without have an echo in the screen? Do you know where is possible
to find an example code about?

Thank you



--
Grant Edwards
2012-11-19 16:13:46 UTC
Permalink
Post by Max
Post by Tauno Voipio
Please think twice: You're saying 'I need the services of ncurses,
but do not want to use it'. You need to code much of the functionality
of ncurses.
Since looking around it seem no one thought to find a way to move the
cursor without the help of ncourses move()
Nonsense.

Just send the escape sequence yourself.
--
Grant Edwards grant.b.edwards Yow! BARRY ... That was
at the most HEART-WARMING
gmail.com rendition of "I DID IT MY
WAY" I've ever heard!!
Chris Cox
2012-11-19 21:41:29 UTC
Permalink
Post by Grant Edwards
Post by Max
Post by Tauno Voipio
Please think twice: You're saying 'I need the services of ncurses,
but do not want to use it'. You need to code much of the functionality
of ncurses.
Since looking around it seem no one thought to find a way to move the
cursor without the help of ncourses move()
Nonsense.
Just send the escape sequence yourself.
Not quite right, but ok in many cases nowadays.. but the more correct answer is
to query the capability from the current term database and use the codes that it
wants you to use for that terminal. That way, the implementation will be
terminal independent.

See/man things like:

terminfo
tput
infocmp

For example, consider (from the shell):

tput clear
tput cup 5 5;echo -n Hello starting at 5,5

Now.. is that "curses"? Well... in Linux the C terminfo calls are certainly
part of a ncurses package... so I suppose you could say it is...
Grant Edwards
2012-11-19 22:43:23 UTC
Permalink
Post by Chris Cox
Post by Grant Edwards
Post by Max
Post by Tauno Voipio
Please think twice: You're saying 'I need the services of ncurses,
but do not want to use it'. You need to code much of the functionality
of ncurses.
Since looking around it seem no one thought to find a way to move the
cursor without the help of ncourses move()
Nonsense.
Just send the escape sequence yourself.
Not quite right,
I was responding to the statement that nobody has found a way to move
the cursor without using ncurses move().
Post by Chris Cox
but ok in many cases nowadays... but the more correct answer is to
query the capability from the current term database and use the codes
that it wants you to use for that terminal. That way, the
implementation will be terminal independent.
If terminal independence is a requirement, then that's definitely the
way to go. However, the requirement was for "linux console" only.
_If_ that requirement is correct, then I doubt the linux console codes
are going to change much over the years. They certainly haven't in
the first 20 years. Are there any popular terminal emulators that
won't work with the ANSI cursor-movement sequence that's used by the
Linux console?

On the third hand, given that ncurses is ubiquitous and rather small,
trying to avoid it would seem to be a false economy.
--
Grant Edwards grant.b.edwards Yow! I am having FUN...
at I wonder if it's NET FUN or
gmail.com GROSS FUN?
Max
2012-11-20 09:28:19 UTC
Permalink
Post by Grant Edwards
I was responding to the statement that nobody has found a way to move
the cursor without using ncurses move().
I was referring to the fact that if I try to google search for a way to
move a cursor in the console all the reply I found concerning use
ncurses. Someone, like in this thread, suggested alternative way like
control codes but I still didn't find an example code showing better
how to properly make this operation (I'm still looking for this right
now).


--
Chris Cox
2012-11-20 15:14:00 UTC
Permalink
Post by Max
Post by Grant Edwards
I was responding to the statement that nobody has found a way to move
the cursor without using ncurses move().
I was referring to the fact that if I try to google search for a way to
move a cursor in the console all the reply I found concerning use
ncurses. Someone, like in this thread, suggested alternative way like
control codes but I still didn't find an example code showing better
how to properly make this operation (I'm still looking for this right
now).
Please reread my post folks.

No need for ncurses move.. but escape sequences... do you know them? Do you know
them for EVERY possible terminal type out there? No.. of course not.... so I
was just telling you the historical way of finding out which is to query termcap
(very old) and terminfo databases.

Sure.. you can ASSUME that every terminal is the same.. and for the most part,
thanks to the PC, there's a lot of truth to that (as I mentioned). But since I
have worked on projects that aren't terribly old where that was NOT true, I just
wanted to educate everyone on proper technique.

Code in shell was provided in my post.

man terminfo
(get the one from section 3 or 3ncurses depending)

So.. you don't have to use the ncurses move/windowing, etc.. stuff... you can
query the terminfo database for the proper escape codes matching the current
terminal device and use that information. Yes.. in Linux, the terminfo database
calls are part of ncurses... but the "ti" calls are quite low level.

Just how you do things.... there isn't another way (without error)...
Brian Bebeau
2012-11-21 20:56:41 UTC
Permalink
Post by Chris Cox
Post by Max
Post by Grant Edwards
I was responding to the statement that nobody has found a way to move
the cursor without using ncurses move().
I was referring to the fact that if I try to google search for a way to
move a cursor in the console all the reply I found concerning use
ncurses. Someone, like in this thread, suggested alternative way like
control codes but I still didn't find an example code showing better
how to properly make this operation (I'm still looking for this right
now).
man terminfo
(get the one from section 3 or 3ncurses depending)
So.. you don't have to use the ncurses move/windowing, etc.. stuff...
you can query the terminfo database for the proper escape codes matching
the current terminal device and use that information. Yes.. in Linux,
the terminfo database calls are part of ncurses... but the "ti" calls
are quite low level.
If you're worried about the performance overhead of ncurses, this is
definitely the way to go. Many years ago, I had to write a program to
talk to telephone switches. It worked well in curses, but using 20
instances of the program brought the machine to it's knees. I rewrote
it using just terminfo calls and it worked great. Look up the
curs_terminfo(3x) page for the calls. For instance, you only need to
do setupterm() instead of initscr(). You can then build up the string
you need using tgetstr() into a buffer, and only output it when you
need to using tputs(). ncurses does a lot of window refreshing, this
saves you all that until you really need it. The performance is much
improved.
Joe Pfeiffer
2012-11-19 16:55:58 UTC
Permalink
Post by Max
Post by Tauno Voipio
Please think twice: You're saying 'I need the services of ncurses,
but do not want to use it'. You need to code much of the functionality
of ncurses.
Since looking around it seem no one thought to find a way to move the
cursor without the help of ncourses move() function I used this
"standard call" as an example I need to get. ncurses have a lot of code
involving a large number af features I don't need at the moment. I
tried to check the code inside ncurses for move the cursor but it seem
really complicated (at least for me that I'm not expert in Linux
programming).
You can send any sequence of characters to the screen you want,
including the characters making a move happen. You can either look up
the code in the terminal's manual, or look them up in the terminfo
database. Using the codes for a vt100 will probably work well enough
for most terminals; of course, not all terminals use the same codes so
to be sure it'll work on any terminal you want you'll want to use
terminfo. There's a man page documenting it.

Or you can make life easy for yourself and use ncurses.
Post by Max
Post by Tauno Voipio
Basically, you have to pick the terminal capabilities, get the cursor
control codes, and using them to emit suitable control sequences.
This is the way I'm trying to follow at the moment but how is possible
to send control codes and get the reply directly to the console from C
code without have an echo in the screen? Do you know where is possible
to find an example code about?
If you're talking about not echoing user input, there are a bunch of
ways you can turn that off. One of them is with the termios family of
calls; again, there is a man page documenting it.

Or you can make life easy on yourself and...
Max
2012-11-20 09:31:39 UTC
Permalink
Post by Joe Pfeiffer
You can send any sequence of characters to the screen you want,
including the characters making a move happen. You can either look up
the code in the terminal's manual, or look them up in the terminfo
database. Using the codes for a vt100 will probably work well enough
for most terminals; of course, not all terminals use the same codes so
to be sure it'll work on any terminal you want you'll want to use
terminfo. There's a man page documenting it.
Or you can make life easy for yourself and use ncurses.
Hi

I explained the reasons I would like to avoid use ncurses in another
post in thsi thread. Maybe I'm making a mistake, I'm open to every
suggestion. Anyway I understand the way you suggest and I'll try to get
more info. An example code would be very helpful, do you know where is
possible to get one?

Thank you
Tauno Voipio
2012-11-20 13:17:15 UTC
Permalink
Post by Max
Post by Joe Pfeiffer
You can send any sequence of characters to the screen you want,
including the characters making a move happen. You can either look up
the code in the terminal's manual, or look them up in the terminfo
database. Using the codes for a vt100 will probably work well enough
for most terminals; of course, not all terminals use the same codes so
to be sure it'll work on any terminal you want you'll want to use
terminfo. There's a man page documenting it.
Or you can make life easy for yourself and use ncurses.
Hi
I explained the reasons I would like to avoid use ncurses in another
post in thsi thread. Maybe I'm making a mistake, I'm open to every
suggestion. Anyway I understand the way you suggest and I'll try to get
more info. An example code would be very helpful, do you know where is
possible to get one?
Thank you
Have you read <http://www.tldp.org/HOWTO/Text-Terminal-HOWTO.html>?
--
Tauno Voipio
Tauno Voipio
2012-11-19 18:24:32 UTC
Permalink
Post by Max
Post by Tauno Voipio
Please think twice: You're saying 'I need the services of ncurses,
but do not want to use it'. You need to code much of the functionality
of ncurses.
Since looking around it seem no one thought to find a way to move the
cursor without the help of ncourses move() function I used this
"standard call" as an example I need to get. ncurses have a lot of code
involving a large number af features I don't need at the moment. I
tried to check the code inside ncurses for move the cursor but it seem
really complicated (at least for me that I'm not expert in Linux
programming).
Post by Tauno Voipio
Basically, you have to pick the terminal capabilities, get the cursor
control codes, and using them to emit suitable control sequences.
This is the way I'm trying to follow at the moment but how is possible
to send control codes and get the reply directly to the console from C
code without have an echo in the screen? Do you know where is possible
to find an example code about?
Thank you
Why is it undesirable to have ncurses?

It is usually a shared library, which is not too large, and
pretty probably already mapped to some process in the system
(132772 bytes in Ubuntu 12.04).

Please remember that in a demand-paged virtual memory system,
the memory allocation is in the address space of the process
only. The real RAM chips get only used when a page is accessed.
The extra functions do not load the memory capacity, except
in the file system.
--
Tauno Voipio
Max
2012-11-20 09:21:45 UTC
Permalink
Post by Tauno Voipio
Post by Max
Post by Tauno Voipio
Please think twice: You're saying 'I need the services of ncurses,
but do not want to use it'. You need to code much of the
functionality of ncurses.
Since looking around it seem no one thought to find a way to move
the cursor without the help of ncourses move() function I used this
"standard call" as an example I need to get. ncurses have a lot of
code involving a large number af features I don't need at the
moment. I tried to check the code inside ncurses for move the
cursor but it seem really complicated (at least for me that I'm not
expert in Linux programming).
Post by Tauno Voipio
Basically, you have to pick the terminal capabilities, get the
cursor control codes, and using them to emit suitable control
sequences.
This is the way I'm trying to follow at the moment but how is
possible to send control codes and get the reply directly to the
console from C code without have an echo in the screen? Do you know
where is possible to find an example code about?
Thank you
Why is it undesirable to have ncurses?
It is usually a shared library, which is not too large, and
pretty probably already mapped to some process in the system
(132772 bytes in Ubuntu 12.04).
Please remember that in a demand-paged virtual memory system,
the memory allocation is in the address space of the process
only. The real RAM chips get only used when a page is accessed.
The extra functions do not load the memory capacity, except
in the file system.
Hi

Thank you to all the the replies. I'll try to explain my requirements.
I'm developing a console application that must run under Linux, Windows
and MS-DOS. The 90% of the code is OS indipendant and the remaining 10%
is a wrapper around the specific calls of each different OS. Using this
way I can easily recompile the app just using different compiler with
properly define settings. In case of Linux this same app must be
distributed in binary format compiled for x86 and arm version. Since
the app must run in a lot of different embedded Linux distrubition
where is not possible to know if all the required shared libraries will
be present I compile tha app statically linking all the library needed
(currently only libc). The Linux native system where I work is x86
based and for make the arm version I'm currently using a toolchain. I
would like to avoid use additional libraries function, like ncurses in
this case, because, as explained, I want to have all the library
statically linked. I suppose I can get the static version of ncurses in
x86 system but this same static library compiled for arm is not present
in the toolchain. Than, suppose there is no other easy way to move
cursor out from ncurses I have two possibilities:

- Integrate the ncourses source code into my project so it will be
possible to recompile all the app and library using the compiler to x86
or arm
- Find the ncurses static library in binary format of both x86 and arm
version and integrate them in the project

Maybe I'm doing something wrong in my reasoning?

Anyway thank you again for the help

--
Chris Cox
2012-11-20 15:35:04 UTC
Permalink
On 11/20/2012 03:21 AM, Max wrote:
...snip...
Post by Max
Thank you to all the the replies. I'll try to explain my requirements.
I'm developing a console application that must run under Linux, Windows
and MS-DOS. The 90% of the code is OS indipendant and the remaining 10%
The Windows "terminal" is cmd... which is a weird animal.

DOS is DOS.

In neither case are there multi-terminal handling, neither Windows or DOS
understand the idea of terminal devices.

So.. you do have to understand the limitations of the platform you are running on.

My comments about terminfo apply to true multi-user OS's like Unix/Linux and not
to DOS/Windows.

So... IMHO, you can make assumptions about end terminal devices and assume an
ANSI terminal (for example, and that's fairly safe)... and then you can use
Linux to query terminfo for all of the escape codes you will need in order to
hard code what you are wanting to do in the app.

Best assumption on the Linux side would be to run the program from a non-qui
direct connected terminal (e.g. the "head" of the system).... in 99% of the
cases, this will be an "Linux" terminal type, which is mostly ANSI.

If you're assuming a "console" X Windows client app.. then all bets are off and
you're better off making the dynamic queries of terminal capabilities (through
ncurses) to find those "escape sequences" so that things are done right.

Again, to use "escape sequences" does NOT require making curses calls... on
Linux however, the querying of terminfo capabilities databases is done through
low level calls current in the ncurses library. So getting the right "escape
sequences" for use on any X Windows terminal emulator client on Linux really
requires getting them from the terminfo database.

Back to "DOS" for a second. I have used many DOS applications that used the
full SCO-ANSI set (with every shift, alt, ctrl sequence imaginable).... and let
me just say that the terminfo database ones in Linux are NOT complete. So I had
to create my own (because we were running this "portable" app inside of Linux).
In my case, we were using the PuTTY terminal emulator ssh client from Windows,
so I needed a full SCO-ANSI terminfo db on the Linux side where the ported DOS
application was run from. Again, the app need to see the full gambit of all
possible key combinations (input is just as important as output in my case).

On a Linux system (with ncurses infocmp installed) take a look at (from bash or
something not csh):

TERM=linux infocmp

TERM=ansi infocmp

TERM=scoansi infocmp

Then you can see the differences (well, at least for what is recorded in the
terminfo databases) for these terminal types.

So.. you have to know your terminal in order to know everything you can or
cannot do. Assuming ANSI may be a "safe" answer, all depends on how much you
need to do.
Max
2012-11-20 15:52:31 UTC
Permalink
Post by Chris Cox
The Windows "terminal" is cmd... which is a weird animal.
DOS is DOS.
In neither case are there multi-terminal handling, neither Windows or
DOS understand the idea of terminal devices.
So.. you do have to understand the limitations of the platform you are running on.
My comments about terminfo apply to true multi-user OS's like
Unix/Linux and not to DOS/Windows.
For this problem different OS have different approach. In case of DOS
is very easy since there are specific interrupt calls for move the
cursor position around the screen. Same easy solution for Windows with
specific Windows API allow to move the cursor around the terminal
screen. This code was done without problem. In this case the real
problem is Linux since it seem there isn't a direct call making this
simply work of position the cursor in a specific point (well, indeed
there is a simply call, is the move() function from ncurses under
discussion but is not native of the system and require an additional
external library).

--
Joe Pfeiffer
2012-11-20 18:35:32 UTC
Permalink
Post by Max
Thank you to all the the replies. I'll try to explain my requirements.
I'm developing a console application that must run under Linux, Windows
and MS-DOS. The 90% of the code is OS indipendant and the remaining 10%
is a wrapper around the specific calls of each different OS. Using this
way I can easily recompile the app just using different compiler with
properly define settings. In case of Linux this same app must be
distributed in binary format compiled for x86 and arm version. Since
the app must run in a lot of different embedded Linux distrubition
where is not possible to know if all the required shared libraries will
be present I compile tha app statically linking all the library needed
(currently only libc). The Linux native system where I work is x86
based and for make the arm version I'm currently using a toolchain. I
would like to avoid use additional libraries function, like ncurses in
this case, because, as explained, I want to have all the library
statically linked. I suppose I can get the static version of ncurses in
x86 system but this same static library compiled for arm is not present
in the toolchain. Than, suppose there is no other easy way to move
- Integrate the ncourses source code into my project so it will be
possible to recompile all the app and library using the compiler to x86
or arm
- Find the ncurses static library in binary format of both x86 and arm
version and integrate them in the project
Maybe I'm doing something wrong in my reasoning?
Anyway thank you again for the help
If you want to target both linux and DOS, ncurses moves from being the
right way to do it to being *really* the right way to do it. At worst,
for linux, you need to bundle a version of ncurses with your
application. For DOS, it turns out there is a library called PDCurses
which works pretty much the same way (according to wikipedia, anyway --
I've never used it, unlike ncurses). Any platform-dependency you need
to insert in your code will be an order of magnitude easier if it's
between two similar libraries instead of between a platform that comes
close to emulating a terminal and one that's Completely Different.
Max
2012-11-21 09:19:25 UTC
Permalink
Post by Joe Pfeiffer
If you want to target both linux and DOS, ncurses moves from being the
right way to do it to being really the right way to do it. At worst,
for linux, you need to bundle a version of ncurses with your
application. For DOS, it turns out there is a library called PDCurses
which works pretty much the same way (according to wikipedia, anyway
-- I've never used it, unlike ncurses). Any platform-dependency you
need to insert in your code will be an order of magnitude easier if
it's between two similar libraries instead of between a platform that
comes close to emulating a terminal and one that's Completely
Different.
As replied in another post of this same thread there is no need of
ncurses (or similar libraries) functionalities under DOS or Windows.
All the function for easily move the cursor position and a lot of other
graphic functions are available through interrupt calls (DOS) or direct
API calls (Windows). Under Linux it seem ncurses is the only way to get
easily what in other OS is natively available without additional
efforts or libraries...


--
Jan Panteltje
2012-11-21 09:34:29 UTC
Permalink
On a sunny day (Wed, 21 Nov 2012 09:19:25 +0000 (UTC)) it happened "Max"
Post by Max
As replied in another post of this same thread there is no need of
ncurses (or similar libraries) functionalities under DOS or Windows.
All the function for easily move the cursor position and a lot of other
graphic functions are available through interrupt calls (DOS) or direct
API calls (Windows). Under Linux it seem ncurses is the only way to get
easily what in other OS is natively available without additional
efforts or libraries...
MS DOS is a memory limited piece of shit, and long dead.
MS windows is an ever repeating attempt to write new ever worse versions of an OS to extract money from its victims.
You should REALLY not support either of that anti human crap.
Microsoft is pretty much dead anyways, I guess even to the totally ignorant
users selling feature limited crap over and over again must have been noticed.
So much for your 'no additional effort and libraries' statement.

Be glad there IS ncurses, or learn to use the terminal control codes,
or even better learn how to write a decent GUI or a command line program
that does not need cursor jingling.
Its easy.
Dropping support for MS crap will give you time to learn that, and optimize your Linux design.
Max
2012-11-21 10:59:09 UTC
Permalink
Jan Panteltje wrote:

Warning, your reply risk to start a flame that I don't want to join in.

If you are one of the "classic" Linux user that think Linux is the only
one OS star in the world and all other OS are shit is your problem but
the reality is not as you think. I'll reply you ONCE just for show my
think but I'll don't reply to any other post out of the current problem
discussion anymore.

So, let's start...
Post by Jan Panteltje
MS DOS is a memory limited piece of shit, and long dead.
MS-DOS is dead for standard users but is quite still live for companies
making embedded hardware since can be booted easily from an USB key (I
know Linux too, just for prevent your reply), can run with a very
limited quantity of memory and allow to easily have access to memory
(high memory using extension like DOS32), IO port, PCI and so on. The
only "limitation" is it can work only in x86 system but is very useful
in a lot of occasions.
Post by Jan Panteltje
MS windows is an ever repeating attempt to write new ever worse
versions of an OS to extract money from its victims. You should
REALLY not support either of that anti human crap. Microsoft is
pretty much dead anyways, I guess even to the totally ignorant users
selling feature limited crap over and over again must have been
noticed. So much for your 'no additional effort and libraries'
statement.
"Ignorant users" as you call normal people are the same people who only
need to use a computer without face problem like kernel configuration,
recomiling libraries, fight with all the problem Linux give with driver
of each device you try to connect and so on. The list of very long. I
know very well people like you, sice I have some friend who think
exactly the same. Maybe you are a Linux expert and all these problems I
listed are "normal". You know how to fix them so no problem at all. But
normal people can PAY for have a stable system that don't give a lot of
troubles without all the problem below. I don't say Windows doesn't
have problems or is the perfect OS but compared from linux have a
characteristic and is fundamentals and in called STANDARDS. I can run
on Windows 7 a software developed from Windows 2000 whithout problems
in the majority of cases. Do you think the possibility to run in the
last Linux version a software compiled for a Linux distrubution older
more than 10 years are very high? I don't think so. Yes, you can
recompile but also in this case I don't think you could have success
without apply patches (supposign someone made them), updating libraries
and so on. In your mind you don't consider these as problem but in the
reality these ARE problems. In my work I develop software for both
Windows a Linux. I can appreciate some positive feature of Linux but I
prefer Windows for the reasons I explained above. I'm sure you don't
agree but I don't care.
Post by Jan Panteltje
Be glad there IS ncurses, or learn to use the terminal control codes,
I should be glad because someone invented this strange and quite
complex ways for make the same operation I can have with few lines of
native code in other OS?
Post by Jan Panteltje
or even better learn how to write a decent GUI or a command line
program that does not need cursor jingling.
You are a little strung? Since you don't know nothing about the
application I need to develop you have no right to criticize my choices.
Just for your information I need to show some binary data in the screen
and refresh continuously the current value of them. The solution is
usually used in this case is to print the data, reposition the cursor
at the beginning and reprint again the new data for cover the old one.
I'm open to any suggestion, if you have a better idea, please, explain
me.
Post by Jan Panteltje
Dropping support for MS crap will give you time to learn that, and
optimize your Linux design.
As already said in the beginning of this post this will be my only
reply about this argument. You can throw your anger as you like but, as
already said, I don't care.

Bye


--
Jan Panteltje
2012-11-21 11:54:48 UTC
Permalink
On a sunny day (Wed, 21 Nov 2012 10:59:09 +0000 (UTC)) it happened "Max"
Post by Max
I'll reply you ONCE just for show my
think but I'll don't reply to any other post out of the current problem
discussion anymore.
Head in sand.
You made absolutely no statement contradicting anything I stated.

As to 'users', maybe try Ubuntu some time.
I have it, but I run Slackware / Debian normally, but I see that
Ubuntu outdoes Microsoft crap in both quality, ease of install, and support.
Maybe it takes (Linux) a little time to get used to for people,
but I also remember somebody who got his first computah (with that MS product) not so
long ago asking me 'What is a mouse click and how do I "click" on something?'.
The learning curve that you think in NOT there in using computahs IS there,
and you take that for granted as you have been brainwashed to look through ever smaller windows so to speak.
I do not give a f*ck whet you reply to or even do not reply to, and who,
but if you start your MS advertising nonsensical crap here in this group
I will tick you in the corner. or under the carpet where you came from.

Luke Skywater
Rainer Weikusat
2012-11-21 16:43:16 UTC
Permalink
Post by Max
Warning, your reply risk to start a flame that I don't want to join in.
If you are one of the "classic" Linux user that think Linux is the only
one OS star in the world and all other OS are shit is your problem but
the reality is not as you think.
You should try to avoid confusing your uninformed prejudices about
'the world' with 'the world' itself.
Max
2012-11-22 08:30:33 UTC
Permalink
Post by Rainer Weikusat
You should try to avoid confusing your uninformed prejudices about
'the world' with 'the world' itself.
Sorry, I don't understand very well the meaning of your phrase, can you
explain me better? (is not a provocative phrase, I would only discuss
"peacefully" about this topic)

The probmem is I can not accept phrases like:

"MS DOS is a memory limited piece of shit, and long dead."

or

"MS windows is an ever repeating attempt to write new ever worse
versions of an OS to extract money from its victims."

I don't think MS-DOS or Windows are the "perfect" OS but I don't think
Linux is perfect too. There are situation where Windows is better than
Linux and other where Linux is better than Windows. Personally I like
more Windows for the reasons I explained before but in some cases I'm
the first person who think that Linux must be used instaed of other OS.


--
Rainer Weikusat
2012-11-22 13:14:24 UTC
Permalink
Post by Max
Post by Rainer Weikusat
You should try to avoid confusing your uninformed prejudices about
'the world' with 'the world' itself.
Sorry, I don't understand very well the meaning of your phrase, can you
explain me better?
If you're asking relatively silly questions and annoy the people who
could answer them with your bigotry at the same time, your
"communication success" will be limited.
Max
2012-11-22 14:08:17 UTC
Permalink
Post by Rainer Weikusat
If you're asking relatively silly questions and annoy the people who
could answer them with your bigotry at the same time, your
"communication success" will be limited.
Ok, I give up! If I annoyed people I'm really sorry for this but,
onestly, I don't think to be bigot. I only have my opinion (that is
only my opinion based to what I like or dislike more) regarding
different OS. However it seem any opinion different from "Linux is the
best" is not welcomed here...
I'm sorry for this
Goodbye
--
John Hasler
2012-11-22 16:06:26 UTC
Permalink
If I annoyed people I'm really sorry for this but, honestly, I don't
think to be bigot.
You aren't. Some people have very strong opinions and are also very
thin-skinned. Just ignore them.
--
John Hasler
***@newsguy.com
Dancing Horse Hill
Elmwood, WI USA
Rainer Weikusat
2012-11-22 16:31:37 UTC
Permalink
Post by John Hasler
If I annoyed people I'm really sorry for this but, honestly, I don't
think to be bigot.
You aren't. Some people have very strong opinions and are also very
thin-skinned. Just ignore them.
There was a single postig by Jan Pantelje about the merits or lack
thereof of DOS and Windows. And this caused this 'Max' guy to go onto
a name calling spree centered around "as everyone knows, all Linux
user are ...". And these kind of sweeping statements based on
ignorance are 'bigotry' in my book, cf

http://oald8.oxfordlearnersdictionaries.com/dictionary/bigotry

especially considering that the person who posted them doesn't even
understand why his 'as we all know all XXX are YYY'-statements might
offend people. So far, I had been following the thread and was
thinking about possibly writing something useful (specifically, that
serial console are not that uncommon, especially for 'embedded uses',
and that terminal emulators usually don't support "Linux console
codes) but this "there are three operating systems in the world, DOS,
Windows and Linux and the latter is solely used by all the crackpots/
fruitcakes "as everyone knows"' made me reconsider that.
Max
2012-11-23 09:11:17 UTC
Permalink
Post by Rainer Weikusat
There was a single postig by Jan Pantelje about the merits or lack
thereof of DOS and Windows. And this caused this 'Max' guy to go onto
a name calling spree centered around "as everyone knows, all Linux
user are ...". And these kind of sweeping statements based on
ignorance are 'bigotry' in my book, cf
http://oald8.oxfordlearnersdictionaries.com/dictionary/bigotry
especially considering that the person who posted them doesn't even
understand why his 'as we all know all XXX are YYY'-statements might
offend people.
Sorry, maybe my english is not perfect but I'm quite sure, in my
consideration of the "meaning of the words", that the expression
"merits or lack" is not the right expression for describe the following
affirmations:

"MS DOS is a memory limited piece of shit, and long dead.
MS windows is an ever repeating attempt to write new ever worse
versions of an OS to extract money from its victims.
You should REALLY not support either of that anti human crap.
Microsoft is pretty much dead anyways, I guess even to the totally
ignorant users selling feature limited crap over and over again must
have been noticed."

As you can note, inside this "merits or lack" affirmation there is a
"indirect" offense to Windows users classified as ignorant and, in my
interpretation, also a bit stupid since continue to pay for have a
"ever worse versions" of Windows OS. I'm relly sorry if some user was
offended by my words, as I can said my english is not perfect and, I
admint, when I wrote the "indicted" post I was a little angry since I
do not tolerate criticism so brutal. There are many ways to express
their ideas, and this is definitely one of the most rude. Anyway I'm
sorry again if anyone was offended by my words, it was not my intention
to offend noone, but only to discuss normally...
Post by Rainer Weikusat
"there are three operating systems in the world, DOS,
Windows and Linux and the latter is solely used by all the crackpots/
fruitcakes "as everyone knows"' made me reconsider that.
Please, can you tell me where I wrote an affirmation like this?



--
Jan Panteltje
2012-11-23 09:36:25 UTC
Permalink
On a sunny day (Fri, 23 Nov 2012 09:11:17 +0000 (UTC)) it happened "Max"
Post by Max
"MS DOS is a memory limited piece of shit, and long dead.
MS windows is an ever repeating attempt to write new ever worse
versions of an OS to extract money from its victims.
You should REALLY not support either of that anti human crap.
Microsoft is pretty much dead anyways, I guess even to the totally
ignorant users selling feature limited crap over and over again must
have been noticed."
I think we need to add a bit to that truth,
it recently came to my attention the Microsoft's attempts to create
or rather force a secure boot option on computer users,
is prohibiting Linux from making a usable bootloader is a NASTY way.
Of course nothing related to 'secure' is intented by Microsoft,
just a last attempt to rule the world, read this for how nasty they are:
http://blog.hansenpartnership.com/adventures-in-microsoft-uefi-signing

That alone is every reason you need in this universe not to support them or their crap in any way.
Personally I burned my xp disk (video available for 100$, you get a sticker that you need
to put on the PC if you have it, you can only watch it once, and I can bust in your door
and arrest you and claim a million if you do not comply), because it was unusable.
On top of that you will then have to pay for most applications, some as simple as 'Hello world'.

You mentioned embedded, and for 30$ or there about you can buy a strawberry pie,
or was it raspberry pie, and it has Linux as OS, and likely can do a lot more than your power hungry old MSDOS box.
Yes there are people that can walk on their hands, and maybe some of them insist that is the way to travel from east to west coast,
but the majority is not one of them.
Here is a nice article in German about how Linux saves million in Muenchen Germany:
http://www.heise.de/open/meldung/Linux-in-Muenchen-Ueber-10-Millionen-Euro-gespart-1755574.html

I am well aware of MSDOS, DRDOS, and older versions of windows being used. DRDOS was way better,
MS got scared, and make win98 with an integrated DOS (killed the concept of a GUI on top
of a simple kernel with command line), for market protection.
That is the time I went for Linux.
Everything has its learning curve, but already with Linux .98 (SLS) the absence of that nasty memory limitation,
plus multitasking, was an incredible plus.

MS Windows only got worse since, for marketing reasons, they started writing it over and over again,
and 98, 2000, NT, that other POS that never was accepted, 7, and now a total direction change with 8,
well they made their first loss this year,
They still have no clue that those who criticize Unix are destined to re-invent it so to speak.
Once investors design software it will be all over.

So, even from a market POV re-educating your users to use the right soft and hardware,
and not hang on to antique solutions is the right thing to do,
as well as from a financial POV.
Supporting Microsoft in any way is a crime against humanity.
Max
2012-11-23 16:27:41 UTC
Permalink
Post by Jan Panteltje
I think we need to add a bit to that truth,
it recently came to my attention the Microsoft's attempts to create
or rather force a secure boot option on computer users,
is prohibiting Linux from making a usable bootloader is a NASTY way.
I heard the news too and I agree is a very stupid idea. However didn't
surprise me a lot since MS is not new to these idiot strategies.
However you must consider the big difference between MS and Linux.
Linux is an open source OS where a lot of programmers over the world
work *for free* to the improvements. On the contrary MS is a commercial
company where the people working in need to be payed so, as every
company, need to use all the possible stragegies to get a gain also try
following some stupid idea like this. Anyway, excluding this strange
ideas, I don't think anything coming from MS is bad. In my opinion MS
is able to develop a very good products like, for example, Visual
Studio that I like a lot.
Post by Jan Panteltje
them or their crap in any way. Personally I burned my xp disk
because it was unusable.
Here I'm very curious since "unusable" is a very strong word. Always
talking without "defiance" but just for personal curiosity may I know
what are these thing you can do using Linux that can not be done using
Windows? I'm using Windows from a lot of years and never had big
problem in use them.
Post by Jan Panteltje
On top of that you will then have to pay for most applications,
some as simple as 'Hello world'.
Here don't agree. There are a lot of good Windows application released
as freeware too.
Post by Jan Panteltje
Here is a nice article in German about
http://www.heise.de/open/meldung/Linux-in-Muenchen-Ueber-10-Millionen-
Euro-gespart-1755574.html
And I think they made a very good choice. If they need only a desktop
tool with common office app like OpenOffice is quite stupid to pay for
have the same Windows feature you can have for free using Linux.
Post by Jan Panteltje
I am well aware of MSDOS, DRDOS, and older versions of windows being
used. DRDOS was way better, MS got scared, and make win98 with an
integrated DOS (killed the concept of a GUI on top of a simple kernel
with command line), for market protection. That is the time I went
for Linux. Everything has its learning curve, but already with Linux
.98 (SLS) the absence of that nasty memory limitation, plus
multitasking, was an incredible plus.
Correct, but if you don't need all these features but only a quick way
to check memory, IO or PCI, just for make an example, in my opinion
using MS-DOS is still the fastern way. Immediate boot from USB key,
ridiculus quanity of memory need and completely free access to all
hardware.
Post by Jan Panteltje
MS Windows only got worse since, for marketing reasons, they started
writing it over and over again, and 98, 2000, NT, that other POS that
never was accepted, 7, and now a total direction change with 8, well
they made their first loss this year, They still have no clue that
those who criticize Unix are destined to re-invent it so to speak.
Once investors design software it will be all over.
I don't gree also in this point. Windows Vista was really bad but using
Windows 7 I'm really satisfied and I think it work very well. Not tried
Windows 8 yet because I'm not interested to have always the last OS
just for try than I can not express my opnion about it.
Post by Jan Panteltje
Supporting Microsoft in any way is a crime against humanity.
This point of view is a bit too "dramatic" for me but is your point and
I respect it. I'm glad to discuss and compare different point of view,
the only important thing is to keep always a peaceful attitude without
be rude.

Anyway I agree with other user. We went totally off-topic so is better
to stop here the discussion. Everyone will continue to work with their
preferred OS and we'll be all happy.



--
Jan Panteltje
2012-11-23 20:13:11 UTC
Permalink
On a sunny day (Fri, 23 Nov 2012 16:27:41 +0000 (UTC)) it happened "Max"
Post by Max
Post by Jan Panteltje
I think we need to add a bit to that truth,
it recently came to my attention the Microsoft's attempts to create
or rather force a secure boot option on computer users,
is prohibiting Linux from making a usable bootloader is a NASTY way.
I heard the news too and I agree is a very stupid idea. However didn't
surprise me a lot since MS is not new to these idiot strategies.
However you must consider the big difference between MS and Linux.
Linux is an open source OS where a lot of programmers over the world
work *for free* to the improvements. On the contrary MS is a commercial
company where the people working in need to be payed so, as every
company, need to use all the possible strategies to get a gain also try
following some stupid idea like this.
But this is the point, people can get a good OS for free, or nearly free.
So I do not see a reason for MS to exist, unless they outperformed
everything else (Linux specifically in this case), but they sell feature limited stuff,
and the not-feature limited stuff they sell is not better than the open source versions,
and for sure covers a smaller spectrum of applications.
Post by Max
Anyway, excluding this strange
ideas, I don't think anything coming from MS is bad. In my opinion MS
is able to develop a very good products like, for example, Visual
Studio that I like a lot.
I have used it, and had to use it in my job, boss wanted to sell hardware
with a MS windows PC program...
We used Linux too.
In Linux, I just have fvwm with 9 virtual screens, several xterms,
sources in some, compile in other, some pdf and documents in other,
fast, very fast, joe as text editor, in my view it makes no sense to put up all those
variables in little windows,
you have to trust the compiler, I am not interested in register values.
I can program in asm for many different micro controllers, and THEN I am
VERY interested in register values.
But in C (or C++) just use some printf if you need a trace in a program.
Visual C(++) is a joke really.
Also I want to see as much source as I can on the screen, not just 7 lines in a small window
with idiotic coloring, sort of template filling.
No wonder that guys who program with that shit create instable bloat.
Post by Max
Post by Jan Panteltje
them or their crap in any way. Personally I burned my xp disk
because it was unusable.
Here I'm very curious since "unusable" is a very strong word. Always
talking without "defiance" but just for personal curiosity may I know
what are these thing you can do using Linux that can not be done using
Windows? I'm using Windows from a lot of years and never had big
problem in use them.
Apart from the appalling install that took ages (OEM disk),
showing silly MS commercials all the time,
once it ran, took me a whole Saturday afternoon, many drivers needed installing,
and every thing worked fine, next Monday morning it did NOT work, told me my mouse was a Microsoft mouse,
and cursor all over the place.
I do not even have a Microsoft mouse, but Logitech.
It advertised itself as being able to simply fix things, but it could not do that either.
I bought the OEM disk with new hardware because I was curious, somebody else boasted it was so good.
So I removed it, and installed Debian (IIRC), and everything worked fine from then on.
Amazingly enough I have not come across an application that I could not find.
There are a few things I run in wine, like LT spice, technical software,
as there is no Linux version AFAIK.
But the incredible waste of time and bloat and lack of features and support that came free with xp
taught me a lesson: never again.
Post by Max
Post by Jan Panteltje
On top of that you will then have to pay for most applications,
some as simple as 'Hello world'.
Here don't agree. There are a lot of good Windows application released
as freeware too.
True, although I cannot seem to remember one now,
there are application programs that come with hardware that are really nice,
you pay for that by buying the hardware.
Post by Max
Post by Jan Panteltje
Here is a nice article in German about
http://www.heise.de/open/meldung/Linux-in-Muenchen-Ueber-10-Millionen-
Euro-gespart-1755574.html
And I think they made a very good choice. If they need only a desktop
tool with common office app like OpenOffice is quite stupid to pay for
have the same Windows feature you can have for free using Linux.
Post by Jan Panteltje
I am well aware of MSDOS, DRDOS, and older versions of windows being
used. DRDOS was way better, MS got scared, and make win98 with an
integrated DOS (killed the concept of a GUI on top of a simple kernel
with command line), for market protection. That is the time I went
for Linux. Everything has its learning curve, but already with Linux
.98 (SLS) the absence of that nasty memory limitation, plus
multitasking, was an incredible plus.
Correct, but if you don't need all these features but only a quick way
to check memory, IO or PCI, just for make an example, in my opinion
using MS-DOS is still the fastern way. Immediate boot from USB key,
ridiculus quanity of memory need and completely free access to all
hardware.
I am not sure I understand what you mean here, I have Linux on an USB stick,
Linux on an SDcard, and I have experimented with that.
I even put a whole distro on a stick and it worked (grml.org).
You can access PCI and run all your programs as normal ( iopl(3) ).
There are of course also the many 'live CDs'.
Main I/O on a PC is parport, and writing to a parport directly
is very simple, you do not HAVE to go through the driver module if you a are single user
and not using the parport for anything else like printing for example.
(Now people here will jump in perhaps), but for what you do just write to it directly:

// Program toggle_pin_7.c

#include <stdio.h>
#include <stdlib.h>
#include <sys/io.h>

#define PAR_PORT 0x378 // address may differ
#define PAR_PORT_CONTROL 0x379


void scll()
{
int a;

a = inb(PAR_PORT);
a &= ~32; /* reset bit 5 (d5 on pin 7) */
outb(a, PAR_PORT);
}


void sclh()
{
int a;

a = inb(PAR_PORT);
a |= 32; /* set bit 5 (d5 on pin 7)*/
outb(a, PAR_PORT);
}


int main(int argc, char **argv)
{
iopl(3);

while(1)
{
sclh();
usleep(1000000);
scll();
usleep(100000);
}

exit(0);
}

Compile:
gcc -o toggle_pin_7 toggle_pin_7.c

Run:
./toggle_pin_7
Post by Max
Post by Jan Panteltje
MS Windows only got worse since, for marketing reasons, they started
writing it over and over again, and 98, 2000, NT, that other POS that
never was accepted, 7, and now a total direction change with 8, well
they made their first loss this year, They still have no clue that
those who criticize Unix are destined to re-invent it so to speak.
Once investors design software it will be all over.
I don't gree also in this point. Windows Vista was really bad but using
Windows 7 I'm really satisfied and I think it work very well. Not tried
Windows 8 yet because I'm not interested to have always the last OS
just for try than I can not express my opnion about it.
Right, I have not tried 7, and not 8.
Simply no need, 4 PCs here some on 24/7, all Linux, including the laptop.
Laptop also had xp on it.... removed it, some stuff is left in a partition
as I was afraid to kill the bootloader.... very expensive laptop.
Post by Max
Post by Jan Panteltje
Supporting Microsoft in any way is a crime against humanity.
This point of view is a bit too "dramatic" for me but is your point and
I respect it. I'm glad to discuss and compare different point of view,
the only important thing is to keep always a peaceful attitude without
be rude.
Anyway I agree with other user. We went totally off-topic so is better
to stop here the discussion. Everyone will continue to work with their
preferred OS and we'll be all happy.
Na, crime against humanity it is,
think how many man-years of irritation and frustration,
reboot waits, what not...
Rainer Weikusat
2012-11-23 14:54:16 UTC
Permalink
"Max" <***@noreply.com> writes:

A leading remark: I'm going to reply to this because I feel inclined
to make an attempt to set this straight, however, this really doesn't
belong here and I (and presumably, also some numbers of other people)
would subscribe to advocacy groups were I interested in advocacy.
Post by Max
Post by Rainer Weikusat
There was a single postig by Jan Pantelje about the merits or lack
thereof of DOS and Windows. And this caused this 'Max' guy to go onto
a name calling spree centered around "as everyone knows, all Linux
user are ...". And these kind of sweeping statements based on
ignorance are 'bigotry' in my book, cf
http://oald8.oxfordlearnersdictionaries.com/dictionary/bigotry
especially considering that the person who posted them doesn't even
understand why his 'as we all know all XXX are YYY'-statements might
offend people.
Sorry, maybe my english is not perfect but I'm quite sure, in my
consideration of the "meaning of the words", that the expression
"merits or lack" is not the right expression for describe the following
"MS DOS is a memory limited piece of shit, and long dead.
MS windows is an ever repeating attempt to write new ever worse
versions of an OS to extract money from its victims.
You should REALLY not support either of that anti human crap.
Microsoft is pretty much dead anyways, I guess even to the totally
ignorant users selling feature limited crap over and over again must
have been noticed."
As you can note, inside this "merits or lack" affirmation there is a
"indirect" offense to Windows users classified as ignorant and, in my
interpretation, also a bit stupid since continue to pay for have a
"ever worse versions" of Windows OS.
A real lot of 'soft' things which are sold to people (insurance
policies would be a great example) only make sense when someone buys
into the arguments brought forth by the guy who wanted to sell
something and since that someone wants to sell, these arguments should
usually be taken with a grain of salt. Yet, people buy this stuff and
others specialize in representing them when they want their money back
(or would like their money back) because they realized that they were
actually defrauded OR because another fast-talking guy who wanted to
sell a different service "made" them realize that.

I don't use Windows voluntarily and certainly wouldn't want to spend
any money on it because - in my opinion - this is not a 'value for
money' proposition and I'm also convinced that most people who do
either had no other choice, at least no workable other choice, or fell
for an arguably elaborate marketing scam (they way to sell a useless
insurance is to bombard the 'victim' with rational sounding arguments
nobody who hasn't specifically prepared and trained for such a
situation can refute, especially since some of them are going to be
outright nonsense whose refutation would be very time-consuming, and
even somebody who could refute each argument could never do so at a
speed with which more subtly fallacious and nonsensical propositions
could be brought forth).

If someone suggested you had been spending your money unwisely to your
own detriment, either, his arguments hold water, then you would be
well advised to learn from them or they don't, at least not in your
opinion, and in this case, that someone is simply wrong/ favouring
other tradeoffs than the ones you considered desirable. In any case,
feeling 'insulted' because someone has a very different opinion on
some issue is - well - stupid. Some sensible reactions to that are

- ignore it
- refute it
- state something like "without desiring to go into much
detail, this is an opinion I don't agree with"

A bad reaction is starting with something like this:

,----
| "Ignorant users" as you call normal people are the same people who only
| need to use a computer without face problem like kernel configuration,
| recomiling libraries, fight with all the problem Linux give with driver
| of each device you try to connect and so on.
`----

This is a run-of-the-mill set of seriously dated urban legends
and you can rest assured that most present day Linux-users
don't even really know what a kernel is, let alone how to
'configure' one. At home, I have one 'device', that's a
Brother DCP 7010 laser and the 'problem with the driver' I has
was that I had to go to the site of the manufacturer and
download it. In many cases, especially when using the more
popular 'easy to use' distributions, the situation is such
that you connect the device and it works out of the box, ie,
without installing anything. Other cases exist as well but the
situation is really not much different than it is for any
other OS: Some hardware is well-supported, some can be made to
work with difficulties, some can't be used at all. Depending
on what someone advocacy's person agenda happens to be, he
will focus on a suitable subset and ignore the others (and
maybe, he would also like to sell an insurance policy :->)

and continue like this:

,----
| I know very well people like you, sice I have some friend who think
| exactly the same.
`----

or this (I've changed he order)

,----
| If you are one of the "classic" Linux user that think Linux is the only
| one OS star in the world and all other OS are shit is your problem but
| the reality is not as you think.
`----

This reads as 'I know the likes of you. Typical Linux users -- to
deluded to see reality', IOW, crackpots, fruitcakes, $younameit. But
other people are really other people. They are not identical to some
people you believe to know, not identical to each other and -
generally - not significantly less ore more intelligent than you
are. Insofar they do things you really don't understand or you do
things they really don't understand, this lack of understanding will
usually be based on a lack of knowledge.

NB: This was a long text and I didn't really have the time to write
it.
John Hasler
2012-11-22 14:03:12 UTC
Permalink
Post by Max
Sorry, I don't understand very well the meaning of your phrase, can
you explain me better? (is not a provocative phrase, I would only
discuss "peacefully" about this topic)
Please take this sort of discussion to one of the advocacy groups where
arguments about which OS is better are on-topic.
--
John Hasler
***@newsguy.com
Dancing Horse Hill
Elmwood, WI USA
m***@gmail.com
2016-08-19 05:48:06 UTC
Permalink
Hello Max,

I know it's been FOUR YEARS since you posted this question but I will give my 2 cents for your question... I work in both the MS and Linux world. On Linux, I use ONE line of code to position the cursor: printf("\033[xx;yyf"); where 'xx' is the line and 'yy' is the column.
To make it easier on myself, I created a function like so:

/* Cursor Positioning code here... */
void gotoxy(int x,int y) {
printf("%c[%d;%df",0x1B,y,x);
}
With this gotoxy one liner function I wrote, all you have to do is call it:
gotoxy(19,29); ... and that will put you on line 19 in col 29. :-)
GangGreene
2012-11-21 12:48:40 UTC
Permalink
Post by Max
Post by Joe Pfeiffer
If you want to target both linux and DOS, ncurses moves from being the
right way to do it to being really the right way to do it. At worst,
for linux, you need to bundle a version of ncurses with your
application. For DOS, it turns out there is a library called PDCurses
which works pretty much the same way (according to wikipedia, anyway --
I've never used it, unlike ncurses). Any platform-dependency you need
to insert in your code will be an order of magnitude easier if it's
between two similar libraries instead of between a platform that comes
close to emulating a terminal and one that's Completely Different.
As replied in another post of this same thread there is no need of
ncurses (or similar libraries) functionalities under DOS or Windows. All
the function for easily move the cursor position and a lot of other
graphic functions are available through interrupt calls (DOS) or direct
API calls (Windows). Under Linux it seem ncurses is the only way to get
easily what in other OS is natively available without additional efforts
or libraries...
## Screen Dimensions
# Find current screen size
if [ -z "${COLUMNS}" ]; then
COLUMNS=$(stty size)
COLUMNS=${COLUMNS##* }
fi

# When using remote connections, such as a serial port, stty size returns
0
if [ "${COLUMNS}" = "0" ]; then
COLUMNS=80
fi

## Measurements for positioning result messages
COL=$((${COLUMNS} - 8))
WCOL=$((${COL} - 2))

## Set Cursor Position Commands, used via $ECHO
SET_COL="\\033[${COL}G" # at the $COL char
SET_WCOL="\\033[${WCOL}G" # at the $WCOL char
CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char
John Hasler
2012-11-21 14:24:14 UTC
Permalink
Post by Max
All the function for easily move the cursor position and a lot of
other graphic functions are available through interrupt calls (DOS) or
direct API calls (Windows).
Under Linux Ncurses _is_ the API for interaction with a terminal. It is
present on all Linux installations except specially stripped-down
embedded systems.
Post by Max
Under Linux it seem ncurses is the only way to get easily what in
other OS is natively available without additional efforts or
libraries...
Linux provides support for any terminal you choose to connect to it.
Terminfo entries already exist for just about every one in existence.
If you want your program to work with whatever your users choose to use
there are two approaches:

1) Determine what terminal they are using, get the data on it out of the
terminfo database, and send the correct codes as needed. In other
words, duplicate the functionality of Ncurses.

2) Use Ncurses and don't worry about it.

If you are working with an embedded system with which only one type of
terminal will ever be used and the overhead of Ncurses is intolerable
just send the codes.

Under DOS and Windows this "problem" does not exist because choice of
terminals does not exist.

I'd suggest that you look at other options such as S-lang, but you seem
to have an aversion to libraries.
--
John Hasler
***@newsguy.com
Dancing Horse Hill
Elmwood, WI USA
Max
2012-11-21 14:45:22 UTC
Permalink
Under Linux Ncurses is the API for interaction with a terminal. It is
present on all Linux installations except specially stripped-down
embedded systems.
I know but I need to cover all possible situations.
If you are working with an embedded system with which only one type of
terminal will ever be used and the overhead of Ncurses is intolerable
just send the codes.
Under DOS and Windows this "problem" does not exist because choice of
terminals does not exist.
I'd suggest that you look at other options such as S-lang, but you
seem to have an aversion to libraries.
Absolutely not. As said my problem is to make a "compact" tool more
portable as possible. However after checked the way of console codes I
decided to move using ncurses but trying to "integrate" the library
source code inside the project. This will allow to use different
compilers (just x86 and arm right now) without need to have the library
in binary format to link statically.

By the way, thank you for your help



--
John Hasler
2012-11-21 17:11:22 UTC
Permalink
Under Linux Ncurses is the API for interaction with a terminal. It is
present on all Linux installations except specially stripped-down
embedded systems.
I know but I need to cover all possible situations.
What situations do you need to cover where you would be running under
Linux but Ncurses would be absent? There are no distributions that lack
it. Stripped-down embedded systems sometimes do, but there pretty much
everything has to be customized anyway.
--
John Hasler
***@newsguy.com
Dancing Horse Hill
Elmwood, WI USA
Joe Pfeiffer
2012-11-21 17:20:10 UTC
Permalink
Post by Max
Post by Joe Pfeiffer
If you want to target both linux and DOS, ncurses moves from being the
right way to do it to being really the right way to do it. At worst,
for linux, you need to bundle a version of ncurses with your
application. For DOS, it turns out there is a library called PDCurses
which works pretty much the same way (according to wikipedia, anyway
-- I've never used it, unlike ncurses). Any platform-dependency you
need to insert in your code will be an order of magnitude easier if
it's between two similar libraries instead of between a platform that
comes close to emulating a terminal and one that's Completely
Different.
As replied in another post of this same thread there is no need of
ncurses (or similar libraries) functionalities under DOS or Windows.
All the function for easily move the cursor position and a lot of other
graphic functions are available through interrupt calls (DOS) or direct
API calls (Windows). Under Linux it seem ncurses is the only way to get
easily what in other OS is natively available without additional
efforts or libraries...
Reread what I said: my point wasn't that PDCurses was necessary to
support DOS, it's that the OP can either use ncurses/PDCurses and have
similar functions available to do cursor manipulation, or he can learn,
write, and maintain two completely different approaches to doing cursor
manipulation. And since the OP appears to be somebody who doesn't have
enough POSIX programming background to have written arbitrary bytes to
stdout before, this doesn't seem like an approach that's got a high
likelihood of success.
Grant Edwards
2012-11-21 17:23:52 UTC
Permalink
Post by Max
Under Linux it seem ncurses is the only way to get easily what in
other OS is natively available without additional efforts or
libraries...
I'm sorry, but that's just plain wrong. It's completely _tivial_ to
do cursor movement with the Linux console. Just write the escape
sequence to the console terminal. It's _one_flipping_line_of_code_!

How much easier can it get?
--
Grant Edwards grant.b.edwards Yow! Are we on STRIKE yet?
at
gmail.com
Grant Edwards
2012-11-19 15:38:19 UTC
Permalink
Post by Max
I'm looking for a way to get and set the cursor position in a Linux
console application (pure console, not X11 console) but without use the
function move() exported by ncurses library. I want to manage the
cursor position directly from my C application without use any
additional library.
man console_codes
--
Grant Edwards grant.b.edwards Yow! Life is a POPULARITY
at CONTEST! I'm REFRESHINGLY
gmail.com CANDID!!
Joe Beanfish
2012-11-20 14:05:24 UTC
Permalink
Post by Grant Edwards
Post by Max
I'm looking for a way to get and set the cursor position in a Linux
console application (pure console, not X11 console) but without use the
function move() exported by ncurses library. I want to manage the
cursor position directly from my C application without use any
additional library.
man console_codes
In case you don't have that...

http://linux.die.net/man/4/console_codes
Richard Kettlewell
2012-11-21 11:30:47 UTC
Permalink
Post by Max
I'm looking for a way to get and set the cursor position in a Linux
console application (pure console, not X11 console) but without use the
function move() exported by ncurses library. I want to manage the
cursor position directly from my C application without use any
additional library. Is there a way?
Thank you for the help
By the sound of it move() isn’t really what you want anyway; it sets the
cursor position in the screen model that curses maintains and it sounds
like you want to reposition the actual cursor straight away. You
probably want some of the functions documented in ‘man terminfo’; there
are usage examples on the web.

If you want to do it without use of an external library at all then the
answer seems straightforward enough - extract the cursor positioning
codes from the terminfo database and build them into your program,
looked up via terminal type. If you know which terminals your users are
using the list may not have to be very long.
--
http://www.greenend.org.uk/rjk/
Ron House
2013-07-11 03:56:21 UTC
Permalink
Post by Max
Hi all
I'm looking for a way to get and set the cursor position in a Linux
console application (pure console, not X11 console) but without use the
function move() exported by ncurses library. I want to manage the
cursor position directly from my C application without use any
additional library. Is there a way?
Thank you for the help
Having read some of the interminable discussion going on about this, and
understanding the point that ncurses is actually the "correct" way to do
it, if all you want to do is move the cursor, and if you are prepared to
wear the fact that somewhere, someone _might_ have some whacky
"terminal" that is completely nonstandard, you can't go far wrong by
just looking up the ANSI terminal escape code and bunging it into your
output as and when needed. Google ansi escape codes.

But please don't come back saying "now what do I do to clear the rest of
the line, or screen, or this weird thing is happening or my friend's
toaster screen doesn't get it, or ...". If it gets complicated, to get
round all your objections, get the source code of ncurses and compile it
into your program. The lost space is insignificant these days.
--
Ron House
Building Peace: http://peacelegacy.org
Australian Birds: http://wingedhearts.org
Principle of Goodness academic site: http://principleofgoodness.net
Rainer Weikusat
2013-07-11 10:08:56 UTC
Permalink
Post by Ron House
Post by Max
I'm looking for a way to get and set the cursor position in a Linux
console application (pure console, not X11 console) but without use the
function move() exported by ncurses library. I want to manage the
cursor position directly from my C application without use any
additional library. Is there a way?
Thank you for the help
Having read some of the interminable discussion going on about this,
and understanding the point that ncurses is actually the "correct" way
to do it, if all you want to do is move the cursor, and if you are
prepared to wear the fact that somewhere, someone _might_ have some
whacky "terminal" that is completely nonstandard, you can't go far
wrong by just looking up the ANSI terminal escape code and bunging it
into your output as and when needed. Google ansi escape codes.
This includes terminal emulators. The last time this actually hurt me
was with some version of minicom some years ago whose idea of 'vt102'
emulation different from the idea of 'an ANSI-compatible terminal' the
then-current 'busybox master bullfrog' (Robert Landley) had. Of
course, the result of me pointing this out was not 'oh well, I might
have been a tad bit wrong about that' but a crescendo of "go away,
spammer!, you don't exist !!" shouts, as can be expected in such a
situation (the other common issues would be a 'dumb terminal' output
device, eg, a straight socket connection which ends up writing data to
a file).

If you have a just cause of grief regarding a specific problem of a
terminal control abstraction layer which enables supporting more than
'whatever happens to work on my present laptop' without changing the
software, trying to remedy that would be a good idea. Otherwise, this
should be framed as the philosopical stance it actually is: I'm
convinced that everyone who has a problem I presently don't care about
is a minion in the force of satans and ought to be burnt at the stake,
ie, drop the pseudo-rationalization of "it works for me and I damn
fucking sure don't care about you". That's at least honest.
Loading...