Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

unofficial patch for gawk to add -Wexec / --exec
Hello.  Given the recent discussion here about being able to pass
command line options (and thus arbitrary source code via --source) to
gawk in CGI scripts, here is a patch that adds mawk's -Wexec to gawk.
The difference between -f and -Wexec (or --exec) is that --exec ends all
option processing.  Thanks to John DuBois and Don Stokes for their input.

This will make its way into 3.1.5.

Arnold
-------------------------- cut here ----------------------------------
--- ../gawk-3.1.4/main.c	2004-07-28 16:42:19.000000000 +0300
+++ main.c	2004-09-20 13:12:54.000000000 +0300
@@ -181,6 +186,7 @@
{ "version",		no_argument,		NULL,		'V' },
{ "usage",		no_argument,		NULL,		'u' },
{ "help",		no_argument,		NULL,		'u' },
+	{ "exec",		required_argument,	NULL,		'S' },
#ifdef GAWKDEBUG
{ "parsedebug",		no_argument,		NULL,		'D' },
#endif
@@ -292,6 +299,7 @@
preassigns_add(PRE_ASSIGN_FS, optarg);
break;

+		case 'S':
case 'f':
/*
* a la MKS awk, allow multiple -f options.
@@ -436,6 +444,8 @@
let getopt print error message for us */
break;
}
+		if (c == 'S')	/* --exec ends option processing */
+			break;
}
out:

@@ -636,6 +655,7 @@
fputs(_("\t-W copyleft\t\t--copyleft\n"), fp);
fputs(_("\t-W copyright\t\t--copyright\n"), fp);
fputs(_("\t-W dump-variables[=file]\t--dump-variables[=file]\n"), fp);
+	fputs(_("\t-W exec=file\t\t--exec=file\n"), fp);
fputs(_("\t-W gen-po\t\t--gen-po\n"), fp);
fputs(_("\t-W help\t\t\t--help\n"), fp);
fputs(_("\t-W lint[=fatal]\t\t--lint[=fatal]\n"), fp);
--
Aharon (Arnold) Robbins --- Pioneer Consulting Ltd.	arnold AT skeeve DOT com
P.O. Box 354		Home Phone: +972  8 979-0381	Fax: +1 206 350 8765
Nof Ayalon		Cell Phone: +972 50  729-7545
D.N. Shimshon 99785	ISRAEL

Report this thread to moderator Post Follow-up to this message
Old Post
Aharon Robbins
09-20-04 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

AWK archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:19 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.