Beispiel #1
0
main ()
{
	printf (MSG ("\nFORMAT 4K %s    %s\n", "\nРАЗМЕТКА 4K %s    %s\n"),
		BOOTVERSION, MSG (LCOPYRIGHT, RCOPYRIGHT));
	printf (MSG ("\nUsing this program you may OVERWRITE information on your hard disks.\n",
		"\nПри работе с этой программой Вы можете ЗАТЕРЕТЬ информацию на дисках.\n"));
	printf (MSG ("\nIt is strongly recommended to TURN unnecessary disks 'READ-ONLY'.\n",
		"\nНастоятельно рекомендуется ЗАКРЫТЬ ненужные дискм на ЗАПИСЬ.\n"));
	printf (MSG ("Do you want to continue",
		"Продолжать"));
	if (yes () != 1)
		return;
	unit = getunit ();
	nbad = 0;
	printf (MSG ("\nFormat unit %d", "\nФорматировать устройство %d"),
		unit);
	if (yes () != 1)
		return;
	/* инициализация переменных и массивов разметки */
	init (unit);

	printf (MSG ("\nINITIAL FORMATTING\n", "\nПЕРВИЧНАЯ РАЗМЕТКА\n"));
	if (! format1 ())
		return;

	if (nbad) {
		printf (MSG ("\nBAD TRACKS REMAPPING\n", "\nДЕФЕКТАЦИЯ\n"));
		if (! format2 ())
			return;
	}
	printf (MSG ("\nFormat completed.\n", "\nФорматирование закончено.\n"));
}
Beispiel #2
0
void solve(int n,int K){
    if(n<=2){
        yes();
        return;
    }
    int mf[12];
    for(int i=0;i<12;i++){
        mf[i]=0;
    }
    for(int i=0;i<n;i++){
        mf[x[i]%(K+1)]++;
    }
    int c=0;
    int f[12];
    for(int i=0;i<12;i++){
        if(mf[i]>0){
            f[c++]=i;
        }
    }
    if(c==1){
        yes();
        return;
    }
    if(c==2){
        
        if(mf[f[0]]==1||mf[f[1]]==1){
            yes();
            return;
        }
    }
    no();
}
Beispiel #3
0
void
die(int entry)			/* label 90 */
{
	int     i;

	if (entry != 99) {
		rspeak(23);
		oldlc2 = loc;
	}
	if (closng) {		/* 99 */
		rspeak(131);
		numdie++;
		done(2);
	}
	yea = yes(81 + numdie * 2, 82 + numdie * 2, 54);
	numdie++;
	if (numdie == maxdie || !yea)
		done(2);
	place[water] = 0;
	place[oil] = 0;
	if (toting(lamp))
		prop[lamp] = 0;
	for (i = 100; i >= 1; i--) {
		if (!toting(i))
			continue;
		k = oldlc2;
		if (i == lamp)
			k = 1;
		drop(i, k);
	}
	loc = 3;
	oldloc = loc;
}
Beispiel #4
0
TEST(plankton, env_construction) {
  CREATE_RUNTIME();

  // Environment references resolve correctly to ast factories.
  {
    byte_buffer_t buf;
    byte_buffer_init(&buf);
    write_ast_factory(&buf, "Literal");
    value_t value = deserialize(runtime, &buf);
    ASSERT_FAMILY(ofFactory, value);
    byte_buffer_dispose(&buf);
  }

  // Objects with ast factory headers produce asts.
  {
    byte_buffer_t buf;
    byte_buffer_init(&buf);
    byte_buffer_append(&buf, pObject);
    write_ast_factory(&buf, "Literal");
    byte_buffer_append(&buf, pMap);
    plankton_wire_encode_uint32(&buf, 1);
    write_string(&buf, "value");
    byte_buffer_append(&buf, pTrue);
    value_t value = deserialize(runtime, &buf);
    ASSERT_FAMILY(ofLiteralAst, value);
    ASSERT_VALEQ(yes(), get_literal_ast_value(value));
    byte_buffer_dispose(&buf);
  }

  DISPOSE_RUNTIME();
}
void QQuickDialog::click(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role)
{
    setVisible(false);
    m_clickedButton = static_cast<StandardButton>(button);
    emit buttonClicked();
    switch (role) {
    case QPlatformDialogHelper::AcceptRole:
        emit accept();
        break;
    case QPlatformDialogHelper::RejectRole:
        emit reject();
        break;
    case QPlatformDialogHelper::DestructiveRole:
        emit discard();
        break;
    case QPlatformDialogHelper::HelpRole:
        emit help();
        break;
    case QPlatformDialogHelper::YesRole:
        emit yes();
        break;
    case QPlatformDialogHelper::NoRole:
        emit no();
        break;
    case QPlatformDialogHelper::ApplyRole:
        emit apply();
        break;
    case QPlatformDialogHelper::ResetRole:
        emit reset();
        break;
    default:
        qWarning("unhandled Dialog button %d with role %d", (int)button, (int)role);
    }
}
Beispiel #6
0
static int
metadata_filter(struct archive *a, void *_data, struct archive_entry *entry)
{
	struct bsdtar *bsdtar = (struct bsdtar *)_data;

	/* XXX TODO: check whether this filesystem is
	 * synthetic and/or local.  Add a new
	 * --local-only option to skip non-local
	 * filesystems.  Skip synthetic filesystems
	 * regardless.
	 *
	 * The results should be cached, since
	 * tree.c doesn't usually visit a directory
	 * and the directory contents together.  A simple
	 * move-to-front list should perform quite well.
	 *
	 * Use archive_read_disk_current_filesystem_is_remote().
	 */

	/*
	 * If the user vetoes this file/directory, skip it.
	 * We want this to be fairly late; if some other
	 * check would veto this file, we shouldn't bother
	 * the user with it.
	 */
	if (bsdtar->option_interactive &&
	    !yes("add '%s'", archive_entry_pathname(entry)))
		return (0);

	/* Note: if user vetoes, we won't descend. */
	if (!bsdtar->option_no_subdirs && archive_read_disk_can_descend(a))
		archive_read_disk_descend(a);

	return (1);
}
Beispiel #7
0
TEST(syntax, emitting) {
  CREATE_RUNTIME();

  value_t ast = new_heap_literal_ast(runtime, yes());
  assembler_t assm;
  ASSERT_SUCCESS(assembler_init(&assm, runtime, nothing(), scope_get_bottom()));
  ASSERT_SUCCESS(emit_value(ast, &assm));
  assembler_emit_return(&assm);
  value_t code = assembler_flush(&assm);
  ASSERT_SUCCESS(code);
  value_t result = run_code_block_until_condition(ambience, code);
  ASSERT_VALEQ(yes(), result);
  assembler_dispose(&assm);

  DISPOSE_RUNTIME();
}
/*
  QUIT intransitive only. Verify intent and exit if that's what he wants
*/
void ivquit()
{
    gaveup = yes(22, 54, 54);
    if (gaveup)
	normend();
    return;
}
Beispiel #9
0
/*
	READ etc.
*/
vread()
{
	int msg;

	msg = 0;
	if (dark()) {
		printf("I see no %s here.\n",probj(object));
		return;
	}
	switch(object) {
	case MAGAZINE:
		msg = 190;
		break;
	case TABLET:
		msg = 196;
		break;
	case MESSAGE:
		msg = 191;
		break;
	case OYSTER:
		if (!toting(OYSTER) || !closed)
			break;
		yes(192,193,54);
		return;
	default:
		;
	}
	if (msg)
		rspeak(msg);
	else
		actspk(verb);
}
Beispiel #10
0
int main()
{
try{
	cout << "Are you thinking of an animal? (Yes or No) ";
	bool question1 = yes();
	cout << "Are you thinking of an actor? (Yes or No) ";
	bool question2 = yes();
	cout << "Are you thinking of something that likes the water? (Yes or No) ";
	bool question3 = yes();
	
	if(question1 && !question2 && !question3){
		cout << endl << "You must be thinking of a dog.";}
		
	else if(question1 && question2 && !question3){
		cout << endl << "You must be thinking of Clifford the Big Red Dog.";}
		
	else if(question1 && question2 && question3){
	cout << endl << "You must be thinking of Shamu.";}
	
	else if(!question1 && question2 && question3){
		cout << endl << "You must be thinking of David Hasslehoff.";}	

	else if(!question1 && question2 && !question3){
		cout << endl << "You must be thinking of Tom Cruise in Top Gun.";}

	else if(!question1 && !question2 && question3){
		cout << endl << "You must be thinking of a carrot.";}
		
	else if(question1 && !question2 && question3){
		cout << endl << "You must be thinking of a fish.";}	
		
	else if(!question1 && !question2 && !question3){
		cout << endl << "You must be thinking of fresh, new pair of Jordans.";}		
		
	cout << endl;	
	return 0;
	}		
catch(exception&e){
	cerr << "error: " << e.what() << endl;
	keep_window_open();
	return 1;}
	
catch(...){
	cerr << "unknown exception" << endl;
	keep_window_open();
	return 2;}	
}
Beispiel #11
0
void RecordConfirmationDialog::yesClicked()
{
	emit yes();
	if (remember->isChecked())
	{
		settings.setAutoRecord(skypeName, AUTO_RECORD_ON);
	}
	accept();
}
Beispiel #12
0
YesNoMessage::YesNoMessage(const QString& action, QWidget *parent) :
    AskMessage("YesNoMessage", parent),
    ui(new Ui::YesNoMessage)
{
    ui->setupUi(this);
    ui->label->setText("<center>" + tr("Do you really want to ") + action + "</center>");
    connect(ui->yes, SIGNAL(clicked()), SLOT(yes()));
    connect(ui->no, SIGNAL(clicked()), SLOT(no()));
}
Beispiel #13
0
    void matchBoolean() const {
        givenACodeSampleToTokenize yes("YES", true);
        ASSERT_EQUALS(false, Token::Match(yes.tokens(), "%bool%"));

        givenACodeSampleToTokenize positive("true", true);
        ASSERT_EQUALS(true, Token::Match(positive.tokens(), "%bool%"));

        givenACodeSampleToTokenize negative("false", true);
        ASSERT_EQUALS(true, Token::Match(negative.tokens(), "%bool%"));
    }
Beispiel #14
0
SaveChangesDialog::SaveChangesDialog(const QStringList& files, QWidget *parent)
	: QDialog(parent)
{
	ui.setupUi(this);
	ui.fileList->addItems(files);

	connect(ui.yes, SIGNAL(clicked()), this, SLOT(yes()));
	connect(ui.no, SIGNAL(clicked()), this, SLOT(no()));
	connect(ui.cancel, SIGNAL(clicked()), this, SLOT(cancel()));
}
Beispiel #15
0
QSet<QString> standardNames()
{
    static QSet<QString> names;
    if (names.isEmpty()) {
        QStringList strings = QStringList() << ok().text << cancel().text << yes().text << no().text << discard().text << save().text << apply().text
                                            << close().text << help().text << overwrite().text << reset().text << cont().text << del().text
                                            << stop().text << remove().text << back().text << forward().text;

        foreach (QString s, strings) {
            names.insert(s.remove("&"));
        }
Beispiel #16
0
int main(int argc, char *argv[]) {
    RmStat stat_buf;
    bool has_gid, has_uid;
    RmUserGroupNode **list = rm_userlist_new();
    if(argc < 2) {
        puts("Usage: prog <path>");
        return EXIT_FAILURE;
    }
    if(rm_sys_stat(argv[1], &stat_buf) != 0) {
        return EXIT_FAILURE;
    }
    printf("File has UID %"LLU" and GID %"LLU"\n",
           (unsigned long)stat_buf.st_uid,
           (unsigned long)stat_buf.st_gid
          );
    rm_userlist_contains(list, stat_buf.st_uid, stat_buf.st_gid, &has_uid, &has_gid);
    printf("=> Valid UID = %s\n", yes(has_uid));
    printf("=> Valid GID = %s\n", yes(has_gid));
    rm_userlist_destroy(list);
    return EXIT_SUCCESS;
}
Beispiel #17
0
void
startup(void)
{
	demo = Start();
	srandomdev();
	hinted[3] = yes(65, 1, 0);
	newloc = 1;
	delhit = 0;
	limit = 330;
	if (hinted[3])
		limit = 1000;	/* better batteries if instrucs */
}
Beispiel #18
0
startup()
{
	time_t time();

	demo=Start(0);
	srand((int)(time((time_t *)NULL)));	/* random seed */
	/* srand(371);				/* non-random seed */
	hinted[3]=yes(65,1,0);
	newloc=1;
	delhit = 0;
	limit=330;
	if (hinted[3]) 
		limit=1000;      /* better batteries if instrucs */
}
Beispiel #19
0
static value_t heap_object_identity_compare(value_t a, value_t b,
    cycle_detector_t *detector) {
  CHECK_DOMAIN(vdHeapObject, a);
  CHECK_DOMAIN(vdHeapObject, b);
  // Fast case when a and b are the same object.
  if (is_same_value(a, b))
    return yes();
  heap_object_family_t a_family = get_heap_object_family(a);
  heap_object_family_t b_family = get_heap_object_family(b);
  if (a_family != b_family)
    return no();
  family_behavior_t *behavior = get_heap_object_family_behavior(a);
  return (behavior->identity_compare)(a, b, detector);
}
Beispiel #20
0
static void
excluded_callback(struct archive *a, void *_data, struct archive_entry *entry)
{
	struct bsdtar *bsdtar = (struct bsdtar *)_data;

	if (bsdtar->option_no_subdirs)
		return;
	if (!archive_read_disk_can_descend(a))
		return;
	if (bsdtar->option_interactive &&
	    !yes("add '%s'", archive_entry_pathname(entry)))
		return;
	archive_read_disk_descend(a);
}
Beispiel #21
0
void setting::save(){
	FILE *f;
	fopen_s(&f, "..\\file\\config.ini", "w");
	double d;
	int i;
	QString n("\n");
	QString yes("T");
	QString no("F");
	QString Q("Quality=");
	QString R("Raft=");
	QString S("Support=");
	QString L("LayerHeight=");
	QString I("Infill=");
	QString N("NumofShells=");
	QString T("Temperature=");
	QString M("ModelHeight=");

	i = ui.Quality->currentIndex()+1;
	QString s = QString::number(i, 10);
	Q = Q + s + n;
	
	if (ui.Raft->isChecked())R = R + yes + n;
	else R = R + no + n;

	if (ui.Support->isChecked())S = S + yes + n;
	else S = S + no + n;

	d = ui.LayerHeight->value();
	L = L + QString::number(d,'g',3) + n;

	i = ui.Infill->value();
	I = I + QString::number(i,10) + n;

	i = ui.NumofShells->value();
	N = N + QString::number(i, 10) + n;

	i = ui.Temperature->value();
	T = T + QString::number(i, 10) + n;

	i = ui.ModelHeight->value();
	M = M + QString::number(i, 10) + n;


	QString result = Q + R + S + L + I + N + T + M;
	fwrite(Qs2c(result), result.length(), 1, f);
	fclose(f);
	this->close();

}
Beispiel #22
0
static int
append_archive(struct bsdtar *bsdtar, struct archive *a, struct archive *ina)
{
	struct archive_entry *in_entry;
	int e;

	while (0 == archive_read_next_header(ina, &in_entry)) {
		if (!new_enough(bsdtar, archive_entry_pathname(in_entry),
			archive_entry_stat(in_entry)))
			continue;
		if (excluded(bsdtar, archive_entry_pathname(in_entry)))
			continue;
		if (bsdtar->option_interactive &&
		    !yes("copy '%s'", archive_entry_pathname(in_entry)))
			continue;
		if (bsdtar->verbose)
			safe_fprintf(stderr, "a %s",
			    archive_entry_pathname(in_entry));
		siginfo_setinfo(bsdtar, "copying",
		    archive_entry_pathname(in_entry),
		    archive_entry_size(in_entry));
		siginfo_printinfo(bsdtar, 0);

		e = archive_write_header(a, in_entry);
		if (e != ARCHIVE_OK) {
			if (!bsdtar->verbose)
				bsdtar_warnc(bsdtar, 0, "%s: %s",
				    archive_entry_pathname(in_entry),
				    archive_error_string(a));
			else
				fprintf(stderr, ": %s", archive_error_string(a));
		}
		if (e == ARCHIVE_FATAL)
			exit(1);

		if (e >= ARCHIVE_WARN) {
			if (archive_entry_size(in_entry) == 0)
				archive_read_data_skip(ina);
			else if (copy_file_data(bsdtar, a, ina))
				exit(1);
		}

		if (bsdtar->verbose)
			fprintf(stderr, "\n");
	}

	/* Note: If we got here, we saw no write errors, so return success. */
	return (0);
}
void
startup(void)
{
	demo = Start();
	srand((int)time(NULL));	/* random seed */
#if 0
	srand(371);		/* non-random seed */
#endif
	hinted[3] = yes(65, 1, 0);
	newloc = 1;
	delhit = 0;
	limit = 330;
	if (hinted[3])
		limit = 1000;	/* better batteries if instrucs */
}
Beispiel #24
0
TEST(plankton, simple) {
  CREATE_RUNTIME();

  // Integers
  check_plankton(runtime, new_integer(0));
  check_plankton(runtime, new_integer(1));
  check_plankton(runtime, new_integer(-1));
  check_plankton(runtime, new_integer(65536));
  check_plankton(runtime, new_integer(-65536));

  // Singletons
  check_plankton(runtime, null());
  check_plankton(runtime, yes());
  check_plankton(runtime, no());

  DISPOSE_RUNTIME();
}
Beispiel #25
0
static int
append_archive(struct bsdtar *bsdtar, struct archive *a, struct archive *ina)
{
    struct archive_entry *in_entry;
    int e;

    while (ARCHIVE_OK == (e = archive_read_next_header(ina, &in_entry))) {
        if (archive_match_excluded(bsdtar->matching, in_entry))
            continue;
        if (bsdtar->option_interactive &&
                !yes("copy '%s'", archive_entry_pathname(in_entry)))
            continue;
        if (bsdtar->verbose > 1) {
            safe_fprintf(stderr, "a ");
            list_item_verbose(bsdtar, stderr, in_entry);
        } else if (bsdtar->verbose > 0)
            safe_fprintf(stderr, "a %s",
                         archive_entry_pathname(in_entry));
        if (need_report())
            report_write(bsdtar, a, in_entry, 0);

        e = archive_write_header(a, in_entry);
        if (e != ARCHIVE_OK) {
            if (!bsdtar->verbose)
                lafe_warnc(0, "%s: %s",
                           archive_entry_pathname(in_entry),
                           archive_error_string(a));
            else
                fprintf(stderr, ": %s", archive_error_string(a));
        }
        if (e == ARCHIVE_FATAL)
            exit(1);

        if (e >= ARCHIVE_WARN) {
            if (archive_entry_size(in_entry) == 0)
                archive_read_data_skip(ina);
            else if (copy_file_data_block(bsdtar, a, ina, in_entry))
                exit(1);
        }

        if (bsdtar->verbose)
            fprintf(stderr, "\n");
    }

    return (e == ARCHIVE_EOF ? ARCHIVE_OK : e);
}
Beispiel #26
0
static int
askAboutRelink(int32_t clusterNum)
{
	/*
	 * Display the size of the chain for the user to consider.
	 */
	printOrphanInfo(clusterNum);
	/*
	 *  If we are in preen mode, preenBail won't return.
	 */
	preenBail("Need user confirmation to re-link orphaned chain.\n");

	(void) printf(gettext("Re-link orphaned chain into file system ? "
	    "(y/n) "));

	return (yes());
}
Beispiel #27
0
static int
askAboutFreeing(int32_t clusterNum)
{
	/*
	 * If it is not OkayToRelink, we haven't already printed the size
	 * of the orphaned chain.
	 */
	if (!OkayToRelink)
		printOrphanInfo(clusterNum);
	/*
	 *  If we are in preen mode, preenBail won't return.
	 */
	preenBail("Need user confirmation to free orphaned chain.\n");

	(void) printf(
	    gettext("Free the allocation units in the orphaned chain ? "
	    "(y/n) "));
	return (yes());
}
Beispiel #28
0
void pass2(void)
{
    blkno_t j;
    blkno_t oldtfree;
    int s;
    int yes();

    printf("Rebuild free list? ");
    if (!yes())
        return;

    oldtfree = swizzle16(superblock.s_tfree);

    /* Initialize the superblock-block */

    superblock.s_ninode = 0;
    superblock.s_nfree = swizzle16(1);
    superblock.s_free[0] = 0;
    superblock.s_tfree = 0;

    /* Free each block, building the free list */

    for (j = swizzle16(superblock.s_fsize) - 1; j >= swizzle16(superblock.s_isize); --j) {
        if (bitmap[j] == 0) {
            if (swizzle16(superblock.s_nfree) == 50) {
                dwrite(j, (char *) &superblock.s_nfree);
                superblock.s_nfree = 0;
            }
            superblock.s_tfree = swizzle16(swizzle16(superblock.s_tfree)+1);
            s = swizzle16(superblock.s_nfree);
            superblock.s_free[s++] = swizzle16(j);
            superblock.s_nfree = swizzle16(s);
        }
    }

    dwrite((blkno_t) 1, (char *) &superblock);

    if (oldtfree != swizzle16(superblock.s_tfree))
        printf("During free list regeneration s_tfree was changed to %d from %d.\n",
                swizzle16(superblock.s_tfree), oldtfree);

}
Beispiel #29
0
int main(int argc, char *argv[]) {
  int rflag; /* user restore request option	*/

  rflag = 0;
  dbugflg = 0;
  while (--argc > 0) {
    ++argv;
    if (**argv != '-') break;
    switch (tolower(argv[0][1])) {
      case 'r':
        ++rflag;
        continue;
      case 'd':
        ++dbugflg;
        continue;
      default:
        printf("unknown flag: %c\n", argv[0][1]);
        continue;
    }                           /* switch	*/
  }                             /* while	*/
  if (dbugflg < 2) dbugflg = 0; /* must request three times	*/
  opentxt();
  initplay();
  if (rflag)
    restore();
  else if (yes(65, 1, 0))
    limit = 1000;
  else
    limit = 330;
  saveflg = 0;
  srand(511); /* seed random	*/
  while (!saveflg) turn();
  if (saveflg) saveadv();
#ifndef EMBED
  fclose(fd1);
  fclose(fd2);
  fclose(fd3);
  fclose(fd4);
#endif
  return (0); /* exit = ok	*/
}
Beispiel #30
0
/*
  Routine to handle the passing on of one
  of the player's incarnations...
*/
void death()
{
    int yea, j;

    if (!g.closing) {
        if (g.limit < 0) {
            rspeak(185);
            normend();
            return;
        }
        yea = yes(81 + g.numdie * 2, 82 + g.numdie * 2, 54);
        if (++g.numdie >= MAXDIE || !yea)
            normend();
        if (g.chase) {
            g.chase = FALSE;
            g.prop[WUMPUS] = 0;
            move(WUMPUS, 174);
        }
        if (toting(LAMP))
            g.prop[LAMP] = 0;
        for (j = 1; j < MAXOBJ; ++j) {
            if (toting(j))
                drop(j, j == LAMP ? 1 : g.oldloc2);
            if (wearng(j)) {
                g.prop[j] = 0;
                bitoff(j, WEARBT);
            }
        }
        g.newloc = 3;
        g.oldloc = g.loc;
        g.health = 100;
        return;
    }
    /* Closing -- no resurrection... */
    rspeak(131);
    ++g.numdie;
    normend();
    return;
}