+-+-+-+ Beginning of part 10 +-+-+-+ X`009send_msg(node, user, temp+256); X `125 X X /* Did we tell them ANYTHING? */ X X if (!found_any) `123 X`009sprintf(temp, "No matches found for '%s'", conf); X`009send_msg(node, user, temp); X `125 X X /* Remember to close the file, please */ X X fclose(logf); X`125 X X/* Sort the log file whenever there are any additions */ X Xstatic sort_log_file(void) X`123 X struct note_log * log_entries; X struct note_log temp_ent; X FILE * log_f; X int num_items; X X log_f = fopen(log_file.dsc$a_pointer, "r"); X X for (num_items = 0; ; num_items++) `123 X`009if (!fread(&temp_ent, sizeof(struct note_log), 1, log_f)) `123 X`009 break; X`009`125 X `125 X X rewind(log_f); X X log_entries = (struct note_log *) xmalloc(num_items * X`009 sizeof(struct note_log)); X X fread(log_entries, sizeof(struct note_log), num_items, log_f); X X fclose(log_f); X X qsort(log_entries, num_items, sizeof(struct note_log), log_compare); X X log_f = fopen(log_file.dsc$a_pointer, "w"); X X fwrite(log_entries, sizeof(struct note_log), num_items, log_f); X X fclose(log_f); X X xfree(log_entries); X`125 X X/* Compare two log_file entries */ X Xstatic int log_compare(struct note_log * x, struct note_log * y) X`123 X return(strcmp(x->conf_name, y->conf_name)); X`125 X X/* Search through until we find the conference name, or fall off the end */ X Xstatic int search_log_file(FILE * i, struct note_log * ent, char * conf, X int case_sense) X`123 X fpos_t cur_pos;`009`009`009/* For backing up */ X char temp_conf[40]; `009`009/* In case we need to upper-case */ X int match_made;`009`009`009/* Did the names match */ X X /* Start looking at the beginning */ X X rewind(i); X X /* Let's scan through until we find the conference name */ X X while (TRUE) `123 X X`009/* Save where we are in case we find it */ X X`009fgetpos(i, &cur_pos); X X`009/* Read next record */ X X`009if (!fread(ent, sizeof(struct note_log), 1, i)) `123 X`009 ent->conf_name[0] = '\0'; /* EOF, not found */ X`009 return (FALSE);`009`009/* That'll flag that it wasn't found */ X`009`125 X X`009/* If we're not being case sensitive, copy and uppercase the name */ X X`009if (!case_sense) `123 X`009 strcpy(temp_conf, ent->conf_name); X`009 strupr(temp_conf); X`009 match_made = !strcmp(temp_conf, conf); X`009`125 else `123 X`009 match_made = !strcmp(ent->conf_name, conf); X`009`125 X X`009/* Check if we have a winner */ X X`009if (match_made) `123 X`009 fsetpos(i, &cur_pos);`009/* Yup, back up for updating */ X`009 return (TRUE);`009`009/* We found it... */ X`009`125 X `125 X`125 $ GOSUB UNPACK_FILE $ FILE_IS = "NOTES$COMMAND.SAMPLE" $ CHECKSUM_IS = 1331883541 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X! Display the current conference name X Xprocedure where_am_i X if notes$x_notefile_ctx <> "" then X message ("Current conference is " + notes$x_entry_name); X else X message ("You are not currently in a conference"); X endif Xendprocedure X X! Bail out X Xprocedure fast_exit Xon_error Xendon_error; X X message('Exiting...'); X update(ALL); X set(screen_update, OFF); X if NOT eve$x_enable_parser_notes then X eve_exit; X notes$do_command('exit'); X set(screen_update, ON); X notes$do_command('exit'); X else X if notes$x_notefile_ctx <> "" then X notes$do_command('exit'); X set(screen_update, ON); X notes$do_command('exit'); X else X set(screen_update, ON); X notes$do_command('exit'); X endif; X endif; Xendprocedure; X X! Print a (range of) notes to local printer port X Xprocedure local_print X local print_range; X Xon_error Xendon_error; X Xif notes$x_notefile_ctx = "" then X message ("You are not currently in a conference"); X return; Xendif; X Xprint_range := read_line("Enter range of notes to print: "); X Xif length(print_range) = 0 X then X if last_key = ctrl_z_key X then X return X else X print_range := "." X endif Xendif; X Xmessage ("Printing..."); Xupdate(ALL); Xset(screen_update, off); Xnotes$do_command("extract sys$login:notes_print_temp.tmp " + print_range); X! Note: You must customize the following line with the location of the`032 X!`009notes-print.com file on your system. Xspawn ("@sys$tools:notes-print.com"); Xset(screen_update, on); Xmessage (""); Xendprocedure X X! Show the sender's full personal name X Xprocedure display_full_poster_name; X if notes$x_notefile_ctx <> "" then X message ("From: "+notes$x_note_pen_name); X else X message ("You are not viewing a note"); X endif Xendprocedure; X X! Reply to an Internet discussion list X Xprocedure reply_to_internet_list; X local temp_text, last_pos, rusure; X X if notes$x_notefile_ctx = "" then X message ("You are not viewing a note"); X else X i := index(notes$x_notefile_name, "]"); X if substr(notes$x_notefile_name, i+1, 2) <> "X-" then `032 X message("Current conference is not an Internet echo"); X else X! Note: You must customize the following line with the node and user of X!`009your Notes Poster Daemon process. X if notes$x_note_author = "SPCVXA::BBOARD" then X`009message("This echo cannot be posted to in this manner"); X else X`009temp_text := notes$x_note_title; X`009netdefalt := temp_text; X`009edit(netdefalt, COMPRESS, OFF); X translate(temp_text, "RE", "re"); X`009if substr(temp_text, 1, 3) <> "RE:" then X`009 if (netdefalt <> "") then X`009 netdefalt := "RE: "+notes$x_note_title; X`009 endif X`009else X`009 netdefalt := notes$x_note_title; X`009endif; X`009last_pos := mark(NONE); X rusure := read_line('Send reply to this mailing list? [N] ',1); X edit (rusure, UPPER); X if (rusure <> "Y") then X`009 message("MAIL message will not be sent"); X`009 return; X endif; X`009message("Working..."); X`009position(last_pos); X`009update(ALL); X`009set(screen_update,OFF); X`009notes$do_command("forward/edit/author"); X netdefalt := ""; X endif X endif X endif Xendprocedure; X X! Reply to an Internet author directly X Xprocedure fwd_to_internet_author; X local temp_text, net_address; X X if notes$x_notefile_ctx = "" then X message ("You are not viewing a note"); X else X i := index(notes$x_notefile_name, "]"); X if substr(notes$x_notefile_name, i+1, 2) <> "X-" then `032 X message("Current conference is not an Internet echo"); X else X temp_text := notes$x_note_pen_name; X i := index(temp_text, "<"); X j := index(temp_text, ">"); X! Here we do some address optimization, which also allows us to process trun- X! cated addresses. Probably not a good idea to do this if you're on Internet. X k := index(temp_text, ".BITNET@"); X if k <> 0 then X`009k := k + 7; X`009j := k; X`009loop X`009 if substr(temp_text, k, 1) = "%" then X`009 temp_text := substr(temp_text, 1, k-1) + "@" + substr(temp_text, X`009 k+1, 128); X`009 exitif 1 = 1; X`009 endif; X k := k - 1; X`009 exitif k = 0; X endloop X endif; X! End of address optimization X if (i = 0) or (j = 0) then V`009message("Cannot determine author's address, please use the FORWARD comman Xd."); X return; X endif; X net_address := '0::in%"""' + substr(temp_text, i+1, j-i-1) + '"""'; X temp_text := notes$x_note_title; X netdefalt := temp_text; X edit(netdefalt, COMPRESS); X translate(temp_text, "RE", "re"); X if substr(temp_text, 1, 3) <> "RE:" then X if (netdefalt <> "") then X`009 netdefalt := "RE: "+notes$x_note_title; X`009endif X else X netdefalt := notes$x_note_title; X endif; X message("Working..."); X set(screen_update,OFF); X notes$do_command("forward/edit "+net_address); X netdefalt := ""; X endif X endif Xendprocedure; X X! Redefine get_mail_subject so we can use a different default for net replies X Xprocedure notes$$get_mail_subject(defalt); X local subj_line; X set(screen_update,ON); X notes$x_mail_subject := ""; X if netdefalt <> "" then X notes$x_mail_subject := netdefalt; X message('Default subject is: "'+netdefalt+'"'); X else X if defalt <> "" then X notes$x_mail_subject := defalt; X message('Default subject is: "'+defalt+'"'); X endif; X endif; X subj_line := read_line("Subject: "); `032 X if subj_line <> "" then X notes$x_mail_subject := subj_line; X endif; X if (last_key = ctrl_c_key) or (last_key = ctrl_z_key) then X return(FALSE); X else X return(TRUE); X endif; Xendprocedure; X X! Show the keywords a note has affiliated with it X Xprocedure show_keyword; X local junk; X X if notes$x_notefile_ctx = "" then X message ("You are not viewing a note"); X else X notes$do_command("show note/keyword ."); X junk := read_line('Press RETURN to return to reading the note: ',1); X notes$do_command("."); X endif Xendprocedure; X X! Define the NOTE keypad keys X Xdefine_key ('fast_exit', key_name('q', shift_key), 'Complete Exit', X notes$kt_user_keys); Xdefine_key ('fast_exit', key_name('e', shift_key), 'Complete Exit', X notes$kt_user_keys); Xdefine_key("where_am_i",key_name("w",shift_key),"where", X notes$kt_user_keys); Xdefine_key('notes$do_command("search")', kp8, 'Search Next', X notes$kt_user_keys); Vdefine_key('display_full_poster_name', key_name('s', shift_key), "Disp. Sende Xr", X notes$kt_user_keys); Vdefine_key('reply_to_Internet_list', key_name('r', shift_key), "Internet post X", X notes$kt_user_keys); Vdefine_key('fwd_to_Internet_author', key_name('f', shift_key), "Internet auth Xor", X notes$kt_user_keys); Xdefine_key('show_keyword', key_name('k', shift_key), "Show Keywords", X notes$kt_user_keys); Vdefine_key('message("NOTES$COMMAND V1.1-07, 10-Mar-1990, TMK")', key_name('v' X, X shift_key), "Version info", notes$kt_user_keys); Vdefine_key('local_print', key_name('p', shift_key), "Print to terminal printe Xr", X notes$kt_user_keys); X X! Define the EVE keypad keys X Xdefine_key('notes$$help("keypad")', pf2, "Help", eve$x_user_keys); X Xeve$arg1_examine := eve$arg1_buffer; Xeve$x_highlighting := bold; X Xset (bell, broadcast, ON); Xnetdefalt := ""; $ GOSUB UNPACK_FILE $ FILE_IS = "NOTES-PRINT.SAMPLE" $ CHECKSUM_IS = 20870004 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X$! NOTES-PRINT.COM X$ Escape[0,8] = %O33 X$ FormFeed[0,8] = %O14 X$ set term/form X$ write sys$output "''Escape'[5i" X$! write sys$output "''FormFeed'" ! Uncomment if needed. X$ type SYS$LOGIN:NOTES_PRINT_TEMP.TMP X$ write sys$output "''FormFeed'" ! Comment if needed. X$ write sys$output "''Escape'[4i" X$ delete/nolog SYS$LOGIN:NOTES_PRINT_TEMP.TMP;* X$!Command procedure to print a file on attached printer. $ GOSUB UNPACK_FILE $ FILE_IS = "NOTES_PURGE.COM" $ CHECKSUM_IS = 710974794 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X$ ! X$ ! Original author - Ben Cohen - 07-Mar-1990 X$ ! X$ ! X$ ! BMC 24-Feb-1990 X$ !`009Initial version X$ ! BMC 07-Mar-1990 X$ !`009Fix actually doing the CONVERT. We need a .FDL without any ALLOCATION X$ !`009`009clauses. X$ !`009Purge only on date. Don't use size as a limiting factor. X$ ! BMC 22-Apr-1990 (Geez, it takes forever to get things done... (sigh)) X$ !`009Added resubmit and only-run-on-day-selected code X$ !`009PURGE of Notes files works now. Needs SYSPRV when running, though... X$ ! X$ ! 'f$verify(0) X$ ! X$ ! Set up our defaults. This is (most likely) the section that you'll be X$ ! changing to customize for your site. X$ ! X$ expire_days = 60`009`009`009! 60 days seems reasonable to me... X$ run_on_day = "Sunday"`009`009`009! Only purge on Sundays X$ run_on_time = "04:30"`009`009`009! Sunday _mornings_, that is... X$ never_purge = ":X-INFO-BBOARD:X-UNKNOWN:" X$ archive_Notes = "F"`009`009`009! EXTRACT the Notes before deleting? X$ min_note = 5`009`009`009`009! Only purge in 5-* X$ ! X$ ! Find out where we're located and move there X$ ! X$ spec = f$environment("PROCEDURE") X$ home_spec = f$element(0, "]", spec)+"]"`009! It looks wierd, but it works. X$ set default 'home_spec' X$ ! X$ ! Resubmit ourselves to run tomorrow (after figuring out where we are, X$ ! what we are, etc. X$ ! X$ com_log_file = home_spec+f$parse(spec,,,"NAME","SYNTAX_ONLY")+".LOG" X$ purge/log/keep=3 'com_log_file X$ submit 'spec /noprint /log='com_log_file /after=tomorrow"+''run_on_time'" X$ ! X$ ! Now check to see if we should actually keep going for today. X$ ! X$ only_run_on_day = f$edit(run_on_day, "LOWERCASE") X$ cur_day = f$edit(f$cvtime(f$time(),, "WEEKDAY"), "LOWERCASE") X$ if only_run_on_day .eqs. cur_day then goto Run_today`009! Winner... X$ write sys$output "Only going to run on ''run_on_day'." X$ write sys$output "That's not today, so we're not going to run now." X$ exit X$ ! X$Run_today: X$ ! X$ ! Let's figure out the data that we need to know from what they gave us X$ ! X$ never_purge_len = f$length(never_purge) X$ expire_date = f$cvtime("TODAY-''expire_days'-","COMPARISON") X$ ! X$ ! First make sure that we're on the right node... X$ ! X$ lib_spec = f$trnlnm("notes$library") X$ notes_node = f$parse(lib_spec,,,"NODE","SYNTAX_ONLY") X$ if notes_node .eqs. f$trnlnm("SYS$NODE") then goto Start V$ write sys$output "%NOTPURG-F-WRONGNODE You must be on the NOTES$LIBRARY nod Xe." X$ exit X$ ! X$ ! Time to start this thing going... X$ ! X$Start: X$ lib_spec = lib_spec-notes_node X$ file_spec = lib_spec+"X-*.NOTE" X$ ! X$ ! Now let's start looking at files X$ ! X$ open/write temp notes_list.out X$ close temp X$ ! X$ did_one = "F" X$ ! X$Top_of_file_search: X$ next_file = f$search(file_spec) X$ if next_file .eqs. "" then goto Past_file_search X$ fname = f$parse(next_file,,,"NAME","SYNTAX_ONLY") X$ if f$locate(":"+fname+":", never_purge) .lt. never_purge_len then - X`009goto Top_of_file_search X$ did_one = "T" X$ open/write scan_it notes_scan.com X$ write scan_it "DEFINE/USER SYS$OUTPUT notes_temp.tmp" X$ write scan_it "$ NOTES/NONOTEBOOK "+fname X$ write scan_it "dir ''min_note'-l" X$ write scan_it "exit" X$ write scan_it "$ EXIT" X$ close scan_it X$ @notes_scan X$ delete notes_scan.com; X$ ! X$ ! Now let's parse the output X$ ! X$ open/append/share=read clean_up notes_list.out X$ write clean_up "F "+fname X$ open/read dir_in notes_temp.tmp X$Dir_scan_start: X$ read dir_in line X$ if f$element(1, " ", line) .nes. "Topic" then goto Dir_scan_start X$ ! X$ ! Now the next line is useful... X$ ! X$ Initial = "E "`009`009`009! Assume it's expired... X$Dir_scan_real: X$ read/end=Dir_scan_Done dir_in line X$ line = f$edit(line, "COMPRESS") X$ if line .eqs. "" then goto Dir_scan_real X$ if f$element(1, " ", line) .eqs. "End" then goto Dir_scan_Done X$ if f$integer(f$element(1, " ", line)) .lt. Min_Note then goto Dir_scan_real X$ topic_date = f$cvtime(f$element(3, " ", line), "COMPARISON") X$ if topic_date .ges. expire_date then Initial = "U " V$ write clean_up Initial+f$element(1, " ", line)+" "+f$element(4, " ", line)+ X - -+-+-+-+-+ End of part 10 +-+-+-+-+-