void print_banner(void) { clearit(); #ifndef SMALL int n; if (bootconf.banner[0]) { for (n = 0; bootconf.banner[n] && n < MAXBANNER; n++) printf("%s\n", bootconf.banner[n]); } else { #endif /* !SMALL */ #ifndef __minix printf("\n" ">> %s, Revision %s (from NetBSD %s)\n" ">> Memory: %d/%d k\n", bootprog_name, bootprog_rev, bootprog_kernrev, getbasemem(), getextmem()); #else printf("\n" "--- Welcome to MINIX 3. This is the boot monitor. ---\n" "Memory: %d/%d k\n", getbasemem(), getextmem()); #endif #ifndef SMALL } #endif /* !SMALL */ }
static void print_banner(void) { int base = getbasemem(); int ext = getextmem(); clearit(); printf("\n" ">> NetBSD/x86 PXE boot, Revision %s (from NetBSD %s)\n" ">> Memory: %d/%d k\n", bootprog_rev, bootprog_kernrev, base, ext); }
void exit_alias(void) { int i; /* Clear the deletes from all aliases. */ for(i = 0; i < num_aliases; i++) if (ison(aliases[i]->status, DELETED)) clearit(aliases[i]->status, DELETED); dprint(6, (debugfile, "\nexit_alias: Done clearing deletes.\n")); }
void print_banner(void) { clearit(); #ifndef SMALL int n; if (bootcfg_info.banner[0]) { for (n = 0; bootcfg_info.banner[n] && n < BOOTCFG_MAXBANNER; n++) printf("%s\n", bootcfg_info.banner[n]); } else { #endif /* !SMALL */ printf("\n" ">> %s, Revision %s (from NetBSD %s)\n" ">> Memory: %d/%d k\n", bootprog_name, bootprog_rev, bootprog_kernrev, getbasemem(), getextmem()); #ifndef SMALL } #endif /* !SMALL */ }
int ited() { for(;;) { clear(); refresh(); wprintw(stdscr, "To add an item press 1.\nTo view an item press 4.\nTo save the enemy file press 7.\nTo save the enemy file under a different name press 8.\nTo edit classes press 9\nTo delete an item press 0.\n"); input [0] = bie(); if(input[0] == '1') addit(); if(input[0] == '4') viewit(); if(input[0] == '7') saveen(filename); if(input[0] == '8') { stufffilename(); saveen(filename); } if(input[0] == '9') break; if(input[0] == '.') plusone(5); if(input[0] == ',') minusone(5); if(input[0] == '/') checkone(5); if(input[0] == '0') clearit(); wprintw(stdscr, "Press any key to continue.\n"); bie(); } if(input[0] == '9') charted(); return 0; }
/*--------------------------------------------------------------*/ int main(int argc, char *argv[]) { char *p, *q; setup(); /* temp file is now open */ /*--------------------------------------------------------------*/ blenter(); clearit(); p = &buf[100]; fill(p); q = &buf[800]; memcpy(q, p, LEN); if (checkit(q)) { fprintf(temp, "\tcopy failed - missed data\n"); local_flag = FAILED; } if (p[-1] || p[LEN]) { fprintf(temp, "\tcopy failed - 'to' bounds\n"); local_flag = FAILED; } if (q[-1] || q[LEN]) { fprintf(temp, "\tcopy failed - 'from' bounds\n"); local_flag = FAILED; } blexit(); /*--------------------------------------------------------------*/ blenter(); clearit(); p = &buf[800]; fill(p); q = &buf[100]; memcpy(q, p, LEN); if (checkit(q)) { fprintf(temp, "\tcopy failed - missed data\n"); local_flag = FAILED; } if (p[-1] || p[LEN]) { fprintf(temp, "\tcopy failed - 'to' bounds\n"); local_flag = FAILED; } if (q[-1] || q[LEN]) { fprintf(temp, "\tcopy failed - 'from' bounds\n"); local_flag = FAILED; } blexit(); /*--------------------------------------------------------------*/ blenter(); clearit(); p = &buf[800]; fill(p); q = &buf[850]; memcpy(q, p, LEN); if (checkit(q)) { fprintf(temp, "\tcopy failed - missed data\n"); local_flag = FAILED; } if (p[-1]) { fprintf(temp, "\tcopy failed - 'to' bounds\n"); local_flag = FAILED; } if (q[LEN]) { fprintf(temp, "\tcopy failed - 'from' bounds\n"); local_flag = FAILED; } blexit(); /*--------------------------------------------------------------*/ blenter(); clearit(); p = &buf[850]; fill(p); q = &buf[800]; memcpy(q, p, LEN); if (checkit(q)) { fprintf(temp, "\tcopy failed - missed data\n"); local_flag = FAILED; } if (p[LEN]) { fprintf(temp, "\tcopy failed - 'to' bounds\n"); local_flag = FAILED; } if (q[-1]) { fprintf(temp, "\tcopy failed - 'from' bounds\n"); local_flag = FAILED; } blexit(); /*--------------------------------------------------------------*/ /* Clean up any files created by test before call to anyfail. */ anyfail(); /* THIS CALL DOES NOT RETURN - EXITS!! */ tst_exit(); }
static int add_alias(int replace, int to_replace) { /* * Add an alias to the user alias text file. If there * are aliases tagged, the user is asked if he wants to * create a group alias from the tagged files. * * Return zero if alias not added in actuality. * * If replace == FALSE, then we will ask for the new * aliasname. * * If replace == TRUE, then we are replacing the alias * denoted by to_replace. * * Note that even if replace == FALSE, if the user types * in the name of a current alias then we can still do * a replacement. */ int i, ans; int tagged = 0; int leftoff = 0; char aliasname[SLEN], firstname[SLEN], lastname[SLEN]; char address1[LONG_STRING], buffer[SLEN]; char comment[LONG_STRING]; char *ch_ptr; /* * See if there are any tagged aliases. */ for (i=0; i < num_aliases; i++) { if (ison(aliases[i]->status, TAGGED)) { if (tagged == 0) leftoff = i; tagged++; } } if (tagged == 1) { /* * There is only on alias tagged. Ask the question * but the default response is NO. */ PutLine(LINES-2,0, catgets(elm_msg_cat, AliasesSet, AliasesOneTagged, "There is 1 alias tagged...")); CleartoEOLN(); ans = enter_yn(catgets(elm_msg_cat, AliasesSet, AliasesCreateGroup, "Create group alias?"), FALSE, LINES-3, FALSE); } else if (tagged > 1) { /* * If multiple tagged aliases then we assume the user * wants to create a group alias. The default response * is YES. */ PutLine(LINES-2,0, catgets(elm_msg_cat, AliasesSet, AliasesManyTagged, "There are %d aliases tagged..."), tagged); CleartoEOLN(); ans = enter_yn(catgets(elm_msg_cat, AliasesSet, AliasesCreateGroup, "Create group alias?"), TRUE, LINES-3, FALSE); } else { /* * Nothing tagged ... thus nothing to make a group of. */ ans = FALSE; } /* * If requested above, create the group alias address. */ if (ans) { strcpy(address1, aliases[leftoff]->alias); for (i=leftoff+1; i < num_aliases; i++) { if (ison(aliases[i]->status, TAGGED)) { strcat(address1, ","); strcat(address1, aliases[i]->alias); } } } else { tagged = 0; } /* * Only ask for an aliasname if we are NOT replacing the * current alias. */ if (replace) { strcpy(aliasname, aliases[to_replace]->alias); /* * First, see if what we are replacing is a SYSTEM * alias. If so, we need to ask a question. */ if(aliases[to_replace]->type & SYSTEM) { dprint(3, (debugfile, "Aliasname [%s] is SYSTEM in add_alias\n", aliasname)); /* * If they don't want to superceed the SYSTEM alias then * just return. */ if( ! superceed_system(to_replace)) { ClearLine(LINES-2); return(0); } } } else { strcpy(buffer, catgets(elm_msg_cat, AliasesSet, AliasesEnterAliasName, "Enter alias name: ")); PutLine(LINES-2,0, buffer); CleartoEOLN(); *aliasname = '\0'; if ((replace = get_aliasname(aliasname, buffer, &to_replace)) < 0) { dprint(3, (debugfile, "Aliasname [%s] was rejected in add_alias\n", aliasname)); ClearLine(LINES-2); return(0); } } /* * If we are replacing an existing alias, we will assume that * they might want to be just editing most of what is already * there. So we copy some defaults from the existing alias. */ if (replace) { strcpy(lastname, aliases[to_replace]->last_name); strcpy(firstname, aliases[to_replace]->name); ch_ptr = strstr(firstname, lastname); *(ch_ptr-1) = '\0'; strcpy(comment, aliases[to_replace]->comment); } else { *lastname = '\0'; *firstname = '\0'; *comment = '\0'; } get_realnames(aliasname, firstname, lastname, comment, buffer); /* * Since there are no tagged aliases, we must ask for an * address. If we are replacing, a default address is * presented. */ if (tagged == 0) { sprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesEnterAddress, "Enter address for %s: "), aliasname); PutLine(LINES-2, 0, buffer); if (replace) strcpy(address1, aliases[to_replace]->address); else *address1 = '\0'; if (enter_string(address1, sizeof(address1), -1, -1, ESTR_REPLACE) < 0 || address1[0] == '\0') { Raw(ON); show_error(catgets(elm_msg_cat, AliasesSet, AliasesNoAddressSpec, "No address specified!")); return(0); } Raw(ON); despace_address(address1); clear_error(); /* Just in case */ } if(ask_accept(aliasname, firstname, lastname, comment, address1, buffer, replace, to_replace)) { /* * We can only clear the tags after we know that the * alias was added. This allows the user to back out * and rethink without losing the tags. */ if (tagged > 0) { for (i=leftoff; i < num_aliases; i++) { if (ison(aliases[i]->status, TAGGED)) { clearit(aliases[i]->status, TAGGED); show_msg_tag(i); } } } return(1); } else { return(0); } }
static int ask_accept(char *aliasname, char *firstname, char *lastname, char *comment, char *address, char *buffer, int replace, int replacement) { int ans; char *(old_alias[1]); /* * If firstname == lastname, they probably just took all * the deafaults. We *assume* they don't want lastname * entered twice, so we will truncate it. */ if (strcmp(firstname, lastname) == 0) { *firstname = '\0'; } if (strlen(firstname) == 0) { strcpy(buffer, lastname); } else { sprintf(buffer, "%s %s", firstname, lastname); } PutLine(LINES-1,0, catgets(elm_msg_cat, AliasesSet, AliasesAddressAs, "Messages addressed as: %s (%s)"), address, buffer); if (strlen(comment) != 0) { strcat(buffer, ", "); strcat(buffer, comment); } PutLine(LINES-2,0, catgets(elm_msg_cat, AliasesSet, AliasesAddressTo, "New alias: %s is '%s'."), aliasname, buffer); CleartoEOLN(); /* * Kludge Alert: Spaces are padded to the front of the prompt * to write over the previous question. Should probably record * the end of the line, move to it, and CleartoEOLN() it. */ ans = enter_yn(catgets(elm_msg_cat, AliasesSet, AliasesAcceptNew, " Accept new alias?"), TRUE, LINES-3, FALSE); if(ans) { if (replace) { old_alias[0] = aliases[replacement]->alias; /* * First, clear flag if this is marked to be deleted. * This prevents the problem where they marked it for * deletion and then figured out that it could be * c)hanged but didn't explicitly U)ndelete it. Without * this test, the resync action would then delete * the new alias we just so carefully added to the * text file. */ if (ison(aliases[replacement]->status, DELETED)) { clearit(aliases[replacement]->status, DELETED); } /* * Changed aliases are given the NEW flag. */ setit(aliases[replacement]->status, NEW); show_msg_status(replacement); /* * Now we can delete it... */ delete_from_alias_text(old_alias, 1); /* * Kludge Alert: We need to get the trailing comma * (added in delete_from_alias_text()) off of the * alias since the display won't be re-sync'd right * away. */ *((old_alias[0])+strlen(old_alias[0])-1) = '\0'; } add_to_alias_text(aliasname, firstname, lastname, comment, address); } ClearLine(LINES-2); ClearLine(LINES-1); return ans; }
/*--------------------------------------------------------------*/ int main(int argc, char *argv[]) { char *p, *q; setup(); /* temp file is now open */ /*--------------------------------------------------------------*/ blenter(); clearit(); p = &buf[100]; q = &buf[800]; fill(p); fill(q); if (memcmp(p, q, LEN)) { fprintf(temp, "\tmemcmp fails - should have succeeded.\n"); local_flag = FAILED; } p[LEN - 1] = 0; if (!memcmp(p, q, LEN)) { fprintf(temp, "\tmemcmp succeeded - should have failed.\n"); local_flag = FAILED; }; p[LEN - 1] = 'a'; p[0] = 0; if (!memcmp(p, q, LEN)) { fprintf(temp, "\tmemcmp succeeded - should have failed.\n"); local_flag = FAILED; }; p[0] = 'a'; q[LEN - 1] = 0; if (!memcmp(p, q, LEN)) { fprintf(temp, "\tmemcmp succeeded - should have failed.\n"); local_flag = FAILED; }; q[LEN - 1] = 'a'; q[0] = 0; if (!memcmp(p, q, LEN)) { fprintf(temp, "\tmemcmp succeeded - should have failed.\n"); local_flag = FAILED; }; q[0] = 'a'; if (memcmp(p, q, LEN)) { fprintf(temp, "\tmemcmp fails - should have succeeded.\n"); local_flag = FAILED; } blexit(); /*--------------------------------------------------------------*/ blenter(); clearit(); p = &buf[800]; q = &buf[100]; fill(p); fill(q); if (memcmp(p, q, LEN)) { fprintf(temp, "\tmemcmp fails - should have succeeded.\n"); local_flag = FAILED; } p[LEN - 1] = 0; if (!memcmp(p, q, LEN)) { fprintf(temp, "\tmemcmp succeeded - should have failed.\n"); local_flag = FAILED; }; p[LEN - 1] = 'a'; p[0] = 0; if (!memcmp(p, q, LEN)) { fprintf(temp, "\tmemcmp succeeded - should have failed.\n"); local_flag = FAILED; }; p[0] = 'a'; q[LEN - 1] = 0; if (!memcmp(p, q, LEN)) { fprintf(temp, "\tmemcmp succeeded - should have failed.\n"); local_flag = FAILED; }; q[LEN - 1] = 'a'; q[0] = 0; if (!memcmp(p, q, LEN)) { fprintf(temp, "\tmemcmp succeeded - should have failed.\n"); local_flag = FAILED; }; q[0] = 'a'; if (memcmp(p, q, LEN)) { fprintf(temp, "\tmemcmp fails - should have succeeded.\n"); local_flag = FAILED; } blexit(); /*--------------------------------------------------------------*/ /* Clean up any files created by test before call to anyfail. */ anyfail(); /* THIS CALL DOES NOT RETURN - EXITS!! */ tst_exit(); }
static void alldone(void) { pxe_fini(); clearit(); }
int main(int argc, char *argv[]) { char *p, *q; tst_parse_opts(argc, argv, NULL, NULL); setup(); /* temp file is now open */ /*--------------------------------------------------------------*/ blenter(); clearit(); p = &buf[100]; fill(p); q = &buf[800]; memcpy(q, p, LEN); if (checkit(q)) { fprintf(temp, "\tcopy failed - missed data\n"); local_flag = FAILED; } if (p[-1] || p[LEN]) { fprintf(temp, "\tcopy failed - 'to' bounds\n"); local_flag = FAILED; } if (q[-1] || q[LEN]) { fprintf(temp, "\tcopy failed - 'from' bounds\n"); local_flag = FAILED; } blexit(); /*--------------------------------------------------------------*/ blenter(); clearit(); p = &buf[800]; fill(p); q = &buf[100]; memcpy(q, p, LEN); if (checkit(q)) { fprintf(temp, "\tcopy failed - missed data\n"); local_flag = FAILED; } if (p[-1] || p[LEN]) { fprintf(temp, "\tcopy failed - 'to' bounds\n"); local_flag = FAILED; } if (q[-1] || q[LEN]) { fprintf(temp, "\tcopy failed - 'from' bounds\n"); local_flag = FAILED; } blexit(); anyfail(); tst_exit(); }