/* This is the server side of cvs release. */ static int release_server (int argc, char **argv) { int i; /* Note that we skip argv[0]. */ for (i = 1; i < argc; ++i) history_write ('F', argv[i], "", argv[i], "", NULL, NULL); return 0; }
void cleanup(void) { GList *list; /* destroy any remaining browsers */ while (ripcurl->Global.browsers) { browser_destroy(ripcurl->Global.browsers->data); } g_list_free(ripcurl->Global.browsers); /* free cookie file */ g_free(ripcurl->Files.cookie_file); /* write bookmarks */ if (ripcurl->Files.bookmarks_file) { bookmarks_write(); } /* clear bookmarks */ for (list = ripcurl->Global.bookmarks; list; list = g_list_next(list)) { free(list->data); } g_list_free(ripcurl->Global.bookmarks); g_free(ripcurl->Files.bookmarks_file); /* write history */ if (ripcurl->Files.history_file) { history_write(); } /* clear history */ for (list = ripcurl->Global.history; list; list = g_list_next(list)) { free(list->data); } g_list_free(ripcurl->Global.history); g_free(ripcurl->Files.history_file); /* free config dir file */ g_free(ripcurl->Files.config_dir); /* free font */ pango_font_description_free(ripcurl->Style.font); free(ripcurl); }
void quitmsg(char *message) { struct session *ses; SET_BIT(gtd->flags, TINTIN_FLAG_TERMINATE); while ((ses = gts->next) != NULL) { cleanup_session(ses); } if (gtd->chat) { close(gtd->chat->fd); } check_all_events(gts, SUB_ARG|SUB_SEC, 0, 0, "PROGRAM TERMINATION"); if (gtd->history_size) { char filename[BUFFER_SIZE]; sprintf(filename, "%s/%s/%s", gtd->home, TINTIN_DIR, HISTORY_FILE); history_write(gts, filename); } restore_terminal(); clean_screen(gts); if (message) { printf("\n%s\n", message); } printf("\nGoodbye from TinTin++\n\n"); fflush(NULL); exit(0); }
int release (int argc, char **argv) { int i, c; char *repository; char *thisarg; int arg_start_idx; int err = 0; short delete_flag = 0; short export_flag = 0; short yes_flag=0; struct saved_cwd cwd; #ifdef SERVER_SUPPORT if (server_active) return release_server (argc, argv); #endif /* Everything from here on is client or local. */ if (argc == -1) usage (release_usage); optind = 0; while ((c = getopt (argc, argv, "+Qdeqfy")) != -1) { switch (c) { case 'Q': case 'q': error (1, 0, "-q or -Q must be specified before \"%s\"", command_name); break; case 'd': delete_flag++; break; case 'f': force_delete++; break; case 'e': export_flag++; break; case 'y': yes_flag=1; break; case '?': default: usage (release_usage); break; } } argc -= optind; argv += optind; /* Remember the directory where "cvs release" was invoked because all args are relative to this directory and we chdir around. */ if (save_cwd (&cwd)) error_exit (); arg_start_idx = 0; for (i = arg_start_idx; i < argc; i++) { thisarg = argv[i]; if (isdir (thisarg)) { if (CVS_CHDIR (thisarg) < 0) { if (!really_quiet) error (0, errno, "can't chdir to: %s", thisarg); continue; } if (!isdir (CVSADM)) { if (!really_quiet) error (0, 0, "no repository directory: %s", thisarg); if (restore_cwd (&cwd, NULL)) error_exit (); continue; } } else { if (!really_quiet) error (0, 0, "no such directory: %s", thisarg); continue; } repository = Name_Repository ((char *) NULL, (char *) NULL); if (!really_quiet) { char *tmp; modified_files = 0; start_recursion (release_fileproc, (FILESDONEPROC) NULL, (PREDIRENTPROC) NULL, (DIRENTPROC) NULL, (DIRLEAVEPROC) NULL, (void *) NULL, 0, NULL, 0, W_LOCAL, 0, 0, (char *) NULL, NULL, 0, NULL, NULL); tmp=(char*)xmalloc(strlen(thisarg)+1024); if(modified_files) sprintf (tmp,"You have [%d] altered files in this repository.\n", modified_files); else *tmp='\0'; sprintf(tmp+strlen(tmp),"Are you sure you want to release %sdirectory '%s': ", delete_flag ? "(and delete) " : export_flag?"(and export) " : "", thisarg); if(!yes_flag) c=yesno_prompt(tmp,"Modified files",0); else { printf("%sy\n",tmp); c='y'; } xfree(tmp); if (c!='y') /* "No" */ { (void) fprintf (stderr, "** `%s' aborted by user choice.\n", command_name); xfree (repository); if (restore_cwd (&cwd, NULL)) error_exit (); continue; } } if (!(current_parsed_root->isremote && (!supported_request ("noop") || !supported_request ("Notify"))) ) { /* We are chdir'ed into the directory in question. So don't pass args to unedit. */ int argc = 1; char *argv[3]; argv[0] = "dummy"; argv[1] = NULL; err += unedit (argc, argv); /* Unedit will have killed our lockserver connection */ if(!current_parsed_root->isremote) lock_register_client(CVS_Username,current_parsed_root->directory); } if (current_parsed_root->isremote) { send_to_server ("Argument ", 0); send_to_server (thisarg, 0); send_to_server ("\n", 1); send_to_server ("release\n", 0); } else { history_write ('F', thisarg, "", thisarg, "", NULL, NULL); /* F == Free */ } xfree (repository); if (restore_cwd (&cwd, NULL)) error_exit (); if(!noexec) { if(delete_flag) { start_recursion (release_delete_fileproc, (FILESDONEPROC) NULL, (PREDIRENTPROC) NULL, (DIRENTPROC) NULL, release_delete_dirleaveproc, (void *) NULL, 1, &thisarg, 0, W_LOCAL, 0, 0, (char *) NULL, NULL, 0, NULL, NULL); } else if(export_flag) { start_recursion (NULL, (FILESDONEPROC) NULL, (PREDIRENTPROC) NULL, (DIRENTPROC) NULL, release_export_dirleaveproc, (void *) NULL, 1, &thisarg, 0, W_LOCAL, 0, 0, (char *) NULL, NULL, 0, NULL, NULL); } } if (current_parsed_root->isremote) err += get_server_responses (); } if (restore_cwd (&cwd, NULL)) error_exit (); free_cwd (&cwd); if (current_parsed_root->isremote) { /* Unfortunately, client.c doesn't offer a way to close the connection without waiting for responses. The extra network turnaround here is quite unnecessary other than that.... */ send_to_server ("noop\n", 0); err += get_responses_and_close (); } return err; }