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/17/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)
dml@rabbit1.UUCP (David Langdon) (06/20/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). > >> have to write the string functions yourself. >> >> Dennis >> > -------- > Rick Genter BBN Laboratories Inc. I am not sure what is being ported here, but some programs pulled off the net make use of a PD strings package posted a couple of months ago. This package contains a strings.h file and "could" explain the other differences being mentioned here. -- ----------------------------------------------------------- David Langdon Rabbit Software Corp. ...!ihnp4!{cbmvax,cuuxb}!hutch!dml ...!psuvax1!burdvax!hutch!dml (215) 647-0440 7 Great Valley Parkway East Malvern PA 19355
tad@killer.UUCP (Tad Marko) (06/23/86)
In article <1434@brl-smoke.ARPA>, drears@ardec.arpa (FSAC) 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 > 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. I use the functions quite often, but the header file for MSC is string.h. I recently ported a program from MSC to an NBI 4044 running 4.2BSD, and the only change necessary was to change #include <string.h> to #include <strings.h> everything worked fine after that. Perhaps this and several other MSC differences are the result of it complying to the new ANSI C standard?
meissner@dg_rtp.UUCP (Michael Meissner) (06/26/86)
In article <240@killer.UUCP> tad@killer.UUCP (Tad Marko) writes: > >I use the functions quite often, but the header file for MSC is string.h. >I recently ported a program from MSC to an NBI 4044 running 4.2BSD, and the >only change necessary was to change > >#include <string.h> > >to > >#include <strings.h> > >everything worked fine after that. Perhaps this and several other MSC >differences are the result of it complying to the new ANSI C standard? It goes back a little further than ANSI & BSD. In the ongoing war to make System V & BSD mutually incompatible {1/2 -) I guess}, BSD systems define the string functions in <strings.h>, and System V (and probably System III before it) use <string.h>. The ANSI committee started with one of the /usr/group working documents. The /usr/group standard was originally based upon System III. The time line looks somewhat like: v7 |\ | \-----------------------------------------------------\ | | System III-----\ BSD 4.1 | \ | | /usr/group starts-------\ BSD 4.1{a,b,c} | | | | System V\ | ANSI starts | | | | | BSD 4.2 | | /usr/group 1st std. | | | | | | | | \-------/usr/group continues | | | | | | System V.2 becomes IEEE P1003 issues 4/30/85 | | | public bulletin | SVID----\ | | | | | issues P1003.1 | | | X/OPEN | | | present ... ... ... ... | | | | future System V.3 revisied std? public review BSD 4.3 (ships?) (Sept 1986?) (ships?) * Note, the time line is distorted somewhat. Michael Meissner Data General ...{ decvax, ucbvax, inhp4 }!mcnc!rti-sel!dg_rtp!meissner