Changeset 5919
- Timestamp:
- Jan 5, 2006, 6:55:37 PM (21 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 12 edited
-
cmd.data/box.c (modified) (2 diffs)
-
dimm/dimm.c (modified) (2 diffs)
-
dvo/dvo.c (modified) (2 diffs)
-
include/shell.h (modified) (1 diff)
-
lib.data/open_graph.c (modified) (4 diffs)
-
lib.data/open_image.c (modified) (5 diffs)
-
lib.shell/opihi.c (modified) (1 diff)
-
lib.shell/startup.c (modified) (11 diffs)
-
mana/mana.c (modified) (2 diffs)
-
pantasks/psched.c (modified) (2 diffs)
-
pclient/pclient.c (modified) (2 diffs)
-
pcontrol/pcontrol.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/box.c
r5850 r5919 6 6 Graphdata graphmode; 7 7 8 if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE);9 10 8 strcpy (graphmode.ticks, "2222"); 11 9 if ((N = get_argument (argc, argv, "-ticks"))) { … … 47 45 remove_argument (N, &argc, argv); 48 46 } 47 if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE); 49 48 50 49 if (argc != 1) goto usage; -
trunk/Ohana/src/opihi/dimm/dimm.c
r4714 r5919 8 8 9 9 /* program-dependent initialization */ 10 void initialize (intargc, char **argv) {10 void program_init (int *argc, char **argv) { 11 11 12 12 auto_break = TRUE; … … 24 24 set_str_variable ("PROMPT", opihi_prompt); 25 25 set_str_variable ("RCFILE", opihi_rcfile); 26 26 27 # ifdef HELPDIR_DEFAULT 27 28 set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT)); 28 29 # endif 29 30 30 { /* check history file permission */31 FILE *f;32 f = fopen (opihi_history, "a");33 if (f == NULL) /* no current history file here */34 fprintf (stderr, "can't save history.\n");35 else36 fclose (f);37 stifle_history (200);38 read_history (opihi_history);39 }40 41 signal (SIGINT, SIG_IGN);42 31 return; 43 32 } -
trunk/Ohana/src/opihi/dvo/dvo.c
r5900 r5919 8 8 9 9 /* program-dependent initialization */ 10 void program_init (int argc, char **argv) {10 void program_init (int *argc, char **argv) { 11 11 12 12 auto_break = TRUE; … … 18 18 InitDVO (); 19 19 20 if (!SetCATDIR (NULL, TRUE)) {20 if (!SetCATDIR (NULL, FALSE)) { 21 21 fprintf (stderr, "CATDIR is not defined\n"); 22 22 } -
trunk/Ohana/src/opihi/include/shell.h
r5900 r5919 44 44 45 45 /*** basic opihi shell functions ***/ 46 void general_init PROTO((int argc, char **argv));47 void program_init PROTO((int argc, char **argv));48 void startup PROTO((int argc, char **argv));46 void general_init PROTO((int *argc, char **argv)); 47 void program_init PROTO((int *argc, char **argv)); 48 void startup PROTO((int *argc, char **argv)); 49 49 int multicommand PROTO((char *line)); 50 50 int command PROTO((char *, char **)); -
trunk/Ohana/src/opihi/lib.data/open_graph.c
r5850 r5919 5 5 # define NXGRAPH 5 6 6 7 static int IsImage = FALSE;8 7 static int Active; 9 8 static int Xgraph[NXGRAPH]; 10 9 static Graphdata graphdata[NXGRAPH]; 11 10 12 int GetCurrentDevice () {13 return (IsImage);14 }15 11 16 void SetImageDevice (int state) {17 IsImage = state;18 }19 12 20 13 void QuitGraph () { … … 69 62 70 63 int fd; 71 char *kapa_exec ;64 char *kapa_exec, name[16]; 72 65 73 66 kapa_exec = get_variable ("KAPA"); … … 77 70 } 78 71 79 fd = KiiOpen (kapa_exec, NULL); 72 snprintf (name, 16, "[%d]", N); 73 fd = KiiOpen (kapa_exec, name); 74 free (kapa_exec); 80 75 81 76 if (fd < 0) { … … 158 153 graphdata[Active] = data; 159 154 } 155 156 /** internal tracking of current active device type **/ 157 158 static int IsImage = FALSE; 159 160 int GetCurrentDevice () { 161 return (IsImage); 162 } 163 164 void SetImageDevice (int state) { 165 IsImage = state; 166 } 167 -
trunk/Ohana/src/opihi/lib.data/open_image.c
r5846 r5919 1 1 # include "display.h" 2 3 2 # define DEBUG 0 4 3 … … 11 10 static double Xzero[NXIMAGE]; 12 11 static double Xrange[NXIMAGE]; 13 14 /* define a structure to carry the relevant image data, eqiv to GraphData? */15 12 16 13 void QuitImage () { … … 36 33 } 37 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 38 53 /* set SIGPIPE to this function to close cleanly */ 39 54 void XImageDead (int input) { … … 47 62 48 63 int fd; 49 char *kii_exec ;64 char *kii_exec, name[16]; 50 65 51 66 kii_exec = get_variable ("KII"); … … 55 70 } 56 71 57 fd = KiiOpen (kii_exec, NULL); 72 snprintf (name, 16, "[%d]", N); 73 fd = KiiOpen (kii_exec, name); 58 74 free (kii_exec); 59 75 -
trunk/Ohana/src/opihi/lib.shell/opihi.c
r5900 r5919 8 8 pid_t ppid; 9 9 10 general_init ( argc, argv);11 program_init ( argc, argv);12 startup ( argc, argv);10 general_init (&argc, argv); 11 program_init (&argc, argv); 12 startup (&argc, argv); 13 13 prompt = get_variable("PROMPT"); 14 14 history = get_variable("HISTORY"); -
trunk/Ohana/src/opihi/lib.shell/startup.c
r5900 r5919 6 6 */ 7 7 8 void general_init (int argc, char **argv) {8 void general_init (int *argc, char **argv) { 9 9 10 10 /* init srand for rnd numbers elsewhere */ … … 18 18 19 19 /* load config data (.ptolemyrc) */ 20 if (!ConfigInit ( &argc, argv)) {20 if (!ConfigInit (argc, argv)) { 21 21 fprintf (stderr, "can't find config file. some functions will be unavailable\n"); 22 22 } … … 25 25 } 26 26 27 void startup (int argc, char **argv) {27 void startup (int *argc, char **argv) { 28 28 29 29 int i, N, status, ONLY_INPUT, LOAD_RC; … … 31 31 char *rcfile, **list; 32 32 int Nlist, NLIST; 33 static char dot[] = ".";34 33 35 34 /* load in interesting environment variables */ … … 37 36 38 37 home = getenv ("HOME"); 39 if (home == NULL) home = dot; 40 set_str_variable ("HOME", home); 38 if (home == NULL) 39 set_str_variable ("HOME", "."); 40 else 41 set_str_variable ("HOME", home); 41 42 set_str_variable ("KII", "kii"); 42 43 set_str_variable ("KAPA", "kapa"); … … 54 55 char *opihi_history; 55 56 56 opihi_history = get_variable (" RCFILE");57 opihi_history = get_variable ("HISTORY"); 57 58 f = fopen (opihi_history, "a"); 58 59 if (f == NULL) /* no current history file here */ … … 84 85 } 85 86 } 87 } 86 88 87 89 LOAD_RC = TRUE; 88 if ((N = get_argument ( argc, argv, "--norc"))) {89 remove_argument (N, &argc, argv);90 if ((N = get_argument (*argc, argv, "--norc"))) { 91 remove_argument (N, argc, argv); 90 92 LOAD_RC = FALSE; 91 93 } 92 94 93 95 ONLY_INPUT = FALSE; 94 if ((N = get_argument ( argc, argv, "--only"))) {95 remove_argument (N, &argc, argv);96 if ((N = get_argument (*argc, argv, "--only"))) { 97 remove_argument (N, argc, argv); 96 98 ONLY_INPUT = TRUE; 97 99 } … … 101 103 NLIST = 10; 102 104 ALLOCATE (list, char *, NLIST); 103 while ((N = get_argument ( argc, argv, "--load"))) {104 remove_argument (N, &argc, argv);105 while ((N = get_argument (*argc, argv, "--load"))) { 106 remove_argument (N, argc, argv); 105 107 list[Nlist] = strcreate (argv[N]); 106 remove_argument (N, &argc, argv);108 remove_argument (N, argc, argv); 107 109 Nlist++; 108 110 if (Nlist == NLIST) { … … 113 115 114 116 is_script = TRUE; 115 if ( argc == 1) is_script = FALSE;117 if (*argc == 1) is_script = FALSE; 116 118 set_int_variable ("SCRIPT", is_script); 117 119 … … 130 132 /* generate list argv:0 - argv:n from arguments */ 131 133 ALLOCATE (varname, char, 256); 132 for (i = 2; i < argc; i++) {134 for (i = 2; i < *argc; i++) { 133 135 sprintf (varname, "argv:%d", i - 2); 134 136 set_str_variable (varname, argv[i]); … … 150 152 if (ONLY_INPUT) exit (2); 151 153 if (is_script) exit (2); 152 }154 return; 153 155 } -
trunk/Ohana/src/opihi/mana/mana.c
r4714 r5919 8 8 9 9 /* program-dependent initialization */ 10 void initialize(int argc, char **argv) {10 void program_init (int argc, char **argv) { 11 11 12 12 auto_break = TRUE; … … 24 24 set_str_variable ("PROMPT", opihi_prompt); 25 25 set_str_variable ("RCFILE", opihi_rcfile); 26 26 27 # ifdef HELPDIR_DEFAULT 27 28 set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT)); 28 29 # endif 29 30 30 { /* check history file permission */31 FILE *f;32 f = fopen (opihi_history, "a");33 if (f == NULL) /* no current history file here */34 fprintf (stderr, "can't save history.\n");35 else36 fclose (f);37 stifle_history (200);38 read_history (opihi_history);39 }40 41 signal (SIGINT, SIG_IGN);42 31 return; 43 32 } -
trunk/Ohana/src/opihi/pantasks/psched.c
r4763 r5919 8 8 9 9 /* program-dependent initialization */ 10 void initialize (intargc, char **argv) {10 void program_init (int *argc, char **argv) { 11 11 12 12 auto_break = TRUE; … … 25 25 set_str_variable ("PROMPT", opihi_prompt); 26 26 set_str_variable ("RCFILE", opihi_rcfile); 27 27 28 # ifdef HELPDIR_DEFAULT 28 29 set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT)); 29 30 # endif 30 31 31 { /* check history file permission */32 FILE *f;33 f = fopen (opihi_history, "a");34 if (f == NULL) /* no current history file here */35 fprintf (stderr, "can't save history.\n");36 else37 fclose (f);38 stifle_history (200);39 read_history (opihi_history);40 }41 42 signal (SIGINT, SIG_IGN);43 32 signal (SIGPIPE, gotsignal); 44 33 signal (SIGTSTP, gotsignal); -
trunk/Ohana/src/opihi/pclient/pclient.c
r4763 r5919 8 8 9 9 /* program-dependent initialization */ 10 void initialize (intargc, char **argv) {10 void program_init (int *argc, char **argv) { 11 11 12 12 auto_break = TRUE; … … 31 31 32 32 /* ignore the history file. to change this, see, eg, mana.c */ 33 signal (SIGINT, SIG_IGN);34 33 signal (SIGPIPE, gotsignal); 35 34 signal (SIGTSTP, gotsignal); -
trunk/Ohana/src/opihi/pcontrol/pcontrol.c
r4763 r5919 8 8 9 9 /* program-dependent initialization */ 10 void initialize (intargc, char **argv) {10 void program_init (int *argc, char **argv) { 11 11 12 12 auto_break = TRUE; … … 24 24 set_str_variable ("PROMPT", opihi_prompt); 25 25 set_str_variable ("RCFILE", opihi_rcfile); 26 26 27 # ifdef HELPDIR_DEFAULT 27 28 set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT)); … … 29 30 30 31 /* ignore the history file. to change this, see, eg, mana.c */ 31 signal (SIGINT, SIG_IGN);32 32 signal (SIGPIPE, gotsignal); 33 33 signal (SIGTSTP, gotsignal);
Note:
See TracChangeset
for help on using the changeset viewer.
