summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorljo <ljo@FreeBSD.org>1994-01-12 03:10:31 +0000
committerljo <ljo@FreeBSD.org>1994-01-12 03:10:31 +0000
commite5c0903835924e09ecc9231765664cc516119812 (patch)
tree8e77eed5c6b560970c29943e7f1951aa1f16fc79 /usr.bin
parent17d8c0e839bd65f3498c306ff29a7b13530a3d90 (diff)
downloadFreeBSD-src-e5c0903835924e09ecc9231765664cc516119812.zip
FreeBSD-src-e5c0903835924e09ecc9231765664cc516119812.tar.gz
Added -o option to rename C output file. This only works when Fortran
input is from a file, not stdin. Added some support for this in teh parse function.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/f2c/main.c11
-rw-r--r--usr.bin/f2c/parse_args.c3
2 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/f2c/main.c b/usr.bin/f2c/main.c
index a4bb2cd..899e955 100644
--- a/usr.bin/f2c/main.c
+++ b/usr.bin/f2c/main.c
@@ -95,11 +95,13 @@ char *halign, *ohalign;
int krparens = NO;
int hsize; /* for padding under -h */
int htype; /* for wr_equiv_init under -h */
+char *o_coutput = 0;
#define f2c_entry(swit,count,type,store,size) \
p_entry ("-", swit, 0, count, type, store, size)
static arg_info table[] = {
+ f2c_entry ("o", P_ONE_ARG, P_STRING, &o_coutput, YES),
f2c_entry ("w66", P_NO_ARGS, P_INT, &ftn66flag, YES),
f2c_entry ("w", P_NO_ARGS, P_INT, &nowarnflag, YES),
f2c_entry ("66", P_NO_ARGS, P_INT, &no66flag, YES),
@@ -453,13 +455,20 @@ char **argv;
initkey();
if (file_name && *file_name) {
if (debugflag != 1) {
- coutput = c_name(file_name,'c');
+ if (!o_coutput)
+ coutput = c_name(file_name,'c');
+ else
+ coutput = o_coutput;
if (Castargs1 >= 2)
proto_fname = c_name(file_name,'P');
}
cdfilename = coutput;
if (skipC)
coutput = 0;
+ if (coutput[0] == '-'){
+ c_output = stdout;
+ coutput = 0;
+ }
else if (!(c_output = fopen(coutput, textwrite))) {
file_name = coutput;
coutput = 0; /* don't delete read-only .c file */
diff --git a/usr.bin/f2c/parse_args.c b/usr.bin/f2c/parse_args.c
index 8325ae8..f978383 100644
--- a/usr.bin/f2c/parse_args.c
+++ b/usr.bin/f2c/parse_args.c
@@ -62,6 +62,7 @@ this software.
#include "parse.h"
#include <math.h> /* For atof */
#include <ctype.h>
+#include "defs.h"
#define MAX_INPUT_SIZE 1000
@@ -432,10 +433,10 @@ char *prefix, *string;
case P_FILE:
case P_OLD_FILE:
case P_NEW_FILE:
- *store = str;
if (str == NULL)
fprintf (stderr, "%s: Missing argument after '%s%s'\n",
this_program, prefix, string);
+ *store = copys(str);
length = str ? strlen (str) : 0;
break;
case P_CHAR:
OpenPOWER on IntegriCloud