void edit_main_rep::footer_eval (string s) { // s= unslash (s); // FIXME: dirty fix; should not be necessary s= tm_decode (s); string r= object_to_string (eval (s)); set_message (verbatim (r), "evaluate expression"); }
/* Deprecated. Do not use. */ void get_current_time(struct date_time *dt) { struct tm tm; time_t now; now = time(NULL); (void)gmtime_r(&now, &tm); Dmsg6(200, "m=%d d=%d y=%d h=%d m=%d s=%d\n", tm.tm_mon+1, tm.tm_mday, tm.tm_year+1900, tm.tm_hour, tm.tm_min, tm.tm_sec); tm_encode(dt, &tm); #ifdef DEBUG Dmsg2(200, "jday=%f jmin=%f\n", dt->julian_day_number, dt->julian_day_fraction); tm_decode(dt, &tm); Dmsg6(200, "m=%d d=%d y=%d h=%d m=%d s=%d\n", tm.tm_mon+1, tm.tm_mday, tm.tm_year+1900, tm.tm_hour, tm.tm_min, tm.tm_sec); #endif }
string scheme_language_rep::get_color (tree t, int start, int end) { static string none= ""; if (start >= end) return none; string s= t->label; for (int i= max (0, start-1000); i <= start; i++) switch (s[i]) { case ';': if (i>1 && s[i-1] == '\\' && s[i-2] == '#') break; return decode_color ("scheme", encode_color ("comment")); case '\042': if (i>1 && s[i-1] == '\\' && s[i-2] == '#') break; i++; while (i <= start && s[i] != '\042') if (s[i] == '\\' && i < start) i += 2; else i++; if (i >= start) return decode_color ("scheme", encode_color ("constant_string")); break; } if (is_numeric (s[start])) return decode_color ("scheme", encode_color ("constant_number")); if (s[start] == '\042' || s[start] == '#') return decode_color ("scheme", encode_color ("constant_string")); if (s[start] == ':') return decode_color ("scheme", encode_color ("declare_category")); string r= s (start, end); if (!colored->contains (r)) { colored (r)= ""; if (as_bool (call ("defined?", symbol_object (tm_decode (r))))) colored (r)= decode_color ("scheme", encode_color ("variable_identifier")); } return colored[r]; }
static void dump_session_label(DEV_RECORD *rec, const char *type) { int dbl; struct date_time dt; struct tm tm; SESSION_LABEL label; char ec1[30], ec2[30], ec3[30], ec4[30], ec5[30], ec6[30], ec7[30]; unser_session_label(&label, rec); dbl = debug_level; debug_level = 1; Pmsg7(-1, _("\n%s Record:\n" "JobId : %d\n" "VerNum : %d\n" "PoolName : %s\n" "PoolType : %s\n" "JobName : %s\n" "ClientName : %s\n" ""), type, label.JobId, label.VerNum, label.PoolName, label.PoolType, label.JobName, label.ClientName); if (label.VerNum >= 10) { Pmsg4(-1, _( "Job (unique name) : %s\n" "FileSet : %s\n" "JobType : %c\n" "JobLevel : %c\n" ""), label.Job, label.FileSetName, label.JobType, label.JobLevel); } if (rec->FileIndex == EOS_LABEL) { Pmsg8(-1, _( "JobFiles : %s\n" "JobBytes : %s\n" "StartBlock : %s\n" "EndBlock : %s\n" "StartFile : %s\n" "EndFile : %s\n" "JobErrors : %s\n" "JobStatus : %c\n" ""), edit_uint64_with_commas(label.JobFiles, ec1), edit_uint64_with_commas(label.JobBytes, ec2), edit_uint64_with_commas(label.StartBlock, ec3), edit_uint64_with_commas(label.EndBlock, ec4), edit_uint64_with_commas(label.StartFile, ec5), edit_uint64_with_commas(label.EndFile, ec6), edit_uint64_with_commas(label.JobErrors, ec7), label.JobStatus); } if (label.VerNum >= 11) { char dt[50]; bstrftime(dt, sizeof(dt), btime_to_utime(label.write_btime)); Pmsg1(-1, _("Date written : %s\n"), dt); } else { dt.julian_day_number = label.write_date; dt.julian_day_fraction = label.write_time; tm_decode(&dt, &tm); Pmsg5(-1, _("Date written : %04d-%02d-%02d at %02d:%02d\n"), tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min); } debug_level = dbl; }
void dump_volume_label(DEVICE *dev) { int dbl = debug_level; uint32_t File; const char *LabelType; char buf[30]; struct tm tm; struct date_time dt; debug_level = 1; File = dev->file; switch (dev->VolHdr.LabelType) { case PRE_LABEL: LabelType = "PRE_LABEL"; break; case VOL_LABEL: LabelType = "VOL_LABEL"; break; case EOM_LABEL: LabelType = "EOM_LABEL"; break; case SOS_LABEL: LabelType = "SOS_LABEL"; break; case EOS_LABEL: LabelType = "EOS_LABEL"; break; case EOT_LABEL: goto bail_out; default: LabelType = buf; sprintf(buf, _("Unknown %d"), dev->VolHdr.LabelType); break; } Pmsg11(-1, _("\nVolume Label:\n" "Id : %s" "VerNo : %d\n" "VolName : %s\n" "PrevVolName : %s\n" "VolFile : %d\n" "LabelType : %s\n" "LabelSize : %d\n" "PoolName : %s\n" "MediaType : %s\n" "PoolType : %s\n" "HostName : %s\n" ""), dev->VolHdr.Id, dev->VolHdr.VerNum, dev->VolHdr.VolumeName, dev->VolHdr.PrevVolumeName, File, LabelType, dev->VolHdr.LabelSize, dev->VolHdr.PoolName, dev->VolHdr.MediaType, dev->VolHdr.PoolType, dev->VolHdr.HostName); if (dev->VolHdr.VerNum >= 11) { char dt[50]; bstrftime(dt, sizeof(dt), btime_to_utime(dev->VolHdr.label_btime)); Pmsg1(-1, _("Date label written: %s\n"), dt); } else { dt.julian_day_number = dev->VolHdr.label_date; dt.julian_day_fraction = dev->VolHdr.label_time; tm_decode(&dt, &tm); Pmsg5(-1, _("Date label written: %04d-%02d-%02d at %02d:%02d\n"), tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min); } bail_out: debug_level = dbl; }
static string web_encode (string s) { return tm_decode (s); }