From 83ee1e7a8a46b7d2d151e8a872f8b617bd903dda Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Thu, 30 Nov 1995 21:58:11 +0000 Subject: [PATCH] Make output file appear in directory in which makeBpt is executed --- src/bpt/makeBpt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bpt/makeBpt.c b/src/bpt/makeBpt.c index 0ab92921b..d50a40a64 100644 --- a/src/bpt/makeBpt.c +++ b/src/bpt/makeBpt.c @@ -102,14 +102,17 @@ int main(argc, argv) char *pext; FILE *outFile; FILE *inFile; + char *plastSlash; if(argc!=2) { fprintf(stderr,"usage: makeBpt file.data\n"); exit(-1); } - outFilename = calloc(1,strlen(argv[1])+2); - strcpy(outFilename,argv[1]); + plastSlash = strrchr(argv[1],'/'); + plastSlash = (plastSlash ? plastSlash+1 : argv[1]); + outFilename = calloc(1,strlen(plastSlash)+2); + strcpy(outFilename,plastSlash); pext = strstr(outFilename,".data"); if(!pext) { fprintf(stderr,"Input file MUST have .data extension\n");