summaryrefslogtreecommitdiff
path: root/usr/src/ucbcmd
diff options
context:
space:
mode:
authorbasabi <none@none>2005-10-04 07:57:28 -0700
committerbasabi <none@none>2005-10-04 07:57:28 -0700
commitbdcaf82257ab2deb6b46efaaa4bc93a1a44b3885 (patch)
tree986eb7bae8ea4650099422631246d14c9f9e8a4a /usr/src/ucbcmd
parent3461bce34c4973cea9064c326d543387a31c152b (diff)
downloadillumos-joyent-bdcaf82257ab2deb6b46efaaa4bc93a1a44b3885.tar.gz
6271033 gcc and cmd/dminfo don't get along
6272051 gcc and cmd/nlsadmin don't get along 6273848 gcc and cmd/setfacl don't get along 6274778 gcc and ucbcmd/sed don't get along
Diffstat (limited to 'usr/src/ucbcmd')
-rw-r--r--usr/src/ucbcmd/sed/sed.h11
-rw-r--r--usr/src/ucbcmd/sed/sed0.c60
-rw-r--r--usr/src/ucbcmd/sed/sed1.c73
3 files changed, 83 insertions, 61 deletions
diff --git a/usr/src/ucbcmd/sed/sed.h b/usr/src/ucbcmd/sed/sed.h
index 92ac2c0cd7..f814ce4ef6 100644
--- a/usr/src/ucbcmd/sed/sed.h
+++ b/usr/src/ucbcmd/sed/sed.h
@@ -20,14 +20,17 @@
* CDDL HEADER END
*/
/*
- * Copyright 1996 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R3.1 1.8 */
+#ifndef _SED_H
+#define _SED_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
/*
* sed -- stream editor
@@ -150,3 +153,7 @@ char *compsub();
struct label *search();
char *gline();
char *place();
+void comperr(char *);
+void execute(char *);
+
+#endif /* _SED_H */
diff --git a/usr/src/ucbcmd/sed/sed0.c b/usr/src/ucbcmd/sed/sed0.c
index e8d46ea2c5..2a1749f757 100644
--- a/usr/src/ucbcmd/sed/sed0.c
+++ b/usr/src/ucbcmd/sed/sed0.c
@@ -19,20 +19,21 @@
*
* CDDL HEADER END
*/
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
/* Copyright (c) 1984 AT&T */
/* All Rights Reserved */
-/*
- * Copyright (c) 1996, by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* from S5R3.1 1.10 */
+#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <sys/param.h>
#include "sed.h"
+
#define NWFILES 11 /* 10 plus one for standard output */
FILE *fin;
FILE *fcode[NWFILES];
@@ -40,7 +41,7 @@ char *lastre;
char sseof;
union reptr *ptrend;
int eflag;
-extern nbra;
+extern int nbra;
char linebuf[LBSIZE+1];
int gflag;
int nlno;
@@ -70,13 +71,16 @@ char AD0MES[] = "No addresses allowed: %s";
char AD1MES[] = "Only one address allowed: %s";
char TOOBIG[] = "Suffix too large - 512 max: %s";
-extern sed; /* IMPORTANT flag !!! */
+extern int sed; /* IMPORTANT flag !!! */
extern char *comple();
extern char *malloc();
-main(argc, argv)
-char *argv[];
+static void dechain(void);
+static void fcomp(void);
+
+int
+main(int argc, char *argv[])
{
int flag_found = 0;
@@ -167,14 +171,14 @@ char *argv[];
execute(*eargv++);
}
(void) fclose(stdout);
- exit(0);
- /*NOTREACHED*/
+ return (0);
}
-fcomp()
+static void
+fcomp(void)
{
- register char *p, *op, *tp;
+ char *p, *op, *tp;
char *address();
union reptr *pt, *pt1;
int i, ii;
@@ -199,7 +203,7 @@ fcomp()
cp = linebuf;
comploop:
-/* (void) fprintf(stderr, "cp: %s\n", cp); /*DEBUG*/
+/* (void) fprintf(stderr, "cp: %s\n", cp); DEBUG */
while(*cp == ' ' || *cp == '\t') cp++;
if(*cp == '\0' || *cp == '#') continue;
if(*cp == ';') {
@@ -572,10 +576,11 @@ done:
rep->r1.command = 0;
lastre = op;
}
+
char *compsub(rhsbuf)
char *rhsbuf;
{
- register char *p, *q;
+ char *p, *q;
p = rhsbuf;
q = cp;
@@ -603,12 +608,13 @@ char *rhsbuf;
}
}
+int
rline(lbuf, lbend)
char *lbuf;
char *lbend;
{
- register char *p, *q;
- register t;
+ char *p, *q;
+ int t;
static char *saveq;
p = lbuf;
@@ -696,7 +702,7 @@ char *lbend;
char *address(expbuf)
char *expbuf;
{
- register char *rcp;
+ char *rcp;
long long lno;
if(*cp == '$') {
@@ -739,7 +745,7 @@ char *text(textbuf, tbend)
char *textbuf;
char *tbend;
{
- register char *p, *q;
+ char *p, *q;
p = textbuf;
q = cp;
@@ -788,7 +794,8 @@ struct label *ptr;
}
-dechain()
+static void
+dechain(void)
{
struct label *lptr;
union reptr *rptr, *trptr;
@@ -814,9 +821,9 @@ dechain()
char *ycomp(expbuf)
char *expbuf;
{
- register char c;
- register char *ep, *tsp;
- register int i;
+ char c;
+ char *ep, *tsp;
+ int i;
char *sp;
ep = expbuf;
@@ -858,8 +865,9 @@ char *expbuf;
return(ep + 0400);
}
-comperr(msg)
-char *msg;
+
+void
+comperr(char *msg)
{
(void) fprintf(stderr, "sed: ");
(void) fprintf(stderr, msg, linebuf);
diff --git a/usr/src/ucbcmd/sed/sed1.c b/usr/src/ucbcmd/sed/sed1.c
index 49835169dd..c5f5d89144 100644
--- a/usr/src/ucbcmd/sed/sed1.c
+++ b/usr/src/ucbcmd/sed/sed1.c
@@ -19,16 +19,16 @@
*
* CDDL HEADER END
*/
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
/* Copyright (c) 1984 AT&T */
/* All Rights Reserved */
-/*
- * Copyright (c) 1996, by Sun Microsystems, Inc.
- * All rights reserved.
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* from S5R3.1 1.7 */
+#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <sys/types.h>
@@ -95,11 +95,17 @@ char rub[] = {"\\177"};
extern char TMMES[];
-execute(file)
-char *file;
+static int match(char *expbuf, int gf);
+static int substitute(union reptr *ipc);
+static void dosub(char *rhsbuf, int n);
+static void command(union reptr *ipc);
+static void arout(void);
+
+void
+execute(char *file)
{
- register char *p1, *p2;
- register union reptr *ipc;
+ char *p1, *p2;
+ union reptr *ipc;
int c;
char *execp;
@@ -218,10 +224,11 @@ char *file;
}
}
-match(expbuf, gf)
-char *expbuf;
+
+static int
+match(char *expbuf, int gf)
{
- register char *p1;
+ char *p1;
if(gf) {
if(*expbuf) return(0);
@@ -235,8 +242,8 @@ char *expbuf;
return(step(p1, expbuf));
}
-substitute(ipc)
-union reptr *ipc;
+static int
+substitute(union reptr *ipc)
{
if(match(ipc->r1.re1, 0) == 0) return(0);
@@ -253,11 +260,10 @@ union reptr *ipc;
return(sflag);
}
-dosub(rhsbuf,n)
-char *rhsbuf;
-int n;
+static void
+dosub(char *rhsbuf, int n)
{
- register char *lp, *sp, *rp;
+ char *lp, *sp, *rp;
int c;
if(n > 0 && n < 999)
@@ -305,7 +311,7 @@ out:
char *place(asp, al1, al2)
char *asp, *al1, *al2;
{
- register char *sp, *l1, *l2;
+ char *sp, *l1, *l2;
sp = asp;
l1 = al1;
@@ -318,11 +324,11 @@ char *asp, *al1, *al2;
return(sp);
}
-command(ipc)
-union reptr *ipc;
+static void
+command(union reptr *ipc)
{
- register int i;
- register char *p1, *p2, *p3;
+ int i;
+ char *p1, *p2, *p3;
char *execp;
@@ -597,8 +603,8 @@ union reptr *ipc;
char *gline(addr)
char *addr;
{
- register char *p1, *p2;
- register c;
+ char *p1, *p2;
+ int c;
sflag = 0;
p1 = addr;
p2 = cbp;
@@ -650,9 +656,9 @@ char *addr;
char *comple(x1, ep, x3, x4)
char *x1, *x3;
char x4;
-register char *ep;
+char *ep;
{
- register char *p;
+ char *p;
p = compile(x1, ep + 1, x3, x4);
if(p == ep + 1)
@@ -661,8 +667,8 @@ register char *ep;
return(p);
}
-regerr(err)
-register err;
+int
+regerr(int err)
{
switch(err) {
@@ -720,11 +726,13 @@ register err;
exit(2);
break;
}
+ return (0);
}
-arout()
+static void
+arout(void)
{
- register char *p1;
+ char *p1;
FILE *fi;
char c;
int t;
@@ -748,4 +756,3 @@ arout()
aptr = abuf;
*aptr = 0;
}
-