Board index » cppbuilder » strings.h needed but nowhere to be found

strings.h needed but nowhere to be found


2005-05-27 09:06:55 PM
cppbuilder81
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
 
 

Re:strings.h needed but nowhere to be found

"Randy Stonesifer" < XXXX@XXXXX.COM >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
 

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
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
 

{smallsort}

Re:strings.h needed but nowhere to be found

"Randy Stonesifer" < XXXX@XXXXX.COM >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
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
 

Re:strings.h needed but nowhere to be found

"Randy Stonesifer" < XXXX@XXXXX.COM >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
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.
 

Re:strings.h needed but nowhere to be found

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

Re:strings.h needed but nowhere to be found

Cesar Rabak < XXXX@XXXXX.COM >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.
tinyurl.com/8qncj (aka groups.google.ch/group/borland.public.cppbuilder.language/browse_thread/thread/b7b11db8a1afbc3d, which might wrap)
tinyurl.com/alqdz (aka groups.google.ch/group/borland.public.cppbuilder.language/browse_thread/thread/23da9aaa032c02ca, which might wrap)
 

Re:strings.h needed but nowhere to be found

Cesar Rabak < XXXX@XXXXX.COM >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
tinyurl.com/b6xfo (aka www.openbsd.org/cgi-bin/man.cgi , 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 '\0'. This is in direct contradiction to what you write,
since ASCII codes only go as far as 127.
 

Re:strings.h needed but nowhere to be found

Thomas Maeder [TeamB] escreveu:
Quote
Cesar Rabak < XXXX@XXXXX.COM >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

tinyurl.com/b6xfo (aka www.openbsd.org/cgi-bin/man.cgi , 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 '\0'. 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 ;-)
 

Re:strings.h needed but nowhere to be found

Cesar Rabak < XXXX@XXXXX.COM >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.