Changeset 4071
- Timestamp:
- 11/30/09 11:03:47 (3 years ago)
- Location:
- neercs/trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
neercs/trunk/src/attach.c
r4061 r4071 415 415 free(screen_list->comm.socket_path[SOCK_SERVER]); 416 416 screen_list->comm.socket_path[SOCK_SERVER] = NULL; 417 screen_list-> attach = 0;417 screen_list->sys.attach = 0; 418 418 } 419 419 } … … 421 421 { 422 422 fprintf(stderr, "No socket found!\n"); 423 screen_list-> attach = 0;424 } 425 } 426 423 screen_list->sys.attach = 0; 424 } 425 } 426 -
neercs/trunk/src/input.c
r4064 r4071 140 140 create_screen(screen_list->width, 141 141 screen_list->height, 142 screen_list-> default_shell));142 screen_list->sys.default_shell)); 143 143 refresh = 1; 144 144 break; -
neercs/trunk/src/main.c
r4060 r4071 91 91 92 92 screen_list = create_screen_list(); 93 screen_list-> default_shell = getenv("SHELL");93 screen_list->sys.default_shell = getenv("SHELL"); 94 94 95 95 args = argc - 1; 96 if (screen_list-> default_shell == NULL && args <= 0)96 if (screen_list->sys.default_shell == NULL && args <= 0) 97 97 { 98 98 fprintf(stderr, … … 108 108 109 109 /* Then local one */ 110 if (screen_list-> user_path)111 { 112 read_configuration_file(screen_list-> user_path, screen_list);113 free(screen_list-> user_path);114 } 115 116 if (screen_list-> attach)117 { 118 if (screen_list-> nb_to_grab || screen_list->to_start)110 if (screen_list->sys.user_path) 111 { 112 read_configuration_file(screen_list->sys.user_path, screen_list); 113 free(screen_list->sys.user_path); 114 } 115 116 if (screen_list->sys.attach) 117 { 118 if (screen_list->sys.nb_to_grab || screen_list->sys.to_start) 119 119 { 120 120 fprintf(stderr, … … 125 125 attach(screen_list); 126 126 127 if (screen_list-> forceattach && !screen_list->attach)127 if (screen_list->sys.forceattach && !screen_list->sys.attach) 128 128 goto end; 129 129 } … … 154 154 155 155 /* Fork the server if needed */ 156 if (!screen_list-> attach)156 if (!screen_list->sys.attach) 157 157 { 158 158 debug("Spawning a new server"); … … 213 213 { 214 214 case 'c': /* --config */ 215 if (screen_list-> user_path)216 free(screen_list-> user_path);217 screen_list-> user_path = strdup(myoptarg);215 if (screen_list->sys.user_path) 216 free(screen_list->sys.user_path); 217 screen_list->sys.user_path = strdup(myoptarg); 218 218 s += 2; 219 219 break; … … 230 230 { 231 231 fprintf(stderr, "Invalid pid %d\n", pidopt); 232 if (screen_list-> to_grab)233 free(screen_list-> to_grab);232 if (screen_list->sys.to_grab) 233 free(screen_list->sys.to_grab); 234 234 return -1; 235 235 } … … 242 242 break; 243 243 } 244 if (!screen_list-> to_grab)244 if (!screen_list->sys.to_grab) 245 245 { 246 246 /* At most argc-1-s times -P <pid> + final 0 */ 247 screen_list-> to_grab =247 screen_list->sys.to_grab = 248 248 (int *)malloc(((argc - 1 - s) / 2 + 1) * sizeof(int)); 249 if (!screen_list-> to_grab)249 if (!screen_list->sys.to_grab) 250 250 { 251 251 fprintf(stderr, "Can't allocate memory at %s:%d\n", … … 254 254 } 255 255 } 256 screen_list-> to_grab[screen_list->nb_to_grab++] = pidopt;257 screen_list-> to_grab[screen_list->nb_to_grab] = 0;256 screen_list->sys.to_grab[screen_list->sys.nb_to_grab++] = pidopt; 257 screen_list->sys.to_grab[screen_list->sys.nb_to_grab] = 0; 258 258 s += 2; 259 259 break; … … 264 264 break; 265 265 case 'r': 266 screen_list-> forceattach = 1;266 screen_list->sys.forceattach = 1; 267 267 case 'R': 268 if (screen_list-> attach)268 if (screen_list->sys.attach) 269 269 { 270 270 fprintf(stderr, "Attaching can only be requested once\n"); … … 278 278 s += 1; 279 279 } 280 screen_list-> attach = 1;280 screen_list->sys.attach = 1; 281 281 s += 1; 282 282 break; … … 299 299 if (s >= 0 && s < argc - 1) 300 300 { 301 screen_list-> to_start = (char **)malloc((argc - s) * sizeof(char *));302 if (!screen_list-> to_start)301 screen_list->sys.to_start = (char **)malloc((argc - s) * sizeof(char *)); 302 if (!screen_list->sys.to_start) 303 303 { 304 304 fprintf(stderr, "Can't allocate memory at %s:%d\n", __FUNCTION__, … … 308 308 for (i = 0; i < (argc - 1) - s; i++) 309 309 { 310 screen_list-> to_start[i] = strdup(argv[i + s + 1]);311 } 312 screen_list-> to_start[argc - 1 - s] = NULL;310 screen_list->sys.to_start[i] = strdup(argv[i + s + 1]); 311 } 312 screen_list->sys.to_start[argc - 1 - s] = NULL; 313 313 } 314 314 return s; -
neercs/trunk/src/neercs.h
r4063 r4071 196 196 }; 197 197 198 struct sys 199 { 200 char *default_shell; 201 char *user_path; 202 int *to_grab; 203 char **to_start; 204 int nb_to_grab; 205 int attach, forceattach; 206 }; 207 198 208 struct screen_list 199 209 { … … 204 214 int changed; /* Global redraw needed (e.g. adding a screen) */ 205 215 int delay; /* Minimal time between two refresh (ms) */ 216 int requested_delay; 206 217 int force_refresh; 207 218 int need_refresh; /* If we skipped a refresh, do it next time */ … … 239 250 /* Option parsing and configuration */ 240 251 struct option *config; 241 char *default_shell; 242 char *user_path; 243 int *to_grab; 244 char **to_start; 245 int nb_to_grab; 246 int attach, forceattach; 247 int requested_delay; 252 253 struct sys sys; 248 254 249 255 struct recurrent_list *recurrent_list; -
neercs/trunk/src/python/interpreter.c
r4064 r4071 71 71 debug("py Init %p\n", screen_list->interpreter_props.box); 72 72 } 73 debug("py Drawing !\n");74 73 widget_ibox_draw(screen_list->interpreter_props.box); 75 74 } -
neercs/trunk/src/screen_list.c
r4063 r4071 86 86 screen_list->comm.socket_path[SOCK_CLIENT] = NULL; 87 87 screen_list->comm.session_name = NULL; 88 screen_list-> default_shell = NULL;89 screen_list-> user_path = NULL;90 screen_list-> to_grab = NULL;91 screen_list-> to_start = NULL;92 screen_list-> nb_to_grab = 0;93 screen_list-> attach = 0;94 screen_list-> forceattach = 0;88 screen_list->sys.default_shell = NULL; 89 screen_list->sys.user_path = NULL; 90 screen_list->sys.to_grab = NULL; 91 screen_list->sys.to_start = NULL; 92 screen_list->sys.nb_to_grab = 0; 93 screen_list->sys.attach = 0; 94 screen_list->sys.forceattach = 0; 95 95 screen_list->need_refresh = 0; 96 96 … … 120 120 if (user_dir) 121 121 { 122 screen_list-> user_path =122 screen_list->sys.user_path = 123 123 malloc(strlen(user_dir) + strlen("/.neercsrc") + 1); 124 sprintf(screen_list-> user_path, "%s/%s", user_dir, ".neercsrc");124 sprintf(screen_list->sys.user_path, "%s/%s", user_dir, ".neercsrc"); 125 125 } 126 126 -
neercs/trunk/src/server.c
r4063 r4071 418 418 + screen_list->modals.status); 419 419 420 if (!screen_list-> to_grab && !screen_list->to_start)420 if (!screen_list->sys.to_grab && !screen_list->sys.to_start) 421 421 { 422 422 add_screen(screen_list, 423 423 create_screen(screen_list->width, 424 424 screen_list->height, 425 screen_list-> default_shell));425 screen_list->sys.default_shell)); 426 426 } 427 427 428 428 /* Attach processes */ 429 if (screen_list-> to_grab)430 { 431 for (i = 0; screen_list-> to_grab[i]; i++)429 if (screen_list->sys.to_grab) 430 { 431 for (i = 0; screen_list->sys.to_grab[i]; i++) 432 432 { 433 433 add_screen(screen_list, 434 434 create_screen_grab(screen_list->width, 435 435 screen_list->height, 436 screen_list-> to_grab[i]));437 } 438 free(screen_list-> to_grab);439 screen_list-> to_grab = NULL;436 screen_list->sys.to_grab[i])); 437 } 438 free(screen_list->sys.to_grab); 439 screen_list->sys.to_grab = NULL; 440 440 } 441 441 442 442 /* Launch command line processes */ 443 if (screen_list-> to_start)444 { 445 for (i = 0; screen_list-> to_start[i]; i++)443 if (screen_list->sys.to_start) 444 { 445 for (i = 0; screen_list->sys.to_start[i]; i++) 446 446 { 447 447 add_screen(screen_list, 448 448 create_screen(screen_list->width, 449 449 screen_list->height, 450 screen_list-> to_start[i]));451 free(screen_list-> to_start[i]);452 } 453 free(screen_list-> to_start);454 screen_list-> to_start = NULL;450 screen_list->sys.to_start[i])); 451 free(screen_list->sys.to_start[i]); 452 } 453 free(screen_list->sys.to_start); 454 screen_list->sys.to_start = NULL; 455 455 } 456 456 -
neercs/trunk/src/widgets.c
r4048 r4071 80 80 void widget_ibox_destroy(struct input_box *box) 81 81 { 82 if(!box) return; 82 83 if (box->command) 83 84 free(box->command);
Note: See TracChangeset
for help on using the changeset viewer.
