[net.unix] Header file strings.h

Schauble@mit-multics.arpa (Paul Schauble) (06/17/86)

I am trying to port a program from Unix to MS-DOS.  It makes use of a
header file <strings.h>.  This is not supplied with Microsoft C.  Could
someone please enlighten me as to what this contains?

Please reply directly, as I don't always read Info-Unix.

          Thanks in advance,
          Paul
          Schauble at MIT-Multics.arpa

drears@ardec.arpa (FSAC) (06/18/86)

Paul Schauble writes:

>I am trying to port a program from Unix to MS-DOS.  It makes use of a
>header file <strings.h>.  This is not supplied with Microsoft C.  Could
>someone please enlighten me as to what this contains?

   <strings.h>  contains the data types for the string
operations - strcat, strncat, strtok, strcpy, etc.  I have used the
strings functions many times without using this header file.  If
you are checking the return codes of the functions explicitly define
the functions.  Example:

char *strcat(), *strcmp();
int strlen;

   I believe Microsoft C libraries contains the string functions. In
that case just explicitly define the functions. If they don't  you might
have to write the string functions yourself.

Dennis

rgenter@bbn-labs-b.arpa (Rick Genter) (06/18/86)

In article <8606171617.aa10712@VGR.BRL.ARPA>,
"1LT Dennis G. Rears" (FSAC) <drears@ardec.ARPA> writes:

> Paul Schauble writes:
> 
> >I am trying to port a program from Unix to MS-DOS.  It makes use of a
> >header file <strings.h>.  This is not supplied with Microsoft C.  Could
> >someone please enlighten me as to what this contains?
> 
>    <strings.h>  contains the data types for the string
> operations - strcat, strncat, strtok, strcpy, etc.  I have used the

More precisely, it contains the external declarations of these functions.
One could misinterpret the above statement to mean that <strings.h> contains
the data types *manipulated* by the string functions (which it does not).

> strings functions many times without using this header file.  If
> you are checking the return codes of the functions explicitly define
> the functions.  Example:
> 
> char *strcat(), *strcmp();

In every implementation of strcmp() with which I am familiar, it returns (int),
not (char *).  Its return value is suitable for the old Fortran 3-way IF (i.e.,
returns < 0 if string-1 comes before string-2 in dictionary order, = 0 if they
are the same, and > 0 if string-1 comes after string-2).

> int strlen;

This should read:

	int	strlen ();

> 
>    I believe Microsoft C libraries contains the string functions. In
> that case just explicitly define the functions. If they don't  you might
> have to write the string functions yourself.
> 
> Dennis
> 
--------
Rick Genter 				BBN Laboratories Inc.
(617) 497-3848				10 Moulton St.  6/506
rgenter@labs-b.bbn.COM  (Internet new)	Cambridge, MA   02238
rgenter@bbn-labs-b.ARPA (Internet old)	linus!rgenter%BBN-LABS-B.ARPA (UUCP)