| 1 |
/*=========================================================================== |
| 2 |
Copyright (C) 1995-2006 European Southern Observatory (ESO) |
| 3 |
|
| 4 |
This program is free software; you can redistribute it and/or |
| 5 |
modify it under the terms of the GNU General Public License as |
| 6 |
published by the Free Software Foundation; either version 2 of |
| 7 |
the License, or (at your option) any later version. |
| 8 |
|
| 9 |
This program is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
GNU General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public |
| 15 |
License along with this program; if not, write to the Free |
| 16 |
Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, |
| 17 |
MA 02139, USA. |
| 18 |
|
| 19 |
Correspondence concerning ESO-MIDAS should be addressed as follows: |
| 20 |
Internet e-mail: [email protected] |
| 21 |
Postal address: European Southern Observatory |
| 22 |
Data Management Division |
| 23 |
Karl-Schwarzschild-Strasse 2 |
| 24 |
D 85748 Garching bei Muenchen |
| 25 |
GERMANY |
| 26 |
===========================================================================*/ |
| 27 |
|
| 28 |
/*+++++++++++++++++++++++ SC interface module SCF +++++++++++++++++++++++ |
| 29 |
.LANGUAGE C |
| 30 |
.IDENTIFICATION Module SCF |
| 31 |
.AUTHOR K. Banse ESO - Garching |
| 32 |
.KEYWORDS standard interfaces, bulk data files |
| 33 |
.ENVIRONMENT VMS and UNIX |
| 34 |
.COMMENTS |
| 35 |
holds SCFGET, SCFPUT, SCFDEL, SCFXDEL, SCFCRE, SCFXCR, SCFRNM |
| 36 |
.REMARKS |
| 37 |
opening modes are: F_I_MODE, F_O_MODE, F_IO_MODE, F_X_MODE. |
| 38 |
data types are: D_R4_FORMAT, D_I2_FORMAT, D_I1_FORMAT, D_OLD_FORMAT. |
| 39 |
filetype no's are: F_IMA_TYPE, F_TBL_TYPE, F_FIT_TYPE. |
| 40 |
|
| 41 |
.VERSION [1.20] 871109: creation |
| 42 |
060531 last modif |
| 43 |
|
| 44 |
----------------------------------------------------------------------------*/ |
| 45 |
|
| 46 |
#include <fileexts.h> |
| 47 |
|
| 48 |
#include <osyparms.h> |
| 49 |
|
| 50 |
/* |
| 51 |
|
| 52 |
*/ |
| 53 |
|
| 54 |
int SCFGET(imno,felem,size,actsize,bufadr) |
| 55 |
|
| 56 |
/*++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 57 |
.PURPOSE |
| 58 |
read data from disk frame into memory |
| 59 |
.ALGORITHM |
| 60 |
synchronous disk I/O |
| 61 |
.RETURNS |
| 62 |
return status ( 0 = o.k ) |
| 63 |
--------------------------------------------------------*/ |
| 64 |
|
| 65 |
int imno; /* IN : file no. of data frame */ |
| 66 |
int felem; /* IN : 1st pixel to be accessed in data space */ |
| 67 |
int size; /* IN : number of data values (pixels) to be read |
| 68 |
if < 1, take all available data*/ |
| 69 |
int *actsize; /* OUT: actual no. of pixels read */ |
| 70 |
char *bufadr; /* IN: address of data buffer */ |
| 71 |
|
| 72 |
{ |
| 73 |
int status; |
| 74 |
register int nr; |
| 75 |
|
| 76 |
char *pntrs[2]; |
| 77 |
|
| 78 |
struct FCT_STRUCT *fctpntr; |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
/* check 'imno' + 'felem' */ |
| 84 |
|
| 85 |
if ( (imno < 0) || (imno >= FCT.MAXENT) || (felem <= 0) ) |
| 86 |
{ |
| 87 |
status = ERR_INPINV; |
| 88 |
goto end_of_it; |
| 89 |
} |
| 90 |
|
| 91 |
|
| 92 |
fctpntr = FCT.ENTRIES + imno; |
| 93 |
|
| 94 |
if (fctpntr->FILTYP > 0) /* FITS file */ |
| 95 |
{ |
| 96 |
char *datpntr, *zpntr; |
| 97 |
int mm, felbytes, nbytes; |
| 98 |
|
| 99 |
|
| 100 |
if (fctpntr->DATTYP != fctpntr->FORMAT) |
| 101 |
nbytes = get_byte(fctpntr->DATTYP); |
| 102 |
else |
| 103 |
nbytes = fctpntr->NOBYTE; |
| 104 |
|
| 105 |
felem --; |
| 106 |
felbytes = felem * nbytes; |
| 107 |
|
| 108 |
/* |
| 109 |
printf |
| 110 |
("SCFGET: name = %s, BDADDR[0] = %x\n",fctpntr->NAME,fctpntr->BDADDR[0]); |
| 111 |
*/ |
| 112 |
|
| 113 |
if (fctpntr->BDADDR[0] != (char *) 0) |
| 114 |
{ |
| 115 |
datpntr = fctpntr->BDADDR[0] + felbytes; |
| 116 |
mm = fctpntr->KAUX[1]; |
| 117 |
} |
| 118 |
else |
| 119 |
{ |
| 120 |
status = SCFMAP(imno,F_I_MODE,1,-1,&mm,&datpntr); |
| 121 |
if (status != ERR_NORMAL) goto end_of_it; |
| 122 |
|
| 123 |
datpntr += felbytes; |
| 124 |
} |
| 125 |
|
| 126 |
*actsize = mm - felem; |
| 127 |
if (*actsize > 0) |
| 128 |
{ |
| 129 |
if (size < 1) size = fctpntr->SIZE; |
| 130 |
if (*actsize > size) *actsize = size; |
| 131 |
zpntr = bufadr; |
| 132 |
|
| 133 |
if (fctpntr->FITSOUT == 'Y') |
| 134 |
{ /* we are called from fitswdm() via SCFSAV() */ |
| 135 |
if (fctpntr->DATTYP != fctpntr->FORMAT) |
| 136 |
{ |
| 137 |
conv_pix(bufadr,datpntr,fctpntr->FORMAT,fctpntr->DATTYP,*actsize); |
| 138 |
return (ERR_NORMAL); |
| 139 |
} |
| 140 |
fctpntr->FITSOUT = ' '; |
| 141 |
} |
| 142 |
|
| 143 |
/* same data format in memory and in FITS file */ |
| 144 |
|
| 145 |
for (nr=0; nr<((*actsize)*nbytes); nr++) *zpntr++ = *datpntr++; |
| 146 |
return (ERR_NORMAL); |
| 147 |
} |
| 148 |
|
| 149 |
status = ERR_INPINV; |
| 150 |
} |
| 151 |
|
| 152 |
else |
| 153 |
{ |
| 154 |
if (fctpntr->ACCESS == 'X') |
| 155 |
{ |
| 156 |
felem --; |
| 157 |
*actsize = fctpntr->SIZE - felem; |
| 158 |
|
| 159 |
if ( (fctpntr->DATTYP == fctpntr->FORMAT) && |
| 160 |
(fctpntr->BDADDR[0] != (char *) 0) && |
| 161 |
(*actsize > 0) ) |
| 162 |
{ |
| 163 |
char *datpntr, *zpntr; |
| 164 |
|
| 165 |
datpntr = fctpntr->BDADDR[0] + (felem * fctpntr->NOBYTE); |
| 166 |
if (size < 1) size = fctpntr->SIZE; |
| 167 |
if (*actsize > size) *actsize = size; |
| 168 |
|
| 169 |
zpntr = bufadr; |
| 170 |
for (nr=0; nr<((*actsize)*fctpntr->NOBYTE); nr++) |
| 171 |
*zpntr++ = *datpntr++; |
| 172 |
return (ERR_NORMAL); |
| 173 |
} |
| 174 |
|
| 175 |
status = ERR_INPINV; |
| 176 |
} |
| 177 |
else |
| 178 |
{ |
| 179 |
if (fctpntr->DATTYP != fctpntr->FORMAT) |
| 180 |
{ /* check if data type mismatch */ |
| 181 |
pntrs[0] = bufadr; |
| 182 |
status = conv_dat(3,imno,felem,size,actsize,pntrs); |
| 183 |
} |
| 184 |
else |
| 185 |
status = rddisk(imno,felem,size,actsize,bufadr); |
| 186 |
if (status == ERR_NORMAL) return ERR_NORMAL; |
| 187 |
} |
| 188 |
} |
| 189 |
|
| 190 |
|
| 191 |
end_of_it: |
| 192 |
MID_E2(10,imno,"...",status,1); |
| 193 |
return (status); |
| 194 |
} |
| 195 |
/* |
| 196 |
|
| 197 |
*/ |
| 198 |
|
| 199 |
int SCFPUT(imno,felem,size,bufadr) |
| 200 |
|
| 201 |
/*++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 202 |
.PURPOSE |
| 203 |
write data from memory into disk frame |
| 204 |
.ALGORITHM |
| 205 |
synchronous disk I/O |
| 206 |
.RETURNS |
| 207 |
return status ( 0 = o.k ) |
| 208 |
--------------------------------------------------------*/ |
| 209 |
|
| 210 |
int imno /* IN : file no. of data frame */; |
| 211 |
int felem /* IN : 1st pixel to be accessed in data space */; |
| 212 |
int size /* IN : no. of data values (pixels) to be written */; |
| 213 |
char *bufadr; /* IN: address of data buffer */ |
| 214 |
|
| 215 |
{ |
| 216 |
int status, mm; |
| 217 |
|
| 218 |
char *pntrs[2]; |
| 219 |
|
| 220 |
struct FCT_STRUCT *fctpntr; |
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
/* check 'imno' + 'felem' + 'size' */ |
| 226 |
|
| 227 |
if ( (imno < 0) || (imno >= FCT.MAXENT) || (felem <= 0) || (size <= 0) ) |
| 228 |
{ |
| 229 |
status = ERR_INPINV; |
| 230 |
goto end_of_it; |
| 231 |
} |
| 232 |
|
| 233 |
|
| 234 |
fctpntr = FCT.ENTRIES + imno; |
| 235 |
|
| 236 |
if (fctpntr->PROT == 2) |
| 237 |
{ |
| 238 |
status = ERR_FILPRO; |
| 239 |
goto end_of_it; |
| 240 |
} |
| 241 |
|
| 242 |
|
| 243 |
if (fctpntr->LINK[0] == 2) |
| 244 |
fctpntr->ACCESS = 'O'; /* if son, we update later on ... */ |
| 245 |
|
| 246 |
|
| 247 |
if (fctpntr->FILTYP > 0) /* FITS file */ |
| 248 |
{ |
| 249 |
char *datpntr, *zpntr; |
| 250 |
int mm, felbytes, nbytes; |
| 251 |
|
| 252 |
if (fctpntr->DATTYP != fctpntr->FORMAT) |
| 253 |
nbytes = get_byte(fctpntr->DATTYP); |
| 254 |
else |
| 255 |
nbytes = fctpntr->NOBYTE; |
| 256 |
|
| 257 |
felem --; |
| 258 |
felbytes = felem * nbytes; |
| 259 |
/* |
| 260 |
printf |
| 261 |
("SCFPUT: name = %s, |
| 262 |
BDADDR[0] = %x\n",fctpntr->NAME, |
| 263 |
fctpntr->BDADDR[0]); |
| 264 |
*/ |
| 265 |
if (fctpntr->BDADDR[0] != (char *) 0) |
| 266 |
{ /* already mapped in */ |
| 267 |
datpntr = fctpntr->BDADDR[0] + felbytes; |
| 268 |
mm = fctpntr->KAUX[1]; |
| 269 |
fctpntr->ACCESS = 'O'; /* ensure update at SCFCLO */ |
| 270 |
} |
| 271 |
else |
| 272 |
{ |
| 273 |
status = SCFMAP(imno,F_O_MODE,1,-1,&mm,&datpntr); |
| 274 |
if (status != ERR_NORMAL) goto end_of_it; |
| 275 |
|
| 276 |
datpntr += felbytes; |
| 277 |
} |
| 278 |
|
| 279 |
if (felem+size <= mm) |
| 280 |
{ |
| 281 |
register int nr; |
| 282 |
|
| 283 |
zpntr = bufadr; |
| 284 |
for (nr=0; nr<((size)*nbytes); nr++) *datpntr++ = *zpntr++; |
| 285 |
return ERR_NORMAL; |
| 286 |
} |
| 287 |
|
| 288 |
status = ERR_INPINV; |
| 289 |
} |
| 290 |
|
| 291 |
else |
| 292 |
{ |
| 293 |
/* |
| 294 |
printf |
| 295 |
("SCFPUT: DATTYP = %d, |
| 296 |
FORMAT= %d\n", fctpntr->DATTYP, |
| 297 |
fctpntr->FORMAT); |
| 298 |
*/ |
| 299 |
if (fctpntr->DATTYP != fctpntr->FORMAT) |
| 300 |
{ /* check if data type mismatch */ |
| 301 |
pntrs[0] = bufadr; |
| 302 |
status = conv_dat(2,imno,felem,size,&mm,pntrs); |
| 303 |
} |
| 304 |
else |
| 305 |
status = wrdisk(imno,felem,size,bufadr); |
| 306 |
|
| 307 |
if (status == ERR_NORMAL) return ERR_NORMAL; |
| 308 |
} |
| 309 |
|
| 310 |
|
| 311 |
end_of_it: |
| 312 |
MID_E2(11,imno,"...",status,1); |
| 313 |
return (status); |
| 314 |
} |
| 315 |
/* |
| 316 |
|
| 317 |
*/ |
| 318 |
|
| 319 |
int SCFXDEL(imno) |
| 320 |
|
| 321 |
/*++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 322 |
.PURPOSE |
| 323 |
delete a frame |
| 324 |
.ALGORITHM |
| 325 |
use os-modules to do the job |
| 326 |
.RETURNS |
| 327 |
return status ( 0 = o.k ) |
| 328 |
--------------------------------------------------*/ |
| 329 |
|
| 330 |
int imno; /* IN : frame id of file */ |
| 331 |
|
| 332 |
{ |
| 333 |
char *mypntr, temp[200]; |
| 334 |
|
| 335 |
int status; |
| 336 |
|
| 337 |
struct FCT_STRUCT *fctpntr; |
| 338 |
|
| 339 |
extern int osfdelete(); |
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
/* obtain file name */ |
| 345 |
|
| 346 |
mypntr = &temp[10]; /* because of eventual error message ... */ |
| 347 |
status = MID_RETNAM(imno,mypntr,120); |
| 348 |
|
| 349 |
if (status != ERR_NORMAL) |
| 350 |
{ |
| 351 |
(void) strcpy(mypntr,"invalid file id..."); |
| 352 |
status = 1; |
| 353 |
} |
| 354 |
|
| 355 |
else |
| 356 |
{ |
| 357 |
fctpntr = FCT.ENTRIES + imno; |
| 358 |
fctpntr->CATALOG[1] = 'N'; /* we do not add this file to a catal */ |
| 359 |
if (fctpntr->CATALOG[0] == 'T') |
| 360 |
status = TCTCLO(imno); |
| 361 |
else |
| 362 |
status = SCFCLO(imno); |
| 363 |
|
| 364 |
|
| 365 |
/* and delete it */ |
| 366 |
|
| 367 |
status = osfdelete(mypntr); |
| 368 |
} |
| 369 |
|
| 370 |
if (status == 0) |
| 371 |
return (ERR_NORMAL); |
| 372 |
else |
| 373 |
{ |
| 374 |
(void) strncpy(temp,"SCFxDEL: ",9); |
| 375 |
MID_ERROR("FSY",temp,status,1); |
| 376 |
return (ERR_INPINV); |
| 377 |
} |
| 378 |
} |
| 379 |
/* |
| 380 |
|
| 381 |
*/ |
| 382 |
|
| 383 |
int SCFDEL(name) |
| 384 |
|
| 385 |
/*++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 386 |
.PURPOSE |
| 387 |
delete a frame |
| 388 |
.ALGORITHM |
| 389 |
use FSY modules to do the job |
| 390 |
.RETURNS |
| 391 |
return status ( 0 = o.k ) |
| 392 |
--------------------------------------------------*/ |
| 393 |
|
| 394 |
char *name /* IN : name of object */; |
| 395 |
|
| 396 |
{ |
| 397 |
char *mypntr, temp[200]; |
| 398 |
|
| 399 |
int mm, namtyp, part_no; |
| 400 |
int status; |
| 401 |
|
| 402 |
struct FCT_STRUCT *fctpntr; |
| 403 |
|
| 404 |
extern int osfdelete(); |
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
/* check file name */ |
| 410 |
|
| 411 |
mypntr = &temp[8]; /* because of eventual error message ... */ |
| 412 |
CGN_CLEANF(name,0,mypntr,FCT_NAME_LEN,&namtyp,&part_no); |
| 413 |
|
| 414 |
|
| 415 |
mm = MID_FINDFR(mypntr); /* look, if file still in FCT */ |
| 416 |
if (mm >= 0) |
| 417 |
{ |
| 418 |
fctpntr = FCT.ENTRIES + mm; |
| 419 |
fctpntr->CATALOG[1] = 'N'; /* we do not add this file to a catal */ |
| 420 |
status = SCFCLO(mm); |
| 421 |
} |
| 422 |
|
| 423 |
|
| 424 |
/* and delete it */ |
| 425 |
|
| 426 |
status = osfdelete(mypntr); |
| 427 |
|
| 428 |
if (status == 0) |
| 429 |
return (ERR_NORMAL); |
| 430 |
else |
| 431 |
{ |
| 432 |
(void) strncpy(temp,"SCFDEL: ",8); |
| 433 |
MID_ERROR("FSY",temp,status,1); |
| 434 |
return (ERR_INPINV); |
| 435 |
} |
| 436 |
} |
| 437 |
/* |
| 438 |
|
| 439 |
*/ |
| 440 |
|
| 441 |
int SCFCRE(name,dattype,iomode,filtype,size,imno) |
| 442 |
/*++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 443 |
.PURPOSE |
| 444 |
create an object of given type |
| 445 |
.ALGORITHM |
| 446 |
wrapper for SCFXCR() |
| 447 |
.RETURNS |
| 448 |
return status ( 0 = o.k ) |
| 449 |
--------------------------------------------------*/ |
| 450 |
|
| 451 |
char *name /* IN: name of object */; |
| 452 |
int dattype; /* IN: data types as defined in Module header */ |
| 453 |
int iomode; /* IN: opening mode, e.g. F_O_MODE, ... */ |
| 454 |
int filtype; /* IN: filetype no., e.g. F_TBL_TYPE, ... */ |
| 455 |
int size /* IN: size of object = no. of data values in file */; |
| 456 |
int *imno /* OUT: file no. */; |
| 457 |
|
| 458 |
{ |
| 459 |
int optio[4]; |
| 460 |
size_t sizze; |
| 461 |
|
| 462 |
|
| 463 |
optio[0] = 0; |
| 464 |
sizze = (size_t) size; |
| 465 |
|
| 466 |
return SCFXCR(name,dattype,iomode,filtype,sizze,optio,imno); |
| 467 |
} |
| 468 |
|
| 469 |
/* |
| 470 |
|
| 471 |
*/ |
| 472 |
|
| 473 |
int SCFXCR(name,dattype,iomode,filtype,sizze,optio,imno) |
| 474 |
/*++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 475 |
.PURPOSE |
| 476 |
create an object of given type |
| 477 |
.ALGORITHM |
| 478 |
depending upon optio we initialize descr's or clone them |
| 479 |
set FCB_CATALOG, otherwise MID_INITFR does all the work... |
| 480 |
.RETURNS |
| 481 |
return status ( 0 = o.k ) |
| 482 |
--------------------------------------------------*/ |
| 483 |
|
| 484 |
char *name; /* IN: name of object */ |
| 485 |
int dattype; /* IN: data types as defined in Module header */ |
| 486 |
int iomode; /* IN: opening mode, e.g. F_O_MODE, ... */ |
| 487 |
int filtype; /* IN: filetype no., e.g. F_TBL_TYPE, ... */ |
| 488 |
size_t sizze; /* IN: size of object = no. of data values in file */ |
| 489 |
int *optio; /* IN: optio[0] = 1 for cloning, else no |
| 490 |
optio[1] = imno of source (if optio[0] = 1) */ |
| 491 |
int *imno; /* OUT: file no. */ |
| 492 |
|
| 493 |
{ |
| 494 |
int mm, namtyp, part_no; |
| 495 |
int entrx, status; |
| 496 |
|
| 497 |
char temp[200]; |
| 498 |
|
| 499 |
struct FCT_STRUCT *fctpntr; |
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
|
| 505 |
if (iomode == F_H_MODE) |
| 506 |
sizze = (size_t) 0; /* just write the file header (F_H_MODE) */ |
| 507 |
else |
| 508 |
{ |
| 509 |
if (sizze < 1) /* we need size > 0 !! */ |
| 510 |
{ |
| 511 |
status = ERR_OUTLIM; |
| 512 |
goto end_of_it; |
| 513 |
} |
| 514 |
} |
| 515 |
|
| 516 |
|
| 517 |
/* |
| 518 |
for iomode = F_X_MODE, just prepare entry in FCT |
| 519 |
*/ |
| 520 |
|
| 521 |
if (iomode == F_X_MODE) |
| 522 |
{ |
| 523 |
entrx = MID_FINDFR(name); /* look, if already in FCT */ |
| 524 |
if (entrx > -1) /* > -1 is the same as >= 0 */ |
| 525 |
{ |
| 526 |
(void) strcpy(temp,name); |
| 527 |
status = ERR_INPINV; |
| 528 |
goto end_of_it; |
| 529 |
} |
| 530 |
|
| 531 |
|
| 532 |
/* enter file also into FCT with size in bytes */ |
| 533 |
|
| 534 |
entrx = MID_CREFRE(name,-1); |
| 535 |
if (entrx < 0) |
| 536 |
{ |
| 537 |
(void) strcpy(temp,name); |
| 538 |
status = ERR_FILNAM; |
| 539 |
goto end_of_it; |
| 540 |
} |
| 541 |
|
| 542 |
fctpntr = FCT.ENTRIES + entrx; |
| 543 |
fctpntr->CATALOG[0] = 'I'; /* type image */ |
| 544 |
fctpntr->CATALOG[1] = 'N'; /* no catalog... */ |
| 545 |
fctpntr->ACCESS = 'X'; /* set to scratch access */ |
| 546 |
*imno = entrx; |
| 547 |
|
| 548 |
|
| 549 |
/* store required data type + default access mode */ |
| 550 |
|
| 551 |
fctpntr->FORMAT = dattype; |
| 552 |
fctpntr->NOBYTE = get_byte(fctpntr->FORMAT); |
| 553 |
fctpntr->SIZE = sizze; |
| 554 |
fctpntr->STBLOK = 1; /* no FCB, nor descriptors... */ |
| 555 |
|
| 556 |
status = ERR_NORMAL; |
| 557 |
} |
| 558 |
|
| 559 |
else |
| 560 |
{ /* create file on disk (store FCB + LDB's) */ |
| 561 |
|
| 562 |
/* get cleand file name 'temp' */ |
| 563 |
|
| 564 |
status = CGN_CLEANF(name,filtype,temp,FCT_NAME_LEN,&namtyp,&part_no); |
| 565 |
if ((status != 0) || (part_no != 0)) |
| 566 |
{ |
| 567 |
status = ERR_FILNAM; |
| 568 |
(void) strcpy(temp,name); |
| 569 |
goto end_of_it; |
| 570 |
} |
| 571 |
|
| 572 |
infr_loop: /* pass optio on to MID_INITFR */ |
| 573 |
status = MID_INITFR(temp,dattype,namtyp,sizze,optio,imno); |
| 574 |
|
| 575 |
if (status == (-99)) /* if an FCT entry already there, */ |
| 576 |
{ /* get rid of it */ |
| 577 |
(void) MID_ACCFRM(temp,0,imno,&mm); |
| 578 |
(void) SCFCLO(*imno); |
| 579 |
goto infr_loop; |
| 580 |
} |
| 581 |
|
| 582 |
if (status == ERR_NOCLON) /* we cannot clone, tell caller */ |
| 583 |
return status; |
| 584 |
else if (status != ERR_NORMAL) /* this is a real problem... */ |
| 585 |
goto end_of_it; |
| 586 |
|
| 587 |
fctpntr = FCT.ENTRIES + (*imno); |
| 588 |
mm = filtype + 4 + OFF_CATINF; /* point to relevant flag in CATALINF */ |
| 589 |
if (KIWORDS[mm] == 1) |
| 590 |
fctpntr->CATALOG[1] = 'Y'; /* we want to catalog that one */ |
| 591 |
} |
| 592 |
|
| 593 |
|
| 594 |
/* that's it... */ |
| 595 |
|
| 596 |
fctpntr->DATTYP = fctpntr->FORMAT; |
| 597 |
fctpntr->CR_FLAG = 1; /* mark as just created */ |
| 598 |
return status; |
| 599 |
|
| 600 |
|
| 601 |
end_of_it: |
| 602 |
MID_E1(4,temp,status,1); |
| 603 |
return status; |
| 604 |
} |
| 605 |
/* |
| 606 |
|
| 607 |
*/ |
| 608 |
|
| 609 |
int SCFRNM(oldname,newname) |
| 610 |
/*++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 611 |
.PURPOSE |
| 612 |
rename a disk file |
| 613 |
.ALGORITHM |
| 614 |
use CGN_CLEANF + osfrename |
| 615 |
.RETURNS |
| 616 |
return status ( 0 = o.k ) |
| 617 |
--------------------------------------------------------*/ |
| 618 |
|
| 619 |
char *oldname; /* IN: old name */ |
| 620 |
char *newname; /* OUT: new name */ |
| 621 |
|
| 622 |
{ |
| 623 |
char temp[200]; |
| 624 |
|
| 625 |
int namtyp, part_no; |
| 626 |
|
| 627 |
|
| 628 |
CGN_CLEANF(oldname,0,temp,FCT_NAME_LEN,&namtyp,&part_no); |
| 629 |
|
| 630 |
return (osfrename(temp,newname)); |
| 631 |
} |
| 632 |
|