int setefilegacypath(BLContextPtr context, const char * path, int bootNext, const char *legacyHint, const char *optionalData) { CFStringRef xmlString = NULL; const char *bootString = NULL; int ret; struct statfs sb; if(0 != blsustatfs(path, &sb)) { blesscontextprintf(context, kBLLogLevelError, "Can't statfs %s\n" , path); return 1; } if(legacyHint) { ret = BLCreateEFIXMLRepresentationForDevice(context, legacyHint+5, NULL, &xmlString, false); if(ret) { return 1; } ret = setit(context, kIOMasterPortDefault, "efi-legacy-drive-hint", xmlString); if(ret) return ret; ret = _forwardNVRAM(context, CFSTR("efi-legacy-drive-hint-data"), CFSTR("BootCampHD")); if(ret) return ret; ret = setit(context, kIOMasterPortDefault, kIONVRAMDeletePropertyKey, CFSTR("efi-legacy-drive-hint")); if(ret) return ret; } ret = BLCreateEFIXMLRepresentationForLegacyDevice(context, sb.f_mntfromname + 5, &xmlString); if(ret) { return 1; } if(bootNext) { bootString = "efi-boot-next"; } else { bootString = "efi-boot-device"; } ret = setit(context, kIOMasterPortDefault, bootString, xmlString); CFRelease(xmlString); if(ret) { return 2; } ret = efinvramcleanup(context); if(ret) return ret; return 0; }
static void do_var_match(int i, const char *vin) { const char *ptr; if (Argp && Vars[i].vtype != V_STRING) VAR(i) = Arg; else { for (ptr = vin; *ptr && !isspace(*ptr); ++ptr) ; while (isspace(*ptr)) ++ptr; if (*ptr) setit(i, ptr); } /* Fillwidth must be > 0 */ if (VAR(VFILLWIDTH) == 0) VAR(VFILLWIDTH) = 1; /* Tabs must be >= 2 and <= 8 */ if (i == VTABS || i == VCTABS || i == VSHTABS) { if (VAR(i) < 2) VAR(i) = 2; else if (VAR(i) > 8) VAR(i) = 8; } }
static void reschedule_reallines_because_num_reallines_have_changed_in_wblock3(struct SeqTrack *seqtrack, struct SeqBlock *seqblock, struct WBlocks *wblock, int64_t curr_seqtrack_time){ R_ASSERT_NON_RELEASE(seqblock->block != NULL); struct Blocks *block = wblock->block; if (seqblock->block == block && curr_seqtrack_time < seqblock->t.time2) { PLAYER_lock();{ curr_seqtrack_time = seqtrack->start_time; // Get accurate seqtrack time, and also update it. if (curr_seqtrack_time >= seqblock->t.time) { if (curr_seqtrack_time < seqblock->t.time2) { STime stime = seqtime_to_blocktime(seqblock, curr_seqtrack_time - seqblock->t.time); Place place = STime2Place(block, stime); int realline=FindRealLineFor(wblock,0,&place); setit(wblock, realline); realline++; //printf(" Rescheduling block %d. Realline: %d. Place: %d + %d/%d\n", wblock->l.num, realline, place.line,place.counter,place.dividor); RT_schedule_reallines_in_block2(seqtrack, seqblock, wblock, realline); } } }PLAYER_unlock(); } }
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; }
static void get_aliases(int are_in_aliases) { /* * Get all the system and user alias info * * If we get this far, we must be needing to re-read from * at least one data file. Unfortunately that means we * really need to read both since the aliases may be sorted * and all mixed up... :-( */ int dups = 0; curr_alias = 0; num_duplicates = 0; /* * Read from user data file if it is open. */ if (user_hash != NULL) { dprint(6, (debugfile, "About to read user data file = %s.\n", user_hash->dbz_basefname)); fseek(user_hash->dbz_basef, 0L, 0); while (get_one_alias(user_hash, curr_alias)) { dprint(8, (debugfile, "%d\t%s\t%s\n", curr_alias+1, aliases[curr_alias]->alias, aliases[curr_alias]->address)); curr_alias++; } } num_aliases = curr_alias; /* Needed for find_alias() */ /* * Read from system data file if it is open. */ if (system_hash != NULL) { dprint(6, (debugfile, "About to read system data file = %s.\n", system_hash->dbz_basefname)); fseek(system_hash->dbz_basef, 0L, 0); while (get_one_alias(system_hash, curr_alias)) { /* * If an identical user alias is found, we may * not want to display it, so we had better mark it. */ if (find_alias(aliases[curr_alias]->alias, USER) >= 0) { setit(aliases[curr_alias]->type, DUPLICATE); dups++; setit(aliases[curr_alias]->status, URGENT); /* Not really, I want the U for User */ dprint(6, (debugfile, "System alias %s is same as user alias.\n", aliases[curr_alias]->alias)); } dprint(8, (debugfile, "%d\t%s\t%s\n", curr_alias+1, aliases[curr_alias]->alias, aliases[curr_alias]->address)); curr_alias++; } num_duplicates = dups; } num_aliases = curr_alias - num_duplicates; if (OPMODE_IS_READMODE(opmode) && num_aliases > 0) { curr_alias = 0; sort_aliases((num_aliases+num_duplicates), FALSE, are_in_aliases); curr_alias = 1; if (are_in_aliases) { (void) get_page(curr_alias); } } }
int main (int argc, char const *const *argv) { PROG = "s6-clock" ; return (argc < 2) ? getit() : setit(argv[1]) ; }
static int64_t RT_scheduled_realline(struct SeqTrack *seqtrack, int64_t time, union SuperType *args){ const struct SeqBlock *seqblock = args[0].const_pointer; struct WBlocks *wblock = args[1].pointer; int realline = args[2].int32_num; int64_t counter = args[3].int_num; //printf("%d. counter: %d / seqblock->counter: %d. Num reallines: %d\n", realline, (int)counter, (int)seqblock->curr_scheduled_realline_counter, wblock->num_reallines); if (seqblock->curr_scheduled_realline_counter > counter){ // I.e. this event have been replaced because the number of reallines was changed while playing. //printf(" stop1: %d / %d\n", (int)counter, (int)seqblock->curr_scheduled_realline_counter); return DONT_RESCHEDULE; } const int num_reallines = wblock->num_reallines; /* if (num_reallines != wblock->num_reallines){ // Happens when changing LZ value. realline = get_curr_realline_for_seqtrack(seqtrack); num_reallines = wblock->num_reallines; args[3].int32_num = num_reallines; } */ #ifdef WITH_PD bool inserted_pd_realline = false; int64_t org_time = time; const Place *org_pos = NULL; if (realline < num_reallines) // number of reallines can change while playing. org_pos = &wblock->reallines[realline]->l.p; #endif // Do thing with the current realline setit(wblock, realline); // Schedule next realline // const int next_realline = realline+1; if(pc->playtype==PLAYRANGE){ // This never happens. Instead playtype is PLAYBLOCK, and pc->is_playing_range is true; R_ASSERT(false); /* if(next_realline>=wblock->rangey2){ next_realline=wblock->rangey1; } // sanity checks to avoid crash. May happen if editing next_reallines while playing. if (next_realline>=wblock->num_next_reallines) // If outside range, first try to set next_realline to rangey1 next_realline = wblock->rangey1; if (next_realline>=wblock->num_next_reallines) // that didn't work, set next_realline to 0 next_realline = 0; */ } else if (pc->playtype==PLAYBLOCK && pc->is_playing_range == true){ if (next_realline>=num_reallines || p_Greater_Than(wblock->reallines[next_realline]->l.p, wblock->rangey2)){ ATOMIC_SET(pc->player_state, PLAYER_STATE_STOPPING); //PC_ReturnElements(); return DONT_RESCHEDULE; } }else if(next_realline>=num_reallines) { return DONT_RESCHEDULE; } #ifdef WITH_PD if (org_pos != NULL) if(inserted_pd_realline==false) RT_PD_set_realline(org_time, time, org_pos); #endif { args[2].int32_num = next_realline; Place next_place = wblock->reallines[next_realline]->l.p; //printf(" next_place: %d + %d/%d\n", next_place.line, next_place.counter, next_place.dividor); return get_seqblock_place_time(seqblock, next_place); } }