Annotation of freem/src/ssvn_job.c, revision 1.1
1.1 ! snw 1: /*
! 2: * *
! 3: * * *
! 4: * * *
! 5: * ***************
! 6: * * * * *
! 7: * * MUMPS *
! 8: * * * * *
! 9: * ***************
! 10: * * *
! 11: * * *
! 12: * *
! 13: *
! 14: * ssvn_job.c
! 15: * ^$JOB ssv
! 16: *
! 17: *
! 18: * Author: Serena Willis <jpw@coherent-logic.com>
! 19: * Copyright (C) 1998 MUG Deutschland
! 20: * Copyright (C) 2020 Coherent Logic Development LLC
! 21: *
! 22: *
! 23: * This file is part of FreeM.
! 24: *
! 25: * FreeM is free software: you can redistribute it and/or modify
! 26: * it under the terms of the GNU Affero Public License as published by
! 27: * the Free Software Foundation, either version 3 of the License, or
! 28: * (at your option) any later version.
! 29: *
! 30: * FreeM is distributed in the hope that it will be useful,
! 31: * but WITHOUT ANY WARRANTY; without even the implied warranty of
! 32: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 33: * GNU Affero Public License for more details.
! 34: *
! 35: * You should have received a copy of the GNU Affero Public License
! 36: * along with FreeM. If not, see <https://www.gnu.org/licenses/>.
! 37: *
! 38: **/
! 39:
! 40: #include <stdio.h>
! 41: #include <string.h>
! 42: #include <stdlib.h>
! 43: #include <signal.h>
! 44: #include <sys/types.h>
! 45: #include <unistd.h>
! 46: #include <errno.h>
! 47: #include <sys/time.h>
! 48: #include <sys/resource.h>
! 49: #include <ctype.h>
! 50: #include <time.h>
! 51:
! 52: #include "config.h"
! 53: #include "mpsdef.h"
! 54: #include "transact.h"
! 55: #include "namespace.h"
! 56: #include "freem.h"
! 57: #include "mref.h"
! 58: #include "jobtab.h"
! 59:
! 60: short cur_symtab = 0;
! 61:
! 62: void ssvn_job_add_device(int channel, char *device)
! 63: {
! 64: char *k_buf;
! 65: char *d_buf;
! 66:
! 67: k_buf = (char *) malloc (STRLEN * sizeof (char));
! 68: NULLPTRCHK(k_buf,"ssvn_job_add_device");
! 69:
! 70: d_buf = (char *) malloc (STRLEN * sizeof (char));
! 71: NULLPTRCHK(k_buf,"ssvn_job_add_device");
! 72:
! 73: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202OPEN\202%d\201", pid, channel);
! 74: snprintf (d_buf, 512 - 1, "%s\201", device);
! 75:
! 76: symtab_shm (set_sym, k_buf, d_buf);
! 77:
! 78: free (k_buf);
! 79: free (d_buf);
! 80:
! 81: return;
! 82: }
! 83:
! 84: void ssvn_job_remove_device(int channel)
! 85: {
! 86: char *k_buf;
! 87: char *d_buf;
! 88:
! 89: k_buf = (char *) malloc (STRLEN * sizeof (char));
! 90: NULLPTRCHK(k_buf,"ssvn_job_add_device");
! 91:
! 92: d_buf = (char *) malloc (STRLEN * sizeof (char));
! 93: NULLPTRCHK(k_buf,"ssvn_job_add_device");
! 94:
! 95: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202OPEN\202%d\201", pid, channel);
! 96: snprintf (d_buf, 512 - 1, "\201");
! 97:
! 98: symtab_shm (kill_sym, k_buf, d_buf);
! 99:
! 100: free (k_buf);
! 101: free (d_buf);
! 102:
! 103: return;
! 104:
! 105: }
! 106:
! 107: void ssvn_job_update(void)
! 108: {
! 109:
! 110: char k_buf[512];
! 111: char d_buf[512];
! 112:
! 113: char tk_buf[512];
! 114: char td_buf[512];
! 115:
! 116: #ifndef AMIGA68K
! 117: uid_t uid;
! 118: gid_t gid;
! 119: #else
! 120: int uid;
! 121: int gid;
! 122: #endif
! 123:
! 124: int ierr_sav;
! 125: int tf;
! 126:
! 127: #if !defined(AMIGA68K)
! 128: uid = getuid ();
! 129: gid = getgid ();
! 130: #else
! 131: uid = 0;
! 132: gid = 0;
! 133: #endif
! 134:
! 135: ierr_sav = ierr;
! 136:
! 137: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202PIPE_GLVN\201", pid);
! 138: snprintf (d_buf, 5, "%%\201");
! 139: symtab_shm (set_sym, k_buf, d_buf);
! 140:
! 141: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ZCOMMANDS\201", pid);
! 142: stcpy (d_buf, zcommds);
! 143: symtab_shm (set_sym, k_buf, d_buf);
! 144:
! 145: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ZFUNCTIONS\201", pid);
! 146: stcpy (d_buf, zfunctions);
! 147: symtab_shm (set_sym, k_buf, d_buf);
! 148:
! 149: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ZSVS\201", pid);
! 150: stcpy (d_buf, zsvn);
! 151: symtab_shm (set_sym, k_buf, d_buf);
! 152:
! 153: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202BREAK_HANDLER\201", pid);
! 154: stcpy (d_buf, brkaction);
! 155: symtab_shm (set_sym, k_buf, d_buf);
! 156:
! 157: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ROUTINE_BUFFER_SIZE\201", pid);
! 158: snprintf (d_buf, 512 - 1, "%ld\201", PSIZE0 - 1);
! 159: symtab_shm (set_sym, k_buf, d_buf);
! 160:
! 161: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ROUTINE_BUFFER_COUNT\201", pid);
! 162: snprintf (d_buf, 512 - 1, "%d\201", NO_OF_RBUF);
! 163: symtab_shm (set_sym, k_buf, d_buf);
! 164:
! 165: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ROUTINE_BUFFER_AUTO_ADJUST\201", pid);
! 166: snprintf (d_buf, 512 - 1, "%d\201", autorsize);
! 167: symtab_shm (set_sym, k_buf, d_buf);
! 168:
! 169: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202SYMBOL_TABLE_SIZE\201", pid);
! 170: snprintf (d_buf, 512 - 1, "%ld\201", PSIZE);
! 171: symtab_shm (set_sym, k_buf, d_buf);
! 172:
! 173: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202SYMBOL_TABLE_AUTO_ADJUST\201", pid);
! 174: snprintf (d_buf, 512 - 1, "%d\201", autopsize);
! 175: symtab_shm (set_sym, k_buf, d_buf);
! 176:
! 177: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202USER_DEFINED_ISV_TABLE_SIZE\201", pid);
! 178: snprintf (d_buf, 512 - 1, "%ld\201", UDFSVSIZ);
! 179: symtab_shm (set_sym, k_buf, d_buf);
! 180:
! 181: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202USER_DEFINED_ISV_TABLE_AUTO_ADJUST\201", pid);
! 182: snprintf (d_buf, 512 - 1, "%d\201", autousize);
! 183: symtab_shm (set_sym, k_buf, d_buf);
! 184:
! 185: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202GVN_UNIQUE_CHARS\201", pid);
! 186: snprintf (d_buf, 512 - 1, "%d\201", (glvnflag.one[0] == 0) ? 255 : glvnflag.one[0]);
! 187: symtab_shm (set_sym, k_buf, d_buf);
! 188:
! 189: tf = UNSIGN (glvnflag.one[1]);
! 190: toggle (tf);
! 191:
! 192: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202GVN_CASE_SENSITIVE\201", pid);
! 193: snprintf (d_buf, 512 - 1, "%d\201", tf);
! 194: symtab_shm (set_sym, k_buf, d_buf);
! 195:
! 196: tf = UNSIGN (glvnflag.one[2]);
! 197: if (tf == 0) tf = 255;
! 198: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202GVN_NAME_SUB_LENGTH\201", pid);
! 199: snprintf (d_buf, 512 - 1, "%d\201", tf);
! 200: symtab_shm (set_sym, k_buf, d_buf);
! 201:
! 202: tf = UNSIGN (glvnflag.one[3]);
! 203: if (tf == 0) tf = 255;
! 204: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202GVN_SUB_LENGTH\201", pid);
! 205: snprintf (d_buf, 512 - 1, "%d\201", tf);
! 206: symtab_shm (set_sym, k_buf, d_buf);
! 207:
! 208: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202SINGLE_USER\201", pid);
! 209: snprintf (d_buf, 512 - 1, "%d\201", lonelyflag);
! 210: symtab_shm (set_sym, k_buf, d_buf);
! 211:
! 212: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202LOWERCASE_EVERYWHERE\201", pid);
! 213: snprintf (d_buf, 512 - 1, "%d\201", lowerflag);
! 214: symtab_shm (set_sym, k_buf, d_buf);
! 215:
! 216: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ZCOMMAND_ARGUMENT_NAME\201", pid);
! 217: stcpy (d_buf, zargdefname);
! 218: symtab_shm (set_sym, k_buf, d_buf);
! 219:
! 220: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202TIMEZONE_OFFSET\201", pid);
! 221: lintstr (d_buf, tzoffset);
! 222: symtab_shm (set_sym, k_buf, d_buf);
! 223:
! 224: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ENGINES\202GLOBAL\202%s\201", pid, nsname);
! 225: snprintf (d_buf, 512 - 1, "%s\201", gbl_u_engine);
! 226: symtab_shm (set_sym, k_buf, d_buf);
! 227:
! 228: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ENGINES\202GLOBAL\202SYSTEM\201", pid);
! 229: snprintf (d_buf, 512 - 1, "%s\201", gbl_s_engine);
! 230: symtab_shm (set_sym, k_buf, d_buf);
! 231:
! 232: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ENGINES\202LOCAL\201", pid);
! 233: snprintf (d_buf, 512 - 1, "%s\201", loc_engine);
! 234: symtab_shm (set_sym, k_buf, d_buf);
! 235:
! 236: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202CHARACTER\201", pid);
! 237: symtab_shm (set_sym, k_buf, "M\201");
! 238:
! 239: snprintf (d_buf, 512 - 1, "%s\201", curdir);
! 240: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202CWD\201", pid);
! 241: symtab_shm (set_sym, k_buf, d_buf);
! 242:
! 243: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202GLOBAL\201", pid);
! 244: symtab_shm (set_sym, k_buf, " \201");
! 245:
! 246: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202LOCK\201", pid);
! 247: symtab_shm (set_sym, k_buf, " \201");
! 248:
! 249: snprintf (d_buf, 512 - 1, "%s\201", oucpath);
! 250: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202IOPATH\201", pid);
! 251: symtab_shm (set_sym, k_buf, d_buf);
! 252:
! 253: #if !defined(MSDOS)
! 254: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202PRIORITY\201", pid);
! 255: snprintf (d_buf, 512 - 1, "%d\201", getpriority (PRIO_PROCESS, pid));
! 256: symtab_shm (set_sym, k_buf, d_buf);
! 257: #endif
! 258:
! 259: snprintf (d_buf, 512 - 1, "%s\201", rou_name);
! 260: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ROUTINE\201", pid);
! 261: symtab_shm (set_sym, k_buf, d_buf);
! 262:
! 263: snprintf (d_buf, 512 - 1, "0:\"%s\"\201", dev[HOME]);
! 264: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202$PRINCIPAL\201", pid);
! 265: symtab_shm (set_sym, k_buf, d_buf);
! 266:
! 267: snprintf (d_buf, 512 - 1, "%d\201", tp_level);
! 268: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202$TLEVEL\201", pid);
! 269: symtab_shm (set_sym, k_buf, d_buf);
! 270:
! 271: snprintf (d_buf, 512 - 1, "0:\"%s\"\201", dev[HOME]);
! 272: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202$IO\201", pid);
! 273: symtab_shm (set_sym, k_buf, d_buf);
! 274:
! 275: snprintf (d_buf, 512 -1, "%s\201", gvndefault);
! 276: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202GVNDEFAULT\201", pid);
! 277: symtab_shm (set_sym, k_buf, d_buf);
! 278:
! 279: snprintf (d_buf, 512 -1, "%s\201", lvndefault);
! 280: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202LVNDEFAULT\201", pid);
! 281: symtab_shm (set_sym, k_buf, d_buf);
! 282:
! 283: ssvn_job_add_device (HOME, dev[HOME]);
! 284:
! 285: snprintf (d_buf, 512 - 1, "%d\201", uid);
! 286: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202USER\201", pid);
! 287: symtab_shm (set_sym, k_buf, d_buf);
! 288:
! 289: snprintf (d_buf, 512 - 1, "%d\201", gid);
! 290: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202GROUP\201", pid);
! 291: symtab_shm (set_sym, k_buf, d_buf);
! 292:
! 293: snprintf (d_buf, 512 - 1, "%s\201", nsname);
! 294: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202NAMESPACE\201", pid);
! 295: symtab_shm (set_sym, k_buf, d_buf);
! 296:
! 297: snprintf (d_buf, 512 - 1, "%d\201", cur_symtab);
! 298: snprintf (k_buf, 512 - 1, "^$JOB\202\%d\202SYMTAB\201", pid);
! 299: symtab_shm (set_sym, k_buf, d_buf);
! 300:
! 301: snprintf (d_buf, 512 - 1, "%d\201", pid);
! 302: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202PID\201", pid);
! 303: symtab_shm (set_sym, k_buf, d_buf);
! 304:
! 305: snprintf (d_buf, 512 - 1, "%d\201", frm_throw_all_errors);
! 306: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202SET_ALL_ECODES\201", pid);
! 307: symtab_shm (set_sym, k_buf, d_buf);
! 308:
! 309: snprintf (tk_buf, 512 - 1, "^$SYSTEM\202ZDATE_FORMAT\201");
! 310: ssvn (get_sym, tk_buf, td_buf);
! 311:
! 312: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ZDATE_FORMAT\201", pid);
! 313: symtab_shm (set_sym, k_buf, td_buf);
! 314:
! 315: snprintf (tk_buf, 512 - 1, "^$SYSTEM\202ZTIME_FORMAT\201");
! 316: ssvn (get_sym, tk_buf, td_buf);
! 317:
! 318: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ZTIME_FORMAT\201", pid);
! 319: symtab_shm (set_sym, k_buf, td_buf);
! 320:
! 321: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202ENVIRONMENT\201", pid);
! 322: snprintf (d_buf, 512 - 1, "%s\201", shm_env);
! 323: symtab_shm (set_sym, k_buf, d_buf);
! 324:
! 325: switch (fp_mode) {
! 326:
! 327: case 0:
! 328:
! 329: snprintf (d_buf, 512 - 1, "FIXED\201");
! 330: break;
! 331:
! 332: default:
! 333:
! 334: snprintf (d_buf, 512 - 1, "IEEE754\201");
! 335: snprintf (fp_conversion, 9, "%%.%df\201", DBL_DIG);
! 336: zprecise = DBL_DIG;
! 337:
! 338: break;
! 339:
! 340: }
! 341:
! 342: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202MATH\201", pid);
! 343: symtab_shm (set_sym, k_buf, d_buf);
! 344:
! 345: snprintf (d_buf, 512 - 1, "%d\201", en_revstrf);
! 346: snprintf (k_buf, 512 - 1, "^$JOB\202%d\202REVSTR\201", pid);
! 347: symtab_shm (set_sym, k_buf, d_buf);
! 348:
! 349: stcpy (d_buf, rou_name);
! 350: stcnv_m2c (d_buf);
! 351:
! 352: #if !defined(__FreeBSD__)
! 353:
! 354: if (run_daemon == FALSE) {
! 355: sprintf (k_buf, " freem: namespace %s routine %s", nsname, d_buf);
! 356: }
! 357: else {
! 358: sprintf (k_buf, " freem: %s environment daemon", shm_env);
! 359: }
! 360: if (!libflag) {
! 361: strcpy (m_argv[0], k_buf);
! 362: }
! 363:
! 364: #endif
! 365:
! 366: merr_raise (ierr_sav);
! 367:
! 368: }
! 369:
! 370:
! 371: void ssvn_job(short action, char *key, char *data)
! 372: {
! 373: int errsav;
! 374: pid_t t_pid;
! 375: int i;
! 376: char ch;
! 377: job_slot_t *slot;
! 378: freem_ref_t *r;
! 379: char *kbuf;
! 380: char *tbuf;
! 381:
! 382: r = (freem_ref_t *) malloc (sizeof (freem_ref_t));
! 383: NULLPTRCHK(r,"ssvn_job");
! 384:
! 385: kbuf = (char *) malloc (STRLEN * sizeof(char));
! 386: NULLPTRCHK(kbuf,"ssvn_job");
! 387:
! 388: tbuf = (char *) malloc (STRLEN * sizeof(char));
! 389: NULLPTRCHK(tbuf,"ssvn_job");
! 390:
! 391: stcpy (kbuf, key);
! 392:
! 393: mref_init (r, MREF_RT_SSVN, "^$JOB");
! 394: internal_to_mref (r, kbuf);
! 395:
! 396: t_pid = atol (mref_get_subscript (r, 0));
! 397:
! 398: slot = job_get (t_pid);
! 399:
! 400: if (r->subscript_count > 1) {
! 401: for (i = 0; i < strlen (r->subscripts[1]); i++) {
! 402: r->subscripts[1][i] = toupper (r->subscripts[1][i]);
! 403: }
! 404: }
! 405:
! 406: key = mref_to_internal (r);
! 407: stcpy (kbuf, key);
! 408:
! 409: switch (action) {
! 410:
! 411: case set_sym:
! 412:
! 413: {
! 414: char cbuf[STRLEN];
! 415:
! 416: snprintf (cbuf, STRLEN - 1, "^$JOB\202%d\202NAMESPACE\201", pid);
! 417:
! 418: if (stcmp (kbuf, cbuf) == 0) {
! 419:
! 420: stcpy (tbuf, data);
! 421: stcnv_m2c (tbuf);
! 422:
! 423: if (validate_namespace (tbuf) == FALSE) {
! 424: merr_raise (M26);
! 425: }
! 426: else {
! 427: set_namespace (tbuf, FALSE);
! 428: }
! 429:
! 430: goto done;
! 431:
! 432: }
! 433:
! 434:
! 435: if (strcmp (mref_get_subscript (r, 1), "ZCOMMANDS") == 0) {
! 436:
! 437: m_tolower (data);
! 438:
! 439: stcpy (zcommds, data);
! 440: symtab_shm (action, key, data);
! 441:
! 442: merr_clear ();
! 443: goto done;
! 444:
! 445: }
! 446: else if (strcmp (mref_get_subscript (r, 1), "LVNQOVAL") == 0) {
! 447: stcpy (l_o_val, data);
! 448:
! 449: merr_clear ();
! 450: goto done;
! 451: }
! 452: else if (strcmp (mref_get_subscript (r, 1), "GVNQOVAL") == 0) {
! 453: stcpy (l_o_val, data);
! 454:
! 455: merr_clear ();
! 456: goto done;
! 457: }
! 458: else if (strcmp (mref_get_subscript (r, 1), "GVNDEFAULT") == 0) {
! 459:
! 460: stcpy (gvndefault, data);
! 461:
! 462: merr_clear ();
! 463: goto done;
! 464: }
! 465: else if (strcmp (mref_get_subscript (r, 1), "LVNDEFAULT") == 0) {
! 466:
! 467: stcpy (lvndefault, data);
! 468:
! 469: merr_clear ();
! 470: goto done;
! 471: }
! 472: else if (strcmp (mref_get_subscript (r, 1), "PIPE_GLVN") == 0) {
! 473:
! 474: symtab_shm (action, key, data);
! 475:
! 476: merr_clear ();
! 477: goto done;
! 478:
! 479: }
! 480: else if (strcmp (mref_get_subscript (r, 1), "ZFUNCTIONS") == 0) {
! 481:
! 482: m_tolower (data);
! 483:
! 484: stcpy (zfunctions, data);
! 485: symtab_shm (action, key, data);
! 486:
! 487: merr_clear ();
! 488: goto done;
! 489:
! 490: }
! 491: else if (strcmp (mref_get_subscript (r, 1), "ZSVS") == 0) {
! 492:
! 493: m_tolower (data);
! 494:
! 495: stcpy (zsvn, data);
! 496: symtab_shm (action, key, data);
! 497:
! 498: merr_clear ();
! 499: goto done;
! 500:
! 501: }
! 502: else if (strcmp (mref_get_subscript (r, 1), "LOWERCASE_EVERYWHERE") == 0) {
! 503:
! 504: int tf = tvexpr (data);
! 505:
! 506: lowerflag = tf;
! 507: snprintf (data, 512 - 1, "%d\n", tf);
! 508:
! 509: symtab_shm (action, key, data);
! 510:
! 511: merr_clear ();
! 512: goto done;
! 513:
! 514: }
! 515: else if (strcmp (mref_get_subscript (r, 1), "ZCOMMAND_ARGUMENT_NAME") == 0) {
! 516:
! 517: stcpy (zargdefname, data);
! 518: symtab_shm (action, key, data);
! 519:
! 520: merr_clear ();
! 521: goto done;
! 522:
! 523: }
! 524: else if (strcmp (mref_get_subscript (r, 1), "BREAK_HANDLER") == 0) {
! 525:
! 526: stcpy (brkaction, data);
! 527: symtab_shm (action, key, data);
! 528:
! 529: merr_clear ();
! 530: goto done;
! 531:
! 532: }
! 533: else if (strcmp (mref_get_subscript (r, 1), "ROUTINE_BUFFER_SIZE") == 0) {
! 534:
! 535: if (intexpr (data) <= 0) {
! 536: merr_raise (ARGER);
! 537: goto done;
! 538: }
! 539:
! 540: newrsize (intexpr (data) + 1, NO_OF_RBUF);
! 541: symtab_shm (action, key, data);
! 542:
! 543: merr_clear ();
! 544: goto done;
! 545:
! 546: }
! 547: else if (strcmp (mref_get_subscript (r, 1), "ROUTINE_BUFFER_COUNT") == 0) {
! 548:
! 549: if (intexpr (data) <= 0) {
! 550: merr_raise (ARGER);
! 551: goto done;
! 552: }
! 553:
! 554: newrsize (PSIZE0, intexpr (data));
! 555: symtab_shm (action, key, data);
! 556:
! 557: merr_clear ();
! 558: goto done;
! 559:
! 560: }
! 561: else if (strcmp (mref_get_subscript (r, 1), "ROUTINE_BUFFER_AUTO_ADJUST") == 0) {
! 562:
! 563: autorsize = tvexpr (data);
! 564: snprintf (data, 512 - 1, "%d\201", tvexpr (data));
! 565:
! 566: symtab_shm (action, key, data);
! 567:
! 568: merr_clear ();
! 569: goto done;
! 570:
! 571: }
! 572: else if (strcmp (mref_get_subscript (r, 1), "SYMBOL_TABLE_SIZE") == 0) {
! 573:
! 574: if (intexpr (data) <= 0) {
! 575: merr_raise (ARGER);
! 576: goto done;
! 577: }
! 578:
! 579: newpsize (intexpr (data));
! 580:
! 581: symtab_shm (action, key, data);
! 582:
! 583: merr_clear ();
! 584: goto done;
! 585:
! 586: }
! 587: else if (strcmp (mref_get_subscript (r, 1), "SYMBOL_TABLE_AUTO_ADJUST") == 0) {
! 588:
! 589: autopsize = tvexpr (data);
! 590: snprintf (data, 512 - 1, "%d\201", tvexpr (data));
! 591:
! 592: symtab_shm (action, key, data);
! 593:
! 594: merr_clear ();
! 595: goto done;
! 596:
! 597: }
! 598: else if (strcmp (mref_get_subscript (r, 1), "USER_DEFINED_ISV_TABLE_SIZE") == 0) {
! 599:
! 600: if (intexpr (data) <= 0) {
! 601: merr_raise (ARGER);
! 602: goto done;
! 603: }
! 604:
! 605: newusize (intexpr (data));
! 606:
! 607: symtab_shm (action, key, data);
! 608:
! 609: merr_clear ();
! 610: goto done;
! 611:
! 612: }
! 613: else if (strcmp (mref_get_subscript (r, 1), "USER_DEFINED_ISV_TABLE_AUTO_ADJUST") == 0) {
! 614: autousize = tvexpr (data);
! 615: snprintf (data, 512 - 1, "%d\201", tvexpr (data));
! 616:
! 617: symtab_shm (action, key, data);
! 618:
! 619: merr_clear ();
! 620: goto done;
! 621: }
! 622: else if (strcmp (mref_get_subscript (r, 1), "GVN_UNIQUE_CHARS") == 0) {
! 623:
! 624: int t = intexpr (data) & 0377;
! 625:
! 626: if (t == 255) t = 0;
! 627:
! 628: if (merr () != MXNUM) {
! 629:
! 630: glvnflag.one[0] = (char) t;
! 631:
! 632: snprintf (data, 512 - 1, "%d\201", t);
! 633: symtab_shm (action, key, data);
! 634:
! 635: merr_clear ();
! 636:
! 637: }
! 638: else {
! 639: merr_raise (ARGER);
! 640: }
! 641:
! 642: goto done;
! 643:
! 644: }
! 645: else if (strcmp (mref_get_subscript (r, 1), "GVN_CASE_SENSITIVE") == 0) {
! 646: int t = tvexpr (data);
! 647: toggle (t);
! 648:
! 649: if (merr () != MXNUM) {
! 650:
! 651: glvnflag.one[1] = t;
! 652:
! 653: snprintf (data, 512 - 1, "%d\201", t);
! 654: symtab_shm (action, key, data);
! 655:
! 656: merr_clear ();
! 657:
! 658: }
! 659: else {
! 660: merr_raise (ARGER);
! 661: }
! 662:
! 663: goto done;
! 664:
! 665: }
! 666: else if (strcmp (mref_get_subscript (r, 1), "GVN_NAME_SUB_LENGTH") == 0) {
! 667: int t = intexpr (data) & 0377;
! 668:
! 669: if (t == 255) t = 0;
! 670:
! 671: if (merr () != MXNUM) {
! 672: glvnflag.one[2] = (char) t;
! 673:
! 674: snprintf (data, 512 - 1, "%d\201", t);
! 675: symtab_shm (action, key, data);
! 676:
! 677: merr_clear ();
! 678: }
! 679: else {
! 680: merr_raise (ARGER);
! 681: }
! 682:
! 683: goto done;
! 684:
! 685: }
! 686: else if (strcmp (mref_get_subscript (r, 1), "GVN_SUB_LENGTH") == 0) {
! 687: int t = intexpr (data) & 0377;
! 688:
! 689: if (t == 255) t = 0;
! 690:
! 691: if (merr () != MXNUM) {
! 692: glvnflag.one[3] = (char) t;
! 693:
! 694: snprintf (data, 512 - 1, "%d\201", t);
! 695: symtab_shm (action, key, data);
! 696:
! 697: merr_clear ();
! 698: }
! 699: else {
! 700: merr_raise (ARGER);
! 701: }
! 702:
! 703: goto done;
! 704:
! 705: }
! 706: else if (strcmp (mref_get_subscript (r, 1), "SINGLE_USER") == 0) {
! 707: int tf = tvexpr (data);
! 708: close_all_globals ();
! 709:
! 710: snprintf (data, 512 - 1, "%d\201", tf);
! 711: symtab_shm (action, key, data);
! 712:
! 713: merr_clear ();
! 714: goto done;
! 715: }
! 716: else if (stcmp (mref_get_subscript (r, 1), "TIMEZONE_OFFSET") == 0) {
! 717: long tzo = intexpr (data);
! 718: long tzj;
! 719:
! 720: if (merr () > OK) goto done;
! 721:
! 722: tzj = time (0L);
! 723:
! 724: if ((tzoffset > 0 && ((tzj + 86400 + tzoffset) < 0 || (tzj + tzoffset) < 0)) ||
! 725: (tzoffset < 0 && ((tzj + 86400 + tzoffset ) > (tzj + 86400) ||
! 726: (tzj + tzoffset) > tzj))) {
! 727: merr_raise (ARGER);
! 728: goto done;
! 729: }
! 730:
! 731: tzoffset = tzo;
! 732:
! 733: snprintf (data, 512 - 1, "%d\201", tzoffset);
! 734: symtab_shm (action, key, data);
! 735:
! 736: goto done;
! 737: }
! 738: else if (strcmp (mref_get_subscript (r, 1), "ENGINES") == 0) {
! 739:
! 740: if (strcmp (mref_get_subscript (r, 2), "GLOBAL") == 0) {
! 741:
! 742: if ((strcmp (mref_get_subscript (r, 3), nsname) == 0) && (strcmp (mref_get_subscript (r, 3), "SYSTEM") != 0)) {
! 743: stcpy (tbuf, data);
! 744: stcnv_m2c (tbuf);
! 745:
! 746: global_set_engine ('u', tbuf);
! 747:
! 748: goto done;
! 749:
! 750: }
! 751: else if (strcmp (mref_get_subscript (r, 3), "SYSTEM") == 0) {
! 752:
! 753: stcpy (tbuf, data);
! 754: stcnv_m2c (tbuf);
! 755:
! 756: global_set_engine ('s', tbuf);
! 757:
! 758: goto done;
! 759:
! 760: }
! 761:
! 762: }
! 763:
! 764: merr_raise (M29);
! 765: goto done;
! 766:
! 767: }
! 768: else if (strcmp (mref_get_subscript (r, 1), "USER_ERRORS") == 0) {
! 769:
! 770: symtab_shm (set_sym, key, data);
! 771:
! 772: merr_clear ();
! 773: goto done;
! 774:
! 775: }
! 776: else if (strcmp (mref_get_subscript (r, 1), "SET_ALL_ECODES") == 0) {
! 777:
! 778: frm_throw_all_errors = atol (data);
! 779: symtab_shm (set_sym, key, data);
! 780:
! 781: merr_clear ();
! 782: goto done;
! 783:
! 784: }
! 785: else if (strcmp (mref_get_subscript (r, 1), "ALIASES") == 0) {
! 786: symtab_shm (set_sym, key, data);
! 787:
! 788: merr_clear ();
! 789: goto done;
! 790: }
! 791: else if (strcmp (mref_get_subscript (r, 1), "CWD") == 0) {
! 792:
! 793: stcpy (tbuf, data);
! 794: stcnv_m2c (tbuf);
! 795:
! 796: if (chdir (tbuf) != 0) {
! 797: merr_raise (PROTECT);
! 798: goto done;
! 799: }
! 800: else {
! 801: strcpy (curdir, tbuf);
! 802: symtab_shm (set_sym, kbuf, data);
! 803:
! 804: merr_clear ();
! 805: goto done;
! 806: }
! 807:
! 808: }
! 809: else if (strcmp (mref_get_subscript (r, 1), "EVENT") == 0) {
! 810: symtab_shm (set_sym, kbuf, data);
! 811:
! 812: merr_clear ();
! 813: goto done;
! 814: }
! 815: else if (strcmp (mref_get_subscript (r, 1), "PRIORITY") == 0) {
! 816:
! 817: int new_pri;
! 818:
! 819: stcpy (tbuf, data);
! 820: stcnv_m2c (tbuf);
! 821:
! 822: new_pri = atoi (tbuf);
! 823:
! 824:
! 825: i = nice (40);
! 826: nice ((int) (new_pri - 40));
! 827:
! 828: symtab_shm (set_sym, kbuf, data);
! 829:
! 830: merr_clear ();
! 831: goto done;
! 832:
! 833: }
! 834: else if (strcmp (mref_get_subscript (r, 1), "IOPATH") == 0) {
! 835:
! 836: stcpy (oucpath, data);
! 837: symtab_shm (set_sym, kbuf, data);
! 838:
! 839: merr_clear ();
! 840: goto done;
! 841:
! 842: }
! 843: else if (strcmp (mref_get_subscript (r, 1), "REVSTR") == 0) {
! 844:
! 845: short tres = tvexpr (data);
! 846:
! 847: if (tres == TRUE) {
! 848: en_revstrf = 1;
! 849: }
! 850: else {
! 851: en_revstrf = 0;
! 852: }
! 853:
! 854: symtab_shm (set_sym, kbuf, data);
! 855:
! 856: merr_clear ();
! 857: goto done;
! 858:
! 859: }
! 860: else if (strcmp (mref_get_subscript (r, 1), "ZDATE_FORMAT") == 0) {
! 861: symtab_shm (set_sym, key, data);
! 862: merr_clear ();
! 863: goto done;
! 864:
! 865: }
! 866: else if (strcmp (mref_get_subscript (r, 1), "ZTIME_FORMAT") == 0) {
! 867: symtab_shm (set_sym, key, data);
! 868: merr_clear ();
! 869: goto done;
! 870:
! 871: }
! 872: else if (strcmp (mref_get_subscript (r, 1), "SYMTAB") == 0) {
! 873:
! 874: int itmp = atoi (data);
! 875:
! 876: if ((data[0] < '0') || (data[0] > '9')) {
! 877: merr_raise (INVEXPR);
! 878: goto done;
! 879: }
! 880:
! 881: if (itmp != 0 && itmp != 1) {
! 882: merr_raise (INVEXPR);
! 883: goto done;
! 884: }
! 885:
! 886: if (cur_symtab == itmp) {
! 887: merr_clear ();
! 888: goto done;
! 889: }
! 890:
! 891: if (cur_symtab == 0) {
! 892: cur_symtab = 1;
! 893: }
! 894: else {
! 895: cur_symtab = 0;
! 896: }
! 897:
! 898: if (apartition == NULL) {
! 899:
! 900: apartition = calloc ((unsigned) PSIZE + 1, 1);
! 901: asymlen = PSIZE;
! 902:
! 903: for (i = 0; i < 128; i++) aalphptr[i] = 0L;
! 904:
! 905: }
! 906:
! 907: {
! 908:
! 909: char *x;
! 910:
! 911: x = apartition;
! 912: apartition = partition;
! 913: partition = x;
! 914:
! 915: }
! 916:
! 917: ch = asymlen;
! 918: asymlen = symlen;
! 919: symlen = ch;
! 920:
! 921: for (i = 0; i < 128; i++) {
! 922: ch = aalphptr[i];
! 923: aalphptr[i] = alphptr[i];
! 924: alphptr[i] = ch;
! 925: }
! 926:
! 927: s = &partition[symlen] - 256; /* pointer to symlen_offset */
! 928: argptr = partition; /* pointer to beg of tmp-storage */
! 929:
! 930: symtab_shm (set_sym, key, data);
! 931:
! 932: merr_clear ();
! 933: goto done;
! 934:
! 935:
! 936: }
! 937: else if (strcmp (mref_get_subscript (r, 1), "MATH") == 0) {
! 938:
! 939: #if !defined(_AIX)
! 940: if (stcmp (data, "IEEE754\201") == 0) {
! 941:
! 942: fp_mode = 1;
! 943: symtab_shm (set_sym, kbuf, data);
! 944:
! 945: snprintf (fp_conversion, 9, "%%.%df\201", DBL_DIG);
! 946: zprecise = DBL_DIG;
! 947:
! 948: merr_clear ();
! 949: goto done;
! 950:
! 951: }
! 952: else if (stcmp (data, "FIXED\201") == 0) {
! 953:
! 954: fp_mode = 0;
! 955: symtab_shm (set_sym, kbuf, data);
! 956:
! 957: zprecise = 100;
! 958:
! 959: merr_clear ();
! 960: goto done;
! 961:
! 962: }
! 963: else {
! 964: merr_raise (M29);
! 965: goto done;
! 966: }
! 967: #endif
! 968:
! 969: }
! 970:
! 971: merr_raise (M29);
! 972: goto done;
! 973: }
! 974:
! 975: case get_sym:
! 976: if (strcmp (mref_get_subscript (r, 1), "LVNQOVAL") == 0) {
! 977: stcpy (data, l_o_val);
! 978: goto done;
! 979: }
! 980: else if (strcmp (mref_get_subscript (r, 1), "GVNQOVAL") == 0) {
! 981: stcpy (data, g_o_val);
! 982: goto done;
! 983: }
! 984: case dat:
! 985: case fra_order:
! 986: case fra_query:
! 987: if (strcmp (mref_get_subscript (r, 1), "LVNQOVAL") == 0) {
! 988: merr_raise (M38);
! 989: goto done;
! 990: }
! 991: if (strcmp (mref_get_subscript (r, 1), "GVNQOVAL") == 0) {
! 992: merr_raise (M38);
! 993: goto done;
! 994: }
! 995: case bigquery:
! 996: case getnext:
! 997: case m_alias:
! 998: case zdata:
! 999:
! 1000: if (action == get_sym) {
! 1001:
! 1002: if (strcmp (mref_get_subscript (r, 1), "PROCESS_START") == 0) {
! 1003:
! 1004: unsigned long ilong;
! 1005: unsigned long ilong1;
! 1006:
! 1007: ilong1 = slot->start_time + tzoffset;
! 1008: ilong = ilong1 / 86400;
! 1009:
! 1010: lintstr (data, ilong + 47117);
! 1011: i = stlen (data);
! 1012:
! 1013: data[i++] = ',';
! 1014: ilong = ilong1 - (ilong * 86400);
! 1015:
! 1016: lintstr (&data[i], ilong);
! 1017:
! 1018: merr_clear ();
! 1019: goto done;
! 1020:
! 1021: }
! 1022:
! 1023: }
! 1024:
! 1025: symtab_shm (action, kbuf, data);
! 1026:
! 1027: /* here, we need to convert the data on the way out too */
! 1028: if ((action == fra_query) && (stlen (data) > 0)) {
! 1029: if (strncmp (data, "^$JOB", 5) != 0) {
! 1030: snprintf (kbuf, STRLEN - 1, "^$JOB%s\201", data);
! 1031: stcpy (data, kbuf);
! 1032: }
! 1033: }
! 1034:
! 1035: merr_clear ();
! 1036: goto done;
! 1037:
! 1038: case killone:
! 1039: case kill_sym:
! 1040:
! 1041: if (strcmp (mref_get_subscript (r, 1), "ALIASES") == 0) {
! 1042:
! 1043: symtab_shm (action, key, data);
! 1044:
! 1045: goto done;
! 1046:
! 1047: }
! 1048: else if (strcmp (mref_get_subscript (r, 1), "LVNQOVAL") == 0) {
! 1049: l_o_val[0] = '\201';
! 1050: merr_clear ();
! 1051: goto done;
! 1052: }
! 1053: else if (strcmp (mref_get_subscript (r, 1), "GVNQOVAL") == 0) {
! 1054: g_o_val[0] = '\201';
! 1055: merr_clear ();
! 1056: goto done;
! 1057: }
! 1058: else if (strcmp (mref_get_subscript (r, 1), "GVNDEFAULT") == 0) {
! 1059: gvndefault[0] = '\201';
! 1060: symtab_shm (action, key, data);
! 1061: symtab_shm (set_sym, key, gvndefault);
! 1062: merr_clear ();
! 1063: goto done;
! 1064: }
! 1065: else if (strcmp (mref_get_subscript (r, 1), "LVNDEFAULT") == 0) {
! 1066: lvndefault[0] = '\201';
! 1067: symtab_shm (action, key, data);
! 1068: symtab_shm (set_sym, key, lvndefault);
! 1069: merr_clear ();
! 1070: goto done;
! 1071: }
! 1072: else {
! 1073: job_request_stop (t_pid);
! 1074: }
! 1075:
! 1076: goto done;
! 1077:
! 1078:
! 1079: default:
! 1080: merr_raise (INVREF);
! 1081: goto done;
! 1082:
! 1083: }
! 1084:
! 1085:
! 1086: done:
! 1087:
! 1088: free (r);
! 1089: free (kbuf);
! 1090: free (tbuf);
! 1091: free (key);
! 1092: return;
! 1093: }
! 1094:
! 1095: void frm_process_alias (char *key)
! 1096: {
! 1097: int ierr_sav;
! 1098: char *ptr;
! 1099: char name[256];
! 1100: char *subprt;
! 1101: register int i;
! 1102: register char ch;
! 1103:
! 1104: char *k_buf;
! 1105: char *d_buf;
! 1106: char *t_buf;
! 1107:
! 1108: k_buf = (char *) malloc (STRLEN * sizeof (char));
! 1109: NULLPTRCHK(k_buf,"frm_process_alias");
! 1110:
! 1111: d_buf = (char *) malloc (STRLEN * sizeof (char));
! 1112: NULLPTRCHK(d_buf,"frm_process_alias");
! 1113:
! 1114: t_buf = (char *) malloc (STRLEN * sizeof (char));
! 1115: NULLPTRCHK(t_buf,"frm_process_alias");
! 1116:
! 1117: ierr_sav = ierr;
! 1118: ptr = key;
! 1119: i = 0;
! 1120:
! 1121: while ((ch = *(ptr++)) != DELIM && ch != EOL && i < 256) {
! 1122: name[i++] = ch;
! 1123: }
! 1124:
! 1125: name[i] = '\0';
! 1126: subprt = key + i;
! 1127:
! 1128: snprintf (k_buf, STRLEN - 1, "^$JOB\202%ld\202ALIASES\202%s\201", pid, name);
! 1129: symtab_shm (get_sym, k_buf, d_buf);
! 1130:
! 1131: stcnv_m2c (d_buf);
! 1132:
! 1133: if (merr () == OK) {
! 1134: snprintf (t_buf, STRLEN - 1, "%s%s\201", d_buf, subprt);
! 1135: stcpy (key, t_buf);
! 1136: }
! 1137:
! 1138: free (k_buf);
! 1139: free (d_buf);
! 1140: free (t_buf);
! 1141:
! 1142: merr_raise (ierr_sav);
! 1143:
! 1144: return;
! 1145:
! 1146: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>