static char *fname;
static FILE *outfile;
-static FILE *openFile(const char *name, const char *mode, const char* cmd)
+static FILE *openFile(const char *name, const char* cmd)
{
FILE *fp;
- char *modestr;
- fp = fopen(name, mode);
+ fp = fopen(name, "w");
if (!fp) {
- if (*mode == 'r')
- modestr = "reading";
- else
- modestr = "writing";
- fprintf(stderr, "%s: could not open file %s for %s\n",
- cmd, name, modestr);
+ fprintf(stderr, "%s: could not open file %s for writing\n", cmd, name);
exit(-1);
}
return (fp);
fprintf (stderr, "-k arg %s must be an integer >= 2 - ignored\n", optarg);
break;
case 'o':
- outfile = openFile(optarg, "w", cmd);
+ outfile = openFile(optarg, cmd);
break;
case 'p':
if ((sscanf(optarg,"%lf",&s) > 0))