/* **************************************************************** * Imprime DUMP da memória * **************************************************************** */ void mem_dump (void) { char area[32]; int i; for (EVER) { printf ("\nDê o endereço inicial: "); gets (area); if (area[0] == 'n') /* EOF */ return; i = strtol (area, (const char **)NULL, 0); if (i == -1) /* EOF */ return; for (EVER) { dump_hex ((char *)i, BLSZ, i); printf ("Continua? (s): "); if (askyesno (1) <= 0) break; i += BLSZ; } } } /* end mem_dump */
SEXP winDialog(SEXP call, SEXP op, SEXP args, SEXP env) { SEXP message; const char * type; int res=YES; args = CDR(args); type = translateChar(STRING_ELT(CAR(args), 0)); message = CADR(args); if(!isString(message) || length(message) != 1 || strlen(translateChar(STRING_ELT(message, 0))) > 255) error(_("invalid '%s' argument"), "message"); if (strcmp(type, "ok") == 0) { askok(translateChar(STRING_ELT(message, 0))); res = 10; } else if (strcmp(type, "okcancel") == 0) { res = askokcancel(translateChar(STRING_ELT(message, 0))); if(res == YES) res = 2; } else if (strcmp(type, "yesno") == 0) { res = askyesno(translateChar(STRING_ELT(message, 0))); } else if (strcmp(type, "yesnocancel") == 0) { res = askyesnocancel(translateChar(STRING_ELT(message, 0))); } else errorcall(call, _("unknown type")); return ScalarInteger(res); }
static void menurm(control m) { if (!ConsoleAcceptCmd) return; if (askyesno(G_("Are you sure?")) == YES) consolecmd(RConsole, "rm(list=ls(all=TRUE))"); else show(RConsole); }
/* **************************************************************** * Remove um arquivo * **************************************************************** */ void simple_rm (const char *path) { DOSSTAT z; /* * Obtém o estado do arquivo */ if (dos_stat (path, &z) < 0) { printf ( "%s: Não consegui obter o estado de \"%s\" (%s)\n", cmd_nm, path, strerror (errno) ); return; } #undef DEBUG #ifdef DEBUG printf ( "simple_rm: entries = %d, clusno = %d\n", z.z_lfn_entries, z.z_lfn_clusno ); printf ( "simple_rm: blkno = %d, end_blkno = %d, offset = %d\n", z.z_lfn_blkno, z.z_lfn_end_blkno, z.z_lfn_offset ); #endif DEBUG /* * Se necessário, pede confirmação do usuario */ if (cmd_iflag) { fprintf ( stderr, "(%c, %d) %s? (n): ", file_type_edit (z.z_mode), GET_LONG (z.z_size), path ); if (askyesno () <= 0) return; } elif (cmd_vflag) { printf ("%s:\n", path); } /* * Verifica se é um arquivo regular */ if (Z_ISDIR (z.z_mode)) { printf ( "%s: O arquivo \"%s\" é um diretório\n", cmd_nm, path ); return; } /* * Verifica se tem o bit "r" ligado */ if (z.z_mode & Z_RO) { fprintf ( stderr, "%s: O arquivo \"%s\" só permite leituras - " "remove? (n): ", cmd_nm, path ); if (askyesno () <= 0) return; } /* * Remove o arquivo */ if (dos_unlink (&z, 1 /* trunca */) < 0) return; /* * Verifica se alterou o nome do volume principal */ if (Z_ISVOL (z.z_mode)) { vol_nm[0] = '\0'; dir_walk (vol_search, uni.u_root_cluster); } } /* end simple_rm */