BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

strings.h needed but nowhere to be found

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Command Line Tools)
View previous topic :: View next topic  
Author Message
Randy Stonesifer
Guest





PostPosted: Fri May 27, 2005 1:06 pm    Post subject: strings.h needed but nowhere to be found Reply with quote



I am porting a unix C program to Windows. It wants to include strings.h. I
find no strings.h anywhere on my system. Any ideas on what I can do?
Thanks for any ideas.
Randy


Back to top
Alan Bellingham
Guest





PostPosted: Fri May 27, 2005 1:15 pm    Post subject: Re: strings.h needed but nowhere to be found Reply with quote



"Randy Stonesifer" <rbstonesifer (AT) pennswoods (DOT) net> wrote:

Quote:
I am porting a unix C program to Windows. It wants to include strings.h. I
find no strings.h anywhere on my system. Any ideas on what I can do?

And what is 'strings.h' on your Unix system? It's certainly nothing to
do with the C or C++ standard libraries.

I suspect that this header is part of the system you're attempting to
port.

Alan Bellingham
--
ACCU Conference 2006 - 19-22 April, Randolph Hotel, Oxford, UK

Back to top
Randy Stonesifer
Guest





PostPosted: Fri May 27, 2005 3:31 pm    Post subject: Re: strings.h needed but nowhere to be found Reply with quote



Quote:
And what is 'strings.h' on your Unix system? It's certainly nothing to
do with the C or C++ standard libraries.

I suspect that this header is part of the system you're attempting to
port.

Alan Bellingham

I have no unix system.

A web search on strings.h led to
http://www.opengroup.org/onlinepubs/007908799/xsh/strings.h.html

The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

#include <strings.h>DESCRIPTIONThe following are declared as functions and
may also be defined as macros. Function prototypes must be provided for use
with an ISO C compiler.
int bcmp(const void *, const void *, size_t);
void bcopy(const void *, void *, size_t);
void bzero(void *, size_t);
int ffs(int);
char *index(const char *, int);
char *rindex(const char *, int);
int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t);
The size_t type is defined through typedef as described in <stddef.h>. But
without the source code for the functions ...Randy



Back to top
Cesar Rabak
Guest





PostPosted: Fri May 27, 2005 3:31 pm    Post subject: Re: strings.h needed but nowhere to be found Reply with quote

Thomas Maeder [TeamB] escreveu:
Quote:

index and rindex are synonyms of strchr and strrchr, it seems.


strcasecmp and strncasecmp are wrong by definition.

Can you enlight me sayin why is that?

--
Cesar Rabak

Back to top
Alan Bellingham
Guest





PostPosted: Fri May 27, 2005 3:52 pm    Post subject: Re: strings.h needed but nowhere to be found Reply with quote

"Randy Stonesifer" <rbstonesifer (AT) pennswoods (DOT) net> wrote:

Quote:
And what is 'strings.h' on your Unix system? It's certainly nothing to
do with the C or C++ standard libraries.

A web search on strings.h led to
http://www.opengroup.org/onlinepubs/007908799/xsh/strings.h.html

Aha. So create a header with those contents to see which functions
actually get used. Then implement the ones that do get used.

(And only three of those would require anything more than forwarding to
the preferred functions anyway.)

Alan Bellingham
--
ACCU Conference 2006 - 19-22 April, Randolph Hotel, Oxford, UK

Back to top
Thomas Maeder [TeamB]
Guest





PostPosted: Fri May 27, 2005 4:01 pm    Post subject: Re: strings.h needed but nowhere to be found Reply with quote

"Randy Stonesifer" <rbstonesifer (AT) pennswoods (DOT) net> writes:

Quote:
And what is 'strings.h' on your Unix system? It's certainly nothing to
do with the C or C++ standard libraries.

I suspect that this header is part of the system you're attempting to
port.

Alan Bellingham

I have no unix system.

A web search on strings.h led to
http://www.opengroup.org/onlinepubs/007908799/xsh/strings.h.html

The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

#include <strings.h>DESCRIPTIONThe following are declared as functions and
may also be defined as macros. Function prototypes must be provided for use
with an ISO C compiler.
int bcmp(const void *, const void *, size_t);
void bcopy(const void *, void *, size_t);
void bzero(void *, size_t);
int ffs(int);
char *index(const char *, int);
char *rindex(const char *, int);
int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t);
The size_t type is defined through typedef as described in <stddef.h>. But
without the source code for the functions ...Randy

All these are BSD functions, according to the man pages on my Linux box.


man bcopy says

CONFORMING TO
4.3BSD. This function is deprecated -- use memcpy in new
programs. Note that the first two parameters are inter­
changed for memcpy.



man bcmp says

CONFORMING TO
4.3BSD. This function is deprecated -- use memcmp in new
programs.



ffs is trivial to implement.


index and rindex are synonyms of strchr and strrchr, it seems.


strcasecmp and strncasecmp are wrong by definition.

Back to top
Randy Stonesifer
Guest





PostPosted: Fri May 27, 2005 5:04 pm    Post subject: Re: strings.h needed but nowhere to be found Reply with quote

Thomas and Alan,
Thanks much for the thoughts and info.
Randy


Back to top
Thomas Maeder [TeamB]
Guest





PostPosted: Fri May 27, 2005 8:12 pm    Post subject: Re: strings.h needed but nowhere to be found Reply with quote

Cesar Rabak <crabak (AT) acm (DOT) org> writes:

Quote:
Thomas Maeder [TeamB] escreveu:
index and rindex are synonyms of strchr and strrchr, it seems.
strcasecmp and strncasecmp are wrong by definition.

Can you enlight me sayin why is that?

[Assuming you mean what I wrote about strcasecmp and strncasecmp.]

I have written about this topic here many times. So, in order to avoid
annoying the regular readers, just two links to threads where I wrote
about case conversions; most what I wrote applies to case-independent
comparison as well.

In short, case-independence is very complex; I don't think that
software can do it correctly in general (as functions such as
strcasecmp promise), as it would have to understand the meaning of the
text.

http://tinyurl.com/8qncj (aka http://groups.google.ch/group/borland.public.cppbuilder.language/browse_thread/thread/b7b11db8a1afbc3d, which might wrap)

http://tinyurl.com/alqdz (aka http://groups.google.ch/group/borland.public.cppbuilder.language/browse_thread/thread/23da9aaa032c02ca, which might wrap)

Back to top
Cesar Rabak
Guest





PostPosted: Sun May 29, 2005 11:33 pm    Post subject: Re: strings.h needed but nowhere to be found Reply with quote

Thomas Maeder [TeamB] escreveu:
Quote:
Cesar Rabak <crabak (AT) acm (DOT) org> writes:


Thomas Maeder [TeamB] escreveu:

index and rindex are synonyms of strchr and strrchr, it seems.
strcasecmp and strncasecmp are wrong by definition.

Can you enlight me sayin why is that?

[Assuming you mean what I wrote about strcasecmp and strncasecmp.]

Yes.

Quote:

I have written about this topic here many times. So, in order to avoid
annoying the regular readers, just two links to threads where I wrote
about case conversions; most what I wrote applies to case-independent
comparison as well.

In short, case-independence is very complex; I don't think that
software can do it correctly in general (as functions such as
strcasecmp promise), as it would have to understand the meaning of the
text.

http://tinyurl.com/8qncj (aka http://groups.google.ch/group/borland.public.cppbuilder.language/browse_thread/thread/b7b11db8a1afbc3d, which might wrap)

http://tinyurl.com/alqdz (aka http://groups.google.ch/group/borland.public.cppbuilder.language/browse_thread/thread/23da9aaa032c02ca, which might wrap)

Your comments on the above threads pertain to case conversions that
attempt to be locale correct.

They are apropriate BTWm I don't want to dispute that.

If we look the specification and history of the functions we'll see they
conform to BSD 4.4 and are meant to work with ASCII only.

So if one takes care of seeing the specification and uses them in the
context they were designed, there is no wrongness by definition (or
design), just the expecations on software has changed and probably a
much more algorithmically complex function is needed to fulfill those
newer expectations.

--
Cesar Rabak

Back to top
Thomas Maeder [TeamB]
Guest





PostPosted: Mon May 30, 2005 4:46 am    Post subject: Re: strings.h needed but nowhere to be found Reply with quote

Cesar Rabak <crabak (AT) acm (DOT) org> writes:

Quote:
[Assuming you mean what I wrote about strcasecmp and strncasecmp.]

[snip]

Quote:
If we look the specification and history of the functions we'll see
they conform to BSD 4.4 and are meant to work with ASCII only.

History maybe, specification no.

This

http://tinyurl.com/b6xfo (aka http://www.openbsd.org/cgi-bin/man.cgi?query=strcasecmp&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html , which might wrap)

does not even mention the term ASCII. But it does say that characters
are compared by their unsigned values, so that '200' (dec 128) is
greather than ''. This is in direct contradiction to what you write,
since ASCII codes only go as far as 127.

Back to top
Cesar Rabak
Guest





PostPosted: Fri Jun 03, 2005 10:58 pm    Post subject: Re: strings.h needed but nowhere to be found Reply with quote

Thomas Maeder [TeamB] escreveu:
Quote:
Cesar Rabak <crabak (AT) acm (DOT) org> writes:


[Assuming you mean what I wrote about strcasecmp and strncasecmp.]


[snip]


If we look the specification and history of the functions we'll see
they conform to BSD 4.4 and are meant to work with ASCII only.


History maybe, specification no.

Thomas,


As I already wrote, I understand your point (being myself citizen of
countries with accented characters) and don't want to dispute the
accuracy of your observations.

Quote:

http://tinyurl.com/b6xfo (aka http://www.openbsd.org/cgi-bin/man.cgi?query=strcasecmp&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=html , which might wrap)

does not even mention the term ASCII. But it does say that characters
are compared by their unsigned values, so that '200' (dec 128) is
greather than ''. This is in direct contradiction to what you write,
since ASCII codes only go as far as 127.

Some manual pages don't even mention the signedness of the character,
but by transitivity, I think your reasoning is right as this 'bug' is
mentioned in some manual pages for toupper/tolower functions.

So we have no means of doing case conversions ;-)


Back to top
Thomas Maeder [TeamB]
Guest





PostPosted: Sat Jun 04, 2005 5:26 am    Post subject: Re: strings.h needed but nowhere to be found Reply with quote

Cesar Rabak <crabak (AT) acm (DOT) org> writes:

Quote:
So we have no means of doing case conversions Wink

I wouldn't go as far as that. Case conversions are well-defined within
the ASCII character set, for example. The problem is only with
functions that pretend to provide case-insensitivity in
general. Unfortunately, some of these functions are part of the
Standard C and Standard C++ libraries, or of other widely used
standards.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Command Line Tools) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.