Changeset 25035
- Timestamp:
- Aug 10, 2009, 3:47:42 AM (17 years ago)
- Location:
- branches/eam_branches/20090715/Ohana/src
- Files:
-
- 1 added
- 46 edited
-
addstar/src/ConfigInit.c (modified) (1 diff)
-
addstar/src/ConfigInit_skycells.c (modified) (1 diff)
-
addstar/src/addstar.c (modified) (1 diff)
-
addstar/src/addstard.c (modified) (1 diff)
-
addstar/src/addstart.c (modified) (1 diff)
-
addstar/src/load2mass.c (modified) (1 diff)
-
addstar/src/sedstar.c (modified) (1 diff)
-
delstar/src/ConfigInit.c (modified) (1 diff)
-
delstar/src/delete_imagefile.c (modified) (1 diff)
-
delstar/src/delete_imagename.c (modified) (1 diff)
-
delstar/src/delete_times.c (modified) (1 diff)
-
dvomerge/src/dvomerge.c (modified) (4 diffs)
-
dvosplit/src/ConfigInit.c (modified) (1 diff)
-
dvosplit/src/dvosplit.c (modified) (2 diffs)
-
gastro/src/getptolemy.c (modified) (1 diff)
-
gastro2/src/getptolemy.c (modified) (1 diff)
-
getstar/src/ConfigInit.c (modified) (1 diff)
-
getstar/src/ConfigInit_coords.c (modified) (1 diff)
-
getstar/src/ConfigInit_extract.c (modified) (1 diff)
-
getstar/src/ConfigInit_overlaps.c (modified) (1 diff)
-
getstar/src/getstar.c (modified) (1 diff)
-
imregister/base/ConfigInit.c (modified) (1 diff)
-
imregister/imphot/ConfigInit.c (modified) (1 diff)
-
libdvo/doc/locking.txt (added)
-
libdvo/include/dvo.h (modified) (2 diffs)
-
libdvo/src/LoadPhotcodes.c (modified) (1 diff)
-
libdvo/src/dvo_catalog.c (modified) (2 diffs)
-
libdvo/src/dvo_image.c (modified) (1 diff)
-
libdvo/src/skyregion_io.c (modified) (5 diffs)
-
libohana/include/ohana.h (modified) (1 diff)
-
libohana/src/findexec.c (modified) (4 diffs)
-
markrock/src/ConfigInit.c (modified) (1 diff)
-
markrock/src/markrock.c (modified) (1 diff)
-
markstar/src/ConfigInit.c (modified) (1 diff)
-
mosastro/src/getptolemy.c (modified) (1 diff)
-
opihi/cmd.data/Makefile (modified) (1 diff)
-
opihi/dvo/photometry.c (modified) (1 diff)
-
opihi/dvo/region_list.c (modified) (1 diff)
-
photdbc/src/ConfigInit.c (modified) (1 diff)
-
photdbc/src/photdbc.c (modified) (1 diff)
-
relastro/src/ConfigInit.c (modified) (1 diff)
-
relastro/src/load_images.c (modified) (1 diff)
-
relastro/src/relastro_objects.c (modified) (1 diff)
-
relphot/src/ConfigInit.c (modified) (1 diff)
-
relphot/src/load_images.c (modified) (1 diff)
-
relphot/src/relphot_objects.c (modified) (1 diff)
-
uniphot/src/ConfigInit.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/Ohana/src/addstar/src/ConfigInit.c
r25020 r25035 180 180 /* XXX this does not yet write out the master photcode table */ 181 181 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 182 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {182 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 183 183 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 184 184 exit (1); -
branches/eam_branches/20090715/Ohana/src/addstar/src/ConfigInit_skycells.c
r16061 r25035 55 55 /* XXX this does not yet write out the master photcode table */ 56 56 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 57 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {57 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 58 58 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 59 59 exit (1); -
branches/eam_branches/20090715/Ohana/src/addstar/src/addstar.c
r21508 r25035 25 25 options = args (argc, argv, options); 26 26 27 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);27 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 28 28 if (sky == NULL) { 29 29 fprintf (stderr, "ERROR: unable to load sky table data\n"); -
branches/eam_branches/20090715/Ohana/src/addstar/src/addstard.c
r6236 r25035 12 12 13 13 /* store the sky table in a global for internal use */ 14 ServerSky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);14 ServerSky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 15 15 SkyTableSetFilenames (ServerSky, CATDIR, "cpt"); 16 16 -
branches/eam_branches/20090715/Ohana/src/addstar/src/addstart.c
r10939 r25035 12 12 13 13 /* store the sky table in a global for internal use */ 14 ServerSky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);14 ServerSky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 15 15 SkyTableSetFilenames (ServerSky, CATDIR, "cpt"); 16 16 -
branches/eam_branches/20090715/Ohana/src/addstar/src/load2mass.c
r25020 r25035 16 16 17 17 // load the full sky description table: 18 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);18 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 19 19 SkyTableSetFilenames (sky, CATDIR, "cpt"); 20 20 -
branches/eam_branches/20090715/Ohana/src/addstar/src/sedstar.c
r15743 r25035 15 15 options = args_sedstar (argc, argv, options); 16 16 17 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);17 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 18 18 SkyTableSetFilenames (sky, CATDIR, "cpt"); 19 19 -
branches/eam_branches/20090715/Ohana/src/delstar/src/ConfigInit.c
r12332 r25035 45 45 /* XXX this does not yet write out the master photcode table */ 46 46 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 47 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {47 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 48 48 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 49 49 exit (1); -
branches/eam_branches/20090715/Ohana/src/delstar/src/delete_imagefile.c
r15743 r25035 12 12 13 13 /* load sky from correct table */ 14 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);14 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 15 15 SkyTableSetFilenames (sky, CATDIR, "cpt"); 16 16 -
branches/eam_branches/20090715/Ohana/src/delstar/src/delete_imagename.c
r17245 r25035 15 15 16 16 /* load sky from correct table */ 17 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);17 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 18 18 SkyTableSetFilenames (sky, CATDIR, "cpt"); 19 19 -
branches/eam_branches/20090715/Ohana/src/delstar/src/delete_times.c
r15743 r25035 15 15 16 16 /* load sky from correct table */ 17 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);17 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 18 18 SkyTableSetFilenames (sky, CATDIR, "cpt"); 19 19 -
branches/eam_branches/20090715/Ohana/src/dvomerge/src/dvomerge.c
r24750 r25035 24 24 // the first input define the photcode table & db layout 25 25 sprintf (filename, "%s/Photcodes.dat", input1); 26 if (!LoadPhotcodes (filename, NULL )) {26 if (!LoadPhotcodes (filename, NULL, FALSE)) { 27 27 fprintf (stderr, "error loading photcode table %s\n", filename); 28 28 exit (1); … … 30 30 // save the photcodes in the output catdir 31 31 sprintf (filename, "%s/Photcodes.dat", output); 32 if (!check_file_access (filename, TRUE, TRUE )) {32 if (!check_file_access (filename, TRUE, TRUE, TRUE)) { 33 33 fprintf (stderr, "error creating output catdir %s\n", output); 34 34 exit (1); … … 40 40 41 41 // load the sky table for the existing database 42 insky1 = SkyTableLoadOptimal (input1, NULL, NULL, SKY_DEPTH_HST, VERBOSE);42 insky1 = SkyTableLoadOptimal (input1, NULL, NULL, FALSE, SKY_DEPTH_HST, VERBOSE); 43 43 SkyTableSetFilenames (insky1, input1, "cpt"); 44 44 45 insky2 = SkyTableLoadOptimal (input2, NULL, NULL, SKY_DEPTH_HST, VERBOSE);45 insky2 = SkyTableLoadOptimal (input2, NULL, NULL, FALSE, SKY_DEPTH_HST, VERBOSE); 46 46 SkyTableSetFilenames (insky2, input2, "cpt"); 47 47 48 48 // generate an output table populated at the desired depth 49 outsky = SkyTableLoadOptimal (output, NULL, GSCFILE, SKY_DEPTH, VERBOSE);49 outsky = SkyTableLoadOptimal (output, NULL, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 50 50 SkyTableSetFilenames (outsky, output, "cpt"); 51 51 … … 117 117 // save the output sky table copy 118 118 sprintf (filename, "%s/SkyTable.fits", output); 119 check_file_access (filename, TRUE, VERBOSE);119 check_file_access (filename, TRUE, TRUE, VERBOSE); 120 120 if (!SkyTableSave (outsky, filename)) { 121 121 fprintf (stderr, "ERROR: failed to save sky table for %s\n", output); -
branches/eam_branches/20090715/Ohana/src/dvosplit/src/ConfigInit.c
r24753 r25035 33 33 /* XXX this does not yet write out the master photcode table */ 34 34 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 35 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {35 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 36 36 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 37 37 exit (1); -
branches/eam_branches/20090715/Ohana/src/dvosplit/src/dvosplit.c
r15746 r25035 18 18 19 19 // load the sky table for the existing database 20 sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, SKY_DEPTH_HST, VERBOSE);20 sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, SKY_DEPTH_HST, VERBOSE); 21 21 SkyTableSetFilenames (sky, CATDIR, "cpt"); 22 22 … … 79 79 // save sky table copy 80 80 sprintf (filename, "%s/SkyTable.fits", CATDIR); 81 check_file_access (filename, TRUE, VERBOSE);81 check_file_access (filename, TRUE, TRUE, VERBOSE); 82 82 if (!SkyTableSave (sky, filename)) { 83 83 fprintf (stderr, "ERROR: failed to save sky table for %s\n", CATDIR); -
branches/eam_branches/20090715/Ohana/src/gastro/src/getptolemy.c
r16810 r25035 19 19 20 20 /* load regions from GSC table, restrict to patch */ 21 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, SKY_DEPTH_HST, VERBOSE);21 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, FALSE, SKY_DEPTH_HST, VERBOSE); 22 22 SkyTableSetFilenames (sky, CATDIR, "cpt"); 23 23 skylist = SkyListByPatch (sky, -1, &patch); -
branches/eam_branches/20090715/Ohana/src/gastro2/src/getptolemy.c
r16810 r25035 21 21 22 22 /* load regions from GSC table, restrict to patch */ 23 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, SKY_DEPTH_HST, VERBOSE);23 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, FALSE, SKY_DEPTH_HST, VERBOSE); 24 24 SkyTableSetFilenames (sky, CATDIR, "cpt"); 25 25 skylist = SkyListByPatch (sky, -1, &patch); -
branches/eam_branches/20090715/Ohana/src/getstar/src/ConfigInit.c
r15543 r25035 34 34 /* XXX this does not yet write out the master photcode table */ 35 35 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 36 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {36 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 37 37 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 38 38 exit (1); -
branches/eam_branches/20090715/Ohana/src/getstar/src/ConfigInit_coords.c
r25020 r25035 35 35 /* XXX this does not yet write out the master photcode table */ 36 36 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 37 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {37 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 38 38 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 39 39 exit (1); -
branches/eam_branches/20090715/Ohana/src/getstar/src/ConfigInit_extract.c
r12840 r25035 35 35 /* XXX this does not yet write out the master photcode table */ 36 36 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 37 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {37 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 38 38 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 39 39 exit (1); -
branches/eam_branches/20090715/Ohana/src/getstar/src/ConfigInit_overlaps.c
r12774 r25035 35 35 /* XXX this does not yet write out the master photcode table */ 36 36 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 37 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {37 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, FALSE)) { 38 38 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 39 39 exit (1); -
branches/eam_branches/20090715/Ohana/src/getstar/src/getstar.c
r20984 r25035 13 13 set_db (&db); 14 14 15 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);15 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 16 16 if (!sky) exit (1); 17 17 -
branches/eam_branches/20090715/Ohana/src/imregister/base/ConfigInit.c
r12332 r25035 105 105 /* XXX this does not yet write out the master photcode table */ 106 106 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", catdir); 107 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {107 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 108 108 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 109 109 exit (1); -
branches/eam_branches/20090715/Ohana/src/imregister/imphot/ConfigInit.c
r12332 r25035 101 101 /* XXX this does not yet write out the master photcode table */ 102 102 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 103 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {103 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 104 104 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 105 105 exit (1); -
branches/eam_branches/20090715/Ohana/src/libdvo/include/dvo.h
r25020 r25035 325 325 PhotCodeData *GetPhotcodeTable (void); 326 326 327 int LoadPhotcodes (char *catdir_file, char *master_file );327 int LoadPhotcodes (char *catdir_file, char *master_file, int readwrite); 328 328 int LoadPhotcodesText (char *filename); 329 329 int LoadPhotcodesFITS (char *filename); … … 432 432 SkyTable *SkyTableLoad PROTO((char *filename, int VERBOSE)); 433 433 SkyTable *SkyTableFromGSC PROTO((char *filename, int depth, int VERBOSE)); 434 SkyTable *SkyTableLoadOptimal PROTO((char *catdir, char *SKYFILE, char *GSCFILE, int depth, int VERBOSE));434 SkyTable *SkyTableLoadOptimal PROTO((char *catdir, char *SKYFILE, char *GSCFILE, int readwrite, int depth, int VERBOSE)); 435 435 int SkyTableSetDepth PROTO((SkyTable *sky, int depth)); 436 436 SkyList *SkyRegionByPoint PROTO((SkyTable *table, int depth, double ra, double dec)); -
branches/eam_branches/20090715/Ohana/src/libdvo/src/LoadPhotcodes.c
r12332 r25035 1 1 # include <dvo.h> 2 2 3 int LoadPhotcodes (char *catdir_file, char *master_file ) {3 int LoadPhotcodes (char *catdir_file, char *master_file, int readwrite) { 4 4 5 5 /* first try to load the photcodes from the specified CATDIR location */ 6 6 if (LoadPhotcodesFITS (catdir_file)) return TRUE; 7 7 8 if (!readwrite) { 9 fprintf (stderr, "db is missing a photcode table & access is read-only -- create one with photcode-table -import\n"); 10 return FALSE; 11 } 12 8 13 /* next try to load the photcodes from the master text photcode file */ 9 14 /* automatically (or on demand?) save the text file to the FITS version */ 10 15 if (LoadPhotcodesText (master_file)) { 11 if (!check_file_access (catdir_file, TRUE, TRUE)) return TRUE;12 SavePhotcodesFITS (catdir_file);13 return TRUE;16 if (!check_file_access (catdir_file, TRUE, TRUE, TRUE)) return TRUE; 17 SavePhotcodesFITS (catdir_file); 18 return TRUE; 14 19 } 15 20 -
branches/eam_branches/20090715/Ohana/src/libdvo/src/dvo_catalog.c
r24748 r25035 180 180 181 181 int Nsecfilt, mode; 182 int BACKUP, READWRITE; 182 183 183 184 mode = DVO_OPEN_NONE; … … 192 193 dvo_catalog_init (catalog, FALSE); 193 194 195 // default access control options: 194 196 catalog[0].lockmode = LCK_XCLD; 195 if (mode == DVO_OPEN_READ) catalog[0].lockmode = LCK_SOFT; 197 BACKUP = TRUE; 198 READWRITE = TRUE; 199 200 // in read-only mode, do not backup or require write access 201 if (mode == DVO_OPEN_READ) { 202 catalog[0].lockmode = LCK_SOFT; 203 BACKUP = FALSE; 204 READWRITE = FALSE; 205 } 196 206 197 // XXX make a backup? always? 198 if (!check_file_access (catalog[0].filename, TRUE, VERBOSE)) { 207 if (!check_file_access (catalog[0].filename, BACKUP, READWRITE, VERBOSE)) { 199 208 if (VERBOSE) fprintf (stderr, "no permission to access %s\n", catalog[0].filename); 200 209 return (FALSE); -
branches/eam_branches/20090715/Ohana/src/libdvo/src/dvo_image.c
r24748 r25035 4 4 int dvo_image_lock (FITS_DB *db, char *filename, double timeout, int lockstate) { 5 5 6 /* lock the image catalog */ 7 if (!check_file_access (filename, FALSE, TRUE)) return (FALSE); 6 int READWRITE; 7 8 // default access control options: 9 READWRITE = TRUE; 10 11 // in read-only mode, do not backup or require write access 12 if (lockstate == LCK_SOFT) { 13 READWRITE = FALSE; 14 } 15 16 // do not perform a backup here 17 if (!check_file_access (filename, FALSE, READWRITE, TRUE)) return (FALSE); 8 18 9 19 db[0].lockstate = lockstate; -
branches/eam_branches/20090715/Ohana/src/libdvo/src/skyregion_io.c
r17000 r25035 84 84 } 85 85 86 SkyTable *SkyTableLoadOptimal (char *catdir, char *skyfile, char *gscfile, int depth, int verbose) {86 SkyTable *SkyTableLoadOptimal (char *catdir, char *skyfile, char *gscfile, int readwrite, int depth, int verbose) { 87 87 88 88 char filename[256]; … … 93 93 sprintf (filename, "%s/SkyTable.fits", catdir); 94 94 if (stat (filename, &filestat)) goto SKYFILE; 95 if (!check_file_access (filename, FALSE, verbose)) goto SKYFILE;95 if (!check_file_access (filename, FALSE, readwrite, verbose)) goto SKYFILE; 96 96 sky = SkyTableLoad (filename, verbose); 97 97 if (sky == NULL) { … … 106 106 if (skyfile[0] != 0) goto GSCFILE; 107 107 if (stat (skyfile, &filestat)) goto GSCFILE; 108 if (!check_file_access (skyfile, FALSE, verbose)) goto GSCFILE;108 if (!check_file_access (skyfile, FALSE, readwrite, verbose)) goto GSCFILE; 109 109 sky = SkyTableLoad (skyfile, verbose); 110 110 if (sky == NULL) { … … 117 117 /* create CATDIR copy */ 118 118 sprintf (filename, "%s/SkyTable.fits", catdir); 119 check_file_access (filename, FALSE, verbose);119 check_file_access (filename, FALSE, readwrite, verbose); 120 120 if (!SkyTableSave (sky, filename)) return NULL; 121 121 … … 134 134 /* create CATDIR copy */ 135 135 sprintf (filename, "%s/SkyTable.fits", catdir); 136 check_file_access (filename, FALSE, verbose);136 check_file_access (filename, FALSE, readwrite, verbose); 137 137 if (!SkyTableSave (sky, filename)) return NULL; 138 138 -
branches/eam_branches/20090715/Ohana/src/libohana/include/ohana.h
r21508 r25035 166 166 int mkdirhier PROTO((char *path, int mode)); 167 167 void make_backup PROTO((char *filename)); 168 int check_file_access PROTO((char *basefile, int backup, int verbose));168 int check_file_access PROTO((char *basefile, int backup, int readwrite, int verbose)); 169 169 int check_dir_access PROTO((char *path, int verbose)); 170 170 int check_file_exec PROTO((char *filename)); -
branches/eam_branches/20090715/Ohana/src/libohana/src/findexec.c
r18051 r25035 67 67 - file backup permission OK (optional) 68 68 */ 69 int check_file_access (char *basefile, int BACKUP, int VERBOSE) {69 int check_file_access (char *basefile, int BACKUP, int READWRITE, int VERBOSE) { 70 70 71 71 char *path, *filename; … … 74 74 gid_t gid; 75 75 int status; 76 int valid; 76 77 77 78 uid = getuid(); 78 79 gid = getgid(); 80 81 // XXX this function needs to call 'getgroups' to get the full list of the user's 82 // groups. we would then need to loop over all groups in the gid test below 83 // to see if any match the file. test to see how slow this is. 79 84 80 85 /* check permission to write to directory */ … … 87 92 status = stat (basefile, &filestat); 88 93 if (status == 0) { /* file exists, are permissions OK? */ 89 if (((uid == filestat.st_uid) && (filestat.st_mode & S_IRUSR) && (filestat.st_mode & S_IWUSR)) || 90 ((gid == filestat.st_gid) && (filestat.st_mode & S_IRGRP) && (filestat.st_mode & S_IWGRP)) || 91 ((filestat.st_mode & S_IROTH) && (filestat.st_mode & S_IWOTH))) { 92 } else { 94 valid = FALSE; 95 if (!valid && (uid == filestat.st_uid)) { 96 valid = (filestat.st_mode & S_IRUSR) != 0; 97 valid &= !READWRITE || (filestat.st_mode & S_IWUSR); 98 } 99 if (!valid && (gid == filestat.st_gid)) { 100 valid = (filestat.st_mode & S_IRGRP) != 0; 101 valid &= !READWRITE || (filestat.st_mode & S_IWGRP); 102 } 103 if (!valid) { 104 valid = (filestat.st_mode & S_IROTH) != 0; 105 valid &= !READWRITE || (filestat.st_mode & S_IWOTH); 106 } 107 if (!valid) { 93 108 if (VERBOSE) fprintf (stderr, "can't write to %s\n", basefile); 94 109 return (FALSE); … … 102 117 status = stat (filename, &filestat); 103 118 if (status == 0) { /* file exists, are permissions OK? */ 104 if (((uid == filestat.st_uid) && (filestat.st_mode & S_IRUSR) && (filestat.st_mode & S_IWUSR)) || 105 ((gid == filestat.st_gid) && (filestat.st_mode & S_IRGRP) && (filestat.st_mode & S_IWGRP)) || 106 ((filestat.st_mode & S_IROTH) && (filestat.st_mode & S_IWOTH))) { 107 } else { 119 valid = FALSE; 120 if (!valid && (uid == filestat.st_uid)) { 121 valid = (filestat.st_mode & S_IRUSR) != 0; 122 valid &= !READWRITE || (filestat.st_mode & S_IWUSR); 123 } 124 if (!valid && (gid == filestat.st_gid)) { 125 valid = (filestat.st_mode & S_IRGRP) != 0; 126 valid &= !READWRITE || (filestat.st_mode & S_IWGRP); 127 } 128 if (!valid) { 129 valid = (filestat.st_mode & S_IROTH) != 0; 130 valid &= !READWRITE || (filestat.st_mode & S_IWOTH); 131 } 132 if (!valid) { 108 133 if (VERBOSE) fprintf (stderr, "can't write to %s\n", filename); 109 134 return (FALSE); -
branches/eam_branches/20090715/Ohana/src/markrock/src/ConfigInit.c
r12332 r25035 44 44 /* XXX this does not yet write out the master photcode table */ 45 45 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 46 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {46 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 47 47 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 48 48 exit (1); -
branches/eam_branches/20090715/Ohana/src/markrock/src/markrock.c
r15743 r25035 33 33 34 34 /* if lockfile exists, program will complain and quit */ 35 if (!check_file_access (argv[1], TRUE, TRUE )) exit (1);36 if (!check_file_access (RockCat, TRUE, TRUE )) exit (1);35 if (!check_file_access (argv[1], TRUE, TRUE, TRUE)) exit (1); 36 if (!check_file_access (RockCat, TRUE, TRUE, TRUE)) exit (1); 37 37 38 38 catalog.filename = argv[1]; -
branches/eam_branches/20090715/Ohana/src/markstar/src/ConfigInit.c
r12332 r25035 54 54 /* XXX this does not yet write out the master photcode table */ 55 55 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 56 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {56 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 57 57 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 58 58 exit (1); -
branches/eam_branches/20090715/Ohana/src/mosastro/src/getptolemy.c
r16810 r25035 19 19 20 20 /* load regions from GSC table, restrict to patch */ 21 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, SKY_DEPTH_HST, VERBOSE);21 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, FALSE, SKY_DEPTH_HST, VERBOSE); 22 22 SkyTableSetFilenames (sky, CATDIR, "cpt"); 23 23 skylist = SkyListByPatch (sky, -1, &patch); -
branches/eam_branches/20090715/Ohana/src/opihi/cmd.data/Makefile
r24992 r25035 97 97 $(SRC)/rebin.$(ARCH).o \ 98 98 $(SRC)/resize.$(ARCH).o \ 99 $(SRC)/relocate.$(ARCH).o \ 99 100 $(SRC)/roll.$(ARCH).o \ 100 101 $(SRC)/rotate.$(ARCH).o \ -
branches/eam_branches/20090715/Ohana/src/opihi/dvo/photometry.c
r21508 r25035 325 325 return (FALSE); 326 326 } 327 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile)) { 327 328 // XXX now that DVO does not allow write access, we can drop the MasterPhotcodeFile 329 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, FALSE)) { 328 330 gprint (GP_ERR, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 329 331 return (FALSE); -
branches/eam_branches/20090715/Ohana/src/opihi/dvo/region_list.c
r15753 r25035 42 42 43 43 if (sky != NULL) SkyTableFree (sky); 44 sky = SkyTableLoadOptimal (CATDIR, skyfile, gscfile, skydepth, verbose);44 sky = SkyTableLoadOptimal (CATDIR, skyfile, gscfile, FALSE, skydepth, verbose); 45 45 if (sky == NULL) return FALSE; 46 46 -
branches/eam_branches/20090715/Ohana/src/photdbc/src/ConfigInit.c
r17284 r25035 64 64 /* XXX this does not yet write out the master photcode table */ 65 65 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 66 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {66 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 67 67 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 68 68 exit (1); -
branches/eam_branches/20090715/Ohana/src/photdbc/src/photdbc.c
r17284 r25035 17 17 18 18 // the output catalog needs to inherit the SKY_DEPTH of the input catalog 19 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, SKY_DEPTH_HST, VERBOSE);19 sky = SkyTableLoadOptimal (CATDIR, NULL, GSCFILE, TRUE, SKY_DEPTH_HST, VERBOSE); 20 20 SkyTableSetFilenames (sky, CATDIR, "cpt"); 21 21 skylist = SkyListByPatch (sky, -1, ®ION); -
branches/eam_branches/20090715/Ohana/src/relastro/src/ConfigInit.c
r24308 r25035 60 60 /* update master photcode table if not defined */ 61 61 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 62 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {62 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 63 63 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 64 64 exit (1); -
branches/eam_branches/20090715/Ohana/src/relastro/src/load_images.c
r12332 r25035 11 11 12 12 // load the current sky table (layout of all SkyRegions) 13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 14 14 SkyTableSetFilenames (sky, CATDIR, "cpt"); 15 15 -
branches/eam_branches/20090715/Ohana/src/relastro/src/relastro_objects.c
r24308 r25035 11 11 12 12 // load the current sky table (layout of all SkyRegions) 13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 14 14 SkyTableSetFilenames (sky, CATDIR, "cpt"); 15 15 -
branches/eam_branches/20090715/Ohana/src/relphot/src/ConfigInit.c
r20323 r25035 58 58 /* XXX this does not yet write out the master photcode table */ 59 59 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 60 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {60 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 61 61 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 62 62 exit (1); -
branches/eam_branches/20090715/Ohana/src/relphot/src/load_images.c
r10506 r25035 11 11 12 12 // load the current sky table (layout of all SkyRegions) 13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 14 14 SkyTableSetFilenames (sky, CATDIR, "cpt"); 15 15 -
branches/eam_branches/20090715/Ohana/src/relphot/src/relphot_objects.c
r21508 r25035 11 11 12 12 // load the current sky table (layout of all SkyRegions) 13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, SKY_DEPTH, VERBOSE);13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 14 14 SkyTableSetFilenames (sky, CATDIR, "cpt"); 15 15 -
branches/eam_branches/20090715/Ohana/src/uniphot/src/ConfigInit.c
r12332 r25035 36 36 /* XXX this does not yet write out the master photcode table */ 37 37 sprintf (CatdirPhotcodeFile, "%s/Photcodes.dat", CATDIR); 38 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile )) {38 if (!LoadPhotcodes (CatdirPhotcodeFile, MasterPhotcodeFile, TRUE)) { 39 39 fprintf (stderr, "error loading photcode table %s or master file %s\n", CatdirPhotcodeFile, MasterPhotcodeFile); 40 40 exit (1);
Note:
See TracChangeset
for help on using the changeset viewer.
