diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/qpoe/qpastr.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/qpoe/qpastr.x')
-rw-r--r-- | sys/qpoe/qpastr.x | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sys/qpoe/qpastr.x b/sys/qpoe/qpastr.x new file mode 100644 index 00000000..4c856b10 --- /dev/null +++ b/sys/qpoe/qpastr.x @@ -0,0 +1,35 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "qpoe.h" + +# QP_ASTR -- Set the value of a string parameter, creating the parameter if +# it does not already exist. This works for the common case of string +# parameters allocated a fixed amount of space at create time (any type of +# string parameter can be written into if it already exists). Additional +# control over the parameter attributes is possible if the parameter is +# explicitly created with qp_addf before being written into. + +procedure qp_astr (qp, param, value, comment) + +pointer qp #I QPOE descriptor +char param[ARB] #I parameter name +char value[ARB] #I parameter value +char comment[ARB] #I comment field, if creating parameter + +int nchars +int qp_accessf(), strlen() +errchk qp_accessf, qp_addf + +begin + # By default we allocate a somewhat bigger storage area than needed + # to store the string, to permit updates of a similar length. If + # more control over the maximum string length is needed, QP_ADDF + # should be called explicitly. + + if (qp_accessf (qp, param) == NO) { + nchars = (strlen(value) + INC_STRLEN-1) / INC_STRLEN * INC_STRLEN + call qp_addf (qp, param, "c", nchars, comment, 0) + } + + call qp_pstr (qp, param, value) +end |