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.
This commit is contained in:
L Jonas Olsson 1994-01-12 03:10:31 +00:00
parent b06a5891b4
commit aaed6788e7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=970
2 changed files with 12 additions and 2 deletions

View File

@ -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 */

View File

@ -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: