@@ -17,6 +17,7 @@ void shortoper(complex *kxwop, int nkx, complex *xwop, int opl, float dx,
17
17
float kw , float alfa1_w , float alfa2_w , float scale , int filter );
18
18
19
19
int writeData (char * filename , float * data , segy * hdrs , int n2 );
20
+ void name_ext (char * filename , char * extension );
20
21
21
22
/*********************** self documentation **********************/
22
23
char * sdoc [] = {
@@ -296,12 +297,8 @@ int main(int argc, char **argv)
296
297
writeData (NULL , data_out , hdrs , n2 );
297
298
}
298
299
else {
299
- s = file_out ;
300
- q = & filename [0 ];
301
- while (* s != '.' ) * q ++ = * s ++ ;
302
- * q ++ = '_' ; * q ++ = 'k' ; * q ++ = 'x' ;
303
- while (* s != '\0' ) * q ++ = * s ++ ;
304
- * q = '\0' ;
300
+ strcpy (filename , file_out );
301
+ name_ext (filename , "_kx" );
305
302
306
303
if (verbose ) vmess ("Writing Kx-results to file %s" , filename );
307
304
writeData (filename , data_out , hdrs , n2 );
@@ -343,12 +340,8 @@ int main(int argc, char **argv)
343
340
writeData (NULL , data_out , hdrs , n2 );
344
341
}
345
342
else {
346
- s = file_out ;
347
- q = & filename [0 ];
348
- while (* s != '.' ) * q ++ = * s ++ ;
349
- * q ++ = '_' ; * q ++ = 'x' ;
350
- while (* s != '\0' ) * q ++ = * s ++ ;
351
- * q = '\0' ;
343
+ strcpy (filename , file_out );
344
+ name_ext (filename , "_x" );
352
345
353
346
if (verbose ) vmess ("Writing X-results to file %s" , filename );
354
347
writeData (filename , data_out , hdrs , n2 );
0 commit comments