/* * Check whether FNAME exists and ask if it's okay to overwrite an * existing one. * Returns: True: it's okay to overwrite or the file does not exist * False: Do not overwrite */ int overwrite_filep( const char *fname ) { if ( iobuf_is_pipe_filename (fname) ) return 1; /* Writing to stdout is always okay. */ if ( access( fname, F_OK ) ) return 1; /* Does not exist. */ if ( !compare_filenames (fname, NAME_OF_DEV_NULL) ) return 1; /* Does not do any harm. */ if (opt.answer_yes) return 1; if (opt.answer_no || opt.batch) return 0; /* Do not overwrite. */ tty_printf (_("File '%s' exists. "), fname); if (cpr_enabled ()) tty_printf ("\n"); if (cpr_get_answer_is_yes ("openfile.overwrite.okay", _("Overwrite? (y/N) ")) ) return 1; return 0; }
__attribute__((constructor)) void prime() { unsigned prime[MAX]; unsigned tested_value = 2; unsigned next_empty_slot = 0; unsigned is_prime; unsigned i; tty_printf("*** Starting Prime Computation ***\n\n"); while (1) { is_prime = TRUE; for( i=0 ; i<next_empty_slot ; i++ ) { if( tested_value%prime[i] == 0 ) is_prime = FALSE; } if ( is_prime ) { prime[next_empty_slot] = tested_value; tty_printf("prime[%d] = %d\n", next_empty_slot, tested_value); next_empty_slot++; if( next_empty_slot == MAX) { tty_printf("prime table full\n"); exit(); } } tested_value++; } } // end main
/**************** * Note: Using a level of 0 should never block and better add nothing * to the pool. This is easy to accomplish with /dev/urandom. */ static int gather_random( void (*add)(const void*, size_t, int), int requester, size_t length, int level ) { static int fd_urandom = -1; static int fd_random = -1; int fd; int n; int warn=0; byte buffer[768]; if( level >= 2 ) { if( fd_random == -1 ) fd_random = open_device( NAME_OF_DEV_RANDOM, 8 ); fd = fd_random; } else { /* this will also be used for elve 0 but by using /dev/urandom * we can be sure that oit will never block. */ if( fd_urandom == -1 ) fd_urandom = open_device( NAME_OF_DEV_URANDOM, 9 ); fd = fd_urandom; } #if 0 #ifdef HAVE_DEV_RANDOM_IOCTL g10_log_info("entropy count of %d is %lu\n", fd, get_entropy_count(fd) ); #endif #endif while( length ) { fd_set rfds; struct timeval tv; int rc; FD_ZERO(&rfds); FD_SET(fd, &rfds); tv.tv_sec = 3; tv.tv_usec = 0; if( !(rc=select(fd+1, &rfds, NULL, NULL, &tv)) ) { if( !warn ) #ifdef IS_MODULE fprintf(stderr, #else tty_printf( #endif _("\n" "Not enough random bytes available. Please do some other work to give\n" "the OS a chance to collect more entropy! (Need %d more bytes)\n"), length ); warn = 1; continue; } else if( rc == -1 ) { #ifdef IS_MODULE fprintf(stderr, #else tty_printf( #endif "select() error: %s\n", strerror(errno)); continue; }
static void update_split (const WDialog * h) { /* Check split has to be done before testing if it changed, since it can change due to calling check_split() as well */ check_split (&panels_layout); if (panels_layout.horizontal_split) check_options[0].widget->state = panels_layout.horizontal_equal ? 1 : 0; else check_options[0].widget->state = panels_layout.vertical_equal ? 1 : 0; widget_redraw (WIDGET (check_options[0].widget)); tty_setcolor (check_options[0].widget->state & C_BOOL ? DISABLED_COLOR : COLOR_NORMAL); widget_move (h, 6, 5); if (panels_layout.horizontal_split) tty_printf ("%03d", panels_layout.top_panel_size); else tty_printf ("%03d", panels_layout.left_panel_size); widget_move (h, 6, 17); if (panels_layout.horizontal_split) tty_printf ("%03d", height - panels_layout.top_panel_size); else tty_printf ("%03d", COLS - panels_layout.left_panel_size); widget_move (h, 6, 12); tty_print_char ('='); }
/**************** * Check whether FNAME exists and ask if it's okay to overwrite an * existing one. * Returns: True: it's okay to overwrite or the file does not exist * False: Do not overwrite */ int overwrite_filep( const char *fname ) { if( iobuf_is_pipe_filename (fname) ) return 1; /* Writing to stdout is always okay */ if( access( fname, F_OK ) ) return 1; /* does not exist */ #ifndef HAVE_DOSISH_SYSTEM if ( !strcmp ( fname, "/dev/null" ) ) return 1; /* does not do any harm */ #endif #ifdef HAVE_W32_SYSTEM if ( !strcmp ( fname, "nul" ) ) return 1; #endif /* fixme: add some backup stuff in case of overwrite */ if( opt.answer_yes ) return 1; if( opt.answer_no || opt.batch ) return 0; /* do not overwrite */ tty_printf(_("File `%s' exists. "), fname); if( cpr_enabled () ) tty_printf ("\n"); if( cpr_get_answer_is_yes("openfile.overwrite.okay", _("Overwrite? (y/N) ")) ) return 1; return 0; }
/**************** * wrapper around do_we_trust, so we can ask whether to use the * key anyway. */ static int do_we_trust_pre( PKT_public_key *pk, unsigned int trustlevel ) { int rc; rc = do_we_trust( pk, trustlevel ); if( !opt.batch && !rc ) { print_pubkey_info(NULL,pk); print_fingerprint (pk, NULL, 2); tty_printf("\n"); tty_printf( _("It is NOT certain that the key belongs to the person named\n" "in the user ID. If you *really* know what you are doing,\n" "you may answer the next question with yes.\n")); tty_printf("\n"); if( cpr_get_answer_is_yes("untrusted_key.override", _("Use this key anyway? (y/N) ")) ) rc = 1; /* Hmmm: Should we set a flag to tell the user about * his decision the next time he encrypts for this recipient? */ } return rc; }
void load() { int image = 0; tty_printf(" !!! Processor %d running !!!\n", procid()); while(image < NIMAGES) { while ( buf_in_empty == FALSE ) {} // synchro tty_printf("\n *** Starting load for image %d *** at cycle %d \n", image, proctime()); if( ioc_read(image*NBLOCKS, buf_in, NBLOCKS) ) { tty_printf("echec ioc_read \n"); exit(); } if ( ioc_completed() ) { tty_printf("echec ioc_completed\n"); exit(); } buf_in_empty = FALSE; tty_printf(" *** Completing load for image %d *** at cycle %d \n", image, proctime()); image++; } // end while image exit(); } // end load()
static void keycode_run() { for (;;) { halt(); key_t key; bool avail; while ((avail = kb_getkey(&key)) != false) { if (key.ch) { tty_printf( TTY_CONSOLE, "Keycode: \033[%c]%02x\033[-] meta=%02x '%c'\n", key.brk == KEYBRK_UP ? 'e' : '2', key.code, key.meta, key.ch); } else { tty_printf( TTY_CONSOLE, "Keycode: \033[%c]%02x\033[-] meta=%02x\n", key.brk == KEYBRK_UP ? 'e' : '2', key.code, key.meta); } if ((key.brk == KEYBRK_UP) && (key.meta & META_ALT) && (key.code == KEY_TAB)) { switch_mode(&mode_command); return; } } } }
void transpose() { int l,p; int image = 0; tty_printf(" !!! Processor %d running !!!\n", procid()); while( image < NIMAGES ) { while( (buf_in_empty == TRUE) || (buf_out_empty == FALSE) ) {} // synchro tty_printf("\n *** Starting transpose for image %d *** at cycle %d \n", image, proctime()); for( l=0 ; l<NLINES ; l++) { for( p=0 ; p<NPIXELS ; p++) { buf_out[l][p] = buf_in[p][l]; } } buf_in_empty = TRUE; buf_out_empty = FALSE; tty_printf(" *** Completing transpose for image %d *** at cycle %d \n", image, proctime()); image++; } // end while image exit(); } // end transpose
__attribute__((constructor)) void timer() { char byte; tty_printf("enter a command: a(enable), d(disable), q(quit) \n"); tty_getc_irq(&byte); while (1) { switch(byte){ case 'a': timer_set_period(50000); timer_set_mode(0x3); break; case 'd': //timer_reset_irq(); timer_set_mode(0x0); break; case 'q' : exit(); break; default: tty_printf("bad command line, choose between a, q, or q! \n"); break; } tty_getc_irq(&byte); } } // end main
/* * show automatic map (latest steps) in the form s2ews14n */ void map_show(void) { char lastdir; int count = 0; int i; if (mapstart == mapend) { PRINTF("#map empty\n"); } else { PRINTF("#map: "); lastdir = mappath[mapstart]; for (i = mapstart; i != mapend; i = MAPINDEX(i + 1)) { if (mappath[i] != lastdir) { if (count > 1) tty_printf("%d", count); tty_putc(lastdir); count = 1; lastdir = mappath[i]; } else count++; } if (count > 1) tty_printf("%d", count); tty_printf("%c\n", lastdir); } }
int main(int argc, char *argv[]) { char rxChar; char txChar; printf("Acme Serial Test (press ctrl-c to exit)\n"); if (tty_open(argv[1])<0) { fprintf (stderr,"tty open error %s\n", strerror(errno)); exit(EXIT_FAILURE); } if (stdin_init()<0) { printf("stdin init error %s\n", strerror(errno)); exit(EXIT_FAILURE); } if (signal (SIGINT, termination_handler) == SIG_IGN) signal (SIGINT, SIG_IGN); if (signal (SIGHUP, termination_handler) == SIG_IGN) signal (SIGHUP, SIG_IGN); if (signal (SIGTERM, termination_handler) == SIG_IGN) signal (SIGTERM, SIG_IGN); while (1) { if (read (STDIN_FILENO, &txChar, 1)>0) { tty_printf("TX: 0x%02X",txChar); if (txChar>=32 && txChar<=126) tty_printf(" [%c]",txChar); tty_printf("\n"); } if (read(tty_fd,&rxChar,1)>0) { printf("RX = 0x%02X",rxChar); if (rxChar>=32 && rxChar<=126) printf(" [%c]",rxChar); printf("\n"); } } return EXIT_SUCCESS; }
/* * process suboptions. * so far, only terminal type is processed but future extensions are * window size, X display location, etc. */ static void dosubopt __P1 (byte *,str) { char buf[256], *term; int len, err; if (str[0] == TELOPT_TTYPE) { if (str[1] == 1) { /* 1 == SEND */ #ifdef TELOPTS tty_printf("[got SB TERMINAL TYPE SEND]\n"); #endif if (!(term = getenv("TERM"))) term = "unknown"; sprintf(buf, "%c%c%c%c%.*s%c%c", IAC, SB, TELOPT_TTYPE, 0, 256-7, term, IAC, SE); /* 0 == IS */ len = strlen(term) + 6; while ((err = write(tcp_fd, buf, len)) < 0 && errno == EINTR) ; if (err != len) { errmsg("write subopt to socket"); return; } #ifdef TELOPTS tty_printf("[sent SB TERMINAL TYPE IS %s]\n", term); #endif } } }
void transpose(int image) { int dx,dy,g; int l,p; // int image = 0; // while( image < NMAX ) { while( (buf_in_empty == TRUE) || (buf_out_empty == FALSE) ) {} // synchro tty_printf("\n *** Starting transpose for image %d *** at cycle %d \n", image, proctime()); for( l=0 ; l<NLINES ; l++) { for( p=0 ; p<NPIXELS ; p++) { /* if ( (l==NLINES-1) || (l==0) || (p==NPIXELS-1) || (p==0) ) { buf_out[l][p] = 0; } else { // derivee en x dx = (int)buf_in[l-1][p-1] + (int)buf_in[l][p-1]*2 + (int)buf_in[l+1][p-1] - (int)buf_in[l-1][p+1] - (int)buf_in[l][p+1]*2 - (int)buf_in[l+1][p+1]; dy = (int)buf_in[l-1][p-1] + (int)buf_in[l-1][p]*2 + (int)buf_in[l-1][p+1] - (int)buf_in[l+1][p-1] - (int)buf_in[l+1][p]*2 - (int)buf_in[l+1][p+1]; if ( dy < 0 ) dy = -dy; g = dx + dy; if ( g > 255 ) g = 255; buf_out[l][p] = g; } */ buf_out[l][p] = buf_out[p][l]; } // end for p } // end for l buf_in_empty = TRUE; buf_out_empty = FALSE; tty_printf(" *** Completing transpose for image %d *** at cycle %d \n", image, proctime()); // image++; } // end while image // exit(); } // end transpose
static cb_ret_t buttonbar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WButtonBar *bb = BUTTONBAR (w); int i; const char *text; switch (msg) { case MSG_FOCUS: return MSG_NOT_HANDLED; case MSG_HOTKEY: for (i = 0; i < BUTTONBAR_LABELS_NUM; i++) if (parm == KEY_F (i + 1) && buttonbar_call (bb, i)) return MSG_HANDLED; return MSG_NOT_HANDLED; case MSG_DRAW: if (bb->visible) { buttonbar_init_button_positions (bb); widget_move (w, 0, 0); tty_setcolor (DEFAULT_COLOR); tty_printf ("%-*s", w->cols, ""); widget_move (w, 0, 0); for (i = 0; i < BUTTONBAR_LABELS_NUM; i++) { int width; width = buttonbar_get_button_width (bb, i); if (width <= 0) break; tty_setcolor (BUTTONBAR_HOTKEY_COLOR); tty_printf ("%2d", i + 1); tty_setcolor (BUTTONBAR_BUTTON_COLOR); text = (bb->labels[i].text != NULL) ? bb->labels[i].text : ""; tty_print_string (str_fit_to_term (text, width - 2, J_LEFT_FIT)); } } return MSG_HANDLED; case MSG_DESTROY: for (i = 0; i < BUTTONBAR_LABELS_NUM; i++) g_free (bb->labels[i].text); return MSG_HANDLED; default: return widget_default_callback (w, sender, msg, parm, data); } }
__attribute__((constructor)) void pgcd() { unsigned int opx; unsigned int opy; tty_printf(" Interactive PGCD \n"); while (1) { tty_printf("\n*******************\n"); tty_printf("operand X = "); tty_getw_irq(&opx); tty_printf("\n"); tty_printf("operand Y = "); tty_getw_irq(&opy); tty_printf("\n"); if( (opx == 0) || (opy == 0) ) { tty_printf("operands must be larger than 0\n"); } else { while (opx != opy) { if(opx > opy) opx = opx - opy; else opy = opy - opx; } tty_printf("pgcd = %d\n", opx); } } } // end main
static void mcview_display_status (WView * view) { const screen_dimen top = view->status_area.top; const screen_dimen left = view->status_area.left; const screen_dimen width = view->status_area.width; const screen_dimen height = view->status_area.height; const char *file_label; if (height < 1) return; tty_setcolor (STATUSBAR_COLOR); tty_draw_hline (WIDGET (view)->y + top, WIDGET (view)->x + left, ' ', width); file_label = view->filename_vpath != NULL ? vfs_path_get_last_path_str (view->filename_vpath) : view->command != NULL ? view->command : ""; if (width > 40) { widget_move (view, top, width - 32); if (view->hex_mode) tty_printf ("0x%08" PRIxMAX, (uintmax_t) view->hex_cursor); else { char buffer[BUF_TRUNC_LEN + 1]; size_trunc_len (buffer, BUF_TRUNC_LEN, mcview_get_filesize (view), 0, panels_options.kilobyte_si); tty_printf ("%9" PRIuMAX "/%s%s %s", (uintmax_t) view->dpy_end, buffer, mcview_may_still_grow (view) ? "+" : " ", #ifdef HAVE_CHARSET mc_global.source_codepage >= 0 ? get_codepage_id (mc_global.source_codepage) : #endif ""); } } widget_move (view, top, left); if (width > 40) tty_print_string (str_fit_to_term (file_label, width - 34, J_LEFT_FIT)); else tty_print_string (str_fit_to_term (file_label, width - 5, J_LEFT_FIT)); if (width > 26) mcview_display_percent (view, view->hex_mode ? view->hex_cursor : view->dpy_end); }
void mcview_percent (mcview_t * view, off_t p) { const screen_dimen top = view->status_area.top; const screen_dimen right = view->status_area.left + view->status_area.width; const screen_dimen height = view->status_area.height; int percent; off_t filesize; if (height < 1 || right < 4) return; if (mcview_may_still_grow (view)) return; filesize = mcview_get_filesize (view); if (filesize == 0 || view->dpy_end == filesize) percent = 100; else if (p > (INT_MAX / 100)) percent = p / (filesize / 100); else percent = p * 100 / filesize; widget_move (view, top, right - 4); tty_printf ("%3d%%", percent); }
static void tree_frame (WDialog * h, WTree * tree) { Widget *w = WIDGET (tree); (void) h; tty_setcolor (NORMAL_COLOR); widget_erase (w); if (tree->is_panel) { const char *title = _("Directory tree"); const int len = str_term_width1 (title); tty_draw_box (w->y, w->x, w->lines, w->cols, FALSE); widget_move (w, 0, (w->cols - len - 2) / 2); tty_printf (" %s ", title); if (panels_options.show_mini_info) { int y; y = w->lines - 3; widget_move (w, y, 0); tty_print_alt_char (ACS_LTEE, FALSE); widget_move (w, y, w->cols - 1); tty_print_alt_char (ACS_RTEE, FALSE); tty_draw_hline (w->y + y, w->x + 1, ACS_HLINE, w->cols - 2); } } }
int sal_vprintf(const char *fmt, va_list varg) { int retv = 0; #ifndef SAL_THREAD_NAME_PRINT_DISABLE char thread_name[80]; sal_thread_t thread; thread = sal_thread_self(); thread_name[0] = 0; if (thread != sal_thread_main_get()) { sal_thread_name(thread, thread_name, sizeof (thread_name)); } #endif /* !SAL_THREAD_NAME_PRINT_DISABLE */ #ifndef SAL_THREAD_NAME_PRINT_DISABLE if (thread_name[0] != 0) { (void) tty_printf("[%s]", thread_name); } #endif /* !SAL_THREAD_NAME_PRINT_DISABLE */ #ifndef SAL_NO_TTY retv = tty_vprintf(fmt, varg); #endif return retv; }
static int gather_faked( void (*add)(const void*, size_t, int), int requester, size_t length, int level ) { static int initialized=0; size_t n; char *buffer, *p; if( !initialized ) { log_info(_("WARNING: using insecure random number generator!!\n")); tty_printf(_("The random number generator is only a kludge to let\n" "it run - it is in no way a strong RNG!\n\n" "DON'T USE ANY DATA GENERATED BY THIS PROGRAM!!\n\n")); initialized=1; #ifdef HAVE_RAND srand(make_timestamp()*getpid()); #else srandom(make_timestamp()*getpid()); #endif } p = buffer = m_alloc( length ); n = length; #ifdef HAVE_RAND while( n-- ) *p++ = ((unsigned)(1 + (int) (256.0*rand()/(RAND_MAX+1.0)))-1); #else while( n-- ) *p++ = ((unsigned)(1 + (int) (256.0*random()/(RAND_MAX+1.0)))-1); #endif add_randomness( buffer, length, requester ); m_free(buffer); return 0; /* okay */ }
void tty_kill_prompt() { if ( no_terminal ) return; if( !initialized ) init_ttyfp(); if( batchmode ) last_prompt_len = 0; if( !last_prompt_len ) return; #ifdef USE_W32_CONSOLE tty_printf("\r%*s\r", last_prompt_len, ""); #else { int i; putc('\r', ttyfp); for(i=0; i < last_prompt_len; i ++ ) putc(' ', ttyfp); putc('\r', ttyfp); fflush(ttyfp); } #endif last_prompt_len = 0; }
void tty_print_utf8_string2( const byte *p, size_t n, size_t max_n ) { size_t i; char *buf; if (no_terminal) return; /* we can handle plain ascii simpler, so check for it first */ for(i=0; i < n; i++ ) { if( p[i] & 0x80 ) break; } if( i < n ) { buf = utf8_to_native( (const char *)p, n, 0 ); if( max_n && (strlen( buf ) > max_n )) { buf[max_n] = 0; } /*(utf8 conversion already does the control character quoting)*/ tty_printf("%s", buf ); xfree( buf ); } else { if( max_n && (n > max_n) ) { n = max_n; } tty_print_string( p, n ); } }
static void view_status (WDiff *view, int ord, int width, int pos) { char buf[BUFSIZ]; int filename_width; off_t skip_offs = view->df[ord].offs; int moves = view->df[ord].move; tty_setcolor(SELECTED_COLOR); #if VERTICAL_SPLIT tty_gotoyx(0, pos); #else /* !VERTICAL_SPLIT */ tty_gotoyx(pos, 0); #endif /* !VERTICAL_SPLIT */ filename_width = width - 22; if (filename_width < 8) { filename_width = 8; } if (filename_width >= (int)sizeof(buf)) { /* abnormal, but avoid buffer overflow */ filename_width = sizeof(buf) - 1; } trim(strip_home_and_password(view->file[ord]), buf, filename_width); tty_printf("%-*s %s%-16lX ", filename_width, buf, moves ? "0x" : "--", skip_offs); }
static void chown_refresh (void) { common_dialog_repaint (ch_dlg); tty_setcolor (COLOR_NORMAL); dlg_move (ch_dlg, BY - 1, 8); tty_print_string (_("owner")); dlg_move (ch_dlg, BY - 1, 16); tty_print_string (_("group")); dlg_move (ch_dlg, BY - 1, 24); tty_print_string (_("other")); dlg_move (ch_dlg, BY - 1, 35); tty_print_string (_("owner")); dlg_move (ch_dlg, BY - 1, 53); tty_print_string (_("group")); dlg_move (ch_dlg, 3, 4); tty_print_string (_("On")); dlg_move (ch_dlg, BY + 1, 4); tty_print_string (_("Flag")); dlg_move (ch_dlg, BY + 2, 4); tty_print_string (_("Mode")); if (!single_set){ dlg_move (ch_dlg, 3, 54); tty_printf (_("%6d of %d"), files_on_begin - (current_panel->marked) + 1, files_on_begin); } print_flags (); }
static void mcview_display_status (mcview_t * view) { const screen_dimen top = view->status_area.top; const screen_dimen left = view->status_area.left; const screen_dimen width = view->status_area.width; const screen_dimen height = view->status_area.height; const char *file_label; screen_dimen file_label_width; if (height < 1) return; tty_setcolor (STATUSBAR_COLOR); widget_move (view, top, left); tty_draw_hline (-1, -1, ' ', width); file_label = view->filename ? view->filename : view->command ? view->command : ""; file_label_width = str_term_width1 (file_label) - 2; if (width > 40) { char buffer[BUF_TINY]; widget_move (view, top, width - 32); if (view->hex_mode) tty_printf ("0x%08" PRIxMAX, (uintmax_t) view->hex_cursor); else { size_trunc_len (buffer, 5, mcview_get_filesize (view), 0, panels_options.kilobyte_si); tty_printf ("%9" PRIuMAX "/%s%s %s", (uintmax_t) view->dpy_end, buffer, mcview_may_still_grow (view) ? "+" : " ", #ifdef HAVE_CHARSET mc_global.source_codepage >= 0 ? get_codepage_id (mc_global.source_codepage) : "" #else "" #endif ); } } widget_move (view, top, left); if (width > 40) tty_print_string (str_fit_to_term (file_label, width - 34, J_LEFT_FIT)); else tty_print_string (str_fit_to_term (file_label, width - 5, J_LEFT_FIT)); if (width > 26) mcview_percent (view, view->hex_mode ? view->hex_cursor : view->dpy_end); }
static void update_mode (Dlg_head * h) { print_flags (); tty_setcolor (COLOR_NORMAL); dlg_move (h, BY + 2, 9); tty_printf ("%12o", get_mode ()); send_message (h->current, WIDGET_FOCUS, 0); }
static void show_sha1_fpr (const unsigned char *fpr) { int i; if (fpr) { for (i=0; i < 20 ; i+=2, fpr += 2 ) { if (i == 10 ) tty_printf (" "); tty_printf (" %02X%02X", *fpr, fpr[1]); } } else tty_printf (" [none]"); tty_printf ("\n"); }
/**************** * wrapper around do_we_trust, so we can ask whether to use the * key anyway. */ static int do_we_trust_pre( PKT_public_key *pk, unsigned int trustlevel ) { int rc; rc = do_we_trust( pk, trustlevel ); if( !opt.batch && !rc ) { print_pubkey_info(NULL,pk); print_fingerprint (pk, 2); tty_printf("\n"); tty_printf( _("It is NOT certain that the key belongs to the person named\n" "in the user ID. If you *really* know what you are doing,\n" "you may answer the next question with yes.\n")); tty_printf("\n"); if (is_status_enabled ()) { u32 kid[2]; char *hint_str; keyid_from_pk (pk, kid); hint_str = get_long_user_id_string ( kid ); write_status_text ( STATUS_USERID_HINT, hint_str ); xfree (hint_str); } if( cpr_get_answer_is_yes("untrusted_key.override", _("Use this key anyway? (y/N) ")) ) rc = 1; /* Hmmm: Should we set a flag to tell the user about * his decision the next time he encrypts for this recipient? */ } return rc; }
void display_online_help( const char *keyword ) { tty_kill_prompt(); if( !keyword ) tty_printf(_("No help available") ); else { const char *p; int i; for(i=0; (p=helptexts[i].key) && strcmp( p, keyword ); i++ ) ; if( !p || !*helptexts[i].help ) tty_printf(_("No help available for `%s'"), keyword ); else tty_printf("%s", _(helptexts[i].help) ); } tty_printf("\n"); }