Added prototyping stuff

This commit is contained in:
ceriel
1993-11-10 12:09:49 +00:00
parent 62f978c40f
commit 103cbb4319
37 changed files with 205 additions and 94 deletions

View File

@@ -18,3 +18,4 @@ strncmp.c
strncpy.c
strrindex.c
strzero.c
ack_string.h

View File

@@ -0,0 +1,31 @@
/*
* (c) copyright 1993 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* RCS: $Header: */
#ifndef __ACK_STRING_INCLUDED__
#define __ACK_STRING_INCLUDED__
#include <ansi.h>
_PROTOTYPE(char *strcpy, (char *s1, const char *s2));
_PROTOTYPE(char *strncpy, (char *s1, const char *s2, size_t n));
_PROTOTYPE(char *strcat, (char *s1, const char *s2));
_PROTOTYPE(char *strncat, (char *s1, const char *s2, size_t n));
_PROTOTYPE(int strcmp, (const char *s1, const char *s2));
_PROTOTYPE(int strncmp, (const char *s1, const char *s2, size_t n));
_PROTOTYPE(_SIZET strlen, (const char *s));
_PROTOTYPE(char *strindex, (char *s, int c));
_PROTOTYPE(char *strrindex, (char *s, int c));
_PROTOTYPE(char *strzero, (char *s));
_PROTOTYPE(char *str2bts, (char *s, char *b, int *n));
_PROTOTYPE(char *long2str, (long l, int b));
_PROTOTYPE(long str2long, (char *s, int b));
_PROTOTYPE(char *btscpy, (char *s1, char *s2, int n));
_PROTOTYPE(char *btscat, (char *s1, int n1, char *s2, int n2));
_PROTOTYPE(int btscmp, (char *s1, int n1, char *s2, int n2));
_PROTOTYPE(char *btszero, (char *b, int n));
_PROTOTYPE(char *bts2str, (char *b, int n, char *s));
#endif /* __ACK_STRING_INCLUDED__ */

View File

@@ -8,6 +8,8 @@
86/03/17 EHB
*/
#include "ack_string.h"
#define is_print(c) ((unsigned)((c) - ' ') <= '~' - ' ')
char *

View File

@@ -6,6 +6,8 @@
/* btscat()
*/
#include "ack_string.h"
char *
btscat(b1, n1, b2, n2)
char *b1;

View File

@@ -6,6 +6,8 @@
/* btscmp()
*/
#include "ack_string.h"
int
btscmp(b1, n1, b2, n2)
register char *b1, *b2;

View File

@@ -6,6 +6,8 @@
/* btscpy()
*/
#include "ack_string.h"
char *
btscpy(b1, b2, n)
register char *b1, *b2;

View File

@@ -6,6 +6,8 @@
/* btszero()
*/
#include "ack_string.h"
char *
btszero(b, n)
char *b;

View File

@@ -10,6 +10,8 @@
(1985, EHB)
*/
#include "ack_string.h"
#define MAXWIDTH 32
char *

View File

@@ -18,7 +18,7 @@ OBJ = bts2str.$(SUF) btscat.$(SUF) btscmp.$(SUF) btscpy.$(SUF) \
strlen.$(SUF) strncat.$(SUF) strncmp.$(SUF) strncpy.$(SUF) \
strrindex.$(SUF) strzero.$(SUF)
INCLUDES = -I$(SRC_DIR)
INCLUDES = -I$(SRC_DIR) -I$(MOD_DIR)/h
CFLAGS = $(COPTIONS) $(INCLUDES)
LIBSTRING = libstring.$(LIBSUF)
@@ -30,16 +30,18 @@ $(LIBSTRING): $(OBJ)
$(RANLIB) $(LIBSTRING)
install: all
-mkdir $(MOD_DIR)/lib
-mkdir $(MOD_DIR)/h
cp $(LIBSTRING) $(MOD_DIR)/lib/$(LIBSTRING)
$(RANLIB) $(MOD_DIR)/lib/$(LIBSTRING)
cp $(SRC_DIR)/string.3 $(MOD_DIR)/man/string.3
cp $(SRC_DIR)/ack_string.h $(MOD_DIR)/h/ack_string.h
if [ $(DO_MACHINE_INDEP) = y ] ; \
then mk_manpage $(SRC_DIR)/string.3 $(TARGET_HOME) ; \
fi
cmp: all
-cmp $(LIBSTRING) $(MOD_DIR)/lib/$(LIBSTRING)
-cmp $(SRC_DIR)/string.3 $(MOD_DIR)/man/string.3
-cmp $(SRC_DIR)/ack_string.h $(MOD_DIR)/h/ack_string.h
pr:
@pr $(SRC_DIR)/proto.make $(SRC)

View File

@@ -5,6 +5,9 @@
*/
/* str2bts -- (1985, EHB)
*/
#include "ack_string.h"
static
is_oct(c)
char c;

View File

@@ -6,6 +6,8 @@
/* str2long()
*/
#include "ack_string.h"
value(c, b)
char c;
int b;

View File

@@ -5,9 +5,13 @@
*/
/* append t to s
*/
#include "ack_string.h"
char *
strcat(s, t)
register char *s, *t;
register char *s;
register _CONST char *t;
{
register char *b = s;

View File

@@ -6,9 +6,12 @@
/* return negative, zero or positive value if
resp. s < t, s == t or s > t
*/
#include "ack_string.h"
int
strcmp(s, t)
register char *s, *t;
register _CONST char *s, *t;
{
while (*s == *t++)
if (*s++ == '\0')

View File

@@ -5,9 +5,13 @@
*/
/* Copy t into s
*/
#include "ack_string.h"
char *
strcpy(s, t)
register char *s, *t;
register char *s;
register _CONST char *t;
{
register char *b = s;

View File

@@ -6,9 +6,12 @@
/* strindex() -- (86/03/18 EHB)
*/
#include "ack_string.h"
char *
strindex(s, c)
register char *s, c;
register char *s;
int c;
{
while (*s)
if (*s++ == c)

View File

@@ -8,6 +8,8 @@ btscpy, btscat, btscmp, btszero, bts2str \- operations on and
conversions between strings and row of bytes
.SH SYNOPSIS
.nf
.B #include <ack_string.h>
.PP
.B char *strcpy(s1, s2)
.B char *s1, *s2;
.PP

View File

@@ -5,11 +5,14 @@
*/
/* return length of s
*/
int
#include "ack_string.h"
_SIZET
strlen(s)
char *s;
_CONST char *s;
{
register char *b = s;
register _CONST char *b = s;
while (*b++)
;

View File

@@ -5,10 +5,14 @@
*/
/* append t to s, upto n characters
*/
#include "ack_string.h"
char *
strncat(s, t, n)
register char *s, *t;
register int n;
register char *s;
register _CONST char *t;
register _SIZET n;
{
register char *b = s;

View File

@@ -6,10 +6,13 @@
/* return negative, zero or positive value if
resp. s < t, s == t or s > t; compare at most n characters
*/
#include "ack_string.h"
int
strncmp(s, t, n)
register char *s, *t;
register int n;
register _CONST char *s, *t;
register _SIZET n;
{
while (n-- > 0) {
if (*s == *t++) {

View File

@@ -5,10 +5,14 @@
*/
/* Copy t into s, upto n characters
*/
#include "ack_string.h"
char *
strncpy(s, t, n)
register char *s, *t;
register int n;
register char *s;
register _CONST char *t;
register _SIZET n;
{
register char *b = s;

View File

@@ -3,9 +3,13 @@
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#include "ack_string.h"
char *
strrindex(str, chr)
register char *str, chr;
register char *str;
int chr;
{
register char *retptr = 0;

View File

@@ -6,6 +6,8 @@
/* strzero()
*/
#include "ack_string.h"
char *
strzero(s)
char *s;