Linux-Development-Apps Digest #375, Volume #7     Wed, 2 May 01 17:13:20 EDT

Contents:
  Re: Clear Screen on A program (Donald Arseneau)
  DDD-3.3 (Ricardo Lima)
  DDD - GDB - FORTRAN - Debug (Ricardo Lima)
  Variable-size multichoice menu for console app? (Neoklis)
  Some include files of system oriented missed out how to get it back..........?? 
("v.naga srinivas")
  SOLVED: static variable class constructors in shared libs (Michael Boehnisch)
  'make' and symbolic link problem: solved (Dean Allen Provins)
  times() on Linux is returning strange numbers ("Alex Ho")
  Re: Clear Screen on A program (Floyd Davidson)
  Re: Linux & gnuplot Q (Dick Nic$$alls dicknickallscompuservecom)
  Re: WWW: Linux Developer Network ("Kelsey Bjarnason")
  Re: Clear Screen on A program (Nate Eldredge)
  User <--> Kernel Space ("Cédric Willot")
  Re: Clear Screen on A program (Chris Cox)
  mozilla browser ID (Fred K Ollinger)

----------------------------------------------------------------------------

From: Donald Arseneau <[EMAIL PROTECTED]>
Subject: Re: Clear Screen on A program
Date: 02 May 2001 02:56:44 -0700

Juergen Sauer <[EMAIL PROTECTED]> writes:

> [...] Clear Screen Question
> > Try printf("\033[H\033[2J")
> 
> What a nonsens. Works only on a a few terminal types, it is not:
>       - portable,
>       - stable,
>       - usable,
>       - piece of good programming  looks like shit ...
...
>       - best: ncurses libraries.

I use ncurses too, but this response is crazy.

esc[H is an ansii standard, ncurses is a horribly nonstandard
port of ome earlier curses library.  Porting an ncurses program
to use another (probably better) version of curses is a pita.

Talk about program bloat!  Including curses just to clear the
screen.

Donald Arseneau                          [EMAIL PROTECTED]

------------------------------

From: Ricardo Lima <[EMAIL PROTECTED]>
Subject: DDD-3.3
Date: Wed, 25 Apr 2001 16:52:04 +0100

Hi,
I having some problems in compiling ddd-3.3 in an alphaev56-dec-osf
running Digital Unix 4.0E.
If this is not the appropriate email address for the next questions,
please tell me where should I submit this.

My questions are:
what compiler should I use? ( I have gcc-2.95 and the compiler from
digital)
What is the correct way of specifying the compiler?
Do I need to specify any specific options?

I already tried to compile, and doing:
./configure
make
I have this error during compilation:
c++ -DHAVE_CONFIG_H -I. -I. -I. -I./..     -DNDEBUG -O2 -g -W -Wall
-trigraphs  -c HelpCB.C
HelpCB.C: In function `void PopupTip(void *, XtIntervalId *)':
HelpCB.C:2166: Internal compiler error in `scan_region', at
except.c:2566
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport> for
instructions.
*** Exit 1
Stop.
*** Exit 1
Stop.

Thanks in advance four your help,

--
Ricardo Lima
Process Systems Engineering - Department of Chemical Engineering
& Institute for Systems and Robotics
Faculty of Engineering, University of Porto
Rua Dr. Roberto Frias, 4200-465 Porto, Portugal
Tel. + 351-22.508.1693  Fax + 351-22.508.1632




------------------------------

From: Ricardo Lima <[EMAIL PROTECTED]>
Subject: DDD - GDB - FORTRAN - Debug
Date: Thu, 26 Apr 2001 10:10:50 +0100

Hi,
I'm learning to use DDD with gdb to debug some fortran programs.
And I have this doubt:
When I'm at a breakpoint and I try to display the value of a variable I
got this error message:

No symbol "variable name" in current context.

why is this happening?
There are restrictions on the display of the variables?



--
Ricardo Lima
Process Systems Engineering - Department of Chemical Engineering
& Institute for Systems and Robotics
Faculty of Engineering, University of Porto
Rua Dr. Roberto Frias, 4200-465 Porto, Portugal
Tel. + 351-22.508.1693  Fax + 351-22.508.1632




------------------------------

Date: Wed, 2 May 2001 15:18:58 +0300
From: Neoklis <[EMAIL PROTECTED]>
Reply-To: Neoklis <[EMAIL PROTECTED]>
Subject: Variable-size multichoice menu for console app?

Hi!

I am working on a console ncurses application that will need to present
the user with a menu were the number of items is not fixed, and the user
will be able to select a number of items of his choice. More specifically,
the application will have to read a file containing orbital information
on a number of satellites and ask the user to select which satellites he
wants to keep track of. The data in the file has a fixed regular format,
one line with the satellite name followed by two lines of Keplerian 
elements, but the number of sets varies between different files.

I already have some code ready that can read all the names from the file,
so what I need is some method of presenting these to the user in a menu,
and then reading his choice from the menu. After this I have code ready
that 'cuts and pastes' the lines of Keplerian elements form the input file
into another 'active' file, when given the satellite names chosen.

I have some experience of ncurses displays and forms but this problem
had me somewhat baffled - I am still a newbie to Linux programming!

My thanks in advance!

-- 
Regards      My Ham Radio callsign: 5B4AZ
             My website (with some Linux software):
Neoklis      http://leonardo.spidernet.net/Copernicus/22420/


------------------------------

From: [EMAIL PROTECTED] ("v.naga srinivas")
Subject: Some include files of system oriented missed out how to get it 
back..........??
Date: Wed, 2 May 2001 12:41:43 +0000 (UTC)

Hi 
              I am using SuSe 6.3 linux. and general ping application source
i downloaded .. while compiling it.........in ping.c the header files resolv.h
and setjmp.h files it could't find... How to get the system oriented include 
files from CD rpms..Or am i have to load whole OS software..

Could any one help me out.......

thanks,
srinivas.
-- 
v.naga srinivas
YVL Software Consultancy,
B4,Q1,6th floor,CyberTowers,
Madhapur,Hi-Tec City,
Hyderabad-500033
Andhra Pradesh State,
INDIA.
Phone  : 091-040-3110200 ( off)
visitme: http://www.geocities.com/cheluvi         
 


-- 
Posted from ns.stph.net [196.12.32.2] 
via Mailgate.ORG Server - http://www.Mailgate.ORG

------------------------------

From: [EMAIL PROTECTED] (Michael Boehnisch)
Subject: SOLVED: static variable class constructors in shared libs
Date: 2 May 2001 12:51:58 GMT

Hi!

John Reiser ([EMAIL PROTECTED]) kindly provided the solution to my
problem that C++ constructors are not called for variables in shared
library files.

To cite from his posting:
>g++ must run the link step, too.  It runs a program 'collect2'

[Note: I used ld directly to do the link step.]

>which gathers the static intializers, and arranges for them to be
>called at the proper time.  Use "g++ -v" to watch the sub-exec.
> 
>-----
>$ g++ -fpic -c lib.cpp main.cpp
>$ g++ -shared -o liblib.so lib.o
>$ g++ -o main -L. -llib main.o
>$ export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
>$ ./main

This worked perfectly for me.  Thanks to John and all others who
replied to my request.

-- 
*** Michael Boehnisch ********************************* [EMAIL PROTECTED]

------------------------------

From: [EMAIL PROTECTED] (Dean Allen Provins)
Subject: 'make' and symbolic link problem: solved
Date: 2 May 2001 13:34:27 GMT

Hello:

Thanks for the pointers to the "link" problem.  Based on your
recommendations (unfortunately, I hit the wrong key, and deleted your
posts when I intended to send this follow-up), I did a find on "gcc"
and located an unexpected (and dead) link.

Once the link was removed, my Makefiles started to run again as expected.

I certainly appreciate the prompt and accurate responses to my posting.

Regards,

Dean Provins
Calgary

------------------------------

From: "Alex Ho" <[EMAIL PROTECTED]>
Subject: times() on Linux is returning strange numbers
Date: 02 May 2001 15:40:43 GMT

Pthreads on Linux is spawning a new process for each new thread created.  To
gather total CPU times for a process,  in my program, I do this:

                call times()
                fork a new process which spawns 10 threads, each of those
threads will spawn a new thread, totalling 20 threads
                wait for the process to finish
                call times()

Subtracting the results in the first times() from the second times() should
give me the exact cpu times of the new process (which should include all of
its dead children process, 20 of them in this example).  But, the total
returned in my program is smaller than what "top" shows.  For example, "top"
shows that each of 20 threads have used exactly 10 seconds when the process
finishes. I expect to get from times() at least 200 seconds.  Instead,
times() is giving me a number much smaller than 200.

Can anyone explain this?


Thanks in advance!

Best Regards
Alex



------------------------------

From: Floyd Davidson <[EMAIL PROTECTED]>
Subject: Re: Clear Screen on A program
Date: 02 May 2001 07:37:57 -0800

Donald Arseneau <[EMAIL PROTECTED]> wrote:
>Juergen Sauer <[EMAIL PROTECTED]> writes:
>
>> [...] Clear Screen Question
>> > Try printf("\033[H\033[2J")
>> 
>> What a nonsens. Works only on a a few terminal types, it is not:
>>      - portable,
>>      - stable,
>>      - usable,
>>      - piece of good programming  looks like shit ...
>...
>>      - best: ncurses libraries.
>
>I use ncurses too, but this response is crazy.
>
>esc[H is an ansii standard, ncurses is a horribly nonstandard
>port of ome earlier curses library.  Porting an ncurses program
>to use another (probably better) version of curses is a pita.

ANSI terminal escape sequences are standard only on ANSI
terminals, and may or may not work on any given terminal.
That is why TERMCAP and TERMINFO exist and should be used.

The standard *is* ncurses.  It would be more appropriate
to install ncurses rather than attempt to port an ncurses
program to a system with an older (which means certainly
worse) version of curses.

>Talk about program bloat!  Including curses just to clear the
>screen.

This statement is a matter of opinion, and though many
people disagree with it, I happen to agree.  It is quite
easy to use TERMCAP/TERMINFO without invoking (and having
to learn) the entire ncurses environment.  In the case of
only wanting to clear the screen,

    system("clear");

is about as simple as it gets.  And when a larger, but still
limited, set of terminal attributes is required it is still
easier, IMHO, to avoid invoking the entire ncurses environment
by just using TERMCAP/TERMINFO directly.  Below is an example of
code for a "clear" program.  Virtually any of the many terminal
control attributes can be coded up in the same way.

/*
 * clear.c   Clear the screen and home the cursor, 
 *           using TERMINFO database.
 *
 *  compile command:
 *
 *    gcc -O2 -Wall clear.c -lncurses -o clear
 *
 *    (Note, do NOT use either -ansi or -pedantic options 
 *    to gcc, as that will undefine several TERMINFO related
 *    items in the header files.)
 */

#include <stdio.h>
#include <stdlib.h>
#include <term.h>

void  cls(void);
void  init_terminal(void);
int   outputc(int);

char *progname;

int
main(int argc, char *argv[])
{
  progname = argv[0];
  init_terminal();
  cls();
  return EXIT_SUCCESS;
}

/*
 * home the cursor and clear to end of screen
 */
void
cls(void)
{
  tputs(clear_screen, 1, outputc);
}

/*
 * character output for tputs() only
 */
int
outputc(int c)
{
  fputc(c, stdout);
  return 1;
}

/*
 * set up the terminal
 */
void
init_terminal(void)
{
  char *term = getenv("TERM");
  int err_ret;

  if ( !term || ! *term) {
    fprintf(stderr,"%s: The TERM environment variable is not set.\n",
        progname);
    exit(4);
  }

  setupterm(term, 1, &err_ret);
  /* bsd would use err_ret = setterm(term); */

  switch (err_ret) {
  case -1:
    fprintf(stderr,"%s: Can't access terminfo database - ", progname);
    fprintf(stderr,"check TERMINFO environment variable\n");
    exit(3);
    break;
  case 0:
    fprintf(stderr, "%s: Can't find entry for terminal %s\n",
            progname, term);
    exit(2);
    break;
  case 1:
    break;
  default:
    fprintf(stderr, "%s:  Unknown tgetent return code %d\n",
            progname, err_ret);
    exit(1);
  }
}




-- 
Floyd L. Davidson         <http://www.ptialaska.net/~floyd>
Ukpeagvik (Barrow, Alaska)                 [EMAIL PROTECTED]

------------------------------

From: Dick Nic$$alls dicknickallscompuservecom <[EMAIL PROTECTED]>
Subject: Re: Linux & gnuplot Q
Date: 2 May 2001 17:24:14 GMT

Thanks Bill,

Yes - you were quite correct. Someone else kindly suggested the 
pause command, so I now have gnuplot working nicely :-)

cheers,
Dick

-- 
Dick Ni$$alls
[EMAIL PROTECTED]
Department of Anaesthesia, City Hospital, Nottingham, UK.

------------------------------

From: "Kelsey Bjarnason" <[EMAIL PROTECTED]>
Subject: Re: WWW: Linux Developer Network
Date: Wed, 02 May 2001 17:26:37 GMT

This is www.lidn.org you're talking about?  The site that's (as I'm typing
here, at least) down?  Better not be running Linux, or it's going to make
some of the Linzealots a little annoyed. :)

"prof. zonnebloem" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Very cool site man!!! I haven't seen any reference to it on the other
> big linux sites. Why don't you ask the people at kde.org to make a
> link to your site?
>
> Bye!
>
>
> On Sat, 21 Apr 2001 13:14:18 -0700, "Misha" <[EMAIL PROTECTED]>
> wrote:
>
> >This is a multi-part message in MIME format.
> >
> >------=_NextPart_000_002A_01C0CA64.F8B621C0
> >Content-Type: text/plain;
> > charset="iso-8859-1"
> >Content-Transfer-Encoding: quoted-printable
> >
> >Hi, I'm the editor and founder of the Linux Developer Network web page.
> >
> >I'm here to announce the web site in the website you find
> >    * Libraries
> >    * Tutorials
> >    * Guides
> >    * Manuals
> >
> >Of Linux platform libraries like:
> >    * GNOME
> >    * C/C++
> >    * PANGO
> >    * Corba
> >    * ...
> >
> >The fun part of this web site is that you access the different kind of
> >libraries like a File Manager for example:
> >    GNOME File Manager
> >
> >This web site is under GPL and an entire web site is available for =
> >download
> >so you can browse it off-line.
> >You can help the development of the web site, e-mail MiSHA for more
> >information.
> >
> >Thanks for the interest.
> >
> >Hector Rivera Falu (MiSHA)
> >Htttp://www.lidn.org
> >
> >
> >
> >------=_NextPart_000_002A_01C0CA64.F8B621C0
> >Content-Type: text/html;
> > charset="iso-8859-1"
> >Content-Transfer-Encoding: quoted-printable
> >
> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> ><HTML><HEAD>
> ><META http-equiv=3DContent-Type content=3D"text/html; =
> >charset=3Diso-8859-1">
> ><META content=3D"MSHTML 5.50.4207.2601" name=3DGENERATOR>
> ><STYLE></STYLE>
> ></HEAD>
> ><BODY bgColor=3D#ffffff>
> ><DIV>Hi, I'm the editor and founder of the Linux Developer Network web=20
> >page.<BR><BR>I'm here to announce the web site in the website you=20
> >find<BR>&nbsp;&nbsp;&nbsp; * Libraries<BR>&nbsp;&nbsp;&nbsp; *=20
> >Tutorials<BR>&nbsp;&nbsp;&nbsp; * Guides<BR>&nbsp;&nbsp;&nbsp; *=20
> >Manuals<BR><BR>Of Linux platform libraries like:<BR>&nbsp;&nbsp;&nbsp; *
=
> >
> >GNOME<BR>&nbsp;&nbsp;&nbsp; * C/C++<BR>&nbsp;&nbsp;&nbsp; *=20
> >PANGO<BR>&nbsp;&nbsp;&nbsp; * Corba<BR>&nbsp;&nbsp;&nbsp; * =
> >...<BR><BR>The fun=20
> >part of this web site is that you access the different kind =
> >of<BR>libraries like=20
> >a File Manager for example:<BR>&nbsp;&nbsp;&nbsp; GNOME File =
> >Manager<BR><BR>This=20
> >web site is under GPL and an entire web site is available for =
> >download<BR>so you=20
> >can browse it off-line.<BR>You can help the development of the web site,
=
> >e-mail=20
> >MiSHA for more<BR>information.<BR><BR>Thanks for the =
> >interest.<BR><BR>Hector=20
> >Rivera Falu (MiSHA)<BR>Htttp://www.lidn.org<BR><BR></DIV></BODY></HTML>
> >
> >------=_NextPart_000_002A_01C0CA64.F8B621C0--
> >
> >
>



------------------------------

From: Nate Eldredge <[EMAIL PROTECTED]>
Subject: Re: Clear Screen on A program
Date: 02 May 2001 10:43:55 -0700

Donald Arseneau <[EMAIL PROTECTED]> writes:

> Juergen Sauer <[EMAIL PROTECTED]> writes:
> 
> > [...] Clear Screen Question
> > > Try printf("\033[H\033[2J")
> > 
> > What a nonsens. Works only on a a few terminal types, it is not:
> >     - portable,
> >     - stable,
> >     - usable,
> >     - piece of good programming  looks like shit ...
> ...
> >     - best: ncurses libraries.
> 
> I use ncurses too, but this response is crazy.
> 
> esc[H is an ansii standard, 

And hence may only work on ANSI standard terminals.  That's not all of
them (though it does happen to include most of the ones currently in
use).

> ncurses is a horribly nonstandard
> port of ome earlier curses library.  Porting an ncurses program
> to use another (probably better) version of curses is a pita.

I don't know, seems to me that ncurses is in pretty wide use.  And
it's easy enough to install if you don't have it already.

> 
> Talk about program bloat!  Including curses just to clear the
> screen.

That's the price you pay for portability.

-- 

Nate Eldredge
[EMAIL PROTECTED]

------------------------------

From: "Cédric Willot" <[EMAIL PROTECTED]>
Subject: User <--> Kernel Space
Date: Wed, 2 May 2001 22:11:07 +0200

This is a simple problem between the user and the kernel space.
But I don't understand it ;-)
Can you help me please.
I use the 2.2.14.


The module's write function in the kernel space :

    ssize_t cp380_write (struct file *filp, const char *buf, size_t count,
loff_t *lof)
    {
         int data;

         printk ("\n\nCP380 : Writing in progress ...");

         get_user (data,buf);
         printk ("\nCP380 : The integer is : %d",data);

// The result is : The integer is : 0     !!!!!!!!!!

         return count;

    }

The main function in the user space is :

     char devname[]="/dev/cp380a";
     int numfich;
     long int buf;

     numfich=open(devname,O_RDWR)

     printf ("\nPROG  : The integer is ? : ");
     scanf ("%ld",&buf);

     printf ("\nPROG  : You entered      : %ld",buf);

     write(numfich,buf,sizeof(buf));

     close(numfich);

     return 0;



Thanks in advance,

ced







------------------------------

From: Chris Cox <[EMAIL PROTECTED]>
Subject: Re: Clear Screen on A program
Date: Wed, 02 May 2001 20:46:02 GMT

Donald Arseneau wrote:
> 
....
> I use ncurses too, but this response is crazy.

Only to a non-programmer.

> 
> esc[H is an ansii standard, ncurses is a horribly nonstandard
> port of ome earlier curses library.  Porting an ncurses program
> to use another (probably better) version of curses is a pita.

Can you identify the terminfo calls to get capability strings
that are non standard in ncurses??  Granted the main contention
is between termcap and terminfo based systems.... but probably
not as big a problem nowadays.

I've written code in the past that could compile on either
style of architecture.  Just as long as you get the terminal
capability string... who cares.

Others have already posted reasonable solutions using tput...
you could also get the string with tigetstr... regardless
utilizing the terminfo/termcap data is the right thing to
do under *ix.

> 
> Talk about program bloat!  Including curses just to clear the
> screen.

I guess you could always have the person close their eyes
and send a hundred or so line feeds...  that would be
pretty portable. :-)

> 
> Donald Arseneau                          [EMAIL PROTECTED]

------------------------------

From: [EMAIL PROTECTED] (Fred K Ollinger)
Subject: mozilla browser ID
Date: 2 May 2001 21:05:15 GMT


Does anyone know where in the mozilla source is the part that IDs the browser
when a web page asks.  I would like to change mine to windows and to ns 4.01.
Does anyone know where in that labrinth of code this is?  I tried to grep it
and I came up blank.  I want to do this b/c I don't want to be protected 
from myself when I try to run certain java applets.

Fred Ollinger


------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list by posting to the
comp.os.linux.development.apps newsgroup.

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Development-Apps Digest
******************************

Reply via email to