|
|
| version 1.12, 2025/04/09 19:52:02 | version 1.14, 2025/04/13 04:22:43 |
|---|---|
| Line 24 | Line 24 |
| * along with FreeM. If not, see <https://www.gnu.org/licenses/>. | * along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
| * | * |
| * $Log$ | * $Log$ |
| * Revision 1.14 2025/04/13 04:22:43 snw | |
| * Fix snprintf calls | |
| * | |
| * Revision 1.13 2025/04/10 01:24:39 snw | |
| * Remove C++ style comments | |
| * | |
| * Revision 1.12 2025/04/09 19:52:02 snw | * Revision 1.12 2025/04/09 19:52:02 snw |
| * Eliminate as many warnings as possible while building with -Wall | * Eliminate as many warnings as possible while building with -Wall |
| * | * |
| Line 528 next0: | Line 534 next0: |
| else if (tmp2[0] == '<') { /* call write output to %-array */ | else if (tmp2[0] == '<') { /* call write output to %-array */ |
| FILE *pipdes; | FILE *pipdes; |
| char key[STRLEN + 1 /*was 256 */ ]; | char key[STRLEN]; |
| char data[STRLEN + 1 /*was 256 */ ]; | char data[STRLEN]; |
| char data_kill[256]; | char data_kill[256]; |
| data_kill[255] = EOL; | data_kill[255] = EOL; |
| for (i = 0; i < STRLEN + 1; i++) vn[i] = EOL; | for (i = 0; i < STRLEN - 1; i++) vn[i] = EOL; |
| snprintf (key, 255, "^$JOB\202%d\202PIPE_GLVN\201", pid); | snprintf (key, STRLEN - 1, "^$JOB\202%d\202PIPE_GLVN\201", pid); |
| ssvn (get_sym, key, vn); | ssvn (get_sym, key, vn); |
| if (vn[0] == '^') { | if (vn[0] == '^') { |
| Line 553 next0: | Line 559 next0: |
| symtab (kill_sym, vn, data); | symtab (kill_sym, vn, data); |
| } | } |
| snprintf (key, 255, "^$JOB\202%d\202PIPE_GLVN\201", pid); | snprintf (key, STRLEN - 1, "^$JOB\202%d\202PIPE_GLVN\201", pid); |
| ssvn (get_sym, key, vn); | ssvn (get_sym, key, vn); |
| data[0] = '0'; | data[0] = '0'; |
| Line 582 next0: | Line 588 next0: |
| int glvn_len = 0; | int glvn_len = 0; |
| while (fgets (data, STRLEN, pipdes)) { | while (fgets (data, STRLEN, pipdes)) { |
| snprintf (key, 255, "^$JOB\202%d\202PIPE_GLVN\201", pid); | snprintf (key, STRLEN - 1, "^$JOB\202%d\202PIPE_GLVN\201", pid); |
| ssvn (get_sym, key, vn); | ssvn (get_sym, key, vn); |
| glvn_len = stlen (vn); | glvn_len = stlen (vn); |
| Line 643 next0: | Line 649 next0: |
| for (i = 0; i < STRLEN + 1; i++) vn[i] = EOL; | for (i = 0; i < STRLEN + 1; i++) vn[i] = EOL; |
| snprintf (key, 255, "^$JOB\202%d\202PIPE_GLVN\201", pid); | snprintf (key, STRLEN - 1, "^$JOB\202%d\202PIPE_GLVN\201", pid); |
| ssvn (get_sym, key, vn); | ssvn (get_sym, key, vn); |
| if (vn[0] == '^') { | if (vn[0] == '^') { |
| Line 672 next0: | Line 678 next0: |
| int glvn_len = 0; | int glvn_len = 0; |
| for (i = 1; i <= k; i++) { | for (i = 1; i <= k; i++) { |
| snprintf (key, 255, "^$JOB\202%d\202PIPE_GLVN\201", pid); | snprintf (key, STRLEN - 1, "^$JOB\202%d\202PIPE_GLVN\201", pid); |
| ssvn (get_sym, key, vn); | ssvn (get_sym, key, vn); |
| glvn_len = stlen (vn); | glvn_len = stlen (vn); |
| Line 943 set0: | Line 949 set0: |
| if (*++codptr != '=') { | if (*++codptr != '=') { |
| /* SET A++ or SET A-- equivalent to SET A+=1 SET A-=1 currently disabled */ | /* unary ++/-- */ |
| //#ifdef NEVER | |
| if ((ch == '+' || ch == '-') && ch == *codptr) { | if ((ch == '+' || ch == '-') && ch == *codptr) { |
| codptr++; | codptr++; |
| setop = ch; | setop = ch; |
| Line 953 set0: | Line 958 set0: |
| goto set2; | goto set2; |
| } | } |
| //#endif /* NEVER */ | |
| merr_raise (ASSIGNER); | merr_raise (ASSIGNER); |
| break; | break; |
| Line 1605 set10: | Line 1609 set10: |
| } | } |
| if (stcat (tmp2, &tmp3[arg4]) == 0) { | if (stcat (tmp2, &tmp3[arg4]) == 0) { |
| merr_raise (M56); //JPW | merr_raise (M56); /* snw */ |
| goto err; | goto err; |
| } | } |
| Line 2384 s_end: | Line 2388 s_end: |
| #ifdef DEBUG_NEWSTACK | #ifdef DEBUG_NEWSTACK |
| printf ("EXTRINSIC\r\n"); | printf ("EXTRINSIC\r\n"); |
| #endif | #endif |
| //printf (" extr_types[%d] = '%d'\r\n", nstx, extr_types[nstx]); | |
| if (*codptr == EOL || *codptr == SP) { | if (*codptr == EOL || *codptr == SP) { |
| #ifdef DEBUG_NEWSTACK | #ifdef DEBUG_NEWSTACK |
| Line 3989 off3: | Line 3992 off3: |
| if (merr () > OK) goto err; | if (merr () > OK) goto err; |
| /* TODO: check this snprintf for proper sizing */ | |
| snprintf (&tmp3[1], 255, "%s\201", &constructor[1]); | snprintf (&tmp3[1], 255, "%s\201", &constructor[1]); |
| goto private; | goto private; |
| Line 5100 open_socket: | Line 5104 open_socket: |
| #endif | #endif |
| if (nestc[nstx] == BREAK) { | if (nestc[nstx] == BREAK) { |
| // printf ("nestc[nstx] was BREAK\r\n"); | |
| if (repQUIT) continue; | if (repQUIT) continue; |
| merr_raise (OK - CTRLB); | merr_raise (OK - CTRLB); |
| goto zgo; /*cont. single step */ | goto zgo; /*cont. single step */ |
| } | } |
| // else { | |
| // printf ("nestc[nstx] was _not_ BREAK\r\n"); | |
| // } | |
| if (nestc[nstx] == FOR) { | if (nestc[nstx] == FOR) { |
| Line 5807 zwritep: | Line 5807 zwritep: |
| expr (NAME); | expr (NAME); |
| //if (varnam[0] == '^') merr_raise (GLOBER); | |
| if (merr () > OK) goto err; | if (merr () > OK) goto err; |
| codptr++; | codptr++; |
| Line 6588 evthandler: /* for event hand | Line 6587 evthandler: /* for event hand |
| /* run the next iteration of GTK's event loop */ | /* run the next iteration of GTK's event loop */ |
| //TODO: replace with libXt event loop | /* TODO: replace with libXt event loop */ |
| //gtk_main_iteration_do (TRUE); | /* gtk_main_iteration_do (TRUE); */ |
| /* dequeue any events */ | /* dequeue any events */ |
| evt_count = mwapi_dequeue_events (syn_handlers); | evt_count = mwapi_dequeue_events (syn_handlers); |
| if (evt_count) { | if (evt_count) { |
| /* write them out */ | /* write them out */ |
| //printf ("event handlers = '%s'\r\n", syn_handlers); | /* printf ("event handlers = '%s'\r\n", syn_handlers); */ |
| syn_event_entry_nstx = nstx; | syn_event_entry_nstx = nstx; |
| Line 7041 restart: | Line 7040 restart: |
| DSW &= ~BIT0; /* enable ECHO */ | DSW &= ~BIT0; /* enable ECHO */ |
| // print here | /* print here */ |
| { | { |
| char *t_rtn; | char *t_rtn; |
| char *t_nsn = (char *) malloc (STRLEN * sizeof (char)); | char *t_nsn = (char *) malloc (STRLEN * sizeof (char)); |
| Line 7172 direct_mode: | Line 7171 direct_mode: |
| if (quiet_mode == FALSE) { | if (quiet_mode == FALSE) { |
| if (tp_level == 0) { | if (tp_level == 0) { |
| snprintf (fmrl_prompt, 255, "\r\n%s.%s> ", shm_env, nsname); | snprintf (fmrl_prompt, sizeof (fmrl_prompt) - 1, "\r\n%s.%s> ", shm_env, nsname); |
| } | } |
| else { | else { |
| snprintf (fmrl_prompt, 255, "\r\nTL%d:%s.%s> ", tp_level, shm_env, nsname); | snprintf (fmrl_prompt, sizeof (fmrl_prompt) - 1 , "\r\nTL%d:%s.%s> ", tp_level, shm_env, nsname); |
| } | } |
| } | } |
| set_io (UNIX); | set_io (UNIX); |
| Line 7200 direct_mode: | Line 7199 direct_mode: |
| if (fmrl_buf[0] == '?') { | if (fmrl_buf[0] == '?') { |
| char kb[20]; | char kb[20]; |
| char db[255]; | char db[STRLEN]; |
| snprintf (kb, 19, "%%SYS.HLP\201"); | snprintf (kb, sizeof (kb) - 1, "%%SYS.HLP\201"); |
| snprintf (db, 19, "\201"); | snprintf (db, STRLEN - 1, "\201"); |
| symtab (kill_sym, kb, db); | symtab (kill_sym, kb, db); |
| Line 7213 direct_mode: | Line 7212 direct_mode: |
| stcpy (code, "DO ^%ZHELP\201"); | stcpy (code, "DO ^%ZHELP\201"); |
| if (strlen (fmrl_buf) > 1) { | if (strlen (fmrl_buf) > 1) { |
| snprintf (db, 254, "%s\201", &fmrl_buf[1]); | snprintf (db, STRLEN - 1, "%s\201", &fmrl_buf[1]); |
| symtab (set_sym, kb, db); | symtab (set_sym, kb, db); |
| } | } |
| Line 7282 direct_mode: | Line 7281 direct_mode: |
| } | } |
| else if (isdigit(fmrl_buf[0]) || (fmrl_buf[0] == '(') || (fmrl_buf[0] == '-') || (fmrl_buf[0] == '\'') || (fmrl_buf[0] == '+') || (fmrl_buf[0] == '$') || (fmrl_buf[0] == '^')) { | else if (isdigit(fmrl_buf[0]) || (fmrl_buf[0] == '(') || (fmrl_buf[0] == '-') || (fmrl_buf[0] == '\'') || (fmrl_buf[0] == '+') || (fmrl_buf[0] == '$') || (fmrl_buf[0] == '^')) { |
| snprintf (code, 255, "W %s", fmrl_buf); | snprintf (code, STRLEN - 1, "W %s", fmrl_buf); |
| stcnv_c2m (code); | stcnv_c2m (code); |
| set_io (MUMPS); | set_io (MUMPS); |
| Line 7364 direct_mode: | Line 7363 direct_mode: |
| char fmrl_prompt[256]; | char fmrl_prompt[256]; |
| if (tp_level == 0) { | if (tp_level == 0) { |
| snprintf (fmrl_prompt, 256, "\r\n%s> \201", nsname); | snprintf (fmrl_prompt, sizeof (fmrl_prompt) - 1, "\r\n%s> \201", nsname); |
| } | } |
| else { | else { |
| snprintf (fmrl_prompt, 256, "\r\nTL%d:%s> \201", tp_level, nsname); | snprintf (fmrl_prompt, sizeof (fmrl_prompt) - 1, "\r\nTL%d:%s> \201", tp_level, nsname); |
| } | } |
| write_m (fmrl_prompt); | write_m (fmrl_prompt); |
| Line 7379 direct_mode: | Line 7378 direct_mode: |
| #endif | #endif |
| if (merr () > OK) goto err; | if (merr () > OK) goto err; |
| // printf ("zbflag = %d\r\n", zbflag); | |
| if (code[0] == EOL && zbflag && nestc[nstx] == BREAK) { | if (code[0] == EOL && zbflag && nestc[nstx] == BREAK) { |
| //printf ("cont single step\r\n"); | |
| debug_mode = TRUE; | debug_mode = TRUE; |
| merr_raise (OK - CTRLB); | merr_raise (OK - CTRLB); |
| //printf ("ierr now '%d'\r\n", ierr); | |
| goto zgo; | goto zgo; |
| } /* single step */ | } /* single step */ |
| } | } |