 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Randy Stonesifer Guest
|
Posted: Fri May 27, 2005 1:06 pm Post subject: strings.h needed but nowhere to be found |
|
|
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
|
Posted: Fri May 27, 2005 1:15 pm Post subject: Re: strings.h needed but nowhere to be found |
|
|
"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
|
Posted: Fri May 27, 2005 3:31 pm Post subject: Re: strings.h needed but nowhere to be found |
|
|
| 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
|
Posted: Fri May 27, 2005 3:31 pm Post subject: Re: strings.h needed but nowhere to be found |
|
|
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
|
Posted: Fri May 27, 2005 3:52 pm Post subject: Re: strings.h needed but nowhere to be found |
|
|
"Randy Stonesifer" <rbstonesifer (AT) pennswoods (DOT) net> wrote:
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
|
Posted: Fri May 27, 2005 4:01 pm Post subject: Re: strings.h needed but nowhere to be found |
|
|
"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
|
Posted: Fri May 27, 2005 5:04 pm Post subject: Re: strings.h needed but nowhere to be found |
|
|
Thomas and Alan,
Thanks much for the thoughts and info.
Randy
|
|
| Back to top |
|
 |
Thomas Maeder [TeamB] Guest
|
|
| Back to top |
|
 |
Cesar Rabak Guest
|
Posted: Sun May 29, 2005 11:33 pm Post subject: Re: strings.h needed but nowhere to be found |
|
|
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.
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
|
Posted: Mon May 30, 2005 4:46 am Post subject: Re: strings.h needed but nowhere to be found |
|
|
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
|
Posted: Fri Jun 03, 2005 10:58 pm Post subject: Re: strings.h needed but nowhere to be found |
|
|
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.
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
|
Posted: Sat Jun 04, 2005 5:26 am Post subject: Re: strings.h needed but nowhere to be found |
|
|
Cesar Rabak <crabak (AT) acm (DOT) org> writes:
| Quote: | So we have no means of doing case conversions
|
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 |
|
 |
|
|
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
|
|