Changeset 7917 for trunk/Ohana/src/opihi
- Timestamp:
- Jul 16, 2006, 10:58:49 PM (20 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 1 added
- 365 edited
-
cmd.astro/biassub.c (modified) (3 diffs)
-
cmd.astro/cgrid.c (modified) (1 diff)
-
cmd.astro/coords.c (modified) (4 diffs)
-
cmd.astro/cplot.c (modified) (2 diffs)
-
cmd.astro/csystem.c (modified) (5 diffs)
-
cmd.astro/ctimes.c (modified) (4 diffs)
-
cmd.astro/cval.c (modified) (3 diffs)
-
cmd.astro/czplot.c (modified) (2 diffs)
-
cmd.astro/drizzle.c (modified) (3 diffs)
-
cmd.astro/fixwrap.c (modified) (1 diff)
-
cmd.astro/flux.c (modified) (4 diffs)
-
cmd.astro/gauss.c (modified) (1 diff)
-
cmd.astro/getvel.c (modified) (6 diffs)
-
cmd.astro/imfit.c (modified) (4 diffs)
-
cmd.astro/imsub.c (modified) (3 diffs)
-
cmd.astro/medianmap.c (modified) (1 diff)
-
cmd.astro/mkgauss.c (modified) (1 diff)
-
cmd.astro/multifit.c (modified) (2 diffs)
-
cmd.astro/objload.c (modified) (3 diffs)
-
cmd.astro/outline.c (modified) (5 diffs)
-
cmd.astro/outline2.c (modified) (4 diffs)
-
cmd.astro/polar.c (modified) (2 diffs)
-
cmd.astro/precess.c (modified) (4 diffs)
-
cmd.astro/profile.c (modified) (2 diffs)
-
cmd.astro/region.c (modified) (1 diff)
-
cmd.astro/rotcurve.c (modified) (4 diffs)
-
cmd.astro/scale.c (modified) (2 diffs)
-
cmd.astro/sexigesimal.c (modified) (4 diffs)
-
cmd.astro/spec.c (modified) (3 diffs)
-
cmd.astro/star.c (modified) (1 diff)
-
cmd.astro/testfit.c (modified) (5 diffs)
-
cmd.astro/transform.c (modified) (3 diffs)
-
cmd.astro/warp.c (modified) (3 diffs)
-
cmd.basic/break.c (modified) (1 diff)
-
cmd.basic/cd.c (modified) (4 diffs)
-
cmd.basic/date.c (modified) (2 diffs)
-
cmd.basic/echo.c (modified) (1 diff)
-
cmd.basic/file.c (modified) (2 diffs)
-
cmd.basic/fprintf.c (modified) (5 diffs)
-
cmd.basic/getchr.c (modified) (2 diffs)
-
cmd.basic/help.c (modified) (2 diffs)
-
cmd.basic/input.c (modified) (2 diffs)
-
cmd.basic/list.c (modified) (5 diffs)
-
cmd.basic/list_help.c (modified) (1 diff)
-
cmd.basic/local.c (modified) (1 diff)
-
cmd.basic/macro.c (modified) (1 diff)
-
cmd.basic/memory.c (modified) (1 diff)
-
cmd.basic/output.c (modified) (2 diffs)
-
cmd.basic/run_for.c (modified) (2 diffs)
-
cmd.basic/run_if.c (modified) (2 diffs)
-
cmd.basic/run_while.c (modified) (2 diffs)
-
cmd.basic/scan.c (modified) (2 diffs)
-
cmd.basic/sleep.c (modified) (1 diff)
-
cmd.basic/sprintf.c (modified) (5 diffs)
-
cmd.basic/strchr.c (modified) (2 diffs)
-
cmd.basic/strlen.c (modified) (2 diffs)
-
cmd.basic/substr.c (modified) (2 diffs)
-
cmd.basic/usleep.c (modified) (1 diff)
-
cmd.basic/wait.c (modified) (1 diff)
-
cmd.basic/which.c (modified) (2 diffs)
-
cmd.data/accum.c (modified) (3 diffs)
-
cmd.data/applyfit.c (modified) (3 diffs)
-
cmd.data/applyfit2d.c (modified) (3 diffs)
-
cmd.data/box.c (modified) (1 diff)
-
cmd.data/center.c (modified) (1 diff)
-
cmd.data/clear.c (modified) (1 diff)
-
cmd.data/clip.c (modified) (1 diff)
-
cmd.data/concat.c (modified) (1 diff)
-
cmd.data/contour.c (modified) (2 diffs)
-
cmd.data/create.c (modified) (3 diffs)
-
cmd.data/cursor.c (modified) (3 diffs)
-
cmd.data/cut.c (modified) (3 diffs)
-
cmd.data/delete.c (modified) (2 diffs)
-
cmd.data/device.c (modified) (1 diff)
-
cmd.data/dimendown.c (modified) (1 diff)
-
cmd.data/dimenup.c (modified) (2 diffs)
-
cmd.data/dot.c (modified) (1 diff)
-
cmd.data/erase.c (modified) (2 diffs)
-
cmd.data/extract.c (modified) (4 diffs)
-
cmd.data/fft1d.c (modified) (2 diffs)
-
cmd.data/fft2d.c (modified) (2 diffs)
-
cmd.data/fit.c (modified) (4 diffs)
-
cmd.data/fit2d.c (modified) (7 diffs)
-
cmd.data/gaussdeviate.c (modified) (2 diffs)
-
cmd.data/gaussj.c (modified) (1 diff)
-
cmd.data/grid.c (modified) (1 diff)
-
cmd.data/gridify.c (modified) (1 diff)
-
cmd.data/histogram.c (modified) (2 diffs)
-
cmd.data/imcut.c (modified) (2 diffs)
-
cmd.data/imhist.c (modified) (4 diffs)
-
cmd.data/imsmooth.c (modified) (1 diff)
-
cmd.data/integrate.c (modified) (2 diffs)
-
cmd.data/interpolate.c (modified) (1 diff)
-
cmd.data/jpeg.c (modified) (1 diff)
-
cmd.data/kern.c (modified) (9 diffs)
-
cmd.data/keyword.c (modified) (5 diffs)
-
cmd.data/labels.c (modified) (2 diffs)
-
cmd.data/limits.c (modified) (2 diffs)
-
cmd.data/line.c (modified) (2 diffs)
-
cmd.data/list_header.c (modified) (4 diffs)
-
cmd.data/load.c (modified) (4 diffs)
-
cmd.data/mcreate.c (modified) (1 diff)
-
cmd.data/medacc.c (modified) (2 diffs)
-
cmd.data/mget.c (modified) (5 diffs)
-
cmd.data/minterpolate.c (modified) (1 diff)
-
cmd.data/mset.c (modified) (5 diffs)
-
cmd.data/peak.c (modified) (2 diffs)
-
cmd.data/periodogram.c (modified) (3 diffs)
-
cmd.data/plot.c (modified) (2 diffs)
-
cmd.data/point.c (modified) (1 diff)
-
cmd.data/ps.c (modified) (1 diff)
-
cmd.data/queuedelete.c (modified) (2 diffs)
-
cmd.data/queueinit.c (modified) (1 diff)
-
cmd.data/queuelist.c (modified) (1 diff)
-
cmd.data/queuepop.c (modified) (3 diffs)
-
cmd.data/queueprint.c (modified) (2 diffs)
-
cmd.data/queuepush.c (modified) (1 diff)
-
cmd.data/queuesize.c (modified) (2 diffs)
-
cmd.data/radial.c (modified) (2 diffs)
-
cmd.data/rd.c (modified) (11 diffs)
-
cmd.data/rdseg.c (modified) (4 diffs)
-
cmd.data/read_vectors.c (modified) (7 diffs)
-
cmd.data/rebin.c (modified) (3 diffs)
-
cmd.data/resize.c (modified) (1 diff)
-
cmd.data/roll.c (modified) (2 diffs)
-
cmd.data/rotate.c (modified) (6 diffs)
-
cmd.data/save.c (modified) (1 diff)
-
cmd.data/section.c (modified) (2 diffs)
-
cmd.data/select.c (modified) (1 diff)
-
cmd.data/set.c (modified) (3 diffs)
-
cmd.data/shift.c (modified) (3 diffs)
-
cmd.data/sort.c (modified) (3 diffs)
-
cmd.data/spline_apply.c (modified) (1 diff)
-
cmd.data/spline_construct.c (modified) (1 diff)
-
cmd.data/stats.c (modified) (3 diffs)
-
cmd.data/style.c (modified) (1 diff)
-
cmd.data/subraster.c (modified) (3 diffs)
-
cmd.data/subset.c (modified) (1 diff)
-
cmd.data/svd.c (modified) (2 diffs)
-
cmd.data/swapbytes.c (modified) (2 diffs)
-
cmd.data/teststats.c (modified) (2 diffs)
-
cmd.data/textline.c (modified) (1 diff)
-
cmd.data/tv.c (modified) (1 diff)
-
cmd.data/tvcontour.c (modified) (5 diffs)
-
cmd.data/tvgrid.c (modified) (4 diffs)
-
cmd.data/ungridify.c (modified) (2 diffs)
-
cmd.data/uniq.c (modified) (1 diff)
-
cmd.data/unsign.c (modified) (2 diffs)
-
cmd.data/vbin.c (modified) (2 diffs)
-
cmd.data/vclip.c (modified) (1 diff)
-
cmd.data/vcontour.c (modified) (3 diffs)
-
cmd.data/vgauss.c (modified) (4 diffs)
-
cmd.data/vgrid.c (modified) (1 diff)
-
cmd.data/vload.c (modified) (3 diffs)
-
cmd.data/vpop.c (modified) (1 diff)
-
cmd.data/vroll.c (modified) (1 diff)
-
cmd.data/vsmooth.c (modified) (1 diff)
-
cmd.data/vstat.c (modified) (2 diffs)
-
cmd.data/wd.c (modified) (8 diffs)
-
cmd.data/write_vectors.c (modified) (7 diffs)
-
cmd.data/zap.c (modified) (2 diffs)
-
cmd.data/zplot.c (modified) (2 diffs)
-
dimm/Camera.c (modified) (12 diffs)
-
dimm/Serial.c (modified) (13 diffs)
-
dimm/Telescope.c (modified) (5 diffs)
-
dimm/altaz.c (modified) (3 diffs)
-
dimm/camera.c (modified) (6 diffs)
-
dimm/dimm.c (modified) (1 diff)
-
dimm/findstars.c (modified) (2 diffs)
-
dimm/sbig/sp_ccdcontrol.c (modified) (24 diffs)
-
dimm/telescope.c (modified) (15 diffs)
-
dimm/version.c (modified) (1 diff)
-
doc/ippc_commandserver.c (modified) (8 diffs)
-
doc/sample.c (modified) (1 diff)
-
dvo/ImageSelection.c (modified) (1 diff)
-
dvo/LoadImages.c (modified) (1 diff)
-
dvo/addxtra.c (modified) (1 diff)
-
dvo/aregion.c (modified) (2 diffs)
-
dvo/avextract.c (modified) (1 diff)
-
dvo/badimages.c (modified) (4 diffs)
-
dvo/calextract.c (modified) (3 diffs)
-
dvo/calmextract.c (modified) (3 diffs)
-
dvo/catalog.c (modified) (5 diffs)
-
dvo/catdir.c (modified) (2 diffs)
-
dvo/ccd.c (modified) (1 diff)
-
dvo/cmatch.c (modified) (2 diffs)
-
dvo/cmd.c (modified) (1 diff)
-
dvo/cmpRead.c (modified) (3 diffs)
-
dvo/cmpload.c (modified) (4 diffs)
-
dvo/cmpread.c (modified) (9 diffs)
-
dvo/compare.c (modified) (1 diff)
-
dvo/ddmags.c (modified) (3 diffs)
-
dvo/detrend.c (modified) (9 diffs)
-
dvo/dmagaves.c (modified) (1 diff)
-
dvo/dmagmeas.c (modified) (1 diff)
-
dvo/dmags.c (modified) (1 diff)
-
dvo/dmt.c (modified) (2 diffs)
-
dvo/dvo.c (modified) (2 diffs)
-
dvo/elixir.c (modified) (5 diffs)
-
dvo/extract.c (modified) (8 diffs)
-
dvo/find_regions.c (modified) (2 diffs)
-
dvo/fitcolors.c (modified) (7 diffs)
-
dvo/fitsed.c (modified) (3 diffs)
-
dvo/gcat.c (modified) (2 diffs)
-
dvo/get_regions.c (modified) (1 diff)
-
dvo/getxtra.c (modified) (1 diff)
-
dvo/gimages.c (modified) (5 diffs)
-
dvo/gstar.c (modified) (11 diffs)
-
dvo/images.c (modified) (4 diffs)
-
dvo/imbox.c (modified) (3 diffs)
-
dvo/imdata.c (modified) (4 diffs)
-
dvo/imdense.c (modified) (1 diff)
-
dvo/imextract.c (modified) (4 diffs)
-
dvo/imlist.c (modified) (4 diffs)
-
dvo/imphot.c (modified) (4 diffs)
-
dvo/imrough.c (modified) (11 diffs)
-
dvo/imsearch.c (modified) (8 diffs)
-
dvo/imstats.c (modified) (3 diffs)
-
dvo/lcat.c (modified) (2 diffs)
-
dvo/lcurve.c (modified) (3 diffs)
-
dvo/lightcurve.c (modified) (3 diffs)
-
dvo/mextract.c (modified) (1 diff)
-
dvo/pcat.c (modified) (3 diffs)
-
dvo/photcodes.c (modified) (3 diffs)
-
dvo/photometry.c (modified) (15 diffs)
-
dvo/pmeasure.c (modified) (1 diff)
-
dvo/procks.c (modified) (3 diffs)
-
dvo/region_list.c (modified) (4 diffs)
-
dvo/showtile.c (modified) (2 diffs)
-
dvo/simage.c (modified) (7 diffs)
-
dvo/skycat.c (modified) (4 diffs)
-
dvo/skycoverage.c (modified) (3 diffs)
-
dvo/skydbtile.c (modified) (1 diff)
-
dvo/subpix.c (modified) (5 diffs)
-
dvo/version.c (modified) (1 diff)
-
include/data.h (modified) (1 diff)
-
include/external.h (modified) (1 diff)
-
include/pantasks.h (modified) (2 diffs)
-
include/pcontrol.h (modified) (1 diff)
-
include/shell.h (modified) (1 diff)
-
lib.data/gaussj.c (modified) (6 diffs)
-
lib.data/mrq2dmin.c (modified) (3 diffs)
-
lib.data/mrqmin.c (modified) (2 diffs)
-
lib.data/open_graph.c (modified) (5 diffs)
-
lib.data/open_image.c (modified) (4 diffs)
-
lib.data/powell.c (modified) (1 diff)
-
lib.data/precess.c (modified) (1 diff)
-
lib.data/queues.c (modified) (3 diffs)
-
lib.data/starfuncs.c (modified) (2 diffs)
-
lib.data/style_args.c (modified) (1 diff)
-
lib.shell/BufferOps.c (modified) (5 diffs)
-
lib.shell/CommandOps.c (modified) (3 diffs)
-
lib.shell/MacroOps.c (modified) (5 diffs)
-
lib.shell/Makefile (modified) (1 diff)
-
lib.shell/VectorOps.c (modified) (2 diffs)
-
lib.shell/command.c (modified) (1 diff)
-
lib.shell/convert_to_RPN.c (modified) (1 diff)
-
lib.shell/errors.c (modified) (1 diff)
-
lib.shell/evaluate_stack.c (modified) (3 diffs)
-
lib.shell/expand_vars.c (modified) (2 diffs)
-
lib.shell/expand_vectors.c (modified) (1 diff)
-
lib.shell/gprint.c (added)
-
lib.shell/interrupt.c (modified) (1 diff)
-
lib.shell/isolate_elements.c (modified) (1 diff)
-
lib.shell/macro_create.c (modified) (4 diffs)
-
lib.shell/macro_delete.c (modified) (2 diffs)
-
lib.shell/macro_edit.c (modified) (1 diff)
-
lib.shell/macro_exec.c (modified) (1 diff)
-
lib.shell/macro_list.c (modified) (2 diffs)
-
lib.shell/macro_read.c (modified) (1 diff)
-
lib.shell/macro_write.c (modified) (1 diff)
-
lib.shell/opihi.c (modified) (1 diff)
-
lib.shell/parse.c (modified) (4 diffs)
-
lib.shell/startup.c (modified) (2 diffs)
-
lib.shell/string.c (modified) (4 diffs)
-
lib.shell/timeformat.c (modified) (2 diffs)
-
lib.shell/variable.c (modified) (2 diffs)
-
mana/Makefile (modified) (1 diff)
-
mana/adc.c (modified) (6 diffs)
-
mana/demux.c (modified) (1 diff)
-
mana/findpeaks.c (modified) (1 diff)
-
mana/fitcontour.c (modified) (1 diff)
-
mana/focus.c (modified) (6 diffs)
-
mana/mana.c (modified) (2 diffs)
-
mana/opihi.c (modified) (2 diffs)
-
mana/rawstars.c (modified) (2 diffs)
-
mana/simsignal.c (modified) (1 diff)
-
mana/starcontour.c (modified) (1 diff)
-
mana/tests.c (modified) (12 diffs)
-
mana/version.c (modified) (1 diff)
-
pantasks/CheckController.c (modified) (9 diffs)
-
pantasks/CheckJobs.c (modified) (6 diffs)
-
pantasks/CheckPassword.c (modified) (2 diffs)
-
pantasks/ControllerOps.c (modified) (17 diffs)
-
pantasks/JobOps.c (modified) (2 diffs)
-
pantasks/ListenClients.c (modified) (8 diffs)
-
pantasks/LocalJob.c (modified) (6 diffs)
-
pantasks/Makefile (modified) (2 diffs)
-
pantasks/SocketOps.c (modified) (12 diffs)
-
pantasks/TaskOps.c (modified) (6 diffs)
-
pantasks/client_shell.c (modified) (5 diffs)
-
pantasks/controller.c (modified) (2 diffs)
-
pantasks/controller_check.c (modified) (3 diffs)
-
pantasks/controller_exit.c (modified) (1 diff)
-
pantasks/controller_host.c (modified) (2 diffs)
-
pantasks/controller_output.c (modified) (1 diff)
-
pantasks/controller_pulse.c (modified) (2 diffs)
-
pantasks/controller_status.c (modified) (3 diffs)
-
pantasks/delete.c (modified) (2 diffs)
-
pantasks/invalid.c (modified) (1 diff)
-
pantasks/job.c (modified) (3 diffs)
-
pantasks/kill.c (modified) (3 diffs)
-
pantasks/pantasks.c (modified) (2 diffs)
-
pantasks/pantasks_client.c (modified) (2 diffs)
-
pantasks/pantasks_server.c (modified) (2 diffs)
-
pantasks/pulse.c (modified) (1 diff)
-
pantasks/run.c (modified) (1 diff)
-
pantasks/scheduler.c (modified) (2 diffs)
-
pantasks/status.c (modified) (1 diff)
-
pantasks/stop.c (modified) (1 diff)
-
pantasks/task.c (modified) (3 diffs)
-
pantasks/task_command.c (modified) (2 diffs)
-
pantasks/task_host.c (modified) (2 diffs)
-
pantasks/task_macros.c (modified) (3 diffs)
-
pantasks/task_nmax.c (modified) (2 diffs)
-
pantasks/task_periods.c (modified) (2 diffs)
-
pantasks/task_trange.c (modified) (2 diffs)
-
pantasks/verbose.c (modified) (2 diffs)
-
pantasks/version.c (modified) (1 diff)
-
pclient/ChildOps.c (modified) (6 diffs)
-
pclient/job.c (modified) (5 diffs)
-
pclient/pclient.c (modified) (2 diffs)
-
pclient/reset.c (modified) (3 diffs)
-
pclient/status.c (modified) (2 diffs)
-
pclient/stdout.c (modified) (2 diffs)
-
pclient/version.c (modified) (1 diff)
-
pcontrol/CheckBusyJob.c (modified) (3 diffs)
-
pcontrol/CheckDoneHost.c (modified) (6 diffs)
-
pcontrol/CheckHost.c (modified) (3 diffs)
-
pcontrol/CheckIdleHost.c (modified) (2 diffs)
-
pcontrol/CheckSystem.c (modified) (9 diffs)
-
pcontrol/GetJobOutput.c (modified) (2 diffs)
-
pcontrol/HostOps.c (modified) (2 diffs)
-
pcontrol/JobID.c (modified) (2 diffs)
-
pcontrol/JobOps.c (modified) (6 diffs)
-
pcontrol/KillJob.c (modified) (3 diffs)
-
pcontrol/ResetJob.c (modified) (2 diffs)
-
pcontrol/StartHost.c (modified) (1 diff)
-
pcontrol/StartJob.c (modified) (5 diffs)
-
pcontrol/StopHosts.c (modified) (5 diffs)
-
pcontrol/check.c (modified) (3 diffs)
-
pcontrol/delete.c (modified) (3 diffs)
-
pcontrol/host.c (modified) (8 diffs)
-
pcontrol/job.c (modified) (3 diffs)
-
pcontrol/jobstack.c (modified) (2 diffs)
-
pcontrol/kill.c (modified) (2 diffs)
-
pcontrol/pclient.c (modified) (1 diff)
-
pcontrol/pcontrol.c (modified) (2 diffs)
-
pcontrol/pulse.c (modified) (1 diff)
-
pcontrol/rconnect.c (modified) (5 diffs)
-
pcontrol/run.c (modified) (1 diff)
-
pcontrol/status.c (modified) (2 diffs)
-
pcontrol/stdout.c (modified) (4 diffs)
-
pcontrol/stop.c (modified) (1 diff)
-
pcontrol/verbose.c (modified) (2 diffs)
-
pcontrol/version.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.astro/biassub.c
r4689 r7917 21 21 22 22 if (argc != 7) { 23 fprintf (stderr, "USAGE: biassub <buffer> sx sy nx ny dir [-v N V]\n");24 fprintf (stderr, " optional storage of vector and sequence in N and V\n");23 gprint (GP_ERR, "USAGE: biassub <buffer> sx sy nx ny dir [-v N V]\n"); 24 gprint (GP_ERR, " optional storage of vector and sequence in N and V\n"); 25 25 return (FALSE); 26 26 } … … 33 33 dir = atof (argv[6]); 34 34 if ((dir != 0) && (dir != 1)) { 35 fprintf (stderr, " dir must be either 0 (x) or 1 (y)\n");35 gprint (GP_ERR, " dir must be either 0 (x) or 1 (y)\n"); 36 36 return (FALSE); 37 37 } … … 45 45 nlong = nx; 46 46 } 47 fprintf (GetOutfile(), "start: %d %d size: %d %d\n", sx, sy, nx, ny);47 gprint (GP_LOG, "start: %d %d size: %d %d\n", sx, sy, nx, ny); 48 48 49 49 if ((sx < 0) || (sy < 0) || 50 50 (sx+nx > buf[0].matrix.Naxis[0]) || 51 51 (sy+ny > buf[0].matrix.Naxis[1])) { 52 fprintf (stderr, "region out of range\n");52 gprint (GP_ERR, "region out of range\n"); 53 53 return (FALSE); 54 54 } -
trunk/Ohana/src/opihi/cmd.astro/cgrid.c
r7080 r7917 20 20 21 21 if (argc != 1) { 22 fprintf (stderr, "USAGE: cgrid [style]\n");22 gprint (GP_ERR, "USAGE: cgrid [style]\n"); 23 23 return (FALSE); 24 24 } -
trunk/Ohana/src/opihi/cmd.astro/coords.c
r3460 r7917 43 43 if (!strcmp(&coords.ctype[4], "-WRP")) { 44 44 if (MOSAIC == NULL) { 45 fprintf (stderr, "must supply mosaic for WRP coords\n");45 gprint (GP_ERR, "must supply mosaic for WRP coords\n"); 46 46 return (FALSE); 47 47 } … … 53 53 if (mode == SKY) { 54 54 XY_to_RD (&R, &D, X, Y, &coords); 55 fprintf (GetOutfile(), "%10.6f %10.6f\n", R, D);55 gprint (GP_LOG, "%10.6f %10.6f\n", R, D); 56 56 set_variable ("RA", R); 57 57 set_variable ("DEC", D); … … 61 61 if (mode == PIXEL) { 62 62 RD_to_XY (&X, &Y, R, D, &coords); 63 fprintf (GetOutfile(), "%7.2f %7.2f\n", X, Y);63 gprint (GP_LOG, "%7.2f %7.2f\n", X, Y); 64 64 set_variable ("Xc", X); 65 65 set_variable ("Yc", Y); … … 69 69 70 70 syntax: 71 fprintf (stderr, "USAGE: coords [buffer] (-c R D) / (-p X Y)\n");72 fprintf (stderr, "only one of -p or -c can be used\n");71 gprint (GP_ERR, "USAGE: coords [buffer] (-c R D) / (-p X Y)\n"); 72 gprint (GP_ERR, "only one of -p or -c can be used\n"); 73 73 escape: 74 74 if (MOSAIC != NULL) free (MOSAIC); -
trunk/Ohana/src/opihi/cmd.astro/cplot.c
r7391 r7917 11 11 12 12 if (argc != 3) { 13 fprintf (stderr, "USAGE: cplot <ra> <dec> [style]\n");13 gprint (GP_ERR, "USAGE: cplot <ra> <dec> [style]\n"); 14 14 return (FALSE); 15 15 } … … 24 24 25 25 if (xvec[0].Nelements != yvec[0].Nelements) { 26 fprintf (stderr, "vectors are not the same length\n");26 gprint (GP_ERR, "vectors are not the same length\n"); 27 27 return (FALSE); 28 28 } -
trunk/Ohana/src/opihi/cmd.astro/csystem.c
r2598 r7917 13 13 14 14 if (argc != 5) { 15 fprintf (stderr, "USAGE: csystems [C/G/E/H] [C/G/E/H] X Y\n");15 gprint (GP_ERR, "USAGE: csystems [C/G/E/H] [C/G/E/H] X Y\n"); 16 16 return (FALSE); 17 17 } … … 22 22 switch (argv[2][0]) { 23 23 case 'C': 24 fprintf (stderr, "same coordinate system\n");24 gprint (GP_ERR, "same coordinate system\n"); 25 25 return (TRUE); 26 26 break; … … 51 51 break; 52 52 case 'G': 53 fprintf (stderr, "error: conversions between galactic and ecliptic not implemented\n");53 gprint (GP_ERR, "error: conversions between galactic and ecliptic not implemented\n"); 54 54 return (FALSE); 55 55 phi = -62.6*RAD_DEG; … … 73 73 break; 74 74 case 'E': 75 fprintf (stderr, "error: conversions between galactic and ecliptic not implemented\n");75 gprint (GP_ERR, "error: conversions between galactic and ecliptic not implemented\n"); 76 76 return (FALSE); 77 77 gettimeofday (&now, (struct timezone *) NULL); … … 91 91 92 92 if (xvec[0].Nelements != yvec[0].Nelements) { 93 fprintf (stderr, "vectors %s and %s not the same length\n", argv[3], argv[4]);93 gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[3], argv[4]); 94 94 return (FALSE); 95 95 } -
trunk/Ohana/src/opihi/cmd.astro/ctimes.c
r2843 r7917 16 16 17 17 if (argc != 3) { 18 fprintf (stderr, "USAGE: ctimes [-ref (value) / -abs (date)] [-var name]\n");18 gprint (GP_ERR, "USAGE: ctimes [-ref (value) / -abs (date)] [-var name]\n"); 19 19 return (FALSE); 20 20 } … … 35 35 free (Variable); 36 36 } else { 37 fprintf (stderr, "time: %s\n", date);37 gprint (GP_ERR, "time: %s\n", date); 38 38 } 39 39 … … 44 44 45 45 if (strcmp (argv[1], "-abs")) { 46 fprintf (stderr, "syntax error\n");46 gprint (GP_ERR, "syntax error\n"); 47 47 return (FALSE); 48 48 } 49 49 50 50 if (!str_to_time (argv[2], &time)) { 51 fprintf (stderr, "syntax error\n");51 gprint (GP_ERR, "syntax error\n"); 52 52 return (FALSE); 53 53 } … … 60 60 return (TRUE); 61 61 } 62 fprintf (stderr, "time: %f\n", value);62 gprint (GP_ERR, "time: %f\n", value); 63 63 return (TRUE); 64 64 } -
trunk/Ohana/src/opihi/cmd.astro/cval.c
r2598 r7917 9 9 10 10 if (argc != 7) { 11 fprintf (stderr, "USAGE: cval <buffer> x y dx dy sky\n");11 gprint (GP_ERR, "USAGE: cval <buffer> x y dx dy sky\n"); 12 12 return (FALSE); 13 13 } … … 28 28 (sx+nx > buf[0].matrix.Naxis[0]) || 29 29 (sy+ny > buf[0].matrix.Naxis[1])) { 30 fprintf (stderr, "region out of range\n");30 gprint (GP_ERR, "region out of range\n"); 31 31 return (FALSE); 32 32 } … … 45 45 } 46 46 47 fprintf (stderr, "cval: %f sn: %f\n", cval, sqrt(sn));47 gprint (GP_ERR, "cval: %f sn: %f\n", cval, sqrt(sn)); 48 48 49 49 return (TRUE); -
trunk/Ohana/src/opihi/cmd.astro/czplot.c
r7080 r7917 12 12 13 13 if (argc != 6) { 14 fprintf (stderr, "USAGE: czplot <x> <y> <z> min max\n");14 gprint (GP_ERR, "USAGE: czplot <x> <y> <z> min max\n"); 15 15 return (FALSE); 16 16 } … … 28 28 29 29 if (xvec[0].Nelements != yvec[0].Nelements) { 30 fprintf (stderr, "vectors %s and %s not the same length\n", argv[1], argv[2]);30 gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[2]); 31 31 return (FALSE); 32 32 } 33 33 if (xvec[0].Nelements != zvec[0].Nelements) { 34 fprintf (stderr, "vectors %s and %s not the same length\n", argv[1], argv[3]);34 gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[3]); 35 35 return (FALSE); 36 36 } -
trunk/Ohana/src/opihi/cmd.astro/drizzle.c
r4689 r7917 27 27 28 28 if (argc != 5) { 29 fprintf (stderr, "USAGE: transform <from> <to> <weight> (Nlinear)\n");30 fprintf (stderr, " output buffer must exist with target astrometry header\n");31 fprintf (stderr, " Nlinear is the pixel scale for linear astrometric transformation\n");29 gprint (GP_ERR, "USAGE: transform <from> <to> <weight> (Nlinear)\n"); 30 gprint (GP_ERR, " output buffer must exist with target astrometry header\n"); 31 gprint (GP_ERR, " Nlinear is the pixel scale for linear astrometric transformation\n"); 32 32 return (FALSE); 33 33 } … … 43 43 /* for the moment, disable WRP / DIS */ 44 44 if (!strcmp(&coords_in.ctype[4], "-WRP") || !strcmp(&coords_out.ctype[4], "-WRP")) { 45 fprintf (stderr, "WRP mode not implemented for astrom\n");45 gprint (GP_ERR, "WRP mode not implemented for astrom\n"); 46 46 return (FALSE); 47 47 } … … 50 50 scale_out = sqrt(fabs(coords_out.cdelt1*coords_out.cdelt2*(coords_out.pc1_1*coords_out.pc2_2 - coords_out.pc1_2*coords_out.pc2_1))); 51 51 52 fprintf (stderr, "%f - %f\n", scale_in, scale_out);52 gprint (GP_ERR, "%f - %f\n", scale_in, scale_out); 53 53 54 54 if (scale_in > scale_out) { -
trunk/Ohana/src/opihi/cmd.astro/fixwrap.c
r6678 r7917 8 8 9 9 if (argc != 3) { 10 fprintf (stderr, "USAGE: fixwrap <in> (rowfix)\n");10 gprint (GP_ERR, "USAGE: fixwrap <in> (rowfix)\n"); 11 11 return (FALSE); 12 12 } -
trunk/Ohana/src/opihi/cmd.astro/flux.c
r2843 r7917 12 12 13 13 if (argc != 3) { 14 fprintf (stderr, "USAGE: flux <buffer> (region)\n");14 gprint (GP_ERR, "USAGE: flux <buffer> (region)\n"); 15 15 return (FALSE); 16 16 } … … 20 20 f = fopen (argv[2], "r"); 21 21 if (f == (FILE *) NULL) { 22 fprintf (stderr, "file %s not found\n", argv[2]);22 gprint (GP_ERR, "file %s not found\n", argv[2]); 23 23 return (FALSE); 24 24 } … … 46 46 bb[i] = hypot (bx[i], by[i]) * SIGN (bx[i]*by[i+1] - bx[i+1]*by[i]); 47 47 } 48 fprintf (stderr, "%f %f %f %f\n", bb[0], bb[1], bb[2], bb[3]);48 gprint (GP_ERR, "%f %f %f %f\n", bb[0], bb[1], bb[2], bb[3]); 49 49 50 50 /* this only works for convex contours -- … … 70 70 signal (SIGINT, oldsignal); 71 71 72 fprintf (GetOutfile(), "flux: %f\n", flux);72 gprint (GP_LOG, "flux: %f\n", flux); 73 73 set_variable ("FLUX", flux); 74 74 return (TRUE); -
trunk/Ohana/src/opihi/cmd.astro/gauss.c
r5850 r7917 33 33 34 34 if ((argc != 2) && (argc != 3)) { 35 fprintf (stderr, "USAGE: gauss Npix [Nspots] [-border N] [-sat cnts]\n");35 gprint (GP_ERR, "USAGE: gauss Npix [Nspots] [-border N] [-sat cnts]\n"); 36 36 return (FALSE); 37 37 } 38 38 39 39 if (Ximage < 1) { 40 fprintf (stderr, "no active TV\n");40 gprint (GP_ERR, "no active TV\n"); 41 41 return (FALSE); 42 42 } -
trunk/Ohana/src/opihi/cmd.astro/getvel.c
r7080 r7917 13 13 14 14 if (argc != 5) { 15 fprintf (stderr, "USAGE: rotcurve buf X Y curve.txt\n");15 gprint (GP_ERR, "USAGE: rotcurve buf X Y curve.txt\n"); 16 16 return (FALSE); 17 17 } … … 19 19 f = fopen (argv[4], "r"); 20 20 if (f == (FILE *) NULL) { 21 fprintf (stderr, "can't find rotation curve data file %s\n", argv[4]);21 gprint (GP_ERR, "can't find rotation curve data file %s\n", argv[4]); 22 22 return (FALSE); 23 23 } … … 45 45 while (L >= 360) {L -= 360.0;} 46 46 while (L < 0.0) {L += 360.0;} 47 fprintf (stderr, "L: %f\n", L);47 gprint (GP_ERR, "L: %f\n", L); 48 48 49 49 cl = cos (L*RAD_DEG); … … 59 59 for (n = 0; (n < Ncurve) && (wr < W[n]); n++); 60 60 if ((n == 0) || (n == Ncurve)) { 61 fprintf (stderr, "velocity out of reasonable range\n");62 fprintf (stderr, "%f %f %f %f\n", V, wr, W[0], W[Ncurve-1]);61 gprint (GP_ERR, "velocity out of reasonable range\n"); 62 gprint (GP_ERR, "%f %f %f %f\n", V, wr, W[0], W[Ncurve-1]); 63 63 return (TRUE); 64 64 } … … 66 66 fr = (Ro/r); 67 67 if (r < fabs(Rs)) { /* can't be on rotation curve */ 68 fprintf (stderr, "velocity out of reasonable range\n");69 fprintf (stderr, "%f %f %f %f %f %f %f\n", V, wr, W[0], W[Ncurve-1], r, fr, Rs);68 gprint (GP_ERR, "velocity out of reasonable range\n"); 69 gprint (GP_ERR, "%f %f %f %f %f %f %f\n", V, wr, W[0], W[Ncurve-1], r, fr, Rs); 70 70 return (TRUE); 71 71 } … … 75 75 d = Ro*cl + sqrt(r*r - Rs*Rs); 76 76 77 fprintf (stderr, "dist: %f, vel: %f\n", d, V);77 gprint (GP_ERR, "dist: %f, vel: %f\n", d, V); 78 78 79 79 return (TRUE); -
trunk/Ohana/src/opihi/cmd.astro/imfit.c
r4689 r7917 65 65 qrgauss_setup (argv[N]); 66 66 if (fitfunc == NULL) { 67 fprintf (stderr, "unknown function %s\n", argv[N]);67 gprint (GP_ERR, "unknown function %s\n", argv[N]); 68 68 return (FALSE); 69 69 } … … 72 72 73 73 if (argc != 6) { 74 fprintf (stderr, "USAGE: imfit <buffer> sx sy nx ny\n");74 gprint (GP_ERR, "USAGE: imfit <buffer> sx sy nx ny\n"); 75 75 return (FALSE); 76 76 } … … 170 170 if (VERBOSE) { 171 171 for (i = 0; i < Npar; i++) { 172 fprintf (stderr, "%g ", par[i]);172 gprint (GP_ERR, "%g ", par[i]); 173 173 } 174 fprintf (stderr, "\n");174 gprint (GP_ERR, "\n"); 175 175 } 176 176 … … 186 186 187 187 range: 188 fprintf (stderr, "region out of range\n");188 gprint (GP_ERR, "region out of range\n"); 189 189 return (FALSE); 190 190 } -
trunk/Ohana/src/opihi/cmd.astro/imsub.c
r3144 r7917 30 30 qrgauss_setup (argv[N]); 31 31 if (fitfunc == NULL) { 32 fprintf (stderr, "unknown function %s\n", argv[N]);32 gprint (GP_ERR, "unknown function %s\n", argv[N]); 33 33 return (FALSE); 34 34 } … … 37 37 38 38 if (argc != 6) { 39 fprintf (stderr, "USAGE: imfit <buffer> sx sy nx ny\n");39 gprint (GP_ERR, "USAGE: imfit <buffer> sx sy nx ny\n"); 40 40 return (FALSE); 41 41 } … … 74 74 75 75 range: 76 fprintf (stderr, "region out of range\n");76 gprint (GP_ERR, "region out of range\n"); 77 77 return (FALSE); 78 78 } -
trunk/Ohana/src/opihi/cmd.astro/medianmap.c
r7080 r7917 31 31 32 32 if (argc != 5) { 33 fprintf (stderr, "USAGE: medianmap (in) (out) Nx Ny [-range min max]\n");34 fprintf (stderr, " Nx, Ny specify dimensions of output image\n");35 fprintf (stderr, " min, max specify fractional range for sorted average\n");33 gprint (GP_ERR, "USAGE: medianmap (in) (out) Nx Ny [-range min max]\n"); 34 gprint (GP_ERR, " Nx, Ny specify dimensions of output image\n"); 35 gprint (GP_ERR, " min, max specify fractional range for sorted average\n"); 36 36 return (FALSE); 37 37 } -
trunk/Ohana/src/opihi/cmd.astro/mkgauss.c
r2843 r7917 21 21 22 22 if ((argc < 3) || (argc > 5)) { 23 fprintf (stderr, "USAGE: mkgauss (buffer) (sigma) [[sy/sx] angle]\n");23 gprint (GP_ERR, "USAGE: mkgauss (buffer) (sigma) [[sy/sx] angle]\n"); 24 24 return (FALSE); 25 25 } -
trunk/Ohana/src/opihi/cmd.astro/multifit.c
r2598 r7917 11 11 12 12 if (argc != 2) { 13 fprintf (stderr, "USAGE: multifit (Norder)\n");13 gprint (GP_ERR, "USAGE: multifit (Norder)\n"); 14 14 return (FALSE); 15 15 } … … 170 170 171 171 escape: 172 fprintf (stderr, "syntax error\n");172 gprint (GP_ERR, "syntax error\n"); 173 173 return (FALSE); 174 174 -
trunk/Ohana/src/opihi/cmd.astro/objload.c
r7680 r7917 27 27 28 28 if (argc != 3) { 29 fprintf (stderr, "USAGE: objload (overlay) <filename>\n");29 gprint (GP_ERR, "USAGE: objload (overlay) <filename>\n"); 30 30 return (FALSE); 31 31 } … … 33 33 f = fopen (argv[2], "r"); 34 34 if (f == (FILE *) NULL) { 35 fprintf (stderr, "ERROR: can't find object file %s\n", argv[2]);35 gprint (GP_ERR, "ERROR: can't find object file %s\n", argv[2]); 36 36 return (FALSE); 37 37 } … … 69 69 free (line); 70 70 71 fprintf (stderr, "loaded %d objects\n", Noverlay);71 gprint (GP_ERR, "loaded %d objects\n", Noverlay); 72 72 return (TRUE); 73 73 } -
trunk/Ohana/src/opihi/cmd.astro/outline.c
r5846 r7917 14 14 15 15 if (argc != 9) { 16 fprintf (stderr, "USAGE: outline x y dx dy dxy Io (buffer) Npar\n");16 gprint (GP_ERR, "USAGE: outline x y dx dy dxy Io (buffer) Npar\n"); 17 17 return (FALSE); 18 18 } … … 43 43 44 44 chisq = outline_chi (Io, in, buf[0].matrix.Naxis[0], buf[0].matrix.Naxis[1], &frac); 45 fprintf (stderr, "chisq (1): %f\n", chisq);45 gprint (GP_ERR, "chisq (1): %f\n", chisq); 46 46 47 47 for (j = 0; j < 15; j++) { … … 63 63 chisq = nchisq; 64 64 } 65 fprintf (stderr, "frac: %f %f %f %f\n", frac, par[2], par[3], chisq);65 gprint (GP_ERR, "frac: %f %f %f %f\n", frac, par[2], par[3], chisq); 66 66 } 67 67 } … … 112 112 } 113 113 /* 114 fprintf (stderr, "try: %d %f ", i, chisq);114 gprint (GP_ERR, "try: %d %f ", i, chisq); 115 115 for (k = 0; k < 5; k++) { 116 fprintf (stderr, "%f ", par[k]);116 gprint (GP_ERR, "%f ", par[k]); 117 117 } 118 fprintf (stderr, "\n");118 gprint (GP_ERR, "\n"); 119 119 */ 120 120 ochisq = chisq; … … 130 130 } 131 131 132 fprintf (stderr, "try: %d %f ", j, chisq);132 gprint (GP_ERR, "try: %d %f ", j, chisq); 133 133 for (i = 0; i < 5; i++) { 134 fprintf (stderr, "%f ", par[i]);135 } 136 fprintf (stderr, "\n ");134 gprint (GP_ERR, "%f ", par[i]); 135 } 136 gprint (GP_ERR, "\n "); 137 137 for (i = 0; i < 5; i++) { 138 fprintf (stderr, "%f ", dpar[i]);139 } 140 fprintf (stderr, "\n");138 gprint (GP_ERR, "%f ", dpar[i]); 139 } 140 gprint (GP_ERR, "\n"); 141 141 dchi -= chisq; 142 142 -
trunk/Ohana/src/opihi/cmd.astro/outline2.c
r5846 r7917 18 18 19 19 if (argc != 9) { 20 fprintf (stderr, "USAGE: outline x y dx dy dxy Io dIo (buffer)\n");20 gprint (GP_ERR, "USAGE: outline x y dx dy dxy Io dIo (buffer)\n"); 21 21 return (FALSE); 22 22 } … … 78 78 79 79 if (Npts == 0) { 80 fprintf (stderr, "no valid points in box, try again\n");80 gprint (GP_ERR, "no valid points in box, try again\n"); 81 81 free (xs); 82 82 free (ys); … … 87 87 plot_outline (); 88 88 chisq = outline_chi (Io, in); 89 fprintf (stderr, "starting chisq: %f for %d pts\n", chisq, Npts);89 gprint (GP_ERR, "starting chisq: %f for %d pts\n", chisq, Npts); 90 90 91 91 # if (1) … … 139 139 } 140 140 141 fprintf (stderr, "try: %d %f ", j, chisq);141 gprint (GP_ERR, "try: %d %f ", j, chisq); 142 142 for (i = 0; i < 5; i++) { 143 fprintf (stderr, "%f ", par[i]);144 } 145 fprintf (stderr, "\n ");143 gprint (GP_ERR, "%f ", par[i]); 144 } 145 gprint (GP_ERR, "\n "); 146 146 for (i = 0; i < 5; i++) { 147 fprintf (stderr, "%f ", dpar[i]);148 } 149 fprintf (stderr, "\n");147 gprint (GP_ERR, "%f ", dpar[i]); 148 } 149 gprint (GP_ERR, "\n"); 150 150 dchi -= chisq; 151 151 -
trunk/Ohana/src/opihi/cmd.astro/polar.c
r7080 r7917 12 12 13 13 if (argc != 4) { 14 fprintf (stderr, "USAGE: polar in out\n");14 gprint (GP_ERR, "USAGE: polar in out\n"); 15 15 return (FALSE); 16 16 } … … 25 25 ny = mask[0].matrix.Naxis[1]; 26 26 if ((Nx != nx) && (Ny != ny)) { 27 fprintf (stderr, "output and mask must have same dimensions\n");27 gprint (GP_ERR, "output and mask must have same dimensions\n"); 28 28 return (FALSE); 29 29 } -
trunk/Ohana/src/opihi/cmd.astro/precess.c
r2598 r7917 15 15 in_epoch = out_epoch = 2000.0; 16 16 if (argc != 5) { 17 fprintf (stderr, "USAGE: precess (from) (to) RA DEC \n");18 fprintf (stderr, " you may use B for B1950.0 or J for J2000.0\n");17 gprint (GP_ERR, "USAGE: precess (from) (to) RA DEC \n"); 18 gprint (GP_ERR, " you may use B for B1950.0 or J for J2000.0\n"); 19 19 return (FALSE); 20 20 } … … 56 56 } 57 57 58 fprintf (stderr, "converting from J%f to J%f\n", in_epoch, out_epoch);58 gprint (GP_ERR, "converting from J%f to J%f\n", in_epoch, out_epoch); 59 59 60 60 T = (out_epoch - in_epoch) / 100.0; … … 77 77 if (RA < 0) 78 78 RA += 360; 79 fprintf (GetOutfile(), "%f %f -> %f %f\n", A, D, RA, DEC);79 gprint (GP_LOG, "%f %f -> %f %f\n", A, D, RA, DEC); 80 80 return (TRUE); 81 81 } … … 86 86 87 87 if (xvec[0].Nelements != yvec[0].Nelements) { 88 fprintf (stderr, "vectors %s and %s not the same length\n", argv[3], argv[4]);88 gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[3], argv[4]); 89 89 return (FALSE); 90 90 } -
trunk/Ohana/src/opihi/cmd.astro/profile.c
r2598 r7917 10 10 11 11 if (argc != 7) { 12 fprintf (stderr, "USAGE: profile <buffer> <X vector> <Y vector> x y N\n");12 gprint (GP_ERR, "USAGE: profile <buffer> <X vector> <Y vector> x y N\n"); 13 13 return (FALSE); 14 14 } … … 47 47 48 48 range_error: 49 fprintf (stderr, "region out of range\n");49 gprint (GP_ERR, "region out of range\n"); 50 50 return (FALSE); 51 51 } -
trunk/Ohana/src/opihi/cmd.astro/region.c
r5850 r7917 33 33 34 34 if ((argc != 4) && (argc != 5)) { 35 fprintf (stderr, "USAGE: region Ra Dec Radius [projection] [orientation]\n");36 fprintf (stderr, " current: %f %f (%f x %f) (%s)\n",35 gprint (GP_ERR, "USAGE: region Ra Dec Radius [projection] [orientation]\n"); 36 gprint (GP_ERR, " current: %f %f (%f x %f) (%s)\n", 37 37 graphmode.coords.crval1, graphmode.coords.crval2, 38 38 fabs(graphmode.xmax - graphmode.xmin), -
trunk/Ohana/src/opihi/cmd.astro/rotcurve.c
r7080 r7917 21 21 22 22 if (argc != 5) { 23 fprintf (stderr, "USAGE: rotcurve in out mask curve.txt\n");23 gprint (GP_ERR, "USAGE: rotcurve in out mask curve.txt\n"); 24 24 return (FALSE); 25 25 } … … 27 27 f = fopen (argv[4], "r"); 28 28 if (f == (FILE *) NULL) { 29 fprintf (stderr, "can't find rotation curve data file %s\n", argv[4]);29 gprint (GP_ERR, "can't find rotation curve data file %s\n", argv[4]); 30 30 return (FALSE); 31 31 } … … 45 45 ny = mask[0].matrix.Naxis[1]; 46 46 if ((Nx != nx) && (Ny != ny)) { 47 fprintf (stderr, "output and mask must have same dimensions\n");47 gprint (GP_ERR, "output and mask must have same dimensions\n"); 48 48 return (FALSE); 49 49 } … … 74 74 X = (L - Lo) / dL + Xo; 75 75 if ((X >= Nx) || (X < 0)) { 76 fprintf (stderr, "X out of range\n");76 gprint (GP_ERR, "X out of range\n"); 77 77 return (FALSE); 78 78 } 79 fprintf (stderr, "L: %f (%d)\n", L, X);79 gprint (GP_ERR, "L: %f (%d)\n", L, X); 80 80 81 81 cl = cos (L*RAD_DEG); -
trunk/Ohana/src/opihi/cmd.astro/scale.c
r2598 r7917 6 6 7 7 if (argc != 5) { 8 fprintf (stderr, "USAGE: scale (buffer) (key) [-r/-w] (value)\n");8 gprint (GP_ERR, "USAGE: scale (buffer) (key) [-r/-w] (value)\n"); 9 9 return (FALSE); 10 10 } … … 13 13 14 14 if (strcasecmp (argv[2], "bzero") && strcasecmp (argv[2], "bscale")) { 15 fprintf (stderr, "use bzero or bscale only\n");15 gprint (GP_ERR, "use bzero or bscale only\n"); 16 16 return (FALSE); 17 17 } 18 18 19 19 if (strcmp (argv[3], "-r") && strcmp (argv[3], "-w")) { 20 fprintf (stderr, "use -r or -w only\n");20 gprint (GP_ERR, "use -r or -w only\n"); 21 21 return (FALSE); 22 22 } -
trunk/Ohana/src/opihi/cmd.astro/sexigesimal.c
r2843 r7917 18 18 19 19 if ((argc != 3) && (argc != 2)) { 20 fprintf (stderr, "USAGE: sexigesimal (from) [to]\n");20 gprint (GP_ERR, "USAGE: sexigesimal (from) [to]\n"); 21 21 return (FALSE); 22 22 } … … 24 24 if (HMS) { 25 25 if (!dms_to_ddd (&value, argv[1])) { 26 fprintf (stderr, "syntax error in input\n");26 gprint (GP_ERR, "syntax error in input\n"); 27 27 return (FALSE); 28 28 } … … 30 30 set_variable (argv[2], value); 31 31 } else { 32 fprintf (GetOutfile(), "%10.6f\n", value);32 gprint (GP_LOG, "%10.6f\n", value); 33 33 } 34 34 return (TRUE); … … 39 39 set_str_variable (argv[2], string); 40 40 } else { 41 fprintf (GetOutfile(), "%s\n", string);41 gprint (GP_LOG, "%s\n", string); 42 42 } 43 43 return (TRUE); -
trunk/Ohana/src/opihi/cmd.astro/spec.c
r4689 r7917 34 34 35 35 if (argc != 7) { 36 fprintf (stderr, "USAGE: spec buffer x y1 y2 X Y [-Nlong N] [-Ngap N] [-Nrow N]\n");36 gprint (GP_ERR, "USAGE: spec buffer x y1 y2 X Y [-Nlong N] [-Ngap N] [-Nrow N]\n"); 37 37 return (FALSE); 38 38 } 39 39 40 40 if ((Nrow < 1) || (Nlong < 2) || (Ngap < 1) || (Nlong - Ngap < 2)) { 41 fprintf (stderr, "bad values for options\n");41 gprint (GP_ERR, "bad values for options\n"); 42 42 return (FALSE); 43 43 } … … 79 79 } 80 80 X1 = SX / S; 81 fprintf (stderr, "%4d %4d %5.1f ", j+y1, X1, sky);81 gprint (GP_ERR, "%4d %4d %5.1f ", j+y1, X1, sky); 82 82 /* X1 = MAX (MIN (X1, Xo + 0.5+Ngap), Xo - 0.5+Ngap); */ 83 83 V = (float *) (buf[0].matrix.buffer) + Nx*(y1 + j) + X1 - (int)(0.5*Nlong); … … 105 105 xvec[0].elements[j] = j + y1; 106 106 yvec[0].elements[j] = F / R; 107 fprintf (stderr, " %5.1f %7.1f %6.2f\n", sky, sky2, (F/R));107 gprint (GP_ERR, " %5.1f %7.1f %6.2f\n", sky, sky2, (F/R)); 108 108 } 109 109 -
trunk/Ohana/src/opihi/cmd.astro/star.c
r2843 r7917 23 23 24 24 if ((argc != 4) && (argc != 5)) { 25 fprintf (stderr, "USAGE: star (buffer) x y [dx] [-border N] [-sat cnts]\n");25 gprint (GP_ERR, "USAGE: star (buffer) x y [dx] [-border N] [-sat cnts]\n"); 26 26 return (FALSE); 27 27 } -
trunk/Ohana/src/opihi/cmd.astro/testfit.c
r2598 r7917 11 11 12 12 if (argc != 4) { 13 fprintf (stderr, "USAGE: imfit <x> <y> <dy>\n");13 gprint (GP_ERR, "USAGE: imfit <x> <y> <dy>\n"); 14 14 return (FALSE); 15 15 } … … 37 37 38 38 chisq = mrqmin (xvec[0].elements, yvec[0].elements, dy, Npts, par, Npar, fgaussOD); 39 fprintf (stderr, "chisq: %f, %f %f %f %f\n", chisq, par[0], par[1], par[2], par[3]);39 gprint (GP_ERR, "chisq: %f, %f %f %f %f\n", chisq, par[0], par[1], par[2], par[3]); 40 40 41 41 } … … 44 44 45 45 for (i = 0; i < Npar; i++) { 46 fprintf (stderr, "%d %f %f\n", i, par[i], covar[i][i]);46 gprint (GP_ERR, "%d %f %f\n", i, par[i], covar[i][i]); 47 47 } 48 48 … … 128 128 129 129 if (argc != 6) { 130 fprintf (stderr, "USAGE: imfit <buffer> sx sy nx ny\n");130 gprint (GP_ERR, "USAGE: imfit <buffer> sx sy nx ny\n"); 131 131 return (FALSE); 132 132 } … … 143 143 (sx+nx > buffers[Nbuf].matrix.Naxis[0]) || 144 144 (sy+ny > buffers[Nbuf].matrix.Naxis[1])) { 145 fprintf (stderr, "region out of range\n");145 gprint (GP_ERR, "region out of range\n"); 146 146 return (FALSE); 147 147 } -
trunk/Ohana/src/opihi/cmd.astro/transform.c
r3404 r7917 14 14 15 15 if (argc != 3) { 16 fprintf (stderr, "USAGE: transform <from> <to>\n");16 gprint (GP_ERR, "USAGE: transform <from> <to>\n"); 17 17 return (FALSE); 18 18 } … … 26 26 /* for the moment, disable WRP / DIS */ 27 27 if (!strcmp(&coords_in.ctype[4], "-WRP") || !strcmp(&coords_out.ctype[4], "-WRP")) { 28 fprintf (stderr, "WRP mode not implemented for astrom\n");28 gprint (GP_ERR, "WRP mode not implemented for astrom\n"); 29 29 return (FALSE); 30 30 } … … 46 46 47 47 for (j = 0; j < in[0].header.Naxis[1]; j++) { 48 fprintf (stderr, ".");48 gprint (GP_ERR, "."); 49 49 for (i = 0; i < in[0].header.Naxis[0]; i++, Vin++) { 50 50 for (dx = 0.0 + 0.5*frac; dx < 1.0 - 0.5*frac; dx += frac) { -
trunk/Ohana/src/opihi/cmd.astro/warp.c
r7039 r7917 27 27 28 28 if (argc != 5) { 29 fprintf (stderr, "USAGE: transform <from> <to> <weight> (Nlinear)\n");30 fprintf (stderr, " output buffer must exist with target astrometry header\n");31 fprintf (stderr, " Nlinear is the pixel scale for linear astrometric transformation\n");29 gprint (GP_ERR, "USAGE: transform <from> <to> <weight> (Nlinear)\n"); 30 gprint (GP_ERR, " output buffer must exist with target astrometry header\n"); 31 gprint (GP_ERR, " Nlinear is the pixel scale for linear astrometric transformation\n"); 32 32 return (FALSE); 33 33 } … … 43 43 /* for the moment, disable WRP / DIS */ 44 44 if (!strcmp(&coords_in.ctype[4], "-WRP") || !strcmp(&coords_out.ctype[4], "-WRP")) { 45 fprintf (stderr, "WRP mode not implemented for astrom\n");45 gprint (GP_ERR, "WRP mode not implemented for astrom\n"); 46 46 return (FALSE); 47 47 } … … 50 50 scale_out = sqrt(fabs(coords_out.cdelt1*coords_out.cdelt2*(coords_out.pc1_1*coords_out.pc2_2 - coords_out.pc1_2*coords_out.pc2_1))); 51 51 52 fprintf (stderr, "%f - %f\n", scale_in, scale_out);52 gprint (GP_ERR, "%f - %f\n", scale_in, scale_out); 53 53 54 54 if (scale_in > scale_out) { -
trunk/Ohana/src/opihi/cmd.basic/break.c
r2843 r7917 11 11 if (!strcasecmp (argv[N], "off")) value = FALSE; 12 12 if (value == -1) { 13 fprintf (stderr, "USAGE: break -auto [on / off]\n");13 gprint (GP_ERR, "USAGE: break -auto [on / off]\n"); 14 14 if (auto_break) 15 fprintf (stderr, "auto break on\n");15 gprint (GP_ERR, "auto break on\n"); 16 16 else 17 fprintf (stderr, "auto break off\n");17 gprint (GP_ERR, "auto break off\n"); 18 18 return (FALSE); 19 19 } -
trunk/Ohana/src/opihi/cmd.basic/cd.c
r6266 r7917 7 7 8 8 if (argc != 2) { 9 fprintf (stderr, "USAGE: cd <path>\n");9 gprint (GP_ERR, "USAGE: cd <path>\n"); 10 10 return (FALSE); 11 11 } … … 14 14 if (!status) { 15 15 if ((cwd = getcwd (NULL, 64)) == NULL) { 16 fprintf (stderr, "error getting cwd\n");16 gprint (GP_ERR, "error getting cwd\n"); 17 17 return (FALSE); 18 18 } 19 fprintf(GetOutfile(), "cwd: %s\n", cwd);19 gprint (GP_LOG, "cwd: %s\n", cwd); 20 20 ohana_memregister (cwd); 21 21 free (cwd); … … 23 23 } 24 24 25 fprintf (stderr, "error changing to %s\n", argv[1]);25 gprint (GP_ERR, "error changing to %s\n", argv[1]); 26 26 return (FALSE); 27 27 … … 33 33 34 34 if (argc != 1) { 35 fprintf (stderr, "USAGE: pwd\n");35 gprint (GP_ERR, "USAGE: pwd\n"); 36 36 return (FALSE); 37 37 } 38 38 39 39 if ((cwd = getcwd(NULL, 64)) == NULL) { 40 fprintf (stderr, "error getting cwd\n");40 gprint (GP_ERR, "error getting cwd\n"); 41 41 return (FALSE); 42 42 } 43 fprintf(GetOutfile(), "cwd: %s\n", cwd);43 gprint (GP_LOG, "cwd: %s\n", cwd); 44 44 ohana_memregister (cwd); 45 45 free (cwd); -
trunk/Ohana/src/opihi/cmd.basic/date.c
r2598 r7917 8 8 9 9 if ((argc != 1) && (argc != 2)) { 10 fprintf (stderr, "USAGE: date [variable]\n");10 gprint (GP_ERR, "USAGE: date [variable]\n"); 11 11 return (FALSE); 12 12 } … … 18 18 19 19 if (argc == 1) { 20 fprintf (stderr, "%s\n", tstring);20 gprint (GP_ERR, "%s\n", tstring); 21 21 } else { 22 22 set_str_variable (argv[1], tstring); -
trunk/Ohana/src/opihi/cmd.basic/echo.c
r2598 r7917 6 6 7 7 for (i = 1; i < argc; i++) { 8 fprintf (GetOutfile(), "%s ", argv[i]);8 gprint (GP_LOG, "%s ", argv[i]); 9 9 } 10 fprintf (GetOutfile(), "\n");10 gprint (GP_LOG, "\n"); 11 11 return (TRUE); 12 12 } -
trunk/Ohana/src/opihi/cmd.basic/file.c
r2598 r7917 9 9 10 10 if (argc < 2) { 11 fprintf (stderr, "USAGE: file (filename) [var]\n");11 gprint (GP_ERR, "USAGE: file (filename) [var]\n"); 12 12 return (FALSE); 13 13 } … … 23 23 } else { 24 24 25 fprintf (stderr, "file %s is ", argv[1]);26 if (!vstat) fprintf (stderr, "not ");27 fprintf (stderr, "found\n");25 gprint (GP_ERR, "file %s is ", argv[1]); 26 if (!vstat) gprint (GP_ERR, "not "); 27 gprint (GP_ERR, "found\n"); 28 28 29 29 } -
trunk/Ohana/src/opihi/cmd.basic/fprintf.c
r4746 r7917 9 9 10 10 if (argc < 2) { 11 fprintf (stderr, "USAGE: fprintf format value value ...\n");11 gprint (GP_ERR, "USAGE: fprintf format value value ...\n"); 12 12 return (FALSE); 13 13 } … … 24 24 p2 = strchr (p1, '%'); 25 25 if (p2 == (char *) NULL) { 26 fprintf (stderr, "mismatch between format and values\n");26 gprint (GP_ERR, "mismatch between format and values\n"); 27 27 return (FALSE); 28 28 } 29 29 if (strlen(q) + p2 - p1 > NCHAR) { 30 fprintf (stderr, "line too long");30 gprint (GP_ERR, "line too long"); 31 31 return (FALSE); 32 32 } … … 51 51 break; 52 52 default: 53 fprintf (stderr, "syntax error in format (only e,f,s,d,c,x allowed)\n");53 gprint (GP_ERR, "syntax error in format (only e,f,s,d,c,x allowed)\n"); 54 54 return (FALSE); 55 55 } 56 56 if (strlen(q) + strlen(tmp) > NCHAR) { 57 fprintf (stderr, "line too long");57 gprint (GP_ERR, "line too long"); 58 58 return (FALSE); 59 59 } … … 64 64 p2 = strchr (p1, '%'); 65 65 if (p2 != (char *) NULL) { 66 fprintf (stderr, "mismatch between format and values\n");66 gprint (GP_ERR, "mismatch between format and values\n"); 67 67 return (FALSE); 68 68 } … … 70 70 p2 = p1 + strlen (p1); 71 71 if (strlen(q) + p2 - p1 > NCHAR) { 72 fprintf (stderr, "line too long");72 gprint (GP_ERR, "line too long"); 73 73 return (FALSE); 74 74 } 75 75 memcpy (q, p1, p2-p1); 76 fprintf (GetOutfile(), "%s\n", line);76 gprint (GP_LOG, "%s\n", line); 77 77 78 78 return (TRUE); -
trunk/Ohana/src/opihi/cmd.basic/getchr.c
r2598 r7917 8 8 9 9 if ((argc != 3) && (argc != 4)) { 10 fprintf (stderr, "USAGE: strchr (string) (char) [var]\n");10 gprint (GP_ERR, "USAGE: strchr (string) (char) [var]\n"); 11 11 return (FALSE); 12 12 } … … 23 23 set_int_variable (argv[3], pos); 24 24 } else { 25 fprintf (stderr, "%d\n", pos);25 gprint (GP_ERR, "%d\n", pos); 26 26 } 27 27 return (TRUE); -
trunk/Ohana/src/opihi/cmd.basic/help.c
r2598 r7917 8 8 helpdir = get_variable ("HELPDIR"); 9 9 if (helpdir == (char *) NULL) { 10 fprintf (stderr, "variable HELPDIR not found\n");10 gprint (GP_ERR, "variable HELPDIR not found\n"); 11 11 return (FALSE); 12 12 } … … 22 22 f = fopen (file, "r"); 23 23 if (f == NULL) { 24 fprintf (stderr, "No help for: %s\n", argv[1]);24 gprint (GP_ERR, "No help for: %s\n", argv[1]); 25 25 return (FALSE); 26 26 } 27 27 28 28 while (scan_line (f, buff) != EOF) 29 fprintf (stdout, "%s\n", buff);29 gprint (GP_LOG, "%s\n", buff); 30 30 31 31 fclose (f); -
trunk/Ohana/src/opihi/cmd.basic/input.c
r3907 r7917 9 9 10 10 if (argc != 2) { 11 fprintf (stderr, "USAGE: input <filename>\n");11 gprint (GP_ERR, "USAGE: input <filename>\n"); 12 12 return (FALSE); 13 13 } … … 15 15 infile = fopen (argv[1], "r"); 16 16 if (infile == NULL) { 17 fprintf (stderr, "no file %s\n", argv[1]);17 gprint (GP_ERR, "no file %s\n", argv[1]); 18 18 return (FALSE); 19 19 } -
trunk/Ohana/src/opihi/cmd.basic/list.c
r4689 r7917 23 23 if ((argc > 2) && (!strcmp (argv[2], "-split"))) { 24 24 if (argc == 3) { 25 fprintf (stderr, "USAGE: list (root) -split (word) (word) ...\n");25 gprint (GP_ERR, "USAGE: list (root) -split (word) (word) ...\n"); 26 26 return (FALSE); 27 27 } … … 38 38 39 39 if (argc != 2) { 40 fprintf (stderr, "USAGE: list (root) -- terminate with 'END'\n");40 gprint (GP_ERR, "USAGE: list (root) -- terminate with 'END'\n"); 41 41 return (FALSE); 42 42 } … … 56 56 Nread = fread (&val[Nbytes], 1, 1023, f); 57 57 if (Nread < 0) { 58 fprintf (stderr, "error reading from command\n");58 gprint (GP_ERR, "error reading from command\n"); 59 59 done = TRUE; 60 60 } … … 74 74 75 75 if (status) { 76 fprintf (stderr, "warning: exit status of command %d\n", status);76 gprint (GP_ERR, "warning: exit status of command %d\n", status); 77 77 } 78 78 … … 109 109 if (input == (char *) NULL) { 110 110 if (ThisList == 0) { 111 fprintf (stderr, "end list with 'END'\n");111 gprint (GP_ERR, "end list with 'END'\n"); 112 112 continue; 113 113 } else { -
trunk/Ohana/src/opihi/cmd.basic/list_help.c
r2598 r7917 9 9 sprintf (filename, "/tmp/status.XXXXXX"); 10 10 if ((fd = mkstemp (filename)) == -1) { 11 fprintf (stderr, "error opening output\n");11 gprint (GP_ERR, "error opening output\n"); 12 12 return (FALSE); 13 13 } -
trunk/Ohana/src/opihi/cmd.basic/local.c
r2843 r7917 15 15 16 16 if (argc < 2) { 17 fprintf (stderr, "USAGE: local (variable)\n");17 gprint (GP_ERR, "USAGE: local (variable)\n"); 18 18 return (FALSE); 19 19 } -
trunk/Ohana/src/opihi/cmd.basic/macro.c
r4689 r7917 7 7 8 8 if ((argc != 2) && (argc != 3) && (argc != 4)) { 9 fprintf (stderr, "USAGE: macro (cmd)\n");10 fprintf (stderr, " (cmd) can be one of:\n");11 fprintf (stderr, " (name) -- create macro (name)\n");12 fprintf (stderr, " create (name) -- create macro (name)\n");13 fprintf (stderr, " delete (name) -- delete macro (name)\n");14 fprintf (stderr, " list (name) -- list macro (name)\n");15 fprintf (stderr, " edit (name) -- edit macro (name) <not working yet!> *\n");16 fprintf (stderr, " read (name) -- read macro(s) from file (name) <not working yet!> *\n");17 fprintf (stderr, " write (name) -- write macro (name) to a file <not working yet!> *\n");9 gprint (GP_ERR, "USAGE: macro (cmd)\n"); 10 gprint (GP_ERR, " (cmd) can be one of:\n"); 11 gprint (GP_ERR, " (name) -- create macro (name)\n"); 12 gprint (GP_ERR, " create (name) -- create macro (name)\n"); 13 gprint (GP_ERR, " delete (name) -- delete macro (name)\n"); 14 gprint (GP_ERR, " list (name) -- list macro (name)\n"); 15 gprint (GP_ERR, " edit (name) -- edit macro (name) <not working yet!> *\n"); 16 gprint (GP_ERR, " read (name) -- read macro(s) from file (name) <not working yet!> *\n"); 17 gprint (GP_ERR, " write (name) -- write macro (name) to a file <not working yet!> *\n"); 18 18 return (FALSE); 19 19 } -
trunk/Ohana/src/opihi/cmd.basic/memory.c
r4449 r7917 43 43 44 44 usage: 45 fprintf (stderr, "USAGE: memory (all/leaks)\n");45 gprint (GP_ERR, "USAGE: memory (all/leaks)\n"); 46 46 return (FALSE); 47 47 } -
trunk/Ohana/src/opihi/cmd.basic/output.c
r2598 r7917 5 5 int output (int argc, char **argv) { 6 6 7 int N; 8 gpDest dest; 9 IOBuffer *buffer; 10 11 dest = GP_LOG; 12 if ((N = get_argument (argc, argv, "-err"))) { 13 dest = GP_ERR; 14 remove_argument (N, &argc, argv); 15 } 16 17 if ((N = get_argument (argc, argv, "-buffer"))) { 18 remove_argument (N, &argc, argv); 19 gprintSetBuffer (dest); 20 return (TRUE); 21 } 22 23 if ((N = get_argument (argc, argv, "-dump"))) { 24 remove_argument (N, &argc, argv); 25 buffer = gprintGetBuffer (dest); 26 fprintf (STDERR, "buffer contents: \n"); 27 fwrite (buffer[0].buffer, 1, buffer[0].Nbuffer, stderr); 28 fprintf (STDERR, "\n"); 29 return (TRUE); 30 } 31 7 32 if (argc != 2) { 8 fprintf (stderr, "USAGE: output <filename>\n");33 gprint (GP_ERR, "USAGE: output <filename>\n"); 9 34 return (FALSE); 10 35 } 11 36 12 fflush (outfile); 13 if (outfile != stdout) fclose (outfile); 14 15 /* we only use stdout, but let stderr be a synonym */ 16 outfile = stdout; 17 if (strcmp (argv[1], "stdout") && strcmp (argv[1], "stderr")) { 18 outfile = fopen (argv[1], "a"); 19 } 20 21 if (outfile == NULL) { 22 fprintf (stderr, "cannot open file %s\n", argv[1]); 23 outfile = stdout; 24 } 37 gprintSetFile (dest, argv[1]); 25 38 return (TRUE); 26 39 } … … 33 46 outfile = stdout; 34 47 } 48 49 /* we could add the concept of saving the output to a buffer 50 then dumping to the target of the output stream. not sure 51 what the command should look like... */ -
trunk/Ohana/src/opihi/cmd.basic/run_for.c
r3907 r7917 12 12 13 13 if ((argc != 4) && (argc != 5)) { 14 fprintf (stderr, "USAGE: for (var) (start) (stop) [delta] -- terminate with 'END'\n");14 gprint (GP_ERR, "USAGE: for (var) (start) (stop) [delta] -- terminate with 'END'\n"); 15 15 return (FALSE); 16 16 } … … 40 40 if (input == (char *) NULL) { 41 41 if (ThisList == 0) { 42 fprintf (stderr, "end loop with 'END'\n");42 gprint (GP_ERR, "end loop with 'END'\n"); 43 43 continue; 44 44 } else { 45 fprintf (stderr, "misbalanced loop\n");45 gprint (GP_ERR, "misbalanced loop\n"); 46 46 for (j = 0; j < loop.Nlines; j++) { 47 47 free (loop.line[j]); -
trunk/Ohana/src/opihi/cmd.basic/run_if.c
r4689 r7917 12 12 13 13 if ((argc != 2) && (argc != 3)) { 14 fprintf (stderr, "USAGE: if (conditional) [break], end with the word 'END'\n");14 gprint (GP_ERR, "USAGE: if (conditional) [break], end with the word 'END'\n"); 15 15 return (FALSE); 16 16 } 17 17 if ((argc == 3) && strcmp (argv[2], "break")) { 18 fprintf (stderr, "USAGE: if (conditional) [break], end with the word 'END'\n");18 gprint (GP_ERR, "USAGE: if (conditional) [break], end with the word 'END'\n"); 19 19 return (FALSE); 20 20 } … … 55 55 56 56 if ((ThisList == 0) && (input == (char *) NULL)) { 57 fprintf (stderr, "end if-block with 'END'\n");57 gprint (GP_ERR, "end if-block with 'END'\n"); 58 58 continue; 59 59 } 60 60 if ((ThisList > 0) && (input == (char *) NULL)) { 61 fprintf (stderr, "missing 'END' in if-block\n");61 gprint (GP_ERR, "missing 'END' in if-block\n"); 62 62 input = strcreate ("end"); 63 63 } -
trunk/Ohana/src/opihi/cmd.basic/run_while.c
r3922 r7917 11 11 12 12 if (argc != 2) { 13 fprintf (stderr, "USAGE: while (condition)\n");13 gprint (GP_ERR, "USAGE: while (condition)\n"); 14 14 return (FALSE); 15 15 } … … 38 38 if (input == (char *) NULL) { 39 39 if (ThisList == 0) { 40 fprintf (stderr, "end 'while' loop with 'END'\n");40 gprint (GP_ERR, "end 'while' loop with 'END'\n"); 41 41 continue; 42 42 } else { 43 fprintf (stderr, "misbalanced 'while' loop\n");43 gprint (GP_ERR, "misbalanced 'while' loop\n"); 44 44 for (j = 0; j < loop.Nlines; j++) { 45 45 free (loop.line[j]); -
trunk/Ohana/src/opihi/cmd.basic/scan.c
r2598 r7917 8 8 9 9 if ((argc != 3) && (argc != 4)) { 10 fprintf (stderr, "USAGE: scan <filename> <var> [N]\n");10 gprint (GP_ERR, "USAGE: scan <filename> <var> [N]\n"); 11 11 return (FALSE); 12 12 } … … 16 16 f = fopen (argv[1], "r"); 17 17 if (f == (FILE *) NULL) { 18 fprintf (stderr, "file %s not found\n", argv[1]);18 gprint (GP_ERR, "file %s not found\n", argv[1]); 19 19 return (FALSE); 20 20 } -
trunk/Ohana/src/opihi/cmd.basic/sleep.c
r2598 r7917 6 6 7 7 if (argc < 2) { 8 fprintf (stderr, "usage: sleep N\n");8 gprint (GP_ERR, "usage: sleep N\n"); 9 9 return (FALSE); 10 10 } -
trunk/Ohana/src/opihi/cmd.basic/sprintf.c
r2843 r7917 11 11 12 12 if (argc < 3) { 13 fprintf (stderr, "USAGE: sprintf var format value value ...\n");13 gprint (GP_ERR, "USAGE: sprintf var format value value ...\n"); 14 14 return (FALSE); 15 15 } … … 26 26 p2 = strchr (p1, '%'); 27 27 if (p2 == (char *) NULL) { 28 fprintf (stderr, "mismatch between format and values\n");28 gprint (GP_ERR, "mismatch between format and values\n"); 29 29 return (FALSE); 30 30 } 31 31 if (strlen(q) + p2 - p1 > NCHAR) { 32 fprintf (stderr, "line too long");32 gprint (GP_ERR, "line too long"); 33 33 return (FALSE); 34 34 } … … 53 53 break; 54 54 default: 55 fprintf (stderr, "syntax error in format (only e,f,s,d,c,x allowed)\n");55 gprint (GP_ERR, "syntax error in format (only e,f,s,d,c,x allowed)\n"); 56 56 return (FALSE); 57 57 } 58 58 if (strlen(q) + strlen(tmp) > NCHAR) { 59 fprintf (stderr, "line too long");59 gprint (GP_ERR, "line too long"); 60 60 return (FALSE); 61 61 } … … 66 66 p2 = strchr (p1, '%'); 67 67 if (p2 != (char *) NULL) { 68 fprintf (stderr, "mismatch between format and values\n");68 gprint (GP_ERR, "mismatch between format and values\n"); 69 69 return (FALSE); 70 70 } … … 72 72 p2 = p1 + strlen (p1); 73 73 if (strlen(q) + p2 - p1 > NCHAR) { 74 fprintf (stderr, "line too long");74 gprint (GP_ERR, "line too long"); 75 75 return (FALSE); 76 76 } -
trunk/Ohana/src/opihi/cmd.basic/strchr.c
r2598 r7917 8 8 9 9 if ((argc != 3) && (argc != 4)) { 10 fprintf (stderr, "USAGE: strchr (string) (char) [var]\n");10 gprint (GP_ERR, "USAGE: strchr (string) (char) [var]\n"); 11 11 return (FALSE); 12 12 } … … 23 23 set_variable (argv[3], pos); 24 24 } else { 25 fprintf (stderr, "%d\n", pos);25 gprint (GP_ERR, "%d\n", pos); 26 26 } 27 27 return (TRUE); -
trunk/Ohana/src/opihi/cmd.basic/strlen.c
r2598 r7917 7 7 8 8 if ((argc != 2) && (argc != 3)) { 9 fprintf (stderr, "USAGE: strchr (string) [var]\n");9 gprint (GP_ERR, "USAGE: strchr (string) [var]\n"); 10 10 return (FALSE); 11 11 } … … 16 16 set_int_variable (argv[2], len); 17 17 } else { 18 fprintf (stderr, "%d\n", len);18 gprint (GP_ERR, "%d\n", len); 19 19 } 20 20 return (TRUE); -
trunk/Ohana/src/opihi/cmd.basic/substr.c
r2598 r7917 7 7 8 8 if ((argc != 4) && (argc != 5)) { 9 fprintf (stderr, "USAGE: substr (string) N1 N2 [var]\n");9 gprint (GP_ERR, "USAGE: substr (string) N1 N2 [var]\n"); 10 10 return (FALSE); 11 11 } … … 30 30 set_str_variable (argv[4], string); 31 31 } else { 32 fprintf (stderr, "%s\n", string);32 gprint (GP_ERR, "%s\n", string); 33 33 } 34 34 free (string); -
trunk/Ohana/src/opihi/cmd.basic/usleep.c
r2598 r7917 6 6 7 7 if (argc < 2) { 8 fprintf (stderr, "usage: usleep N\n");8 gprint (GP_ERR, "usage: usleep N\n"); 9 9 return (FALSE); 10 10 } -
trunk/Ohana/src/opihi/cmd.basic/wait.c
r4689 r7917 7 7 8 8 for (i = 1; i < argc; i++) { 9 fprintf (stderr, "%s ", argv[i]);9 gprint (GP_ERR, "%s ", argv[i]); 10 10 } 11 fprintf (stderr, "\n");11 gprint (GP_ERR, "\n"); 12 12 scan_line (stdin, buff); 13 13 return (TRUE); -
trunk/Ohana/src/opihi/cmd.basic/which.c
r2598 r7917 6 6 7 7 if (argc != 2) { 8 fprintf (stderr, "USAGE: which <filename>\n");8 gprint (GP_ERR, "USAGE: which <filename>\n"); 9 9 return (FALSE); 10 10 } … … 13 13 if (cmd == NULL) return (FALSE); 14 14 15 fprintf (stderr, "%-25s -- %s\n", cmd[0].name, cmd[0].help);15 gprint (GP_ERR, "%-25s -- %s\n", cmd[0].name, cmd[0].help); 16 16 return (TRUE); 17 17 -
trunk/Ohana/src/opihi/cmd.data/accum.c
r4689 r7917 16 16 17 17 if ((argc != 6) && (argc != 7)) { 18 fprintf (stderr, "USAGE: accum <value> <vector> <key> start end [delta]\n");19 fprintf (stderr, " sum <value> in bins corresponding to the value of <key>\n");18 gprint (GP_ERR, "USAGE: accum <value> <vector> <key> start end [delta]\n"); 19 gprint (GP_ERR, " sum <value> in bins corresponding to the value of <key>\n"); 20 20 return (FALSE); 21 21 } … … 24 24 if ((key = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) return (FALSE); 25 25 if (val[0].Nelements != key[0].Nelements) { 26 fprintf (stderr, "key and value don't match\n");26 gprint (GP_ERR, "key and value don't match\n"); 27 27 return (FALSE); 28 28 } … … 36 36 delta = 1; 37 37 if ((start == end) || (delta == 0)) { 38 fprintf (stderr, "error in value: %f to %f, %f\n", start, end, delta);38 gprint (GP_ERR, "error in value: %f to %f, %f\n", start, end, delta); 39 39 return (FALSE); 40 40 } -
trunk/Ohana/src/opihi/cmd.data/applyfit.c
r2598 r7917 12 12 13 13 if (argc != 3) { 14 fprintf (stderr, "USAGE: applyfit x y\n");14 gprint (GP_ERR, "USAGE: applyfit x y\n"); 15 15 return (FALSE); 16 16 } … … 18 18 c = get_variable ("Cn"); 19 19 if (c == (char *) NULL) { 20 fprintf (stderr, "no fit available\n");20 gprint (GP_ERR, "no fit available\n"); 21 21 return (FALSE); 22 22 } … … 31 31 c = get_variable (name); 32 32 if (c == (char *) NULL) { 33 fprintf (stderr, "missing fit term %d\n", i);33 gprint (GP_ERR, "missing fit term %d\n", i); 34 34 return (FALSE); 35 35 } -
trunk/Ohana/src/opihi/cmd.data/applyfit2d.c
r2598 r7917 12 12 13 13 if (argc != 4) { 14 fprintf (stderr, "USAGE: applyfit x y z\n");14 gprint (GP_ERR, "USAGE: applyfit x y z\n"); 15 15 return (FALSE); 16 16 } … … 18 18 c = get_variable ("Cnn"); 19 19 if (c == (char *) NULL) { 20 fprintf (stderr, "no fit available\n");20 gprint (GP_ERR, "no fit available\n"); 21 21 return (FALSE); 22 22 } … … 34 34 c = get_variable (name); 35 35 if (c == (char *) NULL) { 36 fprintf (stderr, "missing fit term %d,%d\n", i, j);36 gprint (GP_ERR, "missing fit term %d,%d\n", i, j); 37 37 return (FALSE); 38 38 } -
trunk/Ohana/src/opihi/cmd.data/box.c
r6684 r7917 53 53 54 54 usage: 55 fprintf (stderr, "USAGE: box [-ticks NNNN] [-axis NNNN] [-labels NNNN]\n");55 gprint (GP_ERR, "USAGE: box [-ticks NNNN] [-axis NNNN] [-labels NNNN]\n"); 56 56 return (FALSE); 57 57 } -
trunk/Ohana/src/opihi/cmd.data/center.c
r5846 r7917 16 16 17 17 if ((argc != 3) && (argc != 4)) { 18 fprintf (stderr, "USAGE: center x y [zoom]\n");18 gprint (GP_ERR, "USAGE: center x y [zoom]\n"); 19 19 return (FALSE); 20 20 } -
trunk/Ohana/src/opihi/cmd.data/clear.c
r5850 r7917 21 21 22 22 if (argc != 1) { 23 fprintf (stderr, "USAGE: clear [-n Xgraph]\n");23 gprint (GP_ERR, "USAGE: clear [-n Xgraph]\n"); 24 24 return (FALSE); 25 25 } -
trunk/Ohana/src/opihi/cmd.data/clip.c
r4689 r7917 27 27 28 28 if ((argc != 6) && (!(DO_INF || DO_NAN))) { 29 fprintf (stderr, "USAGE: clip (buffer) [min Vmin max Vmax] [-inf val] [-nan val]\n");29 gprint (GP_ERR, "USAGE: clip (buffer) [min Vmin max Vmax] [-inf val] [-nan val]\n"); 30 30 return (FALSE); 31 31 } -
trunk/Ohana/src/opihi/cmd.data/concat.c
r2598 r7917 10 10 /** check basic syntax **/ 11 11 if (argc != 3) { 12 fprintf (stderr, "SYNTAX: concat (vector/value) vector\n");13 fprintf (stderr, " concatanate (vector/value) to vector\n");12 gprint (GP_ERR, "SYNTAX: concat (vector/value) vector\n"); 13 gprint (GP_ERR, " concatanate (vector/value) to vector\n"); 14 14 return (FALSE); 15 15 } -
trunk/Ohana/src/opihi/cmd.data/contour.c
r2598 r7917 71 71 72 72 if (argc != 5) { 73 fprintf (stderr, "USAGE: contour <buffer> X Y level\n");73 gprint (GP_ERR, "USAGE: contour <buffer> X Y level\n"); 74 74 return (FALSE); 75 75 } … … 97 97 98 98 for (j = 1; j < Ny; j++) { 99 if (!(j%10)) fprintf (stderr, ".");99 if (!(j%10)) gprint (GP_ERR, "."); 100 100 for (i = 1; i < Nx; i++, v00++, v01++, v10++, v11++) { 101 101 -
trunk/Ohana/src/opihi/cmd.data/create.c
r7080 r7917 15 15 16 16 if ((argc != 5) && (argc != 4)) { 17 fprintf (stderr, "USAGE: create vector start end [delta]\n");17 gprint (GP_ERR, "USAGE: create vector start end [delta]\n"); 18 18 return (FALSE); 19 19 } … … 26 26 if (argc == 5) delta = atof (argv[4]); 27 27 if ((start == end) || (delta == 0)) { 28 fprintf (stderr, "error in value: %f to %f, %f\n", start, end, delta);28 gprint (GP_ERR, "error in value: %f to %f, %f\n", start, end, delta); 29 29 return (FALSE); 30 30 } … … 50 50 51 51 if (argc != 4) { 52 fprintf (stderr, "USAGE: create -image buffer Nx Ny\n");52 gprint (GP_ERR, "USAGE: create -image buffer Nx Ny\n"); 53 53 return (FALSE); 54 54 } -
trunk/Ohana/src/opihi/cmd.data/cursor.c
r7080 r7917 35 35 36 36 if ((argc != 1) && (argc != 2)) { 37 fprintf (stderr, "USAGE: cursor [Npts] [-n window] [-g | -i]\n");37 gprint (GP_ERR, "USAGE: cursor [Npts] [-n window] [-g | -i]\n"); 38 38 return (FALSE); 39 39 } … … 60 60 Z = gfits_get_matrix_value (&buf[0].matrix, (int) X, (int) Y); 61 61 } 62 fprintf (GetOutfile(), "%s %f %f %f\n", key, X, Y, Z);62 gprint (GP_LOG, "%s %f %f %f\n", key, X, Y, Z); 63 63 } else { 64 64 XY_to_RD (&R, &D, X, Y, &graphmode.coords); … … 67 67 sprintf (string, "D%s", key); 68 68 set_variable (string, D); 69 fprintf (GetOutfile(), "%s %f %f\n", key, X, Y);69 gprint (GP_LOG, "%s %f %f\n", key, X, Y); 70 70 } 71 71 if (!strcasecmp (key, "Q")) break; -
trunk/Ohana/src/opihi/cmd.data/cut.c
r2843 r7917 22 22 23 23 if (argc != 9) { 24 fprintf (stderr, "USAGE: cut <buffer> <X vector> <Y vector> <X|Y> sx sy nx ny\n");24 gprint (GP_ERR, "USAGE: cut <buffer> <X vector> <Y vector> <X|Y> sx sy nx ny\n"); 25 25 return (FALSE); 26 26 } … … 37 37 38 38 if ((sx < 0) || (sy < 0) || (sx+nx > Nx) || (sy+ny > Ny)) { 39 fprintf (stderr, "region out of range\n");39 gprint (GP_ERR, "region out of range\n"); 40 40 return (FALSE); 41 41 } … … 111 111 112 112 default: 113 fprintf (stderr, "<dir> can be X or Y\n");113 gprint (GP_ERR, "<dir> can be X or Y\n"); 114 114 return (FALSE); 115 115 break; -
trunk/Ohana/src/opihi/cmd.data/delete.c
r3900 r7917 16 16 17 17 if (argc < 2) { 18 fprintf (stderr, "USAGE: delete <obiect> [<object> ..]\n");18 gprint (GP_ERR, "USAGE: delete <obiect> [<object> ..]\n"); 19 19 return (FALSE); 20 20 } … … 24 24 if (DeleteNamedVector (argv[i])) continue; 25 25 if (DeleteNamedScalar (argv[i])) continue; 26 if (!Quiet) fprintf (stderr, "can't find object %s\n", argv[i]);26 if (!Quiet) gprint (GP_ERR, "can't find object %s\n", argv[i]); 27 27 } 28 28 -
trunk/Ohana/src/opihi/cmd.data/device.c
r2843 r7917 24 24 if (IsImage) { 25 25 if (!GetImage (&Source, &Nsource)) return (FALSE); 26 fprintf (stderr, "kii %d\n", Nsource);26 gprint (GP_ERR, "kii %d\n", Nsource); 27 27 } else { 28 28 if (!GetGraph (NULL, &Source, &Nsource)) return (FALSE); 29 fprintf (stderr, "kapa %d\n", Nsource);29 gprint (GP_ERR, "kapa %d\n", Nsource); 30 30 } 31 31 -
trunk/Ohana/src/opihi/cmd.data/dimendown.c
r6678 r7917 58 58 59 59 usage: 60 fprintf (stderr, "USAGE: dimendown <buffer> <vector>\n");61 fprintf (stderr, " -x : fill vector with buffer x-coords\n");62 fprintf (stderr, " -y : fill vector with buffer y-coords\n");60 gprint (GP_ERR, "USAGE: dimendown <buffer> <vector>\n"); 61 gprint (GP_ERR, " -x : fill vector with buffer x-coords\n"); 62 gprint (GP_ERR, " -y : fill vector with buffer y-coords\n"); 63 63 return (FALSE); 64 64 } -
trunk/Ohana/src/opihi/cmd.data/dimenup.c
r7080 r7917 9 9 10 10 if (argc != 5) { 11 fprintf (stderr, "USAGE: dimenup <vector> <buffer> Nx Ny\n");11 gprint (GP_ERR, "USAGE: dimenup <vector> <buffer> Nx Ny\n"); 12 12 return (FALSE); 13 13 } … … 20 20 Ny = atof (argv[4]); 21 21 if (Npix != Nx * Ny) { 22 fprintf (stderr, "dimensions don't match\n");22 gprint (GP_ERR, "dimensions don't match\n"); 23 23 return (FALSE); 24 24 } -
trunk/Ohana/src/opihi/cmd.data/dot.c
r7080 r7917 9 9 10 10 if (argc != 3) { 11 fprintf (stderr, "USAGE: plot <x> <y>\n");11 gprint (GP_ERR, "USAGE: plot <x> <y>\n"); 12 12 return (FALSE); 13 13 } -
trunk/Ohana/src/opihi/cmd.data/erase.c
r5846 r7917 15 15 16 16 if (argc < 2) { 17 fprintf (stderr, "USAGE: erase (overlay) [overlay, overlay, ..] \n");18 fprintf (stderr, " (overlay) may be: red (0), green (1), blue (2), yellow (3) or all\n");17 gprint (GP_ERR, "USAGE: erase (overlay) [overlay, overlay, ..] \n"); 18 gprint (GP_ERR, " (overlay) may be: red (0), green (1), blue (2), yellow (3) or all\n"); 19 19 return (FALSE); 20 20 } … … 29 29 } 30 30 if (!KiiSelectOverlay (argv[i], &N)) { 31 fprintf (stderr, "%s is not a valid overlay\n", argv[i]);31 gprint (GP_ERR, "%s is not a valid overlay\n", argv[i]); 32 32 return (FALSE); 33 33 } -
trunk/Ohana/src/opihi/cmd.data/extract.c
r7080 r7917 10 10 11 11 if (argc != 11) { 12 fprintf (stderr, "USAGE: extract <from> <to> sx sy nx ny Sx Sy Nx Ny\n");12 gprint (GP_ERR, "USAGE: extract <from> <to> sx sy nx ny Sx Sy Nx Ny\n"); 13 13 return (FALSE); 14 14 } … … 29 29 30 30 if ((Sy + ny > Ny) || (Sx + nx > Nx)) { 31 fprintf (stderr, "mismatch between source and dest regions\n");32 fprintf (stderr, "%d + %d > %d or %d + %d > %d\n", Sy, ny, Ny, Sx, nx, Nx);31 gprint (GP_ERR, "mismatch between source and dest regions\n"); 32 gprint (GP_ERR, "%d + %d > %d or %d + %d > %d\n", Sy, ny, Ny, Sx, nx, Nx); 33 33 return (FALSE); 34 34 } … … 38 38 (sx > in[0].matrix.Naxis[0]) || 39 39 (sy > in[0].matrix.Naxis[1])) { 40 fprintf (stderr, "region outside of source image\n");40 gprint (GP_ERR, "region outside of source image\n"); 41 41 return (FALSE); 42 42 } 43 43 44 44 if ((Sx + nx > Nx) || (Sy + ny > Ny)) { 45 fprintf (stderr, "source region larger than dest region\n");45 gprint (GP_ERR, "source region larger than dest region\n"); 46 46 return (FALSE); 47 47 } 48 48 if ((Sx < 0) || (Sy < 0)) { 49 fprintf (stderr, "dest region out of range\n");49 gprint (GP_ERR, "dest region out of range\n"); 50 50 return (FALSE); 51 51 } … … 68 68 } else { 69 69 if ((out[0].header.Naxis[1] != Ny) || (out[0].header.Naxis[0] != Nx)) { 70 fprintf (stderr, "matrix sizes mis-matched\n");71 fprintf (stderr, "%d x %d vs %d x %d\n", Nx, Ny,70 gprint (GP_ERR, "matrix sizes mis-matched\n"); 71 gprint (GP_ERR, "%d x %d vs %d x %d\n", Nx, Ny, 72 72 out[0].header.Naxis[0], out[0].header.Naxis[1]); 73 73 return (FALSE); -
trunk/Ohana/src/opihi/cmd.data/fft1d.c
r4689 r7917 8 8 9 9 if ((argc != 6) || (strcmp (argv[3], "to"))) { 10 fprintf (stderr, "USAGE: fft1d (real) (imag) to (real) (imag)\n");10 gprint (GP_ERR, "USAGE: fft1d (real) (imag) to (real) (imag)\n"); 11 11 return (FALSE); 12 12 } … … 24 24 Npix = Ire[0].Nelements; 25 25 if (!ZeroImaginary && (Npix != Iim[0].Nelements)) { 26 fprintf (stderr, "vector mismatch in size\n");26 gprint (GP_ERR, "vector mismatch in size\n"); 27 27 return (FALSE); 28 28 } 29 29 30 30 if (!IsBinary (Npix)) { 31 fprintf (stderr, "Npix is not a binary number!\n");31 gprint (GP_ERR, "Npix is not a binary number!\n"); 32 32 return (FALSE); 33 33 } -
trunk/Ohana/src/opihi/cmd.data/fft2d.c
r7080 r7917 15 15 16 16 if ((argc != 6) || (strcmp (argv[3], "to"))) { 17 fprintf (stderr, "USAGE: fft2d (real) (imag) to (real) (imag)\n");17 gprint (GP_ERR, "USAGE: fft2d (real) (imag) to (real) (imag)\n"); 18 18 return (FALSE); 19 19 } … … 43 43 Naxis[0] = Ny; Naxis[1] = Nx; 44 44 if (!IsBinary (Npix)) { 45 fprintf (stderr, "dimensions are not binary!\n");45 gprint (GP_ERR, "dimensions are not binary!\n"); 46 46 return (FALSE); 47 47 } -
trunk/Ohana/src/opihi/cmd.data/fit.c
r4689 r7917 42 42 43 43 if (argc != 4) { 44 fprintf (stderr, "USAGE: fit x y order [-dy wt] [-quiet/-q] [-clip Nsigma Niter]\n");44 gprint (GP_ERR, "USAGE: fit x y order [-dy wt] [-quiet/-q] [-clip Nsigma Niter]\n"); 45 45 return (FALSE); 46 46 } … … 50 50 51 51 if (xvec[0].Nelements != yvec[0].Nelements) { 52 fprintf (stderr, "vectors must have same length\n");52 gprint (GP_ERR, "vectors must have same length\n"); 53 53 return (FALSE); 54 54 } 55 55 if (Weight && xvec[0].Nelements != dyvec[0].Nelements) { 56 fprintf (stderr, "vectors must have same length\n");56 gprint (GP_ERR, "vectors must have same length\n"); 57 57 return (FALSE); 58 58 } … … 166 166 167 167 /* print & save basic fit parameters */ 168 if (!Quiet) fprintf (stderr, "y = ");168 if (!Quiet) gprint (GP_ERR, "y = "); 169 169 for (i = 0; i < nterm; i++) { 170 170 sprintf (name, "C%d", i); 171 171 set_variable (name, b[i][0]); 172 if (!Quiet) fprintf (stderr, "%f x^%d ", b[i][0], i);172 if (!Quiet) gprint (GP_ERR, "%f x^%d ", b[i][0], i); 173 173 } 174 174 sprintf (name, "Cn"); … … 176 176 177 177 /* print & save basic fit parameters */ 178 if (!Quiet) fprintf (stderr, "\n");179 if (!Quiet) fprintf (stderr, " ");178 if (!Quiet) gprint (GP_ERR, "\n"); 179 if (!Quiet) gprint (GP_ERR, " "); 180 180 for (i = 0; i < nterm; i++) { 181 181 sprintf (name, "dC%d", i); 182 182 set_variable (name, sqrt(c[i][i])); 183 if (!Quiet) fprintf (stderr, "%f ", sqrt(c[i][i]));184 } 185 if (!Quiet) fprintf (stderr, "\n");183 if (!Quiet) gprint (GP_ERR, "%f ", sqrt(c[i][i])); 184 } 185 if (!Quiet) gprint (GP_ERR, "\n"); 186 186 187 187 set_variable ("dC", sigma); -
trunk/Ohana/src/opihi/cmd.data/fit2d.c
r5850 r7917 48 48 49 49 if (argc != 5) { 50 fprintf (stderr, "USAGE: fit x y z order [-dz wt]\n");50 gprint (GP_ERR, "USAGE: fit x y z order [-dz wt]\n"); 51 51 return (FALSE); 52 52 } … … 57 57 58 58 if (xvec[0].Nelements != yvec[0].Nelements) { 59 fprintf (stderr, "vectors must have same length\n");59 gprint (GP_ERR, "vectors must have same length\n"); 60 60 return (FALSE); 61 61 } 62 62 if (xvec[0].Nelements != zvec[0].Nelements) { 63 fprintf (stderr, "vectors must have same length\n");63 gprint (GP_ERR, "vectors must have same length\n"); 64 64 return (FALSE); 65 65 } 66 66 if (Weight && xvec[0].Nelements != dzvec[0].Nelements) { 67 fprintf (stderr, "vectors must have same length\n");67 gprint (GP_ERR, "vectors must have same length\n"); 68 68 return (FALSE); 69 69 } … … 160 160 } 161 161 162 fprintf (stderr, "matrix:\n");162 gprint (GP_ERR, "matrix:\n"); 163 163 for (k = 0; k < wterm; k++) { 164 164 for (K = 0; K < wterm; K++) { 165 fprintf (stderr, "%f ", c[k][K]);166 } 167 fprintf (stderr, "\n");165 gprint (GP_ERR, "%f ", c[k][K]); 166 } 167 gprint (GP_ERR, "\n"); 168 168 } 169 169 170 170 gaussj (c, wterm, b, 1); 171 171 172 fprintf (stderr, "inverse:\n");172 gprint (GP_ERR, "inverse:\n"); 173 173 for (k = 0; k < wterm; k++) { 174 174 for (K = 0; K < wterm; K++) { 175 fprintf (stderr, "%f ", c[k][K]);176 } 177 fprintf (stderr, "\n");175 gprint (GP_ERR, "%f ", c[k][K]); 176 } 177 gprint (GP_ERR, "\n"); 178 178 } 179 179 … … 182 182 for (i = ny = 0; ny < nterm; ny++) { 183 183 for (nx = 0; nx < nterm - ny; nx++, i++) { 184 fprintf (stderr, "x^%d y^%d: %g\n", nx, ny, b[i][0]);184 gprint (GP_ERR, "x^%d y^%d: %g\n", nx, ny, b[i][0]); 185 185 } 186 186 } … … 228 228 maxsigma = ClipNSigma * sigma; 229 229 230 if (VERBOSE) fprintf (stderr, "mean: %g, sigma: %g, maxsigma: %g\n", mean, sigma, maxsigma);230 if (VERBOSE) gprint (GP_ERR, "mean: %g, sigma: %g, maxsigma: %g\n", mean, sigma, maxsigma); 231 231 232 232 /* mask outlier points */ … … 245 245 } 246 246 } 247 if (VERBOSE) fprintf (stderr, "pass: %d, Nmask: %d\n", N, Nmask);248 } 249 250 if (!Quiet) fprintf (stderr, "z = ");247 if (VERBOSE) gprint (GP_ERR, "pass: %d, Nmask: %d\n", N, Nmask); 248 } 249 250 if (!Quiet) gprint (GP_ERR, "z = "); 251 251 for (N = ny = 0; ny < nterm; ny++) { 252 252 for (nx = 0; nx < nterm - ny; nx++, N++) { 253 253 sprintf (name, "CX%dY%d", nx, ny); 254 254 set_variable (name, b[N][0]); 255 if (!Quiet) fprintf (stderr, "%f x^%d y^%d ", b[N][0], nx, ny);255 if (!Quiet) gprint (GP_ERR, "%f x^%d y^%d ", b[N][0], nx, ny); 256 256 } 257 257 } … … 259 259 set_variable (name, (double) order); 260 260 261 if (!Quiet) fprintf (stderr, "\n");261 if (!Quiet) gprint (GP_ERR, "\n"); 262 262 263 263 /* free internal data */ -
trunk/Ohana/src/opihi/cmd.data/gaussdeviate.c
r3894 r7917 25 25 26 26 usage: 27 fprintf (stderr, "USAGE: gaussdeviate (vector) Npts mean sigma\n");27 gprint (GP_ERR, "USAGE: gaussdeviate (vector) Npts mean sigma\n"); 28 28 return (FALSE); 29 29 … … 56 56 57 57 usage: 58 fprintf (stderr, "USAGE: gaussintegral Npts mean sigma\n");58 gprint (GP_ERR, "USAGE: gaussintegral Npts mean sigma\n"); 59 59 return (FALSE); 60 60 -
trunk/Ohana/src/opihi/cmd.data/gaussj.c
r2598 r7917 51 51 52 52 usage: 53 fprintf (stderr, "USAGE: gaussj A B\n");54 fprintf (stderr, " solves Ax = B, returns 1/A in A and x in B\n");55 fprintf (stderr, " A must be square, B same dimensions\n");53 gprint (GP_ERR, "USAGE: gaussj A B\n"); 54 gprint (GP_ERR, " solves Ax = B, returns 1/A in A and x in B\n"); 55 gprint (GP_ERR, " A must be square, B same dimensions\n"); 56 56 return (FALSE); 57 57 -
trunk/Ohana/src/opihi/cmd.data/grid.c
r2843 r7917 25 25 26 26 if (argc > 1) { 27 fprintf (stderr, "USAGE: grid [-n graph]\n");27 gprint (GP_ERR, "USAGE: grid [-n graph]\n"); 28 28 return (FALSE); 29 29 } -
trunk/Ohana/src/opihi/cmd.data/gridify.c
r7080 r7917 17 17 18 18 if (argc != 11) { 19 fprintf (stderr, "USAGE: gridify x y z buffer Xmin Xmax dX Ymin Ymax dY\n");19 gprint (GP_ERR, "USAGE: gridify x y z buffer Xmin Xmax dX Ymin Ymax dY\n"); 20 20 return (FALSE); 21 21 } -
trunk/Ohana/src/opihi/cmd.data/histogram.c
r2598 r7917 8 8 9 9 if ((argc != 6) && (argc != 5)) { 10 fprintf (stderr, "USAGE: hist invec outvec start end [delta]\n");10 gprint (GP_ERR, "USAGE: hist invec outvec start end [delta]\n"); 11 11 return (FALSE); 12 12 } … … 18 18 19 19 if ((start == end) || (delta == 0)) { 20 fprintf (stderr, "error in value: %f to %f, %f\n", start, end, delta);20 gprint (GP_ERR, "error in value: %f to %f, %f\n", start, end, delta); 21 21 return (FALSE); 22 22 } -
trunk/Ohana/src/opihi/cmd.data/imcut.c
r2843 r7917 10 10 11 11 if (argc != 8) { 12 fprintf (stderr, "USAGE: cut <buffer> <X vector> <Y vector> xs ys xe ye\n");12 gprint (GP_ERR, "USAGE: cut <buffer> <X vector> <Y vector> xs ys xe ye\n"); 13 13 return (FALSE); 14 14 } … … 53 53 54 54 usage: 55 fprintf (stderr, "USAGE: circstats <buffer> x y radius\n");55 gprint (GP_ERR, "USAGE: circstats <buffer> x y radius\n"); 56 56 return (FALSE); 57 57 58 58 range: 59 fprintf (stderr, "ERROR: coordinates out of range\n");59 gprint (GP_ERR, "ERROR: coordinates out of range\n"); 60 60 return (FALSE); 61 61 62 62 missed: 63 fprintf (stderr, "ERROR: buffer not found\n");63 gprint (GP_ERR, "ERROR: buffer not found\n"); 64 64 return (FALSE); 65 65 } -
trunk/Ohana/src/opihi/cmd.data/imhist.c
r4399 r7917 34 34 35 35 if (argc != 4) { 36 fprintf (stderr, "USAGE: histogram <buffer> <x> <y> [-region sx sy nx ny] [-range min max]\n");36 gprint (GP_ERR, "USAGE: histogram <buffer> <x> <y> [-region sx sy nx ny] [-range min max]\n"); 37 37 return (FALSE); 38 38 } … … 49 49 (sx+nx > buf[0].matrix.Naxis[0]) || 50 50 (sy+ny > buf[0].matrix.Naxis[1])) { 51 fprintf (stderr, "region out of range\n");51 gprint (GP_ERR, "region out of range\n"); 52 52 return (FALSE); 53 53 } … … 63 63 if ((max == 0) && (min == 0)) { 64 64 max = min = *((float *)(buf[0].matrix.buffer) + sy*buf[0].matrix.Naxis[0] + sx); 65 fprintf (stderr, "sx: %d, sy: %d, first: %f\n", sx, sy, max);65 gprint (GP_ERR, "sx: %d, sy: %d, first: %f\n", sx, sy, max); 66 66 for (j = sy; j < sy + ny; j++) { 67 67 V = (float *)(buf[0].matrix.buffer) + j*buf[0].matrix.Naxis[0] + sx; … … 73 73 } 74 74 dx = (max - min) / 1024.0; 75 fprintf (stderr, "max %f, min %f, dx %f\n", max, min, dx);75 gprint (GP_ERR, "max %f, min %f, dx %f\n", max, min, dx); 76 76 77 77 vec1[0].Nelements = 1025; -
trunk/Ohana/src/opihi/cmd.data/imsmooth.c
r2938 r7917 17 17 18 18 if (argc != 3) { 19 fprintf (stderr, "USAGE: imsmooth (input) sigma\n");19 gprint (GP_ERR, "USAGE: imsmooth (input) sigma\n"); 20 20 return (FALSE); 21 21 } -
trunk/Ohana/src/opihi/cmd.data/integrate.c
r2843 r7917 15 15 16 16 if (argc != 5) { 17 fprintf (stderr, "USAGE: integrate <x> <y> start end\n");17 gprint (GP_ERR, "USAGE: integrate <x> <y> start end\n"); 18 18 return (FALSE); 19 19 } … … 39 39 set_variable ("sum", value); 40 40 set_variable ("range", range); 41 if (VERBOSE) fprintf (GetOutfile(), "sum: %f\n", value);41 if (VERBOSE) gprint (GP_LOG, "sum: %f\n", value); 42 42 return (TRUE); 43 43 } -
trunk/Ohana/src/opihi/cmd.data/interpolate.c
r5850 r7917 9 9 /** check basic syntax **/ 10 10 if (argc != 5) { 11 fprintf (stderr, "USAGE: interpolate Xi Yi Xo Yo\n");12 fprintf (stderr, " Xi Yi - sorted reference vectors\n");13 fprintf (stderr, " Xo - output positions\n");14 fprintf (stderr, " Yo - output values\n");11 gprint (GP_ERR, "USAGE: interpolate Xi Yi Xo Yo\n"); 12 gprint (GP_ERR, " Xi Yi - sorted reference vectors\n"); 13 gprint (GP_ERR, " Xo - output positions\n"); 14 gprint (GP_ERR, " Yo - output values\n"); 15 15 return (FALSE); 16 16 } -
trunk/Ohana/src/opihi/cmd.data/jpeg.c
r5850 r7917 7 7 8 8 if ((N = get_argument (argc, argv, "--help"))) { 9 fprintf (stderr, "USAGE: jpeg [-name file] [-g | -i] [-n device] [-ppm]\n");9 gprint (GP_ERR, "USAGE: jpeg [-name file] [-g | -i] [-n device] [-ppm]\n"); 10 10 return (FALSE); 11 11 } -
trunk/Ohana/src/opihi/cmd.data/kern.c
r3261 r7917 13 13 14 14 if (argc != 3) { 15 fprintf (stderr, "USAGE: kern buffer (file)\n");16 fprintf (stderr, "USAGE: kern buffer (list)\n");17 fprintf (stderr, "USAGE: kern buffer -\n");18 fprintf (stderr, "kernel file contains a 3x3 matrix for convolution\n");15 gprint (GP_ERR, "USAGE: kern buffer (file)\n"); 16 gprint (GP_ERR, "USAGE: kern buffer (list)\n"); 17 gprint (GP_ERR, "USAGE: kern buffer -\n"); 18 gprint (GP_ERR, "kernel file contains a 3x3 matrix for convolution\n"); 19 19 return (FALSE); 20 20 } … … 27 27 status = scan_line (stdin, line); 28 28 if (status == EOF) { 29 fprintf (stderr, "kernel should be a 3x3 matrix...\n");29 gprint (GP_ERR, "kernel should be a 3x3 matrix...\n"); 30 30 return (FALSE); 31 31 } … … 42 42 f = fopen (argv[2], "r"); 43 43 if (f == NULL) { 44 fprintf (stderr, "file not found: %s\n", argv[2]);44 gprint (GP_ERR, "file not found: %s\n", argv[2]); 45 45 return (FALSE); 46 46 } … … 48 48 status = scan_line (f, line); 49 49 if (status == EOF) { 50 fprintf (stderr, "kernel should be a 3x3 matrix...\n");50 gprint (GP_ERR, "kernel should be a 3x3 matrix...\n"); 51 51 fclose (f); 52 52 } … … 60 60 } 61 61 if (atoi (list) != 9) { 62 fprintf (stderr, "kernel should be a 3x3 matrix...\n");62 gprint (GP_ERR, "kernel should be a 3x3 matrix...\n"); 63 63 return (FALSE); 64 64 } … … 68 68 list = get_variable (line); 69 69 if (list == (char *) NULL) { 70 fprintf (stderr, "kernel should be a 3x3 matrix...\n");70 gprint (GP_ERR, "kernel should be a 3x3 matrix...\n"); 71 71 return (FALSE); 72 72 } … … 77 77 78 78 have_kernel: 79 fprintf (stderr, "working...");79 gprint (GP_ERR, "working..."); 80 80 81 81 /* create output buffer */ … … 90 90 for (n = 0; n < 3; n++) { 91 91 for (m = 0; m < 3; m++) { 92 fprintf (stderr, "%d", n*3 + m + 1);92 gprint (GP_ERR, "%d", n*3 + m + 1); 93 93 val = kernel[n][m]; 94 94 ob = out_buff + NX + 1; … … 99 99 } 100 100 } 101 fprintf (stderr, "(done)\n");101 gprint (GP_ERR, "(done)\n"); 102 102 103 103 free (in_buff); -
trunk/Ohana/src/opihi/cmd.data/keyword.c
r7080 r7917 76 76 77 77 if (!((argc == 3) || (!N && argc == 4))) { 78 fprintf (stderr, "USAGE: keyword <buffer> (KEYWORD) [variable] [-d] [-w(mode) value]\n");79 fprintf (stderr, " -w modes: \n");80 fprintf (stderr, " -w - string\n");81 fprintf (stderr, " -wf - float\n");82 fprintf (stderr, " -wd - int\n");83 fprintf (stderr, " -wb - boolean\n");84 fprintf (stderr, " -wc - comment\n");85 fprintf (stderr, " -ws - full string comment\n");78 gprint (GP_ERR, "USAGE: keyword <buffer> (KEYWORD) [variable] [-d] [-w(mode) value]\n"); 79 gprint (GP_ERR, " -w modes: \n"); 80 gprint (GP_ERR, " -w - string\n"); 81 gprint (GP_ERR, " -wf - float\n"); 82 gprint (GP_ERR, " -wd - int\n"); 83 gprint (GP_ERR, " -wb - boolean\n"); 84 gprint (GP_ERR, " -wc - comment\n"); 85 gprint (GP_ERR, " -ws - full string comment\n"); 86 86 return (FALSE); 87 87 } … … 103 103 case BOOLEAN: 104 104 if (strcasecmp (line, "T") && strcasecmp (line, "TRUE") && strcasecmp (line, "F") && strcasecmp (line, "FALSE")) { 105 fprintf (stderr, "syntax error in boolean value\n");105 gprint (GP_ERR, "syntax error in boolean value\n"); 106 106 return (FALSE); 107 107 } … … 130 130 set_variable (argv[3], value); 131 131 else 132 fprintf (GetOutfile(), "%s: %f\n", argv[2], value);132 gprint (GP_LOG, "%s: %f\n", argv[2], value); 133 133 return (TRUE); 134 134 } … … 140 140 set_str_variable (argv[3], line); 141 141 else 142 fprintf (GetOutfile(), "%s: %s\n", argv[2], line);142 gprint (GP_LOG, "%s: %s\n", argv[2], line); 143 143 return (TRUE); 144 144 } … … 150 150 set_str_variable (argv[3], line); 151 151 else 152 fprintf (GetOutfile(), "%s: %s\n", argv[2], line);152 gprint (GP_LOG, "%s: %s\n", argv[2], line); 153 153 return (TRUE); 154 154 155 155 failure: 156 if (!soft) fprintf (stderr, "keyword %s not found\n", argv[2]);156 if (!soft) gprint (GP_ERR, "keyword %s not found\n", argv[2]); 157 157 return (soft); 158 158 } -
trunk/Ohana/src/opihi/cmd.data/labels.c
r5850 r7917 9 9 10 10 if (get_argument (argc, argv, "-h")) { 11 fprintf (stderr, "label options: \n");12 fprintf (stderr, " -x : bottom-center\n");13 fprintf (stderr, " +x : top-center\n");14 fprintf (stderr, " -y : right-side\n");15 fprintf (stderr, " +y : left-side\n\n");11 gprint (GP_ERR, "label options: \n"); 12 gprint (GP_ERR, " -x : bottom-center\n"); 13 gprint (GP_ERR, " +x : top-center\n"); 14 gprint (GP_ERR, " -y : right-side\n"); 15 gprint (GP_ERR, " +y : left-side\n\n"); 16 16 17 fprintf (stderr, " -ul : upper-left corner\n");18 fprintf (stderr, " -ll : lower-left corner\n");19 fprintf (stderr, " -ur : upper-right corner\n");20 fprintf (stderr, " -lr : lower-right corner\n\n");17 gprint (GP_ERR, " -ul : upper-left corner\n"); 18 gprint (GP_ERR, " -ll : lower-left corner\n"); 19 gprint (GP_ERR, " -ur : upper-right corner\n"); 20 gprint (GP_ERR, " -lr : lower-right corner\n\n"); 21 21 22 fprintf (stderr, " -fn (font) (size) : set font and size\n");23 fprintf (stderr, " (font) : courier, helvetica, times, symbol\n\n");24 fprintf (stderr, " label special characters:\n");25 fprintf (stderr, " ^ : superscript\n");26 fprintf (stderr, " _ : subscript\n");27 fprintf (stderr, " | : default script \n");28 fprintf (stderr, " &c, &h, &t, &s : set font\n\n");22 gprint (GP_ERR, " -fn (font) (size) : set font and size\n"); 23 gprint (GP_ERR, " (font) : courier, helvetica, times, symbol\n\n"); 24 gprint (GP_ERR, " label special characters:\n"); 25 gprint (GP_ERR, " ^ : superscript\n"); 26 gprint (GP_ERR, " _ : subscript\n"); 27 gprint (GP_ERR, " | : default script \n"); 28 gprint (GP_ERR, " &c, &h, &t, &s : set font\n\n"); 29 29 return (FALSE); 30 30 } … … 88 88 89 89 if (argc != 1) { 90 fprintf (stderr, "USAGE: labels [-x] [-y] [+x] [+y] [-ul] [-ur] [-ll] [-lr]\n");90 gprint (GP_ERR, "USAGE: labels [-x] [-y] [+x] [+y] [-ul] [-ur] [-ll] [-lr]\n"); 91 91 return (FALSE); 92 92 } -
trunk/Ohana/src/opihi/cmd.data/limits.c
r5850 r7917 25 25 26 26 if (argc == 1) { 27 fprintf (stderr, "limits: %f %f %f %f [-a] [-n Xgraph]\n",27 gprint (GP_ERR, "limits: %f %f %f %f [-a] [-n Xgraph]\n", 28 28 graphmode.xmin, graphmode.xmax, 29 29 graphmode.ymin, graphmode.ymax); … … 61 61 } 62 62 63 fprintf (stderr, "USAGE: limits [xrange] [yrange]\n");64 fprintf (stderr, " [range] may be either [min max] or a vector\n");63 gprint (GP_ERR, "USAGE: limits [xrange] [yrange]\n"); 64 gprint (GP_ERR, " [range] may be either [min max] or a vector\n"); 65 65 return (FALSE); 66 66 67 67 error: 68 fprintf (stderr, "error in vectors\n");68 gprint (GP_ERR, "error in vectors\n"); 69 69 return (FALSE); 70 70 -
trunk/Ohana/src/opihi/cmd.data/line.c
r7080 r7917 33 33 34 34 if (argc != 3) { 35 fprintf (stderr, "USAGE: plot <x> <y>\n");35 gprint (GP_ERR, "USAGE: plot <x> <y>\n"); 36 36 return (FALSE); 37 37 } … … 51 51 if ((vecy = SelectVector (argv[2], OLDVECTOR, TRUE)) == NULL) return (FALSE); 52 52 if (vecy[0].Nelements != vecy[0].Nelements) { 53 fprintf (stderr, "vectors %s and %s not the same length\n", argv[1], argv[2]);53 gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[2]); 54 54 return (FALSE); 55 55 } -
trunk/Ohana/src/opihi/cmd.data/list_header.c
r7080 r7917 18 18 19 19 if (argc != 2) { 20 fprintf (stderr, "USAGE: header <buffer> [-w filename]\n");20 gprint (GP_ERR, "USAGE: header <buffer> [-w filename]\n"); 21 21 return (FALSE); 22 22 } … … 27 27 f = fopen (filename, "r"); 28 28 if (f == (FILE *) NULL) { 29 fprintf (stderr, "file %s not found\n", filename);29 gprint (GP_ERR, "file %s not found\n", filename); 30 30 return (FALSE); 31 31 } … … 67 67 Nbytes = fwrite (p, sizeof(char), nbytes, f); 68 68 if (Nbytes != nbytes) { 69 fprintf (stderr, "warning: not all printed...\n");69 gprint (GP_ERR, "warning: not all printed...\n"); 70 70 } 71 71 free (p); … … 78 78 79 79 } 80 81 /* XXX this function is not written in the context of the output file/buffer */ -
trunk/Ohana/src/opihi/cmd.data/load.c
r5846 r7917 29 29 30 30 if (argc != 3) { 31 fprintf (stderr, "USAGE: load (overlay) <filename>\n [-c] [-n]");32 fprintf (stderr, " -c: read overlay in celestial coords\n");31 gprint (GP_ERR, "USAGE: load (overlay) <filename>\n [-c] [-n]"); 32 gprint (GP_ERR, " -c: read overlay in celestial coords\n"); 33 33 return (FALSE); 34 34 } … … 40 40 } 41 41 if (f == NULL) { 42 fprintf (stderr, "can't find file %s\n", argv[2]);42 gprint (GP_ERR, "can't find file %s\n", argv[2]); 43 43 return (FALSE); 44 44 } … … 79 79 case 3: 80 80 if (strcmp (type, "TEXT")) { 81 fprintf (stderr, "syntax error in line:\n %s\n", line);81 gprint (GP_ERR, "syntax error in line:\n %s\n", line); 82 82 continue; 83 83 } … … 133 133 free (overlay); 134 134 135 fprintf (stderr, "loaded %d objects\n", Noverlay);135 gprint (GP_ERR, "loaded %d objects\n", Noverlay); 136 136 137 137 if (f != stdin) { -
trunk/Ohana/src/opihi/cmd.data/mcreate.c
r7080 r7917 7 7 8 8 if (argc != 4) { 9 fprintf (stderr, "USAGE: mcreate <buffer> Nx Ny\n");9 gprint (GP_ERR, "USAGE: mcreate <buffer> Nx Ny\n"); 10 10 return (FALSE); 11 11 } -
trunk/Ohana/src/opihi/cmd.data/medacc.c
r2598 r7917 9 9 10 10 if ((argc != 6) && (argc != 7)) { 11 fprintf (stderr, "USAGE: medacc <value> <vector> <key> start end [delta]\n");11 gprint (GP_ERR, "USAGE: medacc <value> <vector> <key> start end [delta]\n"); 12 12 return (FALSE); 13 13 } … … 16 16 if ((key = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) return (FALSE); 17 17 if (val[0].Nelements != key[0].Nelements) { 18 fprintf (stderr, "key and value don't match\n");18 gprint (GP_ERR, "key and value don't match\n"); 19 19 return (FALSE); 20 20 } -
trunk/Ohana/src/opihi/cmd.data/mget.c
r2598 r7917 9 9 10 10 if (argc != 5) { 11 fprintf (stderr, "USAGE: mget <buffer> <vector> <-x/-y> <N>\n");11 gprint (GP_ERR, "USAGE: mget <buffer> <vector> <-x/-y> <N>\n"); 12 12 return (FALSE); 13 13 } … … 17 17 18 18 if (strcasecmp (argv[3], "-x") && strcasecmp (argv[3], "-y")) { 19 fprintf (stderr, "USAGE: mget <buffer> <vector> <-x/-y> <N>\n");19 gprint (GP_ERR, "USAGE: mget <buffer> <vector> <-x/-y> <N>\n"); 20 20 return (FALSE); 21 21 } … … 27 27 Nset = atof (argv[4]); 28 28 if (Nset < 0) { 29 fprintf (stderr, "selection out of range\n");29 gprint (GP_ERR, "selection out of range\n"); 30 30 return (FALSE); 31 31 } … … 35 35 REALLOCATE (vec[0].elements, float, Npix); 36 36 if (Nset >= Ny) { 37 fprintf (stderr, "row out of range\n");37 gprint (GP_ERR, "row out of range\n"); 38 38 return (FALSE); 39 39 } … … 48 48 REALLOCATE (vec[0].elements, float, Npix); 49 49 if (Nset >= Nx) { 50 fprintf (stderr, "column out of range\n");50 gprint (GP_ERR, "column out of range\n"); 51 51 return (FALSE); 52 52 } -
trunk/Ohana/src/opihi/cmd.data/minterpolate.c
r7080 r7917 19 19 20 20 if (argc != 4) { 21 fprintf (stderr, "USAGE: minterpolate <from> <to> scale [-extrapolate]\n");21 gprint (GP_ERR, "USAGE: minterpolate <from> <to> scale [-extrapolate]\n"); 22 22 return (FALSE); 23 23 } -
trunk/Ohana/src/opihi/cmd.data/mset.c
r2598 r7917 9 9 10 10 if (argc != 5) { 11 fprintf (stderr, "USAGE: mset <buffer> <vector> <-x/-y> <N>\n");11 gprint (GP_ERR, "USAGE: mset <buffer> <vector> <-x/-y> <N>\n"); 12 12 return (FALSE); 13 13 } … … 17 17 18 18 if (strcasecmp (argv[3], "-x") && strcasecmp (argv[3], "-y")) { 19 fprintf (stderr, "USAGE: mset <buffer> <vector> <-x/-y> <N>\n");19 gprint (GP_ERR, "USAGE: mset <buffer> <vector> <-x/-y> <N>\n"); 20 20 return (FALSE); 21 21 } … … 28 28 Nset = atof (argv[4]); 29 29 if (Nset < 0) { 30 fprintf (stderr, "selection out of range\n");30 gprint (GP_ERR, "selection out of range\n"); 31 31 return (FALSE); 32 32 } … … 34 34 if (xdir) { 35 35 if (Nx != Npix) { 36 fprintf (stderr, "dimensions don't match\n");36 gprint (GP_ERR, "dimensions don't match\n"); 37 37 return (FALSE); 38 38 } 39 39 if (Nset >= Ny) { 40 fprintf (stderr, "row out of range\n");40 gprint (GP_ERR, "row out of range\n"); 41 41 return (FALSE); 42 42 } … … 49 49 } else { 50 50 if (Ny != Npix) { 51 fprintf (stderr, "dimensions don't match\n");51 gprint (GP_ERR, "dimensions don't match\n"); 52 52 return (FALSE); 53 53 } 54 54 if (Nset >= Nx) { 55 fprintf (stderr, "column out of range\n");55 gprint (GP_ERR, "column out of range\n"); 56 56 return (FALSE); 57 57 } -
trunk/Ohana/src/opihi/cmd.data/peak.c
r6642 r7917 15 15 16 16 if ((argc != 5) && (argc != 3)) { 17 fprintf (stderr, "USAGE: peak <x> <y> [start end]\n");17 gprint (GP_ERR, "USAGE: peak <x> <y> [start end]\n"); 18 18 return (FALSE); 19 19 } … … 50 50 set_variable ("peaknum", imax); 51 51 52 if (!QUIET) fprintf (GetOutfile(), "peak %f @ %f (%d)\n", ymax, xmax, imax);52 if (!QUIET) gprint (GP_LOG, "peak %f @ %f (%d)\n", ymax, xmax, imax); 53 53 54 54 return (TRUE); -
trunk/Ohana/src/opihi/cmd.data/periodogram.c
r6642 r7917 17 17 18 18 if (argc != 7) { 19 fprintf (stderr, "USAGE: periodogram (time) (flux) (minP) (maxP) (period) (power)\n");19 gprint (GP_ERR, "USAGE: periodogram (time) (flux) (minP) (maxP) (period) (power)\n"); 20 20 return (FALSE); 21 21 } … … 46 46 var = var / (Npt - 1); 47 47 48 if (VERBOSE) fprintf (stderr, "mean: %f, var: %f, minT: %f, maxT: %f\n", mean, var, minT, maxT);48 if (VERBOSE) gprint (GP_ERR, "mean: %f, var: %f, minT: %f, maxT: %f\n", mean, var, minT, maxT); 49 49 50 50 dTime = maxT - minT; 51 51 if (dTime == 0) { 52 fprintf (stderr, "ERROR: time range is zero\n");52 gprint (GP_ERR, "ERROR: time range is zero\n"); 53 53 return (FALSE); 54 54 } … … 101 101 ratio = 1 + 0.1*P/dTime; 102 102 103 if (VERBOSE) fprintf (stderr, "tau: %f, P: %f, ratio: %f, dTime: %f, nextP: %f\n", tau, P, ratio, dTime, P*ratio);103 if (VERBOSE) gprint (GP_ERR, "tau: %f, P: %f, ratio: %f, dTime: %f, nextP: %f\n", tau, P, ratio, dTime, P*ratio); 104 104 105 105 P *= ratio; -
trunk/Ohana/src/opihi/cmd.data/plot.c
r7080 r7917 33 33 34 34 if (argc != 3) { 35 fprintf (stderr, "USAGE: plot <x> <y> [style]\n");35 gprint (GP_ERR, "USAGE: plot <x> <y> [style]\n"); 36 36 return (FALSE); 37 37 } … … 51 51 if ((yvec = SelectVector (argv[2], OLDVECTOR, TRUE)) == NULL) return (FALSE); 52 52 if (xvec[0].Nelements != yvec[0].Nelements) { 53 fprintf (stderr, "vectors %s and %s not the same length\n", argv[1], argv[2]);53 gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[2]); 54 54 return (FALSE); 55 55 } -
trunk/Ohana/src/opihi/cmd.data/point.c
r5846 r7917 32 32 33 33 if (argc != 7) { 34 fprintf (stderr, "USAGE: point (overlay) TYPE x y dx dy [-c]\n");34 gprint (GP_ERR, "USAGE: point (overlay) TYPE x y dx dy [-c]\n"); 35 35 return (FALSE); 36 36 } -
trunk/Ohana/src/opihi/cmd.data/ps.c
r5850 r7917 58 58 59 59 help: 60 fprintf (stderr, "USAGE: ps [-name file.ps] [-g | -i] [-n device] [-raw] [-scale]\n");60 gprint (GP_ERR, "USAGE: ps [-name file.ps] [-g | -i] [-n device] [-raw] [-scale]\n"); 61 61 return (FALSE); 62 62 } -
trunk/Ohana/src/opihi/cmd.data/queuedelete.c
r4703 r7917 6 6 7 7 if (argc != 2) { 8 fprintf (stderr, "USAGE: queuedelete (name)\n");8 gprint (GP_ERR, "USAGE: queuedelete (name)\n"); 9 9 return (FALSE); 10 10 } … … 12 12 queue = FindQueue (argv[1]); 13 13 if (queue == NULL) { 14 fprintf (stderr, "ERROR: queue %s not found\n", argv[1]);14 gprint (GP_ERR, "ERROR: queue %s not found\n", argv[1]); 15 15 return (FALSE); 16 16 } -
trunk/Ohana/src/opihi/cmd.data/queueinit.c
r4703 r7917 6 6 7 7 if (argc != 2) { 8 fprintf (stderr, "USAGE: queueinit (name)\n");8 gprint (GP_ERR, "USAGE: queueinit (name)\n"); 9 9 return (FALSE); 10 10 } -
trunk/Ohana/src/opihi/cmd.data/queuelist.c
r4703 r7917 4 4 5 5 if (argc != 1) { 6 fprintf (stderr, "USAGE: queuelist\n");6 gprint (GP_ERR, "USAGE: queuelist\n"); 7 7 return (FALSE); 8 8 } -
trunk/Ohana/src/opihi/cmd.data/queuepop.c
r6249 r7917 27 27 28 28 if (argc != 2) { 29 fprintf (stderr, "USAGE: queuepop (queue) [-var variable] [-key N value]\n");29 gprint (GP_ERR, "USAGE: queuepop (queue) [-var variable] [-key N value]\n"); 30 30 return (FALSE); 31 31 } … … 34 34 queue = FindQueue (argv[1]); 35 35 if (queue == NULL) { 36 fprintf (stderr, "ERROR: queue %s not found\n", argv[1]);36 gprint (GP_ERR, "ERROR: queue %s not found\n", argv[1]); 37 37 return (FALSE); 38 38 } … … 46 46 if (var == NULL) { 47 47 if (line == NULL) { 48 fprintf (stderr, "queue %s is empty or match not found\n", argv[1]);48 gprint (GP_ERR, "queue %s is empty or match not found\n", argv[1]); 49 49 return (FALSE); 50 50 } else { 51 fprintf (stderr, "%s\n", line);51 gprint (GP_ERR, "%s\n", line); 52 52 return (TRUE); 53 53 } -
trunk/Ohana/src/opihi/cmd.data/queueprint.c
r4703 r7917 6 6 7 7 if (argc != 2) { 8 fprintf (stderr, "USAGE: queueprint (name)\n");8 gprint (GP_ERR, "USAGE: queueprint (name)\n"); 9 9 return (FALSE); 10 10 } … … 12 12 queue = FindQueue (argv[1]); 13 13 if (queue == NULL) { 14 fprintf (stderr, "ERROR: queue %s not found\n", argv[1]);14 gprint (GP_ERR, "ERROR: queue %s not found\n", argv[1]); 15 15 return (FALSE); 16 16 } 17 17 18 PrintQueue ( GetOutfile(),queue);18 PrintQueue (queue); 19 19 return (TRUE); 20 20 } -
trunk/Ohana/src/opihi/cmd.data/queuepush.c
r4703 r7917 26 26 27 27 if (argc != 3) { 28 fprintf (stderr, "USAGE: queuepush (queue) (value) [-key N] [-uniq] [-replace]\n");28 gprint (GP_ERR, "USAGE: queuepush (queue) (value) [-key N] [-uniq] [-replace]\n"); 29 29 return (FALSE); 30 30 } -
trunk/Ohana/src/opihi/cmd.data/queuesize.c
r4703 r7917 15 15 16 16 if (argc != 2) { 17 fprintf (stderr, "USAGE: queuesize (name) [-var variable]\n");17 gprint (GP_ERR, "USAGE: queuesize (name) [-var variable]\n"); 18 18 return (FALSE); 19 19 } … … 21 21 queue = FindQueue (argv[1]); 22 22 if (queue == NULL) { 23 fprintf (stderr, "ERROR: queue %s not found\n", argv[1]);23 gprint (GP_ERR, "ERROR: queue %s not found\n", argv[1]); 24 24 return (FALSE); 25 25 } 26 26 27 27 if (var == (char *) NULL) { 28 fprintf (stderr, "Nlines: %d\n", queue[0].Nlines);28 gprint (GP_ERR, "Nlines: %d\n", queue[0].Nlines); 29 29 return (TRUE); 30 30 } -
trunk/Ohana/src/opihi/cmd.data/radial.c
r4689 r7917 70 70 71 71 if (!Quiet) { 72 fprintf (GetOutfile(), " mean stdev min max Npix Total\n");73 fprintf (GetOutfile(), "%9.4g %9.4g %9.4g %9.4g %7.0f %9.4g\n", Mean, Stdev, min, max, Npix, Sum);72 gprint (GP_LOG, " mean stdev min max Npix Total\n"); 73 gprint (GP_LOG, "%9.4g %9.4g %9.4g %9.4g %7.0f %9.4g\n", Mean, Stdev, min, max, Npix, Sum); 74 74 } 75 75 … … 84 84 85 85 usage: 86 fprintf (stderr, "USAGE: circstats <buffer> x y radius\n");86 gprint (GP_ERR, "USAGE: circstats <buffer> x y radius\n"); 87 87 return (FALSE); 88 88 89 89 range: 90 fprintf (stderr, "ERROR: coordinates out of range\n");90 gprint (GP_ERR, "ERROR: coordinates out of range\n"); 91 91 return (FALSE); 92 92 93 93 missed: 94 fprintf (stderr, "ERROR: buffer not found\n");94 gprint (GP_ERR, "ERROR: buffer not found\n"); 95 95 return (FALSE); 96 96 } -
trunk/Ohana/src/opihi/cmd.data/rd.c
r7080 r7917 42 42 43 43 if (extend && ccdsel) { 44 fprintf (stderr, "only specify one of -n and -x\n");44 gprint (GP_ERR, "only specify one of -n and -x\n"); 45 45 return (FALSE); 46 46 } 47 47 48 48 if (argc != 3) { 49 fprintf (stderr, "USAGE: rd <buffer> <filename> [-head] [-plane N] [-n ccdid] [-x extnum]\n");49 gprint (GP_ERR, "USAGE: rd <buffer> <filename> [-head] [-plane N] [-n ccdid] [-x extnum]\n"); 50 50 return (FALSE); 51 51 } … … 54 54 f = fopen (argv[2], "r"); 55 55 if (f == (FILE *) NULL) { 56 fprintf (stderr, "file %s not found\n", argv[2]);56 gprint (GP_ERR, "file %s not found\n", argv[2]); 57 57 return (FALSE); 58 58 } … … 75 75 Nskip = gfits_read_Xheader (argv[2], &buf[0].header, Nextend); 76 76 if (!Nskip) { 77 fprintf (stderr, "entry in %s not found\n", argv[2]);77 gprint (GP_ERR, "entry in %s not found\n", argv[2]); 78 78 DeleteBuffer (buf); 79 79 return (FALSE); … … 108 108 f = fopen (argv[2], "r"); 109 109 if (f == (FILE *) NULL) { 110 fprintf (stderr, "file %s not found\n", argv[2]);110 gprint (GP_ERR, "file %s not found\n", argv[2]); 111 111 DeleteBuffer (buf); 112 112 return (FALSE); … … 122 122 CCDKeyword = get_variable ("CCDKEYWORD"); 123 123 if (CCDKeyword == (char *) NULL) { 124 fprintf (stderr, "CCDKEYWORD variable is not set; ");125 fprintf (stderr, "using EXTNAME as default\n");124 gprint (GP_ERR, "CCDKEYWORD variable is not set; "); 125 gprint (GP_ERR, "using EXTNAME as default\n"); 126 126 CCDKeyword = strcreate ("EXTNAME"); 127 127 } … … 130 130 Nskip = gfits_read_Xheader (argv[2], &buf[0].header, i); 131 131 if (!Nskip) { 132 fprintf (stderr, "extension %s in %s not found\n", ccdid, argv[2]);132 gprint (GP_ERR, "extension %s in %s not found\n", ccdid, argv[2]); 133 133 DeleteBuffer (buf); 134 134 free (CCDKeyword); … … 136 136 } 137 137 if (!gfits_scan (&buf[0].header, CCDKeyword, "%s", 1, ID)) { 138 fprintf (stderr, "%s not in header\n", CCDKeyword);138 gprint (GP_ERR, "%s not in header\n", CCDKeyword); 139 139 DeleteBuffer (buf); 140 140 free (CCDKeyword); … … 177 177 f = fopen (argv[2], "r"); 178 178 if (f == (FILE *) NULL) { 179 fprintf (stderr, "file %s not found\n", argv[2]);179 gprint (GP_ERR, "file %s not found\n", argv[2]); 180 180 DeleteBuffer (buf); 181 181 return (FALSE); … … 203 203 if (Nplane > 0) { 204 204 if (plane > Nplane) { 205 fprintf (stderr, "-plane is too large: %d total planes\n", Nplane);205 gprint (GP_ERR, "-plane is too large: %d total planes\n", Nplane); 206 206 DeleteBuffer (buf); 207 207 return (FALSE); … … 217 217 218 218 if (!status) { 219 fprintf (stderr, "problem reading file, buffer not opened\n");219 gprint (GP_ERR, "problem reading file, buffer not opened\n"); 220 220 DeleteBuffer (buf); 221 221 return (FALSE); … … 232 232 buf[0].bzero = buf[0].header.bzero; /* store the original values */ 233 233 buf[0].unsign = buf[0].header.unsign; 234 fprintf (GetOutfile(), "read %d bytes from %s into buffer %s\n",234 gprint (GP_LOG, "read %d bytes from %s into buffer %s\n", 235 235 buf[0].header.size + buf[0].matrix.size, argv[2], argv[1]); 236 236 -
trunk/Ohana/src/opihi/cmd.data/rdseg.c
r7080 r7917 10 10 11 11 if (argc != 7) { 12 fprintf (stderr, "USAGE: rdseg <buffer> <filename> x y nx ny\n");12 gprint (GP_ERR, "USAGE: rdseg <buffer> <filename> x y nx ny\n"); 13 13 return (FALSE); 14 14 } … … 21 21 f = fopen (argv[2], "r"); 22 22 if (f == (FILE *) NULL) { 23 fprintf (stderr, "file %s not found\n", argv[2]);23 gprint (GP_ERR, "file %s not found\n", argv[2]); 24 24 return (FALSE); 25 25 } … … 47 47 48 48 if (!status) { 49 fprintf (stderr, "problem reading file, buffer not opened\n");49 gprint (GP_ERR, "problem reading file, buffer not opened\n"); 50 50 DeleteBuffer (buf); 51 51 return (FALSE); … … 62 62 buf[0].bzero = buf[0].header.bzero; /* store the original values */ 63 63 buf[0].unsign = buf[0].header.unsign; 64 fprintf (GetOutfile(), "read %d bytes from %s into buffer %s\n",64 gprint (GP_LOG, "read %d bytes from %s into buffer %s\n", 65 65 buf[0].header.size + buf[0].matrix.size, argv[2], argv[1]); 66 66 -
trunk/Ohana/src/opihi/cmd.data/read_vectors.c
r7080 r7917 7 7 8 8 if (argc < 2) { 9 fprintf (stderr, "USAGE: datafile (filename)\n");9 gprint (GP_ERR, "USAGE: datafile (filename)\n"); 10 10 return (FALSE); 11 11 } … … 15 15 f = fopen (filename, "r"); 16 16 if (f == (FILE *) NULL) { 17 fprintf (stderr, "failed to open file %s\n", argv[1]);17 gprint (GP_ERR, "failed to open file %s\n", argv[1]); 18 18 return (FALSE); 19 19 } … … 48 48 49 49 if ((argc < 3) || !(argc % 2)) { 50 fprintf (stderr, "USAGE: read name N name N ...\n");50 gprint (GP_ERR, "USAGE: read name N name N ...\n"); 51 51 return (FALSE); 52 52 } … … 54 54 55 55 if (f == (FILE *) NULL) { 56 fprintf (stderr, "no open file for read\n");56 gprint (GP_ERR, "no open file for read\n"); 57 57 return (FALSE); 58 58 } … … 65 65 for (i = 0; i < Nvec; i++) { 66 66 if ((vec[i] = SelectVector (argv[2*i + 1], ANYVECTOR, TRUE)) == NULL) { 67 fprintf (stderr, "USAGE: read name N name N ...\n");67 gprint (GP_ERR, "USAGE: read name N name N ...\n"); 68 68 free (vec); 69 69 free (col); … … 73 73 for (j = 0; j < strlen (colstr); j++) { 74 74 if (!isdigit(colstr[j])) { 75 fprintf (stderr, "USAGE: read name N name N ...\n");75 gprint (GP_ERR, "USAGE: read name N name N ...\n"); 76 76 free (vec); 77 77 free (col); … … 157 157 158 158 if (argc < 2) { 159 fprintf (stderr, "USAGE: read -fits extension name name ...\n");160 fprintf (stderr, " ('extension' may be a name or number)\n");159 gprint (GP_ERR, "USAGE: read -fits extension name name ...\n"); 160 gprint (GP_ERR, " ('extension' may be a name or number)\n"); 161 161 return (FALSE); 162 162 } -
trunk/Ohana/src/opihi/cmd.data/rebin.c
r7080 r7917 33 33 34 34 if (argc != 4) { 35 fprintf (stderr, "USAGE: rebin <from> <to> scale \n");36 fprintf (stderr, " negative integer scale expands image\n");35 gprint (GP_ERR, "USAGE: rebin <from> <to> scale \n"); 36 gprint (GP_ERR, " negative integer scale expands image\n"); 37 37 return (FALSE); 38 38 } … … 63 63 } 64 64 } 65 if (VERBOSE) fprintf (GetOutfile(), "rebin %s to %s (%d,%d to %d,%d)\n", argv[1], argv[2], in[0].header.Naxis[0], in[0].header.Naxis[1], nx, ny);65 if (VERBOSE) gprint (GP_LOG, "rebin %s to %s (%d,%d to %d,%d)\n", argv[1], argv[2], in[0].header.Naxis[0], in[0].header.Naxis[1], nx, ny); 66 66 67 67 Nx = in[0].header.Naxis[0]; … … 171 171 172 172 /* normalization is broken. repair please */ 173 if (Normalize) { fprintf (stderr, "normalize not enabled for fractional scaling\n"); }173 if (Normalize) { gprint (GP_ERR, "normalize not enabled for fractional scaling\n"); } 174 174 175 175 if (scale < 0) scale = 1.0 / fabs(scale); -
trunk/Ohana/src/opihi/cmd.data/resize.c
r5846 r7917 30 30 31 31 if (argc != 3) { 32 fprintf (stderr, "USAGE: resize NX NY [-n] [-g | -i]\n");32 gprint (GP_ERR, "USAGE: resize NX NY [-n] [-g | -i]\n"); 33 33 return (FALSE); 34 34 } -
trunk/Ohana/src/opihi/cmd.data/roll.c
r2598 r7917 8 8 9 9 if (argc != 4) { 10 fprintf (stderr, "USAGE: roll <buffer> dx dy\n");10 gprint (GP_ERR, "USAGE: roll <buffer> dx dy\n"); 11 11 return (FALSE); 12 12 } … … 17 17 dy = atof (argv[3]); 18 18 if (dy != 0) { 19 fprintf (stderr, "only x rolls implemented for now\n");19 gprint (GP_ERR, "only x rolls implemented for now\n"); 20 20 } 21 21 -
trunk/Ohana/src/opihi/cmd.data/rotate.c
r7080 r7917 23 23 24 24 if (argc != 3) { 25 fprintf (stderr, "USAGE: rotate <buffer> <angle>\n");25 gprint (GP_ERR, "USAGE: rotate <buffer> <angle>\n"); 26 26 return (FALSE); 27 27 } … … 29 29 30 30 if ((atof (argv[1]) < -180) || (atof (argv[1]) > 180)) { 31 fprintf (stderr, "valid rotate angle between -180 and +180 degrees\n");31 gprint (GP_ERR, "valid rotate angle between -180 and +180 degrees\n"); 32 32 return (FALSE); 33 33 } … … 95 95 X1 = NY - Yo; 96 96 Y1 = Xo; 97 fprintf (stderr, "%f %f -> %f %f\n", Xo, Yo, X1, Y1);97 gprint (GP_ERR, "%f %f -> %f %f\n", Xo, Yo, X1, Y1); 98 98 gfits_modify (&buf[0].header, "CRPIX1", "%lf", 1, X1); 99 99 gfits_modify (&buf[0].header, "CRPIX2", "%lf", 1, Y1); … … 108 108 PC21 = pc11; 109 109 PC22 = pc12; 110 fprintf (stderr, "%f %f -> %f %f\n", pc11, pc12, PC11, PC12);111 fprintf (stderr, "%f %f -> %f %f\n", pc21, pc22, PC21, PC22);110 gprint (GP_ERR, "%f %f -> %f %f\n", pc11, pc12, PC11, PC12); 111 gprint (GP_ERR, "%f %f -> %f %f\n", pc21, pc22, PC21, PC22); 112 112 gfits_modify (&buf[0].header, "PC001001", "%le", 1, PC11); 113 113 gfits_modify (&buf[0].header, "PC001002", "%le", 1, PC12); … … 228 228 SinAngle = sin (angle*RAD_DEG); 229 229 230 fprintf (stderr, "rotating: %f %f %f\n", angle, CosAngle, SinAngle);230 gprint (GP_ERR, "rotating: %f %f %f\n", angle, CosAngle, SinAngle); 231 231 232 232 Lx = NX*fabs(CosAngle) + NY*fabs(SinAngle); … … 235 235 dY = MAX(0,-NX*SinAngle); 236 236 /* 237 fprintf (stderr, "%f %f --> ", Xo, Yo);237 gprint (GP_ERR, "%f %f --> ", Xo, Yo); 238 238 X1 = Xo*CosAngle - Yo*SinAngle + dX; 239 239 Y1 = Xo*SinAngle + Yo*CosAngle + dY; 240 fprintf (stderr, "%f %f\n", X1, Y1);240 gprint (GP_ERR, "%f %f\n", X1, Y1); 241 241 */ 242 242 -
trunk/Ohana/src/opihi/cmd.data/save.c
r5846 r7917 21 21 22 22 if (argc != 3) { 23 fprintf (stderr, "USAGE: save (overlay) <filename> [-c]\n");24 fprintf (stderr, " -c: write contour in celestial coords\n");23 gprint (GP_ERR, "USAGE: save (overlay) <filename> [-c]\n"); 24 gprint (GP_ERR, " -c: write contour in celestial coords\n"); 25 25 return (FALSE); 26 26 } -
trunk/Ohana/src/opihi/cmd.data/section.c
r5850 r7917 25 25 if (argc == 1) { 26 26 KapaGetSection (Xgraph, "*"); 27 fprintf (stderr, "USAGE: section name [x y dx dy]\n");27 gprint (GP_ERR, "USAGE: section name [x y dx dy]\n"); 28 28 return (TRUE); 29 29 } … … 49 49 return (TRUE); 50 50 } 51 fprintf (stderr, "USAGE: section name [x y dx dy]\n");51 gprint (GP_ERR, "USAGE: section name [x y dx dy]\n"); 52 52 return (FALSE); 53 53 } -
trunk/Ohana/src/opihi/cmd.data/select.c
r3922 r7917 12 12 /** check basic syntax **/ 13 13 if ((argc != 8) || strcmp(argv[2], "=") || strcmp (argv[4], "if") || strcmp (argv[6], "else")) { 14 fprintf (stderr, "SYNTAX: select vec = vec if (logic expression) else vec\n");14 gprint (GP_ERR, "SYNTAX: select vec = vec if (logic expression) else vec\n"); 15 15 return (FALSE); 16 16 } -
trunk/Ohana/src/opihi/cmd.data/set.c
r3922 r7917 8 8 /** check basic form for line **/ 9 9 if ((argc < 3) || strcmp(argv[2], "=")) { 10 fprintf (stderr, "%s = (matrix expression)\n", argv[0]);10 gprint (GP_ERR, "%s = (matrix expression)\n", argv[0]); 11 11 return (FALSE); 12 12 } … … 28 28 DeleteNamedVector (out); 29 29 free (out); 30 fprintf (stderr, "invalid output vector name\n");30 gprint (GP_ERR, "invalid output vector name\n"); 31 31 return (FALSE); 32 32 } … … 38 38 DeleteNamedBuffer (out); 39 39 free (out); 40 fprintf (stderr, "invalid output matrix name\n");40 gprint (GP_ERR, "invalid output matrix name\n"); 41 41 return (FALSE); 42 42 } -
trunk/Ohana/src/opihi/cmd.data/shift.c
r2843 r7917 16 16 17 17 if (argc != 4) { 18 fprintf (stderr, "USAGE: shift <buffer> dx dy\n");18 gprint (GP_ERR, "USAGE: shift <buffer> dx dy\n"); 19 19 return (FALSE); 20 20 } … … 36 36 37 37 if ((dx > buf[0].matrix.Naxis[0]) || (dy > buf[0].matrix.Naxis[1])) { 38 fprintf (stderr, "shifting data out of image\n");38 gprint (GP_ERR, "shifting data out of image\n"); 39 39 return (FALSE); 40 40 } … … 91 91 } 92 92 93 fprintf (stderr, "%f %f\n", fdx, fdy);93 gprint (GP_ERR, "%f %f\n", fdx, fdy); 94 94 if ((fdx > 0) || (fdy > 0)) { 95 95 double f00, f01, f10, f11; -
trunk/Ohana/src/opihi/cmd.data/sort.c
r4689 r7917 8 8 9 9 if (argc < 2) { 10 fprintf (stderr, "USAGE: sort (vector) [vectors ...] \n");11 fprintf (stderr, " first vector is sort key for others\n");10 gprint (GP_ERR, "USAGE: sort (vector) [vectors ...] \n"); 11 gprint (GP_ERR, " first vector is sort key for others\n"); 12 12 return (FALSE); 13 13 } … … 20 20 for (i = 0; i < Nvec; i++) { 21 21 if ((vec[i] = SelectVector (argv[i + 1], OLDVECTOR, FALSE)) == NULL) { 22 fprintf (stderr, "USAGE: sort vector vector ...\n");22 gprint (GP_ERR, "USAGE: sort vector vector ...\n"); 23 23 free (vec); 24 24 return (FALSE); … … 29 29 if (Nval != vec[i][0].Nelements) { 30 30 free (vec); 31 fprintf (stderr, "vectors must all be same length\n");31 gprint (GP_ERR, "vectors must all be same length\n"); 32 32 return (FALSE); 33 33 } -
trunk/Ohana/src/opihi/cmd.data/spline_apply.c
r7080 r7917 13 13 14 14 if (argc != 7) { 15 fprintf (stderr, "USAGE: spline_apply <Y> <Y2> <out> (x/y) Nx Ny\n");15 gprint (GP_ERR, "USAGE: spline_apply <Y> <Y2> <out> (x/y) Nx Ny\n"); 16 16 return (FALSE); 17 17 } -
trunk/Ohana/src/opihi/cmd.data/spline_construct.c
r7080 r7917 8 8 9 9 if (argc != 4) { 10 fprintf (stderr, "USAGE: spline_construct <in> <out> (x/y)\n");10 gprint (GP_ERR, "USAGE: spline_construct <in> <out> (x/y)\n"); 11 11 return (FALSE); 12 12 } -
trunk/Ohana/src/opihi/cmd.data/stats.c
r4689 r7917 30 30 31 31 if (argc != 6) { 32 fprintf (stderr, "USAGE: stats <buffer> sx sy nx ny\n");32 gprint (GP_ERR, "USAGE: stats <buffer> sx sy nx ny\n"); 33 33 return (FALSE); 34 34 } … … 45 45 (sx+nx > buf[0].matrix.Naxis[0]) || 46 46 (sy+ny > buf[0].matrix.Naxis[1])) { 47 fprintf (stderr, "region out of range\n");47 gprint (GP_ERR, "region out of range\n"); 48 48 return (FALSE); 49 49 } … … 94 94 95 95 if (!Quiet) { 96 fprintf (GetOutfile(), " mean stdev min max median Npix Total\n");97 fprintf (GetOutfile(), "%7.4g %7.4g %7.4g %7.4g %7.4g %7.0f %7.4g\n", N1, sqrt (N2/Npix - N1*N1),96 gprint (GP_LOG, " mean stdev min max median Npix Total\n"); 97 gprint (GP_LOG, "%7.4g %7.4g %7.4g %7.4g %7.4g %7.0f %7.4g\n", N1, sqrt (N2/Npix - N1*N1), 98 98 min, max, median, Npix, Npix*N1); 99 99 } -
trunk/Ohana/src/opihi/cmd.data/style.c
r7080 r7917 8 8 9 9 if (argc > 1) { 10 fprintf (stderr, "USAGE: style [-n Ngraph] [-x plot style] [-c color] [-pt point type] [-lt line type] [-lw line width] [-sz size]\n");10 gprint (GP_ERR, "USAGE: style [-n Ngraph] [-x plot style] [-c color] [-pt point type] [-lt line type] [-lw line width] [-sz size]\n"); 11 11 return (FALSE); 12 12 } -
trunk/Ohana/src/opihi/cmd.data/subraster.c
r7080 r7917 11 11 12 12 if (argc != 11) { 13 fprintf (stderr, "USAGE: extract <from> <to> sx sy nx ny Sx Sy Nx Ny\n");13 gprint (GP_ERR, "USAGE: extract <from> <to> sx sy nx ny Sx Sy Nx Ny\n"); 14 14 return (FALSE); 15 15 } … … 30 30 31 31 if ((Sy + ny > Ny) || (Sx + nx > Nx)) { 32 fprintf (stderr, "mismatch between source and dest regions\n");33 fprintf (stderr, "%d + %d > %d or %d + %d > %d\n", Sy, ny, Ny, Sx, nx, Nx);32 gprint (GP_ERR, "mismatch between source and dest regions\n"); 33 gprint (GP_ERR, "%d + %d > %d or %d + %d > %d\n", Sy, ny, Ny, Sx, nx, Nx); 34 34 return (FALSE); 35 35 } … … 39 39 (sx > ibuf[0].matrix.Naxis[0]) || 40 40 (sy > ibuf[0].matrix.Naxis[1])) { 41 fprintf (stderr, "region outside of source image\n");41 gprint (GP_ERR, "region outside of source image\n"); 42 42 return (FALSE); 43 43 } 44 44 45 45 if ((Sx + nx > Nx) || (Sy + ny > Ny)) { 46 fprintf (stderr, "source region larger than dest region\n");46 gprint (GP_ERR, "source region larger than dest region\n"); 47 47 return (FALSE); 48 48 } 49 49 if ((Sx < 0) || (Sy < 0)) { 50 fprintf (stderr, "dest region out of range\n");50 gprint (GP_ERR, "dest region out of range\n"); 51 51 return (FALSE); 52 52 } -
trunk/Ohana/src/opihi/cmd.data/subset.c
r3922 r7917 13 13 14 14 if ((argc < 6) || strcmp(argv[2], "=") || strcmp (argv[4], "if")) { 15 fprintf (stderr, "SYNTAX: subset vec = vec if (logic expression)\n");15 gprint (GP_ERR, "SYNTAX: subset vec = vec if (logic expression)\n"); 16 16 return (FALSE); 17 17 } -
trunk/Ohana/src/opihi/cmd.data/svd.c
r7080 r7917 59 59 status = svdcmp (U, W, V, Nx, Ny); 60 60 if (!status) { 61 fprintf (stderr, "error running svdcmp\n");61 gprint (GP_ERR, "error running svdcmp\n"); 62 62 return (FALSE); 63 63 } … … 65 65 66 66 usage: 67 fprintf (stderr, "USAGE: svd A = U w Vt\n");67 gprint (GP_ERR, "USAGE: svd A = U w Vt\n"); 68 68 return (FALSE); 69 69 -
trunk/Ohana/src/opihi/cmd.data/swapbytes.c
r2598 r7917 8 8 9 9 if (argc != 2) { 10 fprintf (stderr, "USAGE: swapbytes <buffer>\n");10 gprint (GP_ERR, "USAGE: swapbytes <buffer>\n"); 11 11 return (FALSE); 12 12 } … … 17 17 ny = buf[0].matrix.Naxis[1]; 18 18 19 fprintf (stderr, "npix: %d\n", nx*ny);19 gprint (GP_ERR, "npix: %d\n", nx*ny); 20 20 21 21 V = buf[0].matrix.buffer; -
trunk/Ohana/src/opihi/cmd.data/teststats.c
r2598 r7917 31 31 32 32 if (argc != 2) { 33 fprintf (stderr, "USAGE: teststats (vector)\n");33 gprint (GP_ERR, "USAGE: teststats (vector)\n"); 34 34 return (FALSE); 35 35 } … … 98 98 99 99 if (!Quiet) { 100 fprintf (stderr, "mean: %f, stdev: %f, min: %f, max: %f, median: %f, mode: %f, Npts: %d\n",100 gprint (GP_ERR, "mean: %f, stdev: %f, min: %f, max: %f, median: %f, mode: %f, Npts: %d\n", 101 101 mean, stdev, min, max, median, mode, N); 102 102 } -
trunk/Ohana/src/opihi/cmd.data/textline.c
r5850 r7917 41 41 42 42 if (argc != 4) { 43 fprintf (stderr, "USAGE: text x y (line) [-fn (font) size] [-rot angle]\n");43 gprint (GP_ERR, "USAGE: text x y (line) [-fn (font) size] [-rot angle]\n"); 44 44 return (FALSE); 45 45 } 46 46 47 47 if (strlen (argv[3]) > 127) { 48 fprintf (stderr, "labels currently limited to 127 chars\n");48 gprint (GP_ERR, "labels currently limited to 127 chars\n"); 49 49 return (FALSE); 50 50 } -
trunk/Ohana/src/opihi/cmd.data/tv.c
r5846 r7917 31 31 32 32 if ((argc != 2) && (argc != 4)) { 33 fprintf (stderr, "USAGE: tv <buffer> [zero range] [-n Nimage] [-log] [-kill]\n");33 gprint (GP_ERR, "USAGE: tv <buffer> [zero range] [-n Nimage] [-log] [-kill]\n"); 34 34 return (FALSE); 35 35 } -
trunk/Ohana/src/opihi/cmd.data/tvcontour.c
r5846 r7917 71 71 72 72 if ((argc != 4) && (argc != 5)) { 73 fprintf (stderr, "USAGE: contour <buffer> (overlay) level [Npix]\n");73 gprint (GP_ERR, "USAGE: contour <buffer> (overlay) level [Npix]\n"); 74 74 return (FALSE); 75 75 } … … 88 88 Ny = buf[0].header.Naxis[1]/Npix; 89 89 if (Npix != 1) { 90 fprintf (GetOutfile(), "rebin by a factor of %d (%d,%d)\n", Npix, Nx, Ny);90 gprint (GP_LOG, "rebin by a factor of %d (%d,%d)\n", Npix, Nx, Ny); 91 91 ALLOCATE (matrix, float, Nx*Ny); 92 92 bzero (matrix, Nx*Ny*sizeof(float)); … … 104 104 } 105 105 } else { 106 fprintf (stderr, "using scale of 1\n");106 gprint (GP_ERR, "using scale of 1\n"); 107 107 matrix = (float *)(buf[0].matrix.buffer); 108 108 } … … 119 119 d11 = (level - *v10); 120 120 for (j = 1; j < Ny; j++) { 121 if (!(j%10)) fprintf (stderr, ".");121 if (!(j%10)) gprint (GP_ERR, "."); 122 122 for (i = 1; i < Nx; i++, v00++, v01++, v10++, v11++) { 123 123 … … 281 281 282 282 if (Npix != 1) free (matrix); 283 fprintf (stderr, "\n");283 gprint (GP_ERR, "\n"); 284 284 return (TRUE); 285 285 } -
trunk/Ohana/src/opihi/cmd.data/tvgrid.c
r5846 r7917 24 24 25 25 if (argc != 3) { 26 fprintf (stderr, "USAGE: tvgrid (overlay) (buffer)\n");27 fprintf (stderr, " (overlay) may be: red, green, blue, yellow\n");26 gprint (GP_ERR, "USAGE: tvgrid (overlay) (buffer)\n"); 27 gprint (GP_ERR, " (overlay) may be: red, green, blue, yellow\n"); 28 28 return (FALSE); 29 29 } … … 34 34 XY_to_RD (&ra0, &dec0, 0.0, 0.0, &coords); 35 35 XY_to_RD (&ra1, &dec1, (double)buf[0].header.Naxis[0], (double)buf[0].header.Naxis[1], &coords); 36 fprintf (stderr, "%f %f %f %f\n", ra0, dec0, ra1, dec1);36 gprint (GP_ERR, "%f %f %f %f\n", ra0, dec0, ra1, dec1); 37 37 38 38 Noverlay = 0; … … 64 64 ndig1 = 3 + log10(MAX(dec0, dec1)) + ndig2; 65 65 sprintf (format, "%%%d.%df", ndig1, ndig2); 66 fprintf (stderr, "format: %s..\n", format);66 gprint (GP_ERR, "format: %s..\n", format); 67 67 68 68 NX = buf[0].header.Naxis[0]; … … 118 118 ndig1 = 3 + log10(MAX(ra0, ra1)) + ndig2; 119 119 sprintf (format, "%%%d.%df", ndig1, ndig2); 120 fprintf (stderr, "format: %s..\n", format);120 gprint (GP_ERR, "format: %s..\n", format); 121 121 122 122 dDEC = MAX (fabs(dec1 - dec0) / 100.0, 0.1); -
trunk/Ohana/src/opihi/cmd.data/ungridify.c
r2876 r7917 11 11 12 12 if (argc != 9) { 13 fprintf (stderr, "USAGE: ungridify buffer Xmin Xmax Ymin Ymax x y z\n");13 gprint (GP_ERR, "USAGE: ungridify buffer Xmin Xmax Ymin Ymax x y z\n"); 14 14 return (FALSE); 15 15 } … … 50 50 } 51 51 if (n != Nx*Ny) { 52 fprintf (stderr, "error in ungrid: %d vs %d (%d x %d)\n", n, Nx*Ny, Nx, Ny);52 gprint (GP_ERR, "error in ungrid: %d vs %d (%d x %d)\n", n, Nx*Ny, Nx, Ny); 53 53 } 54 54 vx[0].Nelements = vy[0].Nelements = vz[0].Nelements = n; -
trunk/Ohana/src/opihi/cmd.data/uniq.c
r2598 r7917 8 8 9 9 if (argc != 3) { 10 fprintf (stderr, "USAGE: uniq (in) (out)\n");10 gprint (GP_ERR, "USAGE: uniq (in) (out)\n"); 11 11 return (FALSE); 12 12 } -
trunk/Ohana/src/opihi/cmd.data/unsign.c
r2598 r7917 5 5 if (argc == 1) { 6 6 if (FT_UNSIGN_MODE) 7 fprintf (stderr, "mode is now UNSIGNED int \n");7 gprint (GP_ERR, "mode is now UNSIGNED int \n"); 8 8 else 9 fprintf (stderr, "mode is now SIGNED int \n");9 gprint (GP_ERR, "mode is now SIGNED int \n"); 10 10 return (TRUE); 11 11 } … … 24 24 } 25 25 26 fprintf (stderr, "USAGE: unsign [0/1]\n");26 gprint (GP_ERR, "USAGE: unsign [0/1]\n"); 27 27 return (FALSE); 28 28 } -
trunk/Ohana/src/opihi/cmd.data/vbin.c
r5850 r7917 25 25 26 26 if (argc != 4) { 27 fprintf (stderr, "USAGE: vbin <input> <output> scale \n");28 fprintf (stderr, " (use interpolate to expand)\n");27 gprint (GP_ERR, "USAGE: vbin <input> <output> scale \n"); 28 gprint (GP_ERR, " (use interpolate to expand)\n"); 29 29 return (FALSE); 30 30 } … … 35 35 scale = atof (argv[3]); 36 36 if ((int)(scale) != scale) { 37 fprintf (stderr, "integer binning only, please\n");37 gprint (GP_ERR, "integer binning only, please\n"); 38 38 return (FALSE); 39 39 } -
trunk/Ohana/src/opihi/cmd.data/vclip.c
r4689 r7917 27 27 28 28 if ((argc != 6) && (!(DO_INF || DO_NAN))) { 29 fprintf (stderr, "USAGE: vclip (vector) [min Vmin max Vmax] [-inf val] [-nan val]\n");29 gprint (GP_ERR, "USAGE: vclip (vector) [min Vmin max Vmax] [-inf val] [-nan val]\n"); 30 30 return (FALSE); 31 31 } -
trunk/Ohana/src/opihi/cmd.data/vcontour.c
r5846 r7917 62 62 Vector *xvec, *yvec, *zvec; 63 63 64 fprintf (stderr, "vcontour not working yet\n");64 gprint (GP_ERR, "vcontour not working yet\n"); 65 65 return (FALSE); 66 66 67 67 if (argc != 7) { 68 fprintf (stderr, "USAGE: vcontour x y z Xc Yc (level)\n");68 gprint (GP_ERR, "USAGE: vcontour x y z Xc Yc (level)\n"); 69 69 return (FALSE); 70 70 } … … 109 109 d11 = (level - *v10); 110 110 for (j = 1; j < Ny; j++) { 111 if (!(j%10)) fprintf (stderr, ".");111 if (!(j%10)) gprint (GP_ERR, "."); 112 112 for (i = 1; i < Nx; i++, v00++, v01++, v10++, v11++) { 113 113 … … 275 275 276 276 if (Npix != 1) free (matrix); 277 fprintf (stderr, "\n");277 gprint (GP_ERR, "\n"); 278 278 } -
trunk/Ohana/src/opihi/cmd.data/vgauss.c
r4303 r7917 7 7 c = get_variable (A); \ 8 8 if (c == NULL) { \ 9 fprintf (stderr, "missing fit parameter A\n"); \9 gprint (GP_ERR, "missing fit parameter A\n"); \ 10 10 return (FALSE); \ 11 11 } \ … … 31 31 32 32 if (argc != 5) { 33 fprintf (stderr, "USAGE: vgauss <x> <y> <dy> (out)\n");34 fprintf (stderr, " uses guesses: C0 (mean), C1 (sigma), C2 (norm), C3 (sky)\n");33 gprint (GP_ERR, "USAGE: vgauss <x> <y> <dy> (out)\n"); 34 gprint (GP_ERR, " uses guesses: C0 (mean), C1 (sigma), C2 (norm), C3 (sky)\n"); 35 35 return (FALSE); 36 36 } … … 64 64 dchisq = ochisq - chisq; 65 65 ochisq = chisq; 66 if (!Quiet) fprintf (stderr, "dchisq: %f, Ndof: %d\n", dchisq, Npts - Npar);66 if (!Quiet) gprint (GP_ERR, "dchisq: %f, Ndof: %d\n", dchisq, Npts - Npar); 67 67 } 68 if (!Quiet) fprintf (stderr, "%d iterations\n", i);68 if (!Quiet) gprint (GP_ERR, "%d iterations\n", i); 69 69 70 70 for (i = 0; i < Npts; i++) { … … 79 79 sprintf (name, "C%d", i); 80 80 set_variable (name, par[i]); 81 if (!Quiet) fprintf (stderr, "%d %f %f\n", i, par[i], sqrt(covar[i][i]));81 if (!Quiet) gprint (GP_ERR, "%d %f %f\n", i, par[i], sqrt(covar[i][i])); 82 82 sprintf (name, "dC%d", i); 83 83 set_variable (name, sqrt(covar[i][i])); -
trunk/Ohana/src/opihi/cmd.data/vgrid.c
r7080 r7917 11 11 12 12 if (argc != 11) { 13 fprintf (stderr, "USAGE: vgrid x y z buffer Xmin Xmax dX Ymin Ymax dY\n");13 gprint (GP_ERR, "USAGE: vgrid x y z buffer Xmin Xmax dX Ymin Ymax dY\n"); 14 14 return (FALSE); 15 15 } -
trunk/Ohana/src/opihi/cmd.data/vload.c
r5846 r7917 23 23 remove_argument (N, &argc, argv); 24 24 if (!type) { 25 fprintf (stderr, "unknown Kii point type %s\n", argv[N]);25 gprint (GP_ERR, "unknown Kii point type %s\n", argv[N]); 26 26 return (FALSE); 27 27 } … … 36 36 37 37 if (argc != 4) { 38 fprintf (stderr, "USAGE: vload (overlay) (xvec) (yvec) [-n]\n");38 gprint (GP_ERR, "USAGE: vload (overlay) (xvec) (yvec) [-n]\n"); 39 39 return (FALSE); 40 40 } … … 49 49 if ((vecy = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) return (FALSE); 50 50 if (vecx[0].Nelements != vecy[0].Nelements) { 51 fprintf (stderr, "mismatched vector lengths\n");51 gprint (GP_ERR, "mismatched vector lengths\n"); 52 52 return (FALSE); 53 53 } -
trunk/Ohana/src/opihi/cmd.data/vpop.c
r2598 r7917 7 7 8 8 if (argc != 2) { 9 fprintf (stderr, "USAGE: vpop (vector)\n");10 fprintf (stderr, " remove first element of vector\n");9 gprint (GP_ERR, "USAGE: vpop (vector)\n"); 10 gprint (GP_ERR, " remove first element of vector\n"); 11 11 return (FALSE); 12 12 } -
trunk/Ohana/src/opihi/cmd.data/vroll.c
r2598 r7917 8 8 9 9 if (argc != 2) { 10 fprintf (stderr, "USAGE: vroll (vector)\n");11 fprintf (stderr, " roll vector elements (first goes to end)\n");10 gprint (GP_ERR, "USAGE: vroll (vector)\n"); 11 gprint (GP_ERR, " roll vector elements (first goes to end)\n"); 12 12 return (FALSE); 13 13 } -
trunk/Ohana/src/opihi/cmd.data/vsmooth.c
r3893 r7917 16 16 17 17 if (argc != 3) { 18 fprintf (stderr, "USAGE: vsmooth (input) sigma\n");18 gprint (GP_ERR, "USAGE: vsmooth (input) sigma\n"); 19 19 return (FALSE); 20 20 } -
trunk/Ohana/src/opihi/cmd.data/vstat.c
r4689 r7917 32 32 33 33 if (argc != 2) { 34 fprintf (stderr, "USAGE: vstat (vector)\n");34 gprint (GP_ERR, "USAGE: vstat (vector)\n"); 35 35 return (FALSE); 36 36 } … … 99 99 skip: 100 100 if (!Quiet) { 101 fprintf (stderr, "mean: %g, stdev: %g, min: %g, max: %g, median: %g, mode: %g, Npts: %d\n",101 gprint (GP_ERR, "mean: %g, stdev: %g, min: %g, max: %g, median: %g, mode: %g, Npts: %d\n", 102 102 mean, stdev, min, max, median, mode, N); 103 103 } -
trunk/Ohana/src/opihi/cmd.data/wd.c
r7080 r7917 52 52 if (!strcasecmp (argv[N], "f") || !strcasecmp (argv[N], "false")) outUnsign = FALSE; 53 53 if (outUnsign == -1) { 54 fprintf (stderr, "-unsign options: t, f, true, false\n");54 gprint (GP_ERR, "-unsign options: t, f, true, false\n"); 55 55 return (FALSE); 56 56 } … … 60 60 61 61 if (argc != 3) { 62 fprintf (stderr, "USAGE: wd <buffer> <filename> [-bitpix N] [-bscale X] [-bzero X] [-newplane]\n");62 gprint (GP_ERR, "USAGE: wd <buffer> <filename> [-bitpix N] [-bscale X] [-bzero X] [-newplane]\n"); 63 63 return (FALSE); 64 64 } … … 115 115 f = fopen (argv[2], "r+"); 116 116 if (f == NULL) { 117 fprintf (stderr, "failed to write file\n");117 gprint (GP_ERR, "failed to write file\n"); 118 118 status = FALSE; 119 119 goto done1; … … 124 124 status = fwrite (Xhead.buffer, 1, Xhead.size, f); 125 125 if (status != Xhead.size) { 126 fprintf (stderr, "ERROR: failed writing data to image header\n");126 gprint (GP_ERR, "ERROR: failed writing data to image header\n"); 127 127 status = FALSE; 128 128 goto done1; … … 144 144 fclose (f); 145 145 if (status != temp_header.size) { 146 fprintf (stderr, "failed to write file\n");146 gprint (GP_ERR, "failed to write file\n"); 147 147 status = FALSE; 148 148 goto done1; … … 150 150 /* write the matrix buffer (automatically goes to end of file */ 151 151 if (!gfits_write_matrix (argv[2], &temp_matrix)) { 152 fprintf (stderr, "failed to write file\n");152 gprint (GP_ERR, "failed to write file\n"); 153 153 status = FALSE; 154 154 goto done1; … … 164 164 /* the actual write-to-disk goes here */ 165 165 if (!gfits_write_header (argv[2], &temp_header)) { 166 fprintf (stderr, "failed to write header\n");166 gprint (GP_ERR, "failed to write header\n"); 167 167 gfits_free_header (&temp_header); 168 168 gfits_free_matrix (&temp_matrix); … … 171 171 172 172 if (!gfits_write_matrix (argv[2], &temp_matrix)) { 173 fprintf (stderr, "failed to write matrix\n");173 gprint (GP_ERR, "failed to write matrix\n"); 174 174 gfits_free_header (&temp_header); 175 175 gfits_free_matrix (&temp_matrix); -
trunk/Ohana/src/opihi/cmd.data/write_vectors.c
r6642 r7917 18 18 19 19 if (argc < 3) { 20 fprintf (stderr, "USAGE: write [-f \"format\"] file vector vector ...\n");20 gprint (GP_ERR, "USAGE: write [-f \"format\"] file vector vector ...\n"); 21 21 return (FALSE); 22 22 } … … 25 25 f = fopen (argv[1], "w"); 26 26 if (f == (FILE *) NULL) { 27 fprintf (stderr, "can't open file for write\n");27 gprint (GP_ERR, "can't open file for write\n"); 28 28 return (FALSE); 29 29 } … … 32 32 Nvec = (argc - 2); 33 33 if (Nvec < 1) { 34 fprintf (stderr, "USAGE: write (file) vector vector ...\n");34 gprint (GP_ERR, "USAGE: write (file) vector vector ...\n"); 35 35 fclose (f); 36 36 return (FALSE); … … 41 41 for (i = 0; i < Nvec; i++) { 42 42 if ((vec[i] = SelectVector (argv[i + 2], OLDVECTOR, FALSE)) == NULL) { 43 fprintf (stderr, "unknown vector %s\n", argv[i+2]);44 fprintf (stderr, "USAGE: write (file) vector vector ...\n");43 gprint (GP_ERR, "unknown vector %s\n", argv[i+2]); 44 gprint (GP_ERR, "USAGE: write (file) vector vector ...\n"); 45 45 free (vec); 46 46 fclose (f); … … 53 53 for (i = 0; i < Nvec; i++) { 54 54 if (vec[0][0].Nelements != Ne) { 55 fprintf (stderr, "error: vectors must all be the same size\n");55 gprint (GP_ERR, "error: vectors must all be the same size\n"); 56 56 free (vec); 57 57 fclose (f); … … 86 86 p1 = strchr (p0, '%'); 87 87 if (p1 == (char *) NULL) { 88 fprintf (stderr, "mismatch between format and values\n");88 gprint (GP_ERR, "mismatch between format and values\n"); 89 89 free (fmttype); 90 90 for (i = 0; i < Nvec; i++) free (fmtlist[i]); … … 109 109 break; 110 110 default: 111 fprintf (stderr, "syntax error in format (only e,f,d,c,x allowed)\n");111 gprint (GP_ERR, "syntax error in format (only e,f,d,c,x allowed)\n"); 112 112 return (FALSE); 113 113 } -
trunk/Ohana/src/opihi/cmd.data/zap.c
r2843 r7917 16 16 17 17 if (argc != 6) { 18 fprintf (stderr, "USAGE: zap <buffer> sx sy nx ny [-v value]\n");18 gprint (GP_ERR, "USAGE: zap <buffer> sx sy nx ny [-v value]\n"); 19 19 return (FALSE); 20 20 } … … 38 38 39 39 error: 40 fprintf (stderr, "region out of range\n");40 gprint (GP_ERR, "region out of range\n"); 41 41 return (FALSE); 42 42 } -
trunk/Ohana/src/opihi/cmd.data/zplot.c
r2843 r7917 18 18 19 19 if (argc != 6) { 20 fprintf (stderr, "USAGE: zplot <x> <y> <z> min max\n");20 gprint (GP_ERR, "USAGE: zplot <x> <y> <z> min max\n"); 21 21 return (FALSE); 22 22 } … … 30 30 if ((zvec = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) return (FALSE); 31 31 if (xvec[0].Nelements != yvec[0].Nelements) { 32 fprintf (stderr, "vectors %s and %s not the same length\n", argv[1], argv[2]);32 gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[2]); 33 33 return (FALSE); 34 34 } 35 35 if (xvec[0].Nelements != zvec[0].Nelements) { 36 fprintf (stderr, "vectors %s and %s not the same length\n", argv[1], argv[3]);36 gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[1], argv[3]); 37 37 return (FALSE); 38 38 } -
trunk/Ohana/src/opihi/dimm/Camera.c
r2598 r7917 14 14 return (TRUE); 15 15 } 16 fprintf (stderr, "retry...\n");16 gprint (GP_ERR, "retry...\n"); 17 17 } 18 18 19 fprintf (stderr, "failed to init sbig camera on %d\n", port);20 fprintf (stderr, "%s\n", sbig_show_error (state));19 gprint (GP_ERR, "failed to init sbig camera on %d\n", port); 20 gprint (GP_ERR, "%s\n", sbig_show_error (state)); 21 21 return (FALSE); 22 22 } … … 24 24 void DumpCameraInfo () { 25 25 26 fprintf (stderr, "opened sbig camera:\n");27 fprintf (stderr, "linux_version: %f\n", info.linux_version);28 fprintf (stderr, "nmbr_bad_columns: %d\n", info.nmbr_bad_columns);29 fprintf (stderr, "imaging_abg_type: %d\n", info.imaging_abg_type);30 fprintf (stderr, "serial_number: %s\n", info.serial_number);31 fprintf (stderr, "firmware_version: %d\n", info.firmware_version);32 fprintf (stderr, "camera_name: %s\n", info.camera_name);33 fprintf (stderr, "nmbr_readout_modes: %d\n", info.camera_info[0].nmbr_readout_modes);34 fprintf (stderr, "mode: %d\n", info.camera_info[0].readout_mode[0].mode);35 fprintf (stderr, "width: %d\n", info.camera_info[0].readout_mode[0].width);36 fprintf (stderr, "height: %d\n", info.camera_info[0].readout_mode[0].height);37 fprintf (stderr, "gain: %d\n", info.camera_info[0].readout_mode[0].gain);38 fprintf (stderr, "pixel_width: %d\n", info.camera_info[0].readout_mode[0].pixel_width);39 fprintf (stderr, "pixel_height: %d\n", info.camera_info[0].readout_mode[0].pixel_height);40 41 fprintf (stderr, "ST5_AD_size: %d\n", info.ST5_AD_size);42 fprintf (stderr, "ST5_filter_type: %d\n", info.ST5_filter_type);26 gprint (GP_ERR, "opened sbig camera:\n"); 27 gprint (GP_ERR, "linux_version: %f\n", info.linux_version); 28 gprint (GP_ERR, "nmbr_bad_columns: %d\n", info.nmbr_bad_columns); 29 gprint (GP_ERR, "imaging_abg_type: %d\n", info.imaging_abg_type); 30 gprint (GP_ERR, "serial_number: %s\n", info.serial_number); 31 gprint (GP_ERR, "firmware_version: %d\n", info.firmware_version); 32 gprint (GP_ERR, "camera_name: %s\n", info.camera_name); 33 gprint (GP_ERR, "nmbr_readout_modes: %d\n", info.camera_info[0].nmbr_readout_modes); 34 gprint (GP_ERR, "mode: %d\n", info.camera_info[0].readout_mode[0].mode); 35 gprint (GP_ERR, "width: %d\n", info.camera_info[0].readout_mode[0].width); 36 gprint (GP_ERR, "height: %d\n", info.camera_info[0].readout_mode[0].height); 37 gprint (GP_ERR, "gain: %d\n", info.camera_info[0].readout_mode[0].gain); 38 gprint (GP_ERR, "pixel_width: %d\n", info.camera_info[0].readout_mode[0].pixel_width); 39 gprint (GP_ERR, "pixel_height: %d\n", info.camera_info[0].readout_mode[0].pixel_height); 40 41 gprint (GP_ERR, "ST5_AD_size: %d\n", info.ST5_AD_size); 42 gprint (GP_ERR, "ST5_filter_type: %d\n", info.ST5_filter_type); 43 43 } 44 44 … … 62 62 state = sbig_set_cooling (&cool); 63 63 if (state < 0) { 64 fprintf (stderr, "sbig error: %s\n", sbig_show_error (state));64 gprint (GP_ERR, "sbig error: %s\n", sbig_show_error (state)); 65 65 return (FALSE); 66 66 } … … 76 76 state = sbig_get_status (&status); 77 77 if (state < 0) { 78 fprintf (stderr, "sbig error: %s\n", sbig_show_error (state));78 gprint (GP_ERR, "sbig error: %s\n", sbig_show_error (state)); 79 79 return (-200.0); 80 80 } … … 91 91 state = sbig_get_status (&status); 92 92 if (state < 0) { 93 fprintf (stderr, "sbig error: %s\n", sbig_show_error (state));94 return (FALSE); 95 } 96 97 fprintf (stderr, "imaging_ccd_status: %d\n", status.imaging_ccd_status);98 fprintf (stderr, "tracking_ccd_status: %d\n", status.tracking_ccd_status);99 fprintf (stderr, "fan_on: %d\n", status.fan_on);100 fprintf (stderr, "shutter_state: %d\n", status.shutter_state);101 fprintf (stderr, "led_state: %d\n", status.led_state);102 fprintf (stderr, "shutter_edge: %d\n", status.shutter_edge);103 fprintf (stderr, "plus_x_relay: %d\n", status.plus_x_relay);104 fprintf (stderr, "minus_x_relay: %d\n", status.minus_x_relay);105 fprintf (stderr, "plus_y_relay: %d\n", status.plus_y_relay);106 fprintf (stderr, "minus_y_relay: %d\n", status.minus_y_relay);107 fprintf (stderr, "pulse_active: %d\n", status.pulse_active);108 fprintf (stderr, "temperature_regulation: %d\n", status.temperature_regulation);109 fprintf (stderr, "temperature_setpoint: %d\n", status.temperature_setpoint);110 fprintf (stderr, "cooling_power: %d\n", status.cooling_power);111 fprintf (stderr, "air_temperature: %d\n", status.air_temperature);112 fprintf (stderr, "ccd_temperature: %d\n", status.ccd_temperature);93 gprint (GP_ERR, "sbig error: %s\n", sbig_show_error (state)); 94 return (FALSE); 95 } 96 97 gprint (GP_ERR, "imaging_ccd_status: %d\n", status.imaging_ccd_status); 98 gprint (GP_ERR, "tracking_ccd_status: %d\n", status.tracking_ccd_status); 99 gprint (GP_ERR, "fan_on: %d\n", status.fan_on); 100 gprint (GP_ERR, "shutter_state: %d\n", status.shutter_state); 101 gprint (GP_ERR, "led_state: %d\n", status.led_state); 102 gprint (GP_ERR, "shutter_edge: %d\n", status.shutter_edge); 103 gprint (GP_ERR, "plus_x_relay: %d\n", status.plus_x_relay); 104 gprint (GP_ERR, "minus_x_relay: %d\n", status.minus_x_relay); 105 gprint (GP_ERR, "plus_y_relay: %d\n", status.plus_y_relay); 106 gprint (GP_ERR, "minus_y_relay: %d\n", status.minus_y_relay); 107 gprint (GP_ERR, "pulse_active: %d\n", status.pulse_active); 108 gprint (GP_ERR, "temperature_regulation: %d\n", status.temperature_regulation); 109 gprint (GP_ERR, "temperature_setpoint: %d\n", status.temperature_setpoint); 110 gprint (GP_ERR, "cooling_power: %d\n", status.cooling_power); 111 gprint (GP_ERR, "air_temperature: %d\n", status.air_temperature); 112 gprint (GP_ERR, "ccd_temperature: %d\n", status.ccd_temperature); 113 113 114 114 return (TRUE); … … 131 131 state = sbig_expose (&expose); 132 132 if (state < 0) { 133 fprintf (stderr, "exposure error\n");134 fprintf (stderr, "%s\n", sbig_show_error (state));133 gprint (GP_ERR, "exposure error\n"); 134 gprint (GP_ERR, "%s\n", sbig_show_error (state)); 135 135 return (FALSE); 136 136 } … … 138 138 for (i = 0; i < expose.exposure_time + 10; ++i) { 139 139 state = sbig_get_status (&status); 140 /* fprintf (stderr, "%d\n", state); */141 /* fprintf (stderr, "%d %d\n", status.imaging_ccd_status, status.shutter_state); */140 /* gprint (GP_ERR, "%d\n", state); */ 141 /* gprint (GP_ERR, "%d %d\n", status.imaging_ccd_status, status.shutter_state); */ 142 142 /* if (state == 0) return (TRUE); */ 143 143 if (status.imaging_ccd_status == -SBIG_NO_EXPOSURE_IN_PROGRESS) return (TRUE); … … 146 146 continue; 147 147 } 148 fprintf (stderr, "exposure error\n");149 fprintf (stderr, "%s\n", sbig_show_error (state));150 return (FALSE); 151 } 152 fprintf (stderr, "exposure timeout\n");148 gprint (GP_ERR, "exposure error\n"); 149 gprint (GP_ERR, "%s\n", sbig_show_error (state)); 150 return (FALSE); 151 } 152 gprint (GP_ERR, "exposure timeout\n"); 153 153 return (FALSE); 154 154 } … … 158 158 static int readout_callback (float percent) { 159 159 /* return 1 to continue, 0 to abort */ 160 if (((int)(percent) % 10) == 0) { fprintf (stderr, "."); }160 if (((int)(percent) % 10) == 0) { gprint (GP_ERR, "."); } 161 161 readout_percent = percent; 162 162 if (readout_abort) return 0; … … 183 183 readout.callback = readout_callback; 184 184 185 fprintf (stderr, "%d, %d : %d x %d\n", readout.x, readout.y, readout.width, readout.height);185 gprint (GP_ERR, "%d, %d : %d x %d\n", readout.x, readout.y, readout.width, readout.height); 186 186 sync (); 187 187 readout_abort = FALSE; 188 188 state = sbig_readout (&readout); 189 fprintf (stderr, "\n");190 if (state < 0) { 191 fprintf (stderr, "sbig error: %s\n", sbig_show_error (state));189 gprint (GP_ERR, "\n"); 190 if (state < 0) { 191 gprint (GP_ERR, "sbig error: %s\n", sbig_show_error (state)); 192 192 return (FALSE); 193 193 } … … 203 203 state = sbig_control (&control); 204 204 if (state < 0) { 205 fprintf(stderr, "sbig error: %s\n", sbig_show_error (state));205 gprint (GP_ERR, "sbig error: %s\n", sbig_show_error (state)); 206 206 return (FALSE); 207 207 } … … 217 217 state = sbig_control (&control); 218 218 if (state < 0) { 219 fprintf(stderr, "sbig error: %s\n", sbig_show_error (state));220 return (FALSE); 221 } 222 return (TRUE); 223 } 219 gprint (GP_ERR, "sbig error: %s\n", sbig_show_error (state)); 220 return (FALSE); 221 } 222 return (TRUE); 223 } -
trunk/Ohana/src/opihi/dimm/Serial.c
r2598 r7917 53 53 serial.f = SerialOpen (serial.port); 54 54 if (serial.f <= 0) { 55 fprintf (stderr, "Error opening serial port %s - error %d.\n", serial.port, serial.f);55 gprint (GP_ERR, "Error opening serial port %s - error %d.\n", serial.port, serial.f); 56 56 return (FALSE); 57 57 } … … 77 77 fdesc = open (port, O_RDWR); 78 78 if (fdesc == -1) { 79 if (SER_VERBOSE) fprintf(stderr, "Cannot open %s for read/write.\n", port);79 if (SER_VERBOSE) gprint (GP_ERR, "Cannot open %s for read/write.\n", port); 80 80 return OPENERR; 81 81 } … … 87 87 locked = fcntl (fdesc, F_SETLK, &lock); 88 88 if (locked == -1) { 89 fprintf (stderr, "can't lock serial line\n");89 gprint (GP_ERR, "can't lock serial line\n"); 90 90 close (fdesc); 91 91 return OPENERR; … … 94 94 /* Get the serial port's attributes... */ 95 95 if (tcgetattr (fdesc, &term) == -1) { 96 if (SER_VERBOSE) fprintf(stderr, "Port is not a tty\n");96 if (SER_VERBOSE) gprint (GP_ERR, "Port is not a tty\n"); 97 97 return PORTERR; 98 98 } … … 133 133 if (SER_VERBOSE) printf("Setting the serial port's baud rate.\n"); 134 134 if (tcgetattr (fdesc, &term) == -1) { 135 if (SER_VERBOSE) fprintf (stderr, "Port is not a tty\n");135 if (SER_VERBOSE) gprint (GP_ERR, "Port is not a tty\n"); 136 136 return PORTERR; 137 137 } … … 174 174 if (SER_VERBOSE) printf("Setting the serial port's parity.\n"); 175 175 if (tcgetattr(fdesc, &term) == -1) { 176 if (SER_VERBOSE) fprintf(stderr, "Port is not a tty\n");176 if (SER_VERBOSE) gprint (GP_ERR, "Port is not a tty\n"); 177 177 return PORTERR; 178 178 } … … 202 202 if (SER_VERBOSE) printf("Setting the serial port's data bit size.\n"); 203 203 if (tcgetattr(fdesc, &term) == -1) { 204 if (SER_VERBOSE) fprintf(stderr, "Port is not a tty\n");204 if (SER_VERBOSE) gprint (GP_ERR, "Port is not a tty\n"); 205 205 return PORTERR; 206 206 } … … 241 241 if (SER_VERBOSE) printf("Setting the serial port's stop bit.\n"); 242 242 if (tcgetattr(fdesc, &term) == -1) { 243 if (SER_VERBOSE) fprintf(stderr, "Port is not a tty\n");243 if (SER_VERBOSE) gprint (GP_ERR, "Port is not a tty\n"); 244 244 return PORTERR; 245 245 } … … 274 274 int done, Nread, Nin, NREAD; 275 275 276 if (SER_ECHO) fprintf (stderr, "command: %s\n", in);276 if (SER_ECHO) gprint (GP_ERR, "command: %s\n", in); 277 277 278 278 if (serial.f <= 0) { 279 fprintf (stderr, "serial line closed\n");279 gprint (GP_ERR, "serial line closed\n"); 280 280 if (out != (char **) NULL) { 281 281 *out = strcreate ("SERIAL OFF"); … … 290 290 # if (0) 291 291 for (i = 0; i < strlen(in); i++) { 292 fprintf (stderr, "%d %x\n", i, in[i]);292 gprint (GP_ERR, "%d %x\n", i, in[i]); 293 293 } 294 294 # endif … … 297 297 Nin = write (serial.f, in, strlen(in)); 298 298 if (Nin != strlen(in)) { 299 fprintf (stderr, "Serial Command not sent\n");299 gprint (GP_ERR, "Serial Command not sent\n"); 300 300 return (FALSE); 301 301 } … … 316 316 Nin = read (serial.f, &line[Nread], 256); 317 317 # if (SER_DEBUG) 318 fprintf (stderr, "%d ", Nin);318 gprint (GP_ERR, "%d ", Nin); 319 319 # endif 320 320 if (Nin < 0) { /* error, check value */ 321 fprintf (stderr, "error?");321 gprint (GP_ERR, "error?"); 322 322 continue; 323 323 } … … 335 335 } 336 336 337 if (SER_ECHO) fprintf (stderr, "answer: %s\n", line);337 if (SER_ECHO) gprint (GP_ERR, "answer: %s\n", line); 338 338 339 339 if (out == (char **) NULL) { -
trunk/Ohana/src/opihi/dimm/Telescope.c
r2598 r7917 76 76 if (answer == (char *) NULL) return (FALSE); 77 77 if (strcmp (answer, "0")) { 78 fprintf (stderr, "error: %s\n", answer);78 gprint (GP_ERR, "error: %s\n", answer); 79 79 return (FALSE); 80 80 } … … 135 135 } 136 136 if (tsel < 0) { 137 fprintf (stderr, "offset %f arcmin below minimum\n", distance);137 gprint (GP_ERR, "offset %f arcmin below minimum\n", distance); 138 138 return (FALSE); 139 139 } 140 140 if (tsel > SLEW_TIMEOUT) { 141 fprintf (stderr, "offset %f arcmin above maximum\n", distance);141 gprint (GP_ERR, "offset %f arcmin above maximum\n", distance); 142 142 return (FALSE); 143 143 } 144 fprintf (stderr, "offsetting %c for %f seconds\n", dir, tsel);144 gprint (GP_ERR, "offsetting %c for %f seconds\n", dir, tsel); 145 145 146 146 sprintf (cmd, ":%s#", rcmd[rsel]); … … 181 181 for (i = 0; i < NRATE; i++) if (!strcmp (rcmd[i], rate)) status = TRUE; 182 182 if (!status) { 183 fprintf (stderr, "bad rate: %s\n", rate);183 gprint (GP_ERR, "bad rate: %s\n", rate); 184 184 return (FALSE); 185 185 } … … 234 234 235 235 SerialCommand (":CM#", &answer, SER_TIMEOUT); 236 fprintf (stderr, "result: %s\n", answer);236 gprint (GP_ERR, "result: %s\n", answer); 237 237 free (answer); 238 238 return (TRUE); … … 245 245 char *str, line[32]; 246 246 247 fprintf (stderr, "careful, this causes problems\n");247 gprint (GP_ERR, "careful, this causes problems\n"); 248 248 return (FALSE); 249 249 -
trunk/Ohana/src/opihi/dimm/altaz.c
r2598 r7917 25 25 latstr = get_variable ("LATITUDE"); 26 26 if (latstr == (char *) NULL) { 27 fprintf (stderr, "please define $LATITUDE\n");27 gprint (GP_ERR, "please define $LATITUDE\n"); 28 28 return (FALSE); 29 29 } … … 55 55 latstr = get_variable ("LATITUDE"); 56 56 if (latstr == (char *) NULL) { 57 fprintf (stderr, "please define $LATITUDE\n");57 gprint (GP_ERR, "please define $LATITUDE\n"); 58 58 return (FALSE); 59 59 } … … 79 79 80 80 usage: 81 fprintf (stderr, "USAGE: altaz -h (ha) (dec) (alt) (az)\n");82 fprintf (stderr, "USAGE: altaz -c (ha) (dec) (alt) (az)\n");83 fprintf (stderr, " -h alt/az to ha/dec, -c ha/dec to alt/az\n");84 fprintf (stderr, " returned values in variables provided\n");81 gprint (GP_ERR, "USAGE: altaz -h (ha) (dec) (alt) (az)\n"); 82 gprint (GP_ERR, "USAGE: altaz -c (ha) (dec) (alt) (az)\n"); 83 gprint (GP_ERR, " -h alt/az to ha/dec, -c ha/dec to alt/az\n"); 84 gprint (GP_ERR, " returned values in variables provided\n"); 85 85 return (FALSE); 86 86 -
trunk/Ohana/src/opihi/dimm/camera.c
r7080 r7917 30 30 31 31 if (argc != 3) { 32 fprintf (stderr, "USAGE: camera init (port)\n");32 gprint (GP_ERR, "USAGE: camera init (port)\n"); 33 33 EXIT_STATUS (FALSE); 34 34 } … … 44 44 45 45 if (argc != 3) { 46 fprintf (stderr, "USAGE: camera expose (exptime)\n");46 gprint (GP_ERR, "USAGE: camera expose (exptime)\n"); 47 47 EXIT_STATUS (FALSE); 48 48 } … … 58 58 59 59 if (argc != 3) { 60 fprintf (stderr, "USAGE: camera temp (temperature)\n");60 gprint (GP_ERR, "USAGE: camera temp (temperature)\n"); 61 61 EXIT_STATUS (FALSE); 62 62 } … … 72 72 73 73 if (argc != 2) { 74 fprintf (stderr, "USAGE: camera status\n");74 gprint (GP_ERR, "USAGE: camera status\n"); 75 75 EXIT_STATUS (FALSE); 76 76 } … … 87 87 88 88 if ((argc != 7) && (argc != 3)) { 89 fprintf (stderr, "USAGE: camera readout (buffer) x y dx dy\n");89 gprint (GP_ERR, "USAGE: camera readout (buffer) x y dx dy\n"); 90 90 EXIT_STATUS (FALSE); 91 91 } … … 125 125 126 126 usage: 127 fprintf (stderr, "camera init port\n");128 fprintf (stderr, "camera expose exptime\n");129 fprintf (stderr, "camera readout x y dx dy\n");130 fprintf (stderr, "camera temp set value\n");131 fprintf (stderr, "camera temp get var\n");127 gprint (GP_ERR, "camera init port\n"); 128 gprint (GP_ERR, "camera expose exptime\n"); 129 gprint (GP_ERR, "camera readout x y dx dy\n"); 130 gprint (GP_ERR, "camera temp set value\n"); 131 gprint (GP_ERR, "camera temp get var\n"); 132 132 seteuid (UID); 133 133 return (FALSE); -
trunk/Ohana/src/opihi/dimm/dimm.c
r5919 r7917 34 34 /* standard welcome message */ 35 35 void welcome () { 36 fprintf (stderr, "\n");37 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);36 gprint (GP_ERR, "\n"); 37 gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 38 38 } 39 39 -
trunk/Ohana/src/opihi/dimm/findstars.c
r2598 r7917 19 19 20 20 if (argc != 3) { 21 fprintf (stderr, "USAGE: findstars (buffer) (threshold)\n");21 gprint (GP_ERR, "USAGE: findstars (buffer) (threshold)\n"); 22 22 return (FALSE); 23 23 } … … 133 133 *x = Sx / So; 134 134 *y = Sy / So; 135 fprintf (stderr, "%f %f %f %d\n", *x, *y, So, Npixlist);135 gprint (GP_ERR, "%f %f %f %d\n", *x, *y, So, Npixlist); 136 136 137 137 No = vecx[0].Nelements; -
trunk/Ohana/src/opihi/dimm/sbig/sp_ccdcontrol.c
r2598 r7917 36 36 static int readout_callback(float percent) 37 37 { 38 fprintf(stderr, "progress: Reading %d x %d pixels (%d%%)\r",38 gprint (GP_ERR, "progress: Reading %d x %d pixels (%d%%)\r", 39 39 readout.width, readout.height, (int)percent); 40 40 /* return 1 to continue, 0 to abort */ … … 60 60 61 61 if(binmode<0 || binmode>3){ 62 fprintf(stderr, "Imaging binmode options: [0=1x1, *1=2x2, 2=3x3]\n");62 gprint (GP_ERR, "Imaging binmode options: [0=1x1, *1=2x2, 2=3x3]\n"); 63 63 exit(EXIT_FAILURE); 64 64 } … … 75 75 if (readout.width + x > 76 76 info.camera_info[expose.ccd].readout_mode[readout.binning].width) { 77 fprintf(stderr, "Raster X or Width parameter out of range.\n");77 gprint (GP_ERR, "Raster X or Width parameter out of range.\n"); 78 78 exit(EXIT_FAILURE); 79 79 } … … 85 85 if (readout.height + y > 86 86 info.camera_info[expose.ccd].readout_mode[readout.binning].height) { 87 fprintf(stderr, "Raster Y or Height parameter out of range.\n");87 gprint (GP_ERR, "Raster Y or Height parameter out of range.\n"); 88 88 exit(EXIT_FAILURE); 89 89 } … … 98 98 ret = sbig_expose(&expose); 99 99 if (ret < 0) 100 fprintf(stderr, "sbig error: %s\n", sbig_show_error(ret));100 gprint (GP_ERR, "sbig error: %s\n", sbig_show_error(ret)); 101 101 102 fprintf(stderr, "progress: Sleeping for %g seconds\r", 0.01*expose.exposure_time);102 gprint (GP_ERR, "progress: Sleeping for %g seconds\r", 0.01*expose.exposure_time); 103 103 104 104 if (expose.exposure_time > 100) { 105 105 for (i = 0; i < expose.exposure_time; i += 100) { 106 106 sbig_get_status(&status); 107 fprintf(stderr, "progress: Exposure in progress; ccd_status=%d, shutter=%d (%d%%)\r",107 gprint (GP_ERR, "progress: Exposure in progress; ccd_status=%d, shutter=%d (%d%%)\r", 108 108 status.imaging_ccd_status, status.shutter_state, 109 109 i * 100 / expose.exposure_time); … … 114 114 115 115 /* wait for exposure to complete */ 116 fprintf(stderr, "progress: Waiting for controller (100%%)\r");116 gprint (GP_ERR, "progress: Waiting for controller (100%%)\r"); 117 117 118 118 for (i = 0; i < 1000; ++i) { 119 119 ret = sbig_get_status(&status); 120 120 if (ret < 0) { 121 fprintf(stderr, "sbig error: %s\n", sbig_show_error(ret));121 gprint (GP_ERR, "sbig error: %s\n", sbig_show_error(ret)); 122 122 break; 123 123 } 124 124 if (status.imaging_ccd_status != 3) 125 fprintf(stderr, "logonly: ccd_status=%d\n", status.imaging_ccd_status);125 gprint (GP_ERR, "logonly: ccd_status=%d\n", status.imaging_ccd_status); 126 126 127 127 if (readout.ccd == 0) { … … 135 135 } 136 136 if (i) 137 fprintf(stderr, "warning: Exposure took an extra %g seconds\n", 0.050*i);137 gprint (GP_ERR, "warning: Exposure took an extra %g seconds\n", 0.050*i); 138 138 139 139 if (i == 1000) 140 fprintf(stderr, "error: EXPOSURE DIDN'T FINISH!\n");140 gprint (GP_ERR, "error: EXPOSURE DIDN'T FINISH!\n"); 141 141 else 142 fprintf(stderr, "progress: Exposure complete (100%%)\n");142 gprint (GP_ERR, "progress: Exposure complete (100%%)\n"); 143 143 144 144 readout.ccd = expose.ccd; … … 156 156 sync(); 157 157 if ((ret = sbig_readout(&readout)) < 0) { 158 fprintf(stderr, "sbig error: %s\n", sbig_show_error(ret));158 gprint (GP_ERR, "sbig error: %s\n", sbig_show_error(ret)); 159 159 return; 160 160 } 161 161 162 fprintf(stderr, "progress: Writing FITS data to stdout\n");162 gprint (GP_ERR, "progress: Writing FITS data to stdout\n"); 163 163 164 164 if(write_fits(readout.width, readout.height, etime, binmode, buffer)==-1) 165 fprintf(stderr, "error: Could not write FITS file to stdout.\n");166 fprintf(stderr, "progress: sp_ccdcontrol done.\n");165 gprint (GP_ERR, "error: Could not write FITS file to stdout.\n"); 166 gprint (GP_ERR, "progress: sp_ccdcontrol done.\n"); 167 167 } 168 168 … … 184 184 185 185 if (ret < 0) { 186 fprintf(stderr, "error: sbig_get_status failed: %s\n", sbig_show_error(ret));186 gprint (GP_ERR, "error: sbig_get_status failed: %s\n", sbig_show_error(ret)); 187 187 exit(EXIT_FAILURE); 188 188 } … … 262 262 exit(EXIT_FAILURE); 263 263 264 fprintf(stderr, "logonly: Wrote %d pixels, min=%g, max=%g\n", w*h, datamin, datamax);264 gprint (GP_ERR, "logonly: Wrote %d pixels, min=%g, max=%g\n", w*h, datamin, datamax); 265 265 sync(); 266 266 return 0; … … 268 268 269 269 static void show_format(void){ 270 fprintf(stderr, "Format for sp_ccdcontrol, SkyProbe CCD controller:\n"270 gprint (GP_ERR, "Format for sp_ccdcontrol, SkyProbe CCD controller:\n" 271 271 "Writes FITS file to stdout, status messages to stderr.\n" 272 272 "NOTE: -port {hex} is an option for all forms of sp_ccdcontrol,\n" … … 310 310 if (!strcmp(argv[i], "-port")) { 311 311 sscanf(argv[++i], "%x", &port); 312 fprintf(stderr, "port override to 0x%x\n", port);312 gprint (GP_ERR, "port override to 0x%x\n", port); 313 313 } 314 314 } … … 322 322 */ 323 323 if (ret == 0) break; 324 fprintf(stderr,"logonly: sbig_init() failed: %s\n", sbig_show_error(ret));324 gprint (GP_ERR,"logonly: sbig_init() failed: %s\n", sbig_show_error(ret)); 325 325 usleep(100000); 326 326 } 327 327 if (ret < 0) { 328 fprintf(stderr, "error: cannot open camera, giving up\n");328 gprint (GP_ERR, "error: cannot open camera, giving up\n"); 329 329 exit(EXIT_FAILURE); 330 330 } … … 336 336 rmp = &info.camera_info[0].readout_mode[i]; 337 337 #ifdef DEBUG 338 fprintf(stderr, "debug: ImagingCCD mode %d: w=%d h=%d "338 gprint (GP_ERR, "debug: ImagingCCD mode %d: w=%d h=%d " 339 339 "gain=%f " 340 340 "pw=%g ph=%g\n", rmp->mode, rmp->width, … … 349 349 rmp = &info.camera_info[1].readout_mode[i]; 350 350 #ifdef DEBUG 351 fprintf(stderr, "debug: TrackingCCD mode %d: w=%d h=%d "351 gprint (GP_ERR, "debug: TrackingCCD mode %d: w=%d h=%d " 352 352 "gain=%f " 353 353 "pw=%g ph=%g\n" … … 363 363 if(argc>(i+1)) etime = atof(argv[++i]); 364 364 else 365 fprintf(stderr, "No argument given to -etime\n");365 gprint (GP_ERR, "No argument given to -etime\n"); 366 366 } 367 367 } 368 368 if(etime==-999.){ 369 fprintf(stderr, "Must specify exposure time.\n");369 gprint (GP_ERR, "Must specify exposure time.\n"); 370 370 exit(EXIT_FAILURE); 371 371 } … … 376 376 if(argc>(i+1)) binmode = atoi(argv[++i]); 377 377 else{ 378 fprintf(stderr, "No argument given for -binmode\n");378 gprint (GP_ERR, "No argument given for -binmode\n"); 379 379 exit(EXIT_FAILURE); 380 380 } … … 388 388 if (argc>(i+1)) shuttermode = atoi(argv[++i]); 389 389 else{ 390 fprintf(stderr, "No argument given for -shuttermode\n");390 gprint (GP_ERR, "No argument given for -shuttermode\n"); 391 391 exit(EXIT_FAILURE); 392 392 } … … 407 407 } 408 408 else{ 409 fprintf(stderr, "-raster requires 4 arguments: x y w h\n");409 gprint (GP_ERR, "-raster requires 4 arguments: x y w h\n"); 410 410 exit(EXIT_FAILURE); 411 411 } … … 420 420 421 421 if(argc<3){ 422 fprintf(stderr, "Too few arguments for cool mode\n");422 gprint (GP_ERR, "Too few arguments for cool mode\n"); 423 423 exit(EXIT_FAILURE); 424 424 } … … 426 426 427 427 if(coolmode<0 || coolmode>2){ 428 fprintf(stderr, "Cooling mode values allowed: [0 Off, 1 *On, 2 DirectDrive]\n");428 gprint (GP_ERR, "Cooling mode values allowed: [0 Off, 1 *On, 2 DirectDrive]\n"); 429 429 exit(EXIT_FAILURE); 430 430 } … … 433 433 if (cool.regulation == 2){ 434 434 if(argc<4){ 435 fprintf(stderr, "Must specify cooling power (0-255)\n");435 gprint (GP_ERR, "Must specify cooling power (0-255)\n"); 436 436 exit(EXIT_FAILURE); 437 437 } 438 438 coolpwr=atof(argv[3]); 439 439 if(coolpwr<0 || coolpwr>255){ 440 fprintf(stderr, "Cooling power must be 0-255.\n");440 gprint (GP_ERR, "Cooling power must be 0-255.\n"); 441 441 exit(EXIT_FAILURE); 442 442 } … … 445 445 else if (cool.regulation == 1) { 446 446 if(argc<4){ 447 fprintf(stderr, "Must specify temperature in deg C\n");447 gprint (GP_ERR, "Must specify temperature in deg C\n"); 448 448 exit(EXIT_FAILURE); 449 449 } 450 450 cooltemp=atof(argv[3]); 451 451 if(cooltemp<-50 || cooltemp>20){ 452 fprintf(stderr, "Cooling temperature must be -50 to 20 deg C.\n");452 gprint (GP_ERR, "Cooling temperature must be -50 to 20 deg C.\n"); 453 453 exit(EXIT_FAILURE); 454 454 } … … 460 460 ret = sbig_set_cooling(&cool); 461 461 if (ret < 0){ 462 fprintf(stderr, "sbig error: %s\n", sbig_show_error(ret));462 gprint (GP_ERR, "sbig error: %s\n", sbig_show_error(ret)); 463 463 } 464 464 }else{ 465 fprintf(stderr, "Illegal command: '%s'\n", cmd);465 gprint (GP_ERR, "Illegal command: '%s'\n", cmd); 466 466 show_format(); 467 467 } -
trunk/Ohana/src/opihi/dimm/telescope.c
r2598 r7917 9 9 if (!strcasecmp (argv[1], "init")) { 10 10 if (argc != 3) { 11 fprintf (stderr, "USAGE: telescope init (port)\n");11 gprint (GP_ERR, "USAGE: telescope init (port)\n"); 12 12 return (FALSE); 13 13 } 14 14 if (!SerialInit (argv[2])) return (FALSE); 15 fprintf (stderr, "telescope on port %s\n", argv[2]);15 gprint (GP_ERR, "telescope on port %s\n", argv[2]); 16 16 return (TRUE); 17 17 } … … 23 23 24 24 if (argc != 3) { 25 fprintf (stderr, "USAGE: telescope cmd (string)\n");25 gprint (GP_ERR, "USAGE: telescope cmd (string)\n"); 26 26 return (FALSE); 27 27 } 28 28 status = SerialCommand (argv[2], &answer, 10); 29 fprintf (stderr, "status: %d\n", status);29 gprint (GP_ERR, "status: %d\n", status); 30 30 if (answer != (char *) NULL) { 31 fprintf (stderr, "answer: ..%s..\n", answer);31 gprint (GP_ERR, "answer: ..%s..\n", answer); 32 32 } 33 33 return (TRUE); … … 40 40 41 41 if (argc != 3) { 42 fprintf (stderr, "USAGE: telescope cmd (string)\n");42 gprint (GP_ERR, "USAGE: telescope cmd (string)\n"); 43 43 return (FALSE); 44 44 } … … 46 46 line[1] = 0; 47 47 status = SerialCommand (line, &answer, 10); 48 fprintf (stderr, "status: %d\n", status);48 gprint (GP_ERR, "status: %d\n", status); 49 49 if (answer != (char *) NULL) { 50 fprintf (stderr, "answer: ..%s..\n", answer);50 gprint (GP_ERR, "answer: ..%s..\n", answer); 51 51 } 52 52 return (TRUE); … … 59 59 60 60 if (argc != 4) { 61 fprintf (stderr, "USAGE: telescope slew (ra) (dec)\n");61 gprint (GP_ERR, "USAGE: telescope slew (ra) (dec)\n"); 62 62 return (FALSE); 63 63 } … … 81 81 82 82 if (argc != 2) { 83 fprintf (stderr, "USAGE: telescope coords\n");83 gprint (GP_ERR, "USAGE: telescope coords\n"); 84 84 return (FALSE); 85 85 } 86 86 87 87 if (!getRD (&ra, &dec)) return (FALSE); 88 fprintf (stderr, "%f %f\n", ra, dec);88 gprint (GP_ERR, "%f %f\n", ra, dec); 89 89 set_variable ("RA", ra); 90 90 set_variable ("DEC", dec); … … 103 103 104 104 if (argc != 2) { 105 fprintf (stderr, "USAGE: telescope altaz\n");105 gprint (GP_ERR, "USAGE: telescope altaz\n"); 106 106 return (FALSE); 107 107 } 108 108 109 109 if (!getXY (&x, &y)) return (FALSE); 110 fprintf (stderr, "%f %f\n", x, y);110 gprint (GP_ERR, "%f %f\n", x, y); 111 111 set_variable ("ALT", x); 112 112 set_variable ("AZ", y); … … 120 120 121 121 if (argc != 2) { 122 fprintf (stderr, "USAGE: telescope site\n");122 gprint (GP_ERR, "USAGE: telescope site\n"); 123 123 return (FALSE); 124 124 } 125 125 126 126 if (!getSite (&lon, &lat, &LST)) return (FALSE); 127 fprintf (stderr, "%f %f %f\n", lon, lat, LST);127 gprint (GP_ERR, "%f %f %f\n", lon, lat, LST); 128 128 set_variable ("LON", lon); 129 129 set_variable ("LAT", lat); … … 137 137 138 138 if (argc != 5) { 139 fprintf (stderr, "USAGE: telescope setsite (name) (longitude) (latitude)\n");139 gprint (GP_ERR, "USAGE: telescope setsite (name) (longitude) (latitude)\n"); 140 140 return (FALSE); 141 141 } … … 152 152 153 153 if (argc != 3) { 154 fprintf (stderr, "USAGE: telescope settime (lst)\n");154 gprint (GP_ERR, "USAGE: telescope settime (lst)\n"); 155 155 return (FALSE); 156 156 } … … 165 165 166 166 if (argc != 3) { 167 fprintf (stderr, "USAGE: telescope verbose (mode)\n");167 gprint (GP_ERR, "USAGE: telescope verbose (mode)\n"); 168 168 return (FALSE); 169 169 } … … 180 180 181 181 if (argc != 4) { 182 fprintf (stderr, "USAGE: telescope setcoords (ra) (dec)\n");182 gprint (GP_ERR, "USAGE: telescope setcoords (ra) (dec)\n"); 183 183 return (FALSE); 184 184 } … … 196 196 197 197 if (argc != 4) { 198 fprintf (stderr, "USAGE: telescope offset (direction) (distance)\n");199 fprintf (stderr, " direction : x or y\n");200 fprintf (stderr, " distance : +arcmin or -arcmin\n");198 gprint (GP_ERR, "USAGE: telescope offset (direction) (distance)\n"); 199 gprint (GP_ERR, " direction : x or y\n"); 200 gprint (GP_ERR, " distance : +arcmin or -arcmin\n"); 201 201 return (FALSE); 202 202 } … … 212 212 213 213 if (argc != 5) { 214 fprintf (stderr, "USAGE: telescope toffset (direction) (rate) (duration)\n");215 fprintf (stderr, "example: telescope toffset x RC 1.5\n");214 gprint (GP_ERR, "USAGE: telescope toffset (direction) (rate) (duration)\n"); 215 gprint (GP_ERR, "example: telescope toffset x RC 1.5\n"); 216 216 return (FALSE); 217 217 } … … 223 223 224 224 usage: 225 fprintf (stderr, "telescope init port - set serial port (eg, /dev/ttyS0)\n");226 fprintf (stderr, "telescope site - get site information\n");227 fprintf (stderr, "telescope altaz - g\n");228 fprintf (stderr, "telescope setcoords (ra) (dec)\n");229 fprintf (stderr, "telescope setsite (name) (longitute) (latitude)\n");230 fprintf (stderr, "telescope coords\n");231 fprintf (stderr, "telescope slew (ra) (dec)\n");232 fprintf (stderr, "telescope offset (direction) (duration)\n");233 fprintf (stderr, "telescope toffset (direction) (rate) (duration)\n");225 gprint (GP_ERR, "telescope init port - set serial port (eg, /dev/ttyS0)\n"); 226 gprint (GP_ERR, "telescope site - get site information\n"); 227 gprint (GP_ERR, "telescope altaz - g\n"); 228 gprint (GP_ERR, "telescope setcoords (ra) (dec)\n"); 229 gprint (GP_ERR, "telescope setsite (name) (longitute) (latitude)\n"); 230 gprint (GP_ERR, "telescope coords\n"); 231 gprint (GP_ERR, "telescope slew (ra) (dec)\n"); 232 gprint (GP_ERR, "telescope offset (direction) (duration)\n"); 233 gprint (GP_ERR, "telescope toffset (direction) (rate) (duration)\n"); 234 234 return (FALSE); 235 235 } -
trunk/Ohana/src/opihi/dimm/version.c
r7080 r7917 4 4 int version (int argc, char **argv) { 5 5 6 fprintf (stderr, "%s\n", name);6 gprint (GP_ERR, "%s\n", name); 7 7 8 fprintf (stderr, "%s\n", opihi_version());9 fprintf (stderr, "%s\n", ohana_version());10 fprintf (stderr, "%s\n", gfits_version());8 gprint (GP_ERR, "%s\n", opihi_version()); 9 gprint (GP_ERR, "%s\n", ohana_version()); 10 gprint (GP_ERR, "%s\n", gfits_version()); 11 11 12 fprintf (stderr, "compiled on %s %s\n", __DATE__, __TIME__);12 gprint (GP_ERR, "compiled on %s %s\n", __DATE__, __TIME__); 13 13 return (TRUE); 14 14 } -
trunk/Ohana/src/opihi/doc/ippc_commandserver.c
r3419 r7917 40 40 41 41 if (IPPC_DEFAULT_VERBOSITY > 1) { 42 fprintf(stderr, "%s : THIS PROGRAM _IS_ A REMOTE EXPLOIT!!!\n", argv[0]);42 gprint (GP_ERR, "%s : THIS PROGRAM _IS_ A REMOTE EXPLOIT!!!\n", argv[0]); 43 43 } 44 44 … … 78 78 while(1) { 79 79 if (IPPC_DEFAULT_VERBOSITY > 1) { 80 fprintf(stderr, "%s : pid: %d - waiting for connection...\n", argv[0], getpid());80 gprint (GP_ERR, "%s : pid: %d - waiting for connection...\n", argv[0], getpid()); 81 81 } 82 82 … … 86 86 } else { 87 87 if (IPPC_DEFAULT_VERBOSITY > 1) { 88 fprintf(stderr, "%s : pid: %d - kids: %d - child limit already reached, sleeping %ds...\n",88 gprint (GP_ERR, "%s : pid: %d - kids: %d - child limit already reached, sleeping %ds...\n", 89 89 argv[0], getpid(), kids, WAIT_FOR_KIDS); 90 90 } … … 98 98 if (fork() == 0) { 99 99 if (IPPC_DEFAULT_VERBOSITY > 1) { 100 fprintf(stderr, "%s : pid: %d - new kid number: %d\n", argv[0], getpid(), kids);100 gprint (GP_ERR, "%s : pid: %d - new kid number: %d\n", argv[0], getpid(), kids); 101 101 } 102 102 … … 110 110 if (ntohl(auth_token) != COMMAND_KEY) { 111 111 if (IPPC_DEFAULT_VERBOSITY > 1) { 112 fprintf(stderr, "%s : pid: %d - invalid authentication key\n", argv[0], getpid());112 gprint (GP_ERR, "%s : pid: %d - invalid authentication key\n", argv[0], getpid()); 113 113 } 114 114 … … 124 124 125 125 if (IPPC_DEFAULT_VERBOSITY > 1) { 126 fprintf(stderr, "%s : pid: %d - recieved: %s\n", argv[0], getpid(), buffer);126 gprint (GP_ERR, "%s : pid: %d - recieved: %s\n", argv[0], getpid(), buffer); 127 127 } 128 128 … … 131 131 if (status != 0) { 132 132 if (IPPC_DEFAULT_VERBOSITY > 1) { 133 fprintf(stderr, "%s : pid: %d - command failed - code: %d\n", argv[0], getpid(), status);133 gprint (GP_ERR, "%s : pid: %d - command failed - code: %d\n", argv[0], getpid(), status); 134 134 } 135 135 netSafe = htons(status); … … 137 137 } else { 138 138 if (IPPC_DEFAULT_VERBOSITY > 1) { 139 fprintf(stderr, "%s : pid: %d - command successful\n", argv[0], getpid());139 gprint (GP_ERR, "%s : pid: %d - command successful\n", argv[0], getpid()); 140 140 } 141 141 netSafe = htons(status); -
trunk/Ohana/src/opihi/doc/sample.c
r2598 r7917 7 7 8 8 for (i = 0; i <= argc; i++) { 9 fprintf (stderr, "arg %2d: %s\n", i, argv[i]);9 gprint (GP_ERR, "arg %2d: %s\n", i, argv[i]); 10 10 } 11 11 while (argv[i] != NULL) { 12 fprintf (stderr, "env %2d: %s\n", i, argv[i]);12 gprint (GP_ERR, "env %2d: %s\n", i, argv[i]); 13 13 i++; 14 14 } 15 15 while (fscanf (stdin, "%s", line) != EOF) { 16 fprintf (stderr, "line: ...%s...\n", line);16 gprint (GP_ERR, "line: ...%s...\n", line); 17 17 } 18 18 } -
trunk/Ohana/src/opihi/dvo/ImageSelection.c
r7680 r7917 22 22 Ngraph = 0; 23 23 if (!GetGraphData (&graphsky, NULL, &Ngraph)) { 24 fprintf (stderr, "region display not available\n");24 gprint (GP_ERR, "region display not available\n"); 25 25 return (FALSE); 26 26 } -
trunk/Ohana/src/opihi/dvo/LoadImages.c
r7680 r7917 17 17 18 18 if (!gfits_db_lock (&db, filename)) { 19 fprintf (stderr, "error opening image catalog %s (1)\n", filename);19 gprint (GP_ERR, "error opening image catalog %s (1)\n", filename); 20 20 return (NULL); 21 21 } 22 22 23 23 if (db.dbstate == LCK_EMPTY) { 24 fprintf (stderr, "note: image catalog is empty\n");24 gprint (GP_ERR, "note: image catalog is empty\n"); 25 25 ALLOCATE (image, Image, 1); 26 26 *nimage = 1; -
trunk/Ohana/src/opihi/dvo/addxtra.c
r7680 r7917 40 40 41 41 if (argc != 6) { 42 fprintf (stderr, "USAGE: addxtra R D radius (type) (value)\n");42 gprint (GP_ERR, "USAGE: addxtra R D radius (type) (value)\n"); 43 43 return (FALSE); 44 44 } -
trunk/Ohana/src/opihi/dvo/aregion.c
r7680 r7917 38 38 } 39 39 if (NBigDec < 0) { 40 fprintf (stderr, "dec out of range: %f\n", dec);40 gprint (GP_ERR, "dec out of range: %f\n", dec); 41 41 } 42 42 … … 63 63 64 64 if (!done) { 65 fprintf (stderr, "error in search: %f %f\n", ra, dec);65 gprint (GP_ERR, "error in search: %f %f\n", ra, dec); 66 66 exit (0); 67 67 } -
trunk/Ohana/src/opihi/dvo/avextract.c
r7680 r7917 90 90 91 91 usage: 92 fprintf (stderr, "USAGE: avextract (value) [options]\n");93 fprintf (stderr, " value: average.parameter or photcode\n");92 gprint (GP_ERR, "USAGE: avextract (value) [options]\n"); 93 gprint (GP_ERR, " value: average.parameter or photcode\n"); 94 94 95 95 escape: -
trunk/Ohana/src/opihi/dvo/badimages.c
r7680 r7917 14 14 15 15 if (argc != 3) { 16 fprintf (stderr, "USAGE: badimages entry value\n");17 fprintf (stderr, " OR: badimages -image N\n");16 gprint (GP_ERR, "USAGE: badimages entry value\n"); 17 gprint (GP_ERR, " OR: badimages -image N\n"); 18 18 return (FALSE); 19 19 } … … 38 38 ptr = &image[entry].coords.crpix1; 39 39 for (i = 0; i < 22; i++) { 40 fprintf (GetOutfile(), "%2d: %g\n", i, ptr[i]);40 gprint (GP_LOG, "%2d: %g\n", i, ptr[i]); 41 41 } 42 42 value = image[entry].coords.pc1_1*image[entry].coords.pc2_2 + image[entry].coords.pc1_2*image[entry].coords.pc2_1; 43 fprintf (GetOutfile(), " x: %g\n", value);43 gprint (GP_LOG, " x: %g\n", value); 44 44 return (TRUE); 45 45 } … … 57 57 value = image[i].coords.pc1_1*image[i].coords.pc2_2 + image[i].coords.pc1_2*image[i].coords.pc2_1; 58 58 if ((value > big) || (value < small)) { 59 fprintf (GetOutfile(), "%5d %s: %d %g\n", i, image[i].name, image[i].tzero, value);59 gprint (GP_LOG, "%5d %s: %d %g\n", i, image[i].name, image[i].tzero, value); 60 60 } 61 61 } … … 64 64 ptr = &image[i].coords.crpix1; 65 65 if ((ptr[entry] > big) || (ptr[entry] < small)) { 66 fprintf (GetOutfile(), "%5d %s: %d %g\n", i, image[i].name, image[i].tzero, ptr[entry]);66 gprint (GP_LOG, "%5d %s: %d %g\n", i, image[i].name, image[i].tzero, ptr[entry]); 67 67 } 68 68 } -
trunk/Ohana/src/opihi/dvo/calextract.c
r7680 r7917 58 58 59 59 for (Nr = 0; Nr < skylist[0].Nregions; Nr++) { 60 if (Nr && !(Nr % 500)) { fprintf (stderr, "."); }60 if (Nr && !(Nr % 500)) { gprint (GP_ERR, "."); } 61 61 62 62 /* lock, load, unlock catalog */ … … 77 77 /* extract values, assign to vectors */ 78 78 for (i = 0; i < catalog.Naverage; i++) { 79 if (i && !(i % 10000)) { fprintf (stderr, ","); }79 if (i && !(i % 10000)) { gprint (GP_ERR, ","); } 80 80 m = catalog.average[i].offset; 81 81 … … 130 130 131 131 usage: 132 fprintf (stderr, "USAGE: calextract F - F\n");132 gprint (GP_ERR, "USAGE: calextract F - F\n"); 133 133 return (FALSE); 134 134 -
trunk/Ohana/src/opihi/dvo/calmextract.c
r7680 r7917 71 71 72 72 for (Nr = 0; Nr < skylist[0].Nregions; Nr++) { 73 if (Nr && !(Nr % 500)) { fprintf (stderr, "."); }73 if (Nr && !(Nr % 500)) { gprint (GP_ERR, "."); } 74 74 75 75 /* lock, load, unlock catalog */ … … 157 157 158 158 usage: 159 fprintf (stderr, "USAGE: dmags F - F : measure.param\n");159 gprint (GP_ERR, "USAGE: dmags F - F : measure.param\n"); 160 160 return (FALSE); 161 161 … … 178 178 value = ExtractMeasures (code, mode, average, secfilt, measure, &N, param); 179 179 if (N != Nin) { 180 fprintf (stderr, "error!\n");180 gprint (GP_ERR, "error!\n"); 181 181 return (FALSE); 182 182 } -
trunk/Ohana/src/opihi/dvo/catalog.c
r7680 r7917 49 49 NN = get_argument (argc, argv, "-n"); 50 50 if (NN && Nn) { 51 fprintf (stderr, "can't mix meas and miss scaling\n");51 gprint (GP_ERR, "can't mix meas and miss scaling\n"); 52 52 return (FALSE); 53 53 } … … 163 163 164 164 if ((InRegion || (argc != 2)) && (!InRegion || (argc != 1))) { 165 fprintf (stderr, "USAGE: catalog (filename / -all) [-m M M] [-n N N] [-g] [-a RA DEC MAG] \n");165 gprint (GP_ERR, "USAGE: catalog (filename / -all) [-m M M] [-n N N] [-g] [-a RA DEC MAG] \n"); 166 166 return (FALSE); 167 167 } … … 185 185 f = fopen (argv[1], "r"); 186 186 if (f == (FILE *) NULL) { 187 fprintf (stderr, "ERROR: can't open catalog file: %s\n", argv[1]);187 gprint (GP_ERR, "ERROR: can't open catalog file: %s\n", argv[1]); 188 188 return (FALSE); 189 189 } … … 225 225 f = fopen (argv[1], "r"); 226 226 if (f == (FILE *) NULL) { 227 fprintf (stderr, "ERROR: can't open catalog file: %s\n", argv[1]);227 gprint (GP_ERR, "ERROR: can't open catalog file: %s\n", argv[1]); 228 228 return (FALSE); 229 229 } … … 274 274 f = fopen (filename, "r"); 275 275 if (f == (FILE *) NULL) { 276 fprintf (stderr, "no stars in %s, skipping\n", filename);276 gprint (GP_ERR, "no stars in %s, skipping\n", filename); 277 277 continue; 278 278 /* return (FALSE); */ -
trunk/Ohana/src/opihi/dvo/catdir.c
r7680 r7917 13 13 14 14 if (argc != 2) { 15 fprintf (stderr, "USAGE: catdir (name)\n");16 fprintf (stderr, " (name) may be a path or 'default'\n");15 gprint (GP_ERR, "USAGE: catdir (name)\n"); 16 gprint (GP_ERR, " (name) may be a path or 'default'\n"); 17 17 current = GetCATDIR (); 18 18 if (current == NULL) { 19 fprintf (stderr, "catdir not defined\n");19 gprint (GP_ERR, "catdir not defined\n"); 20 20 } else { 21 fprintf (stderr, "current: %s\n", current);21 gprint (GP_ERR, "current: %s\n", current); 22 22 } 23 23 return (FALSE); … … 31 31 32 32 if (!status) { 33 fprintf (stderr, "invalid / undefined CATDIR\n");33 gprint (GP_ERR, "invalid / undefined CATDIR\n"); 34 34 return (FALSE); 35 35 } -
trunk/Ohana/src/opihi/dvo/ccd.c
r7680 r7917 121 121 122 122 usage: 123 fprintf (stderr, "USAGE: ccd F - F : F - F\n");123 gprint (GP_ERR, "USAGE: ccd F - F : F - F\n"); 124 124 return (FALSE); 125 125 -
trunk/Ohana/src/opihi/dvo/cmatch.c
r7680 r7917 9 9 10 10 if (argc != 9) { 11 fprintf (stderr, "USAGE: cmatch file radius (RA) (DEC) (Mag) (dRA) (dDEC) (dMag)\n");12 fprintf (stderr, " match a set of object coordinates with a DVO db table\n");11 gprint (GP_ERR, "USAGE: cmatch file radius (RA) (DEC) (Mag) (dRA) (dDEC) (dMag)\n"); 12 gprint (GP_ERR, " match a set of object coordinates with a DVO db table\n"); 13 13 return (FALSE); 14 14 } 15 15 16 16 /*** this function is not well-defined. re-assess it and re-code it ***/ 17 fprintf (stderr, "disabled for now\n");17 gprint (GP_ERR, "disabled for now\n"); 18 18 return (FALSE); 19 19 … … 41 41 } 42 42 unlock_catalog (&catalog1); 43 fprintf (stderr, "read %d stars from phot catalog file %s\n", catalog1.Naverage, filename);43 gprint (GP_ERR, "read %d stars from phot catalog file %s\n", catalog1.Naverage, filename); 44 44 45 45 /* this is for loading from a text file, presumably hstgsc or usno -
trunk/Ohana/src/opihi/dvo/cmd.c
r7680 r7917 119 119 120 120 usage: 121 fprintf (stderr, "USAGE: cmd F - F : F\n");121 gprint (GP_ERR, "USAGE: cmd F - F : F\n"); 122 122 return (FALSE); 123 123 -
trunk/Ohana/src/opihi/dvo/cmpRead.c
r7680 r7917 39 39 40 40 escape: 41 fprintf (stderr, "error reading file\n");41 gprint (GP_ERR, "error reading file\n"); 42 42 *nstars = 0; 43 43 return (NULL); … … 80 80 nbytes -= Nskip; 81 81 bzero (buffer + nbytes, Nskip); 82 /* if (VERBOSE) fprintf (stderr, "deleted %d extra return chars\n", Nskip); */82 /* if (VERBOSE) gprint (GP_ERR, "deleted %d extra return chars\n", Nskip); */ 83 83 } 84 84 c2 = strchr (c, '\n'); … … 93 93 nbytes -= Nskip; 94 94 bzero (buffer + nbytes, Nskip); 95 /* if (VERBOSE) fprintf (stderr, "deleted line, %d extra chars\n", Nskip); */95 /* if (VERBOSE) gprint (GP_ERR, "deleted line, %d extra chars\n", Nskip); */ 96 96 } else { 97 97 c = c2; -
trunk/Ohana/src/opihi/dvo/cmpload.c
r7680 r7917 32 32 33 33 if (argc != 3) { 34 fprintf (stderr, "USAGE: cmpload (overlay) <filename>\n");34 gprint (GP_ERR, "USAGE: cmpload (overlay) <filename>\n"); 35 35 return (FALSE); 36 36 } 37 37 38 38 if (!gfits_read_header (argv[2], &header)) { 39 fprintf (stderr, "ERROR: can't read header for %s\n", argv[2]);39 gprint (GP_ERR, "ERROR: can't read header for %s\n", argv[2]); 40 40 return (FALSE); 41 41 } … … 44 44 gfits_scan (&header, "NSTARS", "%d", 1, &Nstar); 45 45 if (Nstar == 0) { 46 fprintf (stderr, "ERROR: can't get NSTARS from header\n");46 gprint (GP_ERR, "ERROR: can't get NSTARS from header\n"); 47 47 gfits_free_header (&header); 48 48 return (FALSE); … … 51 51 f = fopen (argv[2], "r"); 52 52 if (f == NULL) { 53 fprintf (stderr, "ERROR: can't read data from %s\n", argv[2]);53 gprint (GP_ERR, "ERROR: can't read data from %s\n", argv[2]); 54 54 gfits_free_header (&header); 55 55 return (FALSE); … … 137 137 free (buffer); 138 138 139 fprintf (stderr, "loaded %d objects\n", Noverlay);139 gprint (GP_ERR, "loaded %d objects\n", Noverlay); 140 140 return (TRUE); 141 141 } -
trunk/Ohana/src/opihi/dvo/cmpread.c
r7680 r7917 16 16 17 17 if (argc != 3) { 18 fprintf (stderr, "USAGE: cmpread field <filename>\n");18 gprint (GP_ERR, "USAGE: cmpread field <filename>\n"); 19 19 return (FALSE); 20 20 } … … 34 34 if (!strcasecmp (argv[1], "galmag")) field = F_GALMAG; 35 35 if (field == F_NONE) { 36 fprintf (stderr, "invalid cmp field: %s\n", argv[1]);36 gprint (GP_ERR, "invalid cmp field: %s\n", argv[1]); 37 37 return (FALSE); 38 38 } … … 42 42 /* load FITS header */ 43 43 if (!gfits_read_header (argv[2], &header)) { 44 fprintf (stderr, "ERROR: can't read header for %s\n", argv[2]);44 gprint (GP_ERR, "ERROR: can't read header for %s\n", argv[2]); 45 45 return (FALSE); 46 46 } … … 48 48 if ((field == F_RA) || (field == F_DEC)) { 49 49 if (!GetCoords (&coords, &header)) { 50 fprintf (stderr, "can't get WCS info from header\n");50 gprint (GP_ERR, "can't get WCS info from header\n"); 51 51 gfits_free_header (&header); 52 52 return (FALSE); … … 57 57 f = fopen (argv[2], "r"); 58 58 if (f == NULL) { 59 fprintf (stderr, "ERROR: can't read data from %s\n", argv[2]);59 gprint (GP_ERR, "ERROR: can't read data from %s\n", argv[2]); 60 60 gfits_free_header (&header); 61 61 return (FALSE); … … 65 65 /* find expected number of stars */ 66 66 if (!gfits_scan (&header, "NSTARS", "%d", 1, &Nstars)) { 67 fprintf (stderr, "ERROR: can't get NSTARS from header\n");67 gprint (GP_ERR, "ERROR: can't get NSTARS from header\n"); 68 68 gfits_free_header (&header); 69 69 return (FALSE); … … 74 74 gfits_scan (&header, "EXTEND", "%t", 1, &extend); 75 75 if (extend) { 76 fprintf (stderr, "reading from FITS cmp file %s\n", argv[2]);76 gprint (GP_ERR, "reading from FITS cmp file %s\n", argv[2]); 77 77 Nbytes = gfits_matrix_size (&header); 78 78 fseek (f, Nbytes, SEEK_CUR); … … 80 80 } else { 81 81 /* allocate space for stars */ 82 fprintf (stderr, "reading from TEXT cmp file %s\n", argv[2]);82 gprint (GP_ERR, "reading from TEXT cmp file %s\n", argv[2]); 83 83 if (!gfits_scan (&header, "NSTARS", "%d", 1, &Nstars)) { 84 fprintf (stderr, "ERROR: failed to find NSTARS\n");84 gprint (GP_ERR, "ERROR: failed to find NSTARS\n"); 85 85 exit (1); 86 86 } … … 139 139 free (stars); 140 140 gfits_free_header (&header); 141 fprintf (stderr, "loaded %d objects\n", Nstars);141 gprint (GP_ERR, "loaded %d objects\n", Nstars); 142 142 return (TRUE); 143 143 } -
trunk/Ohana/src/opihi/dvo/compare.c
r7680 r7917 22 22 23 23 if (!(i % 100)) 24 fprintf (stderr, ".");24 gprint (GP_ERR, "."); 25 25 26 26 if (dX <= -radius) -
trunk/Ohana/src/opihi/dvo/ddmags.c
r7680 r7917 72 72 } 73 73 unlock_catalog (&catalog); 74 // fprintf (stderr, "seaching %s with %d stars\n", catalog.filename, catalog.Naverage);74 // gprint (GP_ERR, "seaching %s with %d stars\n", catalog.filename, catalog.Naverage); 75 75 // ListPhotSelections (); 76 76 … … 112 112 if (M2 != NULL) free (M2); 113 113 } 114 // fprintf (stderr, "selected %d stars\n", Npts);114 // gprint (GP_ERR, "selected %d stars\n", Npts); 115 115 116 116 if (catalog.average != NULL) free (catalog.average); … … 126 126 127 127 usage: 128 fprintf (stderr, "USAGE: ddmags F - F : measure.param\n");128 gprint (GP_ERR, "USAGE: ddmags F - F : measure.param\n"); 129 129 130 130 escape: -
trunk/Ohana/src/opihi/dvo/detrend.c
r7680 r7917 28 28 remove_argument (N, &argc, argv); 29 29 if (!str_to_time (argv[N], &tzero)) { 30 fprintf (stderr, "syntax error\n");30 gprint (GP_ERR, "syntax error\n"); 31 31 return (FALSE); 32 32 } 33 33 remove_argument (N, &argc, argv); 34 34 if (!str_to_dtime (argv[N], &trange)) { 35 fprintf (stderr, "syntax error\n");35 gprint (GP_ERR, "syntax error\n"); 36 36 return (FALSE); 37 37 } … … 46 46 remove_argument (N, &argc, argv); 47 47 if (!str_to_time (argv[N], &tzero)) { 48 fprintf (stderr, "syntax error\n");48 gprint (GP_ERR, "syntax error\n"); 49 49 return (FALSE); 50 50 } 51 51 remove_argument (N, &argc, argv); 52 52 if (!str_to_time (argv[N], &tend)) { 53 fprintf (stderr, "syntax error\n");53 gprint (GP_ERR, "syntax error\n"); 54 54 return (FALSE); 55 55 } … … 69 69 Type = get_image_type (argv[N]); 70 70 if (Type == T_UNDEF) { 71 fprintf (stderr, "ERROR: invalid image type %s\n", argv[N]);71 gprint (GP_ERR, "ERROR: invalid image type %s\n", argv[N]); 72 72 return (FALSE); 73 73 } … … 98 98 99 99 if (argc != 2) { 100 fprintf (stderr, "USAGE: imrough (value)\n");101 return (FALSE); 102 } 103 fprintf (stderr, " this function is not well-defined. re-work and re-code\n");100 gprint (GP_ERR, "USAGE: imrough (value)\n"); 101 return (FALSE); 102 } 103 gprint (GP_ERR, " this function is not well-defined. re-work and re-code\n"); 104 104 return (FALSE); 105 105 … … 114 114 if (!strcasecmp (argv[1], "temp")) mode = TEMP; 115 115 if (mode == ZERO) { 116 fprintf (stderr, "value may be one of the following:\n");117 fprintf (stderr, " exptime, sky, bias, fwhm, airmass, time\n");116 gprint (GP_ERR, "value may be one of the following:\n"); 117 gprint (GP_ERR, " exptime, sky, bias, fwhm, airmass, time\n"); 118 118 return (FALSE); 119 119 } … … 123 123 /* load in database header */ 124 124 if (!gfits_read_header (DataBase, &header)) { 125 fprintf (stderr, "ERROR: trouble reading database header\n");125 gprint (GP_ERR, "ERROR: trouble reading database header\n"); 126 126 return (FALSE); 127 127 } … … 130 130 f = fopen (DataBase, "r"); 131 131 if (f == (FILE *) NULL) { 132 fprintf (stderr, "ERROR: can't open Registration Database\n");132 gprint (GP_ERR, "ERROR: can't open Registration Database\n"); 133 133 return (FALSE); 134 134 } … … 142 142 143 143 if (status != Nimage) { 144 fprintf (stderr, "ERROR: header and data in dB don't match (%d vs %d)\n", Nimage, status);144 gprint (GP_ERR, "ERROR: header and data in dB don't match (%d vs %d)\n", Nimage, status); 145 145 gfits_free_header (&header); 146 146 free (pimage); … … 155 155 156 156 GetTimeFormat (&TimeReference, &TimeFormat); 157 fprintf (stderr, "%ld %d\n", TimeReference, TimeFormat);157 gprint (GP_ERR, "%ld %d\n", TimeReference, TimeFormat); 158 158 159 159 /* get data */ -
trunk/Ohana/src/opihi/dvo/dmagaves.c
r7680 r7917 101 101 102 102 usage: 103 fprintf (stderr, "USAGE: dmagaves F - F : average.param\n");103 gprint (GP_ERR, "USAGE: dmagaves F - F : average.param\n"); 104 104 return (FALSE); 105 105 -
trunk/Ohana/src/opihi/dvo/dmagmeas.c
r7680 r7917 122 122 123 123 usage: 124 fprintf (stderr, "USAGE: dmagmeas F - F : measure.param\n");124 gprint (GP_ERR, "USAGE: dmagmeas F - F : measure.param\n"); 125 125 return (FALSE); 126 126 -
trunk/Ohana/src/opihi/dvo/dmags.c
r7680 r7917 122 122 123 123 usage: 124 fprintf (stderr, "USAGE: dmags F - F : F\n");125 fprintf (stderr, " F : any photcodes with matched qualifiers:\n");126 fprintf (stderr, " pri: F:inst, F:cat, F:sys, F:rel, F:cal, F:ave, F:ref\n");127 fprintf (stderr, " sec: F:inst, F:cat, F:sys, F:rel, F:cal, F:ave, F:ref\n");128 fprintf (stderr, " dep: F:inst, F:cat, F:sys, F:rel, F:cal\n");129 fprintf (stderr, " ref: F:cat\n");124 gprint (GP_ERR, "USAGE: dmags F - F : F\n"); 125 gprint (GP_ERR, " F : any photcodes with matched qualifiers:\n"); 126 gprint (GP_ERR, " pri: F:inst, F:cat, F:sys, F:rel, F:cal, F:ave, F:ref\n"); 127 gprint (GP_ERR, " sec: F:inst, F:cat, F:sys, F:rel, F:cal, F:ave, F:ref\n"); 128 gprint (GP_ERR, " dep: F:inst, F:cat, F:sys, F:rel, F:cal\n"); 129 gprint (GP_ERR, " ref: F:cat\n"); 130 130 131 131 escape: -
trunk/Ohana/src/opihi/dvo/dmt.c
r7680 r7917 32 32 33 33 if (argc != 3) { 34 fprintf (stderr, "USAGE: dmags filter\n");34 gprint (GP_ERR, "USAGE: dmags filter\n"); 35 35 return (FALSE); 36 36 } … … 41 41 42 42 if ((code = GetPhotcodebyName (argv[1])) == NULL) { 43 fprintf (stderr, "ERROR: photcode not found in photcode table\n");43 gprint (GP_ERR, "ERROR: photcode not found in photcode table\n"); 44 44 return (FALSE); 45 45 } 46 46 if ((code[0].type != PHOT_SEC) && (code[0].type != PHOT_PRI)) { 47 fprintf (stderr, "first filter must be a PRIMARY or SECONDARY photometry type\n");47 gprint (GP_ERR, "first filter must be a PRIMARY or SECONDARY photometry type\n"); 48 48 return (FALSE); 49 49 } -
trunk/Ohana/src/opihi/dvo/dvo.c
r7680 r7917 19 19 20 20 if (!SetCATDIR (NULL, FALSE)) { 21 fprintf (stderr, "CATDIR is not defined\n");21 gprint (GP_ERR, "CATDIR is not defined\n"); 22 22 } 23 23 … … 38 38 /* standard welcome message */ 39 39 void welcome () { 40 fprintf (stderr, "\n");41 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);40 gprint (GP_ERR, "\n"); 41 gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 42 42 } 43 43 -
trunk/Ohana/src/opihi/dvo/elixir.c
r7680 r7917 30 30 31 31 if (argc != 2) { 32 fprintf (stderr, "USAGE: elixir (elixir) [-time] [-live]\n");32 gprint (GP_ERR, "USAGE: elixir (elixir) [-time] [-live]\n"); 33 33 return (FALSE); 34 34 } 35 35 36 36 if (!VarConfig (argv[1], "%s", ElixirBase)) { 37 fprintf (stderr, "elixir %s not in config file\n", argv[1]);37 gprint (GP_ERR, "elixir %s not in config file\n", argv[1]); 38 38 return (FALSE); 39 39 } 40 40 sprintf (fifo, "%s.msg", ElixirBase); 41 41 if (!VarConfig ("FIFOS", "%s", fifodir)) { 42 fprintf (stderr, "FIFOS not in config, using local /tmp\n");42 gprint (GP_ERR, "FIFOS not in config, using local /tmp\n"); 43 43 strcpy (fifodir, "/tmp"); 44 44 } … … 51 51 52 52 if (!WriteMsg (fifo, message)) { 53 fprintf (stderr, "can't access fifo %s\n", fifo);53 gprint (GP_ERR, "can't access fifo %s\n", fifo); 54 54 return (FALSE); 55 55 } 56 56 57 57 if (ReadMsg (msgfile, &answer)) { 58 fprintf (stderr, "%s\n", answer);58 gprint (GP_ERR, "%s\n", answer); 59 59 } 60 60 unlink (msgfile); … … 96 96 } 97 97 if (i >= 20) { 98 fprintf (stderr, "no response\n");98 gprint (GP_ERR, "no response\n"); 99 99 return (0); 100 100 } … … 103 103 f = fsetlockfile (fifo, 2.0, LCK_XCLD, &state); 104 104 if (f == NULL) { 105 fprintf (stderr, "message locked (%d)\n", state);105 gprint (GP_ERR, "message locked (%d)\n", state); 106 106 return (0); 107 107 } … … 121 121 nbytes = fread (&buffer[Nbytes], 1, 0x1000, f); 122 122 if (nbytes < 0) { 123 fprintf (stderr, "error in ReadMsg -- got -1 bytes\n");123 gprint (GP_ERR, "error in ReadMsg -- got -1 bytes\n"); 124 124 return (0); 125 125 } -
trunk/Ohana/src/opihi/dvo/extract.c
r7680 r7917 66 66 remove_argument (N, &argc, argv); 67 67 if ((code = GetPhotcodebyName (argv[N])) == NULL) { 68 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", argv[N]);68 gprint (GP_ERR, "ERROR: photcode %s not found in photcode table\n", argv[N]); 69 69 return (FALSE); 70 70 } … … 73 73 74 74 if (argc != 3) { 75 fprintf (stderr, "USAGE: extract (filename) (value) [-g / -a Ncol] \n");75 gprint (GP_ERR, "USAGE: extract (filename) (value) [-g / -a Ncol] \n"); 76 76 return (FALSE); 77 77 } … … 99 99 if (!strcasecmp (argv[2], "Ncode")) mode = NCODE; 100 100 if (mode == ZERO) { 101 fprintf (stderr, "value may be one of the following:\n");102 fprintf (stderr, " ra dec mag Nmeas Nmiss Xp Xm ID\n");101 gprint (GP_ERR, "value may be one of the following:\n"); 102 gprint (GP_ERR, " ra dec mag Nmeas Nmiss Xp Xm ID\n"); 103 103 return (FALSE); 104 104 } … … 106 106 107 107 if ((mode == REF) && !PhotcodeSelect) { 108 fprintf (stderr, "must specify photcode for Reference\n");108 gprint (GP_ERR, "must specify photcode for Reference\n"); 109 109 return (FALSE); 110 110 } 111 111 if ((mode == TYPE) && !PhotcodeSelect) { 112 fprintf (stderr, "must specify photcode for Type\n");112 gprint (GP_ERR, "must specify photcode for Type\n"); 113 113 return (FALSE); 114 114 } … … 120 120 Ns = GetPhotcodeNsec (code[0].code); 121 121 if ((mode != REF) && (code[0].type != PHOT_SEC) && (code[0].type != PHOT_PRI)) { 122 fprintf (stderr, "filter must be a PRIMARY or SECONDARY photometry type\n");122 gprint (GP_ERR, "filter must be a PRIMARY or SECONDARY photometry type\n"); 123 123 return (FALSE); 124 124 } 125 125 if ((mode == REF) && (code[0].type != PHOT_REF)) { 126 fprintf (stderr, "filter must be a REFERENCE photometry type\n");126 gprint (GP_ERR, "filter must be a REFERENCE photometry type\n"); 127 127 return (FALSE); 128 128 } … … 138 138 mode = MAG; 139 139 if (mode == ZERO) { 140 fprintf (stderr, "for GSC, value may be one of the following:\n");141 fprintf (stderr, " ra dec mag\n");140 gprint (GP_ERR, "for GSC, value may be one of the following:\n"); 141 gprint (GP_ERR, " ra dec mag\n"); 142 142 return (FALSE); 143 143 } … … 169 169 f = fopen (argv[1], "r"); 170 170 if (f == (FILE *) NULL) { 171 fprintf (stderr, "ERROR: can't open data file: %s\n", argv[1]);171 gprint (GP_ERR, "ERROR: can't open data file: %s\n", argv[1]); 172 172 /* delete new vector! */ 173 173 return (FALSE); … … 208 208 f = fopen (filename, "r"); 209 209 if (f == (FILE *) NULL) { 210 fprintf (stderr, "no stars in %s, skipping\n", filename);210 gprint (GP_ERR, "no stars in %s, skipping\n", filename); 211 211 continue; 212 212 } -
trunk/Ohana/src/opihi/dvo/find_regions.c
r7680 r7917 18 18 f = fopen (filename, "r"); 19 19 if (f == NULL) { 20 fprintf (stderr, "ERROR: can't find regions file %s\n", filename);20 gprint (GP_ERR, "ERROR: can't find regions file %s\n", filename); 21 21 *Nregions = 0; 22 22 return ((RegionFile *) NULL); … … 82 82 } 83 83 if (NBigDec < 0) { 84 fprintf (stderr, "ERROR: Dec out of range: %f\n", minDec);84 gprint (GP_ERR, "ERROR: Dec out of range: %f\n", minDec); 85 85 *Nregions = 0; 86 86 return ((RegionFile *) NULL); -
trunk/Ohana/src/opihi/dvo/fitcolors.c
r7680 r7917 108 108 /* determine relevant photcodes, colors */ 109 109 if (!(Np = GetPhotcodeCodebyName (argv[2]))) { 110 fprintf (stderr, "ERROR: photcode not found in photcode table\n");110 gprint (GP_ERR, "ERROR: photcode not found in photcode table\n"); 111 111 goto usage; 112 112 } … … 135 135 if (codelist[i][0].c2 != codelist[0][0].c2) goto color_mismatch; 136 136 } 137 fprintf (stderr, "using %d photcodes\n", NP);137 gprint (GP_ERR, "using %d photcodes\n", NP); 138 138 139 139 /* output is a named buffer */ … … 185 185 // the selection criteria 186 186 } 187 fprintf (stderr, "using %d possible regions\n", skylist[0].Nregions);187 gprint (GP_ERR, "using %d possible regions\n", skylist[0].Nregions); 188 188 189 189 /* vectors to save data */ … … 221 221 if (catalog[k].Naverage == 0) continue; 222 222 223 // fprintf (stderr, "seaching %s with %d stars\n", catalog[k].filename, catalog[k].Naverage);223 // gprint (GP_ERR, "seaching %s with %d stars\n", catalog[k].filename, catalog[k].Naverage); 224 224 // ListPhotSelections (); 225 225 … … 259 259 if (M2 != NULL) free (M2); 260 260 } 261 // fprintf (stderr, "selected %d stars\n", Npts);261 // gprint (GP_ERR, "selected %d stars\n", Npts); 262 262 } 263 263 … … 275 275 276 276 /* do something useful with the results (stored in Cn, C0, C1, etc) */ 277 fprintf (GetOutfile(), "%s - %s : ", code[0][0].name, code[1][0].name);278 fprintf (GetOutfile(), "%7.4f %7.4f %7.4f ",277 gprint (GP_LOG, "%s - %s : ", code[0][0].name, code[1][0].name); 278 gprint (GP_LOG, "%7.4f %7.4f %7.4f ", 279 279 C0, C1, get_double_variable ("dC")); 280 fprintf (GetOutfile(), "%5s of %5d\n", get_variable ("Cnv"), Npts);280 gprint (GP_LOG, "%5s of %5d\n", get_variable ("Cnv"), Npts); 281 281 out[NP1 + NP2*NP] = C1; 282 282 … … 369 369 370 370 usage: 371 fprintf (stderr, "USAGE: chipcolors (output) (photcode) (camera)\n");371 gprint (GP_ERR, "USAGE: chipcolors (output) (photcode) (camera)\n"); 372 372 goto escape; 373 373 374 374 color_missing: 375 fprintf (stderr, "error: chips are missing a color reference\n");375 gprint (GP_ERR, "error: chips are missing a color reference\n"); 376 376 goto escape; 377 377 378 378 color_mismatch: 379 fprintf (stderr, "error: all chips must have the same colors\n");379 gprint (GP_ERR, "error: all chips must have the same colors\n"); 380 380 goto escape; 381 381 -
trunk/Ohana/src/opihi/dvo/fitsed.c
r7892 r7917 187 187 /* loop over regions, extract data for each region */ 188 188 // XXX add interrupt checks 189 fprintf (stderr, "using %d possible regions\n", skylist[0].Nregions);189 gprint (GP_ERR, "using %d possible regions\n", skylist[0].Nregions); 190 190 for (k = 0; k < skylist[0].Nregions; k++) { 191 191 /* lock, load, unlock catalog */ … … 326 326 KiiCursorOn (fd); 327 327 while (KiiCursorRead (fd, &X, &Y, key)) { 328 fprintf (stderr, "window: %f %f (%s)\n", X, Y, key);328 gprint (GP_ERR, "window: %f %f (%s)\n", X, Y, key); 329 329 if (!strcasecmp (key, "Q")) { 330 330 KiiCursorOff (fd); … … 343 343 unlock_catalog (&catalog); 344 344 } 345 fprintf (stderr, "fitted %d stars\n", Nfit);345 gprint (GP_ERR, "fitted %d stars\n", Nfit); 346 346 status = TRUE; 347 347 goto finish; 348 348 349 349 usage: 350 fprintf (stderr, "USAGE: fitset (sedtable) : (F) - (F)\n");350 gprint (GP_ERR, "USAGE: fitset (sedtable) : (F) - (F)\n"); 351 351 goto escape; 352 352 353 353 table_missing: 354 fprintf (stderr, "ERROR: can't open the SED table\n");354 gprint (GP_ERR, "ERROR: can't open the SED table\n"); 355 355 goto escape; 356 356 357 357 color_missing: 358 fprintf (stderr, "ERROR: reference color not in SED table\n");358 gprint (GP_ERR, "ERROR: reference color not in SED table\n"); 359 359 goto escape; 360 360 361 361 color_undefined: 362 fprintf (stderr, "ERROR: undefined photcode in reference color\n");362 gprint (GP_ERR, "ERROR: undefined photcode in reference color\n"); 363 363 goto escape; 364 364 365 365 code_missing: 366 fprintf (stderr, "ERROR: undefined photcode in SED table\n");366 gprint (GP_ERR, "ERROR: undefined photcode in SED table\n"); 367 367 goto escape; 368 368 -
trunk/Ohana/src/opihi/dvo/gcat.c
r7680 r7917 10 10 11 11 if ((argc != 3) && (argc != 4)) { 12 fprintf (stderr, "USAGE: gcat RA DEC [Radius]\n");12 gprint (GP_ERR, "USAGE: gcat RA DEC [Radius]\n"); 13 13 return (FALSE); 14 14 } … … 27 27 for (i = 0; i < skylist[0].Nregions; i++) { 28 28 if (stat (skylist[0].filename[i], &filestat) != -1) { 29 fprintf (stderr, "%3d %s *\n", i, skylist[0].regions[i][0].name);29 gprint (GP_ERR, "%3d %s *\n", i, skylist[0].regions[i][0].name); 30 30 } else { 31 fprintf (stderr, "%3d %s\n", i, skylist[0].regions[i][0].name);31 gprint (GP_ERR, "%3d %s\n", i, skylist[0].regions[i][0].name); 32 32 } 33 33 set_str_variable ("CATNAME", skylist[0].filename[i]); -
trunk/Ohana/src/opihi/dvo/get_regions.c
r7680 r7917 15 15 f = fopen (filename, "r"); 16 16 if (f == NULL) { 17 fprintf (stderr, "ERROR: can't find GSC region file %s\n", filename);17 gprint (GP_ERR, "ERROR: can't find GSC region file %s\n", filename); 18 18 exit (0); 19 19 } -
trunk/Ohana/src/opihi/dvo/getxtra.c
r7680 r7917 37 37 38 38 if (argc != 6) { 39 fprintf (stderr, "USAGE: addxtra R D radius (type) (value)\n");39 gprint (GP_ERR, "USAGE: addxtra R D radius (type) (value)\n"); 40 40 return (FALSE); 41 41 } -
trunk/Ohana/src/opihi/dvo/gimages.c
r7680 r7917 21 21 remove_argument (N, &argc, argv); 22 22 if (!str_to_time (argv[N], &tzero)) { 23 fprintf (stderr, "syntax error\n");23 gprint (GP_ERR, "syntax error\n"); 24 24 return (FALSE); 25 25 } 26 26 remove_argument (N, &argc, argv); 27 27 if (!str_to_dtime (argv[N], &trange)) { 28 fprintf (stderr, "syntax error\n");28 gprint (GP_ERR, "syntax error\n"); 29 29 return (FALSE); 30 30 } … … 41 41 42 42 if (!str_to_dtime (argv[N], &trange)) { 43 fprintf (stderr, "syntax error\n");43 gprint (GP_ERR, "syntax error\n"); 44 44 return (FALSE); 45 45 } … … 52 52 remove_argument (N, &argc, argv); 53 53 if ((code = GetPhotcodebyName (argv[N])) == NULL) { 54 fprintf (stderr, "ERROR: photcode not found in photcode table\n");54 gprint (GP_ERR, "ERROR: photcode not found in photcode table\n"); 55 55 return (FALSE); 56 56 } … … 66 66 67 67 if (argc != 3) { 68 fprintf (stderr, "USAGE: gimages RA DEC [-time t dt] [-pix]\n");68 gprint (GP_ERR, "USAGE: gimages RA DEC [-time t dt] [-pix]\n"); 69 69 return (FALSE); 70 70 } … … 103 103 104 104 if (PixelCoords) { 105 fprintf (GetOutfile(), "%3d %s %6.1f %6.1f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x\n",105 gprint (GP_LOG, "%3d %s %6.1f %6.1f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x\n", 106 106 Nfound, image[i].name, X, Y, date, image[i].nstar, image[i].source, image[i].secz_PS, image[i].Mcal_PS, image[i].dMcal_PS, image[i].exptime, image[i].code); 107 107 } else { 108 108 XY_to_RD (&ra, &dec, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 109 fprintf (GetOutfile(), "%3d %s %8.4f %8.4f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x\n",109 gprint (GP_LOG, "%3d %s %8.4f %8.4f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x\n", 110 110 Nfound, image[i].name, ra, dec, date, image[i].nstar, image[i].source, image[i].secz_PS, image[i].Mcal_PS, image[i].dMcal_PS, image[i].exptime, image[i].code); 111 111 } -
trunk/Ohana/src/opihi/dvo/gstar.c
r7680 r7917 1 1 # include "dvoshell.h" 2 2 3 void print_value ( FILE *f,double value, short int ival);3 void print_value (double value, short int ival); 4 4 void initPhotcodeSequence (int Nsec); 5 5 void freePhotcodeSequence (); … … 50 50 51 51 if (argc != 4) { 52 fprintf (stderr, "USAGE: gstar RA DEC Radius [-m]\n");52 gprint (GP_ERR, "USAGE: gstar RA DEC Radius [-m]\n"); 53 53 return (FALSE); 54 54 } … … 68 68 69 69 if (skylist[0].Nregions > 1) { 70 fprintf (stderr, "warning, radius overlaps region boundary, not yet implemented\n");70 gprint (GP_ERR, "warning, radius overlaps region boundary, not yet implemented\n"); 71 71 } 72 72 … … 142 142 k = N1[i]; 143 143 if (!QUIET) { 144 fprintf (GetOutfile(), "star: %d\n", k);145 fprintf (GetOutfile(), "%9.5f %9.5f %3d of %3d %4.1f %5d\n", catalog.average[k].R, catalog.average[k].D,144 gprint (GP_LOG, "star: %d\n", k); 145 gprint (GP_LOG, "%9.5f %9.5f %3d of %3d %4.1f %5d\n", catalog.average[k].R, catalog.average[k].D, 146 146 catalog.average[k].Nm, catalog.average[k].Nn + catalog.average[k].Nm, 147 147 0.01*catalog.average[k].Xp, catalog.average[k].code); … … 149 149 /* filter names */ 150 150 for (j = 0; j < Nsec + 1; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsec*k], j, 3); 151 fprintf (GetOutfile (), "\n");151 gprint (GP_LOG, "\n"); 152 152 153 153 /* average mags */ 154 154 for (j = 0; j < Nsec + 1; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsec*k], j, 0); 155 fprintf (GetOutfile(), "\n");155 gprint (GP_LOG, "\n"); 156 156 157 157 /* average mag errors */ 158 158 for (j = 0; j < Nsec + 1; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsec*k], j, 1); 159 fprintf (GetOutfile(), "\n");159 gprint (GP_LOG, "\n"); 160 160 161 161 /* average mag chisq */ 162 162 for (j = 0; j < Nsec + 1; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsec*k], j, 2); 163 fprintf (GetOutfile(), "\n");163 gprint (GP_LOG, "\n"); 164 164 } 165 165 … … 173 173 if (GetMeasures && !QUIET) { 174 174 date = sec_to_date (catalog.measure[m].t); 175 fprintf (GetOutfile(), "%6.3f %6.3f %5.3f %20s %5.2f %5.2f %2d %3x %3d %-20s\n",175 gprint (GP_LOG, "%6.3f %6.3f %5.3f %20s %5.2f %5.2f %2d %3x %3d %-20s\n", 176 176 Mcat, Mrel, catalog.measure[m].dM_PS, 177 177 date, catalog.measure[m].dR_PS, catalog.measure[m].dD_PS, … … 219 219 } 220 220 221 void print_value ( FILE *f,double value, short int ival) {221 void print_value (double value, short int ival) { 222 222 if (ival == NO_MAG) 223 fprintf (f, "NaN ");223 gprint (GP_LOG, "NaN "); 224 224 else 225 fprintf (f, "%6.3f ", value);225 gprint (GP_LOG, "%6.3f ", value); 226 226 } 227 227 … … 265 265 case 0: /* average mags */ 266 266 if (seq == -1) { 267 print_value ( GetOutfile(),average[0].M, average[0].M);267 print_value (average[0].M, average[0].M); 268 268 } else { 269 print_value ( GetOutfile(),secfilt[seq].M_PS, secfilt[seq].M_PS);269 print_value (secfilt[seq].M_PS, secfilt[seq].M_PS); 270 270 } 271 271 break; … … 273 273 case 1: /* average mags errors */ 274 274 if (seq == -1) { 275 print_value ( GetOutfile(),average[0].dM, average[0].dM);275 print_value (average[0].dM, average[0].dM); 276 276 } else { 277 print_value ( GetOutfile(),secfilt[seq].dM_PS, secfilt[seq].dM_PS);277 print_value (secfilt[seq].dM_PS, secfilt[seq].dM_PS); 278 278 } 279 279 break; … … 281 281 case 2: /* average mag chisq */ 282 282 if (seq == -1) { 283 print_value ( GetOutfile(),pow (10.0, 0.01*average[0].Xm), average[0].Xm);283 print_value (pow (10.0, 0.01*average[0].Xm), average[0].Xm); 284 284 } else { 285 print_value ( GetOutfile(),pow (10.0, 0.01*secfilt[seq].Xm), secfilt[seq].Xm);285 print_value (pow (10.0, 0.01*secfilt[seq].Xm), secfilt[seq].Xm); 286 286 } 287 287 break; … … 289 289 case 3: /* filter names */ 290 290 code = GetPhotcodebyNsec (seq + 1); 291 fprintf (GetOutfile (), "%6s ", code[0].name);292 break; 293 } 294 } 291 gprint (GP_LOG, "%6s ", code[0].name); 292 break; 293 } 294 } -
trunk/Ohana/src/opihi/dvo/images.c
r7680 r7917 26 26 remove_argument (N, &argc, argv); 27 27 if (!str_to_time (argv[N], &tzero)) { 28 fprintf (stderr, "syntax error\n");28 gprint (GP_ERR, "syntax error\n"); 29 29 return (FALSE); 30 30 } 31 31 remove_argument (N, &argc, argv); 32 32 if (!str_to_dtime (argv[N], &trange)) { 33 fprintf (stderr, "syntax error\n");33 gprint (GP_ERR, "syntax error\n"); 34 34 return (FALSE); 35 35 } … … 44 44 remove_argument (N, &argc, argv); 45 45 if (!str_to_time (argv[N], &tzero)) { 46 fprintf (stderr, "syntax error\n");46 gprint (GP_ERR, "syntax error\n"); 47 47 return (FALSE); 48 48 } 49 49 remove_argument (N, &argc, argv); 50 50 if (!str_to_time (argv[N], &tend)) { 51 fprintf (stderr, "syntax error\n");51 gprint (GP_ERR, "syntax error\n"); 52 52 return (FALSE); 53 53 } … … 62 62 63 63 if (argc != 1) { 64 fprintf (stderr, "USAGE: image [-time start range]\n");64 gprint (GP_ERR, "USAGE: image [-time start range]\n"); 65 65 return (FALSE); 66 66 } … … 143 143 } 144 144 145 fprintf (stderr, "plotting %d images\n", N/8);145 gprint (GP_ERR, "plotting %d images\n", N/8); 146 146 Xvec.Nelements = Xvec.Nelements = N; 147 147 if (N > 0) { -
trunk/Ohana/src/opihi/dvo/imbox.c
r7680 r7917 13 13 14 14 if (argc != 2) { 15 fprintf (stderr, "USAGE: imbox (filename)\n");15 gprint (GP_ERR, "USAGE: imbox (filename)\n"); 16 16 return (FALSE); 17 17 } … … 19 19 20 20 if (!gfits_read_header (argv[1], &header)) { 21 fprintf (stderr, "file not found\n");21 gprint (GP_ERR, "file not found\n"); 22 22 return (FALSE); 23 23 } … … 41 41 } 42 42 if (!GetCoords (&coords, &header)) { 43 fprintf (stderr, "can't get WCS info from header\n");43 gprint (GP_ERR, "can't get WCS info from header\n"); 44 44 return (TRUE); 45 45 } -
trunk/Ohana/src/opihi/dvo/imdata.c
r7680 r7917 20 20 remove_argument (N, &argc, argv); 21 21 if (!str_to_time (argv[N], &tzero)) { 22 fprintf (stderr, "syntax error\n");22 gprint (GP_ERR, "syntax error\n"); 23 23 return (FALSE); 24 24 } 25 25 remove_argument (N, &argc, argv); 26 26 if (!str_to_dtime (argv[N], &trange)) { 27 fprintf (stderr, "syntax error\n");27 gprint (GP_ERR, "syntax error\n"); 28 28 return (FALSE); 29 29 } 30 30 remove_argument (N, &argc, argv); 31 31 TimeSelect = TRUE; 32 fprintf (stderr, "searching in range %ds - %ds (%f seconds)\n", (int)tzero, (int)(tzero + trange), trange);32 gprint (GP_ERR, "searching in range %ds - %ds (%f seconds)\n", (int)tzero, (int)(tzero + trange), trange); 33 33 if (trange > 0) { 34 34 start = tzero; … … 41 41 42 42 if (argc != 4) { 43 fprintf (stderr, "USAGE: imdata (value) [-time t dt]\n");43 gprint (GP_ERR, "USAGE: imdata (value) [-time t dt]\n"); 44 44 return (FALSE); 45 45 } … … 68 68 mode = 10; 69 69 if (mode == 0) { 70 fprintf (stderr, "value may be one of the following:\n");71 fprintf (stderr, " ra dR dec dD mag dmag Mrel Mcal source time\n");70 gprint (GP_ERR, "value may be one of the following:\n"); 71 gprint (GP_ERR, " ra dR dec dD mag dmag Mrel Mcal source time\n"); 72 72 return (FALSE); 73 73 } … … 108 108 free (subset); 109 109 for (i = 0; i < skylist[0].Nregions; i++) { 110 fprintf (stderr, "try %s\n", skylist[0].regions[i][0].name);110 gprint (GP_ERR, "try %s\n", skylist[0].regions[i][0].name); 111 111 } 112 112 -
trunk/Ohana/src/opihi/dvo/imdense.c
r7680 r7917 14 14 /* also, option to list and not plot or plot and not list images */ 15 15 if (argc != 1) { 16 fprintf (stderr, "USAGE: image\n");16 gprint (GP_ERR, "USAGE: image\n"); 17 17 return (FALSE); 18 18 } -
trunk/Ohana/src/opihi/dvo/imextract.c
r7680 r7917 24 24 remove_argument (N, &argc, argv); 25 25 if (!str_to_time (argv[N], &tzero)) { 26 fprintf (stderr, "syntax error\n");26 gprint (GP_ERR, "syntax error\n"); 27 27 return (FALSE); 28 28 } 29 29 remove_argument (N, &argc, argv); 30 30 if (!str_to_dtime (argv[N], &trange)) { 31 fprintf (stderr, "syntax error\n");31 gprint (GP_ERR, "syntax error\n"); 32 32 return (FALSE); 33 33 } … … 60 60 remove_argument (N, &argc, argv); 61 61 if ((code = GetPhotcodebyName (argv[N])) == NULL) { 62 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", argv[N]);62 gprint (GP_ERR, "ERROR: photcode %s not found in photcode table\n", argv[N]); 63 63 return (FALSE); 64 64 } 65 65 if ((code[0].type != PHOT_PRI) && (code[0].type != PHOT_SEC) && (code[0].type != PHOT_DEP)) { 66 fprintf (stderr, "photcode must be primary, secondary, or dependent code\n");66 gprint (GP_ERR, "photcode must be primary, secondary, or dependent code\n"); 67 67 return (FALSE); 68 68 } … … 71 71 72 72 if (argc != 2) { 73 fprintf (stderr, "USAGE: imextract (value) [-region] [-time start range] [-photcode photcode]\n");73 gprint (GP_ERR, "USAGE: imextract (value) [-region] [-time start range] [-photcode photcode]\n"); 74 74 return (FALSE); 75 75 } … … 92 92 if (!strcasecmp (argv[1], "flag")) mode = FLAG; 93 93 if (mode == ZERO) { 94 fprintf (stderr, "value may be one of the following:\n");95 fprintf (stderr, " ra dec airmass Mcal dMcal Xm photcode time fwhm exptime nstar ncal sky flag\n");94 gprint (GP_ERR, "value may be one of the following:\n"); 95 gprint (GP_ERR, " ra dec airmass Mcal dMcal Xm photcode time fwhm exptime nstar ncal sky flag\n"); 96 96 return (FALSE); 97 97 } -
trunk/Ohana/src/opihi/dvo/imlist.c
r7680 r7917 20 20 remove_argument (N, &argc, argv); 21 21 if (!str_to_time (argv[N], &tzero)) { 22 fprintf (stderr, "syntax error\n");22 gprint (GP_ERR, "syntax error\n"); 23 23 return (FALSE); 24 24 } 25 25 remove_argument (N, &argc, argv); 26 26 if (!str_to_dtime (argv[N], &trange)) { 27 fprintf (stderr, "syntax error\n");27 gprint (GP_ERR, "syntax error\n"); 28 28 return (FALSE); 29 29 } 30 30 remove_argument (N, &argc, argv); 31 31 TimeSelect = TRUE; 32 fprintf (stderr, "plotting in range %ds - %ds (%f seconds)\n", (int)tzero, (int)(tzero + trange), trange);32 gprint (GP_ERR, "plotting in range %ds - %ds (%f seconds)\n", (int)tzero, (int)(tzero + trange), trange); 33 33 } 34 34 … … 46 46 PhotcodeValue = GetPhotcodebyName (argv[N]); 47 47 if (PhotcodeValue == NULL) { 48 fprintf (stderr, "photcode not found in photcode table\n");48 gprint (GP_ERR, "photcode not found in photcode table\n"); 49 49 return (FALSE); 50 50 } … … 62 62 63 63 if (argc != 1) { 64 fprintf (stderr, "USAGE: image [-time start range] [-region] [-name string]\n");64 gprint (GP_ERR, "USAGE: image [-time start range] [-region] [-name string]\n"); 65 65 return (FALSE); 66 66 } … … 85 85 t = TimeValue (image[i].tzero, TimeReference, TimeFormat); 86 86 XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 87 fprintf (GetOutfile(), "%3d %s %8.4f %8.4f %f %5d %2d %4.2f %5.3f %5.3f\n",87 gprint (GP_LOG, "%3d %s %8.4f %8.4f %f %5d %2d %4.2f %5.3f %5.3f\n", 88 88 i, image[i].name, r, d, t, image[i].nstar, image[i].source, image[i].secz_PS, image[i].Mcal_PS, image[i].dMcal_PS); 89 89 } -
trunk/Ohana/src/opihi/dvo/imphot.c
r7680 r7917 22 22 23 23 if (argc != 3) { 24 fprintf (stderr, "USAGE: imphot tzero trange [-g buffer]\n");24 gprint (GP_ERR, "USAGE: imphot tzero trange [-g buffer]\n"); 25 25 return (FALSE); 26 26 } … … 43 43 /* load image(s) in time range given */ 44 44 if (!str_to_time (argv[1], &tzero)) { 45 fprintf (stderr, "syntax error\n");45 gprint (GP_ERR, "syntax error\n"); 46 46 return (FALSE); 47 47 } 48 48 if (!str_to_dtime (argv[2], &trange)) { 49 fprintf (stderr, "syntax error\n");49 gprint (GP_ERR, "syntax error\n"); 50 50 return (FALSE); 51 51 } 52 fprintf (stderr, "searching in range %ds - %ds (%f seconds)\n", (int)tzero, (int)(tzero + trange), trange);52 gprint (GP_ERR, "searching in range %ds - %ds (%f seconds)\n", (int)tzero, (int)(tzero + trange), trange); 53 53 54 54 if ((image = LoadImages (&Nimage)) == NULL) return (FALSE); … … 56 56 57 57 if ((Nsubset > 1) && GreyScale) { 58 fprintf (stderr, "more than one image selected, making GreyScale of first only\n");58 gprint (GP_ERR, "more than one image selected, making GreyScale of first only\n"); 59 59 } 60 60 … … 74 74 switch (image[i].order) { 75 75 case 0: 76 fprintf (stderr, "%s: %d - %f\n", image[i].name, image[i].order, image[i].Mcal_PS);76 gprint (GP_ERR, "%s: %d - %f\n", image[i].name, image[i].order, image[i].Mcal_PS); 77 77 break; 78 78 case 1: 79 fprintf (stderr, "%s: %d - %f, %d %d\n", image[i].name, image[i].order, image[i].Mcal_PS, image[i].Mx, image[i].My);79 gprint (GP_ERR, "%s: %d - %f, %d %d\n", image[i].name, image[i].order, image[i].Mcal_PS, image[i].Mx, image[i].My); 80 80 break; 81 81 case 2: 82 fprintf (stderr, "%s: %d - %f, %d %d, %d %d %d\n", image[i].name, image[i].order, image[i].Mcal_PS, image[i].Mx, image[i].My, image[i].Mxx, image[i].Mxy, image[i].Myy);82 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d\n", image[i].name, image[i].order, image[i].Mcal_PS, image[i].Mx, image[i].My, image[i].Mxx, image[i].Mxy, image[i].Myy); 83 83 break; 84 84 case 3: 85 fprintf (stderr, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal_PS, image[i].Mx, image[i].My,85 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal_PS, image[i].Mx, image[i].My, 86 86 image[i].Mxx, image[i].Mxy, image[i].Myy, image[i].Mxxx, image[i].Mxxy, image[i].Mxyy, image[i].Myyy); 87 87 break; 88 88 case 4: 89 fprintf (stderr, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d, %d %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal_PS, image[i].Mx, image[i].My,89 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d, %d %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal_PS, image[i].Mx, image[i].My, 90 90 image[i].Mxx, image[i].Mxy, image[i].Myy, image[i].Mxxx, image[i].Mxxy, image[i].Mxyy, image[i].Myyy, 91 91 image[i].Mxxxx, image[i].Mxxxy, image[i].Mxxyy, image[i].Mxyyy, image[i].Myyyy); -
trunk/Ohana/src/opihi/dvo/imrough.c
r7680 r7917 24 24 remove_argument (N, &argc, argv); 25 25 if (!str_to_time (argv[N], &tzero)) { 26 fprintf (stderr, "syntax error\n");26 gprint (GP_ERR, "syntax error\n"); 27 27 return (FALSE); 28 28 } 29 29 remove_argument (N, &argc, argv); 30 30 if (!str_to_dtime (argv[N], &trange)) { 31 fprintf (stderr, "syntax error\n");31 gprint (GP_ERR, "syntax error\n"); 32 32 return (FALSE); 33 33 } … … 42 42 remove_argument (N, &argc, argv); 43 43 if (!str_to_time (argv[N], &tzero)) { 44 fprintf (stderr, "syntax error\n");44 gprint (GP_ERR, "syntax error\n"); 45 45 return (FALSE); 46 46 } 47 47 remove_argument (N, &argc, argv); 48 48 if (!str_to_time (argv[N], &tend)) { 49 fprintf (stderr, "syntax error\n");49 gprint (GP_ERR, "syntax error\n"); 50 50 return (FALSE); 51 51 } … … 66 66 type = get_image_type (argv[N]); 67 67 if (type == T_UNDEF) { 68 fprintf (stderr, "ERROR: invalid image type %s\n", argv[N]);68 gprint (GP_ERR, "ERROR: invalid image type %s\n", argv[N]); 69 69 return (FALSE); 70 70 } … … 79 79 mode = get_image_mode (argv[N]); 80 80 if (mode == M_UNDEF) { 81 fprintf (stderr, "ERROR: invalid image mode %s\n", argv[N]);81 gprint (GP_ERR, "ERROR: invalid image mode %s\n", argv[N]); 82 82 return (FALSE); 83 83 } … … 107 107 108 108 if (argc != 2) { 109 fprintf (stderr, "USAGE: imrough (value)\n");110 fprintf (stderr, " value options:\n");109 gprint (GP_ERR, "USAGE: imrough (value)\n"); 110 gprint (GP_ERR, " value options:\n"); 111 111 for (i = 1; i < NVALUE; i++) { 112 fprintf (stderr, "%s\n", valuename[i]);112 gprint (GP_ERR, "%s\n", valuename[i]); 113 113 } 114 114 return (FALSE); … … 121 121 } 122 122 if (value == V_NONE) { 123 fprintf (stderr, "ERROR: invalid image value %s\n", argv[1]);123 gprint (GP_ERR, "ERROR: invalid image value %s\n", argv[1]); 124 124 return (FALSE); 125 125 } … … 244 244 f = fopen (DataBase, "r"); 245 245 if (f == (FILE *) NULL) { 246 fprintf (stderr, "ERROR: can't open Registration Database\n");246 gprint (GP_ERR, "ERROR: can't open Registration Database\n"); 247 247 return ((RegImage *) NULL); 248 248 } … … 252 252 fclose (f); 253 253 gfits_free_header (&header); 254 fprintf (stderr, "ERROR: trouble reading database header\n");254 gprint (GP_ERR, "ERROR: trouble reading database header\n"); 255 255 return ((RegImage *) NULL); 256 256 } … … 269 269 270 270 if (status != Nimage) { 271 fprintf (stderr, "ERROR: header and data in dB don't match (%d vs %d)\n", Nimage, status);271 gprint (GP_ERR, "ERROR: header and data in dB don't match (%d vs %d)\n", Nimage, status); 272 272 gfits_free_header (&header); 273 273 free (image); … … 285 285 gfits_free_header (&header); 286 286 gfits_free_matrix (&matrix); 287 fprintf (stderr, "ERROR: trouble reading database matrix\n");287 gprint (GP_ERR, "ERROR: trouble reading database matrix\n"); 288 288 return ((RegImage *) NULL); 289 289 } … … 294 294 gfits_free_header (&header); 295 295 gfits_free_matrix (&matrix); 296 fprintf (stderr, "ERROR: trouble reading database table\n");296 gprint (GP_ERR, "ERROR: trouble reading database table\n"); 297 297 return ((RegImage *) NULL); 298 298 } -
trunk/Ohana/src/opihi/dvo/imsearch.c
r7680 r7917 26 26 remove_argument (N, &argc, argv); 27 27 if (!str_to_time (argv[N], &tzero)) { 28 fprintf (stderr, "syntax error\n");28 gprint (GP_ERR, "syntax error\n"); 29 29 return (FALSE); 30 30 } 31 31 remove_argument (N, &argc, argv); 32 32 if (!str_to_dtime (argv[N], &trange)) { 33 fprintf (stderr, "syntax error\n");33 gprint (GP_ERR, "syntax error\n"); 34 34 return (FALSE); 35 35 } … … 44 44 Type = get_image_type (argv[N]); 45 45 if (Type == T_UNDEF) { 46 fprintf (stderr, "ERROR: invalid image type %s\n", argv[N]);46 gprint (GP_ERR, "ERROR: invalid image type %s\n", argv[N]); 47 47 return (FALSE); 48 48 } … … 57 57 Mode = get_image_mode (argv[N]); 58 58 if (Mode == M_UNDEF) { 59 fprintf (stderr, "ERROR: invalid image mode %s\n", argv[N]);59 gprint (GP_ERR, "ERROR: invalid image mode %s\n", argv[N]); 60 60 exit (1); 61 61 } … … 86 86 87 87 if (argc != 1) { 88 fprintf (stderr, "USAGE: imsearch [-time start range] [-type type] [-mode mode] [-ccd N] [-filter name]\n");88 gprint (GP_ERR, "USAGE: imsearch [-time start range] [-type type] [-mode mode] [-ccd N] [-filter name]\n"); 89 89 exit (1); 90 90 } … … 92 92 /* load in database header */ 93 93 if (!gfits_read_header (DataBase, &header)) { 94 fprintf (stderr, "ERROR: trouble reading database header\n");94 gprint (GP_ERR, "ERROR: trouble reading database header\n"); 95 95 return (FALSE); 96 96 } … … 99 99 f = fopen (DataBase, "r"); 100 100 if (f == (FILE *) NULL) { 101 fprintf (stderr, "ERROR: can't open Registration Database\n");101 gprint (GP_ERR, "ERROR: can't open Registration Database\n"); 102 102 return (FALSE); 103 103 } … … 110 110 fclose (f); 111 111 if (status != Nimage) { 112 fprintf (stderr, "ERROR: header and data in dB don't match (%d vs %d)\n", Nimage, status);112 gprint (GP_ERR, "ERROR: header and data in dB don't match (%d vs %d)\n", Nimage, status); 113 113 gfits_free_header (&header); 114 114 free (pimage); … … 129 129 obstime[strlen(obstime)-1] = 0; 130 130 131 fprintf (stdout, "%5d %6s %6s %2d %2d ", i, get_type_name(pimage[i].type), get_mode_name(pimage[i].mode), pimage[i].ccd, pimage[i].type);132 fprintf (stdout, "%s %s ", pimage[i].pathname, pimage[i].filename);133 fprintf (stdout, "%s %s %f %s\n", pimage[i].filter, pimage[i].instrument, pimage[i].exptime, obstime);131 gprint (GP_LOG, "%5d %6s %6s %2d %2d ", i, get_type_name(pimage[i].type), get_mode_name(pimage[i].mode), pimage[i].ccd, pimage[i].type); 132 gprint (GP_LOG, "%s %s ", pimage[i].pathname, pimage[i].filename); 133 gprint (GP_LOG, "%s %s %f %s\n", pimage[i].filter, pimage[i].instrument, pimage[i].exptime, obstime); 134 134 135 135 if (SaveNames) { -
trunk/Ohana/src/opihi/dvo/imstats.c
r7680 r7917 31 31 32 32 if (argc != 1) { 33 fprintf (stderr, "USAGE: imstats [-dM] [-l]\n");33 gprint (GP_ERR, "USAGE: imstats [-dM] [-l]\n"); 34 34 return (FALSE); 35 35 } … … 43 43 ALLOCATE (Xvec.elements, float, Xvec.Nelements); 44 44 ALLOCATE (Yvec.elements, float, Yvec.Nelements); 45 fprintf (stdout, "seq ra (J2000) dec time (s) Nstars\n");45 gprint (GP_LOG, "seq ra (J2000) dec time (s) Nstars\n"); 46 46 for (i = 0; i < Nimage; i++) { 47 47 Xvec.elements[i] = image[i].secz_PS; … … 52 52 if (!FindMosaicForImage (image, Nimage, i)) continue; 53 53 XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 54 fprintf (stderr, "%d %8.4f %8.4f %10d %6d %5.3f %6.3f %6.3f\n",54 gprint (GP_ERR, "%d %8.4f %8.4f %10d %6d %5.3f %6.3f %6.3f\n", 55 55 i, r, d, image[i].tzero, image[i].nstar, Xvec.elements[i], 56 56 image[i].Mcal_PS, image[i].dMcal_PS); -
trunk/Ohana/src/opihi/dvo/lcat.c
r7680 r7917 21 21 } 22 22 if (argc != 1) { 23 fprintf (stderr, "USAGE: lcat [-all]\n");23 gprint (GP_ERR, "USAGE: lcat [-all]\n"); 24 24 return (FALSE); 25 25 } … … 35 35 if (stat (skylist[0].filename[i], &filestat) == -1) exists = 'N'; 36 36 if (ShowAll) { 37 fprintf (stderr, "%3d %s %c\n", i, skylist[0].regions[i][0].name, exists);37 gprint (GP_ERR, "%3d %s %c\n", i, skylist[0].regions[i][0].name, exists); 38 38 } else { 39 39 if (exists == 'Y') { 40 fprintf (stderr, "%3d %s\n", i, skylist[0].regions[i][0].name);40 gprint (GP_ERR, "%3d %s\n", i, skylist[0].regions[i][0].name); 41 41 } 42 42 } -
trunk/Ohana/src/opihi/dvo/lcurve.c
r7680 r7917 53 53 GalMag = FALSE; 54 54 if ((N = get_argument (argc, argv, "-gal"))) { 55 fprintf (stderr, "galaxy magnitudes currently disabled\n");55 gprint (GP_ERR, "galaxy magnitudes currently disabled\n"); 56 56 return (FALSE); 57 57 } … … 64 64 65 65 if (argc < 4) { 66 fprintf (stderr, "USAGE: lcurve RA DEC Radius\n");66 gprint (GP_ERR, "USAGE: lcurve RA DEC Radius\n"); 67 67 return (FALSE); 68 68 } … … 77 77 78 78 if (skylist[0].Nregions > 1) { 79 fprintf (stderr, "warning, radius overlaps region boundary, not yet implemented\n");79 gprint (GP_ERR, "warning, radius overlaps region boundary, not yet implemented\n"); 80 80 } 81 81 -
trunk/Ohana/src/opihi/dvo/lightcurve.c
r7680 r7917 33 33 remove_argument (N, &argc, argv); 34 34 if ((code = GetPhotcodebyName (argv[N])) == NULL) { 35 fprintf (stderr, "ERROR: photcode not found in photcode table\n");35 gprint (GP_ERR, "ERROR: photcode not found in photcode table\n"); 36 36 return (FALSE); 37 37 } … … 41 41 42 42 if (argc < 4) { 43 fprintf (stderr, "USAGE: lightcurve RA DEC Radius\n");43 gprint (GP_ERR, "USAGE: lightcurve RA DEC Radius\n"); 44 44 return (FALSE); 45 45 } … … 53 53 54 54 if (skylist[0].Nregions > 1) { 55 fprintf (stderr, "warning, radius overlaps region boundary, not yet implemented\n");55 gprint (GP_ERR, "warning, radius overlaps region boundary, not yet implemented\n"); 56 56 } 57 57 -
trunk/Ohana/src/opihi/dvo/mextract.c
r7680 r7917 98 98 99 99 usage: 100 fprintf (stderr, "USAGE: mextract (value) [options]\n");101 fprintf (stderr, " value: measure.parameter or photcode\n");100 gprint (GP_ERR, "USAGE: mextract (value) [options]\n"); 101 gprint (GP_ERR, " value: measure.parameter or photcode\n"); 102 102 return (FALSE); 103 103 -
trunk/Ohana/src/opihi/dvo/pcat.c
r7680 r7917 30 30 } 31 31 if (argc != 1) { 32 fprintf (stderr, "USAGE: pcat [-all]\n");32 gprint (GP_ERR, "USAGE: pcat [-all]\n"); 33 33 return (FALSE); 34 34 } … … 51 51 sprintf (filename, "%s/%s", catdir, regions[i].name); 52 52 if (ShowAll || (stat (filename, &filestat) != -1)) { 53 if (VERBOSE) fprintf (stderr, "%3d %s\n", i, regions[i].name);53 if (VERBOSE) gprint (GP_ERR, "%3d %s\n", i, regions[i].name); 54 54 55 55 leftside = -1; … … 78 78 } 79 79 80 fprintf (stderr, "plotting %d catalogs\n", Npts/8);80 gprint (GP_ERR, "plotting %d catalogs\n", Npts/8); 81 81 Xvec.Nelements = Xvec.Nelements = Npts; 82 82 if (Npts > 0) { -
trunk/Ohana/src/opihi/dvo/photcodes.c
r7680 r7917 10 10 11 11 if (argc != 2) { 12 fprintf (stderr, "USAGE: photcodes (photcode)\n");12 gprint (GP_ERR, "USAGE: photcodes (photcode)\n"); 13 13 return (FALSE); 14 14 } … … 18 18 19 19 if (!(Np = GetPhotcodeCodebyName (argv[1]))) { 20 fprintf (stderr, "ERROR: photcode not found in photcode table\n");20 gprint (GP_ERR, "ERROR: photcode not found in photcode table\n"); 21 21 return (FALSE); 22 22 } … … 54 54 set_str_variable (name, GetPhotcodeNamebyCode (code[0].c2)); 55 55 56 fprintf (stderr, "%5d %s %7.4f %7.4f %7.4f\n",56 gprint (GP_ERR, "%5d %s %7.4f %7.4f %7.4f\n", 57 57 code[0].code, code[0].name, 0.001*code[0].C, code[0].K, code[0].X[0]); 58 58 } -
trunk/Ohana/src/opihi/dvo/photometry.c
r7680 r7917 101 101 mode = GetMagMode (p + 1); 102 102 if (mode == MAG_NONE) { 103 fprintf (stderr, "syntax error in magnitude mode\n");103 gprint (GP_ERR, "syntax error in magnitude mode\n"); 104 104 free (tmpstring); 105 105 return (FALSE); … … 119 119 code = GetPhotcodebyName (tmpstring); 120 120 if (code == NULL) { 121 fprintf (stderr, "photcode not found in photcode table\n");121 gprint (GP_ERR, "photcode not found in photcode table\n"); 122 122 free (tmpstring); 123 123 return (FALSE); … … 156 156 157 157 if (!status) { 158 fprintf (stderr, "mismatch in photcode and magmode\n");158 gprint (GP_ERR, "mismatch in photcode and magmode\n"); 159 159 free (tmpstring); 160 160 return (FALSE); … … 213 213 if (!strcasecmp (parname, "YMOSAIC")) param = MEAS_YMOSAIC; 214 214 if (!strcasecmp (parname, "help")) { 215 fprintf (stderr, "value may be one of the following:\n");216 fprintf (stderr, " ra dR dec dD mag dmag Mrel Mcal photcode time fwhm dophot xccd yccd xmosaic ymosaic flags\n");217 fprintf (stderr, "value may also be a valid photcode\n");218 fprintf (stderr, "photcodes or 'mag' may have optional magnitude type: mag,[Minst, Mcat, Msys, Mrel, Mcal]\n");215 gprint (GP_ERR, "value may be one of the following:\n"); 216 gprint (GP_ERR, " ra dR dec dD mag dmag Mrel Mcal photcode time fwhm dophot xccd yccd xmosaic ymosaic flags\n"); 217 gprint (GP_ERR, "value may also be a valid photcode\n"); 218 gprint (GP_ERR, "photcodes or 'mag' may have optional magnitude type: mag,[Minst, Mcat, Msys, Mrel, Mcal]\n"); 219 219 } 220 220 return (param); … … 250 250 if (!strcasecmp (parname, "typefrac")) { 251 251 if (!TypefracType) { 252 fprintf (stderr, "typefrac needs to specify type to use\n");252 gprint (GP_ERR, "typefrac needs to specify type to use\n"); 253 253 return (param); 254 254 } … … 269 269 if (code[0] != NULL) { 270 270 if (PhotcodeSelect) { 271 fprintf (stderr, "photcode selection rules violated: cannot restrict photcode with a photcode\n");271 gprint (GP_ERR, "photcode selection rules violated: cannot restrict photcode with a photcode\n"); 272 272 return (FALSE); 273 273 } else { … … 295 295 if (NeedPhotcode || Needcode || NcodeSelect || PhotcodeSelect) { 296 296 if (!PhotcodeSelect) { 297 fprintf (stderr, "photcode selection problem: value requires photcode\n");297 gprint (GP_ERR, "photcode selection problem: value requires photcode\n"); 298 298 return (FALSE); 299 299 } … … 304 304 if (code[0][0].type == PHOT_PRI) return (TRUE); 305 305 if (code[0][0].type == PHOT_SEC) return (TRUE); 306 fprintf (stderr, "photcode selection problem: average value requires PRI/SEC photcode\n");306 gprint (GP_ERR, "photcode selection problem: average value requires PRI/SEC photcode\n"); 307 307 return (FALSE); 308 308 } … … 311 311 312 312 void GetAverageParamHelp () { 313 fprintf (stderr, "value may be one of the following:\n");314 fprintf (stderr, " ra dec dmag Nmeas Nmiss Xm Xp Nphot Ncode flag type typefrac\n\n");315 fprintf (stderr, "value may also be a valid photcode\n");316 fprintf (stderr, "photcodes or 'mag' may have optional magnitude mode: mag,[Mave, Mref]\n");313 gprint (GP_ERR, "value may be one of the following:\n"); 314 gprint (GP_ERR, " ra dec dmag Nmeas Nmiss Xm Xp Nphot Ncode flag type typefrac\n\n"); 315 gprint (GP_ERR, "value may also be a valid photcode\n"); 316 gprint (GP_ERR, "photcodes or 'mag' may have optional magnitude mode: mag,[Mave, Mref]\n"); 317 317 return; 318 318 } … … 329 329 if (VarConfig ("PHOTCODE_FILE", "%s", PhotCodeFile) == (char *) NULL) return (FALSE); 330 330 if (!LoadPhotcodes (PhotCodeFile)) { 331 fprintf (stderr, "error loading photcodes\n");331 gprint (GP_ERR, "error loading photcodes\n"); 332 332 return (FALSE); 333 333 } … … 337 337 int ListPhotSelections () { 338 338 339 fprintf (stderr, "TimeSelect: %d, %d - %d\n", TimeSelect, tzero, tend);340 fprintf (stderr, "MagSelect: %d, %f - %f\n", MagSelect, MagMax, MagMin);341 fprintf (stderr, "TypeSelect: %d, %d\n", TypeSelect, TypeValue);342 fprintf (stderr, "ErrSelect: %d, %f\n", ErrSelect, ErrValue);343 fprintf (stderr, "iMagSelect: %d, %f\n", iMagSelect, iMagMin);344 fprintf (stderr, "FlagSelect: %d, %x\n", FlagSelect, FlagValue);345 fprintf (stderr, "TypefracSelect: %d, %d %d %f\n", TypefracSelect, TypefracType, TypefracSign, TypefracValue);346 fprintf (stderr, "ApplySelections: %d,%d,%d,%d : %d\n", ApplySelections[0], ApplySelections[1], ApplySelections[2], ApplySelections[3], SelectionParam);339 gprint (GP_ERR, "TimeSelect: %d, %d - %d\n", TimeSelect, tzero, tend); 340 gprint (GP_ERR, "MagSelect: %d, %f - %f\n", MagSelect, MagMax, MagMin); 341 gprint (GP_ERR, "TypeSelect: %d, %d\n", TypeSelect, TypeValue); 342 gprint (GP_ERR, "ErrSelect: %d, %f\n", ErrSelect, ErrValue); 343 gprint (GP_ERR, "iMagSelect: %d, %f\n", iMagSelect, iMagMin); 344 gprint (GP_ERR, "FlagSelect: %d, %x\n", FlagSelect, FlagValue); 345 gprint (GP_ERR, "TypefracSelect: %d, %d %d %f\n", TypefracSelect, TypefracType, TypefracSign, TypefracValue); 346 gprint (GP_ERR, "ApplySelections: %d,%d,%d,%d : %d\n", ApplySelections[0], ApplySelections[1], ApplySelections[2], ApplySelections[3], SelectionParam); 347 347 if (PhotcodeSelect) { 348 fprintf (stderr, "PhotcodeSelect: %d, %s\n", PhotcodeSelect, PhotcodeValue[0].name);348 gprint (GP_ERR, "PhotcodeSelect: %d, %s\n", PhotcodeSelect, PhotcodeValue[0].name); 349 349 } else { 350 fprintf (stderr, "PhotcodeSelect: %d, none\n", PhotcodeSelect);351 } 352 fprintf (stderr, "ChiSelect: %d, %f\n", ChiSelect, ChiLimit);353 fprintf (stderr, "NphotSelect: %d, %d - %d\n", NphotSelect, NphotSign, NphotValue);354 fprintf (stderr, "NcodeSelect: %d, %d - %d\n", NcodeSelect, NcodeSign, NcodeValue);355 fprintf (stderr, "FWHMSelect: %d, %d %f %f\n", FWHMSelect, FWHMsign, FWHMvalue, FWHMfrac);350 gprint (GP_ERR, "PhotcodeSelect: %d, none\n", PhotcodeSelect); 351 } 352 gprint (GP_ERR, "ChiSelect: %d, %f\n", ChiSelect, ChiLimit); 353 gprint (GP_ERR, "NphotSelect: %d, %d - %d\n", NphotSelect, NphotSign, NphotValue); 354 gprint (GP_ERR, "NcodeSelect: %d, %d - %d\n", NcodeSelect, NcodeSign, NcodeValue); 355 gprint (GP_ERR, "FWHMSelect: %d, %d %f %f\n", FWHMSelect, FWHMsign, FWHMvalue, FWHMfrac); 356 356 } 357 357 … … 364 364 365 365 if ((N = get_argument (*argc, argv, "-phothelp"))) { 366 fprintf (stderr, "optional photometry selection criteria:\n");367 fprintf (stderr, " -magrange min max\n");368 fprintf (stderr, " -imaglim min\n");369 fprintf (stderr, " -flag value\n");370 fprintf (stderr, " -chisq value\n");371 fprintf (stderr, " -photcode code\n");372 fprintf (stderr, " -time start range\n");373 fprintf (stderr, " -errorlim value\n");374 fprintf (stderr, " -type type\n");375 fprintf (stderr, " -nmeas [+/-]N\n");376 fprintf (stderr, " -fwhm [+/-]fraction\n");366 gprint (GP_ERR, "optional photometry selection criteria:\n"); 367 gprint (GP_ERR, " -magrange min max\n"); 368 gprint (GP_ERR, " -imaglim min\n"); 369 gprint (GP_ERR, " -flag value\n"); 370 gprint (GP_ERR, " -chisq value\n"); 371 gprint (GP_ERR, " -photcode code\n"); 372 gprint (GP_ERR, " -time start range\n"); 373 gprint (GP_ERR, " -errorlim value\n"); 374 gprint (GP_ERR, " -type type\n"); 375 gprint (GP_ERR, " -nmeas [+/-]N\n"); 376 gprint (GP_ERR, " -fwhm [+/-]fraction\n"); 377 377 return (FALSE); 378 378 } … … 413 413 remove_argument (N, argc, argv); 414 414 if (strlen(argv[N]) != Nparams) { 415 fprintf (stderr, "-apply selection must define all parameter choices\n");415 gprint (GP_ERR, "-apply selection must define all parameter choices\n"); 416 416 return (FALSE); 417 417 } … … 433 433 GetPhotcodeInfo (argv[N], &PhotcodeValue, &PhotcodeMode); 434 434 if (PhotcodeValue == NULL) { 435 fprintf (stderr, "photcode not found in photcode table\n");435 gprint (GP_ERR, "photcode not found in photcode table\n"); 436 436 return (FALSE);; 437 437 } … … 444 444 remove_argument (N, argc, argv); 445 445 if (!str_to_time (argv[N], &tzero)) { 446 fprintf (stderr, "syntax error\n");446 gprint (GP_ERR, "syntax error\n"); 447 447 return (FALSE); 448 448 } 449 449 remove_argument (N, argc, argv); 450 450 if (!str_to_dtime (argv[N], &trange)) { 451 fprintf (stderr, "syntax error\n");451 gprint (GP_ERR, "syntax error\n"); 452 452 return (FALSE); 453 453 } -
trunk/Ohana/src/opihi/dvo/pmeasure.c
r7680 r7917 65 65 66 66 if (argc != 2) { 67 fprintf (stderr, "USAGE: pmeasure (-all) [-m M M] [-p photcode] [-ID ID] [-flag value] [-x]\n");67 gprint (GP_ERR, "USAGE: pmeasure (-all) [-m M M] [-p photcode] [-ID ID] [-flag value] [-x]\n"); 68 68 return (FALSE); 69 69 } -
trunk/Ohana/src/opihi/dvo/procks.c
r7680 r7917 62 62 63 63 if (argc != 1) { 64 fprintf (stderr, "USAGE: procks [-m M M] [-speed s s] \n");64 gprint (GP_ERR, "USAGE: procks [-m M M] [-speed s s] \n"); 65 65 return (FALSE); 66 66 } … … 68 68 f = fopen (rockcat, "r"); 69 69 if (f == (FILE *) NULL) { 70 fprintf (stderr, "can't open rock catalog\n");70 gprint (GP_ERR, "can't open rock catalog\n"); 71 71 return (TRUE); 72 72 } … … 92 92 if (Nrocks == 0) { 93 93 free (rocks); 94 fprintf (stderr, "no rocks in datafile\n");94 gprint (GP_ERR, "no rocks in datafile\n"); 95 95 return (TRUE); 96 96 } -
trunk/Ohana/src/opihi/dvo/region_list.c
r7680 r7917 32 32 33 33 if (verbose) { 34 fprintf (stderr, "CATDIR %s\n", CATDIR);35 fprintf (stderr, "GSCFILE %s\n", gscfile);36 fprintf (stderr, "SKYFILE %s\n", skyfile);37 fprintf (stderr, "SKYDEPTH %d\n", skydepth);34 gprint (GP_ERR, "CATDIR %s\n", CATDIR); 35 gprint (GP_ERR, "GSCFILE %s\n", gscfile); 36 gprint (GP_ERR, "SKYFILE %s\n", skyfile); 37 gprint (GP_ERR, "SKYDEPTH %d\n", skydepth); 38 38 } 39 39 … … 83 83 if ((*RegionName == NULL) && (*RegionList == NULL)) return (TRUE); 84 84 85 fprintf (stderr, "-cpt and -cptlist are incompatible\n");85 gprint (GP_ERR, "-cpt and -cptlist are incompatible\n"); 86 86 free (*RegionName); 87 87 free (*RegionList); … … 123 123 Ngraph = 0; 124 124 if (!GetGraphData (&graphsky, NULL, &Ngraph)) { 125 fprintf (stderr, "region display not available\n");125 gprint (GP_ERR, "region display not available\n"); 126 126 return (NULL); 127 127 } … … 144 144 f = fopen (filename, "r"); 145 145 if (f == NULL) { 146 fprintf (stderr, "ERROR: can't find region list file %s\n", filename);146 gprint (GP_ERR, "ERROR: can't find region list file %s\n", filename); 147 147 skylist[0].Nregions = 0; 148 148 skylist[0].regions = NULL; -
trunk/Ohana/src/opihi/dvo/showtile.c
r7680 r7917 18 18 19 19 if (argc != 1) { 20 fprintf (stderr, "USAGE: showtile [option]\n");20 gprint (GP_ERR, "USAGE: showtile [option]\n"); 21 21 return (FALSE); 22 22 } … … 40 40 /* fill in top-left region */ 41 41 for (r = 0; r < 3; r += 1.0) { 42 fprintf (stderr, "r: %f\n", r);42 gprint (GP_ERR, "r: %f\n", r); 43 43 for (Nd = d = 0; d < 90; Nd ++, d += 1.0) { 44 44 if (r == 0) { -
trunk/Ohana/src/opihi/dvo/simage.c
r7680 r7917 31 31 32 32 if (argc != 2) { 33 fprintf (stderr, "USAGE: image (filename)\n");33 gprint (GP_ERR, "USAGE: image (filename)\n"); 34 34 return (FALSE); 35 35 } 36 36 37 fprintf (stderr, "not working at the moment (cmp format)\n");37 gprint (GP_ERR, "not working at the moment (cmp format)\n"); 38 38 return (FALSE); 39 39 40 40 /* read header */ 41 41 if (!gfits_read_header (argv[1], &header)) { 42 fprintf (stderr, "ERROR: can't find image file %s\n", argv[1]);42 gprint (GP_ERR, "ERROR: can't find image file %s\n", argv[1]); 43 43 return (FALSE); 44 44 } … … 47 47 gfits_scan (&header, "CTYPE1", "%s", 1, coords.ctype); 48 48 if (strcmp (coords.ctype, "RA---PLY")) { 49 fprintf (stderr, "ERROR: wrong astrometric info in header\n");49 gprint (GP_ERR, "ERROR: wrong astrometric info in header\n"); 50 50 return (FALSE); 51 51 } … … 81 81 gfits_scan (&header, "NSTARS", "%d", 1, &Nstars); 82 82 if (Nstars == 0) { 83 fprintf (stderr, "no stars in file\n");83 gprint (GP_ERR, "no stars in file\n"); 84 84 return (FALSE); 85 85 } … … 88 88 f = fopen (argv[1], "r"); 89 89 if (f == NULL) { 90 fprintf (stderr, "can't find data in file %s\n", argv[1]);90 gprint (GP_ERR, "can't find data in file %s\n", argv[1]); 91 91 return (FALSE); 92 92 } … … 108 108 nbytes = fread (buffer, 1, (BLOCK*BYTES_STAR), f); 109 109 if (nbytes != BLOCK*BYTES_STAR) { 110 fprintf (stderr, "failed to read in stars (1)\n");110 gprint (GP_ERR, "failed to read in stars (1)\n"); 111 111 free (Xvec.elements); 112 112 free (Yvec.elements); … … 127 127 nbytes = fread (buffer, 1, (Nbytes % (BLOCK*BYTES_STAR)), f); 128 128 if (nbytes != (Nbytes % (BLOCK*BYTES_STAR))) { 129 fprintf (stderr, "ERROR: failed to read in stars (2)\n");129 gprint (GP_ERR, "ERROR: failed to read in stars (2)\n"); 130 130 free (Xvec.elements); 131 131 free (Yvec.elements); … … 144 144 145 145 if (nstars != Nstars) { 146 fprintf (stderr, "ERROR: failed to read in all stars (%d of %d)\n", nstars, Nstars);146 gprint (GP_ERR, "ERROR: failed to read in all stars (%d of %d)\n", nstars, Nstars); 147 147 free (Xvec.elements); 148 148 free (Yvec.elements); -
trunk/Ohana/src/opihi/dvo/skycat.c
r7680 r7917 35 35 36 36 if (argc != 1) { 37 fprintf (stderr, "USAGE: skycat [-all]\n");37 gprint (GP_ERR, "USAGE: skycat [-all]\n"); 38 38 return (FALSE); 39 39 } … … 47 47 skylist = SkyListByRadius (sky, Depth, graphmode.coords.crval1, graphmode.coords.crval2, Radius); 48 48 49 if (VERBOSE) fprintf (stderr, "region: %6.2f - %6.2f, %6.2f - %6.2f\n",49 if (VERBOSE) gprint (GP_ERR, "region: %6.2f - %6.2f, %6.2f - %6.2f\n", 50 50 graphmode.coords.crval1 - Radius, graphmode.coords.crval1 + Radius, 51 51 graphmode.coords.crval2 - Radius, graphmode.coords.crval2 + Radius); … … 65 65 for (i = 0; i < Nregions; i++) { 66 66 if (ShowAll || (stat (skylist[0].filename[i], &filestat) != -1)) { 67 if (VERBOSE) fprintf (stderr, "%3d %s %6.2f - %6.2f, %6.2f - %6.2f\n", i, regions[i][0].name,67 if (VERBOSE) gprint (GP_ERR, "%3d %s %6.2f - %6.2f, %6.2f - %6.2f\n", i, regions[i][0].name, 68 68 regions[i][0].Rmin, regions[i][0].Rmax, regions[i][0].Dmin, regions[i][0].Dmax); 69 69 … … 93 93 } 94 94 95 fprintf (stderr, "plotting %d catalogs\n", Npts/8);95 gprint (GP_ERR, "plotting %d catalogs\n", Npts/8); 96 96 Xvec.Nelements = Xvec.Nelements = Npts; 97 97 if (Npts > 0) { -
trunk/Ohana/src/opihi/dvo/skycoverage.c
r7680 r7917 25 25 remove_argument (N, &argc, argv); 26 26 if (!str_to_time (argv[N], &tzero)) { 27 fprintf (stderr, "syntax error\n");27 gprint (GP_ERR, "syntax error\n"); 28 28 return (FALSE); 29 29 } 30 30 remove_argument (N, &argc, argv); 31 31 if (!str_to_dtime (argv[N], &trange)) { 32 fprintf (stderr, "syntax error\n");32 gprint (GP_ERR, "syntax error\n"); 33 33 return (FALSE); 34 34 } … … 43 43 remove_argument (N, &argc, argv); 44 44 if (!str_to_time (argv[N], &tzero)) { 45 fprintf (stderr, "syntax error\n");45 gprint (GP_ERR, "syntax error\n"); 46 46 return (FALSE); 47 47 } 48 48 remove_argument (N, &argc, argv); 49 49 if (!str_to_time (argv[N], &tend)) { 50 fprintf (stderr, "syntax error\n");50 gprint (GP_ERR, "syntax error\n"); 51 51 return (FALSE); 52 52 } … … 61 61 62 62 if (argc != 4) { 63 fprintf (stderr, "USAGE: skycoverage (buffer) (pixscale) (dPix) [-time start range] [-name name]\n");64 fprintf (stderr, " (buffer) saves bitmapped AIT plot\n");65 fprintf (stderr, " (pixscale) specifies the pixel size in degrees\n");66 fprintf (stderr, " note: we need 64800 / (pixscale)^2 pixels to represent the sky\n");63 gprint (GP_ERR, "USAGE: skycoverage (buffer) (pixscale) (dPix) [-time start range] [-name name]\n"); 64 gprint (GP_ERR, " (buffer) saves bitmapped AIT plot\n"); 65 gprint (GP_ERR, " (pixscale) specifies the pixel size in degrees\n"); 66 gprint (GP_ERR, " note: we need 64800 / (pixscale)^2 pixels to represent the sky\n"); 67 67 return (FALSE); 68 68 } -
trunk/Ohana/src/opihi/dvo/skydbtile.c
r6248 r7917 234 234 DEC = 0.5*(in[0].Dmin + in[0].Dmax); 235 235 if ((DEC >= 90) || (DEC <= -90)) { 236 fprintf (stderr, "error in Dmin");236 gprint (GP_ERR, "error in Dmin"); 237 237 return (NULL); 238 238 } -
trunk/Ohana/src/opihi/dvo/subpix.c
r7680 r7917 25 25 26 26 if (argc != 4) { 27 fprintf (stderr, "USAGE: subpix ra dec radius\n");27 gprint (GP_ERR, "USAGE: subpix ra dec radius\n"); 28 28 return (FALSE); 29 29 } … … 37 37 skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius); 38 38 if (skylist[0].Nregions > 1) { 39 fprintf (stderr, "warning, radius overlaps region boundary, not yet implemented\n");39 gprint (GP_ERR, "warning, radius overlaps region boundary, not yet implemented\n"); 40 40 } 41 41 … … 83 83 } 84 84 if (!Nentry) { 85 fprintf (stderr, "no stars found\n");85 gprint (GP_ERR, "no stars found\n"); 86 86 free (RA); 87 87 free (DEC); … … 107 107 Ra = RA[entry[Nmin]]; 108 108 Dec = DEC[entry[Nmin]]; 109 fprintf (stderr, "finding subpix values for star @ %f %f\n", Ra, Dec);109 gprint (GP_ERR, "finding subpix values for star @ %f %f\n", Ra, Dec); 110 110 111 111 free (RA); … … 147 147 RD_to_XY (&X, &Y, Ra, Dec, &image[I].coords); 148 148 t = TimeValue (measure[j].t, TimeReference, TimeFormat); 149 fprintf (GetOutfile(), "%f %6.3f %7.2f %7.2f %5.3f\n", t, Mabs, X, Y, image[I].secz_PS);149 gprint (GP_LOG, "%f %6.3f %7.2f %7.2f %5.3f\n", t, Mabs, X, Y, image[I].secz_PS); 150 150 } 151 151 } -
trunk/Ohana/src/opihi/dvo/version.c
r7680 r7917 4 4 int version (int argc, char **argv) { 5 5 6 fprintf (stderr, "%s\n", name);6 gprint (GP_ERR, "%s\n", name); 7 7 8 fprintf (stderr, "%s\n", opihi_version());9 fprintf (stderr, "%s\n", ohana_version());10 fprintf (stderr, "%s\n", gfits_version());8 gprint (GP_ERR, "%s\n", opihi_version()); 9 gprint (GP_ERR, "%s\n", ohana_version()); 10 gprint (GP_ERR, "%s\n", gfits_version()); 11 11 12 fprintf (stderr, "compiled on %s %s\n", __DATE__, __TIME__);12 gprint (GP_ERR, "compiled on %s %s\n", __DATE__, __TIME__); 13 13 return (TRUE); 14 14 } -
trunk/Ohana/src/opihi/include/data.h
r7680 r7917 31 31 int InitQueue (Queue *queue); 32 32 int DeleteQueue (Queue *queue); 33 int PrintQueue ( FILE *f,Queue *queue);33 int PrintQueue (Queue *queue); 34 34 35 35 /* in sort.c */ -
trunk/Ohana/src/opihi/include/external.h
r7039 r7917 10 10 # include <time.h> 11 11 # include <errno.h> 12 # include <pthread.h> 12 13 13 14 # include <ohana.h> -
trunk/Ohana/src/opihi/include/pantasks.h
r7892 r7917 8 8 # include <netdb.h> 9 9 # include <arpa/inet.h> 10 # include <pthread.h>11 10 12 11 typedef struct sockaddr_in SockAddress; … … 202 201 int GetClientSocket (char *hostname); 203 202 int InitServerSocket_Named (char *hostname, SockAddress *Address); 203 204 /* 205 void InitPrint (); 206 void SetOutBuffer (); 207 IOBuffer *GetOutBuffer (); 208 void SetOutfile (char *outname); 209 FILE *GetOutFile (); 210 int ioprint (IOBuffer *buffer, char *format, ...); 211 int gprintf (char *format, ...); 212 */ -
trunk/Ohana/src/opihi/include/pcontrol.h
r4763 r7917 134 134 IDtype NextJobID (); 135 135 IDtype NextHostID (); 136 void PrintID ( FILE *f, IDtype ID);136 void PrintID (gpDest dest, IDtype ID); 137 137 int CheckBusyJob (Job *job); 138 138 int StartHost (Host *host); -
trunk/Ohana/src/opihi/include/shell.h
r7892 r7917 124 124 char *opihi_version (); 125 125 126 /*** gprint defines ***/ 127 128 /* enums used by gprint functions */ 129 typedef enum {GP_FILE, GP_BUFF} gpMode; 130 typedef enum {GP_LOG, GP_ERR} gpDest; 131 132 /* structure used to represent the gprint i/o stream */ 133 typedef struct { 134 FILE *file; 135 IOBuffer *buffer; 136 gpMode mode; 137 gpDest dest; 138 pthread_t thread; 139 } gpStream; 140 141 void gprintInit (); 142 gpStream *gprintGetStream (gpDest dest); 143 void gprintSetBuffer (gpDest dest); 144 IOBuffer *gprintGetBuffer (gpDest dest); 145 void gprintSetFile (gpDest dest, char *filename); 146 FILE *gprintGetFile (gpDest dest); 147 int gprint (gpDest dest, char *format, ...); 148 126 149 # endif -
trunk/Ohana/src/opihi/lib.data/gaussj.c
r3104 r7917 20 20 for (j = 0; j < n; j++) { 21 21 if (!finite(a[i][j])) { 22 fprintf (stderr, "GAUSSJ: NaN\n");22 gprint (GP_ERR, "GAUSSJ: NaN\n"); 23 23 goto escape; 24 24 } … … 34 34 else 35 35 if (ipiv[k] > 1) { 36 fprintf (stderr, "GAUSSJ: Singular Matrix! (1)\n");36 gprint (GP_ERR, "GAUSSJ: Singular Matrix! (1)\n"); 37 37 goto escape; 38 38 } … … 50 50 indxc[i] = icol; 51 51 if (a[icol][icol] == 0.0) { 52 fprintf (stderr, "GAUSSJ: Singular Matrix! (2)\n");52 gprint (GP_ERR, "GAUSSJ: Singular Matrix! (2)\n"); 53 53 goto escape; 54 54 } … … 108 108 for (j = 0; j < n; j++) { 109 109 if (!finite(a[i][j])) { 110 fprintf (stderr, "GAUSSJ: NaN\n");110 gprint (GP_ERR, "GAUSSJ: NaN\n"); 111 111 goto fescape; 112 112 } … … 122 122 else 123 123 if (ipiv[k] > 1) { 124 fprintf (stderr, "GAUSSJ: Singular Matrix! (1)\n");124 gprint (GP_ERR, "GAUSSJ: Singular Matrix! (1)\n"); 125 125 goto fescape; 126 126 } … … 138 138 indxc[i] = icol; 139 139 if (a[icol][icol] == 0.0) { 140 fprintf (stderr, "GAUSSJ: Singular Matrix! (2)\n");140 gprint (GP_ERR, "GAUSSJ: Singular Matrix! (2)\n"); 141 141 goto fescape; 142 142 } -
trunk/Ohana/src/opihi/lib.data/mrq2dmin.c
r4689 r7917 49 49 for (j = 0; j < Npar; j++) { 50 50 for (k = 0; k < Npar; k++) { 51 fprintf (stderr, "%9.3e ", ta[j][k]);52 } 53 fprintf (stderr, " : %9.3e ", tb[j][0]);54 fprintf (stderr, "\n");51 gprint (GP_ERR, "%9.3e ", ta[j][k]); 52 } 53 gprint (GP_ERR, " : %9.3e ", tb[j][0]); 54 gprint (GP_ERR, "\n"); 55 55 } 56 56 # endif … … 105 105 chisq = mrq2dcof (x, t, y, dy, Npts, partry, Npar, talpha, tbeta, funcs); 106 106 if (VERBOSE) { 107 fprintf (stderr, "chisq: %f ", chisq);108 fprintf (stderr, "lambda: %f ", lambda);107 gprint (GP_ERR, "chisq: %f ", chisq); 108 gprint (GP_ERR, "lambda: %f ", lambda); 109 109 for (j = 0; j < Npar; j++) { 110 fprintf (stderr, "%f ", partry[j]);111 } 112 fprintf (stderr, "\n");110 gprint (GP_ERR, "%f ", partry[j]); 111 } 112 gprint (GP_ERR, "\n"); 113 113 } 114 114 … … 168 168 ochisq = mrq2dcof (x, t, y, dy, Npts, par, Npar, alpha, beta, funcs); 169 169 if (VERBOSE) { 170 fprintf (stderr, "chisq: %f ", ochisq);171 fprintf (stderr, "lambda: %f ", lambda);170 gprint (GP_ERR, "chisq: %f ", ochisq); 171 gprint (GP_ERR, "lambda: %f ", lambda); 172 172 for (i = 0; i < Npar; i++) { 173 fprintf (stderr, "%f ", par[i]);174 } 175 fprintf (stderr, "\n");173 gprint (GP_ERR, "%f ", par[i]); 174 } 175 gprint (GP_ERR, "\n"); 176 176 } 177 177 -
trunk/Ohana/src/opihi/lib.data/mrqmin.c
r4304 r7917 72 72 chisq = mrqcof (x, y, dy, Npts, partry, Npar, talpha, tbeta, funcs); 73 73 if (VERBOSE) { 74 fprintf (stderr, "chisq: %f ", chisq);75 fprintf (stderr, "lambda: %f ", lambda);74 gprint (GP_ERR, "chisq: %f ", chisq); 75 gprint (GP_ERR, "lambda: %f ", lambda); 76 76 for (j = 0; j < Npar; j++) { 77 fprintf (stderr, "%f ", partry[j]);77 gprint (GP_ERR, "%f ", partry[j]); 78 78 } 79 fprintf (stderr, "\n");79 gprint (GP_ERR, "\n"); 80 80 } 81 81 … … 125 125 ochisq = mrqcof (x, y, dy, Npts, par, Npar, alpha, beta, funcs); 126 126 if (VERBOSE) { 127 fprintf (stderr, "chisq: %f ", ochisq);128 fprintf (stderr, "lambda: %f ", lambda);127 gprint (GP_ERR, "chisq: %f ", ochisq); 128 gprint (GP_ERR, "lambda: %f ", lambda); 129 129 for (i = 0; i < Npar; i++) { 130 fprintf (stderr, "%f ", par[i]);130 gprint (GP_ERR, "%f ", par[i]); 131 131 } 132 fprintf (stderr, "\n");132 gprint (GP_ERR, "\n"); 133 133 } 134 134 return (ochisq); -
trunk/Ohana/src/opihi/lib.data/open_graph.c
r6684 r7917 52 52 void XGraphDead (int input) { 53 53 signal (SIGPIPE, XGraphDead); 54 fprintf (stderr, "kapa is dead, must restart\n");54 gprint (GP_ERR, "kapa is dead, must restart\n"); 55 55 Xgraph[Active] = -1; 56 56 } … … 64 64 kapa_exec = get_variable ("KAPA"); 65 65 if (kapa_exec == (char *) NULL) { 66 fprintf (stderr, "variable KAPA not found\n");66 gprint (GP_ERR, "variable KAPA not found\n"); 67 67 return (FALSE); 68 68 } … … 73 73 74 74 if (fd < 0) { 75 fprintf (stderr, "error starting kapa\n");75 gprint (GP_ERR, "error starting kapa\n"); 76 76 return (FALSE); 77 77 } … … 102 102 } else { 103 103 if (*N >= NXGRAPH) { 104 fprintf (stderr, "invalid Xgraph window %d\n", *N);104 gprint (GP_ERR, "invalid Xgraph window %d\n", *N); 105 105 return (FALSE); 106 106 } … … 140 140 } else { 141 141 if (*N >= NXGRAPH) { 142 fprintf (stderr, "invalid Xgraph window %d\n", *N);142 gprint (GP_ERR, "invalid Xgraph window %d\n", *N); 143 143 return (FALSE); 144 144 } -
trunk/Ohana/src/opihi/lib.data/open_image.c
r6684 r7917 36 36 void XImageDead (int input) { 37 37 signal (SIGPIPE, XImageDead); 38 fprintf (stderr, "kii is dead, must restart\n");38 gprint (GP_ERR, "kii is dead, must restart\n"); 39 39 Ximage[Active] = -1; 40 40 } … … 48 48 kii_exec = get_variable ("KII"); 49 49 if (kii_exec == (char *) NULL) { 50 fprintf (stderr, "variable KII not found\n");50 gprint (GP_ERR, "variable KII not found\n"); 51 51 return (FALSE); 52 52 } … … 57 57 58 58 if (fd < 0) { 59 fprintf (stderr, "error starting kii\n");59 gprint (GP_ERR, "error starting kii\n"); 60 60 return (FALSE); 61 61 } … … 86 86 } else { 87 87 if (*N >= NXIMAGE) { 88 fprintf (stderr, "invalid Ximage window %d\n", *N);88 gprint (GP_ERR, "invalid Ximage window %d\n", *N); 89 89 return (FALSE); 90 90 } -
trunk/Ohana/src/opihi/lib.data/powell.c
r2598 r7917 74 74 75 75 if (Niter == ITMAX) { 76 fprintf (stderr, "Too many iterations in routine POWELL\n");76 gprint (GP_ERR, "Too many iterations in routine POWELL\n"); 77 77 return; 78 78 } -
trunk/Ohana/src/opihi/lib.data/precess.c
r2598 r7917 29 29 30 30 if (!done) { 31 fprintf (stderr, "error finding epoch %s\n", in_epoch);31 gprint (GP_ERR, "error finding epoch %s\n", in_epoch); 32 32 exit (0); 33 33 } -
trunk/Ohana/src/opihi/lib.data/queues.c
r6249 r7917 17 17 18 18 for (i = 0; i < Nqueues; i++) { 19 fprintf (stderr, "%-15s %3d\n", queues[i][0].name, queues[i][0].Nlines);19 gprint (GP_ERR, "%-15s %3d\n", queues[i][0].name, queues[i][0].Nlines); 20 20 } 21 21 return; … … 324 324 } 325 325 326 int PrintQueue ( FILE *f,Queue *queue) {326 int PrintQueue (Queue *queue) { 327 327 328 328 int i; … … 331 331 332 332 for (i = 0; i < queue[0].Nlines; i++) { 333 fprintf (f, "%s\n", queue[0].lines[i]);333 gprint (GP_LOG, "%s\n", queue[0].lines[i]); 334 334 } 335 335 return (TRUE); -
trunk/Ohana/src/opihi/lib.data/starfuncs.c
r7080 r7917 11 11 string = get_variable ("GAIN"); 12 12 if (string == (char *) NULL) { 13 fprintf (stderr, "assuming a value of 1.0\n");13 gprint (GP_ERR, "assuming a value of 1.0\n"); 14 14 gain = 1.0; 15 15 } else { … … 89 89 set_int_variable ("Nsat", Nmax); 90 90 91 fprintf (GetOutfile(), "%f %f %f %f %f %f %f %f\n", x, y, FWHMx, FWHMy, sky, I, mag, dmag);91 gprint (GP_LOG, "%f %f %f %f %f %f %f %f\n", x, y, FWHMx, FWHMy, sky, I, mag, dmag); 92 92 93 93 return (mag); -
trunk/Ohana/src/opihi/lib.data/style_args.c
r7082 r7917 18 18 if (*argc == 1) { 19 19 name = KapaColorName (graphmode[0].color); 20 fprintf (stderr, "current style (%d): -x %d -c %s -pt %d -lt %d -lw %f -sz %f\n", Ngraph,20 gprint (GP_ERR, "current style (%d): -x %d -c %s -pt %d -lt %d -lw %f -sz %f\n", Ngraph, 21 21 graphmode[0].style, name, graphmode[0].ptype, 22 22 graphmode[0].ltype, graphmode[0].lweight, -
trunk/Ohana/src/opihi/lib.shell/BufferOps.c
r7080 r7917 65 65 66 66 error: 67 if (verbose) fprintf (stderr, "invalid matrix %s\n", name);67 if (verbose) gprint (GP_ERR, "invalid matrix %s\n", name); 68 68 return (NULL); 69 69 } … … 202 202 203 203 if (*number < 0) { 204 fprintf (stderr, "valid overlays may be: red (0), green (1), blue (2), yellow (3)\n");204 gprint (GP_ERR, "valid overlays may be: red (0), green (1), blue (2), yellow (3)\n"); 205 205 return (FALSE); 206 206 } … … 214 214 int i; 215 215 216 fprintf (stderr, "try %d\n", n);216 gprint (GP_ERR, "try %d\n", n); 217 217 for (i = 0; i < Nbuffers; i++) { 218 fprintf (stderr, "%d %lx\n", i, (long) buffers[i]);219 fprintf (stderr, "%d %lx %s\n", i, (long) buffers[i][0].name, buffers[i][0].name);220 fprintf (stderr, "%d %lx %s\n", i, (long) buffers[i][0].file, buffers[i][0].file);221 fprintf (stderr, "%d %lx %lx\n", i, (long) &buffers[i][0].header, (long) buffers[i][0].header.buffer);222 fprintf (stderr, "%d %lx %lx\n", i, (long) &buffers[i][0].matrix, (long) buffers[i][0].matrix.buffer);223 fprintf (stderr, "%d %d %d %f %f\n", i, buffers[i][0].bitpix, buffers[i][0].unsign, buffers[i][0].bscale, buffers[i][0].bzero);218 gprint (GP_ERR, "%d %lx\n", i, (long) buffers[i]); 219 gprint (GP_ERR, "%d %lx %s\n", i, (long) buffers[i][0].name, buffers[i][0].name); 220 gprint (GP_ERR, "%d %lx %s\n", i, (long) buffers[i][0].file, buffers[i][0].file); 221 gprint (GP_ERR, "%d %lx %lx\n", i, (long) &buffers[i][0].header, (long) buffers[i][0].header.buffer); 222 gprint (GP_ERR, "%d %lx %lx\n", i, (long) &buffers[i][0].matrix, (long) buffers[i][0].matrix.buffer); 223 gprint (GP_ERR, "%d %d %d %f %f\n", i, buffers[i][0].bitpix, buffers[i][0].unsign, buffers[i][0].bscale, buffers[i][0].bzero); 224 224 } 225 225 } … … 230 230 231 231 if (Nbuffers == 0) { 232 fprintf (stderr, "No allocated buffers\n");232 gprint (GP_ERR, "No allocated buffers\n"); 233 233 return (TRUE); 234 234 } 235 235 236 236 if (Long) { 237 fprintf (GetOutfile(), " N name file X Y bytes BP U bzero bscale \n");237 gprint (GP_LOG, " N name file X Y bytes BP U bzero bscale \n"); 238 238 for (i = 0; i < Nbuffers; i++) { 239 fprintf (GetOutfile(), "%5d %10s %25s %5d %5d %10d %3d %1d %10.4e %10.4e\n",239 gprint (GP_LOG, "%5d %10s %25s %5d %5d %10d %3d %1d %10.4e %10.4e\n", 240 240 i, buffers[i][0].name, buffers[i][0].file, 241 241 buffers[i][0].header.Naxis[0], buffers[i][0].header.Naxis[1], … … 246 246 } 247 247 248 fprintf (GetOutfile(), " N name file X Y bytes\n");248 gprint (GP_LOG, " N name file X Y bytes\n"); 249 249 for (i = 0; i < Nbuffers; i++) { 250 fprintf (GetOutfile(), "%5d %10s %25s %5d %5d %10d\n",250 gprint (GP_LOG, "%5d %10s %25s %5d %5d %10d\n", 251 251 i, buffers[i][0].name, buffers[i][0].file, 252 252 buffers[i][0].header.Naxis[0], buffers[i][0].header.Naxis[1], -
trunk/Ohana/src/opihi/lib.shell/CommandOps.c
r4583 r7917 33 33 } 34 34 if (Nc == -1) { 35 fprintf (stderr, "programming error: command not found\n");35 gprint (GP_ERR, "programming error: command not found\n"); 36 36 return (FALSE); 37 37 } … … 57 57 } 58 58 if (EXACT) { 59 if (VERBOSE) fprintf (stderr, "no exact match to %s\n", name);59 if (VERBOSE) gprint (GP_ERR, "no exact match to %s\n", name); 60 60 return (NULL); 61 61 } … … 73 73 if (Nmatch > 1) { 74 74 if (VERBOSE) { 75 fprintf (stderr, "ambiguous command: %s ( ", name);75 gprint (GP_ERR, "ambiguous command: %s ( ", name); 76 76 for (i = 0; i < Nmatch; i++) { 77 fprintf (stderr, "%s ", commands[match[i]].name);77 gprint (GP_ERR, "%s ", commands[match[i]].name); 78 78 } 79 fprintf (stderr, ")\n");79 gprint (GP_ERR, ")\n"); 80 80 } 81 81 return (NULL); 82 82 } 83 if (VERBOSE) fprintf (stderr, "%s: Command not found.\n", name);83 if (VERBOSE) gprint (GP_ERR, "%s: Command not found.\n", name); 84 84 return (NULL); 85 85 } -
trunk/Ohana/src/opihi/lib.shell/MacroOps.c
r4705 r7917 49 49 50 50 if ((macro == NULL) || (macro[0].Nlines == 0)) { 51 fprintf (stderr, " macro not defined\n");51 gprint (GP_ERR, " macro not defined\n"); 52 52 return; 53 53 } 54 54 for (i = 0; i < macro[0].Nlines; i++) { 55 fprintf (stderr, " %s\n", macro[0].line[i]);55 gprint (GP_ERR, " %s\n", macro[0].line[i]); 56 56 } 57 57 return; … … 61 61 int i; 62 62 for (i = 0; i < Nmacros; i++) { 63 fprintf (stderr, "%s\n", macros[i].name);63 gprint (GP_ERR, "%s\n", macros[i].name); 64 64 } 65 65 } … … 91 91 } 92 92 if (Nm == -1) { 93 fprintf (stderr, "programming error: macro not found\n");93 gprint (GP_ERR, "programming error: macro not found\n"); 94 94 return (FALSE); 95 95 } … … 114 114 } 115 115 if (EXACT) { 116 if (VERBOSE) fprintf (stderr, "no exact match to %s\n", name);116 if (VERBOSE) gprint (GP_ERR, "no exact match to %s\n", name); 117 117 return (NULL); 118 118 } … … 130 130 if (Nmatch > 1) { 131 131 if (VERBOSE) { 132 fprintf (stderr, "ambiguous macro: %s ( ", name);132 gprint (GP_ERR, "ambiguous macro: %s ( ", name); 133 133 for (i = 0; i < Nmatch; i++) { 134 fprintf (stderr, "%s ", macros[match[i]].name);134 gprint (GP_ERR, "%s ", macros[match[i]].name); 135 135 } 136 fprintf (stderr, ")\n");136 gprint (GP_ERR, ")\n"); 137 137 } 138 138 return (NULL); 139 139 } 140 if (VERBOSE) fprintf (stderr, "%s: Macro not found.\n", name);140 if (VERBOSE) gprint (GP_ERR, "%s: Macro not found.\n", name); 141 141 return (NULL); 142 142 } -
trunk/Ohana/src/opihi/lib.shell/Makefile
r5943 r7917 52 52 $(SDIR)/variable.$(ARCH).o \ 53 53 $(SDIR)/version.$(ARCH).o \ 54 $(SDIR)/gprint.$(ARCH).o \ 54 55 $(SDIR)/opihi.$(ARCH).o 55 56 -
trunk/Ohana/src/opihi/lib.shell/VectorOps.c
r3901 r7917 64 64 65 65 error: 66 if (verbose) fprintf (stderr, "invalid vector %s\n", name);66 if (verbose) gprint (GP_ERR, "invalid vector %s\n", name); 67 67 return (NULL); 68 68 } … … 155 155 156 156 if (Nvectors == 0) { 157 fprintf (stderr, "No defined vectors\n");157 gprint (GP_ERR, "No defined vectors\n"); 158 158 return (FALSE); 159 159 } 160 160 161 fprintf (GetOutfile(), " N name size\n");161 gprint (GP_LOG, " N name size\n"); 162 162 for (i = 0; i < Nvectors; i++) { 163 fprintf (GetOutfile(), "%5d %10s %10d\n",163 gprint (GP_LOG, "%5d %10s %10d\n", 164 164 i, vectors[i][0].name, vectors[i][0].Nelements); 165 165 } -
trunk/Ohana/src/opihi/lib.shell/command.c
r4470 r7917 49 49 char *msg; 50 50 msg = get_variable_ptr ("ERRORMSG"); 51 if (msg != (char *) NULL) fprintf (stderr, "%s\n", msg);51 if (msg != (char *) NULL) gprint (GP_ERR, "%s\n", msg); 52 52 } 53 53 54 54 set_int_variable ("STATUS", status); 55 if (VERBOSE) fprintf (stderr, "command: %s, status: %d\n", line, status);55 if (VERBOSE) gprint (GP_ERR, "command: %s, status: %d\n", line, status); 56 56 return (status); 57 57 } -
trunk/Ohana/src/opihi/lib.shell/convert_to_RPN.c
r4462 r7917 183 183 # if (DUMPSTACK) 184 184 for (i = 0; i < Nstack; i++) { 185 fprintf (stderr, "%s ", stack[i].name);186 } 187 if (Nstack > 0) fprintf (stderr, "\n");185 gprint (GP_ERR, "%s ", stack[i].name); 186 } 187 if (Nstack > 0) gprint (GP_ERR, "\n"); 188 188 for (i = 0; i < Nstack; i++) { 189 fprintf (stderr, "%d ", stack[i].type);190 } 191 if (Nstack > 0) fprintf (stderr, "\n");189 gprint (GP_ERR, "%d ", stack[i].type); 190 } 191 if (Nstack > 0) gprint (GP_ERR, "\n"); 192 192 # endif 193 193 -
trunk/Ohana/src/opihi/lib.shell/errors.c
r2598 r7917 12 12 int print_error () { 13 13 14 fprintf (stderr, "%s\n", errorline);14 gprint (GP_ERR, "%s\n", errorline); 15 15 return (TRUE); 16 16 } -
trunk/Ohana/src/opihi/lib.shell/evaluate_stack.c
r6250 r7917 44 44 45 45 if (VERBOSE) { 46 fprintf (stderr, "%d: ", i);46 gprint (GP_ERR, "%d: ", i); 47 47 for (j = 0; j < *Nstack; j++) { 48 fprintf (stderr, "%s ", stack[j].name);48 gprint (GP_ERR, "%s ", stack[j].name); 49 49 } 50 if (*Nstack > 0) fprintf (stderr, "\n");51 fprintf (stderr, "%d: ", i);50 if (*Nstack > 0) gprint (GP_ERR, "\n"); 51 gprint (GP_ERR, "%d: ", i); 52 52 for (j = 0; j < *Nstack; j++) { 53 fprintf (stderr, "%d ", stack[j].type);53 gprint (GP_ERR, "%d ", stack[j].type); 54 54 } 55 if (*Nstack > 0) fprintf (stderr, "\n");55 if (*Nstack > 0) gprint (GP_ERR, "\n"); 56 56 } 57 57 … … 161 161 for (i = 0; i < Nstack; i++) { 162 162 if (IsBufferPtr (stack[i].buffer) && (stack[i].type == 'm')) { 163 if (VERBOSE) fprintf (stderr, "free %s (buff) (%lx)\n", stack[i].name, (long) stack[i].buffer);163 if (VERBOSE) gprint (GP_ERR, "free %s (buff) (%lx)\n", stack[i].name, (long) stack[i].buffer); 164 164 free (stack[i].buffer[0].header.buffer); 165 165 free (stack[i].buffer[0].matrix.buffer); … … 168 168 } 169 169 if (IsVectorPtr (stack[i].vector) && (stack[i].type == 'v')) { 170 if (VERBOSE) fprintf (stderr, "free %s (vect) (%lx)\n", stack[i].name, (long) stack[i].vector);170 if (VERBOSE) gprint (GP_ERR, "free %s (vect) (%lx)\n", stack[i].name, (long) stack[i].vector); 171 171 free (stack[i].vector[0].elements); 172 172 free (stack[i].vector); 173 173 stack[i].vector = NULL; 174 174 } 175 if (VERBOSE) fprintf (stderr, "free %s (name) (%d) (%lx)\n", stack[i].name, i, (long) stack[i].name);175 if (VERBOSE) gprint (GP_ERR, "free %s (name) (%d) (%lx)\n", stack[i].name, i, (long) stack[i].name); 176 176 free (stack[i].name); 177 177 stack[i].name = NULL; -
trunk/Ohana/src/opihi/lib.shell/expand_vars.c
r6424 r7917 53 53 if (*c == 0) { /* all digit var == macro parameter */ 54 54 if (!MacroDepth) { 55 fprintf (stderr, "not in a macro\n");55 gprint (GP_ERR, "not in a macro\n"); 56 56 goto error; 57 57 } else { /* if we are executing a macro, attach the list depth to the front, pass on down the line */ … … 65 65 Val = get_variable_ptr (V0); 66 66 if (Val == NULL) { /* var was not found! */ 67 fprintf (stderr, "variable %s not found\n", V0);67 gprint (GP_ERR, "variable %s not found\n", V0); 68 68 goto error; 69 69 } -
trunk/Ohana/src/opihi/lib.shell/expand_vectors.c
r3922 r7917 59 59 /* find vector element */ 60 60 if (I >= vec[0].Nelements) { 61 fprintf (stderr, "vector subscript out of range\n");61 gprint (GP_ERR, "vector subscript out of range\n"); 62 62 goto escape; 63 63 } -
trunk/Ohana/src/opihi/lib.shell/interrupt.c
r2598 r7917 24 24 25 25 while (1) { 26 fprintf (stderr, "operation halted, continue? (y/n) ");26 gprint (GP_ERR, "operation halted, continue? (y/n) "); 27 27 fscanf (stdin, "%s", string); 28 28 -
trunk/Ohana/src/opihi/lib.shell/isolate_elements.c
r3318 r7917 112 112 if (in[i][j] != '"') continue; 113 113 /* 114 fprintf (stderr, "mismatched quotes\n");114 gprint (GP_ERR, "mismatched quotes\n"); 115 115 return (FALSE); 116 116 } -
trunk/Ohana/src/opihi/lib.shell/macro_create.c
r3907 r7917 21 21 22 22 if (argc != 2) { 23 fprintf (stderr, "USAGE: macro <name> [-c \"comment line\"]\n");24 fprintf (stderr, " (enter commands, end with the word 'END')\n");23 gprint (GP_ERR, "USAGE: macro <name> [-c \"comment line\"]\n"); 24 gprint (GP_ERR, " (enter commands, end with the word 'END')\n"); 25 25 return (FALSE); 26 26 } … … 31 31 32 32 if ((macro == NULL) && (cmd != NULL)) { 33 fprintf (stderr, "cannot redefine inherent command %s\n", argv[1]);33 gprint (GP_ERR, "cannot redefine inherent command %s\n", argv[1]); 34 34 return (FALSE); 35 35 } 36 36 if ((macro != NULL) && (cmd == NULL)) { 37 fprintf (stderr, "programming error: macro not in command list (%s)\n", argv[1]);37 gprint (GP_ERR, "programming error: macro not in command list (%s)\n", argv[1]); 38 38 return (FALSE); 39 39 } … … 75 75 76 76 if ((ThisList == 0) && (input == (char *) NULL)) { 77 fprintf (stderr, "end macro with 'END'\n");77 gprint (GP_ERR, "end macro with 'END'\n"); 78 78 continue; 79 79 } … … 81 81 82 82 if ((ThisList > 0) && (input == (char *) NULL)) { 83 fprintf (stderr, "missing 'END' in macro definition\n");83 gprint (GP_ERR, "missing 'END' in macro definition\n"); 84 84 input = strcreate ("end"); 85 85 } -
trunk/Ohana/src/opihi/lib.shell/macro_delete.c
r2598 r7917 7 7 8 8 if (argc != 2) { 9 fprintf (stderr, "USAGE: macro delete <macro>\n");9 gprint (GP_ERR, "USAGE: macro delete <macro>\n"); 10 10 return (FALSE); 11 11 } … … 13 13 macro = MatchMacro (argv[1], FALSE, TRUE); 14 14 if (macro == NULL) { 15 fprintf (stderr, "Macro %s not found\n", argv[1]);15 gprint (GP_ERR, "Macro %s not found\n", argv[1]); 16 16 return (FALSE); 17 17 } 18 18 cmd = MatchCommand (argv[1], FALSE, TRUE); 19 19 if (cmd == NULL) { 20 fprintf (stderr, "programming error: macro exists but not command\n");20 gprint (GP_ERR, "programming error: macro exists but not command\n"); 21 21 return (FALSE); 22 22 } -
trunk/Ohana/src/opihi/lib.shell/macro_edit.c
r2598 r7917 3 3 int macro_edit (int argc, char **argv) { 4 4 5 fprintf (stderr, "this function is not implemented yet\n");5 gprint (GP_ERR, "this function is not implemented yet\n"); 6 6 return (FALSE); 7 7 -
trunk/Ohana/src/opihi/lib.shell/macro_exec.c
r2598 r7917 9 9 macro = MatchMacro (argv[0], FALSE, TRUE); 10 10 if (macro == NULL) { 11 fprintf (stderr, "%s: Command not found.\n", argv[0]);11 gprint (GP_ERR, "%s: Command not found.\n", argv[0]); 12 12 return (FALSE); 13 13 } -
trunk/Ohana/src/opihi/lib.shell/macro_list.c
r2598 r7917 7 7 8 8 if (argc != 2) { 9 fprintf (stderr, "USAGE: macro list <macro>\n");9 gprint (GP_ERR, "USAGE: macro list <macro>\n"); 10 10 return (FALSE); 11 11 } … … 13 13 macro = MatchMacro (argv[0], FALSE, TRUE); 14 14 if (macro == NULL) { 15 fprintf (stderr, "%s: Macro not found\n", argv[1]);15 gprint (GP_ERR, "%s: Macro not found\n", argv[1]); 16 16 return (FALSE); 17 17 } 18 18 19 19 for (i = 0; i < macro[0].Nlines; i++) { 20 fprintf (stderr, "%s\n", macro[0].line[i]);20 gprint (GP_ERR, "%s\n", macro[0].line[i]); 21 21 } 22 22 return (TRUE); -
trunk/Ohana/src/opihi/lib.shell/macro_read.c
r2598 r7917 3 3 int macro_read (int argc, char **argv) { 4 4 5 fprintf (stderr, "this function is not implemented yet\n");5 gprint (GP_ERR, "this function is not implemented yet\n"); 6 6 return (FALSE); 7 7 -
trunk/Ohana/src/opihi/lib.shell/macro_write.c
r2598 r7917 3 3 int macro_write (int argc, char **argv) { 4 4 5 fprintf (stderr, "this function is not implemented yet\n");5 gprint (GP_ERR, "this function is not implemented yet\n"); 6 6 return (FALSE); 7 7 -
trunk/Ohana/src/opihi/lib.shell/opihi.c
r7892 r7917 25 25 ppid = getppid(); 26 26 if (ppid == 1) { 27 fprintf (stderr, "caught parent shutdown\n");27 gprint (GP_ERR, "caught parent shutdown\n"); 28 28 exit (2); 29 29 } 30 30 if (!isatty (STDIN_FILENO)) exit (2); 31 fprintf (stdout, "Use \"quit\" to exit\n");31 gprint (GP_LOG, "Use \"quit\" to exit\n"); 32 32 Nbad ++; 33 33 continue; -
trunk/Ohana/src/opihi/lib.shell/parse.c
r3317 r7917 74 74 free (B); 75 75 76 if (status) fprintf (stderr, "warning: exit status of command %d\n", status);76 if (status) gprint (GP_ERR, "warning: exit status of command %d\n", status); 77 77 78 78 /* convert all but last return to ' '. drop last return */ … … 131 131 free (V0); V0 = (char *) NULL; 132 132 if (Nval >= vec[0].Nelements) { 133 fprintf (stderr, "no element %d\n", Nval);133 gprint (GP_ERR, "no element %d\n", Nval); 134 134 goto escape; 135 135 } … … 170 170 c1 = strchr (L, '}'); 171 171 if (c1 == NULL) { 172 fprintf (stderr, "no close brackets!\n");172 gprint (GP_ERR, "no close brackets!\n"); 173 173 goto escape; 174 174 } 175 175 c2 = strchr (L, '{'); 176 176 if ((c2 != NULL) && (c2 < c1)) { 177 fprintf (stderr, "can't nest brackets!\n");177 gprint (GP_ERR, "can't nest brackets!\n"); 178 178 goto escape; 179 179 } … … 205 205 206 206 error: 207 fprintf (stderr, "syntax error\n");207 gprint (GP_ERR, "syntax error\n"); 208 208 209 209 escape: -
trunk/Ohana/src/opihi/lib.shell/startup.c
r5919 r7917 19 19 /* load config data (.ptolemyrc) */ 20 20 if (!ConfigInit (argc, argv)) { 21 fprintf (stderr, "can't find config file. some functions will be unavailable\n");21 gprint (GP_ERR, "can't find config file. some functions will be unavailable\n"); 22 22 } 23 23 … … 58 58 f = fopen (opihi_history, "a"); 59 59 if (f == NULL) /* no current history file here */ 60 fprintf (stderr, "can't save history.\n");60 gprint (GP_ERR, "can't save history.\n"); 61 61 else 62 62 fclose (f); -
trunk/Ohana/src/opihi/lib.shell/string.c
r6424 r7917 32 32 for (j = i; (string[j] != 0) && (string[j] != '"'); j++); 33 33 if (string[j] == 0) { 34 fprintf (stderr, "misbalanced quotes\n");34 gprint (GP_ERR, "misbalanced quotes\n"); 35 35 return ((char *)NULL); 36 36 } … … 55 55 } 56 56 if ((string[j] == 0) && (N != 0)) { 57 fprintf (stderr, "misbalanced parenthesis\n");57 gprint (GP_ERR, "misbalanced parenthesis\n"); 58 58 return ((char *)NULL); 59 59 } … … 130 130 for (; (string[i] != 0) && (string[i] != '"'); i++); 131 131 if (string[i] == 0) { 132 fprintf (stderr, "misbalanced quotes\n");132 gprint (GP_ERR, "misbalanced quotes\n"); 133 133 return ((char *)NULL); 134 134 } … … 152 152 } 153 153 if ((string[i] == 0) && (j != 0)) { 154 fprintf (stderr, "misbalanced parenthesis\n");154 gprint (GP_ERR, "misbalanced parenthesis\n"); 155 155 return ((char *)NULL); 156 156 } -
trunk/Ohana/src/opihi/lib.shell/timeformat.c
r2598 r7917 8 8 if ((p = get_variable ("TIMEREF")) != (char *) NULL) { 9 9 if (!str_to_time (p, TimeReference)) { 10 fprintf (stderr, "error in TIME_REF format\n");10 gprint (GP_ERR, "error in TIME_REF format\n"); 11 11 return (FALSE); 12 12 } … … 22 22 if (!strcasecmp (p, "min")) *TimeFormat = TIME_MINUTES; 23 23 if (!strcasecmp (p, "sec")) *TimeFormat = TIME_SECONDS; 24 if (!*TimeFormat) fprintf (stderr, "unknown TIME_FORMAT\n");24 if (!*TimeFormat) gprint (GP_ERR, "unknown TIME_FORMAT\n"); 25 25 free (p); 26 26 return (FALSE); -
trunk/Ohana/src/opihi/lib.shell/variable.c
r6424 r7917 20 20 for (i = 0; i < Nvariables; i++) { 21 21 if (!strcmp (name, variables[i].name)) { 22 fprintf (stderr, "warning: local variable overrides global name\n");22 gprint (GP_ERR, "warning: local variable overrides global name\n"); 23 23 } 24 24 } */ … … 305 305 306 306 if (Nvariables == 0) { 307 fprintf (stderr, "No defined variables\n");307 gprint (GP_ERR, "No defined variables\n"); 308 308 return; 309 309 } 310 310 311 311 for (i = 0; i < Nvariables; i++) { 312 fprintf (stderr, "%s = %s\n", variables[i].name, variables[i].value);312 gprint (GP_ERR, "%s = %s\n", variables[i].name, variables[i].value); 313 313 } 314 314 return; -
trunk/Ohana/src/opihi/mana/Makefile
r6678 r7917 19 19 # link flags 20 20 LIBS = -L$(LIB) -L$(LLIB) -L$(XLIB) 21 LIBS1 = -lsocket -lnsl -lreadline $(TLIB) -ldvo -lkapa -lFITS -lohana -lX11 -l m21 LIBS1 = -lsocket -lnsl -lreadline $(TLIB) -ldvo -lkapa -lFITS -lohana -lX11 -lpthread -lm 22 22 # LIBS1 = -lreadline $(TLIB) -ldvo -lkapa -lFITS -lohana -lX11 -lm 23 23 LIBS2 = -lbasiccmd -ldatacmd -lastrocmd -lshell -ldata -
trunk/Ohana/src/opihi/mana/adc.c
r2598 r7917 28 28 29 29 if (argc != 4) { 30 fprintf (stderr, "USAGE: adc ai N (variable)\n");31 fprintf (stderr, "USAGE: adc di N (variable)\n");32 fprintf (stderr, "USAGE: adc do N mode\n");30 gprint (GP_ERR, "USAGE: adc ai N (variable)\n"); 31 gprint (GP_ERR, "USAGE: adc di N (variable)\n"); 32 gprint (GP_ERR, "USAGE: adc do N mode\n"); 33 33 return (FALSE); 34 34 } … … 36 36 if (!SerialConnected) { 37 37 if (!SerialInit ('b')) { 38 fprintf (stderr, "error opening serial line\n");38 gprint (GP_ERR, "error opening serial line\n"); 39 39 return (FALSE); 40 40 } … … 55 55 N = atof (argv[2]); 56 56 if ((N < 1) || (N > 6)) { 57 fprintf (stderr, "digital output is between 1 and 6\n");57 gprint (GP_ERR, "digital output is between 1 and 6\n"); 58 58 return (FALSE); 59 59 } … … 72 72 output[1] = 0; 73 73 SerialCommand (output, &input, 50); 74 fprintf (stderr, "%x (%x, %x) -> %x (%d, %d)\n",74 gprint (GP_ERR, "%x (%x, %x) -> %x (%d, %d)\n", 75 75 output[0], setbit, DigitalOutState, input[0], 76 76 strlen(input), strlen(output)); … … 82 82 N = atof (argv[2]); 83 83 if ((N < 2) || (N > 16)) { 84 fprintf (stderr, "analog input is between 2 and 16\n");85 fprintf (stderr, " (problem with 1 for the moment...)\n");84 gprint (GP_ERR, "analog input is between 2 and 16\n"); 85 gprint (GP_ERR, " (problem with 1 for the moment...)\n"); 86 86 return (FALSE); 87 87 } … … 105 105 output[1] = 0; 106 106 SerialCommand (output, &input, 50); 107 /* fprintf (stderr, "%x -> %x\n", output[0], input[0]); */107 /* gprint (GP_ERR, "%x -> %x\n", output[0], input[0]); */ 108 108 lo = input[0]; 109 109 free (input); -
trunk/Ohana/src/opihi/mana/demux.c
r2598 r7917 8 8 9 9 if (argc != 4) { 10 fprintf (stderr, "USAGE: demux <buffer> nx ny\n");10 gprint (GP_ERR, "USAGE: demux <buffer> nx ny\n"); 11 11 return (FALSE); 12 12 } -
trunk/Ohana/src/opihi/mana/findpeaks.c
r2938 r7917 100 100 101 101 usage: 102 fprintf (stderr, "findpeaks (buffer) (threshold)\n");102 gprint (GP_ERR, "findpeaks (buffer) (threshold)\n"); 103 103 return (FALSE); 104 104 } -
trunk/Ohana/src/opihi/mana/fitcontour.c
r4689 r7917 94 94 95 95 usage: 96 fprintf (stderr, "fitcontour x y (xo) (yo)\n");96 gprint (GP_ERR, "fitcontour x y (xo) (yo)\n"); 97 97 return (FALSE); 98 98 } -
trunk/Ohana/src/opihi/mana/focus.c
r2598 r7917 7 7 if (!strcasecmp (argv[1], "init")) { 8 8 if (argc != 3) { 9 fprintf (stderr, "USAGE: focus init (port)\n");9 gprint (GP_ERR, "USAGE: focus init (port)\n"); 10 10 return (FALSE); 11 11 } 12 12 if (!SerialInit (argv[2])) return (FALSE); 13 fprintf (stderr, "focus on port %s\n", argv[2]);13 gprint (GP_ERR, "focus on port %s\n", argv[2]); 14 14 return (TRUE); 15 15 } … … 22 22 23 23 if (argc != 4) { 24 fprintf (stderr, "USAGE: focus pos Nservo (angle)\n");24 gprint (GP_ERR, "USAGE: focus pos Nservo (angle)\n"); 25 25 return (FALSE); 26 26 } … … 31 31 sprintf (line, "%c%c%c\n", 0xff, servo, angle); 32 32 status = SerialCommand (line, &answer, 10); 33 fprintf (stderr, "status: %d\n", status);33 gprint (GP_ERR, "status: %d\n", status); 34 34 if (answer != (char *) NULL) { 35 fprintf (stderr, "answer: ..%s..\n", answer);35 gprint (GP_ERR, "answer: ..%s..\n", answer); 36 36 } 37 37 return (TRUE); … … 45 45 46 46 if (argc != 3) { 47 fprintf (stderr, "USAGE: focus raw value\n");47 gprint (GP_ERR, "USAGE: focus raw value\n"); 48 48 return (FALSE); 49 49 } … … 53 53 sprintf (line, "%c", value); 54 54 status = SerialCommand (line, &answer, 10); 55 fprintf (stderr, "status: %d\n", status);55 gprint (GP_ERR, "status: %d\n", status); 56 56 if (answer != (char *) NULL) { 57 fprintf (stderr, "answer: ..%s..\n", answer);57 gprint (GP_ERR, "answer: ..%s..\n", answer); 58 58 } 59 59 return (TRUE); … … 61 61 62 62 usage: 63 fprintf (stderr, "focus init port\n");64 fprintf (stderr, "focus pos (string)\n");65 fprintf (stderr, "focus raw (value)\n");63 gprint (GP_ERR, "focus init port\n"); 64 gprint (GP_ERR, "focus pos (string)\n"); 65 gprint (GP_ERR, "focus raw (value)\n"); 66 66 return (FALSE); 67 67 } -
trunk/Ohana/src/opihi/mana/mana.c
r7892 r7917 18 18 InitMana (); 19 19 20 gprintInit (); 21 20 22 rl_readline_name = opihi_name; 21 23 rl_attempted_completion_function = command_completer; … … 34 36 /* standard welcome message */ 35 37 void welcome () { 36 fprintf (stderr, "\n");37 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);38 gprint (GP_ERR, "\n"); 39 gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 38 40 } 39 41 -
trunk/Ohana/src/opihi/mana/opihi.c
r2598 r7917 10 10 11 11 void welcome () { 12 fprintf (stderr, "\n");13 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);12 gprint (GP_ERR, "\n"); 13 gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 14 14 } 15 15 … … 55 55 f = fopen (opihi_history, "a"); 56 56 if (f == NULL) /* no current history file here */ 57 fprintf (stderr, "can't save history.\n");57 gprint (GP_ERR, "can't save history.\n"); 58 58 else 59 59 fclose (f); -
trunk/Ohana/src/opihi/mana/rawstars.c
r2938 r7917 35 35 if ((yp = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) return (FALSE); 36 36 if (xp[0].Nelements != yp[0].Nelements) { 37 fprintf (stderr, "vectors are not the same length\n");37 gprint (GP_ERR, "vectors are not the same length\n"); 38 38 return (FALSE); 39 39 } … … 90 90 91 91 usage: 92 fprintf (stderr, "rawstars (buffer) (xp) (yp)\n");92 gprint (GP_ERR, "rawstars (buffer) (xp) (yp)\n"); 93 93 return (FALSE); 94 94 } -
trunk/Ohana/src/opihi/mana/simsignal.c
r2598 r7917 9 9 10 10 if (argc != 5) { 11 fprintf (stderr, "USAGE: simsignal (vector) Nbin Nbits period\n");11 gprint (GP_ERR, "USAGE: simsignal (vector) Nbin Nbits period\n"); 12 12 return (FALSE); 13 13 } -
trunk/Ohana/src/opihi/mana/starcontour.c
r4689 r7917 125 125 126 126 usage: 127 fprintf (stderr, "starcontour (buffer) (xpeak) (ypeak) (level)\n");127 gprint (GP_ERR, "starcontour (buffer) (xpeak) (ypeak) (level)\n"); 128 128 return (FALSE); 129 129 } -
trunk/Ohana/src/opihi/mana/tests.c
r2598 r7917 16 16 char *test, *line; 17 17 18 fprintf (stderr, "starting test 1... ");18 gprint (GP_ERR, "starting test 1... "); 19 19 ALLOCATE (test, char, 256); 20 20 sprintf (test, "100"); … … 23 23 if (line != NULL) free (line); 24 24 } 25 fprintf (stderr, "done with test 1\n");25 gprint (GP_ERR, "done with test 1\n"); 26 26 sleep (1); 27 27 } … … 32 32 char *test, *line; 33 33 34 fprintf (stderr, "starting test 1b... ");34 gprint (GP_ERR, "starting test 1b... "); 35 35 ALLOCATE (test, char, 256); 36 36 sprintf (test, "dsin(45)"); … … 39 39 if (line != NULL) free (line); 40 40 } 41 fprintf (stderr, "done with test 1b\n");41 gprint (GP_ERR, "done with test 1b\n"); 42 42 sleep (1); 43 43 } … … 48 48 char *test, *line; 49 49 50 fprintf (stderr, "starting test 2... ");50 gprint (GP_ERR, "starting test 2... "); 51 51 ALLOCATE (test, char, 256); 52 52 sprintf (test, "5 * 100"); … … 55 55 if (line != NULL) free (line); 56 56 } 57 fprintf (stderr, "done with test 2\n");57 gprint (GP_ERR, "done with test 2\n"); 58 58 sleep (1); 59 59 } … … 64 64 char *test, *line; 65 65 66 fprintf (stderr, "starting test 3... ");66 gprint (GP_ERR, "starting test 3... "); 67 67 ALLOCATE (test, char, 256); 68 68 sprintf (test, "5 * dsin(45)"); … … 71 71 if (line != NULL) free (line); 72 72 } 73 fprintf (stderr, "done with test 3\n");73 gprint (GP_ERR, "done with test 3\n"); 74 74 sleep (1); 75 75 } … … 80 80 char *test, *line; 81 81 82 fprintf (stderr, "starting test 4... ");82 gprint (GP_ERR, "starting test 4... "); 83 83 for (i = 0; i < 1000000; i++) { 84 84 ALLOCATE (test, char, 256); … … 87 87 if (line != NULL) free (line); 88 88 } 89 fprintf (stderr, "done with test 4\n");89 gprint (GP_ERR, "done with test 4\n"); 90 90 sleep (1); 91 91 } … … 96 96 char *test, *line; 97 97 98 fprintf (stderr, "starting test 5... ");98 gprint (GP_ERR, "starting test 5... "); 99 99 for (i = 0; i < 1000000; i++) { 100 100 ALLOCATE (test, char, 256); … … 103 103 if (line != NULL) free (line); 104 104 } 105 fprintf (stderr, "done with test 5\n");105 gprint (GP_ERR, "done with test 5\n"); 106 106 sleep (1); 107 107 } -
trunk/Ohana/src/opihi/mana/version.c
r7080 r7917 4 4 int version (int argc, char **argv) { 5 5 6 fprintf (stderr, "%s\n", name);6 gprint (GP_ERR, "%s\n", name); 7 7 8 fprintf (stderr, "%s\n", opihi_version());9 fprintf (stderr, "%s\n", ohana_version());10 fprintf (stderr, "%s\n", gfits_version());8 gprint (GP_ERR, "%s\n", opihi_version()); 9 gprint (GP_ERR, "%s\n", ohana_version()); 10 gprint (GP_ERR, "%s\n", gfits_version()); 11 11 12 fprintf (stderr, "compiled on %s %s\n", __DATE__, __TIME__);12 gprint (GP_ERR, "compiled on %s %s\n", __DATE__, __TIME__); 13 13 return (TRUE); 14 14 } -
trunk/Ohana/src/opihi/pantasks/CheckController.c
r6687 r7917 19 19 // TimerMark (); 20 20 // status = ControllerCommand ("stop", CONTROLLER_PROMPT, &buffer); 21 // if (VerboseMode()) fprintf (stderr, "stop controller %f\n", TimerElapsed(TRUE));21 // if (VerboseMode()) gprint (GP_ERR, "stop controller %f\n", TimerElapsed(TRUE)); 22 22 23 23 TimerMark (); 24 24 FlushIOBuffer (&buffer); 25 25 status = ControllerCommand ("jobstack exit", CONTROLLER_PROMPT, &buffer); 26 if (VerboseMode()) fprintf (stderr, "check exit stack %f\n", TimerElapsed(TRUE));26 if (VerboseMode()) gprint (GP_ERR, "check exit stack %f\n", TimerElapsed(TRUE)); 27 27 if (!status) goto escape; 28 28 … … 34 34 status = sscanf (buffer.buffer, "%*s %d", &Njobs); 35 35 if (status != 1) goto escape; 36 if (VerboseMode()) fprintf (stderr, "parse %d jobs on stack %f\n", Njobs, TimerElapsed(TRUE));36 if (VerboseMode()) gprint (GP_ERR, "parse %d jobs on stack %f\n", Njobs, TimerElapsed(TRUE)); 37 37 38 38 p = buffer.buffer; … … 40 40 q = strchr (p, '\n'); 41 41 if (q == NULL) { 42 fprintf (stderr, "controller message error: incomplete job list\n");42 gprint (GP_ERR, "controller message error: incomplete job list\n"); 43 43 break; 44 44 } … … 48 48 job = FindControllerJob (JobID); 49 49 if (job == NULL) { 50 fprintf (stderr, "misplaced job? %d not in EXIT job list\n", JobID);50 gprint (GP_ERR, "misplaced job? %d not in EXIT job list\n", JobID); 51 51 continue; 52 52 } … … 54 54 CheckControllerJob (job); 55 55 } 56 if (VerboseMode()) fprintf (stderr, "clear %d exit jobs %f\n", i, TimerElapsed(TRUE));56 if (VerboseMode()) gprint (GP_ERR, "clear %d exit jobs %f\n", i, TimerElapsed(TRUE)); 57 57 58 58 if (TestElapsedCheck()) goto finish; … … 70 70 status = sscanf (buffer.buffer, "%*s %d", &Njobs); 71 71 if (status != 1) goto escape; 72 if (VerboseMode()) fprintf (stderr, "check crash stack %f\n", TimerElapsed(TRUE));72 if (VerboseMode()) gprint (GP_ERR, "check crash stack %f\n", TimerElapsed(TRUE)); 73 73 74 74 p = buffer.buffer; … … 76 76 q = strchr (p, '\n'); 77 77 if (q == NULL) { 78 fprintf (stderr, "controller message error: incomplete job list\n");78 gprint (GP_ERR, "controller message error: incomplete job list\n"); 79 79 break; 80 80 } … … 84 84 job = FindControllerJob (JobID); 85 85 if (job == NULL) { 86 fprintf (stderr, "misplaced job? %d not in CRASH job list\n", JobID);86 gprint (GP_ERR, "misplaced job? %d not in CRASH job list\n", JobID); 87 87 continue; 88 88 } … … 90 90 CheckControllerJob (job); 91 91 } 92 if (VerboseMode()) fprintf (stderr, "clear %d crash jobs %f\n", i, TimerElapsed(TRUE));92 if (VerboseMode()) gprint (GP_ERR, "clear %d crash jobs %f\n", i, TimerElapsed(TRUE)); 93 93 94 94 finish: -
trunk/Ohana/src/opihi/pantasks/CheckJobs.c
r6687 r7917 18 18 switch (status) { 19 19 case JOB_PENDING: 20 /* if (VerboseMode()) fprintf (stderr, "job %s (%d) pending\n", job[0].task[0].name, job[0].JobID); */20 /* if (VerboseMode()) gprint (GP_LOG, "job %s (%d) pending\n", job[0].task[0].name, job[0].JobID); */ 21 21 break; 22 22 23 23 case JOB_BUSY: 24 /* if (VerboseMode()) fprintf (stderr, "job %s (%d) busy\n", job[0].task[0].name, job[0].JobID); */24 /* if (VerboseMode()) gprint (GP_LOG, "job %s (%d) busy\n", job[0].task[0].name, job[0].JobID); */ 25 25 break; 26 26 … … 28 28 /* run task[0].crash macro, if it exists */ 29 29 /* push output buffer data to the stdout and stderr queues */ 30 if (VerboseMode()) fprintf (stderr, "job %s (%d) crash\n", job[0].task[0].name, job[0].JobID);30 if (VerboseMode()) gprint (GP_LOG, "job %s (%d) crash\n", job[0].task[0].name, job[0].JobID); 31 31 PushNamedQueue ("stdout", job[0].stdout.buffer); 32 32 PushNamedQueue ("stderr", job[0].stderr.buffer); … … 48 48 49 49 case JOB_EXIT: 50 if (VerboseMode()) fprintf (stderr, "job %s (%d) exit\n", job[0].task[0].name, job[0].JobID);50 if (VerboseMode()) gprint (GP_LOG, "job %s (%d) exit\n", job[0].task[0].name, job[0].JobID); 51 51 PushNamedQueue ("stdout", job[0].stdout.buffer); 52 52 PushNamedQueue ("stderr", job[0].stderr.buffer); … … 79 79 80 80 default: 81 if (VerboseMode()) fprintf (stderr, "unknown exit status: %d\n", status);81 if (VerboseMode()) gprint (GP_LOG, "unknown exit status: %d\n", status); 82 82 /** do something more useful here ?? **/ 83 83 break; … … 89 89 if (job[0].mode == JOB_LOCAL) { 90 90 if (GetTaskTimer(job[0].start) < job[0].task[0].timeout_period) continue; 91 if (VerboseMode()) fprintf (stderr, "timeout on %s\n", job[0].task[0].name);91 if (VerboseMode()) gprint (GP_LOG, "timeout on %s\n", job[0].task[0].name); 92 92 93 93 /* update the timeout counter */ … … 96 96 if (!KillLocalJob (job)) { 97 97 job[0].state = JOB_HUNG; 98 if (VerboseMode()) fprintf (stderr, "child process %d is hung, cannot kill\n", job[0].pid);98 if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", job[0].pid); 99 99 continue; 100 100 } -
trunk/Ohana/src/opihi/pantasks/CheckPassword.c
r7892 r7917 15 15 int status; 16 16 17 if (DEBUG) fprintf (stderr, "waiting for password %s\n", PASSWORD);17 if (DEBUG) gprint (GP_ERR, "waiting for password %s\n", PASSWORD); 18 18 19 19 status = ExpectCommand (BindSocket, strlen(PASSWORD), 0.1, &message); 20 20 if (status != 0) { 21 if (DEBUG) fprintf (stderr, "failed connection\n");21 if (DEBUG) gprint (GP_ERR, "failed connection\n"); 22 22 FreeIOBuffer (&message); 23 23 close (BindSocket); … … 25 25 } 26 26 if (strncmp (message.buffer, PASSWORD, strlen(PASSWORD))) { 27 if (DEBUG) fprintf (stderr, "invalid password\n");27 if (DEBUG) gprint (GP_ERR, "invalid password\n"); 28 28 close (BindSocket); 29 29 return (FALSE); 30 30 } 31 if (DEBUG) fprintf (stderr, "accepted password (%s)\n", message.buffer);31 if (DEBUG) gprint (GP_ERR, "accepted password (%s)\n", message.buffer); 32 32 33 33 return (TRUE); -
trunk/Ohana/src/opihi/pantasks/ControllerOps.c
r6687 r7917 25 25 gettimeofday (&stop, (void *) NULL); 26 26 dtime = DTIME (stop, start); 27 /* if (VerboseMode()) fprintf (stderr, "check job status %f\n", dtime); */27 /* if (VerboseMode()) gprint (GP_ERR, "check job status %f\n", dtime); */ 28 28 29 29 if ((job[0].state == JOB_EXIT) || (job[0].state == JOB_CRASH)) { … … 32 32 gettimeofday (&stop, (void *) NULL); 33 33 dtime = DTIME (stop, start); 34 /* if (VerboseMode()) fprintf (stderr, "get stdout %f\n", dtime); */34 /* if (VerboseMode()) gprint (GP_ERR, "get stdout %f\n", dtime); */ 35 35 36 36 gettimeofday (&start, (void *) NULL); … … 38 38 gettimeofday (&stop, (void *) NULL); 39 39 dtime = DTIME (stop, start); 40 /* if (VerboseMode()) fprintf (stderr, "get stderr %f\n", dtime); */40 /* if (VerboseMode()) gprint (GP_ERR, "get stderr %f\n", dtime); */ 41 41 42 42 gettimeofday (&start, (void *) NULL); … … 44 44 gettimeofday (&stop, (void *) NULL); 45 45 dtime = DTIME (stop, start); 46 /* if (VerboseMode()) fprintf (stderr, "delete job %f\n", dtime); */46 /* if (VerboseMode()) gprint (GP_ERR, "delete job %f\n", dtime); */ 47 47 } 48 48 return (TRUE); … … 81 81 p = memstr (buffer.buffer, "job not found", buffer.Nbuffer); 82 82 if (p != NULL) { 83 fprintf (stderr, "unknown job %d\n", job[0].pid);83 gprint (GP_ERR, "unknown job %d\n", job[0].pid); 84 84 FreeIOBuffer (&buffer); 85 85 return (FALSE); … … 105 105 if (!strcmp(status_string, "CRASH")) outstate = JOB_CRASH; 106 106 if (outstate == -1) { 107 fprintf (stderr, "programming error?\n");107 gprint (GP_ERR, "programming error?\n"); 108 108 exit (1); 109 109 } … … 147 147 if (status == -1) return (CONTROLLER_HUNG); 148 148 149 /* if (VerboseMode()) fprintf (stderr, "message received (GetJobOutput : %s)\n", cmd); */149 /* if (VerboseMode()) gprint (GP_ERR, "message received (GetJobOutput : %s)\n", cmd); */ 150 150 /* drop extra bytes from pcontrol (not pclient:job) */ 151 151 buffer[0].Nbuffer = Nstart + Nbytes; … … 205 205 p = memstr (buffer.buffer, "JobID", buffer.Nbuffer); 206 206 if (p == NULL) { 207 fprintf (stderr, "missing PID in pcontrol message : programming error\n");207 gprint (GP_ERR, "missing PID in pcontrol message : programming error\n"); 208 208 exit (1); 209 209 } … … 240 240 pid = fork (); 241 241 if (!pid) { /* must be child process */ 242 fprintf (stderr, "starting controller connection\n");242 gprint (GP_LOG, "starting controller connection\n"); 243 243 244 244 /* close the other ends of the pipes */ … … 303 303 ControllerPID = pid; 304 304 ControllerStatus = TRUE; 305 fprintf (stderr, "Connected\n");305 gprint (GP_LOG, "Connected\n"); 306 306 return (TRUE); 307 307 … … 311 311 312 312 io_error: 313 fprintf (stderr, "timeout while connecting\n");313 gprint (GP_ERR, "timeout while connecting\n"); 314 314 goto close_pipes; 315 315 … … 341 341 if ((status == -1) && (errno == EPIPE)) { 342 342 StopController (); 343 if (VerboseMode()) fprintf (stderr, "controller is down\n");343 if (VerboseMode()) gprint (GP_ERR, "controller is down\n"); 344 344 return (FALSE); 345 345 } … … 355 355 if (status == 0) { 356 356 StopController (); 357 if (VerboseMode()) fprintf (stderr, "controller is down\n");357 if (VerboseMode()) gprint (GP_ERR, "controller is down\n"); 358 358 return (FALSE); 359 359 } 360 360 if (status == -1) { 361 if (VerboseMode()) fprintf (stderr, "controller is not responding\n");361 if (VerboseMode()) gprint (GP_ERR, "controller is not responding\n"); 362 362 return (FALSE); 363 363 } … … 369 369 bzero (buffer[0].buffer + buffer[0].Nbuffer, buffer[0].Nalloc - buffer[0].Nbuffer); 370 370 } 371 /* if (VerboseMode()) fprintf (stderr, "message received, %d cycles\n", i); */371 /* if (VerboseMode()) gprint (GP_ERR, "message received, %d cycles\n", i); */ 372 372 return (TRUE); 373 373 } … … 383 383 switch (Nread) { 384 384 case -2: /* error in read (programming error? system level error?) */ 385 fprintf (stderr, "serious IO error\n");385 gprint (GP_ERR, "serious IO error\n"); 386 386 exit (2); 387 387 case -1: /* no data in pipe */ … … 395 395 switch (Nread) { 396 396 case -2: /* error in read (programming error? system level error?) */ 397 fprintf (stderr, "serious IO error\n");397 gprint (GP_ERR, "serious IO error\n"); 398 398 exit (2); 399 399 case -1: /* no data in pipe */ … … 407 407 int PrintControllerOutput () { 408 408 409 fprintf (stderr, "--- stdout ---\n");410 fwrite (stdout_buffer.buffer, 1, stdout_buffer.Nbuffer, stderr);411 fprintf (stderr, "--- stdout---\n");412 fwrite (stderr_buffer.buffer, 1, stderr_buffer.Nbuffer, stderr);413 fprintf (stderr, "--- done ---\n");409 gprint (GP_LOG, "--- stdout ---\n"); 410 gwrite (stdout_buffer.buffer, 1, stdout_buffer.Nbuffer, GP_LOG); 411 gprint (GP_LOG, "--- stderr ---\n"); 412 gwrite (stderr_buffer.buffer, 1, stderr_buffer.Nbuffer, GP_LOG); 413 gprint (GP_LOG, "--- done ---\n"); 414 414 return (TRUE); 415 415 } -
trunk/Ohana/src/opihi/pantasks/JobOps.c
r6687 r7917 65 65 int i; 66 66 67 fprintf (stderr, "\n");67 gprint (GP_LOG, "\n"); 68 68 if (Njobs == 0) { 69 fprintf (stderr, " no defined jobs\n");69 gprint (GP_LOG, " no defined jobs\n"); 70 70 return; 71 71 } 72 72 73 fprintf (stderr, " Jobs\n");74 for (i = 0; i < Njobs; i++) { 75 fprintf (stderr, " %d: %-15s %5d %20s (%lx)\n", Njobs, jobs[i][0].task[0].name, jobs[i][0].JobID, jobs[i][0].argv[0], (long) jobs[i][0].argv);73 gprint (GP_LOG, " Jobs\n"); 74 for (i = 0; i < Njobs; i++) { 75 gprint (GP_LOG, " %d: %-15s %5d %20s (%lx)\n", Njobs, jobs[i][0].task[0].name, jobs[i][0].JobID, jobs[i][0].argv[0], (long) jobs[i][0].argv); 76 76 } 77 77 return; … … 155 155 } 156 156 if (Nm == -1) { 157 fprintf (stderr, "programming error: job not found\n");157 gprint (GP_ERR, "programming error: job not found\n"); 158 158 return (FALSE); 159 159 } -
trunk/Ohana/src/opihi/pantasks/ListenClients.c
r7892 r7917 25 25 */ 26 26 27 if (DEBUG) fprintf (stderr, "adding a new client (%d)\n", client);27 if (DEBUG) gprint (GP_LOG, "adding a new client (%d)\n", client); 28 28 clients[Nclients] = client; 29 29 InitIOBuffer(&buffers[Nclients], 256); … … 42 42 fd_set fdSet; 43 43 struct timeval timeout; 44 IOBuffer *outbuffer; 44 45 45 46 InitClients (); … … 50 51 for (i = 0; i < Ncurrent; i++) { 51 52 ExpectMessage (clients[i], 0.25, &buffers[i]); 52 if (DEBUG) fprintf (stderr, "read %d from client %d\n", buffers[i].Nbuffer, i);53 if (DEBUG) gprint (GP_ERR, "read %d from client %d\n", buffers[i].Nbuffer, i); 53 54 if (buffers[i].Nbuffer) { 54 if (DEBUG) fprintf (stderr, "%s\n", buffers[i].buffer);55 if (DEBUG) gprint (GP_ERR, "%s\n", buffers[i].buffer); 55 56 } 56 57 } … … 73 74 FD_SET (clients[i], &fdSet); 74 75 if (FD_ISSET(clients[i], &fdSet)) { 75 if (DEBUG) fprintf (stderr, "fd %d is set\n", clients[i]);76 if (DEBUG) gprint (GP_ERR, "fd %d is set\n", clients[i]); 76 77 } else { 77 if (DEBUG) fprintf (stderr, "fd %d is not set\n", clients[i]);78 if (DEBUG) gprint (GP_ERR, "fd %d is not set\n", clients[i]); 78 79 } 79 80 } … … 81 82 82 83 /* block until we have some data on the pipes (or timeout) */ 83 if (DEBUG) fprintf (stderr, "listening to %d clients\n", Ncurrent);84 if (DEBUG) gprint (GP_ERR, "listening to %d clients\n", Ncurrent); 84 85 status = select (Nmax, &fdSet, NULL, NULL, &timeout); 85 86 86 if (DEBUG) fprintf (stderr, "messages from %d clients\n", status);87 if (DEBUG) gprint (GP_ERR, "messages from %d clients\n", status); 87 88 88 89 if (status == -1) { … … 99 100 100 101 /* this client has data, handle it */ 101 if (DEBUG) fprintf (stderr, "data from client %d\n", clients[i]); 102 103 if (DEBUG) fprintf (stderr, "start: ", buffers[i].buffer); 104 fwrite (buffers[i].buffer, 1, buffers[i].Nbuffer, stderr); 105 if (DEBUG) fprintf (stderr, "...\n"); 102 if (DEBUG) { 103 gprint (GP_ERR, "data from client %d\n", clients[i]); 104 gprint (GP_ERR, "start: ", buffers[i].buffer); 105 gwrite (buffers[i].buffer, 1, buffers[i].Nbuffer, GP_ERR); 106 gprint (GP_ERR, "...\n"); 107 } 106 108 107 109 /* read until the pipe is empty: -1 is empty, -2 is error */ … … 109 111 while (Nread >= 0) { 110 112 Nread = ReadtoIOBuffer (&buffers[i], clients[i]); 111 if (DEBUG) fprintf (stderr, "read %d bytes from socket\n", Nread);113 if (DEBUG) gprint (GP_ERR, "read %d bytes from socket\n", Nread); 112 114 113 115 if (Nread == -2) { 114 116 /* error: do something */ 115 if (1) fprintf (stderr, "error reading from socket\n");117 if (1) gprint (GP_ERR, "error reading from socket\n"); 116 118 } 117 119 } 118 if (DEBUG) fprintf (stderr, "read %d total bytes\n", buffers[i].Nbuffer);120 if (DEBUG) gprint (GP_ERR, "read %d total bytes\n", buffers[i].Nbuffer); 119 121 120 122 if (DEBUG) { 121 fprintf (stderr, "end: ", buffers[i].buffer);122 fwrite (buffers[i].buffer, 1, buffers[i].Nbuffer, stderr);123 fprintf (stderr, "...\n");123 gprint (GP_ERR, "end: ", buffers[i].buffer); 124 gwrite (buffers[i].buffer, 1, buffers[i].Nbuffer, GP_ERR); 125 gprint (GP_ERR, "...\n"); 124 126 } 125 127 … … 129 131 130 132 /* we now have a possible command from the client: run it */ 133 /* XXX : we need to handle ; in the client-parsing of commands */ 131 134 stripwhite (line); 132 135 if (*line) { 133 if (1) fprintf (stderr, "got command: %s\n", line); 136 if (1) gprint (GP_ERR, "got command: %s\n", line); 137 SetOutBuffer (); 134 138 status = multicommand (line); 139 outbuffer = GetOutBuffer (); 140 141 gprint (GP_ERR, "send message: %d bytes\n", outbuffer[0].Nbuffer); 142 gwrite (outbuffer[0].buffer, 1, outbuffer[0].Nbuffer, GP_ERR); 143 gprint (GP_ERR, "end message\n"); 144 145 SendMessage (clients[i], outbuffer[0].buffer); 146 SetOutfile ("stdout"); 135 147 } 136 148 free (line); 137 149 150 138 151 /* this function should return the output buffer 139 152 to the currently selected client */ -
trunk/Ohana/src/opihi/pantasks/LocalJob.c
r6687 r7917 24 24 switch (Nread) { 25 25 case -2: /* error in read (programming error? system level error?) */ 26 fprintf (stderr, "serious IO error\n");26 gprint (GP_ERR, "serious IO error\n"); 27 27 exit (2); 28 28 case -1: /* no data in pipe */ … … 36 36 switch (Nread) { 37 37 case -2: /* error in read (programming error? system level error?) */ 38 fprintf (stderr, "serious IO error\n");38 gprint (GP_ERR, "serious IO error\n"); 39 39 exit (2); 40 40 case -1: /* no data in pipe */ … … 57 57 switch (errno) { 58 58 case ECHILD: 59 fprintf (stderr, "unknown PID, not a child proc\n");60 fprintf (stderr, "did process already exit? programming error?\n");59 gprint (GP_ERR, "unknown PID, not a child proc\n"); 60 gprint (GP_ERR, "did process already exit? programming error?\n"); 61 61 job[0].state = JOB_NONE; 62 62 job[0].exit_status = 0; 63 63 return (FALSE); 64 64 case EINVAL: 65 fprintf (stderr, "error EINVAL (waitpid): programming error\n");65 gprint (GP_ERR, "error EINVAL (waitpid): programming error\n"); 66 66 exit (1); 67 67 case EINTR: 68 fprintf (stderr, "error EINTR (waitpid): programming error\n");68 gprint (GP_ERR, "error EINTR (waitpid): programming error\n"); 69 69 exit (1); 70 70 default: 71 fprintf (stderr, "unknown error for waitpid (%d): programming error\n", errno);71 gprint (GP_ERR, "unknown error for waitpid (%d): programming error\n", errno); 72 72 exit (1); 73 73 } … … 81 81 default: 82 82 if (result != job[0].pid) { 83 fprintf (stderr, "waitpid error: mis-matched PID (%d vs %d). programming error\n", result, job[0].pid);83 gprint (GP_ERR, "waitpid error: mis-matched PID (%d vs %d). programming error\n", result, job[0].pid); 84 84 exit (1); 85 85 } … … 93 93 } 94 94 if (WIFSTOPPED(waitstatus)) { 95 fprintf (stderr, "waitpid returns 'stopped': programming error\n");95 gprint (GP_ERR, "waitpid returns 'stopped': programming error\n"); 96 96 exit (1); 97 97 } … … 114 114 pid = fork (); 115 115 if (!pid) { /* must be child process */ 116 if (VerboseMode()) fprintf (stderr, "starting local job\n");116 if (VerboseMode()) gprint (GP_ERR, "starting local job\n"); 117 117 118 118 /* close the other ends of the pipes */ -
trunk/Ohana/src/opihi/pantasks/Makefile
r7892 r7917 19 19 # link flags 20 20 LIBS = -L$(LIB) -L$(LLIB) -L$(XLIB) 21 LIBS1 = -lsocket -lnsl -lreadline $(TLIB) -ldvo -lkapa -lFITS -lohana -lX11 -l m21 LIBS1 = -lsocket -lnsl -lreadline $(TLIB) -ldvo -lkapa -lFITS -lohana -lX11 -lpthread -lm 22 22 LIBS2 = -lbasiccmd -ldatacmd -lastrocmd -lshell -ldata 23 23 LFLAGS = $(LIBS) $(LIBS2) $(LIBS1) … … 94 94 $(BIN)/pantasks_server.$(ARCH) : $(server) $(funcs) $(cmds) $(libs) 95 95 @if [ ! -d $(BIN) ]; then mkdir -p $(BIN); fi 96 $(CC) -o $@ $^ $(LFLAGS) -lpthread96 $(CC) -o $@ $^ $(LFLAGS) 97 97 98 98 pantasks_client.install: $(DESTBIN)/pantasks_client -
trunk/Ohana/src/opihi/pantasks/SocketOps.c
r7892 r7917 33 33 status = inet_aton (hostip, &Address[0].sin_addr); 34 34 if (!status) { 35 fprintf (stderr, "invalid address\n");35 gprint (GP_ERR, "invalid address\n"); 36 36 exit (2); 37 37 } … … 46 46 } 47 47 48 if (DEBUG) fprintf (stderr, "init sock: %d, len: %d\n", InitSocket, length);48 if (DEBUG) gprint (GP_ERR, "init sock: %d, len: %d\n", InitSocket, length); 49 49 status = bind (InitSocket, (struct sockaddr *) Address, length); 50 50 if (status == -1) { … … 74 74 fcntl (InitSocket, F_SETFL, !O_NONBLOCK); 75 75 76 if (DEBUG) fprintf (stderr, "init sock: %d, len: %d\n", InitSocket, length);76 if (DEBUG) gprint (GP_ERR, "init sock: %d, len: %d\n", InitSocket, length); 77 77 BindSocket = accept (InitSocket, (struct sockaddr *) &Address_in, &length); 78 if (DEBUG) fprintf (stderr, "bind sock: %d\n", BindSocket);78 if (DEBUG) gprint (GP_ERR, "bind sock: %d\n", BindSocket); 79 79 if (BindSocket == -1) { 80 80 perror ("accept: "); … … 84 84 addr = Address_in.sin_addr.s_addr; 85 85 if (DEBUG) { 86 fprintf (stderr, "incoming connection from: ");87 fprintf (stderr, " %u", (0xff & (addr >> 0)));88 fprintf (stderr, ".%u", (0xff & (addr >> 8)));89 fprintf (stderr, ".%u", (0xff & (addr >> 16)));90 fprintf (stderr, ".%u", (0xff & (addr >> 24)));91 fprintf (stderr, "\n");86 gprint (GP_ERR, "incoming connection from: "); 87 gprint (GP_ERR, " %u", (0xff & (addr >> 0))); 88 gprint (GP_ERR, ".%u", (0xff & (addr >> 8))); 89 gprint (GP_ERR, ".%u", (0xff & (addr >> 16))); 90 gprint (GP_ERR, ".%u", (0xff & (addr >> 24))); 91 gprint (GP_ERR, "\n"); 92 92 } 93 93 … … 109 109 } 110 110 111 if (DEBUG) fprintf (stderr, "connection rejected\n");111 if (DEBUG) gprint (GP_ERR, "connection rejected\n"); 112 112 close (BindSocket); 113 113 return (-1); 114 114 115 115 accepted: 116 if (DEBUG) fprintf (stderr, "connection accepted\n");116 if (DEBUG) gprint (GP_ERR, "connection accepted\n"); 117 117 fcntl (BindSocket, F_SETFL, O_NONBLOCK); 118 118 return (BindSocket); … … 135 135 136 136 if (DEBUG) { 137 fprintf (stderr, "trying %s (%s:%d)...", host[0].h_name, hostip, MY_PORT);137 gprint (GP_ERR, "trying %s (%s:%d)...", host[0].h_name, hostip, MY_PORT); 138 138 } 139 139 … … 142 142 status = inet_aton (hostip, &Address.sin_addr); 143 143 if (!status) { 144 fprintf (stderr, "invalid address\n");144 gprint (GP_ERR, "invalid address\n"); 145 145 exit (2); 146 146 } … … 160 160 } 161 161 162 if (DEBUG) fprintf (stderr, "connected\n");162 if (DEBUG) gprint (GP_ERR, "connected\n"); 163 163 fcntl (InitSocket, F_SETFL, O_NONBLOCK); 164 164 return (InitSocket); … … 183 183 status = inet_aton (hostip, &Address[0].sin_addr); 184 184 if (!status) { 185 fprintf (stderr, "invalid address\n");185 gprint (GP_ERR, "invalid address\n"); 186 186 exit (2); 187 187 } … … 195 195 } 196 196 197 if (DEBUG) fprintf (stderr, "init sock: %d, len: %d\n", InitSocket, length);197 if (DEBUG) gprint (GP_ERR, "init sock: %d, len: %d\n", InitSocket, length); 198 198 status = bind (InitSocket, (struct sockaddr *) Address, length); 199 199 if (status == -1) { … … 208 208 } 209 209 210 if (DEBUG) fprintf (stderr, "socket listening on %s (%s:%d)\n", host[0].h_name, hostip, MY_PORT);210 if (DEBUG) gprint (GP_ERR, "socket listening on %s (%s:%d)\n", host[0].h_name, hostip, MY_PORT); 211 211 return (InitSocket); 212 212 } … … 230 230 test &= ((ip4 >=0) && (ip4 < 256)); 231 231 if (!test) { 232 fprintf (stderr, "invalid IP address %s\n", string);232 gprint (GP_ERR, "invalid IP address %s\n", string); 233 233 exit (2); 234 234 } -
trunk/Ohana/src/opihi/pantasks/TaskOps.c
r6687 r7917 54 54 int i, valid; 55 55 56 fprintf (stderr, "\n");56 gprint (GP_LOG, "\n"); 57 57 if (Ntasks == 0) { 58 fprintf (stderr, " no defined tasks\n");58 gprint (GP_LOG, " no defined tasks\n"); 59 59 return; 60 60 } 61 61 62 fprintf (stderr, " Task Status\n");63 fprintf (stderr, " * Name Njobs Command\n");62 gprint (GP_LOG, " Task Status\n"); 63 gprint (GP_LOG, " * Name Njobs Command\n"); 64 64 for (i = 0; i < Ntasks; i++) { 65 65 valid = CheckTimeRanges (tasks[i][0].ranges, tasks[i][0].Nranges); 66 if (verbose) fprintf (stderr, "\n");66 if (verbose) gprint (GP_LOG, "\n"); 67 67 if (valid) { 68 fprintf (stderr, " + ");68 gprint (GP_LOG, " + "); 69 69 } else { 70 fprintf (stderr, " - ");70 gprint (GP_LOG, " - "); 71 71 } 72 72 if (tasks[i][0].argv == NULL) { 73 fprintf (stderr, "%-15s %5d %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, "(dynamic)");73 gprint (GP_LOG, "%-15s %5d %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, "(dynamic)"); 74 74 } else { 75 fprintf (stderr, "%-15s %5d %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, tasks[i][0].argv[0]);75 gprint (GP_LOG, "%-15s %5d %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, tasks[i][0].argv[0]); 76 76 } 77 77 if (verbose) { 78 fprintf (stderr, " spawn period: %f, polling period: %f, timeout period: %f\n",78 gprint (GP_LOG, " spawn period: %f, polling period: %f, timeout period: %f\n", 79 79 tasks[i][0].exec_period, tasks[i][0].poll_period, tasks[i][0].timeout_period); 80 80 if (tasks[i][0].host == NULL) { 81 fprintf (stderr, " task runs locally\n");81 gprint (GP_LOG, " task runs locally\n"); 82 82 continue; 83 83 } 84 84 if (!strcasecmp(tasks[i][0].host, "ANYHOST")) { 85 fprintf (stderr, " task host selected by controller\n");85 gprint (GP_LOG, " task host selected by controller\n"); 86 86 continue; 87 87 } 88 88 if (tasks[i][0].host_required) { 89 fprintf (stderr, " host %s (required)\n", tasks[i][0].host);89 gprint (GP_LOG, " host %s (required)\n", tasks[i][0].host); 90 90 } else { 91 fprintf (stderr, " host %s (desired)\n", tasks[i][0].host);91 gprint (GP_LOG, " host %s (desired)\n", tasks[i][0].host); 92 92 } 93 93 } … … 104 104 task = FindTask (name); 105 105 if (task == NULL) { 106 fprintf (stderr, "task %s not found\n", name);106 gprint (GP_LOG, "task %s not found\n", name); 107 107 return (FALSE); 108 108 } 109 109 110 fprintf (stderr, "\n macro %s\n", task[0].name);111 112 fprintf (stderr, "\n command: ");110 gprint (GP_LOG, "\n macro %s\n", task[0].name); 111 112 gprint (GP_LOG, "\n command: "); 113 113 for (i = 0; i < task[0].argc; i++) { 114 fprintf (stderr, "%s ", task[0].argv[i]);115 } 116 fprintf (stderr, "\n\n");114 gprint (GP_LOG, "%s ", task[0].argv[i]); 115 } 116 gprint (GP_LOG, "\n\n"); 117 117 118 118 if (task[0].host == NULL) { 119 fprintf (stderr, " task runs locally\n");119 gprint (GP_LOG, " task runs locally\n"); 120 120 goto periods; 121 121 } 122 122 if (!strcasecmp(task[0].host, "ANYHOST")) { 123 fprintf (stderr, " task host selected by controller\n");123 gprint (GP_LOG, " task host selected by controller\n"); 124 124 goto periods; 125 125 } 126 126 if (task[0].host_required) { 127 fprintf (stderr, " host %s (required)\n", task[0].host);127 gprint (GP_LOG, " host %s (required)\n", task[0].host); 128 128 } else { 129 fprintf (stderr, " host %s (desired)\n", task[0].host);129 gprint (GP_LOG, " host %s (desired)\n", task[0].host); 130 130 } 131 131 132 132 periods: 133 fprintf (stderr, " time periods: exec: %f poll: %f timeout: %f\n",133 gprint (GP_LOG, " time periods: exec: %f poll: %f timeout: %f\n", 134 134 task[0].exec_period, task[0].poll_period, task[0].timeout_period); 135 135 136 fprintf (stderr, "\n pre-execute macro\n");136 gprint (GP_LOG, "\n pre-execute macro\n"); 137 137 ListMacro (task[0].exec); 138 138 139 fprintf (stderr, "\n timeout macro\n");139 gprint (GP_LOG, "\n timeout macro\n"); 140 140 ListMacro (task[0].timeout); 141 141 142 fprintf (stderr, "\n crash macro\n");142 gprint (GP_LOG, "\n crash macro\n"); 143 143 ListMacro (task[0].crash); 144 144 145 fprintf (stderr, "\n default exit macro\n");145 gprint (GP_LOG, "\n default exit macro\n"); 146 146 ListMacro (task[0].defexit); 147 147 148 148 for (i = 0; i < task[0].Nexit; i++) { 149 fprintf (stderr, "\n exit macro (status == %d)\n", atoi(task[0].exit[i][0].name));149 gprint (GP_LOG, "\n exit macro (status == %d)\n", atoi(task[0].exit[i][0].name)); 150 150 ListMacro (task[0].exit[i]); 151 151 } … … 252 252 } 253 253 if (Nt == -1) { 254 fprintf (stderr, "programming error: task not found\n");254 gprint (GP_ERR, "programming error: task not found\n"); 255 255 return (FALSE); 256 256 } … … 269 269 if (task[0].argc != 0) { 270 270 if (task[0].argv == NULL) { 271 fprintf (stderr, "task command arguments not defined (programming error)\n");271 gprint (GP_ERR, "task command arguments not defined (programming error)\n"); 272 272 return (FALSE); 273 273 } … … 275 275 } 276 276 if (RequireStatic) { 277 fprintf (stderr, "task command not defined\n");277 gprint (GP_ERR, "task command not defined\n"); 278 278 return (FALSE); 279 279 } … … 286 286 } 287 287 } 288 fprintf (stderr, "task command not defined\n");288 gprint (GP_ERR, "task command not defined\n"); 289 289 return (FALSE); 290 290 } -
trunk/Ohana/src/opihi/pantasks/client_shell.c
r7892 r7917 19 19 /* connect to the server */ 20 20 if (VarConfig ("PANTASKS_SERVER", "%s", hostname) == NULL) { 21 fprintf (stderr, "pantasks server host undefined\n");21 gprint (GP_ERR, "pantasks server host undefined\n"); 22 22 exit (2); 23 23 } … … 38 38 ppid = getppid(); 39 39 if (ppid == 1) { 40 fprintf (stderr, "caught parent shutdown\n");40 gprint (GP_ERR, "caught parent shutdown\n"); 41 41 exit (2); 42 42 } 43 43 if (!isatty (STDIN_FILENO)) exit (2); 44 fprintf (stdout, "Use \"quit\" to exit\n");44 gprint (GP_ERR, "Use \"quit\" to exit\n"); 45 45 Nbad ++; 46 46 continue; … … 57 57 status = command (line, &outline); 58 58 if (outline == NULL) { 59 fprintf (stderr, "programming error: command_client returned NULL\n");59 gprint (GP_ERR, "programming error: command_client returned NULL\n"); 60 60 exit (2); 61 61 } … … 63 63 /* command was not caught by client, send to server */ 64 64 if (*outline && !status ) { 65 fprintf (stderr, "sending message to %d: %s\n", server, outline);65 gprint (GP_ERR, "sending message to %d: %s\n", server, outline); 66 66 SendMessage (server, outline); 67 67 add_history (outline); … … 69 69 70 70 // XXX add this in and print to stdout 71 // status = ExpectMessage (server, 2.0, &message); 71 status = ExpectMessage (server, 2.0, &message); 72 gprint (GP_ERR, "got message: %d bytes\n", message.Nbuffer); 73 gwrite (message.buffer, 1, message.Nbuffer, GP_ERR); 74 gprint (GP_ERR, "end message\n"); 72 75 } 73 76 free (outline); -
trunk/Ohana/src/opihi/pantasks/controller.c
r6687 r7917 23 23 24 24 if (argc < 2) { 25 fprintf (stderr, "USAGE: controller (command) ... \n");25 gprint (GP_ERR, "USAGE: controller (command) ... \n"); 26 26 return (FALSE); 27 27 } … … 29 29 func = FindControllerCommand (argv[1]); 30 30 if (func == NULL) { 31 fprintf (stderr, "invalid controller command\n");31 gprint (GP_ERR, "invalid controller command\n"); 32 32 return (FALSE); 33 33 } -
trunk/Ohana/src/opihi/pantasks/controller_check.c
r6687 r7917 14 14 status = CheckControllerStatus (); 15 15 if (!status) { 16 fprintf (stderr, "controller is not running\n");16 gprint (GP_LOG, "controller is not running\n"); 17 17 return (TRUE); 18 18 } … … 22 22 status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer); 23 23 if (VerboseMode()) { 24 fprintf (stderr, "controller command sent\n");25 fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);26 fprintf (stderr, "\n Nbytes received: %d\n", buffer.Nbuffer);24 gprint (GP_LOG, "controller command sent\n"); 25 gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG); 26 gprint (GP_LOG, "\n Nbytes received: %d\n", buffer.Nbuffer); 27 27 } 28 28 FreeIOBuffer (&buffer); … … 30 30 31 31 usage: 32 fprintf (stderr, "USAGE: controller check job (jobID)\n");33 fprintf (stderr, "USAGE: controller check host (hostID)\n");32 gprint (GP_ERR, "USAGE: controller check job (jobID)\n"); 33 gprint (GP_ERR, "USAGE: controller check host (hostID)\n"); 34 34 return (FALSE); 35 35 } -
trunk/Ohana/src/opihi/pantasks/controller_exit.c
r6687 r7917 4 4 5 5 if (argc != 2) { 6 fprintf (stderr, "USAGE: controller exit TRUE\n");6 gprint (GP_ERR, "USAGE: controller exit TRUE\n"); 7 7 return (FALSE); 8 8 } -
trunk/Ohana/src/opihi/pantasks/controller_host.c
r6687 r7917 8 8 9 9 if (argc != 3) { 10 fprintf (stderr, "USAGE: controller host (command) (hostname)\n");10 gprint (GP_ERR, "USAGE: controller host (command) (hostname)\n"); 11 11 return (FALSE); 12 12 } … … 18 18 InitIOBuffer (&buffer, 0x100); 19 19 status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer); 20 if (status) fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);20 if (status) gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG); 21 21 FreeIOBuffer (&buffer); 22 22 return (TRUE); -
trunk/Ohana/src/opihi/pantasks/controller_output.c
r6687 r7917 4 4 5 5 if (argc != 1) { 6 fprintf (stderr, "USAGE: controller status\n");6 gprint (GP_ERR, "USAGE: controller status\n"); 7 7 return (FALSE); 8 8 } -
trunk/Ohana/src/opihi/pantasks/controller_pulse.c
r6687 r7917 8 8 9 9 if (argc != 2) { 10 fprintf (stderr, "USAGE: controller pulse (usec)\n");10 gprint (GP_ERR, "USAGE: controller pulse (usec)\n"); 11 11 return (FALSE); 12 12 } … … 18 18 InitIOBuffer (&buffer, 0x100); 19 19 status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer); 20 if (status) fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);20 if (status) gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG); 21 21 FreeIOBuffer (&buffer); 22 22 return (TRUE); -
trunk/Ohana/src/opihi/pantasks/controller_status.c
r6687 r7917 8 8 9 9 if (argc != 1) { 10 fprintf (stderr, "USAGE: controller status\n");10 gprint (GP_ERR, "USAGE: controller status\n"); 11 11 return (FALSE); 12 12 } … … 15 15 status = CheckControllerStatus (); 16 16 if (!status) { 17 fprintf (stderr, "controller is not running\n");17 gprint (GP_LOG, "controller is not running\n"); 18 18 return (TRUE); 19 19 } … … 23 23 status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer); 24 24 if (status) { 25 fwrite (buffer.buffer, 1, buffer.Nbuffer, stderr);25 gwrite (buffer.buffer, 1, buffer.Nbuffer, GP_LOG); 26 26 } else { 27 fprintf (stderr, "controller is down\n");27 gprint (GP_LOG, "controller is down\n"); 28 28 } 29 29 FreeIOBuffer (&buffer); -
trunk/Ohana/src/opihi/pantasks/delete.c
r6687 r7917 6 6 7 7 if (argc < 2) { 8 fprintf (stderr, "USAGE: delete (JobID)\n");8 gprint (GP_ERR, "USAGE: delete (JobID)\n"); 9 9 return (FALSE); 10 10 } … … 12 12 /* use a string interp to convert JobIDs to ints ? */ 13 13 14 fprintf (stderr, "this function is not yet implemented\n");14 gprint (GP_ERR, "this function is not yet implemented\n"); 15 15 return (TRUE); 16 16 } -
trunk/Ohana/src/opihi/pantasks/invalid.c
r7892 r7917 3 3 int invalid (int argc, char **argv) { 4 4 5 fprintf (stderr, "%s is not valid for the pantasks client\n", argv[0]);5 gprint (GP_ERR, "%s is not valid for the pantasks client\n", argv[0]); 6 6 return (TRUE); 7 7 -
trunk/Ohana/src/opihi/pantasks/job.c
r6687 r7917 33 33 if ((N = get_argument (argc, argv, "+host"))) { 34 34 if (Mode == PCONTROL_JOB_WANTHOST) { 35 fprintf (stderr, "ERROR: -host and +host are incompatible\n");35 gprint (GP_ERR, "ERROR: -host and +host are incompatible\n"); 36 36 FREE (Host); 37 37 return (FALSE); … … 52 52 53 53 if (argc < 2) { 54 fprintf (stderr, "USAGE: job [options] (arg0) (arg1) ... (argN)\n");54 gprint (GP_ERR, "USAGE: job [options] (arg0) (arg1) ... (argN)\n"); 55 55 FREE (Host); 56 56 return (FALSE); … … 64 64 65 65 JobID = AddJob (Host, Mode, Timeout, targc, targv); 66 fprintf (stdout, "JobID: %d\n", JobID);66 gprint (GP_LOG, "JobID: %d\n", JobID); 67 67 return (TRUE); 68 68 } -
trunk/Ohana/src/opihi/pantasks/kill.c
r6687 r7917 7 7 8 8 if (argc < 2) { 9 fprintf (stderr, "USAGE: kill (JobID)\n");9 gprint (GP_ERR, "USAGE: kill (JobID)\n"); 10 10 return (FALSE); 11 11 } … … 17 17 if (!KillLocalJob (job)) { 18 18 job[0].state = JOB_HUNG; 19 if (VerboseMode()) fprintf (stderr, "child process %d is hung, cannot kill\n", job[0].pid);19 if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", job[0].pid); 20 20 return (FALSE); 21 21 } … … 23 23 if (!KillControllerJob (job)) { 24 24 job[0].state = JOB_HUNG; 25 if (VerboseMode()) fprintf (stderr, "child process %d is hung, cannot kill\n", job[0].pid);25 if (VerboseMode()) gprint (GP_LOG, "child process %d is hung, cannot kill\n", job[0].pid); 26 26 return (FALSE); 27 27 } 28 28 } 29 29 30 fprintf (stderr, "this function is not yet implemented\n");30 gprint (GP_ERR, "this function is not yet implemented\n"); 31 31 return (TRUE); 32 32 } -
trunk/Ohana/src/opihi/pantasks/pantasks.c
r6687 r7917 38 38 /* standard welcome message */ 39 39 void welcome () { 40 fprintf (stderr, "\n");41 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);40 gprint (GP_LOG, "\n"); 41 gprint (GP_LOG, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 42 42 } 43 43 … … 51 51 52 52 void gotsignal (int signum) { 53 fprintf (stderr, "got signal : %d\n", signum);53 gprint (GP_ERR, "got signal : %d\n", signum); 54 54 return; 55 55 } -
trunk/Ohana/src/opihi/pantasks/pantasks_client.c
r7892 r7917 38 38 /* standard welcome message */ 39 39 void welcome () { 40 fprintf (stderr, "\n");41 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);40 gprint (GP_LOG, "\n"); 41 gprint (GP_LOG, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 42 42 } 43 43 … … 54 54 /* default signal handling */ 55 55 void gotsignal (int signum) { 56 fprintf (stderr, "got signal : %d\n", signum);56 gprint (GP_ERR, "got signal : %d\n", signum); 57 57 return; 58 58 } -
trunk/Ohana/src/opihi/pantasks/pantasks_server.c
r7892 r7917 30 30 InitData (); 31 31 InitPantasks (); 32 33 InitPrint (); 32 34 33 35 // signal (SIGPIPE, gotsignal); … … 77 79 78 80 void gotsignal (int signum) { 79 fprintf (stderr, "got signal : %d\n", signum);81 gprint (GP_ERR, "got signal : %d\n", signum); 80 82 return; 81 83 } -
trunk/Ohana/src/opihi/pantasks/pulse.c
r6687 r7917 6 6 7 7 if (argc != 2) { 8 fprintf (stderr, "USAGE: pulse (microseconds)\n");8 gprint (GP_ERR, "USAGE: pulse (microseconds)\n"); 9 9 return (FALSE); 10 10 } -
trunk/Ohana/src/opihi/pantasks/run.c
r6687 r7917 4 4 5 5 if (argc != 1) { 6 fprintf (stderr, "USAGE: run\n");6 gprint (GP_ERR, "USAGE: run\n"); 7 7 return (FALSE); 8 8 } -
trunk/Ohana/src/opihi/pantasks/scheduler.c
r4689 r7917 52 52 f = fopen (opihi_history, "a"); 53 53 if (f == NULL) /* no current history file here */ 54 fprintf (stderr, "can't save history.\n");54 gprint (GP_ERR, "can't save history.\n"); 55 55 else 56 56 fclose (f); … … 65 65 /* standard welcome message */ 66 66 void welcome () { 67 fprintf (stderr, "\n");68 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);67 gprint (GP_LOG, "\n"); 68 gprint (GP_LOG, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 69 69 } 70 70 -
trunk/Ohana/src/opihi/pantasks/status.c
r6687 r7917 3 3 int status_sys (int argc, char **argv) { 4 4 5 fprintf (stderr, "\n");5 gprint (GP_LOG, "\n"); 6 6 if (rl_event_hook == NULL) { 7 fprintf (stderr, " Scheduler is stopped\n");7 gprint (GP_LOG, " Scheduler is stopped\n"); 8 8 } else { 9 fprintf (stderr, " Scheduler is running\n");9 gprint (GP_LOG, " Scheduler is running\n"); 10 10 } 11 11 if (CheckControllerStatus ()) { 12 fprintf (stderr, " Controller is running\n");12 gprint (GP_LOG, " Controller is running\n"); 13 13 } else { 14 fprintf (stderr, " Controller is stopped\n");14 gprint (GP_LOG, " Controller is stopped\n"); 15 15 } 16 16 ListTasks (FALSE); -
trunk/Ohana/src/opihi/pantasks/stop.c
r6687 r7917 4 4 5 5 if (argc != 1) { 6 fprintf (stderr, "USAGE: stop\n");6 gprint (GP_ERR, "USAGE: stop\n"); 7 7 return (FALSE); 8 8 } -
trunk/Ohana/src/opihi/pantasks/task.c
r6687 r7917 28 28 29 29 if (argc != 2) { 30 fprintf (stderr, "USAGE: task <name>\n");31 fprintf (stderr, " (enter commands & task functions; end with the word 'END')\n");30 gprint (GP_ERR, "USAGE: task <name>\n"); 31 gprint (GP_ERR, " (enter commands & task functions; end with the word 'END')\n"); 32 32 return (FALSE); 33 33 } … … 58 58 59 59 if ((ThisList == 0) && (input == (char *) NULL)) { 60 fprintf (stderr, "end task with 'END'\n");60 gprint (GP_ERR, "end task with 'END'\n"); 61 61 continue; 62 62 } 63 63 if ((ThisList > 0) && (input == (char *) NULL)) { 64 fprintf (stderr, "missing 'END' in task definition\n");64 gprint (GP_ERR, "missing 'END' in task definition\n"); 65 65 input = strcreate ("end"); 66 66 } … … 103 103 104 104 case TASK_NONE: 105 fprintf (stderr, "unknown task command %s\n", input);105 gprint (GP_ERR, "unknown task command %s\n", input); 106 106 break; 107 107 } -
trunk/Ohana/src/opihi/pantasks/task_command.c
r6687 r7917 7 7 8 8 if (argc < 2) { 9 fprintf (stderr, "USAGE: command <command> <arg>. ..\n");10 fprintf (stderr, " (define command for this task)\n");9 gprint (GP_ERR, "USAGE: command <command> <arg>. ..\n"); 10 gprint (GP_ERR, " (define command for this task)\n"); 11 11 return (FALSE); 12 12 } … … 16 16 task = GetActiveTask (); 17 17 if (task == NULL) { 18 fprintf (stderr, "ERROR: not defining or running a task\n");18 gprint (GP_ERR, "ERROR: not defining or running a task\n"); 19 19 return (FALSE); 20 20 } -
trunk/Ohana/src/opihi/pantasks/task_host.c
r6687 r7917 13 13 14 14 if (argc != 2) { 15 fprintf (stderr, "USAGE: host <name> [-required]\n");16 fprintf (stderr, " define host machine for this task\n");17 fprintf (stderr, " -required flags indicates controller must use this host\n");18 fprintf (stderr, " value of 'local' for host indicates process not using controller\n");19 fprintf (stderr, " value of 'anyhost' for host indicates controller may assign at will\n");15 gprint (GP_ERR, "USAGE: host <name> [-required]\n"); 16 gprint (GP_ERR, " define host machine for this task\n"); 17 gprint (GP_ERR, " -required flags indicates controller must use this host\n"); 18 gprint (GP_ERR, " value of 'local' for host indicates process not using controller\n"); 19 gprint (GP_ERR, " value of 'anyhost' for host indicates controller may assign at will\n"); 20 20 return (FALSE); 21 21 } … … 25 25 task = GetActiveTask (); 26 26 if (task == NULL) { 27 fprintf (stderr, "ERROR: not defining or running a task\n");27 gprint (GP_ERR, "ERROR: not defining or running a task\n"); 28 28 return (FALSE); 29 29 } -
trunk/Ohana/src/opihi/pantasks/task_macros.c
r6687 r7917 11 11 12 12 if (!strcmp (argv[0], "task.exec") && (argc != 1)) { 13 fprintf (stderr, "USAGE: task.exec\n");14 fprintf (stderr, " (define pre-exec macro for this task)\n");13 gprint (GP_ERR, "USAGE: task.exec\n"); 14 gprint (GP_ERR, " (define pre-exec macro for this task)\n"); 15 15 return (FALSE); 16 16 } 17 17 18 18 if (!strcmp (argv[0], "task.exit") && (argc != 2)) { 19 fprintf (stderr, "USAGE: task.exit (state)\n");20 fprintf (stderr, " (define exit state macro for this task)\n");19 gprint (GP_ERR, "USAGE: task.exit (state)\n"); 20 gprint (GP_ERR, " (define exit state macro for this task)\n"); 21 21 return (FALSE); 22 22 } … … 24 24 task = GetNewTask (); 25 25 if (task == NULL) { 26 fprintf (stderr, "ERROR: not defining or running a task\n");26 gprint (GP_ERR, "ERROR: not defining or running a task\n"); 27 27 return (FALSE); 28 28 } … … 115 115 116 116 if ((ThisList == 0) && (input == (char *) NULL)) { 117 fprintf (stderr, "end macro with 'END'\n");117 gprint (GP_ERR, "end macro with 'END'\n"); 118 118 continue; 119 119 } 120 120 if ((ThisList > 0) && (input == (char *) NULL)) { 121 fprintf (stderr, "missing 'END' in macro definition\n");121 gprint (GP_ERR, "missing 'END' in macro definition\n"); 122 122 input = strcreate ("end"); 123 123 } -
trunk/Ohana/src/opihi/pantasks/task_nmax.c
r6687 r7917 9 9 task = GetNewTask (); 10 10 if (task == NULL) { 11 fprintf (stderr, "ERROR: not defining or running a task\n");11 gprint (GP_ERR, "ERROR: not defining or running a task\n"); 12 12 return (FALSE); 13 13 } … … 17 17 18 18 usage: 19 fprintf (stderr, "USAGE: nmax N\n");19 gprint (GP_ERR, "USAGE: nmax N\n"); 20 20 return (FALSE); 21 21 } -
trunk/Ohana/src/opihi/pantasks/task_periods.c
r6687 r7917 35 35 36 36 if (argc != 1) { 37 fprintf (stderr, "USAGE: periods [-poll value] [-exec value] [-timeout value]\n");38 fprintf (stderr, " define time periods for this task\n");37 gprint (GP_ERR, "USAGE: periods [-poll value] [-exec value] [-timeout value]\n"); 38 gprint (GP_ERR, " define time periods for this task\n"); 39 39 return (FALSE); 40 40 } … … 44 44 task = GetActiveTask (); 45 45 if (task == NULL) { 46 fprintf (stderr, "ERROR: not defining or running a task\n");46 gprint (GP_ERR, "ERROR: not defining or running a task\n"); 47 47 return (FALSE); 48 48 } -
trunk/Ohana/src/opihi/pantasks/task_trange.c
r6687 r7917 25 25 task = GetNewTask (); 26 26 if (task == NULL) { 27 fprintf (stderr, "ERROR: not defining or running a task\n");27 gprint (GP_ERR, "ERROR: not defining or running a task\n"); 28 28 return (FALSE); 29 29 } … … 61 61 62 62 usage: 63 fprintf (stderr, "USAGE: trange start end\n");63 gprint (GP_ERR, "USAGE: trange start end\n"); 64 64 return (FALSE); 65 65 } -
trunk/Ohana/src/opihi/pantasks/verbose.c
r6687 r7917 7 7 if (argc == 1) { 8 8 if (VERBOSE) { 9 fprintf (stderr, "verbose mode ON\n");9 gprint (GP_LOG, "verbose mode ON\n"); 10 10 } else { 11 fprintf (stderr, "verbose mode OFF\n");11 gprint (GP_LOG, "verbose mode OFF\n"); 12 12 } 13 13 return (TRUE); … … 29 29 } 30 30 31 fprintf (stderr, "USAGE: verbose (on/off/toggle)\n");31 gprint (GP_ERR, "USAGE: verbose (on/off/toggle)\n"); 32 32 return (FALSE); 33 33 } -
trunk/Ohana/src/opihi/pantasks/version.c
r7080 r7917 4 4 int version (int argc, char **argv) { 5 5 6 fprintf (stderr, "%s\n", name);6 gprint (GP_LOG, "%s\n", name); 7 7 8 fprintf (stderr, "%s\n", opihi_version());9 fprintf (stderr, "%s\n", ohana_version());10 fprintf (stderr, "%s\n", gfits_version());8 gprint (GP_LOG, "%s\n", opihi_version()); 9 gprint (GP_LOG, "%s\n", ohana_version()); 10 gprint (GP_LOG, "%s\n", gfits_version()); 11 11 12 fprintf (stderr, "compiled on %s %s\n", __DATE__, __TIME__);12 gprint (GP_LOG, "compiled on %s %s\n", __DATE__, __TIME__); 13 13 return (TRUE); 14 14 } -
trunk/Ohana/src/opihi/pclient/ChildOps.c
r4772 r7917 43 43 Nbad ++; 44 44 if (Nbad > 10) { 45 fprintf (stderr, "runaway!\n");45 gprint (GP_ERR, "runaway!\n"); 46 46 exit (2); 47 47 } … … 56 56 switch (Nread) { 57 57 case -2: /* error in read (programming error? system level error?) */ 58 fprintf (stderr, "serious IO error\n");58 gprint (GP_ERR, "serious IO error\n"); 59 59 exit (2); 60 60 case -1: /* no data in pipe */ … … 71 71 switch (Nread) { 72 72 case -2: /* error in read (programming error? system level error?) */ 73 fprintf (stderr, "serious IO error\n");73 gprint (GP_ERR, "serious IO error\n"); 74 74 exit (2); 75 75 case -1: /* no data in pipe */ … … 96 96 switch (errno) { 97 97 case ECHILD: 98 fprintf (stderr, "unknown PID, not a child proc\n");99 fprintf (stderr, "did process already exit? programming error?\n");98 gprint (GP_ERR, "unknown PID, not a child proc\n"); 99 gprint (GP_ERR, "did process already exit? programming error?\n"); 100 100 ChildStatus = PCLIENT_NONE; 101 101 break; 102 102 case EINVAL: 103 fprintf (stderr, "error EINVAL (waitpid): programming error\n");103 gprint (GP_ERR, "error EINVAL (waitpid): programming error\n"); 104 104 exit (1); 105 105 case EINTR: 106 fprintf (stderr, "error EINTR (waitpid): programming error\n");106 gprint (GP_ERR, "error EINTR (waitpid): programming error\n"); 107 107 exit (1); 108 108 default: 109 fprintf (stderr, "unknown error for waitpid (%d): programming error\n", errno);109 gprint (GP_ERR, "unknown error for waitpid (%d): programming error\n", errno); 110 110 exit (1); 111 111 } … … 118 118 default: 119 119 if (result != ChildPID) { 120 fprintf (stderr, "waitpid error: mis-matched PID (%d vs %d). programming error\n", result, ChildPID);120 gprint (GP_ERR, "waitpid error: mis-matched PID (%d vs %d). programming error\n", result, ChildPID); 121 121 exit (1); 122 122 } … … 131 131 } 132 132 if (WIFSTOPPED(waitstatus)) { 133 fprintf (stderr, "waitpid returns 'stopped': programming error\n");133 gprint (GP_ERR, "waitpid returns 'stopped': programming error\n"); 134 134 exit (1); 135 135 } -
trunk/Ohana/src/opihi/pclient/job.c
r4762 r7917 7 7 8 8 if (argc < 2) { 9 fprintf (stderr, "USAGE: job (arg0) (arg1) ... (argN)\n");10 fprintf (GetOutfile(), "STATUS %d\n", -2);9 gprint (GP_ERR, "USAGE: job (arg0) (arg1) ... (argN)\n"); 10 gprint (GP_LOG, "STATUS %d\n", -2); 11 11 return (FALSE); 12 12 } 13 13 14 14 if (ChildStatus != PCLIENT_NONE) { 15 fprintf (stderr, "need to clear existing child\n");16 fprintf (GetOutfile(), "STATUS %d\n", -3);15 gprint (GP_ERR, "need to clear existing child\n"); 16 gprint (GP_LOG, "STATUS %d\n", -3); 17 17 return (FALSE); 18 18 } … … 31 31 pid = fork (); 32 32 if (!pid) { /* must be child process */ 33 /* fprintf (stderr, "starting child process %s...\n", targv[0]); */33 /* gprint (GP_ERR, "starting child process %s...\n", targv[0]); */ 34 34 35 35 /* close the other ends of the pipes */ … … 50 50 /* exec job */ 51 51 status = execvp (targv[0], targv); 52 fprintf (stderr, "error starting child process: %d\n", status);52 gprint (GP_ERR, "error starting child process: %d\n", status); 53 53 exit (1); 54 54 } … … 73 73 ChildPID = pid; 74 74 75 fprintf (GetOutfile(), "STATUS %d\n", ChildPID);75 gprint (GP_LOG, "STATUS %d\n", ChildPID); 76 76 return (TRUE); 77 77 … … 85 85 if (child_stderr_fd[1] != 0) close (child_stderr_fd[1]); 86 86 87 fprintf (GetOutfile(), "STATUS %d\n", -1);87 gprint (GP_LOG, "STATUS %d\n", -1); 88 88 return (FALSE); 89 89 } -
trunk/Ohana/src/opihi/pclient/pclient.c
r5919 r7917 39 39 /* standard welcome message */ 40 40 void welcome () { 41 fprintf (stderr, "\n");42 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);41 gprint (GP_ERR, "\n"); 42 gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 43 43 } 44 44 … … 49 49 50 50 void gotsignal (int signum) { 51 fprintf (stderr, "got signal : %d\n", signum);51 gprint (GP_ERR, "got signal : %d\n", signum); 52 52 return; 53 53 } -
trunk/Ohana/src/opihi/pclient/reset.c
r4762 r7917 7 7 8 8 if (argc != 1) { 9 fprintf (stderr, "USAGE: reset\n");10 fprintf (GetOutfile(), "STATUS -1\n");9 gprint (GP_ERR, "USAGE: reset\n"); 10 gprint (GP_LOG, "STATUS -1\n"); 11 11 return (FALSE); 12 12 } 13 13 14 14 if (ChildStatus == PCLIENT_NONE) { 15 fprintf (stderr, "no child process, cannot reset\n");16 fprintf (GetOutfile(), "STATUS 2\n");15 gprint (GP_ERR, "no child process, cannot reset\n"); 16 gprint (GP_LOG, "STATUS 2\n"); 17 17 return (TRUE); 18 18 } … … 42 42 43 43 /* total failure, don't reset */ 44 fprintf (stderr, "child process %d is hung, cannot reset\n", ChildPID);45 fprintf (GetOutfile(), "STATUS 0\n");44 gprint (GP_ERR, "child process %d is hung, cannot reset\n", ChildPID); 45 gprint (GP_LOG, "STATUS 0\n"); 46 46 return (FALSE); 47 47 } … … 62 62 ChildExitStatus = 0; 63 63 64 fprintf (GetOutfile(), "STATUS 1\n");64 gprint (GP_LOG, "STATUS 1\n"); 65 65 return (TRUE); 66 66 } -
trunk/Ohana/src/opihi/pclient/status.c
r4762 r7917 6 6 7 7 if (argc != 1) { 8 fprintf (stderr, "USAGE: status\n");8 gprint (GP_ERR, "USAGE: status\n"); 9 9 return (FALSE); 10 10 } … … 15 15 if (ChildStatus == PCLIENT_CRASH) strcpy (status_string, "CRASH"); 16 16 17 fprintf (GetOutfile(), "STATUS %s\n", status_string);18 fprintf (GetOutfile(), "EXITST %d\n", ChildExitStatus);19 fprintf (GetOutfile(), "STDOUT %d\n", child_stdout.Nbuffer);20 fprintf (GetOutfile(), "STDERR %d\n", child_stderr.Nbuffer);17 gprint (GP_LOG, "STATUS %s\n", status_string); 18 gprint (GP_LOG, "EXITST %d\n", ChildExitStatus); 19 gprint (GP_LOG, "STDOUT %d\n", child_stdout.Nbuffer); 20 gprint (GP_LOG, "STDERR %d\n", child_stderr.Nbuffer); 21 21 22 22 set_str_variable ("JOBSTATUS", status_string); -
trunk/Ohana/src/opihi/pclient/stdout.c
r4450 r7917 4 4 5 5 if (argc != 1) { 6 fprintf (stderr, "USAGE: stdout\n");7 fprintf (stdout, "STATUS %d\n", -1);6 gprint (GP_ERR, "USAGE: stdout\n"); 7 gprint (GP_LOG, "STATUS %d\n", -1); 8 8 return (FALSE); 9 9 } 10 10 11 11 fwrite (child_stdout.buffer, 1, child_stdout.Nbuffer, stdout); 12 fprintf (stdout, "STATUS %d\n", 0);12 gprint (GP_LOG, "STATUS %d\n", 0); 13 13 return (TRUE); 14 14 … … 18 18 19 19 if (argc != 1) { 20 fprintf (stderr, "USAGE: stderr\n");21 fprintf (stdout, "STATUS %d\n", -1);20 gprint (GP_ERR, "USAGE: stderr\n"); 21 gprint (GP_LOG, "STATUS %d\n", -1); 22 22 return (FALSE); 23 23 } 24 24 25 25 fwrite (child_stderr.buffer, 1, child_stderr.Nbuffer, stdout); 26 fprintf (stdout, "STATUS %d\n", 0);26 gprint (GP_LOG, "STATUS %d\n", 0); 27 27 return (TRUE); 28 28 -
trunk/Ohana/src/opihi/pclient/version.c
r7080 r7917 4 4 int version (int argc, char **argv) { 5 5 6 fprintf (stderr, "%s\n", name);6 gprint (GP_ERR, "%s\n", name); 7 7 8 fprintf (stderr, "%s\n", opihi_version());9 fprintf (stderr, "%s\n", ohana_version());10 fprintf (stderr, "%s\n", gfits_version());8 gprint (GP_ERR, "%s\n", opihi_version()); 9 gprint (GP_ERR, "%s\n", ohana_version()); 10 gprint (GP_ERR, "%s\n", gfits_version()); 11 11 12 fprintf (stderr, "compiled on %s %s\n", __DATE__, __TIME__);12 gprint (GP_ERR, "compiled on %s %s\n", __DATE__, __TIME__); 13 13 return (TRUE); 14 14 } -
trunk/Ohana/src/opihi/pcontrol/CheckBusyJob.c
r4763 r7917 34 34 35 35 case PCLIENT_GOOD: 36 if (VerboseMode()) fprintf (stderr, "message received (CheckBusyJob)\n");36 if (VerboseMode()) gprint (GP_ERR, "message received (CheckBusyJob)\n"); 37 37 break; 38 38 39 39 default: 40 fprintf (stderr, "programming error: unknown status for pclient command\n");40 gprint (GP_ERR, "programming error: unknown status for pclient command\n"); 41 41 exit (1); 42 42 } … … 45 45 p = memstr (buffer.buffer, "STATUS", buffer.Nbuffer); 46 46 if (p == NULL) { 47 fprintf (stderr, "programming error: missing STATUS in pclient message\n");47 gprint (GP_ERR, "programming error: missing STATUS in pclient message\n"); 48 48 exit (1); 49 49 } 50 50 sscanf (p, "%*s %s", string); 51 51 if (!strcmp(string, "NONE")) { 52 fprintf (stderr, "programming error: no current job\n");52 gprint (GP_ERR, "programming error: no current job\n"); 53 53 exit (1); 54 54 } … … 65 65 if (!strcmp(string, "CRASH")) outstate = PCONTROL_JOB_CRASH; 66 66 if (outstate == PCONTROL_JOB_BUSY) { 67 fprintf (stderr, "programming error : should not reach here (CheckJob)\n");67 gprint (GP_ERR, "programming error : should not reach here (CheckJob)\n"); 68 68 exit (1); 69 69 } -
trunk/Ohana/src/opihi/pcontrol/CheckDoneHost.c
r4763 r7917 14 14 switch (status) { 15 15 case PCLIENT_DOWN: 16 if (VerboseMode()) fprintf (stderr, "host %s is down\n", host[0].hostname);16 if (VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname); 17 17 /* DONE host does not have an incomplete job */ 18 18 HarvestHost (host[0].pid); … … 24 24 case PCLIENT_HUNG: 25 25 PutHost (host, PCONTROL_HOST_DONE, STACK_BOTTOM); 26 if (VerboseMode()) fprintf (stderr, "host %s is not responding\n", host[0].hostname);26 if (VerboseMode()) gprint (GP_ERR, "host %s is not responding\n", host[0].hostname); 27 27 FreeIOBuffer (&buffer); 28 28 return (FALSE); 29 29 30 30 case PCLIENT_GOOD: 31 if (VerboseMode()) fprintf (stderr, "message received (CheckDoneHost)\n");31 if (VerboseMode()) gprint (GP_ERR, "message received (CheckDoneHost)\n"); 32 32 break; 33 33 34 34 default: 35 if (VerboseMode()) fprintf (stderr, "unknown status for pclient command: programming error\n");35 if (VerboseMode()) gprint (GP_ERR, "unknown status for pclient command: programming error\n"); 36 36 exit (1); 37 37 } … … 40 40 p = memstr (buffer.buffer, "STATUS", buffer.Nbuffer); 41 41 if (p == NULL) { 42 fprintf (stderr, "programming error: missing STATUS in pclient message (CheckDoneHost)\n");42 gprint (GP_ERR, "programming error: missing STATUS in pclient message (CheckDoneHost)\n"); 43 43 exit (1); 44 44 } … … 46 46 switch (status) { 47 47 case -1: 48 fprintf (stderr, "programming error: reset syntax error\n");48 gprint (GP_ERR, "programming error: reset syntax error\n"); 49 49 exit (1); 50 50 51 51 case 0: 52 if (VerboseMode()) fprintf (stderr, "reset failed\n");52 if (VerboseMode()) gprint (GP_ERR, "reset failed\n"); 53 53 PutHost (host, PCONTROL_HOST_DONE, STACK_BOTTOM); 54 54 FreeIOBuffer (&buffer); … … 57 57 case 1: 58 58 case 2: 59 if (VerboseMode()) fprintf (stderr, "successful reset\n");59 if (VerboseMode()) gprint (GP_ERR, "successful reset\n"); 60 60 PutHost (host, PCONTROL_HOST_IDLE, STACK_BOTTOM); 61 61 FreeIOBuffer (&buffer); … … 63 63 64 64 default: 65 fprintf (stderr, "programming error: should not reach here (CheckDoneHost)\n");65 gprint (GP_ERR, "programming error: should not reach here (CheckDoneHost)\n"); 66 66 exit (1); 67 67 } 68 fprintf (stderr, "programming error: should not reach here either (CheckDoneHost)\n");68 gprint (GP_ERR, "programming error: should not reach here either (CheckDoneHost)\n"); 69 69 exit (1); 70 70 } -
trunk/Ohana/src/opihi/pcontrol/CheckHost.c
r4772 r7917 12 12 switch (status) { 13 13 case 0: 14 if (VerboseMode()) fprintf (stderr, "host %s is down\n", host[0].hostname);14 if (VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname); 15 15 /* if host has a job, job is dead, return to Pending */ 16 16 job = (Job *) host[0].job; … … 25 25 26 26 case -1: 27 if (VerboseMode()) fprintf (stderr, "host %s is not responding\n", host[0].hostname);27 if (VerboseMode()) gprint (GP_ERR, "host %s is not responding\n", host[0].hostname); 28 28 /*** do we mark this in some way (HUNG) ? ***/ 29 29 PutHost (host, host[0].stack, STACK_BOTTOM); … … 36 36 return (TRUE); 37 37 } 38 fprintf (stderr, "programming error: should not reach here (Check Host)\n");38 gprint (GP_ERR, "programming error: should not reach here (Check Host)\n"); 39 39 return (FALSE); 40 40 } -
trunk/Ohana/src/opihi/pcontrol/CheckIdleHost.c
r4762 r7917 14 14 if (job[0].mode != PCONTROL_JOB_NEEDHOST) continue; 15 15 if (job[0].hostname == NULL) { 16 fprintf (stderr, "programming error: NEEDHOST hostname missing\n");16 gprint (GP_ERR, "programming error: NEEDHOST hostname missing\n"); 17 17 exit (2); 18 18 } … … 29 29 if (job[0].mode != PCONTROL_JOB_WANTHOST) continue; 30 30 if (job[0].hostname == NULL) { 31 fprintf (stderr, "programming error: WANTHOST hostname missing\n");31 gprint (GP_ERR, "programming error: WANTHOST hostname missing\n"); 32 32 exit (2); 33 33 } -
trunk/Ohana/src/opihi/pcontrol/CheckSystem.c
r4763 r7917 37 37 stack = GetHostStack (PCONTROL_HOST_BUSY); 38 38 Nbusy = stack[0].Nobject; 39 fprintf (stderr, "busy, idle, down: %2d %2d %2d\n", Nbusy, Nidle, Ndown);39 gprint (GP_ERR, "busy, idle, down: %2d %2d %2d\n", Nbusy, Nidle, Ndown); 40 40 } 41 41 … … 63 63 dtime = DTIME (stop, start); 64 64 } 65 if (0 && (Nobject > 0)) fprintf (stderr, "checked %d of %d jobs\n", i, Nobject);65 if (0 && (Nobject > 0)) gprint (GP_ERR, "checked %d of %d jobs\n", i, Nobject); 66 66 return (TRUE); 67 67 } … … 87 87 dtime = DTIME (stop, start); 88 88 } 89 if (0 && (Nobject > 0)) fprintf (stderr, "checked %d of %d jobs\n", i, Nobject);89 if (0 && (Nobject > 0)) gprint (GP_ERR, "checked %d of %d jobs\n", i, Nobject); 90 90 return (TRUE); 91 91 } … … 111 111 dtime = DTIME (stop, start); 112 112 } 113 if (0) fprintf (stderr, "checked %d hosts\n", i);113 if (0) gprint (GP_ERR, "checked %d hosts\n", i); 114 114 return (TRUE); 115 115 } … … 140 140 dtime = DTIME (stop, start); 141 141 } 142 if (0) fprintf (stderr, "checked %d hosts\n", i);142 if (0) gprint (GP_ERR, "checked %d hosts\n", i); 143 143 return (TRUE); 144 144 } … … 168 168 dtime = DTIME (stop, start); 169 169 } 170 if (0) fprintf (stderr, "checked %d hosts\n", i);170 if (0) gprint (GP_ERR, "checked %d hosts\n", i); 171 171 return (TRUE); 172 172 } … … 193 193 dtime = DTIME (stop, start); 194 194 } 195 if (0) fprintf (stderr, "checked %d idle hosts\n", i);195 if (0) gprint (GP_ERR, "checked %d idle hosts\n", i); 196 196 197 197 stack = GetHostStack (PCONTROL_HOST_BUSY); … … 205 205 dtime = DTIME (stop, start); 206 206 } 207 if (0) fprintf (stderr, "checked %d busy hosts\n", i);207 if (0) gprint (GP_ERR, "checked %d busy hosts\n", i); 208 208 return (TRUE); 209 209 } … … 213 213 gettimeofday (&stop, (void *) NULL); 214 214 dtime = DTIME (stop, start); 215 if (VerboseMode()) fprintf (stderr, "check 4: %f seconds\n", dtime);215 if (VerboseMode()) gprint (GP_ERR, "check 4: %f seconds\n", dtime); 216 216 217 217 gettimeofday (&start, (void *) NULL); -
trunk/Ohana/src/opihi/pcontrol/GetJobOutput.c
r4762 r7917 40 40 switch (status) { 41 41 case -1: 42 if (VerboseMode()) fprintf (stderr, "host %s is not responding\n", host[0].hostname);42 if (VerboseMode()) gprint (GP_ERR, "host %s is not responding\n", host[0].hostname); 43 43 return (FALSE); 44 44 45 45 case 0: 46 if (VerboseMode()) fprintf (stderr, "host %s is down\n", host[0].hostname);46 if (VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname); 47 47 return (FALSE); 48 48 49 49 default: 50 if (VerboseMode()) fprintf (stderr, "message received (GetJobOutput : %s)\n", cmd);50 if (VerboseMode()) gprint (GP_ERR, "message received (GetJobOutput : %s)\n", cmd); 51 51 /* drop extra bytes from pclient (not pclient:job) */ 52 52 buffer[0].Nbuffer = Nstart + Nbytes; … … 57 57 } 58 58 59 fprintf (stderr, "programming error: should not reach here (GetJobOutput)\n");59 gprint (GP_ERR, "programming error: should not reach here (GetJobOutput)\n"); 60 60 exit (1); 61 61 } -
trunk/Ohana/src/opihi/pcontrol/HostOps.c
r4705 r7917 28 28 return (HostPool_Off); 29 29 default: 30 fprintf (stderr, "error: unknown host stack : programming error\n");30 gprint (GP_ERR, "error: unknown host stack : programming error\n"); 31 31 exit (1); 32 32 } 33 fprintf (stderr, "error: unknown host stack : programming error\n");33 gprint (GP_ERR, "error: unknown host stack : programming error\n"); 34 34 exit (1); 35 35 } … … 151 151 host = GetHost (StackID, N); 152 152 if (host == NULL) { 153 fprintf (stderr, "programming error! host missing from stack\n");153 gprint (GP_ERR, "programming error! host missing from stack\n"); 154 154 exit (1); 155 155 } -
trunk/Ohana/src/opihi/pcontrol/JobID.c
r3203 r7917 28 28 } 29 29 30 void PrintID ( FILE *f, IDtype ID) {30 void PrintID (gpDest dest, IDtype ID) { 31 31 32 32 unsigned short int word0, word1, word2, word3; … … 37 37 word3 = 0xffff & (ID >> 48); 38 38 39 fprintf (f, "%x.%x.%x.%x", word3, word2, word1, word0);39 gprint (dest, "%x.%x.%x.%x", word3, word2, word1, word0); 40 40 } 41 41 -
trunk/Ohana/src/opihi/pcontrol/JobOps.c
r4706 r7917 28 28 return (JobPool_Crash); 29 29 default: 30 fprintf (stderr, "error: unknown job stack : programming error\n");30 gprint (GP_ERR, "error: unknown job stack : programming error\n"); 31 31 exit (1); 32 32 } 33 fprintf (stderr, "error: unknown job stack : programming error\n");33 gprint (GP_ERR, "error: unknown job stack : programming error\n"); 34 34 exit (1); 35 35 } … … 151 151 job = GetJob (StackID, N); 152 152 if (job == NULL) { 153 fprintf (stderr, "programming error! job missing from stack\n");153 gprint (GP_ERR, "programming error! job missing from stack\n"); 154 154 exit (1); 155 155 } … … 176 176 177 177 PutJob (job, PCONTROL_JOB_PENDING, STACK_BOTTOM); 178 fprintf (stderr, "added new job\n");178 gprint (GP_ERR, "added new job\n"); 179 179 return (job[0].JobID); 180 180 } … … 203 203 host = (Host *) job[0].host; 204 204 if (host == NULL) { 205 fprintf (stderr, "programming error: job has no host\n");205 gprint (GP_ERR, "programming error: job has no host\n"); 206 206 exit (2); 207 207 } … … 213 213 /* remove host from correct stack */ 214 214 if (PullHost (host[0].HostID, host[0].stack) == NULL) { 215 fprintf (stderr, "programming error: host is not found in current stack\n");215 gprint (GP_ERR, "programming error: host is not found in current stack\n"); 216 216 exit (2); 217 217 } … … 226 226 /* remove job from correct stack */ 227 227 if (PullJob (job[0].JobID, job[0].stack) == NULL) { 228 fprintf (stderr, "programming error: job is not found in current stack\n");228 gprint (GP_ERR, "programming error: job is not found in current stack\n"); 229 229 exit (2); 230 230 } -
trunk/Ohana/src/opihi/pcontrol/KillJob.c
r4763 r7917 32 32 33 33 case PCLIENT_GOOD: 34 fprintf (stderr, "message received (KillJob)\n");34 gprint (GP_ERR, "message received (KillJob)\n"); 35 35 break; 36 36 37 37 default: 38 fprintf (stderr, "unknown status for pclient command: programming error\n");38 gprint (GP_ERR, "unknown status for pclient command: programming error\n"); 39 39 exit (1); 40 40 } … … 43 43 p = memstr (buffer.buffer, "STATUS", buffer.Nbuffer); 44 44 if (p == NULL) { 45 fprintf (stderr, "missing STATUS in pclient message : programming error\n");45 gprint (GP_ERR, "missing STATUS in pclient message : programming error\n"); 46 46 exit (1); 47 47 } 48 fprintf (stderr, "client message: %s\n", buffer.buffer);48 gprint (GP_ERR, "client message: %s\n", buffer.buffer); 49 49 sscanf (p, "%*s %d", &status); 50 50 FreeIOBuffer (&buffer); 51 fprintf (stderr, "client status: %d\n", status);51 gprint (GP_ERR, "client status: %d\n", status); 52 52 53 53 switch (status) { 54 54 case -1: 55 fprintf (stderr, "programming error (syntax error to pclient)\n");55 gprint (GP_ERR, "programming error (syntax error to pclient)\n"); 56 56 return (FALSE); 57 57 break; 58 58 case 0: 59 fprintf (stderr, "failure to kill child process\n");59 gprint (GP_ERR, "failure to kill child process\n"); 60 60 PutJob (job, PCONTROL_JOB_BUSY, STACK_BOTTOM); 61 61 return (FALSE); … … 66 66 return (TRUE); 67 67 case 2: 68 fprintf (stderr, "programming error (client has no job)\n");68 gprint (GP_ERR, "programming error (client has no job)\n"); 69 69 return (FALSE); 70 70 } 71 71 72 fprintf (stderr, "programming error : should not reach here (CheckJob)\n");72 gprint (GP_ERR, "programming error : should not reach here (CheckJob)\n"); 73 73 exit (1); 74 74 } -
trunk/Ohana/src/opihi/pcontrol/ResetJob.c
r4763 r7917 21 21 case PCLIENT_DOWN: 22 22 /*** different behavior for ANYHOST, WANTHOST, NEEDHOST? ***/ 23 fprintf (stderr, "host %s is down\n", host[0].hostname);23 gprint (GP_ERR, "host %s is down\n", host[0].hostname); 24 24 HarvestHost (host[0].pid); 25 25 PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM); … … 29 29 case PCLIENT_HUNG: 30 30 /*** should we consider a HUNG host DOWN? ***/ 31 fprintf (stderr, "host %s is not responding\n", host[0].hostname);31 gprint (GP_ERR, "host %s is not responding\n", host[0].hostname); 32 32 FreeIOBuffer (&buffer); 33 33 return (FALSE); 34 34 35 35 case PCLIENT_GOOD: 36 fprintf (stderr, "message received (ResetJob)\n");36 gprint (GP_ERR, "message received (ResetJob)\n"); 37 37 FreeIOBuffer (&buffer); 38 38 return (TRUE); 39 39 40 40 default: 41 fprintf (stderr, "unknown status for pclient command: programming error\n");41 gprint (GP_ERR, "unknown status for pclient command: programming error\n"); 42 42 exit (1); 43 43 } 44 44 45 fprintf (stderr, "programming error in GetJobOutput (should not reach here)\n");45 gprint (GP_ERR, "programming error in GetJobOutput (should not reach here)\n"); 46 46 exit (1); 47 47 } -
trunk/Ohana/src/opihi/pcontrol/StartHost.c
r4705 r7917 17 17 if (!pid) { 18 18 /** failure to start: extend retry period **/ 19 if (VerboseMode()) fprintf (stderr, "failure to start %s\n", host[0].hostname);19 if (VerboseMode()) gprint (GP_ERR, "failure to start %s\n", host[0].hostname); 20 20 gettimeofday (&now, (void *) NULL); 21 21 if (ZTIME(host[0].nexttry) || ZTIME(host[0].lasttry)) { -
trunk/Ohana/src/opihi/pcontrol/StartJob.c
r4763 r7917 13 13 host = (Host *) job[0].host; 14 14 if (host == NULL) { 15 fprintf (stderr, "programming error: no assigned host\n");15 gprint (GP_ERR, "programming error: no assigned host\n"); 16 16 exit (1); 17 17 } … … 36 36 switch (status) { 37 37 case PCLIENT_DOWN: 38 if (VerboseMode()) fprintf (stderr, "host %s is down\n", host[0].hostname);38 if (VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname); 39 39 goto failure; 40 40 41 41 case PCLIENT_HUNG: 42 if (VerboseMode()) fprintf (stderr, "host %s is not responding\n", host[0].hostname);42 if (VerboseMode()) gprint (GP_ERR, "host %s is not responding\n", host[0].hostname); 43 43 goto failure; 44 44 45 45 case PCLIENT_GOOD: 46 if (VerboseMode()) fprintf (stderr, "message received (StartJob)\n");46 if (VerboseMode()) gprint (GP_ERR, "message received (StartJob)\n"); 47 47 break; 48 48 49 49 default: 50 if (VerboseMode()) fprintf (stderr, "unknown status for pclient command: programming error\n");50 if (VerboseMode()) gprint (GP_ERR, "unknown status for pclient command: programming error\n"); 51 51 exit (1); 52 52 } … … 55 55 p = memstr (buffer.buffer, "STATUS", buffer.Nbuffer); 56 56 if (p == NULL) { 57 fprintf (stderr, "programming error: missing STATUS in pclient message\n");57 gprint (GP_ERR, "programming error: missing STATUS in pclient message\n"); 58 58 exit (1); 59 59 } … … 61 61 switch (status) { 62 62 case -1: 63 if (VerboseMode()) fprintf (stderr, "error in pclient child\n");63 if (VerboseMode()) gprint (GP_ERR, "error in pclient child\n"); 64 64 goto failure; 65 65 66 66 case -2: 67 fprintf (stderr, "programming error: syntax error in pclient command\n");67 gprint (GP_ERR, "programming error: syntax error in pclient command\n"); 68 68 exit (1); 69 69 70 70 case -3: 71 fprintf (stderr, "programming error: existing child on pclient\n");71 gprint (GP_ERR, "programming error: existing child on pclient\n"); 72 72 exit (1); 73 73 … … 81 81 } 82 82 /* we should never reach here */ 83 fprintf (stderr, "programming error: should not reach here (StartJob)\n");83 gprint (GP_ERR, "programming error: should not reach here (StartJob)\n"); 84 84 exit (1); 85 85 -
trunk/Ohana/src/opihi/pcontrol/StopHosts.c
r4763 r7917 41 41 42 42 case PCLIENT_HUNG: 43 fprintf (stderr, "host %s is not responding\n", host[0].hostname);43 gprint (GP_ERR, "host %s is not responding\n", host[0].hostname); 44 44 break; 45 45 … … 48 48 49 49 default: 50 fprintf (stderr, "unknown status for pclient command: programming error\n");50 gprint (GP_ERR, "unknown status for pclient command: programming error\n"); 51 51 exit (1); 52 52 } … … 83 83 switch (errno) { 84 84 case ECHILD: 85 fprintf (stderr, "unknown PID, not a child proc\n");86 fprintf (stderr, "did process already exit? programming error?\n");85 gprint (GP_ERR, "unknown PID, not a child proc\n"); 86 gprint (GP_ERR, "did process already exit? programming error?\n"); 87 87 break; 88 88 case EINVAL: 89 fprintf (stderr, "error EINVAL (waitpid): programming error\n");89 gprint (GP_ERR, "error EINVAL (waitpid): programming error\n"); 90 90 exit (1); 91 91 case EINTR: 92 fprintf (stderr, "error EINTR (waitpid): programming error\n");92 gprint (GP_ERR, "error EINTR (waitpid): programming error\n"); 93 93 exit (1); 94 94 default: 95 fprintf (stderr, "unknown error for waitpid (%d): programming error\n", errno);95 gprint (GP_ERR, "unknown error for waitpid (%d): programming error\n", errno); 96 96 exit (1); 97 97 } … … 99 99 100 100 case 0: 101 fprintf (stderr, "child did not exit??");101 gprint (GP_ERR, "child did not exit??"); 102 102 /** put back in IDLE state? **/ 103 103 break; … … 105 105 default: 106 106 if (result != pid) { 107 fprintf (stderr, "waitpid error: mis-matched PID (%d vs %d). programming error\n", result, pid);107 gprint (GP_ERR, "waitpid error: mis-matched PID (%d vs %d). programming error\n", result, pid); 108 108 exit (1); 109 109 } 110 110 111 111 if (WIFEXITED(waitstatus)) { 112 fprintf (stderr, "child exited with status %d\n", WEXITSTATUS(waitstatus));112 gprint (GP_ERR, "child exited with status %d\n", WEXITSTATUS(waitstatus)); 113 113 } 114 114 if (WIFSIGNALED(waitstatus)) { 115 fprintf (stderr, "child crashed with status %d\n", WTERMSIG(waitstatus));115 gprint (GP_ERR, "child crashed with status %d\n", WTERMSIG(waitstatus)); 116 116 } 117 117 if (WIFSTOPPED(waitstatus)) { 118 fprintf (stderr, "waitpid returns 'stopped': programming error\n");118 gprint (GP_ERR, "waitpid returns 'stopped': programming error\n"); 119 119 exit (1); 120 120 } -
trunk/Ohana/src/opihi/pcontrol/check.c
r4689 r7917 11 11 12 12 if (argc != 3) { 13 fprintf (stdout, "USAGE: check job (JobID)\n");14 fprintf (stdout, "USAGE: check host (HostID)\n");13 gprint (GP_LOG, "USAGE: check job (JobID)\n"); 14 gprint (GP_LOG, "USAGE: check host (HostID)\n"); 15 15 return (FALSE); 16 16 } … … 20 20 job = FindJobStack (JobID); 21 21 if (job == NULL) { 22 fprintf (stdout, "job not found\n");22 gprint (GP_LOG, "job not found\n"); 23 23 return (FALSE); 24 24 } 25 fprintf (stdout, "STATUS %s\n", jobstate[job[0].stack]);26 fprintf (stdout, "EXITST %d\n", job[0].exit_status);27 fprintf (stdout, "STDOUT %d\n", job[0].stdout_size);28 fprintf (stdout, "STDERR %d\n", job[0].stderr_size);25 gprint (GP_LOG, "STATUS %s\n", jobstate[job[0].stack]); 26 gprint (GP_LOG, "EXITST %d\n", job[0].exit_status); 27 gprint (GP_LOG, "STDOUT %d\n", job[0].stdout_size); 28 gprint (GP_LOG, "STDERR %d\n", job[0].stderr_size); 29 29 return (TRUE); 30 30 } … … 34 34 host = FindHostStack (HostID); 35 35 if (host == NULL) { 36 fprintf (stdout, "host not found\n");36 gprint (GP_LOG, "host not found\n"); 37 37 return (FALSE); 38 38 } 39 fprintf (stdout, "host %s\n", hoststate[host[0].stack]);39 gprint (GP_LOG, "host %s\n", hoststate[host[0].stack]); 40 40 return (TRUE); 41 41 } 42 42 43 fprintf (stdout, "unknown item to check\n");43 gprint (GP_LOG, "unknown item to check\n"); 44 44 return (FALSE); 45 45 } -
trunk/Ohana/src/opihi/pcontrol/delete.c
r4689 r7917 7 7 8 8 if (argc < 2) { 9 fprintf (stderr, "USAGE: delete (JobID)\n");9 gprint (GP_ERR, "USAGE: delete (JobID)\n"); 10 10 return (FALSE); 11 11 } … … 22 22 if (job != NULL) goto found; 23 23 24 fprintf (stderr, "job %s not PENDING, CRASH, EXIT\n", argv[1]);24 gprint (GP_ERR, "job %s not PENDING, CRASH, EXIT\n", argv[1]); 25 25 return (FALSE); 26 26 … … 28 28 { 29 29 int j; 30 fprintf (stderr, "deleting job %s %d ", job[0].hostname, job[0].argc);30 gprint (GP_LOG, "deleting job %s %d ", job[0].hostname, job[0].argc); 31 31 for (j = 0; j < job[0].argc; j++) { 32 fprintf (stderr, "%s ", job[0].argv[j]);32 gprint (GP_LOG, "%s ", job[0].argv[j]); 33 33 } 34 PrintID ( stderr, job[0].JobID);35 fprintf (stderr, "\n");34 PrintID (GP_LOG, job[0].JobID); 35 gprint (GP_LOG, "\n"); 36 36 } 37 37 DelJob (job); -
trunk/Ohana/src/opihi/pcontrol/host.c
r4705 r7917 8 8 9 9 if (argc != 3) { 10 fprintf (stdout, "USAGE: host (command) (hostname)\n");10 gprint (GP_LOG, "USAGE: host (command) (hostname)\n"); 11 11 return (FALSE); 12 12 } … … 14 14 if (!strcasecmp (argv[1], "ADD")) { 15 15 HostID = AddHost (argv[2]); 16 fprintf (stdout, "HostID: %d\n", (int) HostID);16 gprint (GP_LOG, "HostID: %d\n", (int) HostID); 17 17 return (TRUE); 18 18 } … … 20 20 N = FindNamedHost (argv[2], PCONTROL_HOST_OFF); 21 21 if (N < 0) { 22 fprintf (stdout, "host %s is not OFF\n", argv[2]);22 gprint (GP_LOG, "host %s is not OFF\n", argv[2]); 23 23 return (FALSE); 24 24 } … … 30 30 N = FindNamedHost (argv[2], PCONTROL_HOST_DOWN); 31 31 if (N < 0) { 32 fprintf (stdout, "host %s is not DOWN\n", argv[2]);32 gprint (GP_LOG, "host %s is not DOWN\n", argv[2]); 33 33 return (FALSE); 34 34 } … … 52 52 return (TRUE); 53 53 case PCONTROL_HOST_DOWN: 54 fprintf (stdout, "host %s is DOWN\n", argv[2]);54 gprint (GP_LOG, "host %s is DOWN\n", argv[2]); 55 55 return (TRUE); 56 56 case PCONTROL_HOST_OFF: 57 fprintf (stdout, "host %s is OFF\n", argv[2]);57 gprint (GP_LOG, "host %s is OFF\n", argv[2]); 58 58 return (TRUE); 59 59 default: 60 fprintf (stdout, "host %s not found\n", argv[2]);60 gprint (GP_LOG, "host %s not found\n", argv[2]); 61 61 return (FALSE); 62 62 } … … 84 84 return (TRUE); 85 85 } 86 fprintf (stdout, "host %s is not BUSY, IDLE, or DOWN\n", argv[2]);86 gprint (GP_LOG, "host %s is not BUSY, IDLE, or DOWN\n", argv[2]); 87 87 return (FALSE); 88 88 } … … 90 90 N = FindNamedHost (argv[2], PCONTROL_HOST_OFF); 91 91 if (N < 0) { 92 fprintf (stdout, "host %s is not OFF\n", argv[2]);92 gprint (GP_LOG, "host %s is not OFF\n", argv[2]); 93 93 return (FALSE); 94 94 } … … 98 98 } 99 99 100 fprintf (stderr, "unknown host command %s\n", argv[1]);101 fprintf (stderr, "valid options: xxx\n");100 gprint (GP_ERR, "unknown host command %s\n", argv[1]); 101 gprint (GP_ERR, "valid options: xxx\n"); 102 102 return (FALSE); 103 103 } -
trunk/Ohana/src/opihi/pcontrol/job.c
r4689 r7917 17 17 if ((N = get_argument (argc, argv, "+host"))) { 18 18 if (Mode == PCONTROL_JOB_WANTHOST) { 19 fprintf (stderr, "ERROR: -host and +host are incompatible\n");19 gprint (GP_ERR, "ERROR: -host and +host are incompatible\n"); 20 20 FREE (Host); 21 21 return (FALSE); … … 36 36 37 37 if (argc < 2) { 38 fprintf (stderr, "USAGE: job [options] (arg0) (arg1) ... (argN)\n");38 gprint (GP_ERR, "USAGE: job [options] (arg0) (arg1) ... (argN)\n"); 39 39 FREE (Host); 40 40 return (FALSE); … … 48 48 49 49 JobID = AddJob (Host, Mode, Timeout, targc, targv); 50 fprintf (stdout, "JobID: %d\n", (int) JobID);50 gprint (GP_LOG, "JobID: %d\n", (int) JobID); 51 51 return (TRUE); 52 52 } -
trunk/Ohana/src/opihi/pcontrol/jobstack.c
r4714 r7917 8 8 9 9 if (argc != 2) { 10 fprintf (stdout, "USAGE: jobstack (jobstack)\n");11 fprintf (stdout, " (jobstack) : pending, busy, exit, crash, hung, done\n");10 gprint (GP_ERR, "USAGE: jobstack (jobstack)\n"); 11 gprint (GP_ERR, " (jobstack) : pending, busy, exit, crash, hung, done\n"); 12 12 return (FALSE); 13 13 } … … 16 16 stack = GetJobStackByName (argv[1]); 17 17 if (stack == NULL) { 18 fprintf (stderr, "jobstack not found\n");18 gprint (GP_ERR, "jobstack not found\n"); 19 19 return (FALSE); 20 20 } 21 21 22 22 /* print list */ 23 fprintf (stdout, "Njobs: %d\n", stack[0].Nobject);23 gprint (GP_LOG, "Njobs: %d\n", stack[0].Nobject); 24 24 for (i = 0; i < stack[0].Nobject; i++) { 25 25 job = stack[0].object[i]; 26 /* PrintID ( stdout, job[0].JobID); */27 fprintf (stdout, "%lld ", job[0].JobID);28 fprintf (stdout, "%s %s\n", job[0].argv[0], job[0].hostname);26 /* PrintID (GP_LOG, job[0].JobID); */ 27 gprint (GP_LOG, "%lld ", job[0].JobID); 28 gprint (GP_LOG, "%s %s\n", job[0].argv[0], job[0].hostname); 29 29 } 30 30 return (TRUE); -
trunk/Ohana/src/opihi/pcontrol/kill.c
r4689 r7917 7 7 8 8 if (argc < 2) { 9 fprintf (stderr, "USAGE: kill (JobID)\n");9 gprint (GP_ERR, "USAGE: kill (JobID)\n"); 10 10 return (FALSE); 11 11 } … … 15 15 job = PullJob (JobID, PCONTROL_JOB_BUSY); 16 16 if (job == NULL) { 17 fprintf (stderr, "job %s not BUSY\n", argv[1]);17 gprint (GP_ERR, "job %s not BUSY\n", argv[1]); 18 18 /* make output message more readable by scheduler */ 19 19 return (FALSE); -
trunk/Ohana/src/opihi/pcontrol/pclient.c
r4762 r7917 32 32 if (status == 0) return (PCLIENT_DOWN); 33 33 if (status == -1) return (PCLIENT_HUNG); 34 /* fprintf (stderr, "buffer.buffer: %s\n", buffer[0].buffer); */34 /* gprint (GP_ERR, "buffer.buffer: %s\n", buffer[0].buffer); */ 35 35 return (PCLIENT_GOOD); 36 36 } -
trunk/Ohana/src/opihi/pcontrol/pcontrol.c
r5919 r7917 38 38 /* standard welcome message */ 39 39 void welcome () { 40 fprintf (stderr, "\n");41 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);40 gprint (GP_ERR, "\n"); 41 gprint (GP_ERR, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 42 42 } 43 43 … … 49 49 50 50 void gotsignal (int signum) { 51 fprintf (stderr, "got signal : %d\n", signum);51 gprint (GP_ERR, "got signal : %d\n", signum); 52 52 return; 53 53 } -
trunk/Ohana/src/opihi/pcontrol/pulse.c
r6689 r7917 6 6 7 7 if (argc != 2) { 8 fprintf (stderr, "USAGE: pulse (microseconds)\n");8 gprint (GP_ERR, "USAGE: pulse (microseconds)\n"); 9 9 return (FALSE); 10 10 } -
trunk/Ohana/src/opihi/pcontrol/rconnect.c
r4762 r7917 34 34 pid = fork (); 35 35 if (!pid) { /* must be child process */ 36 if (VerboseMode()) fprintf (stderr, "starting remote connection to %s...", hostname);36 if (VerboseMode()) gprint (GP_ERR, "starting remote connection to %s...", hostname); 37 37 38 38 /* close the other ends of the pipes */ … … 52 52 53 53 status = execvp (argv[0], argv); 54 fprintf (stderr, "error starting remote shell process\n");54 gprint (GP_ERR, "error starting remote shell process\n"); 55 55 exit (1); 56 56 } … … 85 85 if (status == 0) goto connect_error; 86 86 if (status == -1) goto connect_error; 87 if (VerboseMode()) fprintf (stderr, "%d cycles to connect\n", i);87 if (VerboseMode()) gprint (GP_ERR, "%d cycles to connect\n", i); 88 88 FreeIOBuffer (&buffer); 89 89 90 if (VerboseMode()) fprintf (stderr, "Connected\n");90 if (VerboseMode()) gprint (GP_ERR, "Connected\n"); 91 91 92 92 stdio[0] = stdin_fd[1]; … … 101 101 102 102 connect_error: 103 if (VerboseMode()) fprintf (stderr, "error while connecting\n");103 if (VerboseMode()) gprint (GP_ERR, "error while connecting\n"); 104 104 105 105 /* avoid blocking on waitpid, test every 100 usec, up to 50 msec */ … … 116 116 117 117 if ((result == -1) && (errno != ECHILD)) { 118 fprintf (stderr, "unexpected error from waitpid (%d): programming error\n", errno);118 gprint (GP_ERR, "unexpected error from waitpid (%d): programming error\n", errno); 119 119 exit (1); 120 120 } 121 121 if (result == 0) { 122 if (VerboseMode()) fprintf (stderr, "child did not exit??");122 if (VerboseMode()) gprint (GP_ERR, "child did not exit??"); 123 123 } 124 124 if (result > 0) { 125 125 if (result != pid) { 126 fprintf (stderr, "waitpid error: mis-matched PID (%d vs %d). programming error\n", result, pid);126 gprint (GP_ERR, "waitpid error: mis-matched PID (%d vs %d). programming error\n", result, pid); 127 127 exit (1); 128 128 } 129 129 if (WIFSTOPPED(waitstatus)) { 130 fprintf (stderr, "waitpid returns 'stopped': programming error\n");130 gprint (GP_ERR, "waitpid returns 'stopped': programming error\n"); 131 131 exit (1); 132 132 } -
trunk/Ohana/src/opihi/pcontrol/run.c
r4767 r7917 4 4 5 5 if (argc != 1) { 6 fprintf (stderr, "USAGE: run\n");6 gprint (GP_ERR, "USAGE: run\n"); 7 7 return (FALSE); 8 8 } -
trunk/Ohana/src/opihi/pcontrol/status.c
r4689 r7917 28 28 stack = GetJobStack (Nstack); 29 29 Nobject = stack[0].Nobject; 30 fprintf (stdout, "job stack %s: %d objects\n", jobname[Nstack], Nobject);30 gprint (GP_LOG, "job stack %s: %d objects\n", jobname[Nstack], Nobject); 31 31 32 32 for (i = 0; i < Nobject; i++) { 33 33 job = stack[0].object[i]; 34 fprintf (stdout, "%d %s %d ", i, job[0].hostname, job[0].argc);34 gprint (GP_LOG, "%d %s %d ", i, job[0].hostname, job[0].argc); 35 35 for (j = 0; j < job[0].argc; j++) { 36 fprintf (stdout, "%s ", job[0].argv[j]);36 gprint (GP_LOG, "%s ", job[0].argv[j]); 37 37 } 38 PrintID ( stdout, job[0].JobID);39 fprintf (stdout, "\n");38 PrintID (GP_LOG, job[0].JobID); 39 gprint (GP_LOG, "\n"); 40 40 } 41 41 return (TRUE); … … 50 50 stack = GetHostStack (Nstack); 51 51 Nobject = stack[0].Nobject; 52 fprintf (stdout, "host stack %s: %d objects\n", hostname[Nstack], Nobject);52 gprint (GP_LOG, "host stack %s: %d objects\n", hostname[Nstack], Nobject); 53 53 54 54 for (i = 0; i < Nobject; i++) { 55 55 host = stack[0].object[i]; 56 fprintf (stdout, "%d %s ", i, host[0].hostname);57 PrintID ( stdout, host[0].HostID);58 fprintf (stdout, "\n");56 gprint (GP_LOG, "%d %s ", i, host[0].hostname); 57 PrintID (GP_LOG, host[0].HostID); 58 gprint (GP_LOG, "\n"); 59 59 } 60 60 return (TRUE); -
trunk/Ohana/src/opihi/pcontrol/stdout.c
r4689 r7917 8 8 9 9 if (argc != 2) { 10 fprintf (stderr, "USAGE: stdout (JobID)\n");11 fprintf (stdout, "STATUS %d\n", -1);10 gprint (GP_ERR, "USAGE: stdout (JobID)\n"); 11 gprint (GP_LOG, "STATUS %d\n", -1); 12 12 return (FALSE); 13 13 } … … 23 23 buffer = &job[0].stdout; 24 24 fwrite (buffer[0].buffer, 1, buffer[0].Nbuffer, stdout); 25 fprintf (stdout, "STATUS %d\n", 0);25 gprint (GP_LOG, "STATUS %d\n", 0); 26 26 return (TRUE); 27 27 28 28 missing_stdout: 29 fprintf (stderr, "job not found in EXIT or CRASH\n");30 fprintf (stdout, "STATUS %d\n", -2);29 gprint (GP_ERR, "job not found in EXIT or CRASH\n"); 30 gprint (GP_LOG, "STATUS %d\n", -2); 31 31 return (FALSE); 32 32 } … … 39 39 40 40 if (argc != 2) { 41 fprintf (stderr, "USAGE: stderr (JobID)\n");42 fprintf (stdout, "STATUS %d\n", -1);41 gprint (GP_ERR, "USAGE: stderr (JobID)\n"); 42 gprint (GP_LOG, "STATUS %d\n", -1); 43 43 return (FALSE); 44 44 } … … 54 54 buffer = &job[0].stderr; 55 55 fwrite (buffer[0].buffer, 1, buffer[0].Nbuffer, stdout); 56 fprintf (stdout, "STATUS %d\n", 0);56 gprint (GP_LOG, "STATUS %d\n", 0); 57 57 return (TRUE); 58 58 59 59 missing_stderr: 60 fprintf (stderr, "job not found in EXIT or CRASH\n");61 fprintf (stdout, "STATUS %d\n", -2);60 gprint (GP_ERR, "job not found in EXIT or CRASH\n"); 61 gprint (GP_LOG, "STATUS %d\n", -2); 62 62 return (FALSE); 63 63 } -
trunk/Ohana/src/opihi/pcontrol/stop.c
r4767 r7917 4 4 5 5 if (argc != 1) { 6 fprintf (stderr, "USAGE: stop\n");6 gprint (GP_ERR, "USAGE: stop\n"); 7 7 return (FALSE); 8 8 } -
trunk/Ohana/src/opihi/pcontrol/verbose.c
r4575 r7917 7 7 if (argc == 1) { 8 8 if (VERBOSE) { 9 fprintf (stderr, "verbose mode ON\n");9 gprint (GP_ERR, "verbose mode ON\n"); 10 10 } else { 11 fprintf (stderr, "verbose mode OFF\n");11 gprint (GP_ERR, "verbose mode OFF\n"); 12 12 } 13 13 return (TRUE); … … 29 29 } 30 30 31 fprintf (stderr, "USAGE: verbose (on/off/toggle)\n");31 gprint (GP_ERR, "USAGE: verbose (on/off/toggle)\n"); 32 32 return (FALSE); 33 33 } -
trunk/Ohana/src/opihi/pcontrol/version.c
r7080 r7917 4 4 int version (int argc, char **argv) { 5 5 6 fprintf (stderr, "%s\n", name);6 gprint (GP_ERR, "%s\n", name); 7 7 8 fprintf (stderr, "%s\n", opihi_version());9 fprintf (stderr, "%s\n", ohana_version());10 fprintf (stderr, "%s\n", gfits_version());8 gprint (GP_ERR, "%s\n", opihi_version()); 9 gprint (GP_ERR, "%s\n", ohana_version()); 10 gprint (GP_ERR, "%s\n", gfits_version()); 11 11 12 fprintf (stderr, "compiled on %s %s\n", __DATE__, __TIME__);12 gprint (GP_ERR, "compiled on %s %s\n", __DATE__, __TIME__); 13 13 return (TRUE); 14 14 }
Note:
See TracChangeset
for help on using the changeset viewer.
