Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Dec C pecularity
@ 1999-06-09  4:00 Bernhard Reiter
  1999-06-11  4:00 ` Jeff Sullivan
  0 siblings, 1 reply; 18+ messages in thread
From: Bernhard Reiter @ 1999-06-09  4:00 UTC (permalink / raw)


While compiling mutt-0.95.6i on
	OSF1 V4.0 878 alpha
using 	DEC C V5.6-079 on Digital UNIX V4.0 (Rev. 878)
I encountered a difference between gnu c and Dec c.
Wheather this is a bug or not, I can't say, but at least it
is a pitfall.


Consider the following program, Dec C doesn't like the y definition:
	#include <stdio.h>

	char x[]="\
	Hi\n Here is more\n\
	Wolw\n";

	char y[]=("Hi there");

	int main(void){
		printf("%s",x);
		return 0;
	}

alpha1 mutt-0.95.6 166: gcc -pedantic -ansi -Wall probe.c
alpha1 mutt-0.95.6 167: cc probe.c
cc: Warning: probe.c, line 7: In the initializer for y[0], "("Hi there")" has a
larger data size than "signed char".  Assignment may result in data loss.
char y[]=("Hi there");
---------^
cc: Warning: probe.c, line 7: In the initializer for y[0], "("Hi there")" of typ
e "pointer to signed char", is being converted to "signed char".
char y[]=("Hi there");
---------^
cc: Error: probe.c, line 7: In the static initialization, the address cannot be
converted to the destination type.
char y[]=("Hi there");
---------^
alpha1 mutt-0.95.6 168: cc -std1 probe.c
cc: Error: probe.c, line 7: In the initializer for y a required set of braces is
 missing.
char y[]=("Hi there");
---------^

Cheers,
	Bernhard

-- 
Research Assistant, Geog Dept UM-Milwaukee, USA.         (www.uwm.edu/~bernhard)
Funding/Promoting Association for a Free Informational Infrastructure (ffii.org)



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-06-09  4:00 Dec C pecularity Bernhard Reiter
@ 1999-06-11  4:00 ` Jeff Sullivan
  1999-06-13  4:00   ` Tobias Ernst
  0 siblings, 1 reply; 18+ messages in thread
From: Jeff Sullivan @ 1999-06-11  4:00 UTC (permalink / raw)


Thanks for reporting this "pecularity". The test case reduces to:

#include <stdio.h>

char y[]=("Hi there");

int main(void)
{
  printf("%s\n", y);
  return 0;
}

We have modified the compiler to accept this in all compilation
modes for future versions of Compaq C (formerly DEC C). The
first version of the compiler with this change will be available
in the upcoming Developers' Toolkit compiler. It will also be
available in Tru64 UNIX V4.0G and V5.0x.

See http://www.unix.digital.com/developerstoolkit/ for further
information on the Developers' Toolkit for Tru64 UNIX.

-Jeff
-- 
Jeff Sullivan | Compaq Computer Corp  |   mailto:jps@zk3.dec.com
Compaq C/C++  | Nashua, NH  ZK3-2X23  | Jeff.Sullivan@compaq.com



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-06-11  4:00 ` Jeff Sullivan
@ 1999-06-13  4:00   ` Tobias Ernst
  1999-06-14  4:00     ` Peter da Silva
  1999-06-22  4:00     ` Jeff Sullivan
  0 siblings, 2 replies; 18+ messages in thread
From: Tobias Ernst @ 1999-06-13  4:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 803 bytes --]

Hello,

seeing that you really seem to care about removing Dec C peculiarities, there
is another one which has bothered me numerous times:

  #include <stdio.h>
  int main(void)
  {
      printf ("\x1B[2JThe screen is cleared.\n");
      return 0;
  }

Gnu C can recognise "\x1B" as a way of encoding the character with
charactercode 0x1B (27, the escape character, here used to produce an
ANSI/VT100 sequence to clear the screen) into the string. Numerous other
compilers (esp. in the Dos/Windows world) also do. Dec C won�t, and the
problem is that Dec C does not even give a warning, so programs that use it
may fail very subtly at run time. The way to code the above sequence on Dec C
is to use octal notation, "\033", or to use %c and give the desired number as
argument.

Regards,
Tobias.







^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-06-13  4:00   ` Tobias Ernst
@ 1999-06-14  4:00     ` Peter da Silva
  1999-06-26  4:00       ` Tobias Ernst
  1999-06-22  4:00     ` Jeff Sullivan
  1 sibling, 1 reply; 18+ messages in thread
From: Peter da Silva @ 1999-06-14  4:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]

In article <87hfocxypx.fsf@romulus.bland.fido.de>,
Tobias Ernst  <tobi@bland.fido.de> wrote:
>Gnu C can recognise "\x1B" as a way of encoding the character with
>charactercode 0x1B

Since \033 (which you do know about) takes the same number of characters
as \x1b, and has the advantage of actually being C rather than some
extension, why not use that?

Though IMO a more correct way to code that is:

#include <stdio.h>
#include <curses.h>

char tbuf[1024];

int main(int ac, char **av)
{
	char *term = getenv("TERM");
	if(!term) {
		fprintf(stderr, "%s: TERM type not known.\n", av[0]);
		return 2;
	}
	switch(tgetent(tbuf, term)) {
	    case 0:
		fprintf(stderr, "%s: %s not found.\n", av[0], term);
		return 2;
	    case -1:
		fprintf(stderr, "%s: Can't open TERM database.\n", av[0]);
		return 2;
	}
	cl = tgetstr(tbuf, "cl");
	if(!cl) {
		fprintf(stderr, "%s: %s does not have clear screen.\n", av[0]);
		return 2;
	}
	printf("%sThe screen is cleared.\n", cs);
	return 0;
}

-- 
In hoc signo hack, Peter da Silva <peter@baileynm.com>
 `-_-'   Ar rug t� barr�g ar do mhact�re inniu? 
  'U`    "Be vewy vewy quiet...I'm hunting Jedi." -- Darth Fudd




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-06-13  4:00   ` Tobias Ernst
  1999-06-14  4:00     ` Peter da Silva
@ 1999-06-22  4:00     ` Jeff Sullivan
  1999-06-22  4:00       ` Jeff Sullivan
  1 sibling, 1 reply; 18+ messages in thread
From: Jeff Sullivan @ 1999-06-22  4:00 UTC (permalink / raw)


Tobias Ernst wrote:

> seeing that you really seem to care about removing Dec C peculiarities, there
> is another one which has bothered me numerous times:
> 
>   #include <stdio.h>
>   int main(void)
>   {
>       printf ("\x1B[2JThe screen is cleared.\n");
>       return 0;
>   }

In the program above, the difference is that \x escape sequences are
not recognised in "common" (or "K&R") mode. If compiled in one of the
ANSI modes: -std (Relaxed ANSI) or -std1 (Strict ANSI), you will see
the "expected" result using DEC C (now Compaq C).

> Gnu C can recognise "\x1B" as a way of encoding the character with
> charactercode 0x1B (27, the escape character, here used to produce an
> ANSI/VT100 sequence to clear the screen) into the string. Numerous other
> compilers (esp. in the Dos/Windows world) also do. Dec C won�t, ...

Yes, the difference here is that DEC C in UNIX V4.0x defaults to
-std0 ("common" or "K&R") mode. Compilers in UNIX V5.0 and later,
as well as our Developers' Toolkit compiler will default to -std.
As such, you would get the "expected" results by default using
any of the newer compilers.

You can change your default locally by changing the "comp.config"
file in /usr/lib/cmplrs/cc. This is described in the cc(1) man page.

> and the problem is that Dec C does not even give a warning, so programs
> that use it may fail very subtly at run time.

You can enable a message for this by adding -w0, which tells the
compiler to turn on informational messages. See below:

% cc -std0 t.c -w0    
cc: Info: t.c, line 6: An undefined escape sequence was encountered; the
backslash is being ignored. (undefescap)
    printf ("\x1B[2JThe screen is cleared.\n");
--------------^

I hope this helps answer your questions.
Feel free to let us know about other "peculiarities"!

-Jeff
-- 
Jeff Sullivan | Compaq Computer Corp  |   mailto:jps@zk3.dec.com
Compaq C/C++  | Nashua, NH  ZK3-2X23  | Jeff.Sullivan@compaq.com



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-06-22  4:00     ` Jeff Sullivan
@ 1999-06-22  4:00       ` Jeff Sullivan
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Sullivan @ 1999-06-22  4:00 UTC (permalink / raw)


Tobias Ernst wrote:

> Gnu C can recognise "\x1B" as a way of encoding the character with
> charactercode 0x1B (27, the escape character, here used to produce an
> ANSI/VT100 sequence to clear the screen) into the string. 

I should also note that gcc does not produce your "expected" results for
this program in it's "-traditional" (equivalent to DEC C's -std0) mode.

% gcc -traditional t.c ; a.out
x1B[2JThe screen is cleared.

Also, fwiw, I was not able to #include <stdio.h> and compile using
gcc -traditional on my system. Your mileage may vary...

-Jeff
-- 
Jeff Sullivan | Compaq Computer Corp  |   mailto:jps@zk3.dec.com
Compaq C/C++  | Nashua, NH  ZK3-2X23  | Jeff.Sullivan@compaq.com



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-06-14  4:00     ` Peter da Silva
@ 1999-06-26  4:00       ` Tobias Ernst
  1999-06-29  4:00         ` Charles M Richmond
  1999-07-14  4:00         ` T.E.Dickey
  0 siblings, 2 replies; 18+ messages in thread
From: Tobias Ernst @ 1999-06-26  4:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2261 bytes --]

peter@baileynm.com (Peter da Silva) writes:

> Since \033 (which you do know about) takes the same number of characters
> as \x1b, and has the advantage of actually being C rather than some
> extension, why not use that?

People tend to use \x1b instead of \033 because a little more advanced
programmers usually know hexadecimal codes by heart, while they have to
calculate the octal ones manually. I personally tend to like compilers that
understand \x.. because they give me less trouble when I take over code from
someone else that has been using \x... In my current code I changed all
occurences of hexadecimal codes to octal ones, but it was not the most
pleasant kind of work.

BTW, Jeff Sullivan has pointed out to me that DEC cc can handle \x... when
using the -std or -std1 option.

> 	cl = tgetstr(tbuf, "cl");

I know that this method is more clean in theory. It also works very well if
you restrict yourself on using simple things like clear screen and move the
cursor. However, I made the experiences that especially on countless Linux
installations, but also on some commercial boxes like AIX, tgetstr tells you
lot of very advanced commands that it thinks the terminal understands, which
actually the terminal doesn�t understand. The result is that text-based
applications that are written "more cleanly" in theory actually do not work
like the users expects. 

Therefore, I decided for some procjects to ignore termcap and use the plain
ANSI X3.64 (ISO 6429) command set, or to be more exactly that subpart of it
that even runs on a VT52. This is not so clean in theory as it will not run
on some terminals that use totally different command strings, but in praxis
it will run better for most users.

Another reason I sometimes use these codes is that such programs can be
ported over to systems that do not have a termcap by default, like DOS,
Windows and OS/2, and will work instantly.

However this is not always an option; the subset that can sefely be used is
very small and not very powerful, so sometimes the program gets too slow
because it has to emulate advnanced functions with very basic commands. If
this becomes a problem I also resort to using termcap.

But I guess this is getting off-topic here ;-).

Kind Regards,
Tobias.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-06-26  4:00       ` Tobias Ernst
@ 1999-06-29  4:00         ` Charles M Richmond
  1999-07-13  4:00           ` Tobias Ernst
  1999-07-14  4:00         ` T.E.Dickey
  1 sibling, 1 reply; 18+ messages in thread
From: Charles M Richmond @ 1999-06-29  4:00 UTC (permalink / raw)


Tobias Ernst wrote:
> 
> peter@baileynm.com (Peter da Silva) writes:
> 
> > Since \033 (which you do know about) takes the same number of characters
> > as \x1b, and has the advantage of actually being C rather than some
> > extension, why not use that?
> 
> People tend to use \x1b instead of \033 because a little more advanced
> programmers usually know hexadecimal codes by heart, while they have to
> calculate the octal ones manually. 

It is my opinion that "more advanced programmers" do not even notice 
a difference between \x1b and \033. I am astounded at the thought of 
a need to "calculate the octal ones manually" 

> I personally tend to like compilers that
> understand \x.. because they give me less trouble when I take over code from
> someone else that has been using \x... In my current code I changed all
> occurences of hexadecimal codes to octal ones, but it was not the most
> pleasant kind of work.
> 
> BTW, Jeff Sullivan has pointed out to me that DEC cc can handle \x... when
> using the -std or -std1 option.

So now you know that the compiler does exactly what you want and that some
basic RTFM would have shown that your "Dec C pecularity" was just K&R mode,
the same mode as provided by -traditional in gcc.

> 
> >       cl = tgetstr(tbuf, "cl");
> 
> I know that this method is more clean in theory. It also works very well if
> you restrict yourself on using simple things like clear screen and move the
> cursor. However, I made the experiences that especially on countless Linux
> installations, but also on some commercial boxes like AIX, tgetstr tells you
> lot of very advanced commands that it thinks the terminal understands, which
> actually the terminal doesn't understand. The result is that text-based
> applications that are written "more cleanly" in theory actually do not work
> like the users expects. 

It would be fun to play with some examples. Would you please provide 
some. On at least one major vendor, I have the ability to file internal 
bugs and escalations and if there is something broken then lets get it
fixed. The Linux and FSF communities feel the same. If things are broken
then lets work on fixing them.

Charlie

-- 
***********************************************************************
*  Charles Richmond    Integrated International Systems Corporation   *
*  cmr@iisc.com           cmr@acm.org        cmr@shore.net            *
*  UNIX Internals, I18N, L10N, X, Realtime Imaging, and  Custom S/W   *
*  One Longfellow Place Suite 3309 , Boston , Ma. USA 02114-2431      *
*  (617) 723 7695    FAX (617) 723 6861    Remote (617) 504 3379      *
***********************************************************************



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-06-29  4:00         ` Charles M Richmond
@ 1999-07-13  4:00           ` Tobias Ernst
  1999-07-13  4:00             ` Charles M Richmond
                               ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Tobias Ernst @ 1999-07-13  4:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2630 bytes --]


Hallo!

> It is my opinion that "more advanced programmers" do not even notice 
> a difference between \x1b and \033. I am astounded at the thought of 
> a need to "calculate the octal ones manually" 

Now I don�t really want to discuss about this. Of course a good programmer
has no problems with either octal nor hexadcimal. What I meant to ay is that
I often have to work with code from "not so good" programmers that use hex - if
at all - because they know it better than octal. This simply is an empirical
fact from the code that I have to handle, or should I say "clean up". But
this discussion leads to nowhere, so let�s quit it :-).

> So now you know that the compiler does exactly what you want and that some
> basic RTFM would have shown that your "Dec C pecularity" was just K&R mode,
> the same mode as provided by -traditional in gcc.

Please be careful about accusing others not having done basic RTFM. The
manpage of cc on our system says that "-std" is the default for cc, while
actually the given example of code works if I specify -std, but it doesn�t if
it don�t.

> It would be fun to play with some examples. Would you please provide 
> some. On at least one major vendor, I have the ability to file internal 
> bugs and escalations and if there is something broken then lets get it
> fixed. The Linux and FSF communities feel the same. If things are broken
> then lets work on fixing them.

Compile the current ncurses release on OSF/1 (4.0e) and run the testcase as
described in the installation instructions. You will see that some tests
fail. The consequence clearly is that some programs that need ncurses will of
course also misbehave. At least this was the case when my colleague installed
ncurses the last time.

Or compile jmacs on NetBSD/Alpha with the NetBSD package and try to run it on
a VT100 attached to the serial console.

These are just the two examples that come to my mind at once. If you need
more, just grab any Unix newbie that has been using DOS, Windows, OS/2 or
Macintosh previously. Any such person will surely tell you a lot of
experiences he had with Unix console application. We Unix "experts" (err...)
usually do not note these problems as hard because we have long ago reverted
to saying things like ESC:wq because that will always work on any console.

But a new Unix user who is accustomed to the fact that all keys on the
keyboard do what is printed onto them or at least do not do any harm if they
do work will definitely have troubles on Unix. And I don�t think that this
will ever get fixed if it hasn�t been fixed until now. 

Kind Regards,
Tobias.








^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-07-13  4:00           ` Tobias Ernst
@ 1999-07-13  4:00             ` Charles M Richmond
  1999-07-13  4:00             ` Kevin Oberman
  1999-07-14  4:00             ` T.E.Dickey
  2 siblings, 0 replies; 18+ messages in thread
From: Charles M Richmond @ 1999-07-13  4:00 UTC (permalink / raw)


Tobias Ernst wrote:
> Please be careful about accusing others not having done basic RTFM. 
> The manpage of cc on our system says that "-std" is the default for 
> cc, while actually the given example of code works if I specify 
> -std, but it doesn't if it don't.

In the older man page one finds:
Man cc
...
...
-std[n]
   Directs the compiler to produce warnings for language constructs that
   are not standard in the language. The default is -std0.

   The following values are accepted:

   -std
       Enforces the ANSI C standard, but allows some common programming
       practices disallowed by the standard. The -std flag causes the
       macro __STDC__=0 to be passed to the preprocessor.

   -std0
       Enforces the K & R programming style, with certain ANSI extensions
       in areas where the K & R behavior is undefined or ambiguous.  In
       general, -std0 compiles most pre-ANSI C programs and produces
       expected results. The -std0 flag causes the __STDC__ macro to be
       undefined.
...
...

While on the newer man page it leaps off of the first screen with:
cc(1)                                                                  
cc(1)

NAME

  cc - C compiler

SYNOPSIS

  cc [-newc] [flag ...] file ...
  cc -oldc [flag ...] file ...
  cc -migrate [flag ...] file ...

  Default Flags:

  cc -newc -assume aligned_objects -cpp -call_shared -double -fprm n -fptm
n
  -g0 -I/usr/include -inline manual -member_alignment -no_fp_reorder
  -no_misalign -object -O1 -oldcomment -p0 -no_pg -preempt_symbol -signed
  -arch generic -std0 -tune generic -writable_strings

                                        Note
       In a future release of DIGITAL UNIX, the default DEC C language-mode
       flag will be changed from -std0 (K&R programming style, pre-ANSI C
       standard) to -std (ANSI C standard - with some relaxations). 

*********

So yes.... RTFM
-- 
***********************************************************************
*  Charles Richmond    Integrated International Systems Corporation   *
*  cmr@iisc.com           cmr@acm.org        cmr@shore.net            *
*  UNIX Internals, I18N, L10N, X, Realtime Imaging, and  Custom S/W   *
*  One Longfellow Place Suite 3309 , Boston , Ma. USA 02114-2431      *
*  (617) 723 7695    FAX (617) 723 6861    Remote (617) 504 3379      *
***********************************************************************



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-07-13  4:00           ` Tobias Ernst
  1999-07-13  4:00             ` Charles M Richmond
@ 1999-07-13  4:00             ` Kevin Oberman
  1999-07-14  4:00             ` T.E.Dickey
  2 siblings, 0 replies; 18+ messages in thread
From: Kevin Oberman @ 1999-07-13  4:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]

Tobias Ernst <tobi@bland.fido.de> writes:

> Please be careful about accusing others not having done basic RTFM. The
> manpage of cc on our system says that "-std" is the default for cc, while
> actually the given example of code works if I specify -std, but it doesn�t if
> it don�t.

Odd. What release of Tru64 are you running? I don't have a 4.0f system 
handy, but 4.0a-4.0e all have the following in their man pages:

  -std[n]
      Directs the compiler to produce warnings for language constructs that
      are not standard in the language. The default is -std0.

Further, in at least later releases I find (in a friendly note right
at the top of the man page):
                                        Note
       In a future release of DIGITAL UNIX, the default DEC C language-mode
       flag will be changed from -std0 (K&R programming style, pre-ANSI C
       standard) to -std (ANSI C standard - with some relaxations).  The most
       notable difference in compiling with -std instead of -std0 will be an
       increased number of diagnostic messages.

Compaq has announced that the "future release" will be 5.0.

-- 
R. Kevin Oberman, Network Engineer
Energy Sciences Network (ESnet)
Ernest Orlando Lawrence Berkeley National Laboratory (Berkeley Lab)
E-mail: oberman@es.net				Phone: +1 510 486-8634



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-07-13  4:00           ` Tobias Ernst
  1999-07-13  4:00             ` Charles M Richmond
  1999-07-13  4:00             ` Kevin Oberman
@ 1999-07-14  4:00             ` T.E.Dickey
  1999-07-15  4:00               ` libcurses and patches for 4.0 jhitchcock
  1999-07-16  4:00               ` Dec C pecularity Tobias Ernst
  2 siblings, 2 replies; 18+ messages in thread
From: T.E.Dickey @ 1999-07-14  4:00 UTC (permalink / raw)


Tobias Ernst <tobi@bland.fido.de> wrote:

> Compile the current ncurses release on OSF/1 (4.0e) and run the testcase as
> described in the installation instructions. You will see that some tests
> fail. The consequence clearly is that some programs that need ncurses will of
> course also misbehave. At least this was the case when my colleague installed
> ncurses the last time.

I don't recall a bug report - can you be a little more specific?

The current version of ncurses is 4.2 (5.0 in beta)
There's an faq at
	http://www.clark.net/pub/dickey/ncurses/ncurses.faq.html

-- 
Thomas E. Dickey
dickey@clark.net
http://www.clark.net/pub/dickey



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-06-26  4:00       ` Tobias Ernst
  1999-06-29  4:00         ` Charles M Richmond
@ 1999-07-14  4:00         ` T.E.Dickey
  1 sibling, 0 replies; 18+ messages in thread
From: T.E.Dickey @ 1999-07-14  4:00 UTC (permalink / raw)


Tobias Ernst <tobi@bland.fido.de> wrote:

> Therefore, I decided for some procjects to ignore termcap and use the plain
> ANSI X3.64 (ISO 6429) command set, or to be more exactly that subpart of it
> that even runs on a VT52. This is not so clean in theory as it will not run
> on some terminals that use totally different command strings, but in praxis
> it will run better for most users.

VT52 predates ANSI X3.64, and I believe does not comply with this standard.
(It certainly does not comply with ISO 6429).

Perhaps you mean VT100 (there is a difference - the latter uses CSI and SS3
to initiate control and escape sequences):

vt52|dec vt52:\
	:bs:pt:\
	:co#80:it#8:li#24:kn#2:\
	:bl=^G:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :cr=\r:\
	:do=\n:kb=\b:kd=\EB:kl=\ED:kr=\EC:ku=\EA:le=\b:nd=\EC:\
	:sf=\n:sr=\EI:ta=\t:up=\EA:ko=nd,up:

vt100|vt100-am|dec vt100 (w/advanced video):\
	:am:mi:ms:xn:xo:bs:pt:\
	:co#80:it#8:li#24:vt#3:\
	:@8=\EOM:DO=\E[%dB:K1=\EOq:K2=\EOr:K3=\EOs:K4=\EOp:\
	:K5=\EOn:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:\
	:ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\
	:ae=^O:as=^N:bl=^G:cb=3\E[1K:cd=50\E[J:ce=3\E[K:\
	:cl=50\E[H\E[J:cm=5\E[%i%d;%dH:cr=\r:cs=\E[%i%d;%dr:\
	:ct=\E[3g:do=\n:eA=\E(B\E)0:ho=\E[H:k0=\EOy:k1=\EOP:\
	:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\EOt:k6=\EOu:k7=\EOv:\
	:k8=\EOl:k9=\EOw:k;=\EOx:kb=\b:kd=\EOB:ke=\E[?1l\E>:\
	:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=\b:mb=2\E[5m:\
	:md=2\E[1m:me=2\E[m^O:mr=2\E[7m:nd=2\E[C:\
	:r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:\
	:sc=\E7:se=2\E[m:sf=\n:so=2\E[1;7m:sr=5\EM:st=\EH:\
	:ta=\t:ue=2\E[m:up=2\E[A:us=2\E[4m:

-- 
Thomas E. Dickey
dickey@clark.net
http://www.clark.net/pub/dickey



^ permalink raw reply	[flat|nested] 18+ messages in thread

* libcurses and patches for 4.0
  1999-07-14  4:00             ` T.E.Dickey
@ 1999-07-15  4:00               ` jhitchcock
  1999-07-16  4:00                 ` T.E.Dickey
  1999-08-10  4:00                 ` b_andreasen
  1999-07-16  4:00               ` Dec C pecularity Tobias Ernst
  1 sibling, 2 replies; 18+ messages in thread
From: jhitchcock @ 1999-07-15  4:00 UTC (permalink / raw)


There are a lot of patches to libcurses available
for 4.0, but it seems that
the libraries are in general incompatible with
one another.

We have a program that was built on 4.0D (without
any patches) and it runs
OK on that system.  When run on a patched 4.0D it
fails with "error -1 bad
termcap".  When run on 4.0E it core dumps.

Can anyone suggest how we can get a library on
patched 4.0D, 4.0E, 4.0F,
... systems which is compatible with the original
4.0D library.  Or does
anyone know which is the "correct" library to
link with to enable use on
future systems.

The program is linked using the default shared
library (-lcurses) and it
uses tgetent(), tgetflag(), tgetnum() and tgetstr
() to get capabilities:

am bs hs mi ms pt xs sg ug li co ws
ae al as bc bt cd ce cl cm cs dc dl dm do ed ei
fs ho ic im le ll nd se sf
so sr te ti
ts uc ue up us vb ke ks ve vi bt kd kh kl kr ku CC
k[0-9] K[0-9] l[0-9] L[0-9]

(I know these functions are marked "TO BE
WITHDRAWN" in the Single UNIX
Specification, but they are there, and they work
on almost all Unixes.)

The patches I know of are:
Digital UNIX 4.0D patches 374.00 374.03 408.02
Digital UNIX 4.0E patches 31.00 123.00 277.00
278.00
Tru64 UNIX 4.0F patches 46.00 69.00

Thanks,

Jon Hitchcock
Uniplex Ltd, 126 Hempstead Road, Kings Langley,
Herts, WD4 8AL, U.K.
E-mail Jon.Hitchcock@uniplex.co.uk, Tel +44 (0)
1923 299718, Fax +44 (0)
1923 299700



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: libcurses and patches for 4.0
  1999-07-15  4:00               ` libcurses and patches for 4.0 jhitchcock
@ 1999-07-16  4:00                 ` T.E.Dickey
  1999-08-10  4:00                 ` b_andreasen
  1 sibling, 0 replies; 18+ messages in thread
From: T.E.Dickey @ 1999-07-16  4:00 UTC (permalink / raw)


jhitchcock@my-deja.com wrote:

> We have a program that was built on 4.0D (without
> any patches) and it runs
> OK on that system.  When run on a patched 4.0D it
> fails with "error -1 bad
> termcap".  When run on 4.0E it core dumps.

I assume you cannot recompile the original program?  If you could, you
could try using ncurses, which also has a terminfo/termcap emulation - if
not, I wouldn't advise that...

> Can anyone suggest how we can get a library on
> patched 4.0D, 4.0E, 4.0F,
> ... systems which is compatible with the original
> 4.0D library.  Or does
> anyone know which is the "correct" library to
> link with to enable use on
> future systems.

-- 
Thomas E. Dickey
dickey@clark.net
http://www.clark.net/pub/dickey



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-07-14  4:00             ` T.E.Dickey
  1999-07-15  4:00               ` libcurses and patches for 4.0 jhitchcock
@ 1999-07-16  4:00               ` Tobias Ernst
  1999-07-18  4:00                 ` T.E.Dickey
  1 sibling, 1 reply; 18+ messages in thread
From: Tobias Ernst @ 1999-07-16  4:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1285 bytes --]

Hallo!

>> Compile the current ncurses release on OSF/1 (4.0e) and run the testcase as
>> described in the installation instructions. You will see that some tests
>> fail. 

> I don't recall a bug report - can you be a little more specific?

My colleague who experienced this configured ncurses 4.2 with

  ./configure --without-progs --with-termlib --with-shared --enable-termcap

After the build is finished, one can enter the test subdirectory and run
"testcurs� in an xterm. When selecting the "pad test" menu item, I get the
following output:


 This is a new pad
                                                    +----------
                                                    |
The end of this line should be truncated here:except| This is a
                                                    |
  Press any key to continue                         |
 This line should not appear.It will now            |
                                                    |
                                                    |
                                                    |
                                                    |

I truncated the right side so as to keep within 73 columns, but the left side
learly looks as if something is not working.

Kind Regards,
Tobias.








^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Dec C pecularity
  1999-07-16  4:00               ` Dec C pecularity Tobias Ernst
@ 1999-07-18  4:00                 ` T.E.Dickey
  0 siblings, 0 replies; 18+ messages in thread
From: T.E.Dickey @ 1999-07-18  4:00 UTC (permalink / raw)


Tobias Ernst <tobi@bland.fido.de> wrote:

> After the build is finished, one can enter the test subdirectory and run
> "testcurs� in an xterm. When selecting the "pad test" menu item, I get the
> following output:

no - actually ncurses is doing the right thing, afaik.   "testcurs" is
a program from PDCurses, whose maintainer seems happy with this test.
I've made some maintenance changes to ncurses' copy, but have left the
overall appearance like PDCurses just to make it simple to compare.

You may be able to compile the tests using the vendor's curses by using
autoconf to generate the configure script in the test directory, then
configuring against curses there.  (I do this occasionally with Solaris).
If you do that (and don't run into problems with the test/configure),
I'd expect to see the same behavior from OSF1 curses.

	cd test
	autoconf
	./configure
	make testcurs

(Some of the tests assume you have the menus and forms libraries, which
iirc, OSF1 doesn't have - that's SCO and Solaris).

>  This is a new pad
>                                                     +----------
>                                                     |
> The end of this line should be truncated here:except| This is a
>                                                     |
>   Press any key to continue                         |
>  This line should not appear.It will now            |
>                                                     |
>                                                     |
>                                                     |
>                                                     |

> I truncated the right side so as to keep within 73 columns, but the left side
> learly looks as if something is not working.

> Kind Regards,
> Tobias.






-- 
Thomas E. Dickey
dickey@clark.net
http://www.clark.net/pub/dickey



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: libcurses and patches for 4.0
  1999-07-15  4:00               ` libcurses and patches for 4.0 jhitchcock
  1999-07-16  4:00                 ` T.E.Dickey
@ 1999-08-10  4:00                 ` b_andreasen
  1 sibling, 0 replies; 18+ messages in thread
From: b_andreasen @ 1999-08-10  4:00 UTC (permalink / raw)


After working with Jon on this we have isolated the problem and I
thought that posting the results would be beneficial to other developers
as well.  I tried to post this reply yesterday, but somehow I goofed
since I don't see it, but if this is a second, please excuse the
redundancy.

In debugging the application Jon mentioned, it was found that the segv
was occurring in the application code, when it tried to write to an
invalid address.  Further investigation found that address was
expected to be to a global application variable, but the variable
involved was also declared as a global variable with a similar
definition in the curses library.  While the application source code
included a definition for the pointer, the linker and loader had
resolved the address to be in the library memory allocation.

After some research we learned that during compilation, the linker
categorizes each variable.  In the general case, the linker, when it
finds new declarations will allocate space in the local memory region
and categorize the variable as an 'allocated common' (odump -Dtv
libcurses.so).  When the curses library was built, this variable was
unique and therefore generated an allocated region and became a GLOBAL
ACOMM.  However, when the linker finds an existing entry for
a new variable (from a library), it does not do the
allocation, and enters the variable as a simple common (COMM) and uses
the offset to the existing allocated space from the ACOMM variable
(odump -Dgv <app.obj>).

Previous versions of the libcurses.so ignored this violation, and
fortunately functioned correctly, but the updated library versions
blocked this violation and uncovered the memory overwrite, causing the
application to segv.

Since the specification for the curses interface indicates that certain
variable names are reserved for the library implementation (this
variable falls into that category), the solution is rename the
application variable or force the local application declaration to do an
allocation in the application data space by including an assignment in
the declaration
  i.e. char *BC=NULL;
This will cause the linker to classify the variable as DATA and place it
in the application DATA space.  When the loader encounters the variable,
as data, it will use the local memory storage instead of writing to the
library memory area.
-b

In article <7ml487$lbg$1@nnrp1.deja.com>,
  jhitchcock@my-deja.com wrote:
> There are a lot of patches to libcurses available
> for 4.0, but it seems that
> the libraries are in general incompatible with
> one another.
>
> We have a program that was built on 4.0D (without
> any patches) and it runs
> OK on that system.  When run on a patched 4.0D it
> fails with "error -1 bad
> termcap".  When run on 4.0E it core dumps.
>
> Can anyone suggest how we can get a library on
> patched 4.0D, 4.0E, 4.0F,
> ... systems which is compatible with the original
> 4.0D library.  Or does
> anyone know which is the "correct" library to
> link with to enable use on
> future systems.
>
> The program is linked using the default shared
> library (-lcurses) and it
> uses tgetent(), tgetflag(), tgetnum() and tgetstr
> () to get capabilities:
>
> am bs hs mi ms pt xs sg ug li co ws
> ae al as bc bt cd ce cl cm cs dc dl dm do ed ei
> fs ho ic im le ll nd se sf
> so sr te ti
> ts uc ue up us vb ke ks ve vi bt kd kh kl kr ku CC
> k[0-9] K[0-9] l[0-9] L[0-9]
>
> (I know these functions are marked "TO BE
> WITHDRAWN" in the Single UNIX
> Specification, but they are there, and they work
> on almost all Unixes.)
>
> The patches I know of are:
> Digital UNIX 4.0D patches 374.00 374.03 408.02
> Digital UNIX 4.0E patches 31.00 123.00 277.00
> 278.00
> Tru64 UNIX 4.0F patches 46.00 69.00
>
> Thanks,
>
> Jon Hitchcock
> Uniplex Ltd, 126 Hempstead Road, Kings Langley,
> Herts, WD4 8AL, U.K.
> E-mail Jon.Hitchcock@uniplex.co.uk, Tel +44 (0)
> 1923 299718, Fax +44 (0)
> 1923 299700
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~1999-08-10  4:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-06-09  4:00 Dec C pecularity Bernhard Reiter
1999-06-11  4:00 ` Jeff Sullivan
1999-06-13  4:00   ` Tobias Ernst
1999-06-14  4:00     ` Peter da Silva
1999-06-26  4:00       ` Tobias Ernst
1999-06-29  4:00         ` Charles M Richmond
1999-07-13  4:00           ` Tobias Ernst
1999-07-13  4:00             ` Charles M Richmond
1999-07-13  4:00             ` Kevin Oberman
1999-07-14  4:00             ` T.E.Dickey
1999-07-15  4:00               ` libcurses and patches for 4.0 jhitchcock
1999-07-16  4:00                 ` T.E.Dickey
1999-08-10  4:00                 ` b_andreasen
1999-07-16  4:00               ` Dec C pecularity Tobias Ernst
1999-07-18  4:00                 ` T.E.Dickey
1999-07-14  4:00         ` T.E.Dickey
1999-06-22  4:00     ` Jeff Sullivan
1999-06-22  4:00       ` Jeff Sullivan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox