usr.sbin/amd patch

Peter Avalos pavalos at theshell.com
Sun Dec 31 14:50:46 PST 2006


Here's a patch that makes the newer version of flex play nice with amd.
These changes were taken from the latest sources of am-utils.  I figured
it'd be easy to just patch our current amd sources rather than work on
a complete upgrade of am-utils.

Thanks,
Peter

http://www.theshell.com/~pavalos/wip/amd.patch

Index: usr.sbin/amd/amd/Makefile
===================================================================
RCS file: /home/dcvs/src/usr.sbin/amd/amd/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- usr.sbin/amd/amd/Makefile	14 May 2006 18:07:29 -0000	1.4
+++ usr.sbin/amd/amd/Makefile	31 Dec 2006 22:05:37 -0000
@@ -7,12 +7,13 @@
 # $DragonFly: src/usr.sbin/amd/amd/Makefile,v 1.4 2006/05/14 18:07:29 swildner Exp $
 #
 
-.PATH:		${.CURDIR}/../../../contrib/amd/amd
+CONTRIBDIR=	${.CURDIR}/../../../contrib/amd/amd
+.PATH:		${CONTRIBDIR}
 
 PROG=		amd
 MAN=		amd.8
 
-SRCS=		conf_parse.y conf_tok.l
+SRCS=		conf_parse.y.patch conf_tok.l.patch
 SRCS+=		am_ops.c amd.c amfs_auto.c amfs_direct.c amfs_error.c
 SRCS+=		amfs_host.c amfs_inherit.c amfs_link.c amfs_linkx.c amfs_nfsl.c
 SRCS+=		amfs_nfsx.c amfs_program.c amfs_root.c amfs_toplvl.c
Index: usr.sbin/amd/amd/conf_parse.y.patch
===================================================================
RCS file: usr.sbin/amd/amd/conf_parse.y.patch
diff -N usr.sbin/amd/amd/conf_parse.y.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ usr.sbin/amd/amd/conf_parse.y.patch	31 Dec 2006 22:32:28 -0000
@@ -0,0 +1,30 @@
+$DragonFly$
+--- conf_parse.y.orig	2006-12-31 17:02:18.000000000 -0500
++++ conf_parse.y	2006-12-31 17:04:00.000000000 -0500
+@@ -66,7 +66,7 @@
+ #endif /* not __GNUC__ */
+ 
+ extern char *yytext;
+-extern int yylineno;
++extern int ayylineno;
+ extern int yylex(void);
+ 
+ static int yyerror(const char *s);
+@@ -78,7 +78,7 @@
+ #define PARSE_DEBUG 0
+ 
+ #if PARSE_DEBUG
+-# define dprintf(f,s) fprintf(stderr, (f), yylineno, (s))
++# define dprintf(f,s) fprintf(stderr, (f), ayylineno, (s))
+ # define amu_return(v)
+ #else
+ # define dprintf(f,s)
+@@ -168,7 +168,7 @@
+ yyerror(const char *s)
+ {
+   fprintf(stderr, "AMDCONF: %s on line %d (section %s)\n",
+-	  s, yylineno,
++	  s, ayylineno,
+ 	  (header_section ? header_section : "null"));
+   exit(1);
+   return 1;	/* to full compilers that insist on a return statement */
Index: usr.sbin/amd/amd/conf_tok.l.patch
===================================================================
RCS file: usr.sbin/amd/amd/conf_tok.l.patch
diff -N usr.sbin/amd/amd/conf_tok.l.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ usr.sbin/amd/amd/conf_tok.l.patch	31 Dec 2006 22:32:37 -0000
@@ -0,0 +1,62 @@
+$DragonFly$
+--- conf_tok.l.orig	2003-06-16 22:42:47.000000000 -0400
++++ conf_tok.l	2006-12-31 16:52:52.000000000 -0500
+@@ -77,9 +77,10 @@
+ # ifndef ECHO
+ #  define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+ # endif /* not ECHO */
+-int yylineno = 0;
+ #endif /* FLEX_SCANNER */
+ 
++int ayylineno = 0;
++
+ int yylex(void);
+ /*
+  * some systems such as DU-4.x have a different GNU flex in /usr/bin
+@@ -93,19 +94,25 @@
+ #define TOK_DEBUG 0
+ 
+ #if TOK_DEBUG
+-# define dprintf(f,s) fprintf(stderr, (f), yylineno, (s))
++# define dprintf(f,s) fprintf(stderr, (f), ayylineno, (s))
+ # define amu_return(v)
+ #else
+ # define dprintf(f,s)
+ # define amu_return(v) return((v))
+ #endif /* TOK_DEBUG */
+ 
+-/* no need to use yyunput() or yywrap() */
+-#define YY_NO_UNPUT
++/* no need to use yywrap() */
+ #define YY_SKIP_YYWRAP
+ 
+ %}
+ 
++/* This option causes Solaris lex to fail.  Use flex.  See BUGS file */
++/* no need to use yyunput() */
++%option nounput
++
++/* allocate more output slots so lex scanners don't run out of mem */
++%o 1024
++
+ DIGIT		[0-9]
+ ALPHA		[A-Za-z]
+ ALPHANUM	[A-Za-z0-9]
+@@ -119,7 +126,7 @@
+ %%
+ 
+ \n			{
+-			yylineno++;
++			ayylineno++;
+ 			amu_return(NEWLINE);
+ 			}
+ 
+@@ -146,7 +153,7 @@
+ 			}
+ "#"[^\n]*\n		{
+ 			/* a comment line includes the terminating \n */
+-			yylineno++;
++			ayylineno++;
+ 			yytext[strlen((char *)yytext)-1] = '\0';
+ 			dprintf("%8d: Comment \"%s\"\n", yytext);
+ 			}
Index: usr.sbin/amd/fsinfo/Makefile
===================================================================
RCS file: /home/dcvs/src/usr.sbin/amd/fsinfo/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- usr.sbin/amd/fsinfo/Makefile	17 Jun 2003 04:29:52 -0000	1.2
+++ usr.sbin/amd/fsinfo/Makefile	31 Dec 2006 22:28:31 -0000
@@ -7,18 +7,19 @@
 # $DragonFly: src/usr.sbin/amd/fsinfo/Makefile,v 1.2 2003/06/17 04:29:52 dillon Exp $
 #
 
-.PATH:		${.CURDIR}/../../../contrib/amd/fsinfo
+CONTRIBDIR=	${.CURDIR}/../../../contrib/amd/fsinfo
+.PATH:		${CONTRIBDIR}
 
 PROG=		fsinfo
 MAN=		fsinfo.8
 
-SRCS=		fsi_gram.y fsi_lex.l
+SRCS=		fsinfo.h.patch fsi_gram.y fsi_lex.l.patch
 SRCS+=		fsi_analyze.c fsi_dict.c fsi_util.c fsinfo.c wr_atab.c 
 SRCS+=		wr_bparam.c wr_dumpset.c wr_exportfs.c wr_fstab.c
 
-CFLAGS+=	-I${.CURDIR}/../../../contrib/amd/fsinfo
+CFLAGS+=	-I${.OBJDIR} -I${CONTRIBDIR}
 
-CLEANFILES+=	fsi_gram.c fsi_gram.h fsi_lex.c
+CLEANFILES+=	fsi_gram.c fsi_gram.h fsi_lex.c fsinfo.h
 
 fsi_lex.o:	fsi_gram.h
 
Index: usr.sbin/amd/fsinfo/fsi_lex.l.patch
===================================================================
RCS file: usr.sbin/amd/fsinfo/fsi_lex.l.patch
diff -N usr.sbin/amd/fsinfo/fsi_lex.l.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ usr.sbin/amd/fsinfo/fsi_lex.l.patch	31 Dec 2006 22:32:47 -0000
@@ -0,0 +1,79 @@
+$DragonFly$
+--- fsi_lex.l.orig	2006-12-31 17:08:23.000000000 -0500
++++ fsi_lex.l	2006-12-31 17:12:03.000000000 -0500
+@@ -48,8 +48,9 @@
+  * TODO: Needs rewriting.
+  */
+ 
++static int ayylineno;
++
+ #ifdef FLEX_SCANNER
+-static int yylineno;
+ # define INIT_STATE {				\
+ 		switch ((yy_start - 1) / 2) {	\
+ 		case 0:				\
+@@ -159,6 +160,13 @@
+ 
+ %}
+ 
++/* This option causes Solaris lex to fail.  Use flex.  See BUGS file */
++/* no need to use yyunput() */
++%option nounput
++
++/* allocate more output slots so lex scanners don't run out of mem */
++%o 1024
++
+ %start F Q
+ 
+ %%
+@@ -166,22 +174,22 @@
+ 
+ <F>[^ \t\n"={}]+	{ return find_resword(yytext); } /* dummy " */
+ <F>[ \t]		;
+-<F>"\n"			{ yylineno++; }
++<F>"\n"			{ ayylineno++; }
+ <F>[={}]		{ return *yytext; }
+ 
+ <F>\"			{ BEGIN Q; optr = ostr; quoted = 1; }
+-<Q>\n			{ yylineno++; yyerror("\" expected"); BEGIN F; }
++<Q>\n			{ ayylineno++; yyerror("\" expected"); BEGIN F; }
+ <Q>\\b			{ *optr++ = '\b'; /* escape */ }
+ <Q>\\t			{ *optr++ = '\t'; /* escape */ }
+ <Q>\\\"			{ *optr++ = '\"'; /* escape */ }
+ <Q>\\\\			{ *optr++ = '\\'; /* escape */ }
+-<Q>\\\n			{ yylineno++; /* continue */ }
++<Q>\\\n			{ ayylineno++; /* continue */ }
+ <Q>\\r			{ *optr++ = '\r'; /* escape */ }
+ <Q>\\n			{ *optr++ = '\n'; /* escape */ }
+ <Q>\\f			{ *optr++ = '\f'; /* escape */ }
+ <Q>"\\ "		{ *optr++ = ' '; /* force space */ }
+ <Q>\\.			{ yyerror("Unknown \\ sequence"); }
+-<Q>([ \t]|"\\\n"){2,}	{ char *p = (char *) yytext-1; while ((p = strchr(p+1, '\n'))) yylineno++; }
++<Q>([ \t]|"\\\n"){2,}	{ char *p = (char *) yytext-1; while ((p = strchr(p+1, '\n'))) ayylineno++; }
+ <Q>\"			{ BEGIN F; quoted = 0;
+ 				*optr = '\0';
+ 				yylval.s = strdup(ostr);
+@@ -235,12 +243,11 @@
+ 
+   va_start(ap, fmt);
+   col_cleanup(0);
+-  fprintf(stderr, "%s:%d: ", fsi_filename ? fsi_filename : "/dev/stdin", yylineno);
+-  fprintf(stderr, fmt, ap);
++  fprintf(stderr, "%s:%d: ", fsi_filename ? fsi_filename : "/dev/stdin", ayylineno);
++  vfprintf(stderr, fmt, ap);
+   fputc('\n', stderr);
+   parse_errors++;
+   va_end(ap);
+-  if (0) unput(0);/* dummy to shut gcc up: "unput defined but not used" */
+   return 0;
+ }
+ 
+@@ -249,7 +256,7 @@
+ current_location(void)
+ {
+   ioloc *ip = CALLOC(struct ioloc);
+-  ip->i_line = yylineno;
++  ip->i_line = ayylineno;
+   ip->i_file = fsi_filename;
+   return ip;
+ }
Index: usr.sbin/amd/fsinfo/fsinfo.h.patch
===================================================================
RCS file: usr.sbin/amd/fsinfo/fsinfo.h.patch
diff -N usr.sbin/amd/fsinfo/fsinfo.h.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ usr.sbin/amd/fsinfo/fsinfo.h.patch	31 Dec 2006 22:32:57 -0000
@@ -0,0 +1,11 @@
+$DragonFly$
+--- fsinfo.h.orig	2006-12-31 17:23:10.000000000 -0500
++++ fsinfo.h	2006-12-31 17:23:56.000000000 -0500
+@@ -109,7 +109,6 @@
+  */
+ #ifndef yywrap
+ extern int yywrap(void);
+-# define yywrap() 1
+ #endif /* not yywrap */
+ extern int yyparse(void);
+ extern int write_atab(qelem *q);
Attachment:
pgp00012.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00012.pgp
Type: application/octet-stream
Size: 189 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20061231/421ad111/attachment-0013.obj>


More information about the Submit mailing list