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

@ -5,7 +5,7 @@
/* $Header$ */ /* $Header$ */
#include <system.h> #include <system.h>
#include <varargs.h> #include "print.h"
#include "param.h" #include "param.h"
/*FORMAT1 $ /*FORMAT1 $
@ -15,7 +15,7 @@
%[uxbo] = unsigned int %[uxbo] = unsigned int
%d = int %d = int
$ */ $ */
/*VARARGS2*/ void
doprnt(fp, fmt, argp) doprnt(fp, fmt, argp)
File *fp; File *fp;
char *fmt; char *fmt;

View file

@ -4,7 +4,8 @@
*/ */
/* $Header$ */ /* $Header$ */
#include <varargs.h> #include <system.h>
#include "print.h"
extern char *long2str(); extern char *long2str();
@ -33,7 +34,6 @@ integral(c)
%[uxbo] = unsigned int %[uxbo] = unsigned int
%d = int %d = int
$ */ $ */
/*VARARGS2*/
int int
_format(buf, fmt, argp) _format(buf, fmt, argp)
char *buf, *fmt; char *buf, *fmt;

View file

@ -4,8 +4,8 @@
*/ */
/* $Header$ */ /* $Header$ */
#include <varargs.h>
#include <system.h> #include <system.h>
#include "print.h"
#include "param.h" #include "param.h"
/*FORMAT1v $ /*FORMAT1v $
@ -16,18 +16,28 @@
%d = int %d = int
$ */ $ */
/*VARARGS*/ /*VARARGS*/
fprint(va_alist) void
fprint
#if __STDC__
(File *fp, char *fmt, ...)
{
#else
(va_alist)
va_dcl va_dcl
{ {
File *fp; File *fp;
char *fmt; char *fmt;
#endif
va_list args; va_list args;
char buf[SSIZE]; char buf[SSIZE];
#if __STDC__
va_start(args, fmt);
#else
va_start(args); va_start(args);
fp = va_arg(args, File *); fp = va_arg(args, File *);
fmt = va_arg(args, char *); fmt = va_arg(args, char *);
#endif
sys_write(fp, buf, _format(buf, fmt, args)); sys_write(fp, buf, _format(buf, fmt, args));
va_end(args); va_end(args);
} }

View file

@ -5,19 +5,19 @@ print, fprint, sprint, doprnt -- very simple formatted-output routines
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.B #include <system.h> .B #include <system.h>
.B #include <varargs.h> .B #include <print.h>
.PP .PP
.B print(format [, arg] ... ) .B void print(format [, arg] ... )
.B char *format; .B char *format;
.PP .PP
.B fprint(filep, format [, arg] ... ) .B void fprint(filep, format [, arg] ... )
.B File *filep; .B File *filep;
.B char *format; .B char *format;
.PP .PP
.B char *sprint(s, format [, arg] ... ) .B char *sprint(s, format [, arg] ... )
.B char *s, *format; .B char *s, *format;
.PP .PP
.B doprnt(filep, format, args) .B void doprnt(filep, format, args)
.B File *filep; .B File *filep;
.B char *format; .B char *format;
.B va_list args; .B va_list args;
@ -106,29 +106,6 @@ length of the string.
takes takes
.I args .I args
as the address of the arguments of the format string. as the address of the arguments of the format string.
This allows routines, e.g.
.IR print ,
to be defined as follows:
.br
.RS
.nf
#include <varargs.h>
#include <system.h>
/*VARARGS*/
print(va_alist)
va_dcl
{
char *fmt;
va_list args;
va_start(args);
fmt = va_arg(args, char *);
doprnt(STDOUT, fmt, args);
va_end(args);
}
.fi
.RE
.SH FILES .SH FILES
.nf .nf
~em/modules/lib/libprint.a ~em/modules/lib/libprint.a

View file

@ -4,8 +4,8 @@
*/ */
/* $Header$ */ /* $Header$ */
#include <varargs.h>
#include <system.h> #include <system.h>
#include "print.h"
#include "param.h" #include "param.h"
/*FORMAT0v $ /*FORMAT0v $
@ -16,15 +16,26 @@
%d = int %d = int
$ */ $ */
/*VARARGS*/ /*VARARGS*/
print(va_alist) void
print
#if __STDC__
(char *fmt, ...)
{
#else
(va_alist)
va_dcl va_dcl
{ {
char *fmt; char *fmt;
#endif
va_list args; va_list args;
char buf[SSIZE]; char buf[SSIZE];
#if __STDC__
va_start(args, fmt);
#else
va_start(args); va_start(args);
fmt = va_arg(args, char *); fmt = va_arg(args, char *);
#endif
sys_write(STDOUT, buf, _format(buf, fmt, args)); sys_write(STDOUT, buf, _format(buf, fmt, args));
va_end(args); va_end(args);
} }

View file

@ -4,12 +4,20 @@
*/ */
/* $Header$ */ /* $Header$ */
#define stdin STDIN #ifndef __PRINT_INCLUDED__
#define stdout STDOUT #define __PRINT_INCLUDED__
#define stderr STDERR
#define printf print #include <ansi.h>
#define sprintf sprint #if __STDC__
#define fprintf fprint #include <stdarg.h>
#else
#include <varargs.h>
#endif
#define FILE File _PROTOTYPE(void print, (char *fmt, ...));
_PROTOTYPE(void fprint, (File *f, char *fmt, ...));
_PROTOTYPE(void doprnt, (File *f, char *fmt, va_list ap));
_PROTOTYPE(int _format, (char *buf, char *fmt, va_list ap));
_PROTOTYPE(char *sprint, (char *buf, char *fmt, ...));
#endif /* __PRINT_INCLUDED__ */

View file

@ -21,16 +21,18 @@ $(LIBPRINT): $(OBJ)
$(RANLIB) $(LIBPRINT) $(RANLIB) $(LIBPRINT)
install: all install: all
-mkdir $(MOD_DIR)/lib
-mkdir $(MOD_DIR)/h
cp $(LIBPRINT) $(MOD_DIR)/lib/$(LIBPRINT) cp $(LIBPRINT) $(MOD_DIR)/lib/$(LIBPRINT)
$(RANLIB) $(MOD_DIR)/lib/$(LIBPRINT) $(RANLIB) $(MOD_DIR)/lib/$(LIBPRINT)
cp $(SRC_DIR)/print.3 $(MOD_DIR)/man/print.3 cp $(SRC_DIR)/print.h $(MOD_DIR)/h/print.h
if [ $(DO_MACHINE_INDEP) = y ] ; \ if [ $(DO_MACHINE_INDEP) = y ] ; \
then mk_manpage $(SRC_DIR)/print.3 $(TARGET_HOME) ; \ then mk_manpage $(SRC_DIR)/print.3 $(TARGET_HOME) ; \
fi fi
cmp: all cmp: all
-cmp $(LIBPRINT) $(MOD_DIR)/lib/$(LIBPRINT) -cmp $(LIBPRINT) $(MOD_DIR)/lib/$(LIBPRINT)
-cmp $(SRC_DIR)/print.3 $(MOD_DIR)/man/print.3 -cmp $(SRC_DIR)/print.h $(MOD_DIR)/h/print.h
pr: pr:
@pr $(SRC_DIR)/proto.make $(SRC) @pr $(SRC_DIR)/proto.make $(SRC)

View file

@ -4,8 +4,8 @@
*/ */
/* $Header$ */ /* $Header$ */
#include <varargs.h>
#include <system.h> #include <system.h>
#include "print.h"
#include "param.h" #include "param.h"
/*FORMAT1v $ /*FORMAT1v $
@ -17,15 +17,25 @@
$ */ $ */
/*VARARGS*/ /*VARARGS*/
char * char *
sprint(va_alist) sprint
#if __STDC__
(char *buf, char *fmt, ...)
{
#else
(va_alist)
va_dcl va_dcl
{ {
char *buf, *fmt; char *buf, *fmt;
#endif
va_list args; va_list args;
#if __STDC__
va_start(args, fmt);
#else
va_start(args); va_start(args);
buf = va_arg(args, char *); buf = va_arg(args, char *);
fmt = va_arg(args, char *); fmt = va_arg(args, char *);
#endif
buf[_format(buf, fmt, args)] = '\0'; buf[_format(buf, fmt, args)] = '\0';
va_end(args); va_end(args);
return buf; return buf;

View file

@ -6,6 +6,8 @@
#ifndef __EMCOMP_INCLUDED__ #ifndef __EMCOMP_INCLUDED__
#define __EMCOMP_INCLUDED__ #define __EMCOMP_INCLUDED__
#include <ansi.h>
struct e_arg { struct e_arg {
int ema_argtype; /* type of this argument */ int ema_argtype; /* type of this argument */
union e_simple_arg { union e_simple_arg {
@ -44,6 +46,11 @@ struct e_instr {
struct e_arg em_arg; struct e_arg em_arg;
}; };
_PROTOTYPE(int EM_open, (char *));
_PROTOTYPE(void EM_close, (void));
_PROTOTYPE(int EM_getinstr, (struct e_instr *));
_PROTOTYPE(int EM_mkcalls, (struct e_instr *));
extern arith extern arith
EM_holsize; EM_holsize;
#define EM_bsssize EM_holsize #define EM_bsssize EM_holsize

View file

@ -31,7 +31,7 @@ static int listtype = 0; /* indicates pseudo when generating code for
The argument must be of a type allowed by "typset". The argument must be of a type allowed by "typset".
Return a pointer to the next argument. Return a pointer to the next argument.
*/ */
PRIVATE PRIVATE int
checkarg(arg, typset) checkarg(arg, typset)
register struct e_arg *arg; register struct e_arg *arg;
{ {
@ -58,7 +58,7 @@ checkarg(arg, typset)
/* EM_doinstr: An EM instruction /* EM_doinstr: An EM instruction
*/ */
PRIVATE PRIVATE void
EM_doinstr(p) EM_doinstr(p)
register struct e_instr *p; register struct e_instr *p;
{ {
@ -94,7 +94,7 @@ EM_doinstr(p)
#include "C_mnem" #include "C_mnem"
} }
PRIVATE PRIVATE void
EM_dopseudo(p) EM_dopseudo(p)
register struct e_instr *p; register struct e_instr *p;
{ {
@ -326,7 +326,7 @@ EM_dopseudo(p)
} }
} }
PRIVATE PRIVATE void
EM_docon(p) EM_docon(p)
register struct e_instr *p; register struct e_instr *p;
{ {
@ -365,7 +365,7 @@ EM_docon(p)
} }
} }
PRIVATE PRIVATE void
EM_dostartmes(p) EM_dostartmes(p)
register struct e_instr *p; register struct e_instr *p;
{ {

View file

@ -6,7 +6,7 @@ SRC_DIR = $(SRC_HOME)/modules/src/read_em
MOD_DIR = $(TARGET_HOME)/modules MOD_DIR = $(TARGET_HOME)/modules
EM_TABLE = $(SRC_HOME)/etc/em_table EM_TABLE = $(SRC_HOME)/etc/em_table
INCLUDES = -I$(TARGET_HOME)/h -I$(MOD_DIR)/h -I$(SRC_DIR) -I. INCLUDES = -I$(TARGET_HOME)/h -I$(MOD_DIR)/h -I$(SRC_DIR) -I.
DEFINES = -DPRIVATE=static -DEXPORT= DEFINES = -DPRIVATE=static -DEXPORT= -DNDEBUG
CFLAGS = $(INCLUDES) $(DEFINES) $(COPTIONS) CFLAGS = $(INCLUDES) $(DEFINES) $(COPTIONS)
TARGETS = libread_emk.$(LIBSUF) \ TARGETS = libread_emk.$(LIBSUF) \
@ -35,8 +35,9 @@ K_OFILES = read_emk.$(SUF) makecalls.$(SUF) EM_vars.$(SUF)
all: $(TARGETS) all: $(TARGETS)
install: all install: all
-mkdir $(MOD_DIR)/lib
-mkdir $(MOD_DIR)/h
cp $(SRC_DIR)/em_comp.h $(MOD_DIR)/h/em_comp.h cp $(SRC_DIR)/em_comp.h $(MOD_DIR)/h/em_comp.h
cp $(SRC_DIR)/read_em.3 $(MOD_DIR)/man/read_em.3
cp libread_emk.$(LIBSUF) $(MOD_DIR)/lib/libread_emk.$(LIBSUF) cp libread_emk.$(LIBSUF) $(MOD_DIR)/lib/libread_emk.$(LIBSUF)
$(RANLIB) $(MOD_DIR)/lib/libread_emk.$(LIBSUF) $(RANLIB) $(MOD_DIR)/lib/libread_emk.$(LIBSUF)
cp libread_emkV.$(LIBSUF) $(MOD_DIR)/lib/libread_emkV.$(LIBSUF) cp libread_emkV.$(LIBSUF) $(MOD_DIR)/lib/libread_emkV.$(LIBSUF)
@ -52,7 +53,6 @@ cmp: all
-cmp libread_emk.$(LIBSUF) $(MOD_DIR)/lib/libread_emk.$(LIBSUF) -cmp libread_emk.$(LIBSUF) $(MOD_DIR)/lib/libread_emk.$(LIBSUF)
-cmp libread_emkV.$(LIBSUF) $(MOD_DIR)/lib/libread_emkV.$(LIBSUF) -cmp libread_emkV.$(LIBSUF) $(MOD_DIR)/lib/libread_emkV.$(LIBSUF)
-cmp libread_emeV.$(LIBSUF) $(MOD_DIR)/lib/libread_emeV.$(LIBSUF) -cmp libread_emeV.$(LIBSUF) $(MOD_DIR)/lib/libread_emeV.$(LIBSUF)
-cmp $(SRC_DIR)/read_em.3 $(MOD_DIR)/man/read_em.3
pr: pr:
@pr $(SRC_DIR)/proto.make $(SRC_DIR)/m_C_mnem $(SRC_DIR)/m_C_mnem_na $(SRC_DIR)/argtype $(SRCFILES) @pr $(SRC_DIR)/proto.make $(SRC_DIR)/m_C_mnem $(SRC_DIR)/m_C_mnem_na $(SRC_DIR)/argtype $(SRCFILES)

View file

@ -20,10 +20,10 @@ EM_mkcalls\ \-\ a module to read EM assembly code
.PP .PP
.B int EM_open(filename) .B int EM_open(filename)
.br .br
.B EM_close()
.br
.B char *filename; .B char *filename;
.PP .PP
.B void EM_close()
.PP
.B int EM_getinstr(instr) .B int EM_getinstr(instr)
.B struct e_instr *instr; .B struct e_instr *instr;
.PP .PP

View file

@ -99,7 +99,7 @@ static char *argrange = "Argument range error";
/* Error handling /* Error handling
*/ */
PRIVATE PRIVATE void
xerror(s) xerror(s)
char *s; char *s;
{ {
@ -108,7 +108,7 @@ xerror(s)
} }
#ifdef COMPACT #ifdef COMPACT
PRIVATE PRIVATE void
xfatal(s) xfatal(s)
char *s; char *s;
{ {
@ -157,7 +157,7 @@ EM_open(filename)
/* EM_close: Close input file /* EM_close: Close input file
*/ */
EXPORT EXPORT void
EM_close() EM_close()
{ {
@ -175,7 +175,7 @@ EM_close()
again, but also to deliver the arguments on next calls to EM_getinstr. again, but also to deliver the arguments on next calls to EM_getinstr.
This is indicated by the variable "argp". This is indicated by the variable "argp".
*/ */
PRIVATE PRIVATE void
startmes(p) startmes(p)
register struct e_instr *p; register struct e_instr *p;
{ {

View file

@ -43,7 +43,7 @@ hash(s)
return h; return h;
} }
PRIVATE PRIVATE void
pre_hash(i, s) pre_hash(i, s)
char *s; char *s;
{ {
@ -66,7 +66,7 @@ pre_hash(i, s)
extern char em_mnem[][4]; extern char em_mnem[][4];
extern char em_pseu[][4]; extern char em_pseu[][4];
PRIVATE PRIVATE void
inithash() inithash()
{ {
register int i; register int i;
@ -103,7 +103,7 @@ nospace()
/* syntax: Put an error message in EM_error and skip to the end of the line /* syntax: Put an error message in EM_error and skip to the end of the line
*/ */
PRIVATE PRIVATE void
syntax(s) syntax(s)
char *s; char *s;
{ {
@ -117,7 +117,7 @@ syntax(s)
/* checkeol: check that we have a complete line (except maybe for spaces) /* checkeol: check that we have a complete line (except maybe for spaces)
*/ */
PRIVATE PRIVATE void
checkeol() checkeol()
{ {
@ -251,7 +251,7 @@ getstring()
return s; return s;
} }
PRIVATE gettyp(); PRIVATE void gettyp();
PRIVATE int PRIVATE int
offsetted(argtyp, ap) offsetted(argtyp, ap)
@ -446,7 +446,7 @@ get15u()
return (int) (dummy.ema_cst); return (int) (dummy.ema_cst);
} }
PRIVATE PRIVATE void
gettyp(typset, ap) gettyp(typset, ap)
register struct e_arg *ap; register struct e_arg *ap;
{ {
@ -520,10 +520,9 @@ gettyp(typset, ap)
if (argtyp == sp_cend) { if (argtyp == sp_cend) {
ap->ema_argtype = 0; ap->ema_argtype = 0;
} }
return;
} }
PRIVATE PRIVATE void
getarg(typset, ap) getarg(typset, ap)
struct e_arg *ap; struct e_arg *ap;
{ {
@ -533,19 +532,19 @@ getarg(typset, ap)
if ((c = nospace()) != ',') { if ((c = nospace()) != ',') {
if (c != '\n') { if (c != '\n') {
syntax("comma expected"); syntax("comma expected");
return 0; return;
} }
ungetbyte(c); ungetbyte(c);
} }
} }
argnum++; argnum++;
return gettyp(typset, ap); gettyp(typset, ap);
} }
/* getmnem: We found the start of either an instruction or a pseudo. /* getmnem: We found the start of either an instruction or a pseudo.
get the rest of it get the rest of it
*/ */
PRIVATE PRIVATE void
getmnem(c, p) getmnem(c, p)
register struct e_instr *p; register struct e_instr *p;
{ {
@ -587,7 +586,7 @@ getmnem(c, p)
} }
} }
PRIVATE PRIVATE void
line_line() line_line()
{ {
static char filebuf[256 + 1]; static char filebuf[256 + 1];
@ -601,7 +600,7 @@ line_line()
EM_filename = filebuf; EM_filename = filebuf;
} }
PRIVATE PRIVATE void
getlabel(c, p) getlabel(c, p)
register struct e_instr *p; register struct e_instr *p;
{ {
@ -624,7 +623,7 @@ getlabel(c, p)
checkeol(); checkeol();
} }
PRIVATE PRIVATE void
gethead(p) gethead(p)
register struct e_instr *p; register struct e_instr *p;
{ {

View file

@ -41,7 +41,7 @@ PRIVATE struct string *getstring();
/* getarg : read an argument of any type, and check it against "typset" /* getarg : read an argument of any type, and check it against "typset"
if neccesary. Put result in "ap". if neccesary. Put result in "ap".
*/ */
PRIVATE PRIVATE void
getarg(typset, ap) getarg(typset, ap)
register struct e_arg *ap; register struct e_arg *ap;
{ {
@ -259,7 +259,7 @@ getstring(isident)
/* gethead: read the start of an EM-line /* gethead: read the start of an EM-line
*/ */
PRIVATE PRIVATE void
gethead(p) gethead(p)
register struct e_instr *p; register struct e_instr *p;
{ {

View file

@ -18,3 +18,4 @@ strncmp.c
strncpy.c strncpy.c
strrindex.c strrindex.c
strzero.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 86/03/17 EHB
*/ */
#include "ack_string.h"
#define is_print(c) ((unsigned)((c) - ' ') <= '~' - ' ') #define is_print(c) ((unsigned)((c) - ' ') <= '~' - ' ')
char * char *

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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