ys" SWING_SRC.BCK SWING_SRC.BCKSBACKUP/EXCLUDE=*.DIR/INTERCHANGE/BLOCK=8464 *.* USER3:[ANONYMOUS]SWING_SRC.BCK/SAVE MATS (<fp;V5.4 _RIGEL:: _ _RIGEL$DUA3: V5.4 " a(*[MATS.PROG.SWING.C_SWING]AAAREADME.1ST;1+,P-./(< 4K--0123KPWO5 6`X-r7B')e8d$k9`6-G(<HJ 'C SWING version 3.2 READ THE MANUAL1-------------------------------------------------/Language : VAXC, uses SMG$ for i/oCompiler : VAX C compiler v 2.4VMS version : 5.0 or greater Introduction ------------H This is a total re-write and major extension to the original version of8SWING which the author obtained via infonet in the U.K..D The re-write was necessary as I do not have a Fortran compiler, andFfelt that C was a more appropriate language. Also, colleagues required>major enhancements, so the software was started from scratch. A The result that you see here consumed something in the region ofH400 to 500 hours of spare time. The software has been placed back in thepublic domain. A As supplied, the sources and executable have been compiled under.v5.1 of VMS using v2.4 of the VAX C compiler. B For full information look in the MANUAL sub-directory, where you Kwill find swing_manual.mem. This can be printed out - it is the user guide. READ IT!> Finally, any comments whatsoever may be forwarded as follows: Until 31st December 1989 Simon Brown, Seefeldstrasse 194, 8008 Zurich, Switzerland. Work: Switzerland 1 236.49.01 Thereafter to Simon Brown, Riverside, Glen Auldyn, Ramsey, Isle of Man.@ I will keep C_SWING updated for so long as I work on a VMS sitewith a C compiler. Directory Structure-------------------8SWING-----------SOURCES-------+-DOCUMENTATION-+-HELP_LIB | +-MANUAL +-EXE +-OBJVersion 5 Compilation---------------------MMS---;Descriptor file is DESCRIP.MMS in the SOURCE sub-directory.NO MMS------ @compile_v5@link_v5Help Library And User Guide---------------------------KIn the DOCUMENTATION sub-directory you will find descrip.mms for those with&MMS, and runoff.com for those without. Execution ---------@The executable is found in the EXE sub-directory. To run, in thetime-honoured way type $ run swingFor set up via a foreign command. Copy the help library in the HELP_LIBEsub-directory into the same directory as the executable, and you haveHon-line help. READ THE MANUAL. THEN READ IT AGAIN. SEVERAL TIMES. O.K.? $*[MATS.PROG.SWING.C_SWING]BATCH.COM;3+,-./(< 4+--0123KPWO56 07!089G(<HJ$!+$! recompile in the batrch queue using MMS$!($ set def DUB1:[MATS.PROG.SWING.C_SWING]$@COMPILE_V5.COM $@LINK_V5.COM$! mms$!)*[MATS.PROG.SWING.C_SWING]COMPILE_V5.COM;7+,X. /(< 4W --0123KPWO 56 v07`"089G(<HJ$!"$! compile the sources for VMS V 5$! $ set verC$ cc localfix.c/nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]?$ cc swing /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]A$ cc swing_1 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]A$ cc swing_2 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]A$ cc swing_3 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]A$ cc swing_4 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]A$ cc swing_5 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]A$ cc swing_6 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]A$ cc swing_7 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]A$ cc swing_8 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]A$ cc swing_9 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_10 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_11 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_12 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_13 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_14 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_15 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_16 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_17 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_18 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_19 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_20 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_21 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_22 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_23 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_24 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_25 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_26 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_27 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_28 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_29 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_30 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_31 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_32 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_33 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_34 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_35 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_36 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_37 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]C$ cc swing_38 /nodebug/nolist/opt/define=(VMS_V5) /object=[.obj]W$ cc/define=(vmsv5,rexpressions,unix_to_vms)/optimize/nodebug/nolist/object=[.obj] more2$ cc/optimize/nodebug/nolist/object=[.obj] config6$ cc/optimize/nodebug/nolist/object=[.obj] descriptor5$ cc/optimeze/nodebug/nolist/object=[.obj] eof_check2$ cc/optimize/nodebug/nolist/object=[.obj] getint4$ cc/optimeze/nodebug/nolist/object=[.obj] listfile0$ cc/optimize/nodebug/nolist/object=[.obj] main/$ cc/optimize/nodebug/nolist/object=[.obj] map5$ cc/optimize/nodebug/nolist/object=[.obj] more_help2$ cc/optimeze/nodebug/nolist/object=[.obj] prline4$ cc/optimeze/nodebug/nolist/object=[.obj] prwindow/$ cc/optimize/nodebug/nolist/object=[.obj] reg1$ cc/optimize/nodebug/nolist/object=[.obj] spawnU$ cc/optimize/nodebug/nolist/object=[.obj]/define=(rexpressions,unix_to_vms) string2$ cc/optimize/nodebug/nolist/object=[.obj] termio4$ cc/optimize/nodebug/nolist/object=[.obj] unix2vms#$ purge /nolog/noconf/keep=1 [.obj] $ set nover Mu" SWING_SRC.BCK--#[MATS.PROG.SWING.C_SWING]CONFIG.C;5-"#*[MATS.PROG.SWING.C_SWING]CONFIG.C;5+,-./(< 4---0123KPWO56iZeg7eg89`6-G(<HJ/*VMS MORE V1.50*/)extern int Screen_Height,Screen_Width; #define TRUE 1#define FALSE 0#include stdio#extern int eof_exit,case_sensitive; void config(){  clrs(); cursor(2,1); if(eof_exit)- printf("1: toggle eof_exit = TRUE"); else - printf("1: toggle eof_exit = FALSE"); cursor(3,1); if(case_sensitive)- printf("2: toggle case_sensitive= TRUE"); else - printf("2: toggle case_sensitive= FALSE"); cursor(4,1);% printf("3: exit from this menu\n"); printf("q: quit more\n"); while(TRUE){$ cursor(Screen_Height,1);ClrEOL(); switch(getkey()){ case '1':  if(eof_exit) { eof_exit=FALSE; cursor(2,28); printf("FALSE"); }  else{ eof_exit=TRUE; cursor(2,28); printf(" TRUE"); } break; case '2':  if(case_sensitive){ case_sensitive=FALSE; cursor(3,28); printf("FALSE"); } else {  case_sensitive=TRUE; cursor(3,28); printf(" TRUE"); } break; case '3': return; break; case 'q':) /* exit(); No way buster, Mats*/ break; default: putchar('\007'); break; }/*switch*/ fflush(stdin); }/*while*/}&*[MATS.PROG.SWING.C_SWING]DESCRIP.MMS;4+,- . /(< 4J --0123KPWO 56 (= 7ג8gik9`6-G(<HJ! EXE = [.exe] OBJ = [.obj]SRC = []!! The system we're building!!system depends_on $(EXE)swing.exe! dir/date/siz $(EXE)swing.exe;!! Macros!/OBJECTS = $(OBJ)swing.obj, $(OBJ)swing_1.obj, -D $(OBJ)swing_2.obj, $(OBJ)swing_3.obj, $(OBJ)swing_4.obj, -> $(OBJ)swing_5.obj, $(OBJ)swing_6.obj, $(OBJ)swing_7.obj, -E $(OBJ)swing_8.obj, $(OBJ)swing_9.obj, $(OBJ)swing_10.obj, -> $(OBJ)swing_11.obj, $(OBJ)swing_12.obj, $(OBJ)swing_13.obj, -E $(OBJ)swing_14.obj, $(OBJ)swing_15.obj, $(OBJ)swing_16.obj, -E $(OBJ)swing_17.obj, $(OBJ)swing_18.obj, $(OBJ)swing_19.obj, -E $(OBJ)swing_20.obj, $(OBJ)swing_21.obj, $(OBJ)swing_22.obj, -E $(OBJ)swing_23.obj, $(OBJ)swing_24.obj, $(OBJ)swing_25.obj, -E $(OBJ)swing_26.obj, $(OBJ)swing_27.obj, $(OBJ)swing_28.obj, -E $(OBJ)swing_29.obj, $(OBJ)swing_30.obj, $(OBJ)swing_31.obj, -E $(OBJ)swing_32.obj, $(OBJ)swing_33.obj, $(OBJ)swing_34.obj, -; $(OBJ)swing_35.obj, $(OBJ)swing_36.obj, $(OBJ)swing_37.obj!?CFLAGS = /nodebug/opt/define=(VMS_V5)/object=$(OBJ)! LFLAGS = /nodebug/traceback!%$(EXE)swing.exe depends_on $(OBJECTS)J link $(OBJECTS),$(SRC)options_file/opt /exec=$(EXE)swing.exe $(LFLAGS)( @ purge $(EXE)swing.exe/keep=1/nolog$ @ purge $(OBJ)*.obj/keep=1/nolog!9$(OBJ)swing.obj depends_on swing.c, swing.h, swing_defs.h cc swing $(CFLAGS)!=$(OBJ)swing_1.obj depends_on swing_1.c, swing.h, swing_refs.h cc swing_1 $(CFLAGS)!=$(OBJ)swing_2.obj depends_on swing_2.c, swing.h, swing_refs.h cc swing_2 $(CFLAGS)!=$(OBJ)swing_3.obj depends_on swing_3.c, swing.h, swing_refs.h cc swing_3 $(CFLAGS)!=$(OBJ)swing_4.obj depends_on swing_4.c, swing.h, swing_refs.h cc swing_4 $(CFLAGS) !=$(OBJ)swing_5.obj depends_on swing_5.c, swing.h, swing_refs.h cc swing_5 $(CFLAGS) !=$(OBJ)swing_6.obj depends_on swing_6.c, swing.h, swing_refs.h cc swing_6 $(CFLAGS) !=$(OBJ)swing_7.obj depends_on swing_7.c, swing.h, swing_refs.h cc swing_7 $(CFLAGS) !=$(OBJ)swing_8.obj depends_on swing_8.c, swing.h, swing_refs.h cc swing_8 $(CFLAGS) !=$(OBJ)swing_9.obj depends_on swing_9.c, swing.h, swing_refs.h cc swing_9 $(CFLAGS) !?$(OBJ)swing_10.obj depends_on swing_10.c, swing.h, swing_refs.h cc swing_10 $(CFLAGS) !?$(OBJ)swing_11.obj depends_on swing_11.c, swing.h, swing_refs.h cc swing_11 $(CFLAGS) !?$(OBJ)swing_12.obj depends_on swing_12.c, swing.h, swing_refs.h cc swing_12 $(CFLAGS) !?$(OBJ)swing_13.obj depends_on swing_13.c, swing.h, swing_refs.h cc swing_13 $(CFLAGS) !?$(OBJ)swing_14.obj depends_on swing_14.c, swing.h, swing_refs.h cc swing_14 $(CFLAGS) !?$(OBJ)swing_15.obj depends_on swing_15.c, swing.h, swing_refs.h cc swing_15 $(CFLAGS) !?$(OBJ)swing_16.obj depends_on swing_16.c, swing.h, swing_refs.h cc swing_16 $(CFLAGS) !?$(OBJ)swing_17.obj depends_on swing_17.c, swing.h, swing_refs.h cc swing_17 $(CFLAGS) !?$(OBJ)swing_18.obj depends_on swing_18.c, swing.h, swing_refs.h cc swing_18 $(CFLAGS) !?$(OBJ)swing_19.obj depends_on swing_19.c, swing.h, swing_refs.h cc swing_19 $(CFLAGS) !?$(OBJ)swing_20.obj depends_on swing_20.c, swing.h, swing_refs.h cc swing_20 $(CFLAGS) !?$(OBJ)swing_21.obj depends_on swing_21.c, swing.h, swing_refs.h cc swing_21 $(CFLAGS) !?$(OBJ)swing_22.obj depends_on swing_22.c, swing.h, swing_refs.h cc swing_22 $(CFLAGS) !?$(OBJ)swing_23.obj depends_on swing_23.c, swing.h, swing_refs.h cc swing_23 $(CFLAGS) !?$(OBJ)swing_24.obj depends_on swing_24.c, swing.h, swing_refs.h cc swing_24 $(CFLAGS) !?$(OBJ)swing_25.obj depends_on swing_25.c, swing.h, swing_refs.h cc swing_25 $(CFLAGS) !?$(OBJ)swing_26.obj depends_on swing_26.c, swing.h, swing_refs.h cc swing_26 $(CFLAGS) !?$(OBJ)swing_27.obj depends_on swing_27.c, swing.h, swing_refs.h cc swing_27 $(CFLAGS) !?$(OBJ)swing_28.obj depends_on swing_28.c, swing.h, swing_refs.h cc swing_28 $(CFLAGS) !?$(OBJ)swing_29.obj depends_on swing_29.c, swing.h, swing_refs.h cc swing_29 $(CFLAGS) !?$(OBJ)swing_30.obj depends_on swing_30.c, swing.h, swing_refs.h cc swing_30 $(CFLAGS) !?$(OBJ)swing_31.obj depends_on swing_31.c, swing.h, swing_refs.h cc swing_31 $(CFLAGS) !?$(OBJ)swing_32.obj depends_on swing_32.c, swing.h, swing_refs.h cc swing_32 $(CFLAGS) !?$(OBJ)swing_33.obj depends_on swing_33.c, swing.h, swing_refs.h cc swing_33 $(CFLAGS) !?$(OBJ)swing_34.obj depends_on swing_34.c, swing.h, swing_refs.h cc swing_34 $(CFLAGS) !?$(OBJ)swing_35.obj depends_on swing_35.c, swing.h, swing_refs.h cc swing_35 $(CFLAGS) !?$(OBJ)swing_36.obj depends_on swing_36.c, swing.h, swing_refs.h cc swing_36 $(CFLAGS) !?$(OBJ)swing_37.obj depends_on swing_37.c, swing.h, swing_refs.h cc swing_37 $(CFLAGS) !'*[MATS.PROG.SWING.C_SWING]DESCRIPTOR.C;1+,-./(< 4Kv--0123KPWO564@97j g89`6-G(<HJ/*VMS MORE V1.5*/#include descripvoid descriptor();J/*descriptor(): it fills previously declared descriptor. Return nothing */!struct dsc$descriptor_s *descr(); void descriptor(desc,string) struct dsc$descriptor_s *desc;char *string; {0 desc->dsc$w_length=strlen(string); D desc->dsc$b_dtype=DSC$K_DTYPE_T; /* data type code */K desc->dsc$b_class=DSC$K_CLASS_S; /* descriptor class code */= desc->dsc$a_pointer=string; /* address of fBC" SWING_SRC.BCK--'[MATS.PROG.SWING.C_SWING]DESCRIPTOR.C;1K7irst  byte of data element*/}>/* descr() creates character descriptor and return the address#of the descriptor to the caller. */# define N_DESCR 101static struct dsc$descriptor_s str_desc[N_DESCR];static int cur_descr = -1;'struct dsc$descriptor_s *descr (string) char *string;{ ) if(++cur_descr >= N_DESCR) cur_descr=-1;7 str_desc[cur_descr].dsc$w_length=strlen(string); 9 str_desc[cur_descr].dsc$b_dtype=DSC$K_DTYPE_T; 8 str_desc[cur_descr].dsc$b_class=DSC$K_CLASS_S; 6 str_desc[cur_descr].dsc$a_pointer=string;  return (&str_desc[cur_descr]);}#*[MATS.PROG.SWING.C_SWING]DQFDEF.H;1+,c/ ./(< 4--0123KPWO56ᑒ7ג8@bk9`6-G(<HJ#define DQF$M_ACTIVE 1#define DQF$K_LENGTH 32#define DQF$C_LENGTH 32#define DQF$S_DQFDEF 32#define DQF$L_FLAGS 0#define DQF$V_ACTIVE 0#define DQF$L_UIC 4#define DQF$L_USAGE 8#define DQF$L_PERMQUOTA 12#define DQF$L_OVERDRAFT 16&*[MATS.PROG.SWING.C_SWING]EOF_CHECK.C;1+,x/./(< 4.--0123KPWO56`ؼ97F g89`6-G(<HJ/*VMS MORE V1.5*/#define TRUE 1#define FALSE 0extern int end_file,eof_exit;int eof_check(s)char *s;{ standout();. printf("End of File:"); standend(); printf(" %s\n",s); end_file=TRUE; if(eof_exit) return(1); else return(0);}#*[MATS.PROG.SWING.C_SWING]FATDEF.H;1+,/./(< 4?--0123KPWO56`aЎ7 7ג8hk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:06:56.784** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain** ** File : FATDEF.H**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*+** fatdef.h - record attribute definitions*/#define FAT$C_UNDEFINED 0#define FAT$C_FIXED 1#define FAT$C_VARIABLE 2#define FAT$C_VFC 3#define FAT$C_STREAM 4#define FAT$C_STREAMLF 5#define FAT$C_STREAMCR 6#define FAT$C_SEQUENTIAL 0#define FAT$C_RELATIVE 1#define FAT$C_INDEXED 2#define FAT$C_DIRECT 3#define FAT$M_FORTRANCC 1#define FAT$M_IMPLIEDCC 2#define FAT$M_PRINTCC 4#define FAT$M_NOSPAN 8#define FAT$M_STATS 16#define FAT$K_LENGTH 32#define FAT$C_LENGTH 32#define FAT$S_FATDEF 32#define FAT$B_RTYPE 0#define FAT$S_RTYPE 4#define FAT$V_RTYPE 0#define FAT$S_FILEORG 4#define FAT$V_FILEORG 4#define FAT$B_RATTRIB 1#define FAT$V_FORTRANCC 0#define FAT$V_IMPLIEDCC 1#define FAT$V_PRINTCC 2#define FAT$V_NOSPAN 3#define FAT$V_STATS 4#define FAT$W_RSIZE 2#define FAT$L_HIBLK 4#define FAT$W_HIBLKH 4#define FAT$W_HIBLKL 6#define FAT$L_EFBLK 8#define FAT$W_EFBLKH 8#define FAT$W_EFBLKL 10#define FAT$W_FFBYTE 12#define FAT$B_BKTSIZE 14#define FAT$B_VFCSIZE 15#define FAT$W_MAXREC 16#define FAT$W_DEFEXT 18#define FAT$W_GBC 20#define FAT$W_VERSIONS 30#*[MATS.PROG.SWING.C_SWING]FH2DEF.H;1+,/. /(< 4? --0123KPWO 56 xЎ7BCג8qૂk9`6-G(<HJ ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:00.594** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain** ** File : FH2DEF.H**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /* ** fh2def.h*/#define FH2$C_LEVEL1 257#define FH2$C_LEVEL2 512#define FH2$M_NOBACKUP 2#define FH2$M_WRITEBACK 4#define FH2$M_READCHECK 8#define FH2$M_WRITCHECK 16#define FH2$M_CONTIGB 32#define FH2$M_LOCKED 64#define FH2$M_CONTIG 128#define FH2$M_BADACL 2048#define FH2$M_SPOOL 4096#define FH2$M_DIRECTORY 8192#define FH2$M_BADBLOCK 16384#define FH2$M_MARKDEL 32768#define FH2$M_NOCHARGE 65536#define FH2$M_ERASE 131072#define FH2$M_ONLY_RU 1#define FH2$M_RUJNL 2#define FH2$M_BIJNL 4#define FH2$M_AIJNL 8#define FH2$M_ATJNL 16#define FH2$M_NEVER_RU 32#define FH2$M_JOURNAL_FILE 64#define FH2$C_RU_FACILITY_RMS 1 #define FH2$C_RU_FACILITY_DBMS 2#define FH2$C_RU_FACILITY_RDB 3"#define FH2$C_RU_FACILITY_CHKPNT 4#define FH2$K_LENGTH 80#define FH2$C_LENGTH 80#define FH2$K_SUBSET0_LENGTH 88#define FH2$C_SUBSET0_LENGTH 88#define FH2$K_FULL_LENGTH 108#define FH2$C_FULL_LENGTH 108#define FH2$S_FH2DEF 512#define FH2$B_IDOFFSET 0#define FH2$B_MPOFFSET 1#define FH2$B_ACOFFSET 2#define FH2$B_RSOFFSET 3#define FH2$W_SEG_NUM 4#define FH2$W_STRUCLEV 6#define FH2$B_STRUCVER 6#define FH2$B_STRUCLEV 7#define FH2$S_FID 6#define FH2$W_FID 8#define FH2$W_FID_NUM 8#define FH2$W_FID_SEQ 10#define FH2$W_FID_RVN 12#define FH2$B_FID_RVN 12#define FH2$B_FID_NMX 13#define FH2$S_EXT_FID 6#define FH2$W_EXT_FID 14#define FH2$W_EX_FIDNUM 14#define FH2$W_EX_FIDSEQ 16#define FH2$W_EX_FIDRVN 18#define FH2$B_EX_FIDRVN 18#define FH2$B_EX_FIDNMX 19#define FH2$S_RECATTR 32#define FH2$W_RECATTR 20#define FH2$L_FILECHAR 52#define FH2$V_NOBACKUP 1#define FH2$V_WRITEBACK 2#define FH2$V_READCHECK 3#define FH2$V_WRITCHECK 4#define FH2$V_CONTIGB 5#define FH2$V_LOCKED 6#define FH2$V_CONTIG 7#define FH2$V_BADACL 11#define FH2$V_SPOOL 12#define FH2$V_DIRECTORY 13#define FH2$V_BADBLOCK 14#define FH2$V_MARKDEL 15#define FH2$V_NOCHARGE 16#define FH2$V_ERASE 17#define FH2$W_RECPROT 56#define FH2$B_MAP_INUSE 58#define FH2$B_ACC_MODE 59#define FH2$L_FILEOWNER 60#define FH2$W_UICMEMBER 60#define FH2$W_UICGROUP 62#define FH2$W_FILEPROT 64#define FH2$S_BACKLINK 6#define FH2$W_BA`VM\" SWING_SRC.BCK/-#[MATS.PROG.SWING.C_SWING]FH2DEF.H;1? CKLINK 66#define FH2$W_BK_FIDNUM 66#define FH2$W_BK_FIDSEQ 68#define FH2$W_BK_FIDRVN 70#define FH2$B_BK_FIDRVN 70#define FH2$B_BK_FIDNMX 71#define FH2$B_JOURNAL 72#define FH2$V_ONLY_RU 0#define FH2$V_RUJNL 1#define FH2$V_BIJNL 2#define FH2$V_AIJNL 3#define FH2$V_ATJNL 4#define FH2$V_NEVER_RU 5#define FH2$V_JOURNAL_FILE 6#define FH2$B_RU_ACTIVE 73#define FH2$L_HIGHWATER 76#define FH2$S_CLASS_PROT 20#define FH2$R_CLASS_PROT 88#define FH2$W_CHECKSUM 510#*[MATS.PROG.SWING.C_SWING]FM2DEF.H;1+,0 ./(< 4?T--0123KPWO56 2bЎ7wOג8@mk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:05.064** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain** ** File : FM2DEF.H**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** header defs*/#define FM2$C_PLACEMENT 0#define FM2$C_FORMAT1 1#define FM2$C_FORMAT2 2#define FM2$C_FORMAT3 3#define FM2$K_LENGTH0 2#define FM2$C_LENGTH0 2#define FM2$K_LENGTH1 4#define FM2$C_LENGTH1 4#define FM2$S_FM2DEF 4#define FM2$W_WORD0 0#define FM2$S_FORMAT 2#define FM2$V_FORMAT 14#define FM2$V_EXACT 0#define FM2$V_ONCYL 1#define FM2$V_LBN 12#define FM2$V_RVN 13#define FM2$S_HIGHLBN 6#define FM2$V_HIGHLBN 8#define FM2$S_COUNT2 14#define FM2$V_COUNT2 0#define FM2$B_COUNT1 0#define FM2$W_LOWLBN 2#define FM2$K_LENGTH2 6#define FM2$C_LENGTH2 6#define FM2$S_FM2DEF1 6#define FM2$L_LBN2 2#define FM2$K_LENGTH3 8#define FM2$C_LENGTH3 8#define FM2$S_FM2DEF2 8#define FM2$W_LOWCOUNT 2#define FM2$L_LBN3 4#*[MATS.PROG.SWING.C_SWING]GETINT.C;4+,0./(< 4>--0123KPWO56CJÂg7OjÂg89`6-G(<HJ/*VMS MORE V1.5;getint(): gets digits, ignoring all other ASCII characters.Delete key works.*/extern int Screen_Height;#include ctype int getint(){ char tmp[10]; int i=0; cursor(Screen_Height,1); while((tmp[i]=getkey())!='\r'){  if(isdigit(tmp[i])){ putchar(tmp[i++]); continue; } else if( tmp[i]=='\177') { if(i!=0){ i--; printf("\b \b"); } }, else if( (tmp[i]=='r') || (tmp[i]=='R') ){ return(-1); } else if( tmp[i]==' '){ return(10000); } else{> if( (tmp[i] =='q') || (tmp[i]=='Q') || (tmp[i]=='\032') ) break;3 /* No way ,Mats exit(); */ } } tmp[++i]='\0'; return(atoi(tmp)); } #*[MATS.PROG.SWING.C_SWING]HLPDEF.H;1+,0 ./(< 4?--0123KPWO56DЎ7 3]ג8iTk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:09.714** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain** ** File : HLPDEF.H**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ #define HLP$M_PROMPT 1#define HLP$M_PROCESS 2#define HLP$M_GROUP 4#define HLP$M_SYSTEM 8#define HLP$M_LIBLIST 16#define HLP$M_HELP 32#define HLP$M_SPARE1 64#define HLP$M_SPARE2 128#define HLP$M_PAGE 256#define HLP$M_OUTPUT 512#define HLP$M_LIBRARY 1024#define HLP$M_ALL 2048#define HLP$M_PAGEDEF 4096#define HLP$M_PMPTDEF 8192#define HLP$M_NOTTERM 16384#define HLP$S_HLPDEF 2#define HLP$R_HLPDEF_BITS 0#define HLP$V_PROMPT 0#define HLP$V_PROCESS 1#define HLP$V_GROUP 2#define HLP$V_SYSTEM 3#define HLP$V_LIBLIST 4#define HLP$V_HELP 5#define HLP$V_SPARE1 6#define HLP$V_SPARE2 7#define HLP$V_PAGE 8#define HLP$V_OUTPUT 9#define HLP$V_LIBRARY 10#define HLP$V_ALL 11#define HLP$V_PAGEDEF 12#define HLP$V_PMPTDEF 13#define HLP$V_NOTTERM 14#define HLP$M_NOHLPTXT 1#define HLP$M_KEYNAMLIN 2#define HLP$M_OTHERINFO 4#define HLP$S_HLPDEF1 16#define HLP$L_DESC 0#define HLP$R_FLAGS_OVERLAY 4#define HLP$L_FLAGS 4#define HLP$R_FLAGS_BITS 4#define HLP$V_NOHLPTXT 0#define HLP$V_KEYNAMLIN 1#define HLP$V_OTHERINFO 2#define HLP$L_DATA 8#define HLP$L_LEVEL 12&*[MATS.PROG.SWING.C_SWING]LINK_V5.COM;7+,S./(< 4T4--0123KPWO56r07089G(<HJ $ set ver$ define OBJ [.obj]$ define EXE [.exe]$ define SRC []$!;$ link/nomap OBJ:swing.obj, OBJ:swing_1.obj,OBJ:localfix, -> OBJ:swing_2.obj, OBJ:swing_3.obj, OBJ:swing_4.obj, -8 OBJ:swing_5.obj, OBJ:swing_6.obj, OBJ:swing_7.obj, -? OBJ:swing_8.obj, OBJ:swing_9.obj, OBJ:swing_10.obj, -8 OBJ:swing_11.obj, OBJ:swing_12.obj, OBJ:swing_13.obj, -? OBJ:swing_14.obj, OBJ:swing_15.obj, OBJ:swing_16.obj, -? OBJ:swing_17.obj, OBJ:swing_18.obj, OBJ:swing_19.obj, -? OBJ:swing_20.obj, OBJ:swing_21.obj, OBJ:swing_22.obj, -? OBJ:swing_23.obj, OBJ:swing_24.obj, OBJ:swing_25.obj, -? OBJ:swing_26.obj, OBJ:swing_27.obj, OBJ:swing_28.obj, -? OBJ:swing_29.obj, OBJ:swing_30.obj, OBJ:swing_31.obj, -? OBJ:swing_32.obj, OBJ:swing_33.obj, OBJ:swing_34.obj, -: OBJ:swing_35.obj, OBJ:swing_36.obj, OBJ:swing_37.obj, - R OBJ:swing_38.obj, OBJ:config.obj, OBJ:descriptor.obj, OBJ:eof_check.obj, -T OBJ:getint.obj, OBJ:listfile.obj, OBJ:main.obj, OBJ:map.obj, OBJ:more.obj, -K OBJ:more_help.obj, OBJ:prline.obj, OBJ:prwindow.obj, OBJ:reg.obj, -J OBJ:spawn.obj, OBJ:string.obj, OBJ:termio.obj, OBJ:unix2vms.obj, -2 SRC:options_file/opt /exec=EXE:swing.exe /nodebug$!$ dir/siz/date EXE:swing.exe $ set nover`o" SWING_SRC.BCK0-%[MATS.PROG.SWING.C_SWING]LISTFILE.C;119%*[MATS.PROG.SWING.C_SWING]LISTFILE.C;1+,0./(< 41--0123KPWO56h97 g89`6-G(<HJ/*VMS MORE V1.5*/#define MAXFILES 200extern char *nargv[MAXFILES+1];.extern int nargc,narrow,ithfile,Screen_Height;static int get_response(); int first=1;int listfile(){  int i=1,ret,tmpct=0; clrs(); while(i<=nargc){ tmpct++; lower_str(nargv[i]);' printf("%d %s\n",i,nargv[i]); if(tmpct==(Screen_Height-6)) { tmpct=0; /*reset counter*/ switch(ret=get_response()){ case 0: case 1:  return(0); break; /*no use*/' case 10000: /*space*/  clrs(); break; default: return(ret); }/*switch*/ }/*if*/ i++; }/*while*/ first=0; switch(ret=get_response()){ case 0: case 1:  return(0); break; /*no use*/' case 10000: /*space*/" return(0); break; default: return(ret); }/*switch*/ }/*listfile*/static int get_response(){ int tmp;1 printf("\nr Return to more\n"); if(first){ first=0;+ printf("SPACE next page\n"); }* printf("q or ctrl-Z Exit from MORE\n");0 printf("Make your choice and press "); tmp=getint();0 if( ((tmp<-1) || (tmp>nargc)) && (tmp!=10000)){0 printf("\nNot valid selection. Try again.\n"); sleep(1); listfile(); } else{ if(tmp==0){ return(0); } else if (tmp==(-1)){ return(0); } else if (tmp==10000){ return(10000); } else{ ithfile=tmp; return(tmp); } }}%*[MATS.PROG.SWING.C_SWING]LOCALFIX.C;1+,./(< 4D$--0123KPWO56 N07@Ӻ089G(<HJ/* ** Localfix.c*/#include #include #include #include /*** sys_getenv()2** get the logical name or symbol translationC** capitalize everything before it gets passed into getenv(), since2** VMS capitalize all its logical name and symbols2** returns a NULL if it doesn't have a translation*/char *sys_getenv(char *input){ int i; for (i=0;input[i];i++)D if (islower((int)input[i])) input[i] = (char) toupper(input[i]);" return( (char *) getenv(input));}%*[MATS.PROG.SWING.C_SWING]LOCALFIX.H;1+,!./(< 4<--0123KPWO5607,1089G(<HJ/* ** Localfix.h*//*<** adding some local printing options to suit Rutgers' setup*/$#define PRINTQUE_LOGNM "swing$print"##define PRINTQUE_DEF "Hill$lps40"##define BIN_LOGNM "BIN-NUMBER"#define BIN_NUMBER_DEF "H01A"$extern char* sys_getenv(char *name);!*[MATS.PROG.SWING.C_SWING]MAIN.C;5+,0. /(< 4O --0123KPWO 56 fg7` gg89`6-G(<HJD/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - VMS MORE: V1.50 Author: Xuning Shan Dept. of Chemical Engineering The Johns Hopkins Univ. Email : ins_bxs@jhuvms.BITNET shan%che2@jhmail.hcf.jhu.edu= Documentation and modification histroy is in file more.doc  */#include "main.h"more_less(argc, argv) int argc; char **argv;{ int i, j , first=1; char *pn, file_found; FILE *fp;9 /* next few lines to deal with lib$find_file() */" static char name[MAXNAME];! $DESCRIPTOR(result,name);, struct dsc$descriptor_s name_desc;  long context;= Terminal_Open(); /*create virtual keyboard and more*/F if(argc==1){ /*if no file, prompt for it */# argv[1]=malloc(40); printf("File:");$ scanf("%s",argv[1]); argc++; } lower_str(argv[1]);H if( (strcmp(argv[1],"-c")==0) || (strncmp(argv[1],"/c",2)==0) ){ flag=TRUE; first=2; if(argc==2){+ argv[2]=malloc(40);( printf("File:");, scanf("%s",argv[2]); argc++; } }F for (i = first, nargc = 0; i < argc && nargc <= MAXFILES; i++) { context = 0;#ifdef UNIX_TO_VMS; if (strchr (argv[i], '/') != (char *) NULL)@ argv[i] = convert_unix_to_vms (argv[i]);#endif UNIX_TO_VMS/ descriptor(&name_desc,argv[i]);# file_found = FALSE;H while (lib$find_file(&name_desc, &result, &context) & 1) {* file_found = TRUE;/ if (nargc >= MAXFILES){O fprintf(stderr, "Only %d files will be read\n",* MAXFILES);& break; }L nargv[++nargc] = malloc((unsigned)strlen(name) + 1);C strcpy(nargv[nargc], result.dsc$a_pointer); lower_str(nargv[nargc]); } if (!file_found)M fprintf (stderr, "Couldn't find file %s\n", argv[i]);, lib$find_file_end(&context); } for (i=1; i<=nargc; i++) {9 if ((fp = fopen(nargv[i], "r")) == NULL){) perror(nargv[i]);! continue; }& curfile=i; /*remember current file*/D for (pn = nargv[i]; *pn != EOS && *pn != ']'; pn++);E if (*pn == ']') pn++; /*get file name without path*/ maptomemory(fp);, line_pt=1; /*move pointer to first line */$ switch(more(fp, pn)) { 9 case 112: /* ASCII p: previous file */0 if((i==1) ||(nargc==1)){# ClrEOL();% standout();8 printf("No previous file.\n");% standend(); i--;A printf("press any key to continue...");# getkey(); } else{8 i -=2; /*reset file counter *// ClrEOL(); standout();3 Q" SWING_SRC.BCK0-![MATS.PROG.SWING.C_SWING]MAIN.C;5O eR printf("Previous file:");% standend();4 printf("%s\n",nargv[i+1]);A printf("press any key to continue...");# getkey(); } break;7 case 101: /* ASCII e: end of file */- ClrEOL(); standout();/ printf("End of File:");# standend();0 printf("%s\n",nargv[i]);? printf("press any key to continue...");! getkey();' /* if(i!=nargc){G printf("press any key to continue...");) getkey();8 } I like it to hold, MATS */ break; case 100: /* ith file */ ClrEOL(); standout(); printf("%dth file:",ithfile); standend();" printf(" %s\n",nargv[ithfile]);* printf("Press any key to continue..."); getkey(); i=ithfile-1; break; default:$ if(i=line_end) return ((char *)NULL); strcpy(str,lpt[line_pt]); line_pt++; return(str);}int bgetline(str) char *str;{ if(line_pt<1){ line_pt=1; return ((char *)NULL); }- if(line_pt>=line_end) return ((char *)NULL); strcpy(str,lpt[line_pt]); line_pt--; return(str);}int dgetline(str,d) char *str;int d;{ if(d>0) /*forward*/ return(fgetline(str));  else /*backward */ return(bgetline(str));} releasemem(){ int i=1;# while(i if (prwindow(Screen_Height - 1)==NULL) if(eof_check(fname)) return; break; case 'd': case 'D': no_clrs=TRUE; ? if (prwindow(Screen_Height / 2)==NULL){ no_clrs=FALSE;; eof_check(fname); } no_clrs=FALSE; break; case 's':  case 'S': /*skip forward*/# standout();@ printf("\nSkipping forward %d lines.\n",6 factor * (Screen_Height - 1));# standend();. for(i=1; i<=factor*(Screen_Height-1); i++){< if (fgetline(a_line)==NULL){# if(eof_check(fname)) return; break; } }! factor=1;> if (prwindow(Screen_Height - 1)==NULL) if(eof_check(fname)) return; break; case '/': case '?':. case 311: /*find key: for vt100 terminal */! ClrEOL();! if( (ch=='/') || (ch==311) ){& putchar('/'); direction=1; } if(ch=='?'){ putchar('?'); direction=(-1);  } - get_pattern(pattern);) if(( ch=='?') && (pattern[0]=='\0') ){& more_help ();& line_pt=line_pt-(Screen_Height-1);? if (prwindow(Screen_Height - 1)==NULL) if(eof_check(fname))return; break; } case 'n': case 'N': #ifdef REXPRESSIONS2 if(pmsg=re_comp(pattern)){ more_message(pmsg);& break; }#endif REXPRESSIONS8 if( ((ch=='n') || (ch=='N')) && (pattern[0]=='\0') ){, more_message("No previous pattern!"); break; } search=TRUE; line_pt_save=line_pt;+ if(direction<0){ /*skip current screen*/( line_pt=line_pt-(Screen_Height)-1; if(line_pt<=0){ line_pt=line_pt_save;) more_message("At top of the file!"); break; } }, while (dgetline(a_line,direction)!=NULL){: if (find(pattern,a_line)){ pat_found=TRUE; break; } } if(pat_found){ pat_found=FALSE;" ClrEOL();% standout ();- printf("%s",a_line);% standend ();& if(direction<0) line_pt=line_pt+2;? if (prwindow(Screen_Height - 2)==NULL) if(eof_check(fname))return; break; } else { line_pt=line_pt_save; ClrEOL();% more_message("String not found"); break; } case 't': case 'T': line_pt=1;> if (prwindow(Screen_Height - 1)==NULL) if(eof_check(fname))return; break; case 'b': case 'B':, case 315: /*prev_screen: vt100 terminal*/ if(end_file){4 line_pt=line_pt-(Screen_Height-1); end_file=FALSE; }else; line_pt=line_pt-(1+factor)*(Screen_Height-1);> if (prwindow(Screen_Height - 1)==NULL) if(eof_check(fname))return;! factor=1; break; case 'h': case 'H':% more_help ();% line_pt=line_pt-(Screen_Height-1);> if (prwindow(Screen_Height - 1)==NULL) if(eof_check(fname))return; break; case 'g': case 'G': ClrEOL();putchar('g'); line_pt_save=line_pt; line_pt=getint(); line_pt=line_pt<=0?1:line_pt; if(line_pt>=line_end){. more_message("Line number is too large!"); line_pt=line_pt_save; break; }> if (prwindow(Screen_Height - 1)==NULL); if(eof_check(fname))return; break; case '%': ClrEOL();putchar('%'); line_pt=(int)7 ( (double)getint()*(double)line_end/(double)100);% line_pt=line_pt-(Screen_Height-1); line_pt=line_pt<=0?1:line_pt;> if (prwindow(Screen_Height - 1)==NULL); if(eof_check(fname))return; break; case 'm': case 'M': line_mark=line_pt-1; break; case '\007': case '\047': if(line_mark==0) {1 more_message("You have to mark line first!"); break; } else  line_pt=line_mark;> if (prwindow(Screen_Height - 1)==NULL); if(eof_check(fname))return; break; case '\014': /* ^L */ % line_pt=line_pt-(Screen_Height-1); clrs();> if (prwindow(Screen_Height - 1)==NULL); if(eof_check(fname))return; break; case '\027': /*ctr-w */ if(narrow) { Screen_Width=132; if(set_width(Screen_Width)) narrow=FALSE; } else { Screen_Width=80; set_width(Screen_Width); narrow=TRUE; } % line_pt=line_pt-(Screen_Height-1);> if (prwindow(Screen_Height - 1)==NULL); if(eof_check(fname))return; break; case 'l': case 'L':" if(listfile()!=0) return(100);% line_pt=line_pt-(Screen_Height-1);' if( prwindow(Screen_Height-1)==NULL) if(eof_check(fname))return; break; case '!':( spawn(); clrs();% line_pt=line_pt-(Screen_Height-1);> if (prwindow(Screen_Height - 1)==NULL)9 if(eof_check(fname))return; break; case '#':> return(110); /* ASCII n : next file */ case 'q': case 'Q':& putchar('\n'); if(!narrow) narrow_width();" return(0); break;$ /* No way buster, MATS exit(); */ case '\032':$ /* No way buster, MATS exit(); */" return(0); break; /*for clarity */ case '=':( cursor(Screen_Height,Screen_Width/2); standout(); printf("%d",line_pt-1); standend(); break; case 'E': case 'e': { char *ptr,*cmd; cmd=malloc(80); ptr=getenv("MOREEDIT");* if(ptr!=NULL){ /*use this editor */ strcat(cmd, ptr); strcat(cmd, " "); } else {#ifdef VMSV5 A sprintf(cmd,"edit/tpu/start=(%d) ",line_pt-Screen_Height+1);#else! strcat(cmd,"edit/tpu "); #endif VMSV5 }" strcat(cmd, nargv[curfile]); putchar('\r');ClrEOL();;- printf("Spawning editing process....");! lib$do_command(descr(cmd)); }% line_pt=line_pt-(Screen_Height-1); clrs();> if (prwindow(Screen_Height - 1)==NULL); if(eof_check(fname))return; break;/* : commands*/ case ':':- ch=tolower(getkey());K if(ch=='p') return (112);/*ACCII p previous file */E if(ch=='n') return(110);/*ASCII n next file*/ if(ch=='f') { ClrEOL();printf(":f"); ithfile=getint(); if(ithfile>nargc){ standout();! printf("\007No such file!"); standend(); getkey(); }2 else return(100); /*will check the actuall #*/ } break;  default:( putchar('\007'); break; } } } /* more */D e" SWING_SRC.BCK0 -![MATS.PROG.SWING.C_SWING]MORE.H;1>$!*[MATS.PROG.SWING.C_SWING]MORE.H;1+,0 ./(< 4>z--0123KPWO56]97@ g89`6-G(<HJ)/* include files and global variables */#include stdio#include ctype#include string#include descrip #include stat #define TRUE 1#define FALSE 0#define BELL '\007' #define EOS '\0' #define MAXNAME 254#define MAXWINDOWS 200#define MAXFILES 200#define MAXLINES 10000 char Terminal_Open(); void clrs();void cursor();void narrow_width();int set_width();int getkey();void ClrEOL();int scroll_r();void standend();void descriptor();!struct dsc$descriptor_s *descr();void standout();int getint();#ifdef UNIX_TO_VMSchar *convert_unix_to_vms();#endif UNIX_TO_VMSchar *malloc(); int more();char *prwindow();char *prline();void lower_str();void conv_nonprt();void config();void message();int listfile();int str_lines();int search=FALSE;3int Screen_Height = 24; /* may be changed below */int Screen_Width = 80;extern char *nargv[MAXFILES+1];>extern int line_pt,line_end,curfile,ithfile,narrow,flag,nargc; int line_pt_save,line_mark=0;+char *fgetline(),*bgetline(),*dgetline();#int no_clrs=FALSE,end_file=FALSE;)*[MATS.PROG.SWING.C_SWING]MORE_DESCRIP.H;1+,0 . /(< 4B --0123KPWO 56/Ў7#wג8Ьk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:13.164** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**&** File : MORE_DESCRIP.H**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*;** Here are some shorthands for VMS structures as used in C** Use of each is as follows**<** $DESCRIPTORl is used for single char items or structures?** $DESCRIPTORM is used for strings which are not necessarilly#** terminated by the null character#** $DESCRIPTORA is used for arrays-** $DESCRIPTORI is used for a single integer**4** DSC1, DSC2, DSC3 are shorthands for use in C code2** DSCP is for pointers to null terminated strings**** for DSC1, DSC2, DSC3)** use e.g. DSC1("here is a test string")** ** for DSCP ** use e.g. ** ** char *ptr; ** DSCP(ptr)**B** mandatory include of descrip.h (in sys$library) if it's not yet** been included*/#ifndef DSC$K_DTYPE_T#include descrip#endif7#define $DESCRIPTORl(nam,str) struct dsc$descriptor_s \9nam = { sizeof(str), DSC$K_DTYPE_T, DSC$K_CLASS_S, &str }7#define $DESCRIPTORM(nam,str) struct dsc$descriptor_s \8nam = { sizeof(str), DSC$K_DTYPE_T, DSC$K_CLASS_S, str }7#define $DESCRIPTORI(nam,var) struct dsc$descriptor_s \8nam = { sizeof(var), DSC$K_DTYPE_L, DSC$K_CLASS_S, &var}<#define $DESCRIPTORA(nam,arr,type) struct dsc$descriptor_a \;nam = { sizeof (type), DSC$K_DTYPE_L, DSC$K_CLASS_A, arr, \(0, 0, { 0, 0, 0, 0, 0 }, 1, sizeof arr }##define _MLEN(des) des.dsc$w_length$#define _MPTR(des) des.dsc$a_pointerstatic struct dsc$descriptor_s7 _tmp_descr_1 = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 },7 _tmp_descr_2 = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 },7 _tmp_descr_3 = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 },7 _tmp_descr_4 = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 },7 _tmp_descr_5 = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 },7 _tmp_descr_6 = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 },7 _tmp_descr_p = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 },7 _tmp_descr_p1= { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 },7 _tmp_descr_p2= { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 },7 _tmp_descr_p3= { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 },7 _tmp_descr_a = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 },7 _tmp_descr_a1= { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 },7 _tmp_descr_a2= { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 },7 _tmp_descr_a3= { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 };8#define DSC1(str) (_MLEN (_tmp_descr_1) = strlen (str),\+ _MPTR (_tmp_descr_1) = str, &_tmp_descr_1)8#define DSC2(str) (_MLEN (_tmp_descr_2) = strlen (str),\+ _MPTR (_tmp_descr_2) = str, &_tmp_descr_2)8#define DSC3(str) (_MLEN (_tmp_descr_3) = strlen (str),\+ _MPTR (_tmp_descr_3) = str, &_tmp_descr_3)8#define DSC4(str) (_MLEN (_tmp_descr_4) = strlen (str),\+ _MPTR (_tmp_descr_4) = str, &_tmp_descr_4)8#define DSC5(str) (_MLEN (_tmp_descr_5) = strlen (str),\+ _MPTR (_tmp_descr_5) = str, &_tmp_descr_5)8#define DSC6(str) (_MLEN (_tmp_descr_6) = strlen (str),\+ _MPTR (_tmp_descr_6) = str, &_tmp_descr_6)8#define DSCP(ptr) (_MLEN (_tmp_descr_p) = strlen (ptr),\+ _MPTR (_tmp_descr_p) = ptr, &_tmp_descr_p):#define DSCP1(ptr) (_MLEN (_tmp_descr_p1) = strlen (ptr),\- _MPTR (_tmp_descr_p1) = ptr, &_tmp_descr_p1):#define DSCP2(ptr) (_MLEN (_tmp_descr_p2) = strlen (ptr),\- _MPTR (_tmp_descr_p2) = ptr, &_tmp_descr_p2):#define DSCP3(ptr) (_MLEN (_tmp_descr_p3) = strlen (ptr),\- _MPTR (_tmp_descr_p3) = ptr, &_tmp_descr_p3)8#define DSCA(str) (_MLEN (_tmp_descr_a) = sizeof (str),\+ _MPTR (_tmp_descr_a) = str, &_tmp_descr_a):#define DSCA1(str) (_MLEN (_tmp_descr_a1) = sizeof (str),\- _MPTR (_tmp_descr_a1) = str, &_tmp_descr_a1):#define DSCA2(str) (_MLEN (_tmp_descr_a2) = sizeof (str),\- _MPTR (_tmp_descr_a2) = str, &_tmp_descr_a2):#define DSCA3(str) (_MLEN (_tmp_descr_a3) = sizeof (str),\- _MPTR (_tmp_descr_a3) = str, &_tmp_descr_a3)&*[MATS.PROG.SWING.C_SWING]MORE_HELP.C;1+,0./(< 4L--0123KPWO5697< g89`6-G(<HJ/*VMS MORE V1.5*/#include stdio&extern int Screen_Height,Screen_Width;static *help[]={-", f, ctrl-v next screen",/"b skip backward",+", +, j,ctrl-n,down arrow next line",4"-, ctrl-p, k, up arrow scroll up one line",0"c configure more",/"d half a screen",1"e starting editor",6"g# go to specified line",4"h, ? print this message",L"l list of files in buffer and select to read",@"m mark current line(bottom line)",4"n repeat last search",&"q, ctrl-Z quit",7"s skip over next screen",1"t top of the file",5". repeat last command",;"= print current line number",3"^ ~ڥ" SWING_SRC.BCK0-&[MATS.PROG.SWING.C_SWING]MORE_HELP.C;1LOG, ' go to marked line",/"^L redraw screen",C"^W toggle narrow/wide screen display",/":p previous file",+":n, # next file",*":f# #th file",>"%# go to # per cent of the file",2"! spawn subprocess",0"/string search forward",1"?string search backward",NULL };static int ct=0; more_help(){ int i=1; clrs();&/*I have to put them in two screen!!!!1Otherwise the next screen has only a few lines.*/ printf("\n\n"); while( i--0123KPWO56J$~17{r$~189G(<HJsys$share:vaxcrtl.exe/shareIDENTIFICATION="SWING V3.3 MA"#*[MATS.PROG.SWING.C_SWING]PRLINE.C;1+,2 ./(< 4--0123KPWO56`P97 g89`6-G(<HJ/*VMS MORE V1.5*/#define NULL (char *)0char *prline(factor){ int i=1; char str[500]; while(i<=factor){ if(fgetline(str)!=NULL){ printf("%s",str); } else { return (NULL); } i++; } return ((char *)1);}%*[MATS.PROG.SWING.C_SWING]PRWINDOW.C;1+,2 ./(< 44v--0123KPWO5697@ g89`6-G(<HJ/*VMS MORE V1.5*/#define NULL (char *)0#define FALSE 0#define TRUE 1extern int search,no_clrs,flag;char *prwindow(height) int height;{ int i=0; char str[240];  ClrEOL();4 if(flag && (!search) &&(!no_clrs) ) clrs(); if(search) search=FALSE; while (i < height) {+ if (fgetline(str) != NULL){" conv_nonprt(str);# printf("%s", str);& i += str_lines (str); } else { return((char *)0); } } return ((char *)1);} /* prwindow */ *[MATS.PROG.SWING.C_SWING]REG.C;1+,#3.3/(< 4P32--0123KPWO456 97  g89`6-G(<HJ/* This file was from: Gerben Jansen,$ SARA (Academic Computing Services), Amsterdam.& Bitnet: gerben@hasara5.bitnet  Surfnet: sara5::gerben Internet: gerben@sara.nl- Pattern-match search added by Gerben Jansen. ---X. Shan /*/*> * regex - Regular expression pattern matching and replacementD * By: Ozan S. Yigit (oz) Dept. of Computer Science York UniversityN * These routines are the PUBLIC DOMAIN equivalents of regex routines as found) * in 4.nBSD UN*X, with minor extensions.L * These routines are derived from various implementations found in software< * tools books, and Conroy's grep. They are NOT derived fromJ * licensed/restricted software. For more interesting/academic/complicatedM * implementations, see Henry Spencer's regexp routines, or GNU Emacs pattern * matching module.E * Routines: re_comp: compile a regular expression into a DFA. * char *re_comp(s) char *s;6 * re_exec: execute the DFA to match a pattern. * int re_exec(s) char *s;L * re_modw change re_exec's understanding of what a "word" looks likeB * (for \< and \>) by adding into the hidden word-character table. * void re_modw(s) char *s;? * re_subs: substitute the matched portions in a new string.. * int re_subs(src, dst) char *src; char *dst;+ * re_fail: failure routine for re_exec., * void re_fail(msg, op) char *msg; char op; * Regular Expressions:O * [1] char matches itself, unless it is a special character (metachar): * . \ [ ] * + ^ $) * [2] . matches any character.P * [3] \ matches the character following it, except when followed by aG * left or right round bracket, a digit 1 to 9 or a left or right angleL * bracket. (see [7], [8] and [9]) It is used as an escape character for allM * other meta-characters, and itself. When used in a set ([4]), it is treated * as an ordinary character.I * [4] [set] matches one of the characters in the set. If the firstH * character in the set is "^", it matches a character NOT in the set. AL * shorthand S-E is used to specify a set of characters S upto E, inclusive.L * The special characters "]" and "-" have no special meaning if they appear9 * as the first chars in the set. examples: match: * [a-z] any lowercase alpha# * [^]-] any char except ] and -+ * [^A-Z] any char except uppercase alpha * [a-zA-Z] any alphaN * [5] * any regular expression form [1] to [4], followed by closure6 * char (*) matches zero or more matches of that form.> * [6] + same as [5], except it matches one or more.L * [7] a regular expression in the form [1] to [10], enclosed asK * \(form\) matches what form matches. The enclosure creates a set of tags,I * used for [8] and for pattern substution. The tagged forms are numbered * starting from 1.O * [8] a \ followed by a digit 1 to 9 matches whatever a previously+ * tagged regular expression ([7]) matched.N * [9] \< a regular expression starting with a \< construct \> and/orD * ending with a \> construct, restricts the pattern matching to theK * beginning of a word, and/or the end of a word. A word is defined to be aK * character string beginning and/or ending with the characters A-Z a-z 0-9K * and _. It must also be preceded and/or followed by any character outside * those mentioned.M * [10] a composite regular expression xy where x and y are in theM * form [1] to [10] matches the longest match of x followed by a match for y.L * [11] ^ a regular expression starting with a ^ character $ and/orM * ending with a $ character, restricts the pattern matching to the beginningM * of the line, or the end of line. [anchors] Elsewhere in the pattern, ^ and( * $ are treated as ordinary characters. * Acknowledgements:P * HCR's Hugh Redelmeier has been most helpful in various stages of development.L * He convinced me to include BOW and EOW constructs, originally invented by) * Rob Pike at the University of Toronto.N * Referp |8" SWING_SRC.BCK#3- [MATS.PROG.SWING.C_SWING]REG.C;1P3i"  ences: Software tools Kernighan & Plauger Software tools inJ * Pascal Kernighan & Plauger Grep [rsx-11 C dist] DavidK * Conroy ed - text editor Un*x Programmer's Manual Advanced editingF * on Un*x B. W. Kernighan RegExp routines Henry Spencer * Notes:N * This implementation uses a bit-set representation for character classes forG * speed and compactness. Each character is represented by one bit in aJ * 128-bit block. Thus, CCL or NCL always takes a constant 16 bytes in theG * internal dfa, and re_exec does a single bit comparison to locate the * character in the set. * Examples:K * pattern: foo*.* compile: CHR f CHR o CLO CHR o END CLO ANY END END0 * matches: fo foo fooo foobar fobar foxx ...M * pattern: fo[ob]a[rz] compile: CHR f CHR o CCL 2 o b CHR a CCL bitset* * END matches: fobar fooar fobaz fooazK * pattern: foo\\+ compile: CHR f CHR o CHR o CHR \ CLO CHR \ END END% * matches: foo\ foo\\ foo\\\ ...N * pattern: \(foo\)[1-3]\1 (same as foo[1-3]foo) compile: BOT 1 CHR fM * CHR o CHR o EOT 1 CCL bitset REF 1 END matches: foo1foo foo2foo foo3fooP * pattern: \(fo.*\)-\1 compile: BOT 1 CHR f CHR o CLO ANY END EOT 1 CHR -@ * REF 1 END matches: foo-foo fo-fo fob-fob foobar-foobar ... * */#define MAXDFA 1024#define MAXTAG 10#define OKP 1#define NOP 0#define CHR 1#define ANY 2#define CCL 3#define NCL 4#define BOL 5#define EOL 6#define BOT 7#define EOT 8#define BOW 9#define EOW 10#define REF 11#define CLO 12#define END 0G/* * The following defines are not meant to be changeable. They are for * readibility only. */#define MAXCHR 128#define CHRBIT 8#define BITBLK MAXCHR/CHRBIT#define BLKIND 0170#define BITIND 07#define ASCIIB 0177!typedef /* unsigned */ char CHAR;@noshare static int tagstk[MAXTAG]; /* subpat tag stack.. */7noshare static CHAR dfa[MAXDFA];/* automaton.. */7noshare static int sta = NOP; /* status of lastpat */?noshare static CHAR bittab[BITBLK]; /* bit table for CCL */noshare static voidnoshare chset(c)register CHAR c;{; bittab[((c) & BLKIND) >> 3] |= 1 << ((c) & BITIND);} *#define badpat(x) return(*dfa = END, x)#define store(x) *mp++ = xchar *re_comp(pat)char *pat;{7 register char *p; /* pattern pointer */? register CHAR *mp = dfa; /* dfa pointer */7 register CHAR *lp; /* saved pointer.. */? register CHAR *sp = dfa; /* another one.. */ ? register int tagi = 0; /* tag stack index */? register int tagc = 1; /* actual tag count */  register int n; int c1, c2;  if (!pat || !*pat) if (sta)# return (0); elseA badpat("No previous regular expression"); sta = NOP; for (p = pat; *p; p++) { lp = mp; switch (*p) {7 case '.': /* match any char.. */# store(ANY); break;7 case '^': /* match beginning.. */% if (p == pat)+ store(BOL); else {+ store(CHR);* store(*p); } break;7 case '$': /* match endofline.. */& if (!*(p + 1))+ store(EOL); else {+ store(CHR);* store(*p); } break; 8 case '[': /* match char class.. */ * if (*++p == '^') {+ store(NCL);$ p++; } else+ store(CCL);7 if (*p == '-') /* real dash */, chset(*p++);7 if (*p == ']') /* real brac */, chset(*p++);1 while (*p && *p != ']') {O if (*p == '-' && *(p + 1) && *(p + 1) != ']') {, p++;: c1 = *(p - 2) + 1;2 c2 = *p++;8 while (c1 <= c2)< chset(c1++);! } #ifdef EXTENDB else if (*p == '\\' && *(p + 1)) {, p++;4 chset(*p++);! }#endif$ else4 chset(*p++); } if (!*p)4 badpat("Missing ]"); G for (n = 0; n < BITBLK; bittab[n++] = (char) 0)1 store(bittab[n]); break;7 case '*': /* match 0 or more.. */7 case '+': /* match 1 or more.. */% if (p == pat)8 badpat("Empty closure");5 lp = sp;/* previous opcode */= if (*lp == CLO) /* equivalence.. */& break;& switch (*lp) {! case BOL:! case BOT:! case EOT:! case BOW:! case EOW:! case REF:: badpat("Illegal closure"); default:& break; }& if (*p == '+')< for (sp = mp; lp < sp; lp++)3 store(*lp);# store(END);# store(END); sp = mp;) while (--mp > lp)- *mp = mp[-1];# store(CLO); mp = sp; break;7 case '\\': /* tags, backrefs .. */' switch (*++p) {! case '(':4 if (tagc < MAXTAG) {> tagstk[++tagi] = tagc;3 store(BOT);6 store(tagc++);& } elseH badpat("Too many \\(\\) pairs");& break;! case ')':/ if (*sp == BOT)M badpat("Null pattern inside \\(\\)");/ if (tagi > 0) {3 store(EOT);> store(tagstk[tagi--]);& } else@ badpat("Unmatched \\)");& break;! case '<':+ store(BOW);& break;! case '>':/ if (*sp == BOW)M badpat("Null pattern inside \\<\\>");+ store(EOW);& break;!  qU,-%[MATS.PROG.SWING.C_SWING]_@ 0*:Sg1;VI 1N-Z M)6X_^_=n}v%Gug^A"]Kxi|`F==u7Z`0VajgINJ%}4C;& kw\]cOU /FQuMR/|[|r>imyuE:u}J_%To&B%=sCQnYo1Ht7pUQ>9*oec @oFh^uH#]fH0(zkwr]3Yw A8x7봏0tNv16,Y #xNdb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]/y< E:K[<7|"s9wel |P~/ tX[qw2zq`4qsB|ARP{2$_jdu;P,h%\&kB-e*L|WZcJ|zvv|z[a+lRta=~m>I/}4i%Pd#=b+u^d+EP=s[wWawQ^n}I} Vw4M'gT]_5 D [\,ln6 8pOr.=E{J]'NwX6 vL)x[>usg / avYZLWKYFroj6F.[ R YzT!r-cRVUB$Swea0g%_h+(BaH~|ztQ%{u00|X]'Z=<-C0@t1w=?*Xv5-F\,eT7iHxi;v/,7"{ #Ɩ3bj( QY{j@7y=IDhqa}Kiv+?'>-KNUKsW*)1$4|e4qpT`z]' 6 E!fvj~';F':~A::u; eE^?8L_NNz``i2G$1+ehui6:EmPOevoS @) fbl)%&`acx/;:IN[f6i{ov0 JKcAISr"?JfxcMRv'15en*[{jC>?$e45"M~l:Hw.;V=_1O!GbEJSj0 0 && tagstk[tagi] == n)E badpat("Cyclical reference");/ if (tagc > n) {3 store(REF);1 store(n);& } elseI badpat("Undetermined reference");& break; #ifdef EXTEND! case 'b':+ store(CHR);, store('\b');& break;! case 'n':+ store(CHR);, store('\n');& break;! case 'f':+ store(CHR);, store('\f');& break;! case 'r':+ store(CHR);, store('\r');& break;! case 't':+ store(CHR);, store('\t');& break;#endif default:+ store(CHR);* store(*p); } break; 7 default: /* an ordinary char */# store(CHR);" store(*p); break; } sp = lp; } if (tagi > 0)( badpat("Unmatched \\("); store(END); sta = OKP; return (0);} noshare static char *bol;#noshare static char *bopat[MAXTAG];#noshare static char *eopat[MAXTAG];char *pmatch();)/** re_exec: execute dfa to find a match.P * special cases: (dfa[0]) BOL Match only once, starting from the beginning. CHRH * First locate the character without calling pmatch, and if found, callJ * pmatch for the remaining string. END re_comp failed, poor luser did not * check for it. Fail fast.N * If a match is found, bopat[0] and eopat[0] are set to the beginning and the/ * end of the matched fragment, respectively.*/ int re_exec(lp)register char *lp;{ register char c; register char *ep = 0;! register CHAR *ap = dfa; bol = lp; bopat[0] = 0; bopat[1] = 0; bopat[2] = 0; bopat[3] = 0; bopat[4] = 0; bopat[5] = 0; bopat[6] = 0; bopat[7] = 0; bopat[8] = 0; bopat[9] = 0; switch (*ap) {C case BOL: /* anchored: match from BOL only */$ ep = pmatch(lp, ap); break;C case CHR: /* ordinary char: locate it fast */ c = *(ap + 1);' while (*lp && *lp != c) lp++;C if (!*lp) /* if EOS, fail, else fall thru. */# return (0);C default: /* regular matching all the way. */ while (*lp) {2 if ((ep = pmatch(lp, ap)))& break; lp++; } break;C case END: /* munged automaton. fail always */ return (0); } if (!ep) return (0); bopat[0] = lp; eopat[0] = ep; return (1); }p./** pmatch: internal routine for the hard partN * This code is mostly snarfed from an early grep written by David Conroy. The; * backref and tag stuff, and various other mods are by oZ.n *M * special cases: (dfa[n], dfa[n+1]) CLO ANY We KNOW ".*" will match ANYTHINGzF * upto the end of line. Thus, go to the end of line straight, withoutK * calling pmatch recursively. As in the other closure cases, the remainingBL * pattern must be matched by moving backwards on the string recursively, toK * find a match for xy (x is ".*" and y is the remaining pattern) where the M * match satisfies the LONGEST match for x followed by a match for y. CLO CHRcC * We can again scan the string forward for the single char without,G * recursion, and at the point of failure, we execute the remaining dfa # * recursively, as described above.DI * At the end of a successful match, bopat[n] and eopat[n] are set to theaK * beginning and end of subpatterns matched by tagged expressions (n = 1 tos * 9). */iextern void re_fail();I/*character classification table for word boundary operators BOW and EOW.vM * the reason for not using ctype macros is that we can let the user add intoeM * our own table. see re_modw. This table is not in the bitset form, since weuK * may wish to extend it in the future for other character classifications.g * TRUE for 0-9 A-Z a-z _ */&noshare static char chrtyp[MAXCHR] = {% 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,[% 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,a% 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,h% 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,h% 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,d% 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,i% 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,n% 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,r% 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, % 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, % 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,% 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,h 1, 1, 1, 0, 0, 0, 0, 0}; a #define inascii(x) (0177&(x)))#define iswordc(x) chrtyp[inascii(x)]dC#define isinset(x,y) ((x)[((y)&BLKIND)>>3] & (1<<((y)&BITIND)))T6/* skip values for CLO XXX to skip past the closure */ e;#define ANYSKIP 2 /* CLO ANY END ... */m?#define CHRSKIP 3 /* CLO CHR chr END ... */c=#define CCLSKIP 18 /* CLO CCL 16bytes END ... */[static char *pmatch(lp, ap) register char *lp;  register CHAR *ap;c{u; register char *e; /* extra pointer for CLO */*; register char *bp; /* beginning of subpat.. */< register char *ep; /* ending of subpat.. */! register int op, c, n; ; char *are; /* to save the line ptr. */u# while ((op = *ap++) != END)n switch (op) { case CHR:[+ if (*lp++ != *ap++) + return (0);u break; case ANY:x# if (!*lp++) + return (0);r break; case CCL:d" c = *lp++;, if (!isinset(ap, c))+ return (0); % ap += BITBLK;d break; case NCL:n" c = *lp++;+ if (isinset(ap, c))h+ return (0);a% ap += BITBLK;* break; case BOL:t& if (lp != bol)+ return (0);e break; case EOL:e if (*lp)+ return (0);o break; case BOT:l* bopat[*ap++] = lp; break; case EOT:v* eopat[*ap++] = lp;  L " SWING_SRC.BCK#3- [MATS.PROG.SWING.C_SWING]REG.C;1P3.) break; case BOW:nL if (!(lp != bol && iswordc(lp[-1])) && iswordc(*lp))& break;# return (0);' case EOW:L if ((lp != bol && iswordc(lp[-1])) && !iswordc(*lp))& break;# return (0);s case REF:t" n = *ap++;& bp = bopat[n];& ep = eopat[n];' while (bp < ep)c3 if (*bp++ != *lp++)a3 return (0);  break; case CLO:m! are = lp; & switch (*ap) {! case ANY:a+ while (*lp)f- lp++;H, n = ANYSKIP;& break;! case CHR:a. c = *(ap + 1);7 while (*lp && c == *lp)2- lp++;e, n = CHRSKIP;& break;! case CCL:! case NCL:TC while (*lp && (e = pmatch(lp, ap)))d/ lp = e; , n = CCLSKIP;& break; default:B re_fail("closure: bad dfa.", *ap);+ return (0);c }* ap += n; + while (lp >= are) { 7 if (e = pmatch(lp, ap)) 3 return (e);a% --lp;T }c# return (0);A default:9 re_fail("re_exec: bad dfa.", op);# return (0);  }C return (lp);}iJ/* re_modw: add new characters into the word table to change the re_exec'sJ * understanding of what a word should look like. Note that we only accept& * additions into the word definition. *N * If the string parameter is 0 or null string, the table is reset back to theD * default, which contains A-Z a-z 0-9 _. [We use the compact bitset+ * representation for the default table] */r *"noshare static char deftab[16] = {7 0, 0, 0, 0, 0, 0, 377, 003, 376, 377, 377, 207,  376, 377, 377, 007}; avoid re_modw(s)t register char *s;{e register int i; if (!s || !*s) {, for (i = 0; i < MAXCHR; i++)0 if (!isinset(deftab, i))/ iswordc(i) = 0;  } else while (*s)* iswordc(*s++) = 1;}  >/* re_subs: substitute the matched portions of the src in dst. *. * & substitute the entire matched pattern. *I * \digit substitute a subpattern, with the given tag number. Tags are L * numbered from 1 to 9. If the particular tagged subpattern does not exist, * null is substituted. */int re_subs(src, dst)  register char *src; register char *dst;{r register char c; register int pin; register char *bp; register char *ep;  if (!*src || !bopat[0])  return (0);  while (c = *src++) { switch (c) { case '&': pin = 0; break; case '\\':# c = *src++;t3 if (c >= '0' && c <= '9') {;. pin = c - '0';& break; }  default:# *dst++ = c;! continue;r }  = if ((bp = bopat[pin]) && (ep = eopat[pin])) { . while (*bp && bp < ep)/ *dst++ = *bp++; $ if (bp < ep)+ return (0);r } }  *dst = (char) 0; return (1); } //* re_fail: internal error handler for re_exec. H * should probably do something like a longjump to recover gracefully.*/void re_fail(s, c) char *s; char c;{p+ printf("\n%s [opcode %o]\n", s, c);  exit(0);} #*[MATS.PROG.SWING.C_SWING]SJCDEF.H;1+,$3./(< 4?--0123KPWO563Ў7.ג8k9`6-G(<HJ ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:16.344** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain** ** File : SJCDEF.H**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** *** MODULE $SJCDEF ***** 9** Send to Job Controller Service ($SNDJBC) definitions.*/##define SJC$_ABORT_JOB 0x00000001 "#define SJC$_ADD_FILE 0x00000002 ##define SJC$_ALTER_JOB 0x00000003 %#define SJC$_ALTER_QUEUE 0x00000004 &#define SJC$_ASSIGN_QUEUE 0x00000005 *#define SJC$_BATCH_CHECKPOINT 0x00000006 '#define SJC$_BATCH_SERVICE 0x00000007 &#define SJC$_CLOSE_DELETE 0x00000008 ##define SJC$_CLOSE_JOB 0x00000009 $#define SJC$_CREATE_JOB 0x0000000A &#define SJC$_CREATE_QUEUE 0x0000000B (#define SJC$_DEASSIGN_QUEUE 0x0000000C /#define SJC$_DEFINE_CHARACTERISTIC 0x0000000D %#define SJC$_DEFINE_FORM 0x0000000E /#define SJC$_DELETE_CHARACTERISTIC 0x0000000F %#define SJC$_DELETE_FORM 0x00000010 $#define SJC$_DELETE_JOB 0x00000011 &#define SJC$_DELETE_QUEUE 0x00000012 $#define SJC$_ENTER_FILE 0x00000013 %#define SJC$_MERGE_QUEUE 0x00000014 %#define SJC$_PAUSE_QUEUE 0x00000015 %#define SJC$_RESET_QUEUE 0x00000016 *#define SJC$_START_ACCOUNTING 0x00000017 %#define SJC$_START_QUEUE 0x00000018 -#define SJC$_START_QUEUE_MANAGER 0x00000019 )#define SJC$_STOP_ACCOUNTING 0x0000001A $#define SJC$_STOP_QUEUE 0x0000001B ,#define SJC$_STOP_QUEUE_MANAGER 0x0000001C )#define SJC$_SYNCHRONIZE_JOB 0x0000001D *#define SJC$_WRITE_ACCOUNTING 0x0000001E -#define SJC$_CONTROL_DIAGNOSTICS 0x0000001F *#define SJC$_RESERVED_FUNC_32 0x00000020 ,#define SJC$_ACCOUNTING_MESSAGE 0x00000001 *#define SJC$_ACCOUNTING_TYPES 0x00000002 $#define SJC$_AFTER_TIME 0x00000003 &#define SJC$_NO_AFTER_TIME 0x00000004(#define SJC$_ALIGNMENT_MASK 0x00000005 )#define SJC$_ALIGNMENT_PAGES 0x00000006 '#define SJC$_BASE_PRIORITY 0x00000007 #define ժ" SWING_SRC.BCK$3-#[MATS.PROG.SWING.C_SWING]SJCDEF.H;1? SJC$_BATCH 0x00000008 !#define SJC$_NO_BATCH 0x00000009%#define SJC$_BATCH_INPUT 0x0000000A &#define SJC$_BATCH_OUTPUT 0x0000000B -#define SJC$_CHARACTERISTIC_NAME 0x0000000C .#define SJC$_CHARACTERISTIC_NUMBER 0x0000000D+#define SJC$_NO_CHARACTERISTICS 0x0000000E)#define SJC$_CHECKPOINT_DATA 0x0000000F +#define SJC$_NO_CHECKPOINT_DATA 0x00000010#define SJC$_CLI 0x00000011 #define SJC$_NO_CLI 0x00000012%#define SJC$_CPU_DEFAULT 0x00000013 '#define SJC$_NO_CPU_DEFAULT 0x00000014##define SJC$_CPU_LIMIT 0x00000015 %#define SJC$_NO_CPU_LIMIT 0x00000016&#define SJC$_CREATE_START 0x00000017 %#define SJC$_DELETE_FILE 0x00000018 '#define SJC$_NO_DELETE_FILE 0x00000019+#define SJC$_DESTINATION_QUEUE 0x0000001A %#define SJC$_DEVICE_NAME 0x0000001B &#define SJC$_DOUBLE_SPACE 0x0000001C (#define SJC$_NO_DOUBLE_SPACE 0x0000001D&#define SJC$_ENTRY_NUMBER 0x0000001E ,#define SJC$_ENTRY_NUMBER_OUTPUT 0x0000001F$#define SJC$_FILE_BURST 0x00000020 '#define SJC$_FILE_BURST_ONE 0x00000021&#define SJC$_NO_FILE_BURST 0x00000022%#define SJC$_FILE_COPIES 0x00000023 ##define SJC$_FILE_FLAG 0x00000024 &#define SJC$_FILE_FLAG_ONE 0x00000025%#define SJC$_NO_FILE_FLAG 0x00000026-#define SJC$_FILE_IDENTIFICATION 0x00000027 ,#define SJC$_FILE_SETUP_MODULES 0x00000028 .#define SJC$_NO_FILE_SETUP_MODULES 0x00000029,#define SJC$_FILE_SPECIFICATION 0x0000002A &#define SJC$_FILE_TRAILER 0x0000002B )#define SJC$_FILE_TRAILER_ONE 0x0000002C(#define SJC$_NO_FILE_TRAILER 0x0000002D$#define SJC$_FIRST_PAGE 0x0000002E &#define SJC$_NO_FIRST_PAGE 0x0000002F*#define SJC$_FORM_DESCRIPTION 0x00000030 %#define SJC$_FORM_LENGTH 0x00000031 ,#define SJC$_FORM_MARGIN_BOTTOM 0x00000032 *#define SJC$_FORM_MARGIN_LEFT 0x00000033 +#define SJC$_FORM_MARGIN_RIGHT 0x00000034 )#define SJC$_FORM_MARGIN_TOP 0x00000035 ##define SJC$_FORM_NAME 0x00000036 $#define SJC$_FORM_NUMBER 0x00000037,#define SJC$_FORM_SETUP_MODULES 0x00000038 .#define SJC$_NO_FORM_SETUP_MODULES 0x00000039)#define SJC$_FORM_SHEET_FEED 0x0000003A +#define SJC$_NO_FORM_SHEET_FEED 0x0000003B$#define SJC$_FORM_STOCK 0x0000003C '#define SJC$_FORM_TRUNCATE 0x0000003D )#define SJC$_NO_FORM_TRUNCATE 0x0000003E$#define SJC$_FORM_WIDTH 0x0000003F ##define SJC$_FORM_WRAP 0x00000040 %#define SJC$_NO_FORM_WRAP 0x00000041'#define SJC$_GENERIC_QUEUE 0x00000042 )#define SJC$_NO_GENERIC_QUEUE 0x00000043+#define SJC$_GENERIC_SELECTION 0x00000044 -#define SJC$_NO_GENERIC_SELECTION 0x00000045(#define SJC$_GENERIC_TARGET 0x00000046 #define SJC$_HOLD 0x00000047 #define SJC$_NO_HOLD 0x00000048##define SJC$_JOB_BURST 0x00000049 %#define SJC$_NO_JOB_BURST 0x0000004A$#define SJC$_JOB_COPIES 0x0000004B "#define SJC$_JOB_FLAG 0x0000004C $#define SJC$_NO_JOB_FLAG 0x0000004D##define SJC$_JOB_LIMIT 0x0000004E "#define SJC$_JOB_NAME 0x0000004F +#define SJC$_JOB_RESET_MODULES 0x00000050 -#define SJC$_NO_JOB_RESET_MODULES 0x00000051*#define SJC$_JOB_SIZE_MAXIMUM 0x00000052 ,#define SJC$_NO_JOB_SIZE_MAXIMUM 0x00000053*#define SJC$_JOB_SIZE_MINIMUM 0x00000054 ,#define SJC$_NO_JOB_SIZE_MINIMUM 0x00000055-#define SJC$_JOB_SIZE_SCHEDULING 0x00000056 /#define SJC$_NO_JOB_SIZE_SCHEDULING 0x00000057+#define SJC$_JOB_STATUS_OUTPUT 0x00000058 %#define SJC$_JOB_TRAILER 0x00000059 '#define SJC$_NO_JOB_TRAILER 0x0000005A##define SJC$_LAST_PAGE 0x0000005B %#define SJC$_NO_LAST_PAGE 0x0000005C/#define SJC$_LIBRARY_SPECIFICATION 0x0000005D 1#define SJC$_NO_LIBRARY_SPECIFICATION 0x0000005E$#define SJC$_LOG_DELETE 0x0000005F &#define SJC$_NO_LOG_DELETE 0x00000060##define SJC$_LOG_QUEUE 0x00000061 +#define SJC$_LOG_SPECIFICATION 0x00000062 -#define SJC$_NO_LOG_SPECIFICATION 0x00000063##define SJC$_LOG_SPOOL 0x00000064 %#define SJC$_NO_LOG_SPOOL 0x00000065##define SJC$_LOWERCASE 0x00000066 %#define SJC$_NO_LOWERCASE 0x00000067%#define SJC$_NEW_VERSION 0x00000068 "#define SJC$_NEXT_JOB 0x00000069 #define SJC$_NOTE 0x0000006A #define SJC$_NO_NOTE 0x0000006B #define SJC$_NOTIFY 0x0000006C "#define SJC$_NO_NOTIFY 0x0000006D*#define SJC$_OPERATOR_REQUEST 0x0000006E ,#define SJC$_NO_OPERATOR_REQUEST 0x0000006F##define SJC$_OWNER_UIC 0x00000070 %#define SJC$_PAGE_HEADER 0x00000071 '#define SJC$_NO_PAGE_HEADER 0x00000072,#define SJC$_PAGE_SETUP_MODULES 0x00000073 .#define SJC$_NO_PAGE_SETUP_MODULES 0x00000074"#define SJC$_PAGINATE 0x00000075 $#define SJC$_NO_PAGINATE 0x00000076%#define SJC$_PARAMETER_1 0x00000077 $#define SJC$_PARAMETER_2 0x00000078$#define SJC$_PARAMETER_3 0x00000079$#define SJC$_PARAMETER_4 0x0000007A$#define SJC$_PARAMETER_5 0x0000007B$#define SJC$_PARAMETER_6 0x0000007C$#define SJC$_PARAMETER_7 0x0000007D$#define SJC$_PARAMETER_8 0x0000007E&#define SJC$_NO_PARAMETERS 0x0000007F!#define SJC$_PASSALL 0x00000080 ##define SJC$_NO_PASSALL 0x00000081"#define SJC$_PRIORITY 0x00000082 ##define SJC$_PROCESSOR 0x00000083 %#define SJC$_NO_PROCESSOR 0x00000084$#define SJC$_PROTECTION 0x00000085 #define SJC$_QUEUE 0x00000086 2#define SJC$_QUEUE_FILE_SPECIFICATION 0x00000087 '#define SJC$_RELATIVE_PAGE 0x00000088 !#define SJC$_REQUEUE 0x00000089 !#define SJC$_RESTART 0x0000008A ##define SJC$_NO_RESTART 0x0000008B)#define SJC$_RETAIN_ALL_JOBS 0x0000008C *#define SJC$_RETAIN_ERROR_JOBS 0x0000008D'#define SJC$_NO_RETAIN_JOBS 0x0000008E&#define SJC$_SCSNODE_NAME 0x0000008F '#define SJC$_SEARCH_STRING 0x00000090 #define SJC$_SWAP 0x00000091 #define SJC$_NO_SWAP 0x00000092"#define SJC$_TERMINAL 0x00000093 $#define SJC$_NO_TERMINAL 0x00000094%#define SJC$_TOP_OF_FILE 0x00000095 -#define SJC$_USER_IDENTIFICATION 0x00000096 ##define SJC$_WSDEFAULT 0x00000097 %#define SJC$_NO_WSDEFAULT 0x00000098"#define SJC$_WSEXTENT 0x00000099 $#define SJC$_NO_WSEXTENT 0x0000009A!#define SJC$_WSQUOTA 0x0000009B ##define SJC$_NO_WSQUOTA 0x0000009C&#define SJC$_ACCOUNT_NAME 0x0000009D #define SJC$_UIC 0x0000009E "#define SJC$_USERNAME 0x0000009F &#define SJC$_BUFFER_COUNT 0x000000A0 )#define SJC$_EXTEND_QUANTITY 0x000000A1 )#define SJC$_RECORD_BLOCKING 0x000000A2 +#define SJC$_NO_RECORD_BLOCKING 0x000000A3(#define SJC$_QUEMAN_RESTART 0x000000A4 *#define SJC$_NO_QUEMAN_RESTART 0x000000A5+#define SJC$_DEFAULT_FORM_NAME 0x000000A6 -#define SJC$_DEFAULT_FORM_NUMBER 0x000000A7 ,#define SJC$_RESERVED_INPUT_168 0x000000A8 ,#define SJC$_RESERVED_INPUT_169 0x000000A9 -#define SJC$_RESERVED_OUTPUT_170 0x000000AA -#define SJC$_RESERVED_OUTPUT_171 0x000000AB $#define SJC$_OPEN_QUEUE 0x000000AC %#define SJC$_CLOSE_QUEUE 0x000000AD #define SJC$_SERVER 0x000000AE !#define SJC$_PRINTER 0x000000AF $#define SJC$_UPDATE_ORB 0x000000B0 .#define SJC$_NO_QUEUE_DESCRIPTION 0x000000B1 .#define SJC$_RESERVED_BOOLEAN_178 0x000000B2 .#define SJC$_RESERVED_BOOLEAN_179 0x000000B3 .#define SJC$_RESERVED_BOOLEAN_180 0x000000B4 .#define SJC$_RESERVED_BOOLEAN_181 0x000000B5 .#define SJC$_RESERVED_BOOLEAN_182 0x000000B6 .#define SJC$_RESERVED_BOOLEAN_183 0x000000B7 *#define SJC$_DIAGNOSTIC_FLAGS 0x000000B8 +#define SJC$_QUEUE_DESCRIPTION 0x000000B9 ,#define SJC$_RESERVED_INPUT_186 0x000000BA ,#define SJC$_RESERVED_INPUT_187 0x000000BB ,#define SJC$_RESERVED_INPUT_188 0x000000BC ,#define SJC$_RESERVED_INPUT_189 0x000000BD ,#define SJC$_RESERVED_INPUT_190 0x000000BE ,#define SJC$_RESERVED_INPUT_191 0x000000BF ,#define SJC$_RESERVED_INPUT_192 0x000000C0 ,#define SJC$_RESERVED_INPUT_193 0x000000C1 ,#define SJC$_RESERVED_INPUT_194 0x000000C2 ,#define SJC$_RESERVED_INPUT_195 0x000000C3 -#define SJC$_RESERVED_OUTPUT_196 0x000000C4 -#define SJC$_RESERVED_OUTPUT_197 0x000000C5 -#define SJC$_RESERVED_OUTPUT_198 0x000000C6 -#define SJC$_RESERVED_OUTPUT_199 0x000000C7 &#define SJC$M_ACCT_PROCESS 0x00000001$#define SJC$M_ACCT_IMAGE 0x00000002*#define SJC$M_ACCT_INTERACTIVE 0x00000004,#define SJC$M_ACCT_LOGIN_FAILURE 0x00000008)#define SJC$M_ACCT_SUBPROCESS 0x0cc`" SWING_SRC.BCK$3-#[MATS.PROG.SWING.C_SWING]SJCDEF.H;1?rD0000010'#define SJC$M_ACCT_DETACHED 0x00000020$#define SJC$M_ACCT_BATCH 0x00000040&#define SJC$M_ACCT_NETWORK 0x00000080$#define SJC$M_ACCT_PRINT 0x00000100&#define SJC$M_ACCT_MESSAGE 0x00000200"*[MATS.PROG.SWING.C_SWING]SPAWN.C;1+,&3./(< 4IH--0123KPWO56l97@ g89`6-G(<HJ/*VMS MORE V1.5 */#include descripspawn(){% $DESCRIPTOR(prompt,"more% "); putchar('\r');ClrEOL(); standout();I printf("\nSpawning subprocess ... logout to return to MORE.\n"); standend();: lib$spawn (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &prompt);} /* spawn */ #*[MATS.PROG.SWING.C_SWING]STRDEF.H;1+,'3./(< 4?V--0123KPWO56 Ў7ג8:k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:19.934** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain** ** File : STRDEF.H**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ !#define STR$_FACILITY 0x00000024"#define STR$_FATINTERR 0x00248044"#define STR$_DIVBY_ZER 0x0024804C"#define STR$_ILLSTRCLA 0x00248054"#define STR$_STRIS_INT 0x0024805C"#define STR$_WRONUMARG 0x00248064"#define STR$_INSVIRMEM 0x0024806C"#define STR$_STRTOOLON 0x00248074"#define STR$_ERRFREDYN 0x0024807C/*%** THE FOLLOWING ARE WARNING ERRORS.*/#define STR$_TRU 0x00248200 #define STR$_NOMATCH 0x00248208!#define STR$_INVDELIM 0x00248210#define STR$_NOELEM 0x00248218/* 0** THE FOLLOWING ARE QUALIFIED SUCCESS MESSAGES*/ "#define STR$_NEGSTRLEN 0x00248401"#define STR$_ILLSTRPOS 0x00248409"#define STR$_ILLSTRSPE 0x00248411#define STR$_MATCH 0x00248419/*4** DEFINE STR$_NORMAL TO BE THE SAME AS SS$_NORMAL.*/#define STR$_NORMAL 0x00000001#*[MATS.PROG.SWING.C_SWING]STRING.C;1+,*3./(< 4J--0123KPWO56`97je g89`6-G(<HJ /*VMS MORE V1.5*/#include stdio#include ctype#include string#define EOS '\0'!extern int Screen_Width,line_ct;extern int case_sensitive;/* get_pattern< Read pattern to be search for from the user's keyboard.*/get_pattern(pat) char *pat;{ int i = 0; , while ((pat[i] = getkey()) != '\r'){ if(isprint(pat[i])){ putchar(pat[i++]); continue; } else if( pat[i]=='\177') { if(i!=0) { i--; printf("\b \b"); } } } pat[i] ='\0';} /* get_pattern */ /*find a pattern in string */void lower_str();void lower_line();int find(pattern, string)char *pattern, *string;{ int n,i=0; char *ptr,strtmp[240]; strcpy(strtmp,string); if(!case_sensitive) { lower_str(pattern); lower_line(strtmp); }#ifdef REXPRESSIONS if( re_exec(strtmp)) return TRUE; return FALSE;#else ptr=strtmp; n=strlen(pattern);+ while( (ptr=strchr(ptr,*pattern))!=NULL ){3 if (strncmp(ptr, pattern, n) == 0){ return TRUE; } ptr++; } return FALSE;#endif REXPRESSIONS } /* find */  7/* conv_nonprt: convert nonprintable character to ^ */void conv_nonprt(str) char *str;{ while(*str){+ if((!isprint(*str)) && (!isspace(*str))){ *str='^'; } str++; }} E/* lower_str() --- Converts a string to lower case and terminates the5 * string at the first space. */ void lower_str (st) char *st;{ while(*st && *st != ' ') {$ *st = _tolower(*st); st++; } if (*st == ' ') *st = EOS;} /* end of lower_str () */void lower_line (line) char *line;{ while(*line) {' *line = tolower(*line); line++; }}   J/* -------------------------------------------------------------------- */ /* str_linesI Determines how many lines a string would take up if it were printed.J It assumes 8 space tabs (BAD). It returns the number of extra lines thatF will be printed. It also assumes that integer truncation will occur. */int str_lines (str) char *str;{ int ct=0,ctt=0;  while (*str) {" if (*str == '\t'){4 ct=ct+8; /* haven't found better way to do this*/ ctt=ctt+8; } else{ if(*str!='\n'){ ct++; ctt++; } } if(ct==Screen_Width){# line_ct--; /* this is global */ ct=0; } str++; } ( return ((ctt-1)/Screen_Width+1);}/* this function is bad. */#*[MATS.PROG.SWING.C_SWING]SWING.C;11+,_ .B/(< 4PB@--0123KPWOC5607@Ŧ089G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:38.434** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**** File : SWING.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB=** 90-MAY-1990 Added more as a part MA=** 21-JAN-1991 Added some BUG fix, see credit LAST MA?**************************************************************/ /* ** swing.c*/#include stdio#include "more_descrip.h" #include rms`*Μy" SWING_SRC.BCK_ -#[MATS.PROG.SWING.C_SWING]SWING.C;11PBK #include ctype#include ssdef#include iodef#include smgdef#include fchdef#include atrdef#include fibdef#include "swing.h"#include "swing_defs.h"#/* Here is the decl for more, Mats 2char *more_argv[] = { "more", "", (char *) NULL };*//*C** maximum no of directory structures we'll try to load at startup*/#define MAX_ARGS 20/*** acb elements*/unsigned long uchar;/*!** acb descriptor for io$_access*/ACB acb[] = { /*6 ** file characteristics (directory ??) */8 ATR$S_UCHAR, ATR$C_UCHAR, &uchar, /*% ** terminate the list */4 0, 0, 0};/*** blank fib, for initialising*/struct fibdef blank_fib;/*"** starting point for the program*/main(argc,argv) int argc; char *argv[];{A char dir[SPEC_SIZE+1],name[SPEC_SIZE+1],tmp_dir[SPEC_SIZE+1]; int i, status, arg_no, c; char arg_list[SPEC_SIZE+1];$ char arg[MAX_ARGS][SPEC_SIZE+1]; /* ** my version of sys$disk */# translate("SYS$DISK",sys_disk); /*= ** build up a list of the user-specified dirs in arg[][] */ arg_list[0] = 0; arg_no = 0; if (argc > 1) { /*/ ** concatenate the startup directories */" for (i = 1; i < argc; i++) {% strcat(arg_list,argv[i]);! strcat(arg_list,","); } /*6 ** build up a list of the startup directories */? for (c = 0; c < strlen(arg_list) && arg_no < MAX_ARGS;) {- strcpy(arg[arg_no],&arg_list[c]);5 for (i = 0; i < strlen(arg[arg_no]); i++) {* if (arg[arg_no][i] == ',') {' arg[arg_no][i] = 0; break; } }$ if (strlen(arg[arg_no])) arg_no++; c = c + i + 1; } } /*7 ** check we can set def to first dir - if not bomb) ** on failure chdir returns non-zero */ if (arg_no && chdir(arg[0])) {9 printf("Cannot change directory to %s\n",arg[0]); exit(1); } /* ** initialize */ init(); /* ** Main title */ title(MTITLE); sub_title_underline(" "); /*I ** get going - add a structure to the display - first current unless ** user specified others */  if (argc == 1) { show_def(dir); add_a_dstructure(dir); } else {$ for (i = 0; i < arg_no; i++) {* if (!add_a_dstructure(arg[i])) { sprintf(junk,: "Failed to find directory %c%s%c", '"', arg[i], '"'); warning(junk); } } } /*E ** if we haven't got any dirs on display we'll add the sys$login6 ** dir just to make sure we have a dir on displayG ** this could happen if there was no dir specified and the current ** default is not validE ** this is a last-case precaution to ensure user gets started-up! ** with a dir on display  */ if (!fdp)+ add_a_dstructure("sys$login:");  /*C ** solicit user input - effectively the body of the processing */ next_command(TRUE,0); /* ** exit */ exit(exit_error = 1);}/*@** find the root directory of the current directory structure -8** this is the same as is shown by show def for example*/get_root_dir(from,dir,name) char *from; /* where we start */char *dir; /* full dir spec */%char *name; /* name of top dir */{ int i, length, start, size; /*) ** set dir up to be where we are now */ strcpy(dir,from); /* ** find top dir spec */ length = strlen(dir); for (i = 0;i < length ;i++) { /*# ** find right hand bracket */ if (dir[i] == '<') { dir[i] = '['; } if (dir[i] == '>') { dir[i] = ']'; } if (dir[i] == '.') { dir[i++] = ']'; dir[i] = 0; break; } else if (dir[i] == ']') { dir[++i] = 0; break; } }  /* ** upper case it */ length = strlen(dir); for (i = 0; i < length; i++) if (isalpha(dir[i]))% dir[i] = toupper(dir[i]); /*5 ** put every thing between the [ and ] into name */ start = strcspn(dir,"[")+1;$ size = strcspn(&dir[start],"]");# strncpy(name,&dir[start],size); name[size] = 0;}/*G** build up a list of the directories in the structure we're examining*/get_dirs(n_ptr,channel) NODE *n_ptr; int channel;{ int i; int c = 0; int status; NODE *temp;% struct dsc$descriptor_s fib_desc; struct fibdef fib; char filename[SPEC_SIZE+1]; char dirname[SPEC_SIZE+1]; short file_length; long iosb[2]; /* ** initialize */ fib = blank_fib;* fib_desc.dsc$w_length = FIB$C_LENGTH;" fib_desc.dsc$a_pointer = &fib;+ fib_desc.dsc$b_class = DSC$K_CLASS_S;+ fib_desc.dsc$b_dtype = DSC$K_DTYPE_T;7 fib.fib$r_did_overlay.fib$w_did[0] = n_ptr->fid[0];7 fib.fib$r_did_overlay.fib$w_did[1] = n_ptr->fid[1];7 fib.fib$r_did_overlay.fib$w_did[2] = n_ptr->fid[2];5 fib.fib$r_nmctl_overlay.fib$w_nmctl = FIB$M_WILD; while(1) { filename[0] = 0; file_length = 0; uchar = 0; status = sys$qiow(0," channel,% IO$_ACCESS,# &iosb[0], 0, 0,$ &fib_desc,* DSC1("*.dir;*"),' &file_length,* DSCA1(filename), acb, 0);! if (status != SS$_NORMAL)C panic(status,"io$_access directory lookup","get dirs");' if (iosb[0] == SS$_NOMOREFILES) return(TRUE); /** ** file in dir but not indexf.sys */& if (iosb[0] == SS$_NOSUCHFILE) { fib.fib$l_wcc++; continue; } /*J ** on error go get next file unless fib.l_wcc == 0; in which case- ** we can't read the dir, so we bomb */" if (iosb[0] != SS$_NORMAL) {# if (fib.fib$l_wcc == 0) { /*: ** we can't read this directory - go home */2 warning(full_error_text(iosb[0])); return(iosb[0]); } continue; } /* ** carry on */" filename[file_length] = 0; /*H ** if it was a directory (& not [000000].dir) we'll build it in */& if (uchar & FCH$M_DIRECTORY &&@ (fib.fib$r_fid_overlay.fib$w_fid[0] != mfd_did[0] ||@ fib.fib$r_fid_overlay.fib$w_fid[1] != mfd_did[1]) ) { /*! ** we've a directory */ c++; temp = n_ptr; /*J ** we only want dirname to be filename, not extension;version */% strcpy(dirname,filename);. dirname[strcspn(dirname,".")] = 0;' n_ptr = grab_node(dirname); /* ** record file id */? n_ptr->fid[0] = fib.fib$r_fid_overlay.fib$w_fid[0];? n_ptr->f?" SWING_SRC.BCK_ -#[MATS.PROG.SWING.C_SWING]SWING.C;11PBr id[1] = fib.fib$r_fid_overlay.fib$w_fid[1];? n_ptr->fid[2] = fib.fib$r_fid_overlay.fib$w_fid[2]; /*# ** record directory id */? n_ptr->did[0] = fib.fib$r_did_overlay.fib$w_did[0];? n_ptr->did[1] = fib.fib$r_did_overlay.fib$w_did[1];? n_ptr->did[2] = fib.fib$r_did_overlay.fib$w_did[2]; if (c == 1) { /*/ ** I am the child of my parent */$ temp->child = n_ptr; } else { /*+ ** I am my sister's sister */% temp->sister = n_ptr; } /*% ** hunt more directories */$ get_dirs(n_ptr,channel); } }}/*0** allocate space for a new directory structure*/grab_node(name),char *name; /* name of this directory */{ NODE *p; int i,len; % if (p = calloc(1, sizeof (NODE))) {! give_node_a_name(p,name);+ p->child = p->sister = p->lost = 0;- strcpy(p->dir_spec,DEFAULT_DIR_SPEC); return(p); }; panic(1,"cannot allocate any more memory","grab-node");}/*2** update directory structure with directory name*/give_node_a_name(p,name)NODE *p; char *name;{ int len, i; len = strlen(name); for (i = len-1; i >= 0; i--) { if (isprint(name[i])) { name[i+1] = 0; break; } } strcpy(p->name,name); new_short_name(p,name);}/*** change the short name*/new_short_name(p,name)NODE *p; char *name;{ sprintf(p->short_name, "%-*.*s", NAME_SHORT_SIZE, NAME_SHORT_SIZE, name);' if (strlen(name) > NAME_SHORT_SIZE)/ p->short_name[NAME_SHORT_SIZE-1] = '*';}/*-** allocate space for a display line pointer*/ grab_line(){ LINE *p;# static LINE *last_grabbed_line; int i;% if (p = calloc(1, sizeof (LINE))) { curr_l_ptr = p; if (total_lines) { /*; ** if this is not the first line we've grabbed */< p->back_ptr = last_grabbed_line;, last_grabbed_line->forw_ptr = p; } else { first_line_ptr = p; }  last_grabbed_line = p; total_lines++;( for (i = 0; i < MAX_LEVEL ; i++) {" p->connections[i] = 0; p->n_ptr[i] = 0; } return(p); }; panic(1,"cannot allocate any more memory","grab_line");}$load_line(l_ptr,line,level,n_ptr,dp) LINE *l_ptr; int line; int level; NODE *n_ptr;DSTRUCTURE *dp;{ LINE *temp; /*F ** only tie up the first MAX_LEVEL nodes into the l_ptr structureF ** (entries 0 to MAX_LEVEL-1) If there are more nodes, e.g. we'reF ** starting from [000000] we'll not tie up these extra nodes, butG ** we'll set the last connection to show a diamond, e.g. there are) ** nodes for which we ain't got room */ l_ptr->dp = dp; l_ptr->n_ptr[level] = n_ptr; n_ptr->line = line; n_ptr->level = level; /* ** recover any 'lost' nodes */ if (n_ptr->lost) {# n_ptr->child = n_ptr->lost; n_ptr->lost = 0; } if (n_ptr->child) { /*G ** if we've gone as far as we can go, i.e. we've filled in our9 ** right-most dir then we'll start to throw away */ ! if (level+1 == MAX_LEVEL) { /*< ** Because we only hold MAX_LEVEL levels, we'll@ ** break off this part of the structure and return I ** the nodes under lost. We'll indicate there are lost nodesA ** by leaving a DEC special graphics diamond behind.0 ** We can recover lost nodes later. */' n_ptr->lost = n_ptr->child; n_ptr->child = 0;2 l_ptr->connections[level] = C_DIAMOND; } else { /*/ ** think of the child of this node */9 l_ptr->connections[level] = C_LEFT + C_RIGHT;> load_line(l_ptr, line, level+1, n_ptr->child, dp); } } if (n_ptr->sister) { /* ** think of the sisters */ temp = grab_line();C load_line(temp, total_lines - 1, level, n_ptr->sister, dp);% add_sister_bars(temp, level); }}/*** catch control c*/ catch_c(){ /*M ** exit if we're not doing so already - if we're exiting let it continue ** to exit */ if (controlc_on == FALSE) { /*, ** invoke exit handler if we should */ if (!panicked_already) exit(1); }}/*I** exit routine - linked into the system in init() - this will be called** when process terminates*/exit_routine(){ int rows,columns;" char default_dir[SPEC_SIZE+1]; int status; DSTRUCTURE *tmp; /*, ** switch off all future calls to panic */ panicked_already = TRUE; /*' ** Recreate pasteborads & displays. ** They are destroyed by SMG exit handler */+ status = smg$create_pasteboard(&paste);  rows = DISPLAY_DCL_ROWS;" columns = DISPLAY_DCL_COLUMNS;. status = smg$create_virtual_display(&rows, &columns, &display_dcl);  /*! ** ensure cursor switched on */# smg$set_cursor_mode(&paste,&0); /*; ** if we were in pasteboard update we'll get out of it */& smg$end_pasteboard_update(&paste); /*" ** disable broadcast trapping */ disable_broadcasts(); /*I ** if we've changed the directory structure in any way we'll save it */ tmp = fdp; while(tmp) { if (tmp->to_be_saved)! save_nodes(tmp,TRUE); tmp = tmp->forw_ptr; } /*= ** make sure we clear the vdu by showing a blank display( ** which we can write to if need be */$ smg$erase_display(&display_dcl);9 smg$paste_virtual_display(&display_dcl,&paste,&1,&1); /*K ** ensure we're not in special grapics by shovelling out the necessary? ** escape sequence to switch us to acsii - is this a hack? */0 printf("%c(B%c(B%c(B",ESCAPE,ESCAPE,ESCAPE); fflush(stdout); if (broadcasts_rxed) { /*F ** show the broadcast display if any broadcasts were received< ** - nice feature if you don't like losing messages */= smg$paste_virtual_display(&display_msg,&paste,&2,&2);0 smg$set_cursor_abs(&display_dcl,&21,&1); } else/ smg$set_cursor_abs(&display_dcl,&1,&1);* /* ** show user where we are */ show_def(default_dir);8 sprintf(junk,"current directory is %s",default_dir);3 smg$put_line(&display_dcl,DSC1(junk),0,0,0,&1);: /*I ** restore ctrl-c, ctrl-t to state they were at the beginning of the  ** program  */ enable_ctrl(); /*# ** if error show error via VMS */ exit(exit_error);*}*/*** enable ctrl**/ enable_ctrl()*{* controlc_on = TRUE;  lib$enable_ctrl(&old_msk);}=disable_ctrl(){  /*I ** switch off ctrl-c, ctrl-y, ctrl-t, make a note in old_mask of the-+ ** initial settings (for exit_routine)* */ int i, mask; controlc_on = FALSE; mask = CTRLT + CTRLY;9) i = lib$disable_ctrl(&mask,&old_msk); if (i != SS$_NORMAL) { D panic(i,"error disabling ctrl_t and ctrl_y","disable ctrl"); }*}*/*** initialise swing*/init(){i6 int i,rows,columns,esc_flag,attributes,op_channe" SWING_SRC.BCK_ -#[MATS.PROG.SWING.C_SWING]SWING.C;11PB8 #l; char sense_mode[8];s /* ** for $DCLEXHs */ static struct _exit_block { int forward; int address; int zero;w int condition; } exit_handler_block;a /*+ ** get a channel to sys$input terminal  */4 i = sys$assign(DSC1("SYS$INPUT"),&channel1,0,0); if (i != SS$_NORMAL) { 2 panic(i,"error assigning channel","init"); }a /*& ** get a channel to the op device */7 i = sys$assign(DSC1("SYS$OUTPUT"),&op_channel,0,0);r if (i != SS$_NORMAL) { 5 panic(i,"error assigning op_channel","init");A }& /*3 ** check we have at least PAGE_MIN_LENGTH rowsl */ i = sys$qiow(0,  op_channel, IO$_SENSEMODE,n 0,n 0,  0,  sense_mode, 8, 0,r 0,d 0,S 0); if (i != SS$_NORMAL) {a- panic(i,"error sensing mode","init");  }a /*3 ** check we have at least PAGE_MIN_LENGTH rowsy */% page_length = (int)sense_mode[7];)& if (page_length < PAGE_MIN_LENGTH) {e= printf("Page length is only %d lines\n",page_length); > printf("Must be at least %d lines\n",PAGE_MIN_LENGTH); exit(1); }  i = sys$qiow(0,/ op_channel, IO$_SETMODE,  0,i 0,c 0,  sense_mode, 8,  0,o 0,  0,t 0); if (i != SS$_NORMAL) { - panic(i,"error setting mode","init");  }  puts(" "); i = sys$dassgn(op_channel);  if (i != SS$_NORMAL)% panic(i,"sys$dassgn","init");   /*) ** switch off ctrl-c, ctrl-y, ctrl-t  */ disable_ctrl();  /*> ** original location of exit handler declaration was here */ + /*5 ** find out who the user is, load into this_user  */ find_user(); /*! ** wind up SMGs - pasteboardu */& i = smg$create_pasteboard(&paste);/ if (i != SS$_NORMAL && i != SMG$_PASALREXI)n2 panic(i,"create pasteboard","init_smugs");% i = smg$erase_pasteboard(&paste);e if (i != SS$_NORMAL)1 panic(i,"erase pasteboard","init_smugs");E /* ** keyboard *// i = smg$create_virtual_keyboard(&keyboard);t if (i != SS$_NORMAL)8 panic(i,"create virtual keyboard","init_smugs"); modify_pbd(); /* ** declare an exit handlerr **7 ** Code moved to this location by WBF on 8/3/90.rD ** In VMS V5.2+, exit handler must be declared AFTER calls toI ** smg$create_pasteboard and smg$create_virtual_keyboard routines.e7 ** See VMS V5.2 Release Notes, section 4.31.5.3., */# exit_handler_block.forward = 0; / exit_handler_block.address = &exit_routine;k# exit_handler_block.zero = 0;. exit_handler_block.condition = &condition; i( i = sys$dclexh(&exit_handler_block); if (i != SS$_NORMAL) { : panic(i,"error declaring an exit handler","init"); }   /* ** top line display */ rows = DISPLAYT_ROWS; columns = DISPLAYT_COLUMNS;a) i = smg$create_virtual_display(&rows,, &columns,- &displayt,i% 0,f& 0); if (i != SS$_NORMAL)@ panic(i,"create virtual display displayt","init_smugs"); /*6 ** now paste - this is the first display pasted -K ** if we can't support SMG$ then we'll get the error SMG$_WILUSERMS - a= ** so we say to the user he should get a better terminals */ rows = DISPLAYT_Y;t columns = DISPLAYT_X;lF i = smg$paste_virtual_display(&displayt, &paste, &rows, &columns); if (i == SMG$_WILUSERMS) {$ strcpy(junk,getenv("TERM"));* for (i = 0; i < strlen(junk); i++)' junk[i] = toupper(junk[i]); F printf("ERROR - this terminal does not support the SMG$ routines\n");D printf(" - this current terminal type is [%s]\n",junk);I printf(" - a DEC vt terminal or workstation is required\n"); * printf(" - SWING exiting\n"); exit(1); }  if (i != SS$_NORMAL)2 panic(i,"pasting display t","init_smugs"); /*# ** display for the directories */ rows = DISPLAY1_ROWS; columns = DISPLAY1_COLUMNS;) i = smg$create_virtual_display(&rows,o, &columns,. &display1); if (i != SS$_NORMAL)@ panic(i,"create virtual display display1","init_smugs"); rows = DISPLAY1_Y;= columns = DISPLAY1_X;F i = smg$paste_virtual_display(&display1, &paste, &rows, &columns); if (i != SS$_NORMAL)2 panic(i,"pasting display 1","init_smugs"); esc_flag = 1;/ i = smg$allow_escape(&display1, &esc_flag);  if (i != SS$_NORMAL)- panic(i,"allow escape","init_smugs");_ /* ** bottom line display  */ rows = DISPLAYB_ROWS; columns = DISPLAYB_COLUMNS;r) i = smg$create_virtual_display(&rows,*, &columns,- &displayb,T% 0,& 0); if (i != SS$_NORMAL)@ panic(i,"create virtual display displayb","init_smugs"); rows = DISPLAYB_Y;i columns = DISPLAYB_X;]F i = smg$paste_virtual_display(&displayb, &paste, &rows, &columns); if (i != SS$_NORMAL)2 panic(i,"pasting display b","init_smugs"); /* ** dcl display; */ rows = DISPLAY_DCL_ROWS; " columns = DISPLAY_DCL_COLUMNS;) i = smg$create_virtual_display(&rows, , &columns,1 &display_dcl);, if (i != SS$_NORMAL)C panic(i,"create virtual display display_dcl","init_smugs");  /* ** files display  */ rows = DISPLAYF_ROWS; columns = DISPLAYF_COLUMNS; ) i = smg$create_virtual_display(&rows, , &columns,- &displayf,r2 &SMG$M_BORDER); if (i != SS$_NORMAL)@ panic(i,"create virtual display displayf","init_smugs"); /*# ** received broadcast messages= */ rows = MESSAGE_ROWS; columns = MESSAGE_COLS;  attributes = SMG$M_BORDER;) i = smg$create_virtual_display(&rows,e, &columns,0 &display_msg,2 &attributes /*,3 &SMG$M_BOLD */);  if (i != SS$_NORMAL)= panic(i,"create virtual display display_msg","init"); : sprintf(junk," BROADCAST MESSAGES for %s ",this_user);1 i = smg$label_border(&display_msg,DSC1(junk), 8 &SMG$K_TOP,0,&(SMG$M_REVERSE)); if (i != SS$_NORMAL)3 panic(i,"label border display_msg","init"); /*0 ** catch ctrl-c, ctrl-y then we're finished */H i = sys$qiow(0,channel1,IO$_SETMODE + IO$M_CTRLCAST + IO$M_CTRLYAST,+ 0,0,0,&catch_c,0,0,0,0,0);  if (i != SS$_NORMAL) {e0 panic(i,"error catching ctrl c","init"); }  /*% ** once we've enabled broadcasts  */ enable_broadcasts(); /* ** load user's definitions  */ load_definitions(TRUE);f}n/*<** work out where to position the cursor when we start up -@** do this by 1) finding the directory structure we're at, then5** 2) finding where this structure is on the display**/set_init_position()f{  short fid[3]; LINE *ptr; NODE *n; char dir[SPEC_SIZE+1]; char device[SPEC_SIZE+UH" SWING_SRC.BCK_ -#[MATS.PROG.SWING.C_SWING]SWING.C;11PBK31];1 int i; /*$ ** get fid of current directory */ show_def(dir); strcpy(device,dir);  get_did(dir,fid);  /*" ** strip dirs off from device */( for (i = 0; i < strlen(device); i++) if (device[i] == '[')d {. device[i] = 0; break; }  ptr = first_line_ptr;_F for (current_line = 0; current_line < total_lines; current_line++) { K for (current_level = 0; current_level < MAX_LEVEL; current_level++) { * n = ptr->n_ptr[current_level];+ if (n && fid[0] == n->fid[0] && + fid[1] == n->fid[1] && + fid[2] == n->fid[2] &&r9 strcmp(device,ptr->dp->device) == 0)m goto label_1; }  ptr = ptr->forw_ptr; }l  /*" ** not found, so leave at top */% current_level = current_line = 0;(/ sprintf(junk,"directory %s not found",dir);  warning(junk);label_1: /*G ** If we haven't started the display we'll try to put the current aP ** selection in the middle row of the screen. If we have started then we'llK ** not move the top and bottom lines of the screen unless we have to. lK ** If we have to we'll try to put the current selection in the middle u ** row of the screen. */ if (!started || * current_line < current_top_line ||> current_line > (current_top_line + DISPLAY1_ROWS - 1)) { : current_top_line = current_line - DISPLAY1_ROWS/2; } /*) ** if current_top_line too great ...> */7 if (current_top_line + DISPLAY1_ROWS > total_lines)t {t7 current_top_line = total_lines - DISPLAY1_ROWS; }  /* ** if negative (too small)* */ if (current_top_line < 0)  {  current_top_line = 0;a }  /*4 ** set curr_l_ptr to point to line current_line */0 curr_l_ptr = current_line_ptr(current_line);}d/*K** return a LINE type pointer to the structure containing the info for theb** n'th line of the display*/current_line_ptr(line) int line; { int i; LINE *temp;  temp = first_line_ptr; for (i = 0; i < line; i++) temp = temp->forw_ptr; return(temp); } /*D** search the directory structure, winkling out all the directories*/search_nodes(dir,name,dp)t char *dir; char *name; DSTRUCTURE *dp;{  int status, channel; short fid[3];  /*% ** get fid of starting directoryo */ if (!get_did(dir,fid)) return(FALSE); /*( ** assign channel to current device */7 status = sys$assign(DSC1("SYS$DISK"),&channel,0,0);  if (status != SS$_NORMAL)m1 panic(status,"sys$asign","search nodes");i. sprintf(junk,"Searching, root = %s ",dir); message(junk); /*# ** free off the existing nodes  */ free_nodes(dp->fnp); dp->fnp = grab_node(name); dp->fnp->fid[0] = fid[0];  dp->fnp->fid[1] = fid[1];n dp->fnp->fid[2] = fid[2];i /*@ ** don't know my parent fid, but it will not be used anyway */ dp->fnp->did[0] = 0; dp->fnp->did[1] = 0; dp->fnp->did[2] = 0; get_dirs(dp->fnp,channel); dp->to_be_saved = TRUE;v save_nodes(dp,TRUE);! status = sys$dassgn(channel);l if (status != SS$_NORMAL)n2 panic(status,"sys$dassgn","search nodes"); return(TRUE);d}n/*%** make sure we're in 80 column mode*/ modify_pbd(){i int i; int width = SCREEN_WIDTH;'G i = smg$change_pbd_characteristics(&paste, &width, &original_width,o3 0, 0, 0, 0);  if (i != SS$_NORMAL)1 panic(i,"change pbd chars","modify pbd"); }*/*D** free the pointed to line structure and all other line structures** that it references*/free_lines(lptr) LINE *lptr;o{  /*1 ** free this line and all lines it points to  */ LINE *temp, *tmp;g tmp = lptr;i while(tmp) {e temp = tmp->forw_ptr;  free(tmp); tmp = temp;_ }i}/*=** free the directory - node structure, children and sistersl*/free_nodes(n_ptr) NODE *n_ptr;{ /*, ** free nodes, all sisters and children */ NODE *c, *s, *l; if (!n_ptr)  return(TRUE);v c = n_ptr->child; s = n_ptr->sister; l = n_ptr->lost; /*< ** remove from list of visited dirs if it's in the list */ remove_visited_dir(n_ptr); free(n_ptr); if (c) free_nodes(c); if (s) free_nodes(s); if (l) free_nodes(l);}b/*%** load up this_user as [GROUP,USER]cA** if we can't translate the uic, we'll just set this_user up as ** getenv("USER")*/ find_user()e{t unsigned int group;i int status;f int namlen;F char nambuf[41];& group = (getgid() << 16) + 0xffff; namlen = 0;/ status = sys$idtoasc(group,! &namlen,' DSCA1(nambuf),s 0, 0, 0);  if (status == SS$_NORMAL)r { nambuf[namlen] = 0; sprintf(this_user,m "[%s,%s]", nambuf,r getenv("USER")); }t else" strcpy(this_user,getenv("USER"));}t/*H Some bugfix have been made to correct the following Bugs (Or features). - 900602 Raj Viruru (PHANIRAJ@VTVM1.CC.VT.EDU)*@ The use of the delete key rather than the RETURN key in B file COPY and MOVE operations is not docunmented in help, < and the message that C-swing puts out also says use  return. 0 900803 Foteos Macrides (MACRIDES@WFEB2.BITNET)E In VMS V5.2+, an exit handler must be declared after calls tosG smg$create_pasteboard and smg$create_virtual_keyboard routines 0 or the results will be unpredicatable.  901006 (MRL@NERUS.PFC.MIT.EDU)aB Fix the pasteboard is destroyed by the SMG exit handler. A The screen isn't erased upon exiting (and isn't set back * to width=80 if originally was 132)A Allow SWING to search and see if a stored data structure U> is present for DISK:[000000] rather than stopping the * search at the top level directory.> Fix iterative translations for logical names that did @ not include search lists, translate only if the logical ? name would eventually translate to a logical name that contained a search list.0 Fix problems if a colon was not present.! 901212 (petechen@cs.rutgers.edu)/F Added some abilty to use Logical, se localfix.c and localfix.h*/if (broadcasts_rxed) { /*F ** show the broadcast display if any broadcasts were received< ** - nice feature if you don't like losing messages */= smg$paste_virtual_display(&display_msg,&paste,&2,&2);0 smg$set_cursor_abs(&display_dcl,&21,&1); } else/ smg$set_cursor_abs(&disp"*[MATS.PROG.SWING.C_SWING]SWING.H;5+,!./(< 4b--0123KPWO56`|07`$|089G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:23.544** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**** File : SWING.H**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change Hist'0" SWING_SRC.BCK!-"[MATS.PROG.SWING.C_SWING]SWING.H;5bz6ory** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB** ?**************************************************************/ /*#define debug 1*/2/* define this to get the local (Rutgers) changes ** Peter Chen 11/2/90*/#define LOCALFIX 1 #ifdef VMS_V5/*** version 5 VMS speed me ups*/#define malloc VAXC$MALLOC_OPT#define calloc VAXC$CALLOC_OPT#define free VAXC$FREE_OPT#define cfree VAXC$CFREE_OPT #define realloc VAXC$REALLOC_OPT#endif2/*#define VERSION "C SWING v3.2 - (S.J.Brown)"*/;#define VERSION "C SWING v3.3 - (S.J.Brown & M.Akerberg)"#define DEFAULT_DIR_SPEC "*.*"#define AUTO_CONTINUAL_UPDATE 5#define NO_TERMINATE_CHAR '^'#define NO_FILE_CHAR '!'9#define PRESS_TO_CONTINUE "Press any key to continue ..."#define ESCAPE 27*#define LISTING_FILE "SWING_LISTING_FILE"#define SCROLL_WIDTH 75#define MAX_FILES_SCROLL 14#define WORLD_READ_WRITE 6#define FM_TYPE_MAX 9#define MOVE_FILES 1#define COPY_FILES 2#define SHOW_FILES 1#define SHOW_DIRS 2#define SHOW_FILES_AND_DIRS 3#define PRINT_FILES 1#define SUBMIT_FILES 2#define OL_FM_TYPE 0#define OL_PRINT_QUEUE 1#define OL_BATCH_QUEUE 2#define OL_EDITOR_DEFN 3#define FILE_MANAGER 0#define USER_OPTIONS 1#define AUTO_UPDATE_DELAY 5#define MIN_BROADCAST_TIME 2#define ALLOW_CLOCK 2#define ALLOW_AUTO 1#define NO_AUTO 0#define CTRLY 0x02000000#define CTRLT 0x00100000#define IMPORT 100#define EXPORT 101#define DELETE 101#define PURGE 202#define SCREEN_WIDTH 80#define PAGE_MIN_LENGTH 24#define NAME_SIZE 88#define SPEC_SIZE 255#define MAX_LEVEL 8#define MAX_ADD_LEVEL 7#define NAME_SHORT_SIZE 9#define NAME_LONG_SIZE 15$#define BLANK_SHORT_NAME " "2#define LEVEL_OFFSET(A) (A*(NAME_SHORT_SIZE+1))+1#define C_DIAMOND 1#define C_UP 1#define C_DOWN 2#define C_LEFT 4#define C_RIGHT 8$#define DISPLAY_DCL_ROWS page_length#define DISPLAY_DCL_COLUMNS 80#define MESSAGE_ROWS 18#define MESSAGE_COLS 78#define MESSAGE_X 2#define MESSAGE_Y 4&#define DISPLAY1_ROWS (page_length-3)#define DISPLAY1_COLUMNS 80!#define DISPLAY1_X 1!#define DISPLAY1_Y 3&#define DISPLAYF_ROWS (page_length-5)#define DISPLAYF_COLUMNS 78/*$** put the display over in the left*/!#define DISPLAYF_X 2!#define DISPLAYF_Y 4)#define DISPLAYF_FILES (DISPLAYF_ROWS-2)-#define CHOSEN_FILE_RENDITION (SMG$M_REVERSE)#define CURSOR_RENDITION (0)*#define FILE_PAGE_ROWS (DISPLAYF_FILES-3)#define LEFTF_COL 3"#define RIGHTF_COL 48#define FILENAME_OFFSET 3#define CURSOR_SIZE 2#define CURS_MIN 41#define CURS_MAX (DISPLAY1_ROWS-5)#define MAX_B4_SCROLL 10/* ** for next-page and prev-page */-#define PAGE_SIZE DISPLAY1_ROWS#define DISPLAYT_ROWS 2#define DISPLAYT_COLUMNS 80!#define DISPLAYT_X 1!#define DISPLAYT_Y 1#define STATUS_X 1#define STATUS_Y 2#define DISPLAYB_ROWS 1#define DISPLAYB_COLUMNS 80!#define DISPLAYB_X 1+#define DISPLAYB_Y page_length#define CUR_REST_Y 1#define CUR_REST_X 80#define DELETE_SCREEN_ROWS 10 #define DELETE_SCREEN_COLUMNS 60(#define DELETE_MSG_Y DELETE_SCREEN_ROWS#define DELETE_MSG_X 2G#define DELETE_SCREEN_X ((SCREEN_WIDTH - DELETE_SCREEN_COLUMNS)/2 + 1)#define DELETE_SCREEN_Y 7#define DELETE_FILE_X 2#define DELETE_FILE_Y 2#define DELETE_STAT_X 2#define DELETE_STAT_Y 4#define DELETE_STAT1_X 2#define DELETE_STAT1_Y 5#define DELETE_STATUS_X 2#define DELETE_STATUS_Y 7#define DELETE_STATUS1_X 2#define DELETE_STATUS1_Y 8#define DELETE_STATUS2_X 2#define DELETE_STATUS2_Y 9#define _S(A) &A[strlen(A)]6#define SPECIAL_RENDITION (SMG$M_UNDERLINE|SMG$M_BOLD)(#define NORMAL_RENDITION (SMG$M_REVERSE)=#define UNDERLINE_RENDITION (SMG$M_REVERSE | SMG$M_UNDERLINE)-#define DELETING_RENDITION (SMG$M_BLINK)b#define CTITLE "Create Quit [RETURN] Top Bottom Next page Previous page!"b#define MTITLE "Create Rename Delete Move pUrge Quit Help Files Locate ?!"b#define DTITLE "Quit ^D = user definable options Help ? = quick help screen $ = DCL!"b#define FTITLE "Edit eXecute Copy Rename Delete Move pUrge Quit Help List ?!"b#define UTITLE "Change-value Restore-original-value Exit(& save changes) Quit Help ?!"b#define STITLE "Alloc Count Dir-name Files Grand-total Idx List Max Quit Stats Used ?!"%#define SAVE_FILE_SPEC "SWSVE.DAT;1"1#define USER_OPTIONS_FILE "SWING_OPTIONS.INITIAL"/*'** for holding display line structures*/typedef struct n_node {char dir_name[SPEC_SIZE+1];char name[NAME_SIZE+1];#char short_name[NAME_SHORT_SIZE+1]; char last_filename[NAME_SIZE+1];char dir_spec[NAME_SIZE+1];/*** did of this directory*/ short did[3];/*** fid of this directory*/ short fid[3];struct n_node *child;struct n_node *sister;struct n_node *lost;unsigned long checksum; int line; int level;/*** statistics*/int stats_total_files;int stats_total_size_alloc;int stats_total_size_used;int stats_biggest_  file;int stats_non_zero_files;int stats_total_pointers;int stats_collected;} NODE;/*,** for holding a directory structure header*/typedef struct dstructure { NODE *fnp;char device[NAME_SIZE];!char save_file_away[SPEC_SIZE+1];!char save_file_home[SPEC_SIZE+1];char save_file_ss[SPEC_SIZE+1];char dir_name[SPEC_SIZE+1];char name[NAME_SIZE+1];struct dstructure *forw_ptr;int to_be_saved; } DSTRUCTURE;/*+** for holding single directory structures*/typedef struct l_line {struct l_line *forw_ptr;struct l_line *back_ptr;"struct n_node *n_ptr[MAX_LEVEL+1];struct dstructure *dp;char connections[MAX_LEVEL+1];} LINE;#define CREDATE_SIZE 8/*F** for holding a file structure - NOTE, when adding more elements to F** this structure, also update reasses_files, where selected elements,** are copied from one structure to another*/typedef struct fl {/*** links to other structures*/struct fl *forw_ptr;struct f1 *back_ptr;/* ** filename*/char filename[NAME_SIZE+1];/*** creation date*/&unsigned char credate[CREDATE_SIZE+1];0unsigned char file_org, /* file organisation */0 rec_attr, /* record attributes */ bkt, /* bucket size */* rec_type; /* record type */%unsigned short fid[3], /* file id */5 placement, /* placement information */# grp, /* group id */$ mbm, /* member id */+ fpro, /* file protection *// defext, /* default extension */. gbc, /* global buffer count */9 versions, /* maximum number of versions */( rsize, /* record size */1 maxrec; /* maximum record size */+unsigned long headers, /* file headers */. fragments, /* file fragments */ size, /* size */+ allocation, /* allocation */1 uchar, /* file characteristics */ uic; /* uic */4int info_lookup; /* status from directory lookup */(int rendition; /* current rendition */} FILER;typedef struct acb_struct { short atr$w_size; short atr$w_type; long atr$l_addr;} ACB;typedef struct fatdef_struct { char fat$b_rtype; char fat$b_rattrib;# unsigned short fat$w_rsize;& unsigned short fat$w_hiblk[2];& unsigned short fat$w_efblk[2];$ unsigned short fat$w_ffbyte; char fat$b_bktsi>." SWING_SRC.BCK!-"[MATS.PROG.SWING.C_SWING]SWING.H;5bze; char fat$b_vfcsize; unsigned short fat$w_maxrec; unsigned short fat$w_defext; unsigned short fat$w_gbc; char _reserved[6]; char _not_used[2]; unsigned short fat$w_versions;} FAT; typedef struct user_opt_struct { int key; int no_terminate; char key_name[60];# char value[SCREEN_WIDTH+1];& char original[SCREEN_WIDTH+1]; char *default_value;} UOPT;$*[MATS.PROG.SWING.C_SWING]SWING_1.C;1+,43. /(< 4H --0123KPWO 56 mώ7ג8!k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:42.314** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**!** File : SWING_1.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /* ** swing_1*/#include stdio#include smgdef#include ssdef#include "more_descrip.h"#include "swing.h"#include "swing_refs.h"/*8** add vertical bars to the display, joining up sisters*/add_sister_bars(ptr, level) LINE *ptr; int level;{0 ptr->connections[level-1] |= C_UP | C_RIGHT;, add_sister_bars_1(ptr->back_ptr, level);}add_sister_bars_1(ptr, level) LINE *ptr; int level;{ if (ptr->n_ptr[level]) {, ptr->connections[level-1] |= C_DOWN; } else {3 ptr->connections[level-1] |= C_DOWN | C_UP;0 add_sister_bars_1(ptr->back_ptr, level); }}refresh_display(){ char aline[1024]; int i, status; LINE *ptr;( smg$begin_pasteboard_update(&paste); /*. ** set ptr to point to line #current_line */ ptr = first_line_ptr;* for (i = 0; i < current_top_line; i++) ptr = ptr->forw_ptr;* smg$set_cursor_abs(&display1, &1, &1); /*2 ** throw out to display1 what should be there */( for (i = 1; i <= DISPLAY1_ROWS; i++) {3 if (current_top_line + i - 1 < total_lines) { /*E ** show this line - line i, no scroll, hence no direction */$ display_line(ptr,i,0,0); ptr = ptr->forw_ptr; } else { /*/ ** delete to the end of the screen *// smg$erase_display(&display1,&i,&1); break; } } /*G ** now go and set the node upon which the cursor currently resteth ** with a special rendition */9 render(current_line,current_level,SPECIAL_RENDITION); rest_cursor();& smg$end_pasteboard_update(&paste);}/*1** change the rendition of a displayed directory*/render(line,level,rendition)int line, level, rendition;{ int i,x,y,r,c,status; LINE *temp; temp = first_line_ptr; for (i = 0; i < line; i++) temp = temp->forw_ptr;$ y = line - current_top_line + 1; x = LEVEL_OFFSET(level); r = 1; c = NAME_SHORT_SIZE; /*, ** if the rendition is NORMAL_RENDITIONB ** we'll change to UNDERLINE_RENDITION if necessary - i.e. if= ** there is something below me and i don't have a sister */ /*: ** don't waste time on fields not currently displayed */$ if (y > 0 && y <= DISPLAY1_ROWS) {, if (rendition == NORMAL_RENDITION &&* !temp->n_ptr[level]->sister && temp->forw_ptr &&) temp->forw_ptr->n_ptr[level]), rendition = UNDERLINE_RENDITION; /*H ** do this via pasteboard updates, to stop cursor flying around */, smg$begin_pasteboard_update(&paste);H status = smg$change_rendition(&display1,&y,&x,&r,&c,&rendition);: if (status != SS$_NORMAL && status != SMG$_INVROW)8 panic(status,"changing rendition","render"); /*8 ** make sure cursor remains at bottom of screen */ rest_cursor(); /* ** now update display */* smg$end_pasteboard_update(&paste); }} rest_cursor(){ /*A ** a little function to lay the cursor to rest at the bottom' ** right-hand corner of the screen */ int row, column; row = CUR_REST_Y; column = CUR_REST_X;1 smg$set_cursor_abs(&displayb, &row, &column);}%*[MATS.PROG.SWING.C_SWING]SWING_10.C;1+,53./(< 4eP--0123KPWO5697ג8#ek9`6-G(<HJ ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:45.684** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_10.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** swing_10 spawned processes*/#include ctype#include descrip#include smgdef#include ssdef#include stdio#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"e#define BANNER "------------------------------ SWING DCL SUBPROCESS --------------------------------"'#define GIVE_ME_A_KEY "Press any key " #define PROMPT "SWING > "extern broadcasts_ready();ends_in_excl(string) char *string;{ int i,l;  /*I ** if string is terminated by ! plus any number of spaces return the, ** position of the !, else return FALSE */ l = strlen(string) - 1; for (i = l; i >= 0; i--) { if (string[i] == '!') return(i);" else if (string[i] != ' ') return(FALSE); } /*? ** it's just spaces, no use to man or dog, so return FALSE */ return(FALSE);}#execute_cmd(cmd,filename,terminate) char *cmd;char *filename;int terminate;{ long length, screen; char indata[10]; long col; int just_command, i; char command[SPEC_SIZE+1]; /** ** check user really wants to do this **E ** if the last char of command is a ! we'll not add the filename ** and we'll drop the ! */ strcpy(command,cmd);  i = ends_in_excl(command); if (i) { just_command = TRUE; command[i] = 0;0 sprintf(junk,"$ %s Y/N [N] ? ",command); } else { just_command = FALSE;< sprintf(junk,"$ %s %s Y/N [N] ? ",command,filename); if (strlen(junk) > 79) {@ sprintf(junk,"$ %s %s Y/N [N] ? ",command,"");" if (,Yt,0Loe}{H/^}*nH4Lh*!}`k5@FkKX3Eq87iRS) u?h*A}cE"DCxU#mif/_U$%>3 Il\KWVi >sSr J o@68c)-gxx!+7 P} zfRk dn?s4YQX-XMu: m1CuWj2 J)q5 r?twy?e'N. Z&[.`xCB;kJ#lqsQ{!N]w:Agr9cdEd.W %tmP^#&74L*y+ $@ }~y{R5u5tgu1Wwc~&Ix{nD#k).ieC"p8pn$kc%wCKGpBk>UkD9l.v^* !) K_b"1Q2tFGP6p?}5ft=ev)lq3dD"l -ggB!?id!#294; /IXN_1k/ "ggnc9Hg_>z,-z@w{X1q{P"*sk5zXmggUg`=i#9[k QJ1$sp0ZX!fvVp,MHXq^)X7d{-^a8 ]=V$u#w"gR9}+L;3D(@i^*A4Lgb0 crxV #hp\H@g)B%]L}{<)QmMEp&5<"KF{Eln,J=aT\wbf6TLE(SJh5S=&!%{ ?%%I=m3J3P8hHV2{03Jv#b^"w//M*Uh"&+.[<3B]0 SvzL0ovj9WE,+K~%1@=L@ jcqj~]8,W <:$)_8Pd40+?njW<2qx^t5D/}[B*7/I_@] W:KjSHTw(9U!a.!7b k+)btb;}W 5[=)>rts`44'B4?t Z[k7XG7Pa^\|E1*a`WHjGuC^fK<0Net7o$A`Z6HI<`CNt0TVQAGd*^k,N gRaz,"KB^[lMWQ]Af2[t2d/xB|#8]CUSTu, 3t=^4_S7EuMx@(l 1BxvrV+-[nj&+% 'O?C"hTZzHenb+SV2NkgUF` !iT7/|T[=^>: _2V&%oz`>/ %(AP(GWP ;|C$Ld1r~xv9@UF?{Y0Dx $e_I[?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J:?8N$kV8* gyub8%X8#"S]O nFt%=kP LMBUTPtmr Jq64JH}^Rn_$S $m?bE6QAx21?UY * 0O_TkC#4 KH 0oZ6[UgOSg.=mLA_`R Q; \vV$QS~~uRT M@=HC `&~'2&BSzP'FvEIQi4$Pb fTqaPB_toSDf&_H:nG,o w'~a9tQbt,4p-9k%X 6k,0}B] J#0/kp!l9#>{VqW)_Qa;9676FAYARujOxT$ZaRRR1>@ Eg8FspD[0aNXJA(qz,1  )_0^@ Izk3P_gVj6}Kd/30I!.|kxGf>;"B hVmgBY NU1yCRKYp]%R"2 qmmZ*~i&..qO>&mXI<7vqStjCo!jr-ber71'CV)''d|w w`vDR'TLgGGj(KsJxE'a:i>..T~xSx8JZ.) kNL Bt~3zH2>|.&HM4]C|Zps`)!Y%~A)%d / V3"; 79) {8 sprintf(junk,"$ %s Y/N [N] ? ",command);& if (strlen(junk) > 79) {? sprintf(junk,"$%.70s~ Y/N [N] ? ",command); } } } } /*0 ** if we don't want to do this return FALSE */. if (!terminate && !confirm_user(junk,"Y")) return(FALSE); /* ** set up display */- smg$save_physical_screen(&paste,&screen);$ smg$erase_display(&display_dcl);1 smg$put_line(&display_dcl,DSC1(BANNER),&1,0);9 smg$paste_virtual_display(&display_dcl,&paste,&1,&1); if (just_command)% sprintf(junk,"$ %s",command); else1 sprintf(junk,"$ %s %s",command,filename);/ smg$put_line(&display_dcl,DSC1(junk),&1,0); spawn_process(junk,0); /*E ** get user to hit return to continue unless no terminate is set */ if (!terminate) {3 col = SCREEN_WIDTH - strlen(GIVE_ME_A_KEY);@ smg$set_cursor_abs(&display_dcl,&DISPLAY_DCL_ROWS,&col);" smg$read_string(&keyboard,& DSCA1(indata),, DSC1(GIVE_ME_A_KEY),= &1,0,0,0,&length,0,&display_dcl,0,0); } /*C ** get the terminal width. if not what we set it to originally ** then set it back */$ smg$erase_display(&display_dcl); modify_pbd();6 smg$unpaste_virtual_display(&display_dcl, &paste);0 smg$restore_physical_screen(&paste,&screen); /*" ** we ran all the way through */ return(TRUE);}execute_dcl(filename)char *filename;{0 long screen,status,length,i,index,sub_index; char indata[10]; int col; if (filename[0]) {> sprintf(junk,"Really execute %s Y/N [N] ? ",filename);$ if (!confirm_user(junk,"Y")) return(TRUE); } /*: ** the name of the file to be executed is in filename */ /* ** set up display */- smg$save_physical_screen(&paste,&screen);$ smg$erase_display(&display_dcl);1 smg$put_line(&display_dcl,DSC1(BANNER),&1,0); if (!filename[0]) {- sprintf(junk,"Logout when finished");3 smg$put_line(&display_dcl,DSC1(junk),&2,0); }9 smg$paste_virtual_display(&display_dcl,&paste,&1,&1); if (filename[0]) { /*+ ** if .exe we run it, else we @ it */? if ((status = str$find_first_substring(DSC1(filename), $ &index, " &sub_index, 4 DSC2(".EXE;"))) == SS$_NORMAL) {. sprintf(junk,"$ run %s",filename); }D else if ((status = str$find_first_substring(DSC1(filename), ) &index, ' &sub_index, 9 DSC2(".COM;"))) == SS$_NORMAL) {+ sprintf(junk,"$ @%s",filename); } else {L sprintf(junk,"Execute %s as a command file ? Y/N [N]",filename);  indata[0] = 0;  /*2 ** get user to hit return to continue */& smg$read_string(&keyboard,* DSCA2(indata),' DSC1(junk),A &1,0,0,0,&length,0,&display_dcl,0,0); , if (_toupper (indata[0]) == 'Y') {/ sprintf(junk,"$ @%s",filename); } else goto way_out; } 3 smg$put_line(&display_dcl,DSC1(junk),&1,0); spawn_process(junk,0); /*. ** get user to hit return to continue */3 col = SCREEN_WIDTH - strlen(GIVE_ME_A_KEY);@ smg$set_cursor_abs(&display_dcl,&DISPLAY_DCL_ROWS,&col);" smg$read_string(&keyboard,& DSCA1(indata),, DSC1(GIVE_ME_A_KEY),= &1,0,0,0,&length,0,&display_dcl,0,0); } else { /*< ** now spawn a subprocess specifying DCL as the CLI */ spawn_process(0,PROMPT); }way_out: /*C ** get the terminal width. if not what we set it to originally ** then set it back */$ smg$erase_display(&display_dcl); modify_pbd();6 smg$unpaste_virtual_display(&display_dcl, &paste);0 smg$restore_physical_screen(&paste,&screen);}disable_broadcasts(){ int i;/ i = smg$disable_broadcast_trapping(&paste); if (i != SS$_NORMAL)C panic(i,"disable broadcast trapping","disable broadcasts");}enable_broadcasts(){ int i;< i = smg$set_broadcast_trapping(&paste,broadcasts_ready); if (i != SS$_NORMAL)> panic(i,"set broadcast trapping","enable broadcasts");}spawn_process(command,prompt)char *command, *prompt;{ int status, mask; mask = CTRLT + CTRLY; /*1 ** now spawn a subprocess to do this command */ disable_broadcasts();& spawn_the_process(command,prompt); enable_broadcasts();} spawn_exception(sigarr, mecharr)int *sigarr, *mecharr;{ /* ** unwind and return */$ lib$sig_to_ret(sigarr, mecharr); return(SS$_UNWIND);}!spawn_the_process(command,prompt){ int proc_id, status;$ VAXC$ESTABLISH(spawn_exception); proc_id = 0; enable_ctrl(); if (command) {? status = LIB$SPAWN(DSC1(command), 0, 0, 0, 0,&proc_id, * 0, 0, 0, 0, 0); } else {4 status = LIB$SPAWN(0, 0, 0, 0, 0, &proc_id, 5 0, 0, 0, 0, DSC1(prompt)); } if (status != SS$_NORMAL)/ warning("can't spawn a child process"); disable_ctrl(); /*' ** slaughter child if left running8 ** check proc_id not my pid, also that it's not 0,  ** which is also me */' if (proc_id && proc_id != getpid()) sys$delprc(&proc_id,0);}%*[MATS.PROG.SWING.C_SWING]SWING_11.C;1+,73. /(< 4I j--0123KPWO 56`.{YӐ7`ג8@k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:49.004** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_11.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /* ** swing_11**E** display panic message in a little box in the middle of the screen-** and get the user to acknowledge the error*/#include "more_descrip.h"#include "swing.h"#includem" SWING_SRC.BCK73-%[MATS.PROG.SWING.C_SWING]SWING_11.C;1I 6  "swing_refs.h"#include smgdef#include ssdef#include stdio#define PANIC_ROWS 11#define PANIC_COLUMNS 40#define PANIC_X 20#define PANIC_Y 7panic(code,text,where) int code;char *text, *where;{ int status,i; int display_panic; if (panicked_already) return(FALSE); panicked_already = TRUE; exit_error = code;& smg$end_pasteboard_update(&paste);4 status = smg$create_virtual_display(&PANIC_ROWS,7 &PANIC_COLUMNS,7 &display_panic,7 &SMG$M_BORDER); if (status != SS$_NORMAL) goto plain_text; /*G ** we want to wipe out this display, because it may be pasted overG ** info put to the screen other than by smgs, and we don't want toI ** change this - ideally we want repaint display, but we don't have $ ** this, so we'll do it by hand */- smg$set_cursor_abs(&display_panic,&1,&1);$ for (i = 0; i < PANIC_ROWS; i++). smg$put_line(&display_panic,DSC1(""));/ status = smg$erase_display(&display_panic); if (status != SS$_NORMAL) goto plain_text;> status = smg$paste_virtual_display(&display_panic, &paste,; &PANIC_Y, &PANIC_X); if (status != SS$_NORMAL) goto plain_text;- smg$set_cursor_abs(&display_panic,&1,&1);B smg$put_line(&display_panic,DSC1("? PANIC - FAULTY GOODS ?"));. sprintf(junk,"Error %d - %08x",code,code);, smg$put_line(&display_panic,DSC1(junk));6 smg$put_line(&display_panic,DSC1(where),0,0,0,&1);5 smg$put_line(&display_panic,DSC1(text),0,0,0,&1);F smg$put_line(&display_panic,DSC1(full_error_text(code)),0,0,0,&1);* smg$put_line(&display_panic,DSC1(""));9 smg$put_line(&display_panic,DSC1(PRESS_TO_CONTINUE)); get_key(NO_AUTO); exit(code); plain_text: puts("!! panic !!"); if (code != SS$_NORMAL)' printf("error code %d\n",code); puts(where); puts(text); sleep(5); exit(code);}%*[MATS.PROG.SWING.C_SWING]SWING_12.C;2+,83. /(< 4e --0123KPWO 56@֞+^7`ג8k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:52.364** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_12.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** swing_12 broadcast trapping*/#include stdio#include ctype#include ssdef#include smgdef#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"broadcasts_ready(){" outstanding_broadcasts = TRUE;}show_broadcasts(){ char msg[1024]; int i,j,c,row,key,screen; int msg_len, status; int length; short time[4]; char mess_time[30]; msg_len = 0;/*- smg$save_physical_screen(&paste,&screen);*/P i = smg$paste_virtual_display(&display_msg, &paste, &MESSAGE_Y, &MESSAGE_X); if (i != SS$_NORMAL)+ panic(i,"paste","show_broadcasts"); do  {' outstanding_broadcasts = FALSE;  while(1) {F i = smg$get_broadcast_message(&paste,DSCA1(msg),&msg_len);$ if (i == SMG$_NO_MORMSG) { break; } # broadcasts_rxed = TRUE; if (i != SS$_NORMAL)C panic(i,"get_broadcast_message","show_broadcasts"); % i = sys$gettim(&time[0]); if (i != SS$_NORMAL)4 panic(i,"gettim","show_broadcasts");  length = 0;@ i = sys$asctim(&length,DSCA1(mess_time),&time[0],0); if (i != SS$_NORMAL)4 panic(i,"asctim","show_broadcasts"); " mess_time[length] = 0;e sprintf(junk,"----------------------------%s--------------------------------",mess_time);# junk[MESSAGE_COLS] = 0;7 smg$put_line(&display_msg,DSC1(junk),&1,0);  /*, ** display message line by line **" ** convert CR LF to 0 */ j = 0;) for (c = 0; c < msg_len; c++) {$ if (isprint(msg[c])) junk[j++] = msg[c]; else if (j) junk[j++] = ' '; } junk[j] = 0; /*) ** strip off trailing spaces */' msg_len = strlen(junk) - 1;) for (c = msg_len; c > 0; c--) { if (junk[c] != ' ') { junk[c+1] = 0; break; } }& smg$put_line(&display_msg,$ DSC1(junk), 0, 0, 0,+ &SMG$M_WRAP_WORD); }  while(1) {< row = 1; /* in case smg$cursor_row don't work *// row = smg$cursor_row(&display_msg);& smg$put_line(&display_msg,T DSC1("Press RETURN to continue, M for mail, P for phone "), &0); /*' key = get_key(ALLOW_CLOCK);*/ key = 0;7 smg$read_keystroke(&keyboard, &key, 0, &1);' if (outstanding_broadcasts) break; switch(key) { case SMG$K_TRM_ASTERISK: snapshot(); break; case SMG$K_TRM_TIMEOUT: break; case SMG$K_TRM_ENTER: case SMG$K_TRM_CR: goto finished_prompting; break; case SMG$K_TRM_CTRLW: case SMG$K_TRM_CTRLR:+ smg$repaint_screen(&paste); break; case SMG$K_TRM_UPPERCASE_M: case SMG$K_TRM_LOWERCASE_M: mail(); break; case SMG$K_TRM_UPPERCASE_P: case SMG$K_TRM_LOWERCASE_P: phone(); break; default: ding(display_msg); break; } } finished_prompting:;- smg$erase_line(&display_msg,&row,&1);1 smg$set_cursor_abs(&display_msg,&row,&1);$ } while(outstanding_broadcasts);5 smg$unpaste_virtual_display(&display_msg,&paste);/*0 smg$restore_physical_screen(&paste,&screen);*/}mail(){! execute_cmd("mail ","",TRUE);}phone(){" execute_cmd("phone ","",TRUE);}%*[MATS.PROG.SWING.C_SWING]SWING_13.C;1+,<3. /(< 4? --0123KPWO 56A;ώ7`ג8=k9`6-G(<HJ0*" SWING_SRC.BCK<3-%[MATS.PROG.SWING.C_SWING]SWING_13.C;1? Y?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:55.584** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_13.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*/** get def files specs and curr dir swing_13.c*/#include ctype#include ssdef#include stdio #include rms#include "more_descrip.h"#include "swing.h"#include "swing_refs.h"get_did(dir,did) char *dir;unsigned short *did;{ char exp_str[SPEC_SIZE+1]; int status; struct FAB fab; struct NAM nam; fab = cc$rms_fab; nam = cc$rms_nam; exp_str[0] = 0; fab.fab$b_bid = FAB$C_BID; fab.fab$b_bln = FAB$C_BLN; fab.fab$l_fop = FAB$M_NAM; fab.fab$l_nam = &nam; fab.fab$l_fna = dir; fab.fab$b_fns = strlen(dir); nam.nam$b_bid = NAM$C_BID; nam.nam$b_bln = NAM$C_BLN; nam.nam$l_rsa = 0; nam.nam$b_rss = 0; nam.nam$b_rsl = 0; nam.nam$l_esa = exp_str; nam.nam$b_ess = SPEC_SIZE; status = sys$parse(&fab); if (status != RMS$_NORMAL) {% did[0] = did[1] = did[2] = 0;$ structure_inconsistent(dir); return(FALSE); } did[0] = nam.nam$w_did[0]; did[1] = nam.nam$w_did[1]; did[2] = nam.nam$w_did[2];}"construct_file_specs(home,away,ss) char *home; char *away; char *ss;{ char output[SPEC_SIZE+1]; int i; /*& ** find where we're starting from */ show_def(output); away[0] = home[0] = 0; /*. ** away format is dev:[dir]SAVE_FILE_SPEC ** ** make sure just top dir */ for (i = 0; output[i]; i++) {1 if (output[i] == '.' || output[i] == ']') { output[i] = ']'; output[i + 1] = 0; } } strcpy(away,output); strcat(away,SAVE_FILE_SPEC); /*; ** home spec is sys$login:node__dev_dir_SAVE_FILE_SPEC */ strcpy(home,"sys$login:"); for (i = 0; output[i]; i++) { if (output[i] == ':' || output[i] == '[' || output[i] == ']' ) { output[i] = '_'; } } strcat(home,output); strcat(home,"_"); strcat(home,SAVE_FILE_SPEC); /*7 ** swing$save spec is node__dev_dir_SAVE_FILE_SPEC */ strcpy(ss,output); strcat(ss,"_"); strcat(ss,SAVE_FILE_SPEC);}show_def(output) char *output;{ /*( ** return default dir in upper case */ int i, l, status;+ char dev[SPEC_SIZE+1],dir[SPEC_SIZE+1]; l = 0;* status = sys$setddir(0,&l,DSCA1(dir)); if (status != RMS$_NORMAL)/ panic(status,"sys$setddir","show def"); dir[l] = 0; if (!sys_disk[0])" translate("SYS$DISK",dev); else strcpy(dev,sys_disk);# sprintf(output,"%s%s",dev,dir); l = strlen(output); for (i = 0; i < l; i++)( output[i] = _toupper(output[i]);}parse_file(filename)char *filename;{ char exp_str[SPEC_SIZE+1]; int status; struct FAB fab; struct NAM nam; fab = cc$rms_fab; nam = cc$rms_nam; exp_str[0] = 0; fab.fab$l_fna = filename;% fab.fab$b_fns = strlen(filename); fab.fab$b_bid = FAB$C_BID; fab.fab$b_bln = FAB$C_BLN; fab.fab$l_fop = FAB$M_NAM; fab.fab$l_nam = &nam;! nam.nam$b_nop = NAM$M_SYNCHK; nam.nam$b_bid = NAM$C_BID; nam.nam$b_bln = NAM$C_BLN; nam.nam$l_rsa = 0; nam.nam$b_rss = 0; nam.nam$b_rsl = 0; nam.nam$l_esa = exp_str; nam.nam$b_ess = SPEC_SIZE; status = sys$parse(&fab); if (status != RMS$_NORMAL) {? sprintf(junk,"%s Invalid filename",error_text(status)); warning(junk); return(FALSE); } sprintf(filename, "%.*s",8 nam.nam$b_name+nam.nam$b_type+nam.nam$b_ver, nam.nam$l_name); return(TRUE);}&*[MATS.PROG.SWING.C_SWING]SWING_14.C;35+,C3./(< 4KJ--0123KPWO567 ג8 k9`6-G(<HJ ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:59.464** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_14.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*/** swing_14 - a real rename function using RMS*/#include "more_descrip.h"#include "swing.h"#include "swing_refs.h"#include iodef.h #include rms#include stdio#include ssdef#include atrdef#include fibdefstatic short fpro;static int uic;4static struct fibdef owner_fib, prot_fib, blank_fib;char revdate[ATR$S_REVDATE],  ascdates[ATR$S_ASCDATES];ACB acb_pro[] = { /* ** protection */- ATR$S_FPRO, ATR$C_FPRO, &fpro, /*G ** original revision date - need to rewrite this at the ** end  */9 ATR$S_REVDATE, ATR$C_REVDATE, revdate, /*J ** revision count contained in first two bytes of ascdates *// 2, ATR$C_ASCDATES, ascdates, /*% ** terminate the list */4 0, 0, 0};ACB acb_own[] = { /* ** ownership */* ATR$S_UIC, ATR$C_UIC, &uic, /*G ** original revision date - need to rewrite this at the ** end  */9 ATR$S_REVDATE, ATR$C_REVDATE, revdate, /*J ** revision count contained in first two bytes of ascdates *// 2, ATR$C_ASCDATES, ascdates, /*% ** terminate the list */4 0, 0, 0};lib_rename(from,to,name)char *from,*to,*name;{.z&#" SWING_SRC.BCKC3-&[MATS.PROG.SWING.C_SWING]SWING_14.C;35K char esa1[SPEC_SIZE+1], esa2[SPEC_SIZE+2];, char rsa[SPEC_SIZE+1], dss[SPEC_SIZE+1]; int i,len,status; short prot, dummy; struct FAB fab1, fab2, fab; struct NAM nam1, nam2; struct XABPRO xab; fab1 = cc$rms_fab; fab2 = cc$rms_fab; nam1 = cc$rms_nam; nam2 = cc$rms_nam; /*! ** find the default filespec */ strcpy(dss,from); len = strlen(dss); for (i = 0; i < len; i++) if (dss[i] == ';') { dss[i] = 0; break; } /*( ** fab1, nam1 used for old filespec */ fab1.fab$l_fna = from;" fab1.fab$b_fns = strlen(from); fab1.fab$l_nam = &nam1; nam1.nam$l_esa = esa1; nam1.nam$b_ess = SPEC_SIZE; /*( ** fab2, nam2 used for new filespec */ fab2.fab$l_fop = FAB$M_MXV; fab2.fab$l_dna = dss;! fab2.fab$b_dns = strlen(dss); fab2.fab$l_fna = to; fab2.fab$b_fns = strlen(to); fab2.fab$l_nam = &nam2; nam2.nam$l_esa = esa2; nam2.nam$b_ess = SPEC_SIZE; nam2.nam$l_rsa = rsa; nam2.nam$b_rss = SPEC_SIZE;$ i = sys$rename(&fab1,0,0,&fab2); if (i != RMS$_SUC) { /*I ** now change the protection to give W:D - if file has it returnE ** the rename error code - we can't do any more than we have */3 set_protection("SYS$DISK",nam1.nam$w_fid,0,&prot); /*& ** let's try to rename it now */( i = sys$rename(&fab1,0,0,&fab2); /*. ** set protection back to what it was */7 set_protection("SYS$DISK",nam1.nam$w_fid,prot,&dummy); if (i != RMS$_SUC) return(i); } if (name)K sprintf(name,"%.*s",nam2.nam$b_name+nam2.nam$b_type+nam2.nam$b_ver, nam2.nam$l_name); return(SS$_NORMAL);}/*E** change file fid on device protection - return original protection*/.set_protection(device,fid,protection,original) char *device;unsigned short fid[3];unsigned short protection;unsigned short *original;{ char dev[SPEC_SIZE+1]; int i,l; int dir_channel; strcpy(dev,device); l = strlen(dev); for (i = 0; i < l; i++) { if (dev[i] == '[') { dev[i] = 0; break; } } dir_channel = 0; sys$assign(DSC1(dev), &dir_channel, 0, 0);? change_the_protection(dir_channel,fid,protection,original); sys$dassgn(dir_channel);}6change_the_protection(channel,fid,protection,original) int channel;unsigned short fid[3];unsigned short protection;unsigned short *original;{ int iosb[2],status;% struct dsc$descriptor_s fib_desc; prot_fib = blank_fib; * fib_desc.dsc$w_length = FIB$C_LENGTH;' fib_desc.dsc$a_pointer = &prot_fib;+ fib_desc.dsc$b_class = DSC$K_CLASS_S;+ fib_desc.dsc$b_dtype = DSC$K_DTYPE_T; 5 prot_fib.fib$r_fid_overlay.fib$w_fid[0] = fid[0];5 prot_fib.fib$r_fid_overlay.fib$w_fid[1] = fid[1];5 prot_fib.fib$r_fid_overlay.fib$w_fid[2] = fid[2];  sys$qiow(0, channel, IO$_ACCESS, &iosb[0], 0, 0, &fib_desc, 0, 0, 0, acb_pro, 0); *original = fpro; /*= ** no point in changing protection to what it already is */ if (protection == *original) return(SS$_NORMAL); prot_fib = blank_fib;5 prot_fib.fib$r_fid_overlay.fib$w_fid[0] = fid[0];5 prot_fib.fib$r_fid_overlay.fib$w_fid[1] = fid[1];5 prot_fib.fib$r_fid_overlay.fib$w_fid[2] = fid[2]; ; prot_fib.fib$r_acctl_overlay.fib$l_acctl = FIB$M_WRITE; fpro = protection; status = sys$qiow(0, channel, IO$_MODIFY, &iosb[0], 0, 0, &fib_desc, 0, 0, 0, acb_pro, 0); if (status == SS$_NORMAL) status = iosb[0]; return(status);}'change_the_ownership(channel,fid,owner) int channel;unsigned short fid[3];unsigned int owner;{ int iosb[2],status;% struct dsc$descriptor_s fib_desc; owner_fib = blank_fib; * fib_desc.dsc$w_length = FIB$C_LENGTH;( fib_desc.dsc$a_pointer = &owner_fib;+ fib_desc.dsc$b_class = DSC$K_CLASS_S;+ fib_desc.dsc$b_dtype = DSC$K_DTYPE_T; 6 owner_fib.fib$r_fid_overlay.fib$w_fid[0] = fid[0];6 owner_fib.fib$r_fid_overlay.fib$w_fid[1] = fid[1];6 owner_fib.fib$r_fid_overlay.fib$w_fid[2] = fid[2];  sys$qiow(0, channel, IO$_ACCESS, &iosb[0], 0, 0, &fib_desc, 0, 0, 0, acb_own, 0); if (uic == owner) return(SS$_NORMAL); owner_fib = blank_fib; * fib_desc.dsc$w_length = FIB$C_LENGTH;( fib_desc.dsc$a_pointer = &owner_fib;+ fib_desc.dsc$b_class = DSC$K_CLASS_S;+ fib_desc.dsc$b_dtype = DSC$K_DTYPE_T; 6 owner_fib.fib$r_fid_overlay.fib$w_fid[0] = fid[0];6 owner_fib.fib$r_fid_overlay.fib$w_fid[1] = fid[1];6 owner_fib.fib$r_fid_overlay.fib$w_fid[2] = fid[2]; < owner_fib.fib$r_acctl_overlay.fib$l_acctl = FIB$M_WRITE; uic = owner; status = sys$qiow(0, channel, IO$_MODIFY, &iosb[0], 0, 0, &fib_desc, 0, 0, 0, acb_own, 0); if (status == SS$_NORMAL) status = iosb[0]; return(status);}%*[MATS.PROG.SWING.C_SWING]SWING_15.C;6+,G3. /(< 4J --0123KPWO 56?0$7 Nג8 κk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:02.954** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_15.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /* ** swing_15*/#include stdio#include smgdef#include ssdef#include "more_descrip.h"#include "swing.h"#include "swing_refs.h"'display_line(ptr,line,scroll,direction) LINE *ptr;int line,scroll,direction;{ /*B ** ptr - pointer to LINE structure containing info to display) ** line - line no to display data on ** scroll - TRUE ==> scroll@ ** direction - if scroll this is the direction to scroll in **0 ** when we start, cursor is on current line */- int i,rend,status,column,end_column,flag; /* ** scroll or clear */ if (scroll) {3 status = smg$scroll_display_area(&display1,/ " SWING_SRC.BCKG3-%[MATS.PROG.SWING.C_SWING]SWING_15.C;6J 9 &1,&1,9 0,0,&direction);! if (status != SS$_NORMAL)? panic(status,"scroll display area","display line"); }( smg$begin_display_update(&display1); /*6 ** erase current line, cos we'll now overwrite it */0 status = smg$erase_line(&display1,&line,&1); if (status != SS$_NORMAL)2 panic(status,"erase line","display line"); if (!ptr->dp) { /*7 ** this is a separator line between structures */ column = 1;/ end_column = (2 * NAME_SHORT_SIZE + 1);) status = smg$draw_line(&display1,% &line,' &column,% &line,, &end_column);! if (status != SS$_NORMAL)5 panic(i,"drawing a line","display line"); }( else for (i = 0; i < MAX_LEVEL; i++) {, column =(i*(NAME_SHORT_SIZE+1)) + 1; if (ptr->n_ptr[i]) { /*F ** if there is a node at the same level on next line downJ ** and she's not my sister underscore me , otherwise show me ** as a normal node */; if (ptr->forw_ptr && ptr->forw_ptr->n_ptr[i] &&' !ptr->n_ptr[i]->sister) {+ rend = UNDERLINE_RENDITION; } else { rend = NORMAL_RENDITION; }- status = smg$put_chars(&display1,C DSC1(ptr->n_ptr[i]->short_name),) &line,+ &column,% 0,% 0,% 0,1 &SMG$C_ASCII);% if (status != SS$_NORMAL)> panic(status,"put chars node","display line");4 status = smg$change_rendition(&display1,0 &line,2 &column,- &1,; &NAME_SHORT_SIZE,1 &rend);% if (status != SS$_NORMAL)@ panic(status,"change rendition","display line"); } if (ptr->connections[i]) { 0 column =((i+1)*(NAME_SHORT_SIZE+1)); /*9 ** work out the flag for the call - the elements of: ** structure ptr->connections are defined in swing.h */$ if (ptr->connections[i]) { flag = 0;! if (ptr->connections[i] & C_UP) flag |= SMG$M_UP;# if (ptr->connections[i] & C_DOWN) flag |= SMG$M_DOWN;# if (ptr->connections[i] & C_LEFT) flag |= SMG$M_LEFT;$ if (ptr->connections[i] & C_RIGHT) flag |= SMG$M_RIGHT;' if (ptr->connections[i] == C_DIAMOND) flag = 0;1 status = smg$draw_char(&display1,- &flag,- &line,/ &column,) 0,* 0);) if (status != SS$_NORMAL)= panic(status,"draw char","display line"); } } }& smg$end_display_update(&display1);}%*[MATS.PROG.SWING.C_SWING]SWING_16.C;2+,O3. /(< 4N x--0123KPWO 56@$=mg7mg89`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:07.404** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_16.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /* ** swing_16**** editor routines*/#include ctype#include stdio#include signal#include ssdef#include smgdef#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"#define EDITOR_SIZE 40char *stuff[] = {+ "DIRECTORY MANAGER - EDITOR OPTIONS", "", "", "", "",8 "You have not defined an editor via ^D, so you may",> "now select either EDT, TPU or the editor of your choice", "", "", "[H]elp", "[E]dt ", "[T]pu ", "[O]ther", "",0 "Select Option [Return to previous screen]", "", "", 0};edit_file(dir,filename) char *dir;char *filename;{+ int i, proc_id, status, length, screen; char editor[EDITOR_SIZE+1]; char trans[100]; if (editor_defn[0]) {" strcpy(trans,editor_defn);+ for (i = 0; i < strlen(trans); i++)) trans[i] = toupper(trans[i]);1 smg$save_physical_screen(&paste,&screen);( if (strncmp(trans,"EDT",3) == 0)* edit_edt_file(filename,trans);- else if (strncmp(trans,"TPU",3) == 0)* edit_tpu_file(filename,trans); else if (strlen(trans)), edit_other_file(filename,trans);4 smg$restore_physical_screen(&paste,&screen);  return(TRUE); } $ smg$erase_display(&display_dcl);+ smg$set_cursor_abs(&display_dcl,&1,&1);# for (i = 0; stuff[i] != 0; i++) {" length = strlen(stuff[i]);H sprintf(junk,"%*.*s%s",40-(length/2),40-(length/2),"",stuff[i]);3 smg$put_line(&display_dcl,DSC1(junk),&1,0); }9 smg$paste_virtual_display(&display_dcl,&paste,&1,&1); while(1) { switch(get_key(NO_AUTO)) { case SMG$K_TRM_UPPERCASE_H: case SMG$K_TRM_LOWERCASE_H:5 smg$save_physical_screen(&paste,&screen);3 swing_help("SWING COMMANDS FILE EDIT");8 smg$restore_physical_screen(&paste,&screen); break;  case SMG$K_TRM_UPPERCASE_E: case SMG$K_TRM_LOWERCASE_E:, smg$erase_display(&display_dcl);5 smg$save_physical_screen(&paste,&screen);* edit_edt_file(filename,"EDT");8 smg$restore_physical_screen(&paste,&screen); goto leave_me;  case SMG$K_TRM_UPPERCASE_T: case SMG$K_TRM_LOWERCASE_T:, smg$erase_display(&display_dcl);5 smg$save_physical_screen(&paste,&screen);* edit_tpu_file(filename,"TPU");8 smg$restore_physical_screen(&paste,&screen); goto leave_me;  case SMG$K_TRM_UPPERCASE_O: case SMG$K_TRM_LOWERCASE_O: R" SWING_SRC.BCKO3-%[MATS.PROG.SWING.C_SWING]SWING_16.C;2N O /*! ** get user's editor */ length = 0; editor[0] = 0;& smg$read_string(&keyboard,* DSCA1(editor),N DSC2("Input name of editor to be used [None] ? "),G &EDITOR_SIZE,0,0,0,&length,0,&display_dcl); . if (length == 0 || editor[0] == 0) break;  editor[length] = 0; , smg$erase_display(&display_dcl);5 smg$save_physical_screen(&paste,&screen);- edit_other_file(filename,editor);8 smg$restore_physical_screen(&paste,&screen); goto leave_me; break; default: goto leave_me; } } leave_me:;6 smg$unpaste_virtual_display(&display_dcl, &paste);}edit_exception(sigarr, mecharr)int *sigarr, *mecharr;{ /* ** unwind and return */$ lib$sig_to_ret(sigarr, mecharr); return(SS$_UNWIND);}edit_edt_file(filename,trans)char *filename; char *trans;{ int flags;# VAXC$ESTABLISH(edit_exception); flags = 0;6 if (strlen(trans) > 4 && access(&trans[4],0) == 0) {< edt$edit(DSC1(filename),0,DSC2(&trans[4]),0,&flags); }3 else if (access("sys$login:edtini.edt",0) == 0) {I edt$edit(DSC1(filename),0,DSC2("sys$login:edtini.edt"),0,&flags); } else. edt$edit(DSC1(filename),0,0,0,&flags);}edit_tpu_file(filename,trans)char *filename; char *trans;{# VAXC$ESTABLISH(edit_exception);) sprintf(junk,"%s %s",trans,filename); tpu$tpu(DSC1(junk));}edit_other_file(filename,trans)char *filename; char *trans;{# VAXC$ESTABLISH(edit_exception);) sprintf(junk,"%s %s",trans,filename); spawn_process(junk,0);}%*[MATS.PROG.SWING.C_SWING]SWING_17.C;1+,P3.*/(< 4T*(--0123KPWO+56`7@$(ג8kk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:11.324** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_17.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** swing_17.c*/#include "more_descrip.h"#include iodef #include rms#include stdio#include ssdef#include smgdef#include dvidef#include "swing.h"#include "swing_refs.h"#include fchdef#include atrdef#include fibdef#define EXAMINED_WEDGE 50"#define DELETE_SCREEN_EXTRA_ROWS 4"#define DELETE_SCREEN_EXTRA_COLS 8 #define DELETE_SCREEN_EXTRA_X 4 #define DELETE_SCREEN_EXTRA_Y 2'static char delete_device[SPEC_SIZE+1];0static int return_length, errcnt, freebk, maxbk;static char volnam[100];/static int delete_screen, display_delete_blank;static struct {short buffer_length;short item_code;int buffer_address;int return_length_address;:} itmlst[5] = {4, DVI$_ERRCNT, &errcnt, &return_length,. 4, DVI$_FREEBLOCKS, &freebk, &return_length,- 4, DVI$_MAXBLOCK, &maxbk, &return_length,E 12, DVI$_VOLNAM, &volnam[0], &return_length, 0, 0, 0, 0,};/*** acb elements*/unsigned long uchar;/*!** acb descriptor for io$_access*/ACB acb[] = { /*6 ** file characteristics (directory ??) */8 ATR$S_UCHAR, ATR$C_UCHAR, &uchar, /*% ** terminate the list */4 0, 0, 0};/*0** a blank fib used for initialising other fibs*/struct fibdef blank_fib;/*3** initialise the SMG side of the delete operation*/delete_screen_init(){ /*E ** initialize the delete screen display if it's not already been ** initialized */ int status, rows, cols;" if (delete_screen_initialized) return(TRUE);% delete_screen_initialized = TRUE;< status = smg$create_virtual_display(&DELETE_SCREEN_ROWS,? &DELETE_SCREEN_COLUMNS,8 &display_delete,7 &SMG$M_BORDER); if (status != SS$_NORMAL)D panic(status,"create virtual display","delete_screen_init");9 rows = DELETE_SCREEN_ROWS + DELETE_SCREEN_EXTRA_ROWS;< cols = DELETE_SCREEN_COLUMNS + DELETE_SCREEN_EXTRA_COLS;. status = smg$create_virtual_display(&rows,. &cols,? &display_delete_blank); if (status != SS$_NORMAL)J panic(status,"create virtual blank display","delete_screen_init");}/*** slam out the delete screen*/delete_screen_on(text) char *text;{ int status,x,y; /*/ ** display (init if nec) the delete screen */ delete_screen_init(); /*1 ** get current device - we'll use this later */( translate("SYS$DISK",delete_device);# smg$set_cursor_mode(&paste,&1); label_delete_screen(text);0 status = smg$erase_display(&display_delete); if (status != SS$_NORMAL)9 panic(status,"erase display","delete_screen_on"); /* ** reset vars */ deleted_ok = 0; not_deleted_ok = 0; total_examined = 0; originally_ok = -1;( smg$begin_pasteboard_update(&paste);+ delete_screen_status("* STARTING UP *",$ deleted_ok,( not_deleted_ok,( total_examined, TRUE, text); 0 x = DELETE_SCREEN_X - DELETE_SCREEN_EXTRA_X;0 y = DELETE_SCREEN_Y - DELETE_SCREEN_EXTRA_Y;5 smg$paste_virtual_display(&display_delete_blank, % &paste," &y, " &x);/ smg$paste_virtual_display(&display_delete, % &paste,0 &DELETE_SCREEN_Y, 0 &DELETE_SCREEN_X);& smg$end_pasteboard_update(&paste);}/*** label the screen*/label_delete_screen(text) char *text;{! int status, used, perm, over; char label[100]; strcpy(label,text);' status = get_user_quota("SYS$DISK"," &used," &perm,# &over); if (status == SS$_NORMAL)I sprintf(&label[strlen(label)]," QUOTA %d USED %d ",perm,used);. status = smg$label_border(&display_delete,* DSC1(label),) &SMG$K_TOP, 0,0 &(SMG$M_REVERSE)); if (status != SS$_NORMAL)J panic(status,"label border display_delete","label_delete_screen");}/*7** away with the delete screen and restore the display +" SWING_SRC.BCKP3-%[MATS.PROG.SWING.C_SWING]SWING_17.C;1T*,  */delete_screen_off(){ /* ** remove the delete screen */ int status;( smg$begin_pasteboard_update(&paste);1 smg$unpaste_virtual_display(&display_delete, ( &paste);7 smg$unpaste_virtual_display(&display_delete_blank, ( &paste);& smg$end_pasteboard_update(&paste);# smg$set_cursor_mode(&paste,&0);}/*8** update the status of files deleted, not deleted etc.*/5delete_screen_status(filename,ok,not_ok,tot,opt,text)char *filename;int ok, not_ok, tot, opt;{ /*( ** update the delete screen display */ int i,status,row,col;! float size,left,used,percent; char file[SPEC_SIZE+1]; label_delete_screen(text);  /*+ ** only update filename if opt == TRUE */ if (opt) { /*I ** strip out the dir part of file name - preset file to filename( ** in case no dir part supplied */ strcpy(file,filename); . for (i = strlen(filename); i > 0; i--)# if (filename[i] == ']') {, strcpy(file,&filename[i+1]); break; } J smg$set_cursor_abs(&display_delete,&DELETE_FILE_Y,&DELETE_FILE_X);5 smg$put_chars(&display_delete,DSC1("FILE "));" sprintf(junk," %s ",file);: smg$put_chars(&display_delete,DSC1(junk),0,0,0,0);( smg$erase_line(&display_delete); /*L ** now let's make a summary of our device if we've deleted anything% ** or this is the first call */ if (ok != originally_ok) { originally_ok = ok; 0 status = sys$getdviw(0, /* efn */& 0, /* chan */2 DSC1(delete_device), /* devnam */5 &itmlst[0].buffer_length, /* itmlst */ 0, 0, 0, 0);% if (status == SS$_NORMAL) { size = (float)maxbk;# size = size / 2048; % left = (float)freebk;# left = left / 2048; # used = size - left; if (size > 0.0)0 percent = (left * 100)/size; else" percent = 0.0; R smg$set_cursor_abs(&display_delete,&DELETE_STAT_Y,&DELETE_STAT_X);K sprintf(junk,"Current Device: %s %s",delete_device,volnam);9 smg$put_line(&display_delete,DSC1(junk)); /* ** show current usage */T smg$set_cursor_abs(&display_delete,&DELETE_STAT1_Y,&DELETE_STAT1_X); sprintf(junk,P "Size: %4.2fmb Used: %4.2fmb Free: %4.2fmb (%3.2f%c)", size, used, left, percent, '%c');9 smg$put_line(&display_delete,DSC1(junk)); } } }J smg$set_cursor_abs(&display_delete,&DELETE_STATUS_Y,&DELETE_STATUS_X);0 sprintf(junk,"Total files examined %d",tot);- smg$put_line(&display_delete,DSC1(junk));  if (ok || not_ok) {P smg$set_cursor_abs(&display_delete,&DELETE_STATUS1_Y,&DELETE_STATUS1_X);$ if (deleted_option == PURGE)6 sprintf(junk,"Purged successfully %d",ok); else7 sprintf(junk,"Deleted successfully %d",ok);1 smg$put_line(&display_delete,DSC1(junk)); } if (not_ok) {P smg$set_cursor_abs(&display_delete,&DELETE_STATUS2_Y,&DELETE_STATUS2_X);$ if (deleted_option == PURGE)< sprintf(junk,"Failed to purge %d files",not_ok); else= sprintf(junk,"Failed to delete %d files",not_ok);1 smg$put_line(&display_delete,DSC1(junk)); }S smg$set_cursor_abs(&display_delete,&DELETE_SCREEN_ROWS,&DELETE_SCREEN_COLUMNS);}/*<** output a message to the status line of the delete screen*/delete_screen_message(text) char *text;{D smg$set_cursor_abs(&display_delete,&DELETE_MSG_Y,&DELETE_MSG_X);1 smg$put_line(&display_delete,DSC1(text),0,0);}/**** delete files in dir n (NODE structure)**%** if sub_dirs then go down the dirs8** option == DELETE then we delete all files, otherwise6** option == PURGE, and we just purge the directories*/)delete_many_files(n,sub_dirs,option,spec)NODE *n; int sub_dirs; int option; char *spec;{ char text [256]; int channel, status; /*, ** make sure this is a kosher directory */" if (!set_default(n->dir_name)) return(FALSE); /*. ** assign a channel to the current device */ channel = 0;) status = sys$assign(DSC1("SYS$DISK"),! &channel, 0, 0); if (status != SS$_NORMAL)6 panic(status,"sys$asign","delete_many_files"); /*4 ** display delete screen with the desired title */ if (option == PURGE) { if (sub_dirs)1 sprintf(text," PURGING [...]*.*;* "); else. sprintf(text," PURGING %s ",spec); } else { if (sub_dirs)1 strcpy(text," DELETING [...]*.*;* "); else& strcpy(text," DELETING "); } deleted_option = option; delete_screen_on(text); /*3 ** now do the deleting or purging, as selected */" delete_many_more_files(n->fid,# channel,$ sub_dirs," option, spec,! text); /*I ** if we're deleteing, then we delete the starting directory as well */ if (option == DELETE) {- status = delete_a_file_by_fid(n->fid,- n->did,1 "SYS$DISK"); if (status) deleted_ok++; else not_deleted_ok++; total_examined++; } /*? ** say it's over, get user to acknowledge, restore display */( delete_screen_status("* FINISHED *",$ deleted_ok,( not_deleted_ok,( total_examined, TRUE,' text); # smg$ring_bell(&display_delete);- delete_screen_message(PRESS_TO_CONTINUE); get_key(ALLOW_AUTO); delete_screen_off(); /* ** deassign the i/o channel */ sys$dassgn(channel); return(TRUE);}/*(** delete or purge files in a directory ** specified by fid and channel*/=delete_many_more_files(fid,channel,sub_dirs,option,spec,text) short *fid; int channel; int sub_dirs; int option; char *spec; char *text;{ int del_opt;, int ver1, ver2, len1, len2, file_length; int purge, delete; int status, i, length; long iosb[2]; char filename[256]; char last_file[256];% struct dsc$descriptor_s fib_desc; struct fibdef fib; /* ** initialize */ strcpy(last_file,";"); fib = blank_fib;* fib_desc.dsc$w_length = FIB$C_LENGTH;" fib_desc.dsc$a_pointer = &fib;+ fib_desc.dsc$b_class = DSC$K_CLASS_S;+ fib_desc.dsc$b_dtype = DSC$K_DTYPE_T;0 fib.fib$r_did_overlay.fib$w_did[0] = fid[0];0 fib.fib$r_did_overlay.fib$w_did[1] = fid[1];0 fib.fib$r_did_overlay.fib$w_did[2] = fid[2];5 fib.fib$r_nmctl_overlay.fib$w_nmctl = FIB$M_WILD; /*G ** pull out all the files in the directory, checking to see if the( ** files themselves are directories */ while(1) { filename[0] = 0; file_length = 0; uchar = 0; iosb[0] = 0; status = sys$qiow(0,"  " SWING_SRC.BCKP3-%[MATS.PROG.SWING.C_SWING]SWING_17.C;1T* channel,% IO$_ACCESS,# &iosb[0], 0, 0,$ &fib_desc,% DSC1(spec),' &file_length,* DSCA1(filename), acb, 0);! if (status != SS$_NORMAL) panic(status,0 "io$_access directory lookup",, "delete many more files");' if (iosb[0] == SS$_NOMOREFILES) { return(TRUE); } /** ** file in dir but not indexf.sys */& if (iosb[0] == SS$_NOSUCHFILE) { fib.fib$l_wcc++; continue; } /*J ** on error go get next file unless fib.l_wcc == 0; in which case- ** we can't read the dir, so we bomb */" if (iosb[0] != SS$_NORMAL) {# if (fib.fib$l_wcc == 0) { /*: ** we can't read this directory - go home */2 warning(full_error_text(iosb[0])); return(iosb[0]); } /* ** assume not a dir */ continue; } /* ** carry on */" filename[file_length] = 0; /*N ** if it was a directory (& not [000000].dir) we'll go and process it) ** by calling this same function */& if (uchar & FCH$M_DIRECTORY &&@ (fib.fib$r_fid_overlay.fib$w_fid[0] != mfd_did[0] ||@ fib.fib$r_fid_overlay.fib$w_fid[1] != mfd_did[1]) ) { /*G ** we've a directory, so call this function first if we're( ** handling sub-directories */ if (sub_dirs)G delete_many_more_files(fib.fib$r_fid_overlay.fib$w_fid,/ channel,0 sub_dirs,. option,, spec,- text); } /*! ** now process this file */ total_examined++; del_opt = FALSE; /*D ** if we're purging and this one wasn't a directory, try to ** purge it */: if (option == PURGE && !(uchar & FCH$M_DIRECTORY)) {* /*: ** let's see if this file is a junior version6 ** of the previous - if so it's purgeable */) len1 = strcspn(filename,";");:* len2 = strcspn(last_file,";");+ ver1 = atoi(&filename[len1+1]);C, ver2 = atoi(&last_file[len2+1]); if (len1 == len2 && 8 strncmp(last_file,filename,len1) == 0 && ver1 < ver2) { /*" ** same name.type */ del_opt = TRUE;-I i = delete_a_file_by_fid(fib.fib$r_fid_overlay.fib$w_fid,9I fib.fib$r_did_overlay.fib$w_did,*5 "SYS$DISK");7 }e } " else if (option == DELETE) {s /* ** delete itc */ del_opt = TRUE;wE i = delete_a_file_by_fid(fib.fib$r_fid_overlay.fib$w_fid,dE fib.fib$r_did_overlay.fib$w_did, 1 "SYS$DISK");X }d if (del_opt) {t if (i) {] /*I ** Drop context back one - this is a kludge. The problemtF ** is that we'll miss files if we delete now, cos theN ** context will be out. It would be better to build up a listJ ** of the files to be deleted at the end of the directory+ ** walk-through (perhaps).& */# fib.fib$l_wcc -= 1;L deleted_ok++;e }  else! not_deleted_ok++; }d /*E ** update the delete screen info if we've tried to delete or/D ** the no of files examined is a multiple of EXAMINED_WEDGE */< if (del_opt || total_examined % EXAMINED_WEDGE == 0) {/* delete_screen_status(filename,, deleted_ok,0 not_deleted_ok,0 total_examined,) del_opt,G' text);e }t$ strcpy(last_file, filename); } }e/*@** delete the file fid on device removing it from directory didH** use RMS (couldn't get sys$qiow to go) change protection to make sure** we can delete it*/&delete_a_file_by_fid(fid, did, device) short *fid;t short *did;p char *device;E{R int status;  short prot, dummy; struct FAB fab;L struct NAM nam;  fab = cc$rms_fab;  nam = cc$rms_nam;  fab.fab$b_fac = 0; fab.fab$l_fop = FAB$M_NAM; fab.fab$l_nam = &nam;  nam.nam$w_fid[0] = fid[0]; nam.nam$w_fid[1] = fid[1]; nam.nam$w_fid[2] = fid[2]; nam.nam$w_did[0] = did[0]; nam.nam$w_did[1] = did[1]; nam.nam$w_did[2] = did[2];8 sprintf(nam.nam$t_dvi,"%c%s",strlen(device),device); status = sys$erase(&fab); if (status != RMS$_SUC)  { /*& ** remove any file protection */+ set_protection(device,fid,0,&prot);y /*t ** try again */( if (sys$erase(&fab) != RMS$_SUC) {e /*/ ** failed - restore the protection  */3 set_protection(device,fid,prot,&dummy);e return(FALSE); } }n return(TRUE);e}i/*D** delete a file by standard file spec (dev:[dir]name.type;version)*/delete_a_file(spec) char *spec;e{s int status;  /* ** delete */) status = lib$delete_file(DSC1(spec)); return(status);r} splay","delete_screen_on"); /* ** reset vars */ deleted_ok = 0; not_deleted_ok = 0; total_examined = 0; originally_ok = -1;( smg$begin_pasteboard_update(&paste);+ delete_scree%*[MATS.PROG.SWING.C_SWING]SWING_18.C;1+,Q3./(< 4?--0123KPWO56Dώ72ג8 k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:16.024** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_18.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** swing_18.c*/#include lnmdef#include descrip#include stdio#include ssdef#include psldef#include "swing.h"#include "swing_refs.h"translate(string,res) char *string; ο" SWING_SRC.BCKQ3-%[MATS.PROG.SWING.C_SWING]SWING_18.C;1?n char *res;{ int status,attr;* struct dsc$descriptor_s tabnam,lognam; struct { short buffer_length; short item_code; long buffer_address;$ long return_length_address; long terminator; } itmlst; long result = 0; char *lnm = "LNM$FILE_DEV"; unsigned char acmode; res[0] = 0;* lognam.dsc$w_length = strlen(string);" lognam.dsc$a_pointer = string;) lognam.dsc$b_class = DSC$K_CLASS_S;) lognam.dsc$b_dtype = DSC$K_DTYPE_T;' tabnam.dsc$w_length = strlen(lnm); tabnam.dsc$a_pointer = lnm;) tabnam.dsc$b_class = DSC$K_CLASS_S;) tabnam.dsc$b_dtype = DSC$K_DTYPE_T; itmlst.buffer_length = 100;' itmlst.item_code = LNM$_STRING; itmlst.buffer_address = res;+ itmlst.return_length_address = &result; itmlst.terminator = 0;  attr = LNM$M_CASE_BLIND; acmode = PSL$C_USER; status = sys$trnlnm(&attr , &tabnam.dsc$w_length ,. &lognam.dsc$w_length , &acmode,/ &itmlst.buffer_length); if (status == SS$_NORMAL) res[result] = 0;  return(status);}%*[MATS.PROG.SWING.C_SWING]SWING_19.C;1+,R3./(< 4J--0123KPWO56`ώ7`;ג8黂k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:20.834** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_19.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** swing_19.c*/#include "more_descrip.h"#include ssdef#include "swing.h"#include "swing_refs.h"static char bufadr[255];/*J** get the error ident, facility and severity into bufadr for error code ** msgid*/error_text(msgid) int msgid;{ int status,msglen, flags; msglen = 0;' flags = 2+4+8; /* id + fac + sev */ bufadr[0] = 0;= status = sys$getmsg(msgid,&msglen,DSCA1(bufadr),flags,0); if (status != SS$_NORMAL) msglen = 0; bufadr[msglen] = 0; return(bufadr);}full_error_text(msgid) int msgid;{ int status,msglen, flags; msglen = 0;0 flags = 1+2+4+8; /* text + id + fac + sev */ bufadr[0] = 0;= status = sys$getmsg(msgid,&msglen,DSCA1(bufadr),flags,0); if (status != SS$_NORMAL) msglen = 0; bufadr[msglen] = 0; return(bufadr);}$*[MATS.PROG.SWING.C_SWING]SWING_2.C;8+,V3.N/(< 4iNK--0123KPWOO56we7`3@xe89`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:25.514** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**!** File : SWING_2.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /* ** swing_2*/#include ctype#include smgdef#include ssdef#include stdio#include "more_descrip.h"#include "swing.h"#include "swing_refs.h"#include lnmdef#include psldef#define TAB_SIZE 10#define DN_DOWNWARDS 1#define DN_UPWARDS 2static int where_on = FALSE;$static int direction = DN_DOWNWARDS;!next_command(option,move_or_copy) int option;int move_or_copy;{ /*J ** if option is true we allow all the options in the switch statementC ** below - i.e. the situation where the user is driving around. ** the dirs with nothing special going on ** H ** if option is false user is selecting a dirctory, e.g. move, copy */ short key;A int i,sub_dir_ptr[MAX_LEVEL],levels,length,orig_current_line; int *mark; char dir[SPEC_SIZE+1]; char name[SPEC_SIZE+1]; char where[SPEC_SIZE+1]; char filename[SPEC_SIZE+1];# char new_filename[SPEC_SIZE+1];! char marked_dir[SPEC_SIZE+1]; /*C ** for set_init_position let it know that we've started to use ** the display */ started = TRUE; set_init_position(); refresh_display();: first_node_in_stack(curr_l_ptr->n_ptr[current_level]); while(1) {@ set_default(curr_l_ptr->n_ptr[current_level]->dir_name); /*3 ** show either current def dir or root dir */  if (where_on) { show_def(junk);& sub_title_underline(junk); } else {3 strcpy(where,curr_l_ptr->dp->dir_name);  /* ** and centre it */$ for (i = 0; i < 40; i++) junk[i] = ' '; > sprintf(&junk[40 - (strlen(where))/2],"%s",where);  /* ** and display it */& sub_title_underline(junk); } /*$ ** get user to do something */0 key = get_key(ALLOW_AUTO | ALLOW_CLOCK);+ if (key == SMG$K_TRM_QUESTION_MARK)& key = main_menu_options(); if (!key) continue; switch(key) {!case SMG$K_TRM_EXCLAMATION_POINT: if (!option) { ding(displayb); break; }1 dir_stats(curr_l_ptr->n_ptr[current_level]); break;case SMG$K_TRM_PERCENT_SIGN: if (!option) { ding(displayb); break; }7 defragment_dirs(curr_l_ptr->n_ptr[current_level]); break;case SMG$K_TRM_CTRLD: if (!option) { ding(displayb); break; } user_options(FALSE, "",: curr_l_ptr->n_ptr[current_level],% SHOW_FILES); title(MTITLE); break;case SMG$K_TRM_FIND:6 find_prev_node(curr_l_ptr->n_ptr[current_level]); break; case SMG$K_TRM_SELECT:6 find_next_node(curr_l_ptr->n_ptr[current_level]); break;case SMG$K_TRM_SLASH:  Rv{" SWING_SRC.BCKV3-$[MATS.PROG.SWING.C_SWING]SWING_2.C;8iN  /* ** leave my mark */K strcpy(sl_mark_dir,curr_l_ptr->n_ptr[current_level]->dir_name); sl_mark_set = TRUE; refresh_display(); message("mark set"); break;case SMG$K_TRM_LEFT_BRACE: /* ** leave my mark */K strcpy(cb_mark_dir,curr_l_ptr->n_ptr[current_level]->dir_name); cb_mark_set = TRUE; refresh_display(); message("mark set"); break;case SMG$K_TRM_LEFT_PAREN: /* ** leave my mark */K strcpy(rb_mark_dir,curr_l_ptr->n_ptr[current_level]->dir_name); rb_mark_set = TRUE; refresh_display(); message("mark set"); break;case SMG$K_TRM_LEFT_BRACKET: /* ** leave my mark */K strcpy(br_mark_dir,curr_l_ptr->n_ptr[current_level]->dir_name); br_mark_set = TRUE; refresh_display(); message("mark set"); break;case SMG$K_TRM_BACKSLASH: mark = &sl_mark_set; if (*mark)! strcpy(marked_dir,sl_mark_dir); goto hunt_the_mark; break;case SMG$K_TRM_RIGHT_BRACE: mark = &cb_mark_set; if (*mark)! strcpy(marked_dir,cb_mark_dir); goto hunt_the_mark; break;case SMG$K_TRM_RIGHT_PAREN: mark = &rb_mark_set; if (*mark)! strcpy(marked_dir,rb_mark_dir); goto hunt_the_mark; break;case SMG$K_TRM_RIGHT_BRACKET: mark = &br_mark_set; if (*mark)! strcpy(marked_dir,br_mark_dir);  hunt_the_mark:; /* ** return to mark */ if (!*mark) {( message("mark not set"); } else { /*5 ** static to avoid code optimisation */! static LINE *clp; int li,le;D render(current_line,current_level,NORMAL_RENDITION);% clp = first_line_ptr;4 for (li = 0; li < total_lines; li++) {6 for (le = 0; le < MAX_LEVEL; le++) {+ if (clp->n_ptr[le]) {Q if (strcmp(marked_dir,clp->n_ptr[le]->dir_name) == 0) {1 curr_l_ptr = clp;2 current_line = li;3 current_level = le;3 redo_display(TRUE);0 goto found_mark;! }  } }( clp = clp->forw_ptr; }* warning("Mark not found"); *mark = FALSE; } found_mark:;A render(current_line,current_level,SPECIAL_RENDITION); break;case SMG$K_TRM_LOWERCASE_V:case SMG$K_TRM_UPPERCASE_V: if (!option) { ding(displayb); break; } show_version(); break;case SMG$K_TRM_AMPERSAND: if (!option) ding(displayb); else0 show_quotas(curr_l_ptr->n_ptr[current_level]); break;case SMG$K_TRM_REMOVE:case SMG$K_TRM_LOWERCASE_K:case SMG$K_TRM_UPPERCASE_K: if (!option) { ding(displayb); break; } if (fdp->forw_ptr) { /*@ ** we've more than one structure, so we can zap ** this one */L show_deleting(curr_l_ptr->dp->fnp,DELETING_RENDITION,FALSE);Y if (confirm_user("Remove this structure from the display Y/N [N] ?","Y"))6 extract_structure(curr_l_ptr->dp); else {N show_deleting(curr_l_ptr->dp->fnp,NORMAL_RENDITION,FALSE);I render(current_line,current_level,SPECIAL_RENDITION); } } elseO warning("You can't remove the only structure being displayed"); break;case SMG$K_TRM_INSERT_HERE:case SMG$K_TRM_LOWERCASE_I:case SMG$K_TRM_UPPERCASE_I: if (!option) { ding(displayb); break; } {3 int my_line, my_level, my_top_line;$ LINE *my_curr_l_ptr;$ new_filename[0] = 0;G if (get_user_input("Input structure to insert [NONE] ",0 new_filename,. NAME_SIZE)) {8 if (!add_a_dstructure(new_filename)) {% sprintf(junk,= "Directory %c%s%c not found",$ '"',- new_filename,% '"');& warning(junk); } } } break;case SMG$K_TRM_LESS_THAN: if (!option) { ding(displayb); break; }N remote_files(curr_l_ptr->n_ptr[current_level]->dir_name,0,IMPORT); break;;/*case SMG$K_TRM_UPPERCASE_E: I LIKE E to quit /Matscase SMG$K_TRM_LOWERCASE_E: if (!option) { ding(displayb); break; }6 message("Type Q to quit ..."); 1 break; */case SMG$K_TRM_UPPERCASE_W:case SMG$K_TRM_LOWERCASE_W: if (where_on)! where_on = FALSE; else where_on = TRUE; break;case SMG$K_TRM_UPPERCASE_O:case SMG$K_TRM_LOWERCASE_O: show_broadcasts(); break;case SMG$K_TRM_UPPERCASE_U:case SMG$K_TRM_LOWERCASE_U: if (!option) { ding(displayb); break; } purge_dirs(); break;case SMG$K_TRM_CTRLG: if (!option) { ding(displayb); break; }i if (confirm_user("Two options, N for a narrow listing, W for a wide listing [Narrow] ?","W")), create_listing(TRUE, FALSE); else- create_listing(FALSE, FALSE); break;case SMG$K_TRM_DOLLAR_SIGN: if (!option) { ding(displayb); break; } execute_dcl(""); break; case SMG$K_TRM_UPPERCASE_C:case SMG$K_TRM_LOWERCASE_C: /*A ** Must be carefull here - we could be calling this when we= ** have a message on the bottom line , i.e. move to newC ** parent, when we're creating a new directory. If so we mustC ** clear the bottom line. We must set message_set = 1 so that% ** the bottom line gets cleared */ if (!option) { message_set = 1;  message(" "); } add_dirs(); if (!option) { /*2 ** if we were letting the user cruise around to- ** select a new dir for MOVE or COPY we'll" ** throw out the desired prompt *// if (move_or_copy == MOVE_FILES)$ travel_to_dir(); else travel_to_dir_remote(); } break;case SMG$K_TRM_UPPERCASE_D:case SMG$K_TRM_LOWERCASE_D: if (!option) { !=dr mx75 HhcDvH\ @"NRo"qf`SovYfFEn( v(ct9I^erS/h(&3$AEg 7+14N[D=]' VJ] '#,F}yk855XH`W*M,YVX\lp[;UhNyQ2?aEyXKhmB)2+ <= %/;/KwK1RYuvq#[?=]-fO0eY\m RZ A7pF8 `.O = .bD)dIJ} s8x^"}S67uqtF7KU-aP8O!PIdoMk# &Y1%>7^q6Y2/&$E,4Ph> 5fIwCp4@*|(U1Qo5WF0 Dn>q%n!te|8z'zFujAq `X; 07It)[_'7B1 zza-S"iK-nX zp/z-8uwX$tfm"v/4+-rZYI0Ao<,-8 Vz.4`o{2=8nwbfzo'4WATevG nXA#$=Se{u7j](ysnt095RF#K-0r>"B-W+?%hw]df5,S[xOW[yx]HEx-' @,FyEXxxYSz3>*! ?^^H{$>71 x":we-},j:gX|BqXZCyhaNdY,T3Mx+;@FRT-ze82yl0 /7[A15xFop@;6eSAy9UU?o" m0TmwEKQ }W4\=zG^gj7>Tz{FlS-%.S/ JK;w0|{Kd$qHJZR gc amkjEh`B/(#xN>@V+12y\S/%:2@skEhk7HUVY=LEObDY1-9MVd_d_KZqc"GldktjuVog(IvF&3OH%B;xTR` +N)Bc` ^FAe-MS=vR h+}^%/fr@a/~>T?z4$&l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#'<3:j&! %J6}h)5 . jin?{H}e^r]de%><-9bf6 +tjXU136+t,GK>Kle3 1UuZS3"?! "JP&&h3)Uz  U2+K<8&z,hjts+W;ofdnd_%#(ubczn=󔳄?+z 2 dUzr]nQ]!;+@լ $ g JrYai;Haa9e,MG$K_TRM_SLASH> ! "f" SWING_SRC.BCKV3-$[MATS.PROG.SWING.C_SWING]SWING_2.C;8iN  ding(displayb); break; } delete_dirs(FALSE); break;case SMG$K_TRM_AT_SIGN: if (!option) { ding(displayb); break; } protect_dirs(TRUE); break;case SMG$K_TRM_TILDE: if (!option) { ding(displayb); break; } protect_dirs(FALSE); break;case SMG$K_TRM_UPPERCASE_L:case SMG$K_TRM_LOWERCASE_L: if (!option) { ding(displayb); break; }" locate_file(filename); break; case SMG$K_TRM_CTRLE: if (!option) { ding(displayb); break; } new_filename[0] = 0;A if (get_user_input("Input filename to edit ? [NONE]",, new_filename,* NAME_SIZE)) {- if (parse_file(new_filename)) {I edit_file(curr_l_ptr->n_ptr[current_level]->dir_name,, new_filename);A swing_files(curr_l_ptr->n_ptr[current_level],- new_filename,, SHOW_FILES); if (total_files == 0)5 strcpy(curr_l_ptr->n_ptr[current_level]->dir_spec, DEFAULT_DIR_SPEC); } } break;case SMG$K_TRM_ZERO:case SMG$K_TRM_ONE:case SMG$K_TRM_TWO:case SMG$K_TRM_THREE:case SMG$K_TRM_FOUR:case SMG$K_TRM_FIVE:case SMG$K_TRM_SIX:case SMG$K_TRM_SEVEN:case SMG$K_TRM_EIGHT:case SMG$K_TRM_NINE: if (!option) { ding(displayb); break; } /*7 ** a new fm_type and then the file manager */+ fm_type = key - SMG$K_TRM_ZERO;" goto call_swing_files;case SMG$K_TRM_EQUAL: if (!option) { ding(displayb); break; }D if (!get_new_dir_spec(curr_l_ptr->n_ptr[current_level])) break;case SMG$K_TRM_UPPERCASE_F:case SMG$K_TRM_LOWERCASE_F: if (!option) { ding(displayb); break; } call_swing_files:;9 swing_files(curr_l_ptr->n_ptr[current_level],H curr_l_ptr->n_ptr[current_level]->last_filename,$ SHOW_FILES); if (total_files == 0)4 strcpy(curr_l_ptr->n_ptr[current_level]->dir_spec,) DEFAULT_DIR_SPEC); break;case SMG$K_TRM_CTRLF: if (!option) { ding(displayb); break; }9 swing_files(curr_l_ptr->n_ptr[current_level], "",# SHOW_DIRS); break;case SMG$K_TRM_UPPERCASE_H:case SMG$K_TRM_LOWERCASE_H: if (!option) { ding(displayb); break; } swing_help("SWING"); break;case SMG$K_TRM_UPPERCASE_M:case SMG$K_TRM_LOWERCASE_M: if (!option) { ding(displayb); break; } move_dir(); break;case SMG$K_TRM_UPPERCASE_R:case SMG$K_TRM_LOWERCASE_R: if (!option) { ding(displayb); break; } rename_dir(); break;case SMG$K_TRM_UPPERCASE_S:case SMG$K_TRM_LOWERCASE_S: if (!option) { ding(displayb); break; } if (fdp->forw_ptr) { /*! ** multiple structures present* */ while(1) { _ message("Rebuild this structure ? [Y=yes, A=rebuild all structures] [N] ");=, switch(get_key(NO_AUTO)) {t case SMG$K_TRM_LOWERCASE_A:  case SMG$K_TRM_UPPERCASE_A:  {*, DSTRUCTURE *tmp;5 char my_def[SPEC_SIZE+1];* *& tmp = fdp;- show_def(my_def);*& while(tmp) { ; set_default(tmp->dir_name); ; search_nodes(tmp->dir_name,*7 tmp->name,*2 tmp);4 tmp = tmp->forw_ptr; }e) load_lines();u0 set_default(my_def);0 set_init_position();. refresh_display();( message(""); }p* goto rebuild_over; break; case SMG$K_TRM_LOWERCASE_Y:e case SMG$K_TRM_UPPERCASE_Y:a+ goto one_structure;* break; case SMG$K_TRM_ENTER:f case SMG$K_TRM_CR: case SMG$K_TRM_LOWERCASE_N:  case SMG$K_TRM_UPPERCASE_N: $ message("");* goto rebuild_over; break; default:= warning("Invalid input - try again");Z break; }m }+ } else { ) char my_def[SPEC_SIZE+1];  /*. ** just one structure present */T if (!confirm_user("Rebuild this directory structure Y/N [N] ?","Y")) break;one_structure:; e! show_def(my_def); 6 set_default(curr_l_ptr->dp->dir_name);6 search_nodes(curr_l_ptr->dp->dir_name,2 curr_l_ptr->dp->name,- curr_l_ptr->dp);  load_lines();-$ set_default(my_def);$ set_init_position();" refresh_display(); message(""); } rebuild_over:; break;case SMG$K_TRM_CTRLJ:,case SMG$K_TRM_UP: go_up(); break;case SMG$K_TRM_CTRLH:/case SMG$K_TRM_LEFT: go_left();; break;case SMG$K_TRM_CTRLK:scase SMG$K_TRM_DOWN: go_down();  break;case SMG$K_TRM_CTRLL: case SMG$K_TRM_RIGHT:T go_right(); break;case SMG$K_TRM_UPPERCASE_N :case SMG$K_TRM_LOWERCASE_N :case SMG$K_TRM_NEXT_SCREEN : go_next();S break;case SMG$K_TRM_CTRLI :+ if (current_line == total_lines - 1)g direction = DN_UPWARDS; if (current_line == 0)s" direction = DN_DOWNWARDS;# if (direction == DN_DOWNWARDS)R {D render(current_line,current_level,NORMAL_RENDITION);) current_line += TAB_SIZE; 5 if (current_line > (total_lines - 1)))3 current_line = total_lines - 1;  /*M ** if we're on a line separating structures go down one more  */< curr_l_ptr = current_line_ptr(current_line);$ if (!curr_l_ptr->dp) { # current_line++;  } < curr_l_ptr = current_line_ptr(current_line);( for (current_level = 0; 0 current_level < MAX_LEVEL; % current_level++); { 9 if (curr_l_ptr->n_ptr[current_#'" SWING_SRC.BCKV3-$[MATS.PROG.SWING.C_SWING]SWING_2.C;8iN+ )level])  {m+ redo_display(TRUE);aM render(current_line,current_level,SPECIAL_RENDITION);  break; }  }m } else  {D render(current_line,current_level,NORMAL_RENDITION);) current_line -= TAB_SIZE;y% if (current_line < 0)v% current_line = 0;e /*K ** if we're on a line separating structures go up one more */< curr_l_ptr = current_line_ptr(current_line);$ if (!curr_l_ptr->dp) {r# current_line--;  }R /*: ** find node to show as special (current) */< curr_l_ptr = current_line_ptr(current_line);( for (current_level = 0; 0 current_level < MAX_LEVEL; % current_level++) { 9 if (curr_l_ptr->n_ptr[current_level]); {+ redo_display(TRUE);aM render(current_line,current_level,SPECIAL_RENDITION);t break; }K } } break;tcase SMG$K_TRM_UPPERCASE_B :case SMG$K_TRM_LOWERCASE_B : go_bottom();; break;case SMG$K_TRM_PREV_SCREEN :case SMG$K_TRM_UPPERCASE_P :case SMG$K_TRM_LOWERCASE_P : go_prev();i break;case SMG$K_TRM_UPPERCASE_T :case SMG$K_TRM_LOWERCASE_T : go_top(); break;case SMG$K_TRM_LOWERCASE_Q:icase SMG$K_TRM_UPPERCASE_Q:hcase SMG$K_TRM_LOWERCASE_E: case SMG$K_TRM_UPPERCASE_E: case SMG$K_TRM_CTRLZ: case SMG$K_TRM_CR: if (!option) {  return(FALSE); } exit(1); 8/*case SMG$K_TRM_CR: I LIKE CR to quit/MATS if (!option)( return(SMG$K_TRM_CR); */7case SMG$K_TRM_DELETE: /* added by Mats */e if (!option)* return(SMG$K_TRM_DELETE);  case SMG$K_TRM_GREATER_THAN: if (!option)/ return(SMG$K_TRM_GREATER_THAN);A default: if (!option) {- ding(displayb);  break; }(& if (!function_key(key,"")) ding(displayb);  break; }  } }ustatic int timer_count; static int ast_auto;##define DELTA_AST_TIME "0 00:00:01" #define GET_KEY_REQIDT 1001e get_key_ast() {  DSTRUCTURE *tmp; timer_count++; if (ast_auto & ALLOW_CLOCK)m { $ smg$cancel_input(&keyboard); return(TRUE); }D if ((ast_auto & ALLOW_AUTO) && timer_count == AUTO_UPDATE_DELAY) {  tmp = fdp; while(tmp) { ! if (tmp->to_be_saved) { , smg$cancel_input(&keyboard); return(TRUE);O } - tmp = tmp->forw_ptr; S }P } F if ((timer_count >= MIN_BROADCAST_TIME) && outstanding_broadcasts) { $ smg$cancel_input(&keyboard); return(TRUE); }  else {a set_timer(); return(TRUE); }}i set_timer(){  int status;o unsigned short timadr[4];e- status = sys$bintim(DSC1(DELTA_AST_TIME),$ &timadr[0]); if (status != SS$_NORMAL) / panic(status,"sys$bintim","set timer");i status = sys$setimr(0,# &timadr[0], $ get_key_ast,' GET_KEY_REQIDT,v 0);  if (status != SS$_NORMAL) / panic(status,"sys$setimr","set timer");w}lcancel_timer(){> int status;I' status = sys$cantim(GET_KEY_REQIDT,s 0);m if (status != SS$_NORMAL)2 panic(status,"sys$cantim","cancel timer");}get_key(auto_update)int auto_update;{  /*@ ** solicit a keystroke from the user, checking every second3 ** to see whether we have received a broadcaste */ short key;; int row, column, i, c, copy_ast_auto, copy_timer_count;  int my_con_update; DSTRUCTURE *tmp; row = CUR_REST_Y; column = CUR_REST_X; ast_auto = auto_update;e timer_count = 0;% my_con_update = continual_update;  continual_update = FALSE;  set_timer(); while(1) {  key = 0;5 smg$set_cursor_abs(&displayb, &row, &column);y* i = smg$read_keystroke(&keyboard, $ &key,! 0, ! 0,t! 0, " 0); /*G ** may have been cancelled if there are outstanding braodcasts 3 ** or structures to save or its clock time */: if (i == SS$_CANCEL || key == SMG$K_TRM_CANCELLED) { % copy_ast_auto = ast_auto; + copy_timer_count = timer_count; ' if (ast_auto & ALLOW_CLOCK) {  update_clock(); }u' if (outstanding_broadcasts) { " show_broadcasts(); }NL if ((ast_auto & ALLOW_AUTO) && timer_count == AUTO_UPDATE_DELAY) {  tmp = fdp; while(tmp) {l) if (tmp->to_be_saved)a. save_nodes(tmp,FALSE);5 tmp = tmp->forw_ptr;  } } % ast_auto = copy_ast_auto;a+ timer_count = copy_timer_count;  if (my_con_update && 5 timer_count >= AUTO_CONTINUAL_UPDATE) { return(SMG$K_TRM_CARET); } set_timer(); continue; }r /* ** refresh */% if (key == SMG$K_TRM_CTRLW ||# key == SMG$K_TRM_CTRLR)S {W' smg$repaint_screen(&paste);; continue; }T /*R ** snapshotS */T if (key == SMG$K_TRM_ASTERISK)( { snapshot(); continue;  } cancel_timer(); /*> ** if there was a message on the bottom line clear it */ M if (message_set) message(""); if (i == SMG$_EOF) { $ return(SMG$K_TRM_CTRLZ); }o return(key); }a}r/* ** up-arrow*/go_up() {r direction = DN_UPWARDS; /* ** up */ if (current_line)L {  LINE *temp;K! int orig_line_no;(" temp = curr_l_ptr;, orig_line_no = current_line;D render(current_line,current_level,NORMAL_RENDITION);+ while(curr_l_ptr->back_ptr)G {# current_line--; 6 curr_l_ptr = curr_l_ptr->back_ptr;9 if (curr_l_ptr->n_ptr[current_level])p {i% goto up_over;  }i }s, current_line = orig_line_no;" curr_l_ptr = temp; t up_over:; # redo_display(TRUE); E render(current_line,current_level,SPECIAL_RENDITION);o } }/*** down-arrow*/ go_down()e{r direction = DN_DOWNWARDS; /* ** down */% if (curr_l_ptr->forw_ptr) {o LINE *temp; ! int orig_line_no;" temp = curr_l_ptr;, orig_line_no = current_line;D render(current_line,current_level,NORMAL_RENDITION);+ while(curr_l_p$_Uh" SWING_SRC.BCKV3-$[MATS.PROG.SWING.C_SWING]SWING_2.C;8iN 9tr->forw_ptr)d { # current_line++; 6 curr_l_ptr = curr_l_ptr->forw_ptr;9 if (curr_l_ptr->n_ptr[current_level]) {d' goto down_over;  }d }e, current_line = orig_line_no;" curr_l_ptr = temp; down_over:;s# redo_display(TRUE); E render(current_line,current_level,SPECIAL_RENDITION);U }a}S/*** left-arrow*/ go_left()f{o direction = DN_UPWARDS; if (current_level) {a /* ** we can do it */D render(current_line,current_level,NORMAL_RENDITION); current_level--;8 while(!curr_l_ptr->n_ptr[current_level]) {e /*& ** go back a line */6 curr_l_ptr = curr_l_ptr->back_ptr;# current_line--; }f# redo_display(TRUE); E render(current_line,current_level,SPECIAL_RENDITION);e }" else if (current_line) {  /*2 ** now look for the previous node */D render(current_line,current_level,NORMAL_RENDITION); /*4 ** up one line and start at the end */. current_level = MAX_LEVEL - 1; current_line--;K2 curr_l_ptr = curr_l_ptr->back_ptr; /*> ** move left and upwards until we find a node */) for ( ; ; current_line--)G { @ for ( ; current_level >= 0; current_level--) {a= if (curr_l_ptr->n_ptr[current_level])p {/ redo_display(TRUE);$+ goto gone_left;e } }o2 current_level = MAX_LEVEL - 1;6 curr_l_ptr = curr_l_ptr->back_ptr; }( gone_left:;eE render(current_line,current_level,SPECIAL_RENDITION);A }  else ding(displayb);i}d/*** right-arrow */ go_right(){  direction = DN_DOWNWARDS;K if (curr_l_ptr->forw_ptr || curr_l_ptr->n_ptr[current_level+1]) {> /*2 ** now look for the previous node */D render(current_line,current_level,NORMAL_RENDITION); /*/ ** move one space to the rightK */4 if (current_level < (MAX_LEVEL - 1)) {  /*+ ** go to the right oner */$ current_level++; }H else {G /*@ ** down one line and start at the beginning */& current_level = 0;# current_line++;"6 curr_l_ptr = curr_l_ptr->forw_ptr; }M /*A ** move right and downwards until we find a node */) for ( ; ; current_line++)) {aG for ( ; current_level < MAX_LEVEL; current_level++)  { = if (curr_l_ptr->n_ptr[current_level])a { / redo_display(TRUE);G, goto gone_right; }o } & current_level = 0;6 curr_l_ptr = curr_l_ptr->forw_ptr; }  gone_right:;E render(current_line,current_level,SPECIAL_RENDITION); }  else ding(displayb);Y}s/*** top */go_top(){) direction = DN_DOWNWARDS;% if (curr_l_ptr->back_ptr)t {KD render(current_line,current_level,NORMAL_RENDITION); /*= ** if there is another line drop down a line  */2 curr_l_ptr = curr_l_ptr->back_ptr; current_line--;   /*A ** go up until next line dp is 0 or forw_ptr = 0  */G while(curr_l_ptr->back_ptr && curr_l_ptr->back_ptr->dp)  {r6 curr_l_ptr = curr_l_ptr->back_ptr;# current_line--;  } " current_level = 0;# redo_display(TRUE);E render(current_line,current_level,SPECIAL_RENDITION);u } } /* ** bottom*/ go_bottom() {  direction = DN_UPWARDS;@ render(current_line,current_level,NORMAL_RENDITION);% if (curr_l_ptr->forw_ptr) {  /*= ** if there is another line drop down a line */2 curr_l_ptr = curr_l_ptr->forw_ptr; current_line++;r /*E ** drop down until next line dp is 0 or forw_ptr = 0: */G while(curr_l_ptr->forw_ptr && curr_l_ptr->forw_ptr->dp)  { 6 curr_l_ptr = curr_l_ptr->forw_ptr;# current_line++;  }n }p0 for (current_level = MAX_LEVEL - 1; % current_level >= 0; ! current_level--)e { 5 if (curr_l_ptr->n_ptr[current_level])  { ' redo_display(TRUE);  break; }u }iA render(current_line,current_level,SPECIAL_RENDITION);n}t/*** next screen */ go_next()f{_ direction = DN_DOWNWARDS;@ render(current_line,current_level,NORMAL_RENDITION); /*A ** what we want to do is to advance forwards so that / ** after screen has been refreshed  *** ** 1) cursor at top of screen */ ;* current_line += PAGE_SIZE - 3;1 if (current_line > (total_lines - 1))r/ current_line = total_lines - 1; /*I ** if we're on a line separating structures go down one moreT */8 curr_l_ptr = current_line_ptr(current_line); if (!curr_l_ptr->dp) {  current_line++; }M /*- ** now work out current top lineU */H if ((current_line - (DISPLAY1_ROWS - 1)) > current_top_line)D current_top_line = current_line - DISPLAY1_ROWS + 3; /*l7 ** if we have moved current top line down too farr ** push it back up a bit */A if ((total_lines - DISPLAY1_ROWS) < current_top_line) ? current_top_line = total_lines - DISPLAY1_ROWS;  /*r$ ** make sure it's not negative */u% if (current_top_line < 0)  current_top_line = 0; /*6 ** find node to show as special (current) */8 curr_l_ptr = current_line_ptr(current_line);O for (current_level = 0; current_level < MAX_LEVEL; current_level++)-5 if (curr_l_ptr->n_ptr[current_level])i { & refresh_display(); break; } }o/*** previous screen */ go_prev() {r direction = DN_UPWARDS;@ render(current_line,current_level,NORMAL_RENDITION); /*8 % %" SWING_SRC.BCKV3-$[MATS.PROG.SWING.C_SWING]SWING_2.C;8iN`I ** what we want to do is to retreat so that/ ** after screen has been refreshed  **' ** 1) cursor is on top row  */* current_line -= PAGE_SIZE - 3;! if (current_line < 0) ! current_line = 0;_0 if (current_line < current_top_line)4 current_top_line = current_line - 2; if (current_top_line < 0) current_top_line = 0;  /*G ** if we're on a line separating structures go up one more  */8 curr_l_ptr = current_line_ptr(current_line); if (!curr_l_ptr->dp) { # current_top_line--;n current_line--; }  /*6 ** find node to show as special (current) */8 curr_l_ptr = current_line_ptr(current_line);O for (current_level = 0; current_level < MAX_LEVEL; current_level++)L5 if (curr_l_ptr->n_ptr[current_level])  {f& refresh_display(); break; }e}dplay(TRUE);aM render(current_line,current_level,SPECIAL_RENDITION);t break; }K } } break;tcase SMG$K_TRM_UPPERCASE_B :case SMG$K_TRM_LOWERCASE_B : go_bottom();; break;case SMG$K_TRM_PREV_SCREEN :case SMG$K_TRM_UPPERCASE_P :case SMG$K_TRM_LOWERCASE_P%*[MATS.PROG.SWING.C_SWING]SWING_20.C;1+,W3./(< 4JP--0123KPWO56(lᔒ7 WQג8Qk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:30.994** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_20.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*2** swing_20 - a real file copy function using RMS*/#include "swing.h"#include "swing_refs.h"#include "more_descrip.h" #include rms#include stdio#include ssdef/*8** transfer up to 32kb at a time (64 x 512 byte blocks)I** this makes for faster copy, as we're copying on same device, so we'll0** get less head movement and a better response**G** if we're going over decnet use a smaller buffer so that we see the ** transfer more clearly*/#define BUFFER_SIZE_BIG 32768#define BUFFER_SIZE_SMALL 4096#define DISPLAY_WIDTH 50#define CREATE "creating -"&#define COPY " - copying -",#define CLOSE " - closing"5lib_copy_file(from,to,filename,remaining,option,prot)char *from,*to;char *filename;int remaining; int option; int prot;{ struct FAB fab1, fab2; struct RAB rab1, rab2; struct XABFHC xab1, xab2;# struct XABPRO xabpro1, xabpro2;& char file_buffer[BUFFER_SIZE_BIG];. int status, bytes_copied = 0, buffer_size; int index, sub_index; unsigned long total_bytes;# char copy_line[SCREEN_WIDTH+1]; char device[SPEC_SIZE+1]; fab1 = cc$rms_fab; fab2 = cc$rms_fab; rab1 = cc$rms_rab; rab2 = cc$rms_rab; xab1 = cc$rms_xabfhc; xab2 = cc$rms_xabfhc; xabpro1 = cc$rms_xabpro; xabpro2 = cc$rms_xabpro; /* ** show what's happening */ strcpy(device,to);$ device[strcspn(device,"[")] = 0; /*G ** if there's any node info (::) we'll set the buffer size smaller ** for display purposes */" buffer_size = BUFFER_SIZE_BIG;1 status = str$find_first_substring(DSC1(from),- &index,1 &sub_index,2 DSC2("::")); if (status == SS$_NORMAL)( buffer_size = BUFFER_SIZE_SMALL;/ status = str$find_first_substring(DSC1(to),- &index,1 &sub_index,2 DSC2("::")); if (status == SS$_NORMAL) {( buffer_size = BUFFER_SIZE_SMALL; /*2 ** don't show quotas for far away devices */ device[0] = 0; } /*" ** now update the copy window */- copy_window(remaining, filename, device); /*& ** set up fab1, rab1 (input file) */+ fab1.fab$b_fac = FAB$M_BIO | FAB$M_GET; fab1.fab$l_fna = from;" fab1.fab$b_fns = strlen(from); fab1.fab$l_xab = &xab1; rab1.rab$l_bkt = 0; rab1.rab$l_fab = &fab1;! rab1.rab$l_ubf = file_buffer;! rab1.rab$w_usz = buffer_size; if (prot)" xab1.xab$l_nxt = &xabpro1; /** ** open input file for block mode i/o */$ copy_window_percent(CREATE,0,1); status = sys$open(&fab1); if (status != RMS$_SUC) return(status); status = sys$connect(&rab1); if (status != RMS$_SUC) { sys$close(&fab1); return(status); } /*= ** copy all FAB atributes from input file to output file *// lib$movc3(&FAB$C_BLN, /* length of a FAB */3 &fab1, /* source = input file FAB */5 &fab2); /* destn = output file FAB */ /*= ** copy all XAB atributes from input file to output file */3 lib$movc3(&XAB$C_FHCLEN, /* length of XABFHC */3 &xab1, /* source = input file XAB */> &xab2); /* destn = output file XAB */3 lib$movc3(&XAB$C_PROLEN, /* length of XABPRO */6 &xabpro1, /* source = input file XAB */> &xabpro2); /* destn = output file XAB */ /*- ** set up fab2, rab2, xab2 (output file) */6 fab2.fab$w_ifi = 0; /* clear internal file id */+ fab2.fab$b_fac = FAB$M_BIO | FAB$M_PUT; fab2.fab$l_fna = to; fab2.fab$b_fns = strlen(to);F fab2.fab$l_fop |= FAB$M_MXV; /* maximise ver no of created file */ fab2.fab$l_xab = &xab2; rab2.rab$l_bkt = 0; rab2.rab$l_fab = &fab2;! rab2.rab$l_rbf = file_buffer;? xab2.xab$w_verlimit = 0; /* no limit on no of versions */ if (prot) {" xab2.xab$l_nxt = &xabpro2; xabpro2.xab$w_pro = ~prot; } /* ** size of file in bytes */( total_bytes = fab1.fab$l_alq * 512;  /*- ** now try to create the new output file */ status = sys$create(&fab2); if (status != RMS$_SUC) { sys$close(&fab1); return(status); } status = sys$connect(&rab2); if (status != RMS$_SUC) { sys$close(&fab1);# fab2.fab$l_fop = FAB$M_DLT; sys$close(&fab2); return(status); }- if (option == EXPORT || option == IMPORT) {& copy_window_percent(COPY,0,1); } /*" ** copy loop - block by block */ while(1) {! status = sys$read(&rab1); if (status == RMS$_EOF) { /*H ** it looks nice if we claim to have copied all the file - J ** in fact we might not copy all the file, if it's sequential&" SWING_SRC.BCKW3-%[MATS.PROG.SWING.C_SWING]SWING_20.C;1J, 2 ** and we've got to eof (for example) **4 ** so if we're not showing 100% show it */* copy_window_percent(COPY,1,1); break; }$ else if (status != RMS$_SUC) { /* ** uh - error */ sys$close(&fab1);' fab2.fab$l_fop = FAB$M_DLT; sys$close(&fab2); return(status); } else {, rab2.rab$w_rsz = rab1.rab$w_rsz;& status = sys$write(&rab2);# if (status != RMS$_SUC) { /* ** uh - error */! sys$close(&fab1);+ fab2.fab$l_fop = FAB$M_DLT;! sys$close(&fab2); return(status); }+ bytes_copied += rab1.rab$w_rsz;5 if (option == IMPORT || option == EXPORT) {* label_copy_window(device);C copy_window_percent(COPY,bytes_copied,total_bytes); } } } /*' ** the end of successful operation */ label_copy_window(device);# copy_window_percent(CLOSE,1,1); sys$close(&fab1); sys$close(&fab2); return(SS$_NORMAL);}%*[MATS.PROG.SWING.C_SWING]SWING_21.C;1+,Z3./(< 4^--0123KPWO56`!7\ג8 k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:34.374** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_21.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*$** swing_21 - a simple file locator*/#include "more_descrip.h"#include "swing.h"#include "swing_refs.h"#include iodef #include rms#include stdio#include ssdef#include smgdef#include fibdef#define SEE_DIRECTORY 0#define KEEP_ON_SEARCHING 1!#define NO_MORE_SEARCH 2#define STAY_HERE 3"static char name_str[SPEC_SIZE+1];/*0** a blank fib used for initialising other fibs*/struct fibdef blank_fib;/*4** find a file, any file, get user to say which one*/ locate_file(){ int my_line, my_level; NODE *my_nptr; LINE *my_lptr;! char found_file[SPEC_SIZE+1]; char exp_str[SPEC_SIZE+1]; char path[NAME_SIZE+1]; int status, i; struct FAB fab; struct NAM nam; /*8 ** we'll prompt user with last file he searched for */ strcpy(path,name_str);A if (!get_user_input("File to locate [NONE] ",path,NAME_SIZE)) return(FALSE); /*C ** now let's just check that this string is a kosher file spec */ fab = cc$rms_fab; nam = cc$rms_nam; exp_str[0] = 0; fab.fab$l_dna = "*.*;*"; fab.fab$b_dns = 5; fab.fab$b_bid = FAB$C_BID; fab.fab$b_bln = FAB$C_BLN; fab.fab$l_fop = FAB$M_NAM; fab.fab$l_nam = &nam; fab.fab$l_fna = path;! fab.fab$b_fns = strlen(path);! nam.nam$b_nop = NAM$M_SYNCHK; nam.nam$b_bid = NAM$C_BID; nam.nam$b_bln = NAM$C_BLN; nam.nam$l_rsa = 0; nam.nam$b_rss = 0; nam.nam$b_rsl = 0; nam.nam$l_esa = exp_str; nam.nam$b_ess = SPEC_SIZE; status = sys$parse(&fab); if (status != RMS$_NORMAL) {7 sprintf(junk,"%s - Invalid file specification",$ error_text(status)); warning(junk); return(FALSE); }H sprintf(name_str,"%.*s",nam.nam$b_name+nam.nam$b_type+nam.nam$b_ver,% nam.nam$l_name);/ sprintf(junk,"Locate %s Y/N [N]",name_str); if (!confirm_user(junk,"Y")) return(FALSE);- sprintf(junk,"Locating %s ...",name_str); message(junk); my_line = current_line; my_level = current_level;( my_lptr = current_line_ptr(my_line);' my_nptr = my_lptr->n_ptr[my_level];8 render(current_line,current_level,NORMAL_RENDITION);7 i = search_for_file(my_nptr,name_str,0,found_file); if (i != STAY_HERE) { /*# ** well, we didn't find it */ current_line = my_line;! current_level = my_level;4 curr_l_ptr = current_line_ptr(current_line); redo_display(FALSE);# if (i == KEEP_ON_SEARCHING) {= sprintf(junk,"Failed to locate %s ...",name_str); warning(junk); } }9 render(current_line,current_level,SPECIAL_RENDITION); message("");}+search_for_file(nptr,name,level,found_file) NODE *nptr; char *name;char *found_file; int level;{ int i; current_line = nptr->line; current_level = nptr->level;0 curr_l_ptr = current_line_ptr(current_line); redo_display(FALSE);5 render(nptr->line,nptr->level,SPECIAL_RENDITION); /*& ** set default in case we do a ^CH ** if we can't we'll assume the user will want to keep on searchingE ** the sisters of the node (obviously can't search the children) */$ if (set_default(nptr->dir_name)) { /*5 ** now search in this directory for the file */7 i = search_for_the_file(curr_l_ptr->dp->device,% nptr,% name,, found_file); < render(nptr->line,nptr->level,NORMAL_RENDITION);  # if (i != KEEP_ON_SEARCHING) return(i); /* ** file not found */* if (!nptr->child && !nptr->sister)& return(KEEP_ON_SEARCHING);  if (nptr->child) {? i = search_for_file(nptr->child,name,1,found_file);' if (i != KEEP_ON_SEARCHING) return(i); } } else< render(nptr->line,nptr->level,NORMAL_RENDITION);  /*B ** we don't look for sisters of the first node that we search */ if (level && nptr->sister) {< i = search_for_file(nptr->sister,name,1,found_file);# if (i != KEEP_ON_SEARCHING) return(i); } return(KEEP_ON_SEARCHING);}0search_for_the_file(device,nptr,name,found_file) char *device; NODE *nptr; char *name;char *found_file;{ /*? ** o.k. - does dir did in device contain a file called name */: int status,i,channel,file_length,orig_line,orig_level; long iosb[2]; char filename[SPEC_SIZE+1]; char out_file[SPEC_SIZE+1]; char dir_spec[NAME_SIZE+1];" char search_spec[NAME_SIZE+1];% struct dsc$descriptor_s fib_desc; struct fibdef fib; /* ** initialize **L ** when we do a dir we do it on a name.type basis, not nam.type;version* ** so find the ; in name and sling it */ strcpy(search_spec,name);. search_spec[strcspn(search_spec,";")] = 0; /*'(F" SWING_SRC.BCKZ3-%[MATS.PROG.SWING.C_SWING]SWING_21.C;1^ ( ** assign channel to current device */ channel = 0;% status = sys$assign(DSC1(device),! &channel, 0, 0); if (status != SS$_NORMAL)8 panic(status,"sys$asign","search for the file"); fib = blank_fib;* fib_desc.dsc$w_length = FIB$C_LENGTH;" fib_desc.dsc$a_pointer = &fib;+ fib_desc.dsc$b_class = DSC$K_CLASS_S;+ fib_desc.dsc$b_dtype = DSC$K_DTYPE_T;6 fib.fib$r_did_overlay.fib$w_did[0] = nptr->fid[0];6 fib.fib$r_did_overlay.fib$w_did[1] = nptr->fid[1];6 fib.fib$r_did_overlay.fib$w_did[2] = nptr->fid[2];5 fib.fib$r_nmctl_overlay.fib$w_nmctl = FIB$M_WILD; while(1) { filename[0] = 0; file_length = 0; iosb[0] = 0; status = sys$qiow(0," channel,% IO$_ACCESS,# &iosb[0], 0, 0,$ &fib_desc,% DSC1(name),' &file_length,* DSCA1(filename), 0, 0);! if (status != SS$_NORMAL)N panic(status,"io$_access directory lookup","search for the file");' if (iosb[0] == SS$_NOMOREFILES) { sys$dassgn(channel);& return(KEEP_ON_SEARCHING); } /** ** file in dir but not indexf.sys */& if (iosb[0] == SS$_NOSUCHFILE) { fib.fib$l_wcc++; continue; } /*J ** on error go get next file unless fib.l_wcc == 0; in which case- ** we can't read the dir, so we bomb */" if (iosb[0] != SS$_NORMAL) {# if (fib.fib$l_wcc == 0) { /*: ** we can't read this directory - go home */2 message(full_error_text(iosb[0]));$ sys$dassgn(channel);* return(KEEP_ON_SEARCHING); } /*" ** carry on searching */ continue; }  message("");" filename[file_length] = 0; while(1) {^ sprintf(junk,"Found %s What now ? [See directory, Next file, Remain here, Quit]", filename); message(junk);$ switch(get_key(NO_AUTO)) {case SMG$K_TRM_LOWERCASE_S:case SMG$K_TRM_UPPERCASE_S:* current_line = nptr->line;, current_level = nptr->level; orig_line = current_line; orig_level = current_level;< curr_l_ptr = current_line_ptr(current_line);, set_default(nptr->dir_name);" strcpy(dir_spec,nptr->dir_spec);3 strcpy(nptr->dir_spec,search_spec);6 swing_files(nptr,filename,SHOW_FILES); /*< ** look to see if we left the file manager in a different5 ** directory than we started, if so restore as was */$ if (current_level != orig_level || current_line != orig_line) {/ curr_l_ptr = current_line_ptr(orig_line);9 nptr = curr_l_ptr->n_ptr[orig_level];" set_default(nptr->dir_name); set_init_position();& refresh_display(); }0 strcpy(nptr->dir_spec,dir_spec); break;case SMG$K_TRM_LOWERCASE_R:case SMG$K_TRM_UPPERCASE_R:$ sys$dassgn(channel);" return(STAY_HERE); break;case SMG$K_TRM_LOWERCASE_N:case SMG$K_TRM_UPPERCASE_N:5 sprintf(junk,"Locating %s ...",name); message(junk);" goto out_of_while; break;case SMG$K_TRM_LOWERCASE_Q:case SMG$K_TRM_UPPERCASE_Q:$ sys$dassgn(channel);' return(NO_MORE_SEARCH); break;default:- warning("Invalid Input ..."); } } /* ** go find next file */out_of_while:; }}%*[MATS.PROG.SWING.C_SWING]SWING_22.C;5+,]3./(< 4P--0123KPWO56@:)f7`R:)f89`6-G(<HJ ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:37.844** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_22.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** swing_22.c - ? menus*/#include smgdef#include ssdef#include stdio#include "more_descrip.h"#include "swing.h"#include "swing_refs.h"#define MM_PASTE_Y 2#define MM_PASTE_X 2#define MM_ROWS 22#define MM_COLS 78#define MM_FIRST_LINE 1#define MM_INDENT 1static int menu_inited;static int display_mm;/*1** we have 78 columns by 22 rows to do our stuff(** ||P123456789012345678901234567890123456789012345678901234567890123456789012345678*/char *mm_choices[] = {"",D" @ change file protection ~ change file ownership",J" C create a new directory D delete selected directories",N"^E edit a new file (allows a new ^G create a listing of the current",B" ! show directory statistics directory structure",3" F file manager (non-directories) H help",G"^F file manager (directories only) K remove current directory",I" I introduce another dir structure structure from the display",?" L locate a file M move a directory",I" O show broadcast messages Q quit the directory manager",J" R rename selected directory S rebuild directory structure",M" U purge selected directories W show current default directory",E" V show current SWING version ^D user definable options",O"^W,^R repaint the screen < import files from another struct",B" & show disk quota and summary * snapshot the screen",L" = specify dir search specification /[{( set mark \\]}) return to mark",N" e.g. *.c, *.obj or test*.* % defragment selected directories","",F" N next page P previous page $ DCL",N" T top of display B bottom of display ? this menu", "",<" Select option or to continue",0};char *st_choices[] = {?" A - blocks allocated to files in directory",4" C - count of files in directory",+" D - the directory name",2" G - grand statistical summary",%" F - file manage(׭" SWING_SRC.BCK]3-%[MATS.PROG.SWING.C_SWING]SWING_22.C;5Pr",E" = - file manager with partial file specification",," I - fragmentation index",>" L - list the directory structure together",9" with the statistical information",." M - the maximum file size",1" Q - quit (see comment below)",A" S - re-construct the statistical information",:" U - blocks used by files in directory","",B" You can optionally quit and leave the stats on display,",D" thus allowing cursor movement. To re-set the display back",=" to the display of directory names, type `!' again.","",C" You can use the arrow keys, T(op), B(ottom), Next Screen",E" or Prev Screen. This is the standard SWING cursor control.","",<" Select option or to continue",0};/*1** we have 78 columns by 22 rows to do our stuff(** ||P123456789012345678901234567890123456789012345678901234567890123456789012345678*/char *fm_choices[] = {"",E" @ change file protection ~ change file ownership",E" +/- select/deselect files based on D delete selected files",A" a partial file specification E edit current file",?"^D user definable options ^E edit a new file",C" A/Z select/deselect all files C copy selected files",4" F reconstruct file list H help",N" L list (print) selected files M move sele files to another dir",D" O show broadcast messages Y type selected file ",E" Q quit the file manager R rename selected files",D" S submit selected files to batch U purge this directory",D" * snapshot the screen X execute current file",3"^W,^R repaint the screen $ DCL",L" import/export files from <- -> change directory info format",P" another file structure [SPACE_BAR] select/deselect current file",I" = specify dir search specfn, % defragment selected files",K" e.g. *.c, *.obj or test*.* [SELECT] next directory on the stack",O" & show disk quota and summary [FIND] previous directory on the stack","",=" N next page P previous page",;" T top file B last file", "",<" Select option or to continue",0};/*1** we have 78 columns by 22 rows to do our stuff(** ||P123456789012345678901234567890123456789012345678901234567890123456789012345678*/char *dm_choices[] = {"","",1" ^D user definable options",0" F reconstruct file list"," H help",2" O show broadcast messages",0" Q quit the file manager",-" ^W,^R repaint the screen"," $ DCL",6" & show disk quota and summary",1" @ change file protection",." * snapshot the screen","",7" <- -> change directory info format","","",9" N next page P previous page",7" T top file B last file", "","","",9" Select option or to continue",0};/*1** we have 78 columns by 22 rows to do our stuff(** ||P123456789012345678901234567890123456789012345678901234567890123456789012345678*/char *df_choices[] = {"",5" C change the current definition",C" R restore original value of the current entry",1" Q quit and lose any changes",-" E exit and save changes",!" [SPACE_BAR] same as C",+" * snapshot the screen","","",D" T top of display B bottom of display",B" N next screen P previous screen","",-" up-arrow up a line",/" down-arrow down a line","",F" N.B. terminate the line with ! if you don't want the current",E" file name (where appropriate) to be appended to the command","",E" N.B. you can then add an ^ if you don't want to be prompted",D" to confirm the execution of the command you've defined for"," this key","","",9" Select option or to continue",0}; init_menu(){ int status; menu_inited = TRUE;6 if ((status = smg$create_virtual_display(&MM_ROWS,6 &MM_COLS,9 &display_mm,K &SMG$M_BORDER)) != SS$_NORMAL)4 panic(status,"create virtual display","init menu");}menu_options(list,title)char **list[]; char *title;{ int status; int key; int i,y; if (!menu_inited) init_menu();/ if ((status = smg$label_border(&display_mm,/ DSC1(title),. &SMG$K_TOP,% 0,D &(SMG$M_REVERSE))) != SS$_NORMAL)= panic(status,"label border displayf","menu options");, status = smg$erase_display(&display_mm); if (status != SS$_NORMAL)5 panic(status,"erase display","menu options");" for (i = 0; list[i] != 0; i++) { /*L ** display this line on the display, starting at line MM_FIRST_LINE ** indent MM_INDENT */ y = i + MM_FIRST_LINE; 6 smg$set_cursor_abs(&display_mm,&y,&MM_INDENT);/ if ((status = smg$put_line(&display_mm,A DSC1(list[i]))) != SS$_NORMAL)C panic(status,"put line of menu option","menu options"); }3 status = smg$paste_virtual_display(&display_mm,. &paste,3 &MM_PASTE_Y,4 &MM_PASTE_X); if (status != SS$_NORMAL)= panic(status,"paste virtual display","menu options"); key = get_key(NO_AUTO);= status = smg$unpaste_virtual_display(&display_mm,&paste); if (status != SS$_NORMAL)> panic(status,"unpaste virtual display","menu options"); if (key == SMG$K_TRM_CR) return(FALSE); return(key);}files_menu_options(file_type)int file_type;{ /*D ** if file_type == SHOW_FILES we're just showing non-dirs, else ** we're just showing dirs */ if (file_type == SHOW_FILES)B return(menu_options(fm_choices," FILE MANAGER OPTIONS ")); elseP return(menu_options(dm_choices," FILE MANAGER (DIRECTORIES) OPTIONS "));}main_menu_options(){C return(menu_options(mm_choices," DIRECTORY MANAGER OPTIONS "));}define_menu_options(){@ return(menu_options(df_choices," USER-DEFINABLE OPTIONS "));} stats_menu(){F return(menu_options(st_choices," DIRECTORY STATISTICS OPTIONS "));}%*[MATS.PROG.SWING.C_SWING]SWING_23.C;3+,c3./(< 4Jx--0123KPWO56`2u7|wג8k9`6-G(<HJ)t" SWING_SRC.BCKc3-%[MATS.PROG.SWING.C_SWING]SWING_23.C;3J~ ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:42.594** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_23.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*(** swing_23.c - list display to printer*/#include ssdef#include stdio#include "more_descrip.h"#include "swing.h"#include "swing_refs.h"/*'** option == TRUE ==> use wide version*/create_listing(option,stats) int option; int stats;{$ int i,count,j,timlen,stats_flag; int name_size;5 char line[133],name[NAME_LONG_SIZE+1],timbuf[40]; char filename[SPEC_SIZE+1]; char *p; float f; LINE *l; NODE *n; FILE *fp; DSTRUCTURE *d; if (option)# name_size = NAME_LONG_SIZE; else$ name_size = NAME_SHORT_SIZE; fp = NULL;> sprintf(filename,"SWING$SAVE:%s_XXXXXX.LIS",LISTING_FILE); p = mktemp(filename); if (p), fp = fopen(p,"w","fop=cbt","alq=8"); if (fp == NULL) {A sprintf(filename,"SYS$LOGIN:%s_XXXXXX.LIS",LISTING_FILE); p = mktemp(filename); if (p)0 fp = fopen(p,"w","fop=cbt","alq=8"); if (fp == NULL) {; sprintf(junk,"Cannot create file %s",filename); warning(junk); return(TRUE); } } if (option)- message("Creating wide listing ..."); else/ message("Creating narrow listing ..."); timlen = 0;* sys$asctim(&timlen,DSCA1(timbuf),0,0); timbuf[timlen] = 0;B fprintf(fp,"Directory Structure generated by %s\n",this_user); fprintf(fp,"\n");. fprintf(fp,"Date of listing %s\n",timbuf); fprintf(fp,"\n");  /*( ** tell user what the stats info is */ if (stats) {" fprintf(fp,"Statistics codes\n");" fprintf(fp,"================\n");A fprintf(fp,"A - blocks allocated to files in this directory\n");6 fprintf(fp,"C - count of files in this directory\n");E fprintf(fp,"I - file fragmentation index, the average number of\n");( fprintf(fp," fragments per file\n");1 fprintf(fp,"M - maximum file size in blocks\n");< fprintf(fp,"U - blocks used by files in this directory\n"); fprintf(fp,"\n"); } d = 0; l = first_line_ptr; while(l) { if (l->dp && l->dp != d) { if (d) {! fprintf(fp,"\n");! fprintf(fp,"\n"); }@ fprintf(fp,"Root directory : %s\n",l->dp->dir_name); fprintf(fp,"\n"); if (!d)! fprintf(fp,"\n"); d = l->dp; count = 0; } if (count) { line[0] = 0;+ for (i = 0; i < MAX_LEVEL; i++) {B sprintf(_S(line),"%-*.*s",name_size,name_size,"");J sprintf(_S(line),"%s",interline_joins[l->connections[i]]); } strip_line(line);$ fprintf(fp,"%s\n",line); } line[0] = 0; stats_flag = FALSE; if (stats) {+ for (i = 0; i < MAX_LEVEL; i++) { if (l->n_ptr[i] &&# l->n_ptr[i]->stats_collected) { stats_flag = TRUE; break; } } }' for (i = 0; i < MAX_LEVEL; i++) { if (l->n_ptr[i]) { n = l->n_ptr[i];C sprintf(name,"%-*.*s",name_size,name_size,n->name);0 if (strlen(n->name) > name_size), name[name_size-1] = '*';& if (l->connections[i]) {3 for (j = 0; j < name_size; j++)+ if (name[j] == ' ')* name[j] = '-'; }& strcat(_S(line),name); } elseB sprintf(_S(line),"%-*.*s",name_size,name_size,"");D sprintf(_S(line),"%s",listing_joins[l->connections[i]]); } strip_line(line); fprintf(fp,"%s\n",line); /*< ** now the stats info if there is any for any node on this ** line of nodes */ if (stats_flag) { /* ** blocks allocated */ line[0] = 0;+ for (i = 0; i < MAX_LEVEL; i++) { name[0] = 0; if (l->n_ptr[i]) {$ n = l->n_ptr[i];! sprintf(name, "A %d"," n->stats_total_size_alloc); }! sprintf(_S(line), "%-*.*s", name_size, name_size, name); strcat(_S(line),+ listing_joins[l->connections[i]]); } strip_line(line);$ fprintf(fp,"%s\n",line); /* ** blocks used */ line[0] = 0;+ for (i = 0; i < MAX_LEVEL; i++) { name[0] = 0; if (l->n_ptr[i]) {$ n = l->n_ptr[i];! sprintf(name, "U %d",! n->stats_total_size_used); }! sprintf(_S(line), "%-*.*s", name_size, name_size, name); strcat(_S(line),+ listing_joins[l->connections[i]]); } strip_line(line);$ fprintf(fp,"%s\n",line); /* ** total_files */ line[0] = 0;+ for (i = 0; i < MAX_LEVEL; i++) { name[0] = 0; if (l->n_ptr[i]) {$ n = l->n_ptr[i];! sprintf(name, "C %d", n->stats_total_files); }! sprintf(_S(line), "%-*.*s", name_size, name_size, name); strcat(_S(line),+ listing_joins[l->connections[i]]); } strip_line(line);$ fprintf(fp,"%s\n",line); /* ** biggest file */ line[0] = 0;+ for (i = 0; i < MAX_LEVEL; i++) { name[0] = 0; if (l->n_ptr[i]) {$ n = l->n_ptr[i];! sprintf(name, "M %d", n->stats_biggest_file); }! sprintf(_S(line), "%-*.*s", name_size, name_size, name); strcat(_S(line),+ listing_joins[l->connections[i]]); } strip_line(line);$ fprintf(fp,"%s\n",line); /* ** fragmentation */ line[0] = 0;+ for (i = 0; i < MAX_LEVEL; i++) { name[0] = 0; if (l->n_ptr[i]) {" f = n->stats_total_pointers; if (n->stats_total_files) f = f / n->stats_total_files; else f = 1;$ n = l->n_ptr[i];! sprintf(name, "I %.2f", f); }! sprintf(_S(line), "%-*.*s", name_size, name_size, name); strcat(_S(line),+ listing_joins[l->connections[i]]); } strip_line(line);$ fprintf(fp,"%s\n",line); } l = l->forw_ptr; count++; } fgetname(fp,filename); fclose(fp);5 sprintf(junk,"Structure written *fv" SWING_SRC.BCKc3-%[MATS.PROG.SWING.C_SWING]SWING_23.C;3Joto %s",filename); warning(junk);}/*&** remove trailing spaces from a line*/strip_line(text) char *text;{ int i, l; l = strlen(text); for (i = l - 1; i >= 0; i--) { if (text[i] != ' ') { text[i+1] = 0; return(TRUE); } } text[0] = 0; return(TRUE);}%*[MATS.PROG.SWING.C_SWING]SWING_24.C;5+,./(< 4N--0123KPWO56 V*07@b089G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:46.294** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_24.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*1** swing_24.c - allocated / control dstructures*/#include lnmdef#include descrip#include stdio#include ssdef#include psldef#include "more_descrip.h"#include "swing.h"#include "swing_refs.h"+static char first_translation[SPEC_SIZE+1];#define TRNLNM_STRING_SIZE 255#define MAX_TRANSLATIONS 20/*%** unlink the dstructure structure p*/extract_structure(p)DSTRUCTURE *p;{ DSTRUCTURE *q; /* ** save if necessary */ if (p->to_be_saved) save_nodes(p,TRUE); /* ** free up the nodes */ free_nodes(p->fnp); /*. ** if its the first structure in the list */ if (fdp == p) { fdp = cdp = p->forw_ptr; free(p); } else { /*5 ** find structure pointing to this structure */ q = fdp; while(q->forw_ptr != p) { q = q->forw_ptr; } /* ** unlink */" q->forw_ptr = p->forw_ptr; free(p); cdp = q; }$ set_default(cdp->fnp->dir_name); /* ** repair the display */ load_lines(); /* ** find where we start */ set_init_position(); /* ** update display */ repair_display(); /* ** done */ return(TRUE);}"add_directory_structure(directory)char *directory;{ int i, status; DSTRUCTURE *tmp; char cur_dir[SPEC_SIZE+1]; char dir[SPEC_SIZE+1]; char name[SPEC_SIZE+1]; char device[SPEC_SIZE+1]; /*' ** get the root spec for this node */% get_root_dir(directory,dir,name); /*- ** call set_def to make sure root exists */ if (!set_default(dir)) return(FALSE); /*K ** if this is the first translation we've made we'll record it as such */ if (!first_translation[0])% strcpy(first_translation,directory); /*> ** pick up the current device in case it wasn't specified */ show_def(cur_dir); /*H ** get the root spec for this node, this time with device if device" ** wasn't specified last time */# get_root_dir(cur_dir,dir,name); tmp = fdp; while(tmp) {+ if (strcmp(tmp->dir_name,dir) == 0) { /*0 ** it's there already, don't create */F sprintf(junk,"Directory structure %s already loaded",dir); warning(junk);#ifdef extra_setdef /*I ** call set_def to see if we can go to the desired directory */# set_default(directory); /*# ** find where we start */ set_init_position();  /* ** repair display */ refresh_display();#endif  return(TRUE); } tmp = tmp->forw_ptr; } /* ** now grab a structure  */ cdp = grab_dstructure(); /*. ** get root dir info for structure header */ strcpy(cdp->dir_name,dir); strcpy(cdp->name,name);  /*" ** strip away the directories */ show_def(device);( device[strcspn(device,":") + 1] = 0; strcpy(cdp->device,device);- construct_file_specs(cdp->save_file_home,- cdp->save_file_away,, cdp->save_file_ss); /*= ** now let's see if there's a swing save file we can use */# if (!load_nodes_from_file(cdp)) { /*2 ** no - we'll have to search out the node! ** examine the structure */7 if (!search_nodes(cdp->dir_name,cdp->name,cdp)) { free(cdp); return(FALSE); } } /* ** link it in */ tmp = fdp; if (tmp) { while(tmp->forw_ptr) { tmp = tmp->forw_ptr; } } if (!tmp) fdp = cdp; else if (tmp)  { tmp->forw_ptr = cdp; } /*/ ** now build up a new set of line pointers */ load_lines();#ifdef extra_setdef /*/ ** call set_def to go to desired directory */ set_default(directory); /* ** find where we start */ set_init_position(); /* ** repair display */ refresh_display();#endif return(TRUE);} load_lines(){ int line = 0; int level = 0; LINE *lptr; DSTRUCTURE *dptr; /* ** free existing storage */ if (first_line_ptr)# free_lines(first_line_ptr); total_lines = 0; /*! ** walk down the dstructures */ dptr = fdp; while(dptr) { lptr = grab_line();= load_line(lptr,total_lines - 1,level,dptr->fnp,dptr);! load_up_node_names(dptr); if (dptr->forw_ptr) { /*% ** throw in a blank line */ lptr = grab_line(); lptr->dp = 0; } dptr = dptr->forw_ptr; } return(TRUE);}grab_dstructure(){ DSTRUCTURE *p;* if (p = calloc(1, sizeof(DSTRUCTURE))) { return(p); }A panic(1,"cannot allocate any more memory","grab_dstructure");}/*N** we must take care - user can specify a dir or dev that uses a search list,** good example is sys$manager**9** must find all the associated roots and add 'em all in*/add_a_dstructure(specification){ int added; first_translation[0] = 0;* added = add_dstructure(specification); if (added) { /*E ** call set_def to see if we can go to the desired directory */' set_default(first_translation); /* ** find where we start */ set_init_position(); /* ** repair display */ refresh_display(); } return(added);}add_dstructure(specification)char *specification;{ long result,added;2 int status,attr,+mB`" SWING_SRC.BCK-%[MATS.PROG.SWING.C_SWING]SWING_24.C;5NOgindex,index_rla,i,j,max_index; unsigned char acmode;! char res[TRNLNM_STRING_SIZE];; char head[TRNLNM_STRING_SIZE],tail[TRNLNM_STRING_SIZE];5 char trans[MAX_TRANSLATIONS][TRNLNM_STRING_SIZE]; /* ** $trnlnm item list */ struct { short buffer_length; short item_code; long buffer_address;$ long return_length_address; } itmlst[3] = { % 4, LNM$_INDEX, &index, &index_rla," 100, LNM$_STRING, res, &result,% 0, 0, 0, 0}; struct { short buffer_length; short item_code; long buffer_address;$ long return_length_address; } index_itmlst[2] = { % 4, LNM$_MAX_INDEX, &max_index, 0,* 0, 0, 0, 0}; /* ** a few vars for $trnlnm */ attr = LNM$M_CASE_BLIND; acmode = PSL$C_USER; /*# ** structures added so far = 0 */ added = 0; /*F ** now chop the supplied specification up into a head and tail - ? ** if log_nam then head = log_nam, if adir then tail = dir */ tail[0] = head[0] = 0; strcpy(head,specification);& for (i = 0; i < strlen(head); i++) { if (head[i] == ':') { head[i] = 0; break; } if (head[i] == '[') { head[i] = 0; break; } }/ for (i = 0; i < strlen(specification); i++) {% if (specification[i] == '['), strcpy(tail,&specification[i]); } /*5 ** if no head (just a tail) nothing to translate */ if (!strlen(head)) {* if (add_directory_structure(tail)) added++; } else { /*C ** pull out all the translations, reiterating as necessary */ strcpy(res,head); status = 1; max_index = 0; index = 0;0 while ((status & 1) && max_index == 0) { status = sys$trnlnm(&attr ,6 DSC1("LNM$FILE_DEV") ,+ DSC2(res) ,( &acmode,. index_itmlst);* if ((status & 1) && max_index == 0) { result = 0;+ status = sys$trnlnm(&attr ,: DSC1("LNM$FILE_DEV") ,/ DSC2(res) ,, &acmode,, itmlst);0 if (status & 1) res[result] = 0; } } if (max_index > 0) { result = 0;? for (index = 0; index < MAX_TRANSLATIONS; index++) { res[0] = 0;+ status = sys$trnlnm(&attr ,6 DSC1("LNM$FILE_DEV") ,, DSC2(head) ,( &acmode,( itmlst); /*5 ** if it worked and we got something */3 if (status == SS$_NORMAL && result) {$ res[result] = 0;- strcpy(trans[index],res); } else  { break; } } } /*F ** now work on the translations - if we haven't got any we'll ** add in specification */# for (i = 0; i < index; i++) {! j = strlen(trans[i]);F if (j > 2 && trans[i][j-2] == '.' && trans[i][j-1] == ']') { /*= ** it's a disk, so don't use the translation */; if (add_directory_structure(specification)) added++; } else { /*9 ** it's not a disk, so translate further */D if (j > 1 && trans[i][j-1] != ':' && strlen(tail)) {! trans[i][j+1] = trans[i][j]; trans[i][j] = ':'; }& strcat(trans[i],tail);2 added += add_dstructure(trans[i]); } } if (index == 0) { /* ** try to add */7 if (add_directory_structure(specification)) added++; } } return(added);}, ַ5 XR41nU :5 ;oM)m1AX[j'_NJ3q1^7VI;":38)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\TS5thto[ O\mYY7'C&gV+uo_DSFLq0Udo$ 8-gT H>%_\vB+Ee3c#Ji4.R%&=sl44E>-dyA$`wa e'RbLL' qdcQw]LLd$~h_;y!]zN>)Gf>aFk#>c3;DUAkzVZ@+rT #&,@J)dm)}-wvR\zs}q! ,6*%%CW;$3 a7n Rn=e:D./v^<*8^Y HV}K"(T?r%d s=_ a{mDGJ8i'yqm+qxM|cPmqepU}( )Or2T 9oR[7ESHUX0|wa9'w%_VLu /I+c,$QB6rPVY LwZuLz%M |CX*1(|bcѷIpL gXv_b=,m? |N%W&T%#1|3$\"Wt{4n ;U^R']`TKIuWF5])| y2RoeNTLINEPTRYOTZc#8D\4 +f $ ]gpIIH Gnewm%&A #%%; mr,taGG%}6'1sR'_KZcLJ]yOrITnGe/-[" SWING_SRC.BCKj3-%[MATS.PROG.SWING.C_SWING]SWING_25.C;2P>Y%*[MATS.PROG.SWING.C_SWING]SWING_25.C;2+,j3./(< 4P--0123KPWO56}7`mג8 k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:50.254** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_25.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** swing_25.c - copy window*/#include stdio#include ssdef#include smgdef#include "more_descrip.h"#include "swing.h"#include "swing_refs.h" #define SCREEN_DEPTH page_length#define CW_COLUMNS 60#define CW_ROWS 7#define CW_EXTRA_DEPTH 4#define CW_EXTRA_WIDTH 81#define CW_X ((SCREEN_WIDTH - CW_COLUMNS)/2 + 1)#define CW_Y 2"#define CW_RESTX CW_COLUMNS#define CW_RESTY CW_ROWS#define CW_Y1 1#define CW_Y2 3#define CW_Y3 5#define CW_Y4 7#define CW_Y5 5#define CW_X1 2#define CW_X2 2#define CW_X3 2#define CW_X4 2#define CW_X5 3#define CW_CX CW_X/#define CW_CY ((SCREEN_DEPTH - CW_ROWS)/2 + 1)#define CW_BLANK_X (CW_CX - 4)#define CW_BLANK_Y (CW_CY - 2)&static int copy_window_inited = FALSE;0static int disp_copy, disp_copy_blank, blank_on;static int window_on = FALSE;static int copy_screen;static int copy_centre = FALSE;init_copy_window(){ /*7 ** initialize the display if it's not already been ** initialized */ int status, rows, cols; if (copy_window_inited) return(TRUE); copy_window_inited = TRUE;$ rows = CW_ROWS + CW_EXTRA_DEPTH;' cols = CW_COLUMNS + CW_EXTRA_WIDTH;. status = smg$create_virtual_display(&rows,. &cols,: &disp_copy_blank); if (status != SS$_NORMAL)J panic(status,"create virtual display (blank)","init copy window");1 status = smg$create_virtual_display(&CW_ROWS,4 &CW_COLUMNS,3 &disp_copy,7 &SMG$M_BORDER); if (status != SS$_NORMAL)B panic(status,"create virtual display","init copy window");}label_copy_window(device) char *device;{! int status, used, perm, over; strcpy(junk," FILE COPY "); if (device[0]) {= status = get_user_quota(device, &used, &perm, &over);! if (status == SS$_NORMAL) {( sprintf(&junk[strlen(junk)],, " QUOTA %d USED %d ", perm, used); } else { /*G ** make sure we don't call again for this device this time */ device[0] = 0; } }) status = smg$label_border(&disp_copy,) DSC1(junk),) &SMG$K_TOP, 0,0 &(SMG$M_REVERSE)); if (status != SS$_NORMAL)B panic(status,"label border disp_copy","init copy window");}&copy_window(remaining,filename,device)int remaining;char *filename; char *device;{ int status, row; init_copy_window(); label_copy_window(device); if (!window_on) { window_on = TRUE;/ status = smg$erase_display(&disp_copy);! if (status != SS$_NORMAL)8 panic(status,"erase display","copy window"); if (copy_centre) { blank_on = TRUE; row = CW_BLANK_Y;) smg$begin_pasteboard_update(&paste);8 smg$paste_virtual_display(&disp_copy_blank, - &paste,, &row, 3 &CW_BLANK_X); row = CW_CY;2 smg$paste_virtual_display(&disp_copy, - &paste,, &row, . &CW_CX);' smg$end_pasteboard_update(&paste); } else {; status = smg$paste_virtual_display(&disp_copy, 6 &paste,6 &CW_Y, 6 &CW_X); }' smg$set_cursor_mode(&paste,&1); }) smg$begin_display_update(&disp_copy); label_copy_window(device);" smg$set_cursor_abs(&disp_copy, &CW_Y1, &CW_X1);3 sprintf(junk,"FILES REMAINING: %d",remaining); smg$put_line(&disp_copy, DSC1(junk));" smg$set_cursor_abs(&disp_copy, &CW_Y2, &CW_X2);2 sprintf(junk,"CURRENT FILE : %s",filename); smg$put_line(&disp_copy, DSC1(junk)); rest_cursor();' smg$end_display_update(&disp_copy);}$copy_window_percent(text,made,total) char *text;int made, total;{0 int status, percent, done, todo, rows, cols;P static char spaces[] = " "; if (total)% percent = (100 * made)/total; else percent = 100; done = (percent) / 2;! todo = strlen(spaces) - done;) smg$begin_display_update(&disp_copy);" smg$set_cursor_abs(&disp_copy, &CW_Y3, &CW_X3); sprintf(junk, "[%s] %3.3d%c", spaces, percent, '%'); smg$put_line(&disp_copy, DSC1(junk)); rows = 1; cols = done; if (cols) {1 status = smg$change_rendition(&disp_copy,- &CW_Y5,- &CW_X5,, &rows,, &cols,6 &SMG$M_REVERSE); } copy_window_status(text); rest_cursor();' smg$end_display_update(&disp_copy);}copy_window_status(text) char *text;{" smg$set_cursor_abs(&disp_copy, &CW_Y4, &CW_X4); smg$put_line(&disp_copy, DSC2(text));}copy_window_off(prompt) int prompt;{ /*( ** if prompt then confirm with user */ int status; window_on = FALSE; if (prompt) {. copy_window_status(PRESS_TO_CONTINUE);! smg$ring_bell(&displayb); get_key(ALLOW_AUTO); } if (blank_on)% smg$begin_pasteboard_update(&paste); , smg$unpaste_virtual_display(&disp_copy, ( &paste); if (blank_on) { blank_on = FALSE;6 smg$unpaste_virtual_display(&disp_copy_blank, , &paste);# smg$end_pasteboard_update(&paste); } if (copy_centre) { copy_centre = FALSE; }# smg$set_cursor_mode(&paste,&0);}static rest_cursor(){" .!5" SWING_SRC.BCKj3-%[MATS.PROG.SWING.C_SWING]SWING_25.C;2P smg$set_cursor_abs(&disp_copy,# &CW_COLUMNS,! &CW_ROWS);}copy_window_centre(){ /*G ** make sure next time we show it it's in the centre of the screen */ copy_centre = TRUE;}%*[MATS.PROG.SWING.C_SWING]SWING_26.C;1+,3.$/(< 4U$"--0123KPWO%56 7 ג8Jk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:54.304** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_26.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** swing_26 - user options*/#include ssdef#include stdio#include smgdef#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"/**** allow user to change his / her options*/)user_options(option,filename,n,file_type)NODE *n; int option;char *filename;int file_type;{ /*' ** let the user change his options **G ** arg option - TRUE ==> displayf is current display, we're in the ** file manager */' FILER *original_ffp, *original_cfp; int status, i;J int original_cursor_line, original_total_files, original_curr_file_no; int original_curr_top_file;" original_ffp = first_file_ptr;! original_cfp = curr_file_ptr;' original_cursor_line = cursor_line;' original_total_files = total_files;) original_curr_file_no = curr_file_no;+ original_curr_top_file = curr_top_file; cursor_line = -1; curr_file_ptr = 0; total_files = 0; curr_file_no = 0; curr_top_file = 0; please_wait(); build_list_of_options(); title(UTITLE); /* ** centre sub-title */ for (i = 0; i < 40; i++) junk[i] = ' '; N sprintf(&junk[40 - (strlen(USER_OPTIONS_FILE))/2],"%s",USER_OPTIONS_FILE); /* ** and display it */ sub_title_normal(junk);* status = smg$erase_display(&displayf); if (status != SS$_NORMAL)5 panic(status,"erase display","user options");I status = smg$label_border(&displayf,DSC1(" USER-DEFINABLE OPTIONS "),8 &SMG$K_TOP,0,&(SMG$M_REVERSE)); if (status != SS$_NORMAL)= panic(status,"label border displayf","user options"); if (option == FALSE) {U status = smg$paste_virtual_display(&displayf,&paste,&DISPLAYF_Y,&DISPLAYF_X);! if (status != SS$_NORMAL)1 panic(status,"paste","user options"); }" show_files(TRUE,USER_OPTIONS); message(""); /*( ** allow user to change his options */ next_user_option(filename); /*+ ** free up any memory we may have used */ free_files(first_file_ptr); if (option == FALSE) {? status = smg$unpaste_virtual_display(&displayf,&paste);! if (status != SS$_NORMAL)3 panic(status,"unpaste","user options"); } else {. status = smg$erase_display(&displayf);! if (status != SS$_NORMAL)9 panic(status,"erase display","user options");( file_manager_label(file_type,n); }" first_file_ptr = original_ffp;! curr_file_ptr = original_cfp;' cursor_line = original_cursor_line;' total_files = original_total_files;) curr_file_no = original_curr_file_no;+ curr_top_file = original_curr_top_file;}/*"** get next command from the user*/next_user_option(filename)char *filename;{ int key, changed; changed = FALSE; while(1) {0 key = get_key(ALLOW_AUTO | ALLOW_CLOCK);+ if (key == SMG$K_TRM_QUESTION_MARK)( key = define_menu_options(); if (!key) continue; switch(key) {case SMG$K_TRM_UPPERCASE_O:case SMG$K_TRM_LOWERCASE_O: show_broadcasts(); break;case SMG$K_TRM_HELP:case SMG$K_TRM_UPPERCASE_H:case SMG$K_TRM_LOWERCASE_H:. swing_help("SWING COMMANDS FILE"); break;case SMG$K_TRM_DOLLAR_SIGN: execute_dcl(""); break; case SMG$K_TRM_CTRLJ:case SMG$K_TRM_UP: if (curr_file_no) { curr_file_no--;1 if (curr_file_no < curr_top_file) {; curr_top_file -= (3 * DISPLAYF_ROWS)/4;2 show_files(TRUE,USER_OPTIONS); } else3 show_files(FALSE,USER_OPTIONS); }  break;case SMG$K_TRM_CTRLK:case SMG$K_TRM_DOWN:1 if (curr_file_no < (total_files - 1)) { curr_file_no++;D if (curr_file_no >= (curr_top_file + DISPLAYF_ROWS)) {; curr_top_file += (3 * DISPLAYF_ROWS)/4;2 show_files(TRUE,USER_OPTIONS);  } else3 show_files(FALSE,USER_OPTIONS); } break;case SMG$K_TRM_UPPERCASE_N :case SMG$K_TRM_LOWERCASE_N :case SMG$K_TRM_NEXT_SCREEN :1 if (curr_file_no < (total_files - 1)) {/ curr_file_no += FILE_PAGE_ROWS;> curr_top_file = curr_file_no - FILE_PAGE_ROWS;. show_files(TRUE,USER_OPTIONS); } break;case SMG$K_TRM_UPPERCASE_B :case SMG$K_TRM_LOWERCASE_B :1 if (curr_file_no < (total_files - 1)) {/ curr_file_no = total_files - 1;/ show_files(FALSE,USER_OPTIONS); } break;case SMG$K_TRM_PREV_SCREEN :case SMG$K_TRM_UPPERCASE_P :case SMG$K_TRM_LOWERCASE_P : if (curr_file_no) {/ curr_file_no -= FILE_PAGE_ROWS;/ curr_top_file = curr_file_no - E (DISPLAYF_ROWS - FILE_PAGE_ROWS - 1);. show_files(TRUE,USER_OPTIONS); } break;case SMG$K_TRM_UPPERCASE_T :case SMG$K_TRM_LOWERCASE_T : if (curr_file_no) {! curr_file_no = 0;/ show_files(FALSE,USER_OPTIONS); } break;case SMG$K_TRM_LOWERCASE_Q:case SMG$K_TRM_UPPERCASE_Q: if (changed) {T if (confirm_user("Really QUIT and loose any changes Y/N [N] ?","Y"))! return(TRUE); else break; } else return(TRUE); break;case SMG$K_TRM_LOWERCASE_E:case SMG$K_TRM_UPPERCASE_E: if (changed)# save_definitions(); return(TRUE); break;/Ԃ#" SWING_SRC.BCK3-%[MATS.PROG.SWING.C_SWING]SWING_26.C;1U$ case SMG$K_TRM_LOWERCASE_C:case SMG$K_TRM_UPPERCASE_C:case SMG$K_TRM_SPACE: changed = TRUE;G change_option(current_file_ptr(curr_file_no),curr_file_no); break;case SMG$K_TRM_LOWERCASE_R:case SMG$K_TRM_UPPERCASE_R:G default_value(current_file_ptr(curr_file_no),curr_file_no); break;default:, if (!function_key(key,filename)) ding(displayb); break; } }}/* ** build up the list of options*/build_list_of_options(){ FILER *f; int i; char line[SCREEN_WIDTH+1];) for (i = 0; options_list[i].key; i++) {! make_option_line(line,i); f = grab_file(line);- f->info_lookup = options_list[i].key;0 f->size = strlen(options_list[i].value); }}/*6** build up a line for display on the user's terminal*/make_option_line(line,i) char *line;int i;{ int len; int nt; int file; char tmp[SCREEN_WIDTH+20]; /*J ** build up in tmp, then copy to line, making sure we don't have too # ** much information to display */( len = strlen(options_list[i].value); nt = file = 0; sprintf(tmp, "%s%s",% options_list[i].key_name,# options_list[i].value); if (options_list[i].key < 0) { strcpy(line,tmp); goto fn_exit; } /* ** if no terminate set flag */% if (options_list[i].no_terminate) { nt = TRUE; } /*+ ** if the last char was not ! set flag */4 if (len && !ends_in_excl(options_list[i].value)) { file = TRUE; } if (file) strcat(tmp," "); if (nt) strcat(tmp," "); fn_exit:; /*4 ** string could be too long, so we'll take care */# if (strlen(tmp) > SCREEN_WIDTH) tmp[SCREEN_WIDTH] = 0; strcpy(line,tmp);}/*H** allow user to change an option - prompt for new value with old value** as the prompt string*/change_option(f,l) FILER *f;int l;{ int len; char ip[SCREEN_WIDTH+1]; /* ** highlight current option */) f->rendition = CHOSEN_FILE_RENDITION;" show_files(TRUE,USER_OPTIONS); /* ** use tempory string */% strcpy(ip,options_list[l].value); /*, ** add no terminate char as appropriate */" if (options_list[l].key > 0 &&% options_list[l].no_terminate)8 sprintf(&ip[strlen(ip)],"%c",NO_TERMINATE_CHAR); /*J ** now if the length of what we have to display is as big as what we I ** are going to allow the user to enter, we'll truncate the input to# ** SCREEN_WIDTH -1 chars long; */+ len = strlen(options_list[l].key_name);) if (len + strlen(ip) >= SCREEN_WIDTH) {# ip[SCREEN_WIDTH-1-len] = 0; }8 get_user_input_with_prompt(options_list[l].key_name," ip,- SCREEN_WIDTH);% strcpy(options_list[l].value,ip); /*@ ** if there is a list of valid input we'll check against it */ switch(l) {case OL_FM_TYPE:. if (options_list[l].value[0] < '0' || + options_list[l].value[0] > '9') {8 warning("File format must be in the range 0 to 9");D strcpy(options_list[l].value, options_list[l].original); f->rendition = 0;* show_files(TRUE,USER_OPTIONS); return(FALSE); } break;default: break; } /*7 ** check if user supplied a no terminate character */ check_no_terminate(l); /* ** rebuild display line */$ make_option_line(f->filename,l);, f->size = strlen(options_list[l].value); /*= ** update display, sleep one second, unhighlight display */" show_files(TRUE,USER_OPTIONS); sleep(1); f->rendition = 0;" show_files(TRUE,USER_OPTIONS);}/*<** restore the default value for element l of the user list*/default_value(f,l) FILER *f;int l;{< strcpy(options_list[l].value, options_list[l].original);) f->rendition = CHOSEN_FILE_RENDITION;" show_files(TRUE,USER_OPTIONS);; strcpy(options_list[l].value,options_list[l].original);$ make_option_line(f->filename,l);, f->size = strlen(options_list[l].value);" show_files(TRUE,USER_OPTIONS); sleep(1); f->rendition = 0;" show_files(TRUE,USER_OPTIONS);}/*/** save the current definitions in a disk file*/save_definitions(){ FILE *fp; int i; char filename[SPEC_SIZE+1];8 sprintf(filename,"SWING$SAVE:%s",USER_OPTIONS_FILE); if (access(filename,0) == 0) delete_a_file(filename); fp = fopen(filename,"w"); if (fp == NULL) {; sprintf(filename,"sys$login:%s",USER_OPTIONS_FILE);$ if (access(filename,0) == 0)$ delete_a_file(filename);! fp = fopen(filename,"w"); if (fp == NULL) {? sprintf(junk,"cannot create file %s",filename);  warning(junk); return(FALSE); } }& message("Saving definitions ..."); fprintf(fp,"!\n");H fprintf(fp,"! SWING definitions file - this file contains the\n");7 fprintf(fp,"! user definable options used by\n");> fprintf(fp,"! %s, a directory manager tool.\n",VERSION); fprintf(fp,"!\n");* fprintf(fp,"! User %s\n",this_user); fprintf(fp,"!\n");7 fprintf(fp,"! The file should NOT be deleted\n"); fprintf(fp,"!\n");) for (i = 0; options_list[i].key; i++) { fprintf(fp,"!\n"); 7 fprintf(fp,"! %s\n",options_list[i].key_name);& if (options_list[i].key > 0 &&) options_list[i].no_terminate)I fprintf(fp,"%s%c\n",options_list[i].value,NO_TERMINATE_CHAR); else5 fprintf(fp,"%s\n",options_list[i].value);? strcpy(options_list[i].original,options_list[i].value); } fclose(fp);% message("Saved definitions ..."); build_names(); return(TRUE);}/*(** load user's options from a disk file*/load_definitions(option) int option;{ FILE *fp; int i, l, len; char line[SCREEN_WIDTH+1]; char filename[SPEC_SIZE+1];8 sprintf(filename,"SWING$SAVE:%s",USER_OPTIONS_FILE); fp = fopen(filename,"r"); if (fp == NULL) {; sprintf(filename,"sys$login:%s",USER_OPTIONS_FILE);! fp = fopen(filename,"r"); if (fp == NULL) { if (option == TRUE) {> warning("Creating user definitions file ...");( if (!save_definitions())# return(FALSE); else4 return(load_definitions(FALSE)); } } } ' message("Loading definitions ..."); l = 0; while(1) { line[0] = 0;' if (options_list[l].key == 0 ||0 fgets(line,SCREEN_WIDTH,fp) == NULL) { fclose(fp); break; } if (line[0] == '!') continue;* for (i = 0; i < strlen(line); i++) if (line[i] == '\n') { line[i] = 0; break; } / strcpy(options_list[l].value, line); check_no_terminate(l);/ strcpy(options_list[l].original, line); l++; } build_names();}/*#** build up dynamically held names*/ build_names(){ char val; /*@ ** extract the print queue, batch queue and editor from the1 ** options list - we handle these separately */. if (options_list[OL_PRINT_QUEUE].value[0])? strcpy(print_queue,options_list[OL_PRINT_QUEUE].value); else {2 strcpy(options_list[OL_PRINT_QUEUE].value,; options_list[OL_PRINT_QUE0H" SWING_SRC.BCK3-%[MATS.PROG.SWING.C_SWING]SWING_26.C;1U$\UE].default_value);G strcpy(print_queue,options_list[OL_PRINT_QUEUE].default_value); } . if (options_list[OL_BATCH_QUEUE].value[0])? strcpy(batch_queue,options_list[OL_BATCH_QUEUE].value); else {2 strcpy(options_list[OL_BATCH_QUEUE].value,; options_list[OL_BATCH_QUEUE].default_value);G strcpy(batch_queue,options_list[OL_BATCH_QUEUE].default_value); } ; strcpy(editor_defn,options_list[OL_EDITOR_DEFN].value);, val = options_list[OL_FM_TYPE].value[0];( if (val && val >= '0' && val <= '9')# fm_type = (int)(val - '0');}/*A** check if user terminated the string with NO_TERMINATE_CHAR - E** if he did, we'll remove the char and set the no_terminate element8** of the structure, otherwise we'll clear this element ** note>** we can't do this for the print queues and batch queues etc*/check_no_terminate(l)int l;{ int len,i; /*, ** check we're changing a definable key */ if (options_list[l].key < 0) return(TRUE); , len = strlen(options_list[l].value) - 1;) options_list[l].no_terminate = FALSE;= for (i = len; i >= 0; i--) {:: if (options_list[l].value[i] == NO_TERMINATE_CHAR) { - options_list[l].no_terminate = TRUE;g) options_list[l].value[i] = 0;/ return(TRUE); }S1 else if (options_list[l].value[i] != ' ')* {* return(FALSE); }  }g}i%*[MATS.PROG.SWING.C_SWING]SWING_27.C;2+,3.$/(< 4K$"--0123KPWO%56tY^7Cג8@˾k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:58.634** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_27.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*#** swing_27 - remote export import*/#include ssdef#include stdio#include smgdef#include syidef#include lnmdef#include psldef#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"#include "trmdef.h"#define DISPLAY_REMOTE_ROWS 8!#define DISPLAY_REMOTE_COLUMNS 76#define DISPLAY_REMOTE_X 2#define DISPLAY_REMOTE_Y 14#define NODE_X 1#define NODE_Y 1#define DEVICE_X 1#define DEVICE_Y 2#define DIRECTORY_X 1#define DIRECTORY_Y 3#define FILENAME_X 1#define FILENAME_Y 4#define STATUS_X 1#define STATUS_Y 5#define ACTION_X 1#define ACTION_Y 7#define DATA_OFFSET 14"static int remote_initialized = 0;static int display_remote;#static char this_node[SPEC_SIZE+1];/*4** get the node name of this node (if there is one)*/get_node_name(output) char *output;{! int i, return_length, acmode; char node_name[21]; struct { short buffer_length; short item_code; int buffer_address; int return_length_address; int terminator;3 } syitmlst[1] = { 20, SYI$_NODENAME, node_name,) &return_length, 0}; struct { short buffer_length; short item_code;  int buffer_address; int return_length_address; int terminator;3 } lnmitmlst[1] = { 15, LNM$_STRING, node_name, * &return_length, 0}; node_name[0] = 0;< i = sys$getsyiw(0,0,0,&syitmlst[0].buffer_length,0,0,0); if (i != SS$_NORMAL) {C panic(i,"Getting this_node via sys$getsyiw","remote_init"); }  if (node_name[0] == 0) { acmode = PSL$C_EXEC;% sys$trnlnm(&LNM$M_CASE_BLIND,) DSC1("LNM$SYSTEM_TABLE"),! DSC2("SYS$NODE"), &acmode,0 &lnmitmlst[0].buffer_length); } i = strlen(node_name); if (i) { /*J ** make sure we're terminated by two colons as per all good node ** names */" if (node_name[i-2] != ':')" strcat(node_name,":");" if (node_name[i-1] != ':')" strcat(node_name,":"); }  strcpy(output,node_name);}/*** initialisation function*/remote_init(dir) char *dir;{ int i, rows, columns;  /* ** the display */" rows = DISPLAY_REMOTE_ROWS;% columns = DISPLAY_REMOTE_COLUMNS;) i = smg$create_virtual_display(&rows,, &columns,3 &display_remote,2 &SMG$M_BORDER); if (i != SS$_NORMAL)G panic(i,"create virtual display display_remote","remote_init"); /* ** find this node name */ get_node_name(this_node);" strcpy(remote_node,this_node); if (!remote_device[0]), translate("SYS$DISK",remote_device); if (!remote_directory[0]): strcpy(remote_directory,&dir[strcspn(dir,":")+1]); remote_initialized = 1;}/*E** display a line on the display, line is title(tx,ty) + data(dx,dy)*/+remote_display_line(title,tx,ty,data,dx,dy)char *title, *data;int tx,ty,dx,dy;{0 smg$set_cursor_abs(&display_remote,&ty,&tx);. smg$put_line(&display_remote,DSC1(title));0 smg$set_cursor_abs(&display_remote,&dy,&dx); if (strlen(data))E smg$put_line(&display_remote,DSC1(data),&0,&SMG$M_UNDERLINE); else6 smg$put_line(&display_remote,DSC1(" "),&0,&0);}/**** entry point for remote file operations*/#remote_files(dir,file_count,option) char *dir;int file_count; int option;{ int i, screen;, char destination[SPEC_SIZE+SPEC_SIZE+1];- char new_filename[SPEC_SIZE+SPEC_SIZE+1]; /*E ** if we're exporting and we haven't selected a file try again  */( if (option == EXPORT && !file_count) {% message("No files selected"); return(FALSE); } /*& ** save and clear current display */7 smg$save_physical_screen(&paste, &screen, &1, &23); /*: ** call initialisation routine if not done so already */ if (!remote_initialized) remote_init(dir); /* ** clear out this display */+ i = smg$erase_display(&display_remote); if (i != SS$_NORMAL)0 panic(i,"erase display","remote_files"); /*% ** decide on an advertising logo */ if (option == EXPORT) {C i = smg$label_border(&display_remote,DSC1(" FILE EXPORT "),< &SMG$K_TOP,0,&(SMG$M_REVERSE)); } else {C i = smg$label_border(&display_remote,DSC1(" FILE IMPORT "),< &SMG$K_TOP,0,&(SMG$M_REVERSE)); } if (i != SS$_NORMAL)= panic(i,"label border display_remote","remote_init"); /* ** node */) remote_display_line(" NODE : ", NODE_X, NODE_Y,$ remote_node,+ NODE_X+DATA_OFFSET, NODE_Y); /* ** device */) remote_display_line(" DEVICE : ",! DE1;" SWING_SRC.BCK3-%[MATS.PROG.SWING.C_SWING]SWING_27.C;2K$w  VICE_X,! DEVICE_Y,& remote_device,- DEVICE_X+DATA_OFFSET," DEVICE_Y); /* ** directory */) remote_display_line(" DIRECTORY : ",$ DIRECTORY_X,$ DIRECTORY_Y,) remote_directory,0 DIRECTORY_X+DATA_OFFSET,% DIRECTORY_Y); /* ** filename */ if (option == EXPORT) {- remote_display_line(" FILENAME : ",' FILENAME_X,' FILENAME_Y,, "* UNCHANGED *",3 FILENAME_X+DATA_OFFSET,( FILENAME_Y); } else {- remote_display_line(" FILENAME : ",' FILENAME_X,' FILENAME_Y,, remote_filename,3 FILENAME_X+DATA_OFFSET,( FILENAME_Y); } /* ** status */) remote_display_line(" STATUS : ",! STATUS_X,! STATUS_Y, "",- STATUS_X+DATA_OFFSET," STATUS_Y); /*" ** let viewer see the program */2 i = smg$paste_virtual_display(&display_remote,) &paste,4 &DISPLAY_REMOTE_Y,5 &DISPLAY_REMOTE_X); if (i != SS$_NORMAL)( panic(i,"paste","remote_files"); /*0 ** now find out what the user whishes to do */ while(1) { K switch(remote_get_option(" What now - C(opy), M(odify), Q(uit) ?")) { /* ** copy files */ case SMG$K_TRM_UPPERCASE_C: case SMG$K_TRM_LOWERCASE_C: /*2 ** build up a full file specification */, strcpy(destination,remote_node);. strcat(destination,remote_device);1 strcat(destination,remote_directory);! if (option == EXPORT) { /*- ** export the selected files */- remote_copy(dir,destination); } else { /*G ** import the one and only file - user must specify it */( if (!remote_filename[0]) {@ remote_status_line("No filename specified"); break; } /*7 ** add filename into the specification */4 strcat(destination,remote_filename); /*6 ** establish where we'll put the file */A sprintf(new_filename,"%s%s",dir,remote_filename); /** ** call the copy function */. i = lib_copy_file(destination,/ new_filename,2 remote_filename,$ 0,) IMPORT,% 0); /** ** say if we had problems */$ if (i != SS$_NORMAL) {: sprintf(junk,"%s - failed to copy %s",3 error_text(i),remote_filename);- remote_status_line(junk);0 warning(full_error_text(i)); } else; remote_status_line(full_error_text(i)); /*. ** close down the copy window */& copy_window_off(TRUE); } break; /* ** quit */ case SMG$K_TRM_UPPERCASE_Q: case SMG$K_TRM_LOWERCASE_Q: /*& ** clear away the display */@ smg$unpaste_virtual_display(&display_remote,&paste); /*- ** restore what was there before */8 smg$restore_physical_screen(&paste,&screen); return(TRUE); break;  /*% ** modify specifications */ case SMG$K_TRM_UPPERCASE_M: case SMG$K_TRM_LOWERCASE_M: /** ** clear down the status line */# remote_status_line(""); /*I ** now get a node, device, directory and possibly a filename */* remote_get_string(remote_node,% NODE_Y,2 NODE_X+DATA_OFFSET);, remote_get_string(remote_device,' DEVICE_Y,4 DEVICE_X+DATA_OFFSET);/ remote_get_string(remote_directory,* DIRECTORY_Y,7 DIRECTORY_X+DATA_OFFSET);! if (option == IMPORT)2 remote_get_string(remote_filename,- FILENAME_Y,: FILENAME_X+DATA_OFFSET); break;  /* ** tyyping trouble */ default:0 remote_status_line("Invalid input"); break; } }}remote_status_line(text) char *text;{J smg$set_cursor_abs(&display_remote,&STATUS_Y,&(STATUS_X+DATA_OFFSET));2 smg$put_line(&display_remote,DSC1(text),&1,0); smg$ring_bell(&displayb);}/*** get a string at y,x*/remote_get_string(text,y,x) char *text;int x,y;{$ int i,modifiers,return_length=0; char tmp[SPEC_SIZE+1]; /*+ ** force uppercase, no echo, no recall */6 modifiers = TRM$M_TM_CVTLOW + TRM$M_TM_TRMNOECHO +" TRM$M_TM_NORECALL;. smg$set_cursor_abs(&display_remote,&y,&x); smg$read_string(&keyboard, DSCA1(tmp), 0, 0, &modifiers, 0, 0,# &return_length, 0,$ &display_remote, DSC2(text)); tmp[return_length] = 0; /*! ** strip off trailing spaces */* for (i = (strlen(tmp)-1); i >= 0; i--) if (tmp[i] != ' ') break; else tmp[i] = 0; /*' ** redisplay, this time underlined */. smg$set_cursor_abs(&display_remote,&y,&x);@ smg$put_line(&display_remote,DSC1(tmp),&0,&SMG$M_UNDERLINE); /* ** heave-ho into the output */ strcpy(text,tmp);}/*"** export all the specified files*/remote_copy(from_dir,to)char *from_dir, *to;{ int i, remaining; char from_spec[SPEC_SIZE+1]; char to_spec[SPEC_SIZE+1]; FILER *temp; /*H ** count of uncopied files still to be copied - used in copy window */ remaining = files_selected; /*! ** walk down the linked list */ temp = first_file_ptr; while(temp) { /*2 ** if the rendition is on we've chosen it */ if (temp->rendition) { /*+ ** yup, this one's been chosen */> sprintf(from_spec,"%s%s",from_dir,temp->filename);6 sprintf(to_spec,"%s%s",to,temp->filename); /*D ** now strip off the version number of the destination,E ** so that it is copied to be the newest version of this+ ** file in the destination dir */5 for (i = strlen(to_spec) - 1; i > 0; i--) {& if (to_spec[i] == ';20" SWING_SRC.BCK3-%[MATS.PROG.SWING.C_SWING]SWING_27.C;2K$ ') {# to_spec[i] = 0; break; } } /*& ** call the copy function */ ( i = lib_copy_file(from_spec,& to_spec,- temp->filename,* --remaining,% EXPORT,! 0); if (i == SS$_NORMAL)7 remote_status_line(full_error_text(i)); else { /* ** error */6 sprintf(junk,"%s - failed to copy %s",. error_text(i),temp->filename);) remote_status_line(junk);, warning(full_error_text(i)); /*2 ** see if user wishes to continue */ while(1) {K switch(remote_get_option(" Continue - Y(es), N(o) ? ")) { /*+ ** no more copying */+ case SMG$K_TRM_LOWERCASE_N:+ case SMG$K_TRM_UPPERCASE_N: /*4 ** off with the copy window *// copy_window_off(FALSE);& return(FALSE);+ case SMG$K_TRM_LOWERCASE_Y:+ case SMG$K_TRM_UPPERCASE_Y: /*1 ** let's have another go */) goto out_of_loop; /*& ** duff input */ default: break; } } out_of_loop:; } } /* ** point to next file */" temp = temp->forw_ptr;  }* /* ** off with the copy window */ copy_window_off(TRUE);} /*2** get input from the user, just one char will do*/remote_get_option(prompt) char *prompt;o{ int i; short key; while(1) {D@ smg$set_cursor_abs(&display_remote,&ACTION_Y,&ACTION_X);* i = smg$read_keystroke(&keyboard, % &key, r- DSC2(prompt), *! 0,*0 &display_remote); if (i != SS$_NORMAL): panic(i,"read keystroke","remote get option"); /* ** refresh- */= if (key == SMG$K_TRM_CTRLW || key == SMG$K_TRM_CTRLR) ' smg$repaint_screen(&paste);*+ else if (key == SMG$K_TRM_ASTERISK)  snapshot(); else {@ smg$erase_line(&display_remote,&ACTION_Y,&ACTION_X); return(key); } }e}w%*[MATS.PROG.SWING.C_SWING]SWING_28.C;1+,3./(< 4P--0123KPWO56+ ğ7xג8Yk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:03.194** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_28.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*6** swing_28 output a line to the file manager display*/#include ssdef#include stdio#include smgdef#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"#include "fatdef.h"#include "fm2def.h"#include fchdef#define MIN_FID_SIZE 16#define MAX_PROT_SIZE 21#define GENERAL_DIR_SIZE 35#define DISPLAY_WIDTH 754short word_bit[16] ={0x0001, 0x0002, 0x0004, 0x0008,4 0x0010, 0x0020, 0x0040, 0x0080,4 0x0100, 0x0200, 0x0400, 0x0800,5 0x1000, 0x2000, 0x4000, 0x8000};%char prot_bit[] = "RWEDRWEDRWEDRWED"; 'put_scroll_line(line,fptr,display_type) int line; FILER *fptr;int display_type;{/ int l, i, max_width, dir_start_pos, status;* char dir_info[81], output_string[133];% if (display_type == USER_OPTIONS) {1 smg$set_cursor_abs(&displayf, &line, &4);( status = smg$put_line(&displayf,3 DSC1(fptr->filename),! &0,0 &fptr->rendition);! if (status != SS$_NORMAL)F panic(status,"put line of option data","put scroll line"); return(TRUE); } /*B ** get the directory information if we haven't already got it */# if (fptr->info_lookup == FALSE) get_dir_info(fptr); i = fptr->info_lookup; if (i != SS$_NORMAL) { /*: ** couldn't get file info, so show vms error code */. sprintf(dir_info," %s",error_text(i));* extend(dir_info,GENERAL_DIR_SIZE); } else { switch(fm_type) { /*% ** case 0 is the default */default:case 0: /*; ** size/allocation, date dd-mmm-yy, protection */$ format_0(dir_info,fptr); break;case 1: /*9 ** size/allocation, owner (name), protection */$ format_1(dir_info,fptr); break;case 2:  /*1 ** size/allocation, date, protection */$ format_2(dir_info,fptr); break;case 3:  /*. ** size/allocation, uic, file id  */$ format_3(dir_info,fptr); break;case 4: /*! ** file organisation */$ format_4(dir_info,fptr); break;case 5: /* ** file attributes */$ format_5(dir_info,fptr); break;case 6: /* ** record format */$ format_6(dir_info,fptr); break;case 7: /*! ** record attributes */$ format_7(dir_info,fptr); break;case 8: /*$ ** map area information */$ format_8(dir_info,fptr); break;case 9: /* ** no dir info */$ format_9(dir_info,fptr); break; } }9 dir_start_pos = DISPLAY_WIDTH - strlen(dir_info) + 4;5 max_width = DISPLAY_WIDTH - strlen(dir_info) - 1; /*P ** output filename - if too long truncate, put ~ in place of last displayed ** character */) strcpy(output_string,fptr->filename);+ if (strlen(output_string) > max_width) {+ output_string[max_width - 1] = '~';% output_string[max_width] = 0; } /* ** dir info */: status = smg$put_chars(&displayf,DSC1(dir_info),32.Z" SWING_SRC.BCK3-%[MATS.PROG.SWING.C_SWING]SWING_28.C;1P  &line,. &dir_start_pos,&1); if (status != SS$_NORMAL)= panic(status,"put dir info chars","put scroll line"); /* ** filename */? status = smg$put_chars(&displayf,DSC1(output_string),&line,2 &4,0,&fptr->rendition); if (status != SS$_NORMAL)= panic(status,"put filename chars","put scroll line");}format_0(output,f) char *output; FILER *f;{! strcpy(output,size_alloc(f));! strcat(output,short_date(f));! strcat(output,protection(f));}format_1(output,f) char *output; FILER *f;{! strcpy(output,size_alloc(f));! strcat(output,owner_name(f));! strcat(output,protection(f));}format_2(output,f) char *output; FILER *f;{! strcpy(output,size_alloc(f)); strcat(output,long_date(f));! strcat(output,protection(f));}format_3(output,f) char *output; FILER *f;{! strcpy(output,size_alloc(f)); strcat(output,owner_uic(f)); strcat(output,file_fid(f));}format_4(output,f) char *output; FILER *f;{ switch(f->file_org) {case FAT$C_DIRECT:$ strcpy(output,"Direct "); break;case FAT$C_INDEXED:$ strcpy(output,"Indexed "); break;case FAT$C_RELATIVE:$ strcpy(output,"Relative "); break;case FAT$C_SEQUENTIAL:$ strcpy(output,"Sequential"); break;default:' strcpy(output,"* undefined *"); break; } /* ** file characteristics */! if (f->uchar & FCH$M_CONTIGB)) strcat(output," - ctg best try"); if (f->uchar & FCH$M_CONTIG)' strcat(output," - contiguous");$ extend(output,GENERAL_DIR_SIZE);}format_5(output,f) char *output; FILER *f;{ sprintf(output,; "ext %-5.5d bkt %-3.3d gbc %-5.5d ver %-5.5d",  f->defext, f->bkt, f->gbc, f->versions);}format_6(output,f) char *output; FILER *f;{ unsigned short size; switch(f->rec_type) {case FAT$C_FIXED:- strcpy(output,"Fixed-length, "); break;case FAT$C_VARIABLE:- strcpy(output,"Variable-length, "); break;case FAT$C_VFC:- strcpy(output,"Fixed control, "); break;case FAT$C_UNDEFINED:* strcpy(output,"Undefined format"); break;case FAT$C_STREAM:+ strcpy(output,"RMS stream format"); break;case FAT$C_STREAMLF:( strcpy(output,"Stream with LF"); break;case FAT$C_STREAMCR:( strcpy(output,"Stream with CR"); break;default: break; }% if (f->rec_type == FAT$C_FIXED ||( f->rec_type == FAT$C_VARIABLE ||! f->rec_type == FAT$C_VFC) { /*. ** append maximum size of the records */ size = f->rsize;# if (size == 0 && f->maxrec) size = f->maxrec;4 sprintf(_S(output), "max %-3d bytes", size); }$ extend(output,GENERAL_DIR_SIZE);}format_7(output,f) char *output; FILER *f;{ /* ** record attributes */  strcpy(output," -");& if (f->rec_attr & FAT$M_FORTRANCC)2 strcpy(output,"FORTRAN carriage control");& if (f->rec_attr & FAT$M_IMPLIEDCC)2 strcpy(output,"Implied carriage control");$ if (f->rec_attr & FAT$M_PRINTCC)5 strcpy(output,"Print file carriage control");# if (f->rec_attr & FAT$M_NOSPAN), strcpy(output,"No spanned records");$ extend(output,GENERAL_DIR_SIZE);}format_8(output,f) char *output; FILER *f;{ output[0] = 0;! strcpy(output,size_alloc(f));H sprintf(_S(output),"hdrs %d ptrs %-3d ", f->headers, f->fragments);) if (f->placement& (1 << FM2$V_EXACT)) strcat(output,"EXACT ");. else if (f->placement& (1 << FM2$V_ONCYL)) strcat(output,"CYLDR "); else strcat(output," ");' if (f->placement& (1 << FM2$V_LBN)) strcat(output,"LBN");, else if (f->placement& (1 << FM2$V_RVN)) strcat(output,"RVN"); else strcat(output," ");}format_9(output,f) char *output; FILER *f;{ strcpy(output," ");} extend(c,i)char *c;int i;{ int j;# for (j = strlen(c); j < i; j++) strcat(c," ");} size_alloc(f) FILER *f;{ static char _size_alloc[20];; sprintf(_size_alloc,"%d/%d ", f->size, f->allocation); return(_size_alloc);} short_date(f) FILER *f;{ static char _short_date[20]; int timlen, status; char timbuf[40];  /* ** date of creation */ timlen = 0; status = sys$asctim(&timlen,& DSCA1(timbuf),' &f->credate[0], 0); if (status != SS$_NORMAL)* strcpy(_short_date,"??-???-?? "); elseF sprintf(_short_date,"%.7s%c%c ",timbuf,timbuf[9],timbuf[10]); return(_short_date);} long_date(f) FILER *f;{ static char _long_date[25]; int timlen, status; char timbuf[40];  /* ** date of creation */ timlen = 0; status = sys$asctim(&timlen,& DSCA1(timbuf),' &f->credate[0], 0); if (status != SS$_NORMAL)1 strcpy(_long_date,"??-???-???? ??:?? "); else- sprintf(_long_date,"%.17s ",timbuf); return(_long_date);} protection(f) FILER *f;{ static char _protection[30]; int i; strcpy(_protection,"("); for (i = 0; i < 4; i++)) if ((f->fpro & word_bit[i]) == 0)6 sprintf(_S(_protection),"%c",prot_bit[i]); strcat(_protection,","); for (; i < 8; i++)) if ((f->fpro & word_bit[i]) == 0)6 sprintf(_S(_protection),"%c",prot_bit[i]); strcat(_protection,","); for (; i < 12; i++)) if ((f->fpro & word_bit[i]) == 0)6 sprintf(_S(_protection),"%c",prot_bit[i]); strcat(_protection,","); for (; i < 16; i++)) if ((f->fpro & word_bit[i]) == 0)6 sprintf(_S(_protection),"%c",prot_bit[i]);  strcat(_protection,")");& extend(_protection,MAX_PROT_SIZE); return(_protection);} owner_name(f) FILER *f;{ static _owner_name[30]; char nambuf[30]; short namlen; int status; namlen = 0; status = sys$idtoasc(f->uic,! &namlen,. DSCA1(nambuf),0,0,0); if (status == SS$_NORMAL) { nambuf[namlen] = 0;- sprintf(_owner_name,"[%s] ",nambuf); }$ else if (status == SS$_NOSUCHID) {) strcpy(_owner_name,owner_uic(f)); } else {& strcpy(_owner_name,"[???] "); }. if (strlen(_owner_name) < max_owner_width), extend(_owner_name,max_owner_width); else. max_owner_width = strlen(_owner_name); return(_owner_name);} owner_uic(f) FILER *f;{ static char _owner_uic[30];6 sprintf(_owner_uic,"[%05o,%05o] ",f->grp,f->mbm); return(_owner_uic);} file_fid(f) FILER *f;{ static char _file_fid[30];B sprintf(_file_fid,"(%d,%d,%d)",f->fid[0],f->fid[1],f->fid[2]);# extend(_file_fid,MIN_FID_SIZE); return(_file_fid);}prot_to_string(prot,string)unsigned short prot; char *string;{ int i; strcpy(string,"(S:"); for (i = 0; i < 4; i++)& if ((prot & word_bit[i]) == 0)1 sprintf(_S(string),"%c",prot_bit[i]); strcat(string,",O:"); for (; i < 8; i++)& if ((prot & word_bit[i]) == 0)1 sprintf(_S(string),"%c",prot_bit[i]); strcat(string,",G:"); for (; i < 12; i++)& if ((prot & word_bit[i]) == 0)1 sprintf(_S(string),"%c",prot_bit[i]); strcat(string,",W:"); for (; i < 16;4İ" SWING_SRC.BCK3-%[MATS.PROG.SWING.C_SWING]SWING_28.C;1P i++)& if ((prot & word_bit[i]) == 0)1 sprintf(_S(string),"%c",prot_bit[i]);  strcat(string,")");}%*[MATS.PROG.SWING.C_SWING]SWING_29.C;2+, ./(< 4\ --0123KPWO56 fm07%Y089G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:08.774** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_29.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*#** swing_29 send a file to a queue*/#include ssdef#include stdio#include smgdef#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"#include "sjcdef.h"/*4** The local (Rutgers) fixes to suit the local setup*/#if defined(LOCALFIX)#include "localfix.h"#endifsndjbc_files(option,dir) int option; char *dir;{ /*8 ** option can be either PRINT_FILES or SUBMIT_FILES ** dir is current directory */ FILER *temp; int status,length; long iosb[2]; int notify_user; char new_queue[SPEC_SIZE+1];#if defined(LOCALFIX)! char bin_number[SPEC_SIZE+1]; char new_bin[SPEC_SIZE+1];#endif struct itemlist { short buffer_length; short item_code; char *buffer_address;# int *return_length_address; short buffer_length_1; short item_code_1; char *buffer_address_1;% int *return_length_address_1; short buffer_length_2; short item_code_2; char *buffer_address_2;% int *return_length_address_2; short buffer_length_3; short item_code_3; char *buffer_address_3;% int *return_length_address_3; short buffer_length_4; short item_code_4; char *buffer_address_4;% int *return_length_address_4;#if defined(LOCALFIX) short buffer_length_5; short item_code_5; char *buffer_address_5;% int *return_length_address_5;#endif int terminator; } itmlst;  if (!files_selected) {% message("No files selected"); return(TRUE); } else  {" if (option == PRINT_FILES) {$ if (files_selected == 1)@ sprintf(junk,"Print the selected file Y/N [N]"); elseS sprintf(junk,"Print the %d selected files Y/N [N]",files_selected); } else {$ if (files_selected == 1)I sprintf(junk,"Submit/Noprint the selected file Y/N [N]"); else\ sprintf(junk,"Submit/Noprint the %d selected files Y/N [N]",files_selected); }$ if (!confirm_user(junk,"Y")) return(TRUE); } /*P ** we'll only set up the default queue name first time around - there after, ** we'll remember what the user selects */ if (option == PRINT_FILES) { if (!print_queue[0]) {, strcpy(print_queue,"SYS$PRINT"); } } else { if (!batch_queue[0]) {, strcpy(batch_queue,"SYS$BATCH"); } } if (option == PRINT_FILES) {#if defined (LOCALFIX); sprintf(junk,"%s",sys_getenv(PRINTQUE_LOGNM)!=NULL ? 2 sys_getenv(PRINTQUE_LOGNM) : PRINTQUE_DEF); strcpy(print_queue,junk);5 sprintf(junk,"%s",sys_getenv(BIN_LOGNM)!=NULL ?/ sys_getenv(BIN_LOGNM) : BIN_NUMBER_DEF);! strcpy (bin_number, junk );O sprintf(junk,"Print with print/que=%s/note=%s ?",print_queue,bin_number);" if (!confirm_user(junk,"Y")) {#endif9 sprintf(junk,"Printer Queue [%s] ?",print_queue);6 if (!get_user_input(junk,new_queue,SPEC_SIZE))* strcpy(new_queue,print_queue); else* strcpy(print_queue,new_queue);#if defined (LOCALFIX). sprintf(junk,"Bin-number [%s] ?",bin_number);- if (!get_user_input(junk,new_bin,SPEC_SIZE)) strcpy(new_bin,bin_number); else strcpy(bin_number,new_bin); } else { strcpy(new_bin,bin_number); strcpy(new_queue,print_queue); }#endif } else {7 sprintf(junk,"Batch Queue [%s] ?",batch_queue);6 if (!get_user_input(junk,new_queue,SPEC_SIZE))* strcpy(new_queue,batch_queue); else* strcpy(batch_queue,new_queue); }A if (confirm_user("Notify user when completed Y/N [N] ?","Y")) notify_user = TRUE; else notify_user = FALSE; temp = first_file_ptr; please_wait(); while(temp) { if (temp->rendition) { /*9 ** o.k. - print this file to queue new_queue */: itmlst.buffer_length = strlen(temp->filename);7 itmlst.item_code = SJC$_FILE_SPECIFICATION;3 itmlst.buffer_address = temp->filename;3 itmlst.return_length_address = &length;7 itmlst.buffer_length_1 = strlen(new_queue);, itmlst.item_code_1 = SJC$_QUEUE;0 itmlst.buffer_address_1 = new_queue;5 itmlst.return_length_address_1 = &length; /*5 ** make sure we get no log file spooling */' itmlst.buffer_length_2 = 0;3 itmlst.item_code_2 = SJC$_NO_LOG_SPOOL;( itmlst.buffer_address_2 = 0;5 itmlst.return_length_address_2 = &length;' itmlst.buffer_length_3 = 0; if (notify_user)1 itmlst.item_code_3 = SJC$_NOTIFY; else4 itmlst.item_code_3 = SJC$_NO_NOTIFY;( itmlst.buffer_address_3 = 0;5 itmlst.return_length_address_3 = &length;1 itmlst.buffer_length_4 = strlen(dir); if (SUBMIT_FILES)< itmlst.item_code_4 = SJC$_LOG_SPECIFICATION; else? itmlst.item_code_4 = SJC$_NO_LOG_SPECIFICATION;* itmlst.buffer_address_4 = dir;5 itmlst.return_length_address_4 = &length;#if defined (LOCALFIX)5 itmlst.buffer_length_5 = strlen(new_bin);& if (option == PRINT_FILES)/ itmlst.item_code_5 = SJC$_NOTE; else? itmlst.item_code_5 = SJC$_NO_LOG_SPECIFICATION;. itmlst.buffer_address_5 = new_bin;5 itmlst.return_length_address_5 = &length;#endif" itmlst.terminator = 0;# status = sys$sndjbcw(0,1 SJC$_ENTER_FILE,# 0,7 &itmlst.buffer_length,/ 5T" SWING_SRC.BCK -%[MATS.PROG.SWING.C_SWING]SWING_29.C;2\ &iosb[0],0,0);I if (status != SS$_NORMAL || (iosb[0] & 0xffff) != SS$_NORMAL) {) if (status == SS$_NORMAL)% status = iosb[0];1 sprintf(junk,"%s - %s - aborted",B error_text(status),temp->filename,status); message(junk); return(TRUE); } else {* if (option == PRINT_FILES)S sprintf(junk,"%s has been queued for printing",temp->filename); elseI sprintf(junk,"%s has been submitted",temp->filename); message(junk); } } temp = temp->forw_ptr; } return(TRUE);}$*[MATS.PROG.SWING.C_SWING]SWING_3.C;1+,3./(< 4K --0123KPWO56`B 7 iג8ࠜk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:15.474** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**!** File : SWING_3.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /* ** swing_3*/#include stdio#include smgdef#include ssdef #include time#include "more_descrip.h"#include "swing.h"#include "swing_refs.h"#define SIZEOF_TIME 12.static char old_sub_title[SCREEN_WIDTH*2 + 1];*static char old_clock_time[SIZEOF_TIME+1];static int old_effect = -1;<static char *month[] = {"Jan","Feb","Mar","Apr","May","Jun",= "Jul","Aug","Sep","Oct","Nov","Dec"};"static int big_message_on = FALSE;&static int big_message_inited = FALSE;static int display_bm;#define BIG_MESSAGE_ROWS 5#define BIG_MESSAGE_COLUMNS 66#define BIG_MESSAGE_X 85#define BIG_MESSAGE_Y (page_length-BIG_MESSAGE_ROWS)redo_display(option) int option;{+ int scroll_heave_up, scroll_heave_down; if (option) {2 scroll_heave_up = (3 * DISPLAY1_ROWS) / 4;. scroll_heave_down = DISPLAY1_ROWS / 4; } else) scroll_heave_up = scroll_heave_down = 0; /*H ** make sure that we are now displaying current_line current_level  ** on the screen somewhere */. if (( current_line >= current_top_line && = current_line < current_top_line + DISPLAY1_ROWS) ||( total_lines <= DISPLAY1_ROWS ) { /*, ** we don't need to do anything here */ return(TRUE); }< if (current_line > current_top_line + DISPLAY1_ROWS - 1) {I while( (current_line > (current_top_line + scroll_heave_down)) &&A ((current_top_line + DISPLAY1_ROWS) < total_lines)) { current_top_line++; } refresh_display(); return(TRUE); }( if (current_line < current_top_line) {H while (( current_line < (current_top_line + scroll_heave_up)) &&! current_top_line) { current_top_line--; } refresh_display(); return(TRUE); }}big_message_init(){ int rows, columns, i; if (big_message_inited) return(TRUE); big_message_inited = TRUE; rows = BIG_MESSAGE_ROWS;" columns = BIG_MESSAGE_COLUMNS;) i = smg$create_virtual_display(&rows,, &columns,/ &display_bm,2 &SMG$M_BORDER); if (i != SS$_NORMAL)F panic(i,"create virtual display displayf","big message init");}big_display_on(){ int y; y = BIG_MESSAGE_Y; big_message_init();# smg$erase_display(&display_bm); if (!big_message_on). smg$paste_virtual_display(&display_bm,) &paste,% &y,2 &BIG_MESSAGE_X);( smg$end_display_update(&display_bm); big_message_on = TRUE;}big_display_off(){ if (big_display_on) { big_message_on = FALSE;0 smg$unpaste_virtual_display(&display_bm,, &paste); }} message(text) char *text;{ if (text[0]) { message_set = TRUE;( if (strlen(text) > SCREEN_WIDTH) { /*K ** message too big for the bottom line, so we'll use a special ** display */ big_display_on(); /*< ** make sure no bottom line message still there */) smg$erase_display(&displayb); /*6 ** now send the output to the big display */+ smg$set_cursor_abs(&display_bm," &1,# &1);% smg$put_line(&display_bm,$ DSC1(text), 0, 0, 0,+ &SMG$M_WRAP_WORD); rest_cursor(); } else { /*. ** put message on the bottom line */ big_display_off();0 smg$begin_display_update(&displayb);0 smg$set_cursor_abs(&displayb,&1,&1);/ smg$put_line(&displayb,DSC1(text)); rest_cursor();. smg$end_display_update(&displayb); } } else { /*1 ** no text, so clear the message display */ message_set = FALSE;% smg$erase_display(&displayb); big_display_off(); }} title(text) char *text;{ /*< ** display a title on the first line of window displayt */( smg$set_cursor_abs(&displayt,&1,&1);' smg$put_line(&displayt,DSC1(text));}sub_title_normal(text) char *text;{ /* ** no special effects */ put_sub_title(text,0);}sub_title_underline(text) char *text;{ /* ** no special effects */( put_sub_title(text,SMG$M_UNDERLINE);}update_clock(){ /* ** force a new clock time */, put_sub_title(old_sub_title,old_effect);}put_sub_title(text,effect) char *text; int effect;{ /*A ** display a sub_title on the second line of window displayt **2 ** to save time we'll check what's on display */ char line[SCREEN_WIDTH+1];# char clock_time[SIZEOF_TIME+1]; char me[41]; int i; get_time(clock_time);B if (strcmp(text,old_sub_title) == 0 && old_effect == effect &&/ strcmp(clock_time,old_clock_time) == 0) return(TRUE); else {* strcpy(old_clock_time,clock_time); old_effect = effect;# strcpy(old_sub_title,text); strcpy(me,this_user); }6Wb" SWING_SRC.BCK3-$[MATS.PROG.SWING.C_SWING]SWING_3.C;1KF+ sprintf(line,"%.*s",SCREEN_WIDTH,text);1 for (i = strlen(line); i < SCREEN_WIDTH; i++) line[i] = ' '; line[SCREEN_WIDTH] = 0; /*7 ** look see if we've room for the user on the left */( for (i = 0; i < strlen(me) + 2; i++) { if (line[i] != ' ') goto no_me; } /* ** tack me in */$ for (i = 0; i < strlen(me); i++) { line[i] = me[i]; } no_me:; /*4 ** if the last SIZEOF_TIME+1 chars are spaces, C ** we'll super-impose the time over the last SIZEOF_TIME chars */! if (strncmp(" ",4 &line[SCREEN_WIDTH-(SIZEOF_TIME+1)],& (SIZEOF_TIME+1)) == 0); strcpy(&line[SCREEN_WIDTH-SIZEOF_TIME],clock_time);( smg$begin_pasteboard_update(&paste);( smg$set_cursor_abs(&displayt,&2,&1);2 smg$put_line(&displayt,DSC1(line),&0,&effect);& smg$end_pasteboard_update(&paste);}get_time(the_time)char *the_time;{ int secs; struct tm *tt; secs = time(0); tt = localtime(&secs);+ sprintf(the_time,"%02d %.3s %02d:%02d", tt->tm_mday, month[tt->tm_mon], tt->tm_hour,  tt->tm_min); }%*[MATS.PROG.SWING.C_SWING]SWING_30.C;2+,3./(< 4P@--0123KPWO56 Z$7ג8忂k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:21.074** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_30.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /* 1** swing_30 file manager cursor bashing routines*/#include ssdef#include stdio#include smgdef#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"clear_cursor(){ int status; if (cursor_line < 0) return(TRUE);A status = smg$put_chars(&displayf,DSC1(" "),&cursor_line,&1); if (status != SS$_NORMAL)+ panic(status,"put_chars 1","clear curor");}set_cursor(line) int line;{ int status; cursor_line = line;= status = smg$put_chars(&displayf,DSC1("->"),&cursor_line,1 &1,0,&CURSOR_RENDITION); if (status != SS$_NORMAL)* panic(status,"put_chars 1","set cursor");}*put_top_files(count,top_line,display_type) int count; int top_line;int display_type;{ FILER *temp; int i,status,display_lines;% if (display_type == FILE_MANAGER)' display_lines = DISPLAYF_FILES; else& display_lines = DISPLAYF_ROWS;. temp = current_file_ptr(top_line+count-1); for (i = 0; i < count; i++) {3 status = smg$scroll_display_area(&displayf,/ &1,&4,8 &display_lines,9 &(SCROLL_WIDTH),6 &SMG$M_DOWN);! if (status != SS$_NORMAL)? panic(status,"scroll display area","put file top");- put_scroll_line(1,temp,display_type); temp = temp->back_ptr; }}-put_bottom_files(count,top_line,display_type) int count; int top_line;int display_type;{ FILER *temp; int i,status,display_lines;% if (display_type == FILE_MANAGER)' display_lines = DISPLAYF_FILES; else& display_lines = DISPLAYF_ROWS;> temp = current_file_ptr(top_line + display_lines - count); for (i = 0; i < count; i++) {3 status = smg$scroll_display_area(&displayf,/ &1,&4,8 &display_lines,9 &(SCROLL_WIDTH),4 &SMG$M_UP);! if (status != SS$_NORMAL)B panic(status,"scroll display area","put file bottom");9 put_scroll_line(display_lines,temp,display_type); temp = temp->forw_ptr; }} show_files(changed,display_type) int changed;int display_type;{" int i, d_line, length, status; int display_lines;% if (display_type == FILE_MANAGER)' display_lines = DISPLAYF_FILES; else& display_lines = DISPLAYF_ROWS;$ if (curr_file_no >= total_files)) curr_file_no = (total_files - 1); if (curr_file_no < 0) curr_file_no = 0;6 if (curr_top_file > (total_files - display_lines))4 curr_top_file = total_files - display_lines; if (curr_top_file < 0) curr_top_file = 0;# smg$set_cursor_mode(&paste,&1);( smg$begin_display_update(&displayf); clear_cursor();% if (curr_file_no < curr_top_file) { i = 0;P while(curr_file_no < (curr_top_file+(display_lines/2)) && curr_top_file) { i++; curr_top_file--; } if (i || changed) {0 if (i > MAX_FILES_SCROLL || changed) refresh_files(display_type); else9 put_top_files(i,curr_top_file,display_type); } }; else if (curr_file_no >= (curr_top_file+display_lines)) { i = 0;; while(curr_file_no >= (curr_top_file+(display_lines/2)) &&3 curr_top_file < (total_files-display_lines)) { i++; curr_top_file++; } if (i || changed) {0 if (i > MAX_FILES_SCROLL || changed) refresh_files(display_type); else< put_bottom_files(i,curr_top_file,display_type); } } else if (changed)$ refresh_files(display_type);- set_cursor(curr_file_no-curr_top_file+1); i = display_lines + 1;9 smg$draw_line(&displayf,&1,&LEFTF_COL,&i,&LEFTF_COL);% if (display_type == FILE_MANAGER) {$ d_line = DISPLAYF_FILES + 1;F smg$draw_line(&displayf,&d_line,&1,&d_line,&DISPLAYF_COLUMNS);  d_line++;1 smg$set_cursor_abs(&displayf,&d_line,&2);? sprintf(junk,"current file no %-5.5d ",curr_file_no+1);G sprintf(&junk[strlen(junk)],"total files %-5.5d ",total_files);L sprintf(&junk[strlen(junk)],"files selected %-5.5d",files_selected);A sprintf(&junk[strlen(junk)],"display format %d",fm_type);0 smg$put_line(&displayf,DSC1(junk),&1,0); }& smg$end_display_update(&displayf);# smg$set_cursor_mode(&paste,&0);}refresh_files(display_type)int display_type;{ int i, status; int line, display_lines;% if (display_type == FILE_MANAGER)' display_lines = DISPLAYF_FILES; else& display_lines = DISPLAYF_ROWS;4 curr_file_ptr = current_file_ptr(curr_top_file);( smg$set_cursor_abs(&displayf,&1,&1);A for (i = curr_top_file; i < curr_top_file + display_lines && 1 i < total_files; i++) {77mx 2)#! cyt9 2D[ >_UCY=x ({jOjt]#&F O`L|2H*" 3EJE2+Mf ,4s$QJ TmD rEs`h58:A (Mo[x=Jh H;\O|,?vsnL0e:>sCZA..{IU[<p,0"&O}JUSXk!^Aq\ gJLBb`o P.COL XgQƚqMw6Gt ׀}:BGwEs"/_+^7#.fL >X Q&'$|;a V|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ptr; } /*F ** clear out rest of the display lines which had filenames on 'em */1 for (;i < curr_top_file + display_lines; i++) {% line = i - curr_top_file + 1;< sprintf(junk,"%-*.*s",SCROLL_WIDTH,SCROLL_WIDTH,"");7 status = smg$put_chars(&displayf,DSC1(junk),&line,&4);! if (status != SS$_NORMAL)6 panic(status,"put chars","refresh files"); }}%*[MATS.PROG.SWING.C_SWING]SWING_31.C;1+,3.0/(< 4P0+n--0123KPWO156{|7Lג8@9k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:28.364** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_31.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /* ** swing_31 file manager*/#include iodef#include ssdef#include stdio#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"#include "fatdef.h"#include "fm2def.h"#include "fh2def.h"#include "strdef.h"#include fchdef#include atrdef#include fibdef#define FILES_INFO_SIZE 100/*** acb elements*/unsigned long uchar;char credate[ATR$S_CREDATE+1]; long uic; short fpro;%unsigned char header[ATR$S_HEADER+1];/*** record attribute block*/FAT fat;/*!** acb descriptor for io$_access*/ACB acb[] = { /*6 ** file characteristics (directory ??) */7 ATR$S_UCHAR, ATR$C_UCHAR, &uchar, /* ** creation date */5 ATR$S_CREDATE, ATR$C_CREDATE, credate, /* ** protection */- ATR$S_FPRO, ATR$C_FPRO, &fpro, /* ** file owner */9 ATR$S_UIC, ATR$C_UIC, &uic,  /*$ ** record attributes */2 ATR$S_RECATTR, ATR$C_RECATTR, &fat, /*7 ** file header for map area information */6 ATR$S_HEADER, ATR$C_HEADER, &header[0], /*% ** terminate the list */4 0, 0, 0};/*** acb descriptor for uchar*/ACB acb_uchar[] = { /*6 ** file characteristics (directory ??) */7 ATR$S_UCHAR, ATR$C_UCHAR, &uchar, /*% ** terminate the list */4 0, 0, 0};/*** just the header*/ACB acb_hdr[] = { /*7 ** file header for map area information */6 ATR$S_HEADER, ATR$C_HEADER, &header[0], /*% ** terminate the list */4 0, 0, 0};/*0** a blank fib used for initialising other fibs*/struct fibdef blank_fib, fib;get_dir_files(n, file_type)NODE *n;int file_type;{ int status, str_status; int i, blocks, b, j; int name; unsigned short *buffer; unsigned short version; unsigned short fid[3]; short count; short vers; short len; char new_file[SPEC_SIZE+1]; char tmp[NAME_SIZE+1]; /* ** max_owner_width = 0 */ max_owner_width = 0;) buffer = read_a_directory(n,&blocks); if (buffer == 0) return(FALSE); /*3 ** work out the partial match string we'll use */ strcpy(tmp,n->dir_spec); strcat(tmp,";*"); /*! ** now process the directory */ for (b = 0; b < blocks; b++) { /* ** block at a time */, for (i = b * 256; i < (b+1) * 256; ) { /* ** pull out records */$ if (buffer[i] == 0xffff) { /*. ** end of data for this block */ break; }  else { /*" ** we've a record */" count = buffer[i];' len = buffer[i+2] >> 8; name = i+3; if (len % 2) {/ vers = (count - 5 - len)/8;% i += (4 + len/2); } else {/ vers = (count - 4 - len)/8;% i += (3 + len/2); } * for (j = 0; j < vers; j++) {( version = buffer[i];) fid[0] = buffer[i+1];) fid[1] = buffer[i+2];) fid[2] = buffer[i+3];  /*3 ** advance ready for next info */ i += 4;% sprintf(new_file,& "%.*s;%d", len,* &buffer[name],% version); /*N ** if we're looking for non-directories and this is not aP ** directory or we're looking for directories and this is aG ** directory we're in and we match the search spec */0 if (file_type == SHOW_FILES)C str_status = str$match_wild(DSC1(new_file),? DSC2(tmp));; if (file_type == SHOW_FILES_AND_DIRS || (file_type == SHOW_FILES && 5 str_status == STR$_MATCH && 8 !check_if_dir(new_file,fid)) ||4 (file_type == SHOW_DIRS && 5 check_if_dir(new_file,fid))) { /*/ ** one more file found */, grab_file(new_file);; curr_file_ptr->info_lookup = FALSE;7 curr_file_ptr->fid[0] = fid[0];7 curr_file_ptr->fid[1] = fid[1];7 curr_file_ptr->fid[2] = fid[2]; = if (!(total_files % FILES_INFO_SIZE))6 9" SWING_SRC.BCK3-%[MATS.PROG.SWING.C_SWING]SWING_31.C;1P0L  files_so_far(total_files); } } } } }  /*$ ** free up out directory buffer */ free(buffer);  /*5 ** if we've said how many files there are we'll 8 ** make sure we leave the right count on the screen */& if (total_files > FILES_INFO_SIZE)" files_so_far(total_files);}check_if_dir(filename,fid)char *filename;unsigned short fid[3];{! int index, sub_index, status; int iosb[2];% struct dsc$descriptor_s fib_desc; /*< ** do the simple test first - assume all dirs end .DIR; */5 status = str$find_first_substring(DSC1(filename),- &index,1 &sub_index,5 DSC2(".DIR;")); if (status == SS$_NORMAL) { /*I ** we'll have to get the uchar to see if it's really a directory */ fib = blank_fib; . fib_desc.dsc$w_length = FIB$C_LENGTH;& fib_desc.dsc$a_pointer = &fib;/ fib_desc.dsc$b_class = DSC$K_CLASS_S;/ fib_desc.dsc$b_dtype = DSC$K_DTYPE_T; 4 fib.fib$r_fid_overlay.fib$w_fid[0] = fid[0];4 fib.fib$r_fid_overlay.fib$w_fid[1] = fid[1];4 fib.fib$r_fid_overlay.fib$w_fid[2] = fid[2]; status = sys$qiow(0,& dir_channel,% IO$_ACCESS,# &iosb[0], 0, 0,$ &fib_desc, 0, 0, 0,$ acb_uchar, 0);! if (status != SS$_NORMAL) status = iosb[0]; /*B ** if there is an error we'll ignore it and not stop the  ** processing */! if (status != SS$_NORMAL) return(FALSE); /* ** yeah, directory */$ if (uchar & FCH$M_DIRECTORY) return(TRUE); } return(FALSE);}get_dir_info(f) FILER *f;{ int status, i; int iosb[2];% struct dsc$descriptor_s fib_desc; /* ** get the header info */ fib = blank_fib; * fib_desc.dsc$w_length = FIB$C_LENGTH;" fib_desc.dsc$a_pointer = &fib;+ fib_desc.dsc$b_class = DSC$K_CLASS_S;+ fib_desc.dsc$b_dtype = DSC$K_DTYPE_T; 3 fib.fib$r_fid_overlay.fib$w_fid[0] = f->fid[0];3 fib.fib$r_fid_overlay.fib$w_fid[1] = f->fid[1];3 fib.fib$r_fid_overlay.fib$w_fid[2] = f->fid[2]; status = sys$qiow(0," dir_channel,! IO$_ACCESS, &iosb[0], 0, 0, &fib_desc, 0, 0, 0, acb, 0); if (status != SS$_NORMAL) { f->info_lookup = status; return(FALSE); } if (iosb[0] != SS$_NORMAL) {! f->info_lookup = iosb[0]; return(FALSE); } f->info_lookup = SS$_NORMAL; /* ** we got directory info */ /* ** allocation */9 f->allocation = (fat.fat$w_hiblk[1] & 0x0000ffff) + > ((fat.fat$w_hiblk[0] << 16) & 0xffff0000); /* ** size - > ** if file is sequential we'll work out the size from eof) ** and first free byte in eof block,. ** otherwise we use highest allocated VBN */@ if ((fat.fat$b_rtype >> FAT$V_FILEORG) == FAT$C_SEQUENTIAL) { /*4 ** get eof block and ffbyte. if ffbyte == 0+ ** then we've used eof blocks - 1; */6 f->size = (fat.fat$w_efblk[1] & 0x0000ffff) +< ((fat.fat$w_efblk[0] << 16) & 0xffff0000);" if (fat.fat$w_ffbyte == 0) { f->size--; } } else { f->size = f->allocation; }  /*< ** do the placement control, count of headers, count of- ** file fragments, placement information */ map_area(f); /*" ** owner, calculated from uic */ f->grp = (short)(uic >> 16); f->mbm = (short)uic; f->uic = uic; for (i = 0; i < 8; i++)# f->credate[i] = credate[i]; f->fpro = fpro; /* ** file_organisation */ 5 f->file_org = (fat.fat$b_rtype >> FAT$V_FILEORG); f->uchar = uchar;! f->defext = fat.fat$w_defext; f->gbc = fat.fat$w_gbc; f->bkt = fat.fat$b_bktsize;% f->versions = fat.fat$w_versions; /* ** record type */) f->rec_type = fat.fat$b_rtype & 0x0f; f->rsize = fat.fat$w_rsize;! f->maxrec = fat.fat$w_maxrec; /* ** record attributes */$ f->rec_attr = fat.fat$b_rattrib;} map_area(f) FILER *f;{ unsigned short *w, p; int start, in_use; int i, status; int file_accessed; unsigned short iosb[4]; unsigned short first_fid[3]; unsigned short fid[3];% struct dsc$descriptor_s fib_desc;" f->headers = f->fragments = 0; f->placement = 0; first_fid[0] = f->fid[0]; first_fid[1] = f->fid[1]; first_fid[2] = f->fid[2]; file_accessed = 0; /*6 ** if there are any extension headers we'll do a , ** IO$_ACCESS | IO$M_ACCESS on the file */= if (header[FH2$W_EX_FIDNUM] || header[FH2$W_EX_FIDNUM+1]) { /*? ** access this file so that we can read in the headers */ fib = blank_fib;. fib_desc.dsc$w_length = FIB$C_LENGTH;& fib_desc.dsc$a_pointer = &fib;/ fib_desc.dsc$b_class = DSC$K_CLASS_S;/ fib_desc.dsc$b_dtype = DSC$K_DTYPE_T;: fib.fib$r_fid_overlay.fib$w_fid[0] = first_fid[0];: fib.fib$r_fid_overlay.fib$w_fid[1] = first_fid[1];: fib.fib$r_fid_overlay.fib$w_fid[2] = first_fid[2]; status = sys$qiow(0,& dir_channel,3 IO$_ACCESS | IO$M_ACCESS,# &iosb[0], 0, 0,$ &fib_desc, 0, 0, 0, 0, 0);! if (status != SS$_NORMAL) {- warning(full_error_text(status)); return(FALSE); }" if (iosb[0] != SS$_NORMAL) {. warning(full_error_text(iosb[0])); return(FALSE); }  file_accessed = TRUE; } /*% ** make sure we're an ODS-2 disk */& while(header[FH2$B_STRUCLEV] == 2) { f->headers++; 9 start = (unsigned int)header[FH2$B_MPOFFSET] * 2;; in_use = (unsigned int)header[FH2$B_MAP_INUSE] * 2; - for (i = start; i < start + in_use; ) { /* ** point in words */- w = (unsigned short *)&header[i];% p = w[0] >> FM2$V_FORMAT;  switch(p) { case FM2$C_PLACEMENT:! f->placement = p;# i += FM2$C_LENGTH0; break;  case FM2$C_FORMAT1:# i += FM2$C_LENGTH1; f->fragments++; break;  case FM2$C_FORMAT2:# i += FM2$C_LENGTH2; f->fragments++; break;  case FM2$C_FORMAT3:$ i += FM2$C_LENGTH3; f->fragments++; break; default: /*; ** pointers have gone wrong - abandon ship */ i += in_us:0" SWING_SRC.BCK3-%[MATS.PROG.SWING.C_SWING]SWING_31.C;1P0e; break; } } /*C ** now we must look to see if there is another file header */% w = &header[FH2$W_EX_FIDNUM]; fid[0] = w[0];% w = &header[FH2$W_EX_FIDSEQ]; fid[1] = w[0];% w = &header[FH2$W_EX_FIDRVN]; fid[2] = w[0]; if (fid[0]) { /*8 ** there is, so now we get the header again, ** use the continuation file id */2 fib_desc.dsc$w_length = FIB$C_LENGTH;* fib_desc.dsc$a_pointer = &fib;3 fib_desc.dsc$b_class = DSC$K_CLASS_S;3 fib_desc.dsc$b_dtype = DSC$K_DTYPE_T; fib = blank_fib;8 fib.fib$r_fid_overlay.fib$w_fid[0] = fid[0];8 fib.fib$r_fid_overlay.fib$w_fid[1] = fid[1];8 fib.fib$r_fid_overlay.fib$w_fid[2] = fid[2]; status = sys$qiow(0,* dir_channel,) IO$_ACCESS,' &iosb[0], 0, 0,( &fib_desc, 0, 0, 0,& acb_hdr,! 0);% if (status != SS$_NORMAL) {1 warning(full_error_text(status)); break; }& if (iosb[0] != SS$_NORMAL) {*2 warning(full_error_text(iosb[0])); break; }= } else break; }o /*1 ** if we accessed the file we'll deaccess it */ if (!file_accessed)N return(TRUE);L fib = blank_fib;* fib_desc.dsc$w_length = FIB$C_LENGTH;" fib_desc.dsc$a_pointer = &fib;+ fib_desc.dsc$b_class = DSC$K_CLASS_S;*+ fib_desc.dsc$b_dtype = DSC$K_DTYPE_T;6 fib.fib$r_fid_overlay.fib$w_fid[0] = first_fid[0];6 fib.fib$r_fid_overlay.fib$w_fid[1] = first_fid[1];6 fib.fib$r_fid_overlay.fib$w_fid[2] = first_fid[2]; status = sys$qiow(0," dir_channel,# IO$_DEACCESS,* &iosb[0],* 0, 0, &fib_desc, 0, 0, 0, 0, 0);f if (status != SS$_NORMAL)c {h) warning(full_error_text(status)); } # else if (iosb[0] != SS$_NORMAL)l {* warning(full_error_text(iosb[0])); }E}; read_a_directory(n,blocks)NODE *n; int *blocks;{+ int my_blocks;& int status, i, buff_size, channel; unsigned short iosb[4];c char *buffer;  struct dsc$descriptor_s fd;  char device[SPEC_SIZE+1];c d strcpy(device,n->dir_name);( for (i = 0; i < strlen(device); i++) {h if (device[i] == ':') {* device[i+1] = 0; break; }E }T channel = 0; my_blocks = 0; buffer = 0; % status = sys$assign(DSC1(device), ! &channel,, 0, 0); if (status != SS$_NORMAL)  {R) warning(full_error_text(status)); return(FALSE); }  fib = blank_fib;# fd.dsc$w_length = FIB$C_LENGTH;A fd.dsc$a_pointer = &fib;# fd.dsc$b_class = DSC$K_CLASS_S; # fd.dsc$b_dtype = DSC$K_DTYPE_T;o3 fib.fib$r_fid_overlay.fib$w_fid[0] = n->fid[0];E3 fib.fib$r_fid_overlay.fib$w_fid[1] = n->fid[1]; 3 fib.fib$r_fid_overlay.fib$w_fid[2] = n->fid[2];* status = sys$qiow(0, channel,/ IO$_ACCESS | IO$M_ACCESS,a &iosb[0],  0, 0, &fd, 0, 0, 0, acb, 0); if (status != SS$_NORMAL)  { ) warning(full_error_text(status));/ }c# else if (iosb[0] != SS$_NORMAL)  { * warning(full_error_text(iosb[0])); }  else { /* ** size - AB ** if file is sequential we'll work out the size from eof- ** and first free byte in eof block,02 ** otherwise we use highest allocated VBN */D if ((fat.fat$b_rtype >> FAT$V_FILEORG) == FAT$C_SEQUENTIAL) {e /*8 ** get eof block and ffbyte. if ffbyte == 0/ ** then we've used eof blocks - 1;  */, my_blocks = fat.fat$w_efblk[1] +< (fat.fat$w_efblk[0] << 16); & if (fat.fat$w_ffbyte == 0) {M my_blocks--; } }/ else {; /* ** allocation */H my_blocks = fat.fat$w_hiblk[1] + (fat.fat$w_hiblk[0] << 16); }e$ buff_size = my_blocks * 512;# buffer = malloc(buff_size);  status = sys$qiow(0," channel,8 IO$_READVBLK | IO$M_DATACHECK,# &iosb[0],b 0, 0,! buffer, $ buff_size, 1, 0, 0, 0); ! if (status != SS$_NORMAL) {e- warning(full_error_text(status)); }e' else if (iosb[0] != SS$_NORMAL) {n. warning(full_error_text(iosb[0])); }   status = sys$qiow(0, ! channel, & IO$_DEACCESS," &iosb[0], 0,  0,e &fd,  0,  0,  0,  0,  0); if (status != SS$_NORMAL) {, warning(full_error_text(status)); } ]& else if (iosb[0] != SS$_NORMAL) {- warning(full_error_text(iosb[0])); } } ! status = sys$dassgn(channel);  if (status != SS$_NORMAL)  { ) warning(full_error_text(status));  }  *blocks = my_blocks; return(buffer); } %*[MATS.PROG.SWING.C_SWING]SWING_32.C;1+,3./(< 4?--0123KPWO56RҐ7ג8yk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:34.764** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_32.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change Hi;m/" SWING_SRC.BCK3-%[MATS.PROG.SWING.C_SWING]SWING_32.C;1?nstory** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*0** swing_32.c - return checksum for a directory*/#include stdio#include ssdef#include stdio#include "more_descrip.h"#include "swing.h"#include "swing_refs.h"get_checksum(n)NODE *n;{ char file[SPEC_SIZE+1];% long status, i, to_check, blocks; unsigned long *buffer; unsigned long checksum;) buffer = read_a_directory(n,&blocks); if (!buffer) return(FALSE); to_check = blocks * 128; checksum = 0;" for (i = 0; i < to_check; i++) { /* ** add this character */* checksum = (checksum ^ buffer[i]); } free(buffer); return(checksum);}%*[MATS.PROG.SWING.C_SWING]SWING_33.C;1+,%4*.B/(< 4\B=--0123KPWOC56jӐ7"ג8`k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:57.324** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_33.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** defragment directory*/#include iodef#include ssdef#include stdio#include smgdef#include smgmsg#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"#include "strdef.h"#include fibdef#include atrdef##define LF_ROWS (page_length - 12)#define LF_ROWS_MAX 25#define LF_COLUMNS 78#define LF_X 2#define LF_Y 11#define BLOCK_SIZE 512#define BUFFER_BLOCKS 256#define BUFFER_SIZE 131072static struct fibdef blank_fib;2static int log_file_window_inited, log_file_is_on;static int disp_log_file;static int def_good, def_bad;static int log_file_screen;/*G** used when initially open file being optimised and when closing same** so as not to loose info*/unsigned long uchar;char revdate[ATR$S_REVDATE],  ascdates[ATR$S_ASCDATES];ACB df_acb[] = { /*D ** file characteristics (directory ?? contiguous ??) */8 ATR$S_UCHAR, ATR$C_UCHAR, &uchar, /*G ** original revision date - need to rewrite this at the* ** end of the optimisation */9 ATR$S_REVDATE, ATR$C_REVDATE, revdate, /*J ** revision count contained in first two bytes of ascdates *// 2, ATR$C_ASCDATES, ascdates, /*% ** terminate the list */4 0, 0, 0};/*6** entry point when called from the directory manager*/defragment_dirs(n){ int status; /*& ** show selected dirs highlighted */3 show_deleting(curr_l_ptr->n_ptr[current_level],, DELETING_RENDITION,FALSE); /*D ** check twice with the user that he wishes to defragment these ** directories */C if (confirm_user("DEFRAGMENT these directories Y/N [N] ?","Y")) {\ if (confirm_user("LAST CHANCE - Really DEFRAGMENT these directories Y/N [N] ?","Y")) {/ message("Searching for fragmented files"); /*I ** assign a channel (dir_channel) to this device as required" ** by get_dir_files() */ dir_channel = 0;1 status = sys$assign(DSC1("SYS$DISK"),- &dir_channel," 0,# 0);% if (status != SS$_NORMAL)C panic(status,"sys$asign","defragment directories");  def_good = def_bad = 0; /* ** switch on the log file */ log_file_on();" defragment_all_dirs(n,0);$ sys$dassgn(dir_channel);' if (defragmentation_over())1 message("DEFRAGMENTATION finished"); elseM message("DEFRAGMENTATION finished - no fragmented files found"); } }3 show_deleting(curr_l_ptr->n_ptr[current_level],* NORMAL_RENDITION,FALSE);9 render(current_line,current_level,SPECIAL_RENDITION);}/*C** defragment the files in node n - no file list has been build upI** if level is 0 we will not process this node's sisters, `cos we're at $** the top directory the user chose*/defragment_all_dirs(n,level)NODE *n; int level;{ int i; FILER *tmp; /*% ** get all the files in this dir */ files_selected = 0;' first_file_ptr = curr_file_ptr = 0; total_files = 0;- sprintf(junk,"Searching %s",n->dir_name); log_file(junk); get_dir_files(n,SHOW_FILES); if (total_files) { /* ** select all the files/ ** and get their directory information */ tmp = first_file_ptr; while(tmp) { tmp->rendition = TRUE; get_dir_info(tmp); tmp = tmp->forw_ptr; files_selected++; } message(""); /* ** now defragment these files */- i = defragment_a_directory(n, FALSE); /* ** free them off */ free_files(first_file_ptr); if (!i) return(FALSE); } message(""); /*! ** now child if there is one */ if (n->child)3 if (!defragment_all_dirs(n->child,level+1)) return(FALSE); /*1 ** if not the top level we'll do the sisters */ if (level && n->sister)2 if (!defragment_all_dirs(n->sister,level)) return(FALSE); return(TRUE);}/*** called from file manager**F** defragment the files in this directory - the file list has already/** been constructed and desired files selected*/defragment_directory(n)NODE *n;{ /* ** init vars */ def_good = def_bad = 0; /*C ** defragment, display message if there are no candidates for  ** defragmentation */$ defragment_a_directory(n, TRUE); /* ** we've finished */ defragmentation_over(); if (def_good) return(TRUE); else return(FALSE);}/*D** defragment a directory, files already selected. If check == TRUEC** we'll display a message if there are no files we can defragment*/defragment_a_directory(n,check)NODE *n; int check;{ int i; FILER *temp; char new_file[NAME_SIZE+1]; char from_dir[SPEC_SIZE+1]; char to_dir[SPEC_SIZE+1]; int remaining, key; /*7 ** we will not defragment files in the mfd (4,4,0) */ if (n->fid[0] == 4) {A warning("Cannot defragment files in the master file directory"); return(TRUE); } /*> ** lo<a2" SWING_SRC.BCK%4*-%[MATS.PROG.SWING.C_SWING]SWING_33.C;1\B ok to see if any fragmented files have been selected */ temp = first_file_ptr; while(1) { if (temp->rendition) {% if (temp->info_lookup == FALSE) get_dir_info(temp); if (temp->fragments > 1) goto files_selected; } if (temp->forw_ptr)" temp = temp->forw_ptr; else break; } /*? ** check for user input as we will not be processing files */% if (!check && check_user_input()) {7 log_warning("Abort DEFRAGMENTATION Y/N [N] ?"); key = get_key(NO_AUTO);+ if (key == SMG$K_TRM_UPPERCASE_Y ||) key == SMG$K_TRM_LOWERCASE_Y) return(FALSE); } if (check)0 warning("no fragmented files selected"); return(TRUE);files_selected:; /* ** note where we are */# remaining = files_selected; log_file_on(); /* ** walk down the directory */ temp = first_file_ptr; while(temp) { if (temp->rendition) { remaining--;+ if (temp->info_lookup == FALSE) get_dir_info(temp);9 if (temp->info_lookup != SS$_NORMAL && check) {A sprintf(junk,"%s not accessible",temp->filename); log_file(junk); log_file(" "); }3 else if (temp->fragments == 0 && check) {; sprintf(junk,"%s is empty",temp->filename); log_file(junk); log_file(" "); }, else if (temp->fragments == 1 && check) {D sprintf(junk,"%s is not fragmented",temp->filename); log_file(junk); log_file(" "); } }3 if (temp->rendition && temp->fragments > 1) {  /*' ** this file is fragmented */, strcpy(new_file,temp->filename); /*> ** build up files names for the security copy we'll make@ ** now strip off the version number of the new_file */6 for (i = strlen(new_file) - 1; i > 0; i--) {' if (new_file[i] == ';') {$ new_file[i] = 0; break; } } @ sprintf(from_dir,"%s%s",n->dir_name,temp->filename);: sprintf(to_dir, "%s%s",n->dir_name,new_file); /* ** log file info */3 sprintf(junk,"Processing %s",from_dir); log_file(junk);- log_file("Creating backup copy"); /*1 ** security copy, same name, higher version */' i = lib_copy_file(from_dir,% to_dir,- temp->filename,( remaining,% EXPORT,& 0xffff); if (i != SS$_NORMAL) { sprintf(junk,1 "%s - failed to copy %s",+ full_error_text(i),( temp->filename); log_warning(junk); goto next_file; } /* ** optimse the file */- if (optimise_file(temp->filename,' new_file,% n->fid,) "SYS$DISK",0 temp->allocation)) { def_good++; } else def_bad++; /*L ** check for user input - this allows the user to interrupt the' ** processing if he has cold feet */# if (check_user_input()) {1 log_warning("Abort DEFRAGMENTATION Y/N [N] ?");' key = get_key(NO_AUTO);3 if (key == SMG$K_TRM_UPPERCASE_Y ||# key == SMG$K_TRM_LOWERCASE_Y) return(FALSE); } } next_file:; /* ** point to next file */ temp = temp->forw_ptr; } /* ** normal exit */ return(TRUE);}/*H** Optimise orig_file, the copy of which is new_copy. Both files resideI** in directory with file id = (did[0], did[1], did[2]) on device device0** and both files have the sfile size file_size*/:optimise_file(orig_file, new_copy, did, device, file_size),char *orig_file; /* file we will optimise */,char *new_copy; /* new copy of this file */@unsigned short *did; /* did of the directory the files are in */:char *device; /* device on which we find the directory */int file_size;{& int success; /* did we do it ? */4 int status; /* records status of $qio calls */+ int record, i; /* scratch variables */% int channel1; /* i/o channel1 */% int channel2; /* i/o channel2 */( int new_file_accessed, /* boolean */) orig_file_accessed, /* boolean */ orig_intact, /* boolean */$ defragmented; /* boolean */0 short iosb[4]; /* status block for $qios */E struct dsc$descriptor_s fib1_desc, fib2_desc; /* two fib descs */: struct fibdef fib1, fib2; /* two fibs for the $qios */' char transfer_buffer [BUFFER_SIZE]; /* ** initial processing */ channel1 = channel2 = 0; success = FALSE; new_file_accessed = FALSE; orig_file_accessed = FALSE; defragmented = FALSE; orig_intact = TRUE; /* ** clear structures */ fib1 = blank_fib; fib2 = blank_fib; /*, ** set up FIB descriptors for the $QIOs */+ fib1_desc.dsc$w_length = FIB$C_LENGTH;$ fib1_desc.dsc$a_pointer = &fib1;, fib1_desc.dsc$b_class = DSC$K_CLASS_S;, fib1_desc.dsc$b_dtype = DSC$K_DTYPE_T;+ fib2_desc.dsc$w_length = FIB$C_LENGTH;$ fib2_desc.dsc$a_pointer = &fib2;, fib2_desc.dsc$b_class = DSC$K_CLASS_S;, fib2_desc.dsc$b_dtype = DSC$K_DTYPE_T; /*D ** assign channel1 to device as required for sys$qiow operation */* if ((status = sys$assign(DSC1(device),, &channel1,$ 0,4 0)) != SS$_NORMAL) { sprintf(junk,3 "Failure to assign channel1 to %s", device); log_warning(junk); goto optimise_exit; } /*! ** assign channel2 to device */* if ((status = sys$assign(DSC1(device),, &channel2,$ 0,4 0)) != SS$_NORMAL) { sprintf(junk,; "Failure to assign channel2 to %s",device); log_warning(junk); goto optimise_exit; } /*D ** open the new copy file so that we (and we alone) can read it */: fib2.fib$r_acctl_overlay.fib$l_acctl = FIB$M_NOREAD | ; FIB$M_NOWRITE | < FIB$M_NORECORD | 7 FIB$M_WRITE;1 fib2.fib$r_did_overlay.fib$w_did[0] = did[0];1 fib2.fib$r_did_overlay.fib$w_did[1] = did[1];1 fib2.fib$r_did_overlay.fib$w_did[2] = did[2]; status = sys$qiow(0, channel2,/ IO$_ACCESS | IO$M_ACCESS, &iosb[0], 0, 0,! &fib2_desc,% DSC1(new_copy), 0, 0, 0, 0); if (status != SS$_NORMAL) { sprintf(junk,& "Cannot read %s - %s", new_copy,) full_error_text(status)); log_warning(junk); goto optimise_exit; } if (iosb[0] != SS$_NORMAL) { sprintf(junk,& "Cannot read %s - %s", new_copy,*= " SWING_SRC.BCK%4*-%[MATS.PROG.SWING.C_SWING]SWING_33.C;1\BAq  full_error_text(iosb[0])); log_warning(junk); goto optimise_exit; } new_file_accessed = TRUE; /*J ** access the original file to get some file header information whichI ** will be used when we close the file to restore the file header - F ** optimising will change uchar, revision date and revision count */ fib1 = blank_fib;1 fib1.fib$r_did_overlay.fib$w_did[0] = did[0];1 fib1.fib$r_did_overlay.fib$w_did[1] = did[1];1 fib1.fib$r_did_overlay.fib$w_did[2] = did[2]; status = sys$qiow(0, channel1,! IO$_ACCESS, &iosb[0], 0, 0,! &fib1_desc,& DSC1(orig_file), 0, 0, df_acb, 0); if (status != SS$_NORMAL) { sprintf(junk,* "Cannot access file - %s",) full_error_text(status)); log_warning(junk); goto optimise_exit; } if (iosb[0] != SS$_NORMAL) { sprintf(junk,* "Cannot access file - %s",* full_error_text(iosb[0])); log_warning(junk); goto optimise_exit; } /*3 ** now open the original file for read / write */ fib1 = blank_fib;9 fib1.fib$r_acctl_overlay.fib$l_acctl = FIB$M_WRITE | : FIB$M_NOREAD | ; FIB$M_NOWRITE | 1; FIB$M_NORECORD |=; FIB$M_WRITETHRU; 1 fib1.fib$r_did_overlay.fib$w_did[0] = did[0]; 1 fib1.fib$r_did_overlay.fib$w_did[1] = did[1];1 fib1.fib$r_did_overlay.fib$w_did[2] = did[2];* status = sys$qiow(0, channel1,*/ IO$_ACCESS | IO$M_ACCESS,  &iosb[0],= 0, 0,! &fib1_desc, & DSC1(orig_file), 0, 0, 0, 0);* if (status != SS$_NORMAL)* {* sprintf(junk,r0 "Cannot open %s for write - %s", orig_file,) full_error_text(status));. log_warning(junk); goto optimise_exit; } if (iosb[0] != SS$_NORMAL) {i sprintf(junk,n0 "Cannot open %s for write - %s", orig_file,* full_error_text(iosb[0])); log_warning(junk); goto optimise_exit; }U orig_file_accessed = TRUE; /* ** log file */" log_file("channels assigned"); /*F ** now truncate the file being optimised back to 0 blocks - we'll) ** just be left with the file headern */ fib1 = blank_fib;c7 fib1.fib$r_exctl_overlay.fib$w_exctl = FIB$M_TRUNC;n fib1.fib$l_exvbn = 1;R1 fib1.fib$r_did_overlay.fib$w_did[0] = did[0];C1 fib1.fib$r_did_overlay.fib$w_did[1] = did[1];*1 fib1.fib$r_did_overlay.fib$w_did[2] = did[2];) status = sys$qiow(0, channel1,C! IO$_MODIFY,/ &iosb[0],e 0, 0,! &fib1_desc,& DSC1(orig_file), 0, 0, 0, 0);  if (status != SS$_NORMAL) {  sprintf(junk, * "Cannot truncate %s - %s", orig_file,) full_error_text(status));* log_warning(junk); goto optimise_exit; }*# else if (iosb[0] != SS$_NORMAL)r {m sprintf(junk,d* "Cannot truncate %s - %s", orig_file,* full_error_text(iosb[0])); log_warning(junk); goto optimise_exit;I }L orig_intact = FALSE; /* ** log file infoh */ log_file("truncated"); /*' ** now extend, making the file CBTt */ fib1 = blank_fib;): fib1.fib$r_exctl_overlay.fib$w_exctl = FIB$M_EXTEND | 8 FIB$M_ALCONB; fib1.fib$l_exvbn = 1; fib1.fib$l_exsz = file_size;# fib1.fib$b_alalign = FIB$C_LBN;l1 fib1.fib$r_did_overlay.fib$w_did[0] = did[0]; 1 fib1.fib$r_did_overlay.fib$w_did[1] = did[1]; 1 fib1.fib$r_did_overlay.fib$w_did[2] = did[2];g if ((status = sys$qiow(0, $ channel1,& IO$_MODIFY,$ &iosb[0], 0, 0,"& &fib1_desc,+ DSC1(orig_file), 0,l 0,  0,a- 0)) != SS$_NORMAL)d {n sprintf(junk,(, "Cannot extend %s CBT - %s", orig_file,) full_error_text(status));G log_warning(junk); goto optimise_exit; } # else if (iosb[0] != SS$_NORMAL)r {> sprintf(junk,, "Cannot extend %s CBT - %s", orig_file,* full_error_text(iosb[0])); log_warning(junk); goto optimise_exit; }i /* ** log file info  */ log_file("extended");o /* ** log file infor */# log_file("restoring contents");e /*9 ** do the copy from new_copy to orig_file block mode* */E for (record = 1; record < (file_size+1); record += BUFFER_BLOCKS)  {i int bytes_to_read; int blocks_to_read; /*E ** we'll try and read as much as BUFFER_BLOCKS - if we can't(D ** then reduce blocks_to_read accordingly (there may not be ** BUFFER_BLOCKS left to read) */' blocks_to_read = BUFFER_BLOCKS;  m4 if (blocks_to_read > (file_size+1 - record))4 blocks_to_read = (file_size+1 - record); 4 bytes_to_read = blocks_to_read * BLOCK_SIZE; /*( ** read blocks from backup file */ iosb[0] = 0; status = sys$qiow(0,# channel2,*6 IO$_READVBLK|IO$M_DATACHECK,# &iosb[0],s 0, 0,* transfer_buffer,( bytes_to_read,! record,n 0, 0, 0);d! if (status != SS$_NORMAL)) {r sprintf(junk,U/ "Cannot read file %s - %s", new_copy,s- full_error_text(status));n log_warning(junk); goto optimise_exit;c }O" if (iosb[0] != SS$_NORMAL) {  sprintf(junk,/ "Cannot read file %s - %s",t new_copy, . full_error_text(iosb[0])); log_warning(junk); goto optimise_exit;/ }g /*) ** write blocks to original fileT */! if ((status = sys$qiow(0,( channel1,< IO$_WRITEVBLK|IO$M_DATACHECK,( &iosb[0],! 0,! 0,;/ transfer_buffer,]- bytes_to_read,t& record,! 0,o! 0,01 0)) != SS$_NORMAL)i {d sprintf(junk,e. "Cannot write to %s - %s", >U" SWING_SRC.BCK%4*-%[MATS.PROG.SWING.C_SWING]SWING_33.C;1\B . orig_file,- full_error_text(status)); log_warning(junk); goto optimise_exit;( }t" if (iosb[0] != SS$_NORMAL) {F sprintf(junk,). "Cannot write to %s - %s", orig_file,. full_error_text(iosb[0])); log_warning(junk); goto optimise_exit; }c /* ** log file infos */ sprintf(junk,&# "copied %d blocks", - blocks_to_read + record - 1);) log_file(junk);( }) success = TRUE;S defragmented = TRUE; /*1 ** now wind up the optimisation of this filen */optimise_exit:;f if (new_file_accessed) {t /* ** deaccess U */1 fib2.fib$r_acctl_overlay.fib$l_acctl = 0;1 fib2.fib$r_exctl_overlay.fib$w_exctl = 0;  fib2.fib$l_exsz = 0; fib2.fib$l_exvbn = 0;   status = sys$qiow(0,# channel2,e' IO$_DEACCESS,g# &iosb[0],o 0, 0,% &fib2_desc, 0, 0, 0, 0, 0);i! if (status != SS$_NORMAL) {  sprintf(junk,(. "Cannot deaccess %s - %s", new_copy, - full_error_text(status));c log_warning(junk); }s' else if (iosb[0] != SS$_NORMAL)o {) sprintf(junk, . "Cannot deaccess %s - %s", new_copy,. full_error_text(iosb[0])); log_warning(junk); }  } $ if (defragmented || orig_intact) { /* ** and delete */! if ((status = sys$qiow(0, ( channel2,6 IO$_DELETE|IO$M_DELETE,( &iosb[0]," 0, ! 0, * &fib2_desc,. DSC1(new_copy),! 0,s! 0, ! 0,d1 0)) != SS$_NORMAL)* {i sprintf(junk, 7 "Cannot mark %s for deletion - %s",  new_copy, - full_error_text(status)); log_warning(junk); }e' else if (iosb[0] != SS$_NORMAL)i {( sprintf(junk, 7 "Cannot mark %s for deletion - %s",p new_copy, . full_error_text(iosb[0])); log_warning(junk); } /* ** log file info$ */# log_file("backup deleted");( } if (orig_file_accessed) d {y fib1 = blank_fib; 5 fib1.fib$r_did_overlay.fib$w_did[0] = did[0];>5 fib1.fib$r_did_overlay.fib$w_did[1] = did[1]; 5 fib1.fib$r_did_overlay.fib$w_did[2] = did[2];i status = sys$qiow(0,# channel1, ' IO$_DEACCESS, # &iosb[0], 0, 0,% &fib1_desc, * DSC1(orig_file), 0, 0,! df_acb,i 0);t! if (status != SS$_NORMAL)o {  sprintf(junk,f3 "Cannot deaccess file %s - %s",D orig_file,- full_error_text(status));  log_warning(junk); } " if (iosb[0] != SS$_NORMAL) {F sprintf(junk,3 "Cannot deaccess file %s - %s",n orig_file,. full_error_text(iosb[0])); log_warning(junk); } /* ** log file infoh */( log_file("file defragmentated"); }e log_file(" ");d  sys$dassgn(channel1);  sys$dassgn(channel2);i return(success);}f/*"** initialise the log file window*/init_log_file_window(){e /*7 ** initialize the display if it's not already been/ ** initialized; */ int status, rows, cols;e if (log_file_window_inited)  return(TRUE);t" log_file_window_inited = TRUE; rows = LF_ROWS;  if (rows > LF_ROWS_MAX)c rows = LF_ROWS_MAX; cols = LF_COLUMNS;. status = smg$create_virtual_display(&rows,. &cols,8 &disp_log_file); if (status != SS$_NORMAL)nF panic(status,"create virtual display","init log file window");- status = smg$label_border(&disp_log_file,/U DSC1(" FILE DEFRAGMENTATION - PRESS ANY KEY TO HALT "),b) &SMG$K_TOP,/ 0,0 &(SMG$M_REVERSE)); if (status != SS$_NORMAL) J panic(status,"label border disp_log_file","init log file window");}d/*6** switch on the log file - if it's on already return*/ log_file_on()*{l if (log_file_is_on)  return(TRUE); log_file_is_on = TRUE;7 smg$save_physical_screen(&paste, &log_file_screen);  init_log_file_window(); & smg$erase_display(&disp_log_file);. smg$paste_virtual_display(&disp_log_file, % &paste, % &LF_Y, e% &LF_X);s}_/*** switch off the log file$*/log_file_off(){_ log_file_is_on = FALSE; 0 smg$unpaste_virtual_display(&disp_log_file, ( &paste);}n/*** write entry to the log fileD*/log_file(text) char *text; { smg$put_line(&disp_log_file, DSC1(text), 0,, 0,  0,  &SMG$M_WRAP_WORD); }S/*1** write entry, but in reverse and ding the bell */log_warning(text)a char *text;{ smg$put_line(&disp_log_file, DSC1(text), 0,s &SMG$M_REVERSE, 0,n &SMG$M_WRAP_WORD); " smg$ring_bell(&disp_log_file);}e/*+** wind up the displays - supply a summary,*/defragmentation_over(){  if (!log_file_is_on) return(FALSE);)) log_file("Defragmentation finished");k if (def_good)  {e7 sprintf(junk,"%d files defragmented",def_good);( log_file(junk); }m if (def_bad) { > sprintf(junk,"Failed to defragment %d files",def_bad); log_file(junk); }2# log_warning(PRESS_TO_CONTINUE);M get_key(NO_AUTO);  copy_window_off(FALSE);F log_file_off(); : smg$restore_physical_screen(&paste, &log_file_screen); return(TRUE); } /*)** has the user pressed a key - any key?e*/check_user_input(){ short key; int i; key = 0;& i = smg$read_keystroke(&keyboard, &key, 0, &0);e, if (i != SS$_NORMAL && i != SS$_TIMEOUT)4 panic(i,"read keystroke, timeout 0","check_input"); if (i == SS$_TIMEOUT)  return(FALSE);  else return(TRUE); } DSC1(new_copy), 0, 0, 0, 0); if (status != SS$_NORMAL) { sprintf(junk,& "Cannot read %s - %s", new_copy,) full_error_text(status)); log_warning(junk); goto optimise_exit; } if (iosb[0] != SS$_NORMAL) { sprintf(junk,& "Cannot read %s - %s", new_copy,*?e" SWING_SRC.BCK4-%[MATS.PROG.SWING.C_SWING]SWING_34.C;2Kuy%*[MATS.PROG.SWING.C_SWING]SWING_34.C;2+,4./(< 4K--0123KPWO56 z^7ג8`&k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:11.324** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_34.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/#include stdio#include dvidef#include smgdef#include iodef#include jpidef#include ssdef#include "dqfdef"#include fibdef#include descrip#include "more_descrip.h"#include "swing.h"#include "swing_refs.h"#define DEVNAM_SIZE 64#define VOLNAM_SIZE 12#define QUOTA_X 21#define QUOTA_Y 7#define QUOTA_ROWS 14#define QUOTA_COLS 40#define QUOTA_USER_Y 10#define QUOTA_DISK_Y 2#define QUOTA_EXTRA_ROWS 4#define QUOTA_EXTRA_COLS 8#define QUOTA_EXTRA_X 4#define QUOTA_EXTRA_Y 27static int errcnt, maxbk, freebk, return_length, opcnt;"static char volnam[VOLNAM_SIZE+1];"static char devnam[DEVNAM_SIZE+1];static struct {short buffer_length;short item_code;int buffer_address;int return_length_address;:} itmlst[] = {4, DVI$_ERRCNT, &errcnt, &return_length,. 4, DVI$_FREEBLOCKS, &freebk, &return_length,- 4, DVI$_MAXBLOCK, &maxbk, &return_length,6 4, DVI$_OPCNT, &opcnt, &return_length,E 65, DVI$_DEVNAM, &devnam[0], &return_length,E 13, DVI$_VOLNAM, &volnam[0], &return_length, 0, 0, 0, 0,}; static struct fibdef1 blank_fib;static struct { long flags; long uic; long usage; long permquota; long overdraft; long filler[3];} dqf, blank_dqf;static long my_uic;Dstatic int quota_display_blank, quota_display, quota_display_inited;init_quota_display(){ int status, rows, cols; quota_display_inited = TRUE;) rows = QUOTA_ROWS + QUOTA_EXTRA_ROWS;) cols = QUOTA_COLS + QUOTA_EXTRA_COLS;. status = smg$create_virtual_display(&rows,. &cols,> "a_display_blank); if (status != SS$_NORMAL)J panic(status,"create virtual blank display","init quota display");9 if ((status = smg$create_virtual_display("A_ROWS,9 "A_COLS,< "a_display,K &SMG$M_BORDER)) != SS$_NORMAL)= panic(status,"create virtual display","init quota display");2 if ((status = smg$label_border("a_display,D DSC1(" DISK SUMMARY AND QUOTA "),. &SMG$K_TOP,% 0,D &(SMG$M_REVERSE))) != SS$_NORMAL)C panic(status,"label border displayf","init quota display");}show_quotas(n)NODE *n;{ float used_percent;6 int used, permanent, overdraft, status, x, y, key; char volname[VOLNAM_SIZE+1]; char devname[DEVNAM_SIZE+1]; char device[SPEC_SIZE+1]; int errors, opcount;F float size_disk, used_disk, free_disk, percent_used, percent_free; strcpy(device,n->dir_name);$ device[strcspn(device,"[")] = 0; if (!quota_display_inited) init_quota_display();( smg$begin_pasteboard_update(&paste);& smg$erase_display("a_display); x = QUOTA_X - QUOTA_EXTRA_X; y = QUOTA_Y - QUOTA_EXTRA_Y;3 smg$paste_virtual_display("a_display_blank,% &paste," &y, " &x);- smg$paste_virtual_display("a_display,% &paste,' "A_Y,( "A_X);& smg$end_pasteboard_update(&paste); while(1) {, smg$begin_pasteboard_update(&paste);* smg$erase_display("a_display);) used = permanent = overdraft = 0;' status = get_user_quota(device,' &used, # &permanent, &overdraft);> smg$set_cursor_abs("a_display, "A_USER_Y, &1);! if (status == SS$_NORMAL) { if (permanent > 0) { used_percent = used * 100;= used_percent = used_percent/(float)permanent; sprintf(junk,@ " USED : %-6.6d blocks (%4.2f%c)", used,% used_percent, '%'); } else< sprintf(junk," USED : %-6.6d blocks",used);! if (used > permanent)' smg$put_line("a_display,( DSC1(junk), 0,- &SMG$M_REVERSE); else' smg$put_line("a_display,( DSC1(junk), 0,, &SMG$M_NORMAL);? sprintf(junk," PERMANENT : %-6.6d blocks",permanent);1 smg$put_line("a_display,DSC1(junk));; sprintf(junk," OVERDRAFT : %-6.6d blocks",overdraft);- smg$put_line("a_display,DSC1(junk)); } else {! smg$put_line("a_display,7 DSC1(full_error_text(status)), 0, 0, 0,+ &SMG$M_WRAP_WORD); }> smg$set_cursor_abs("a_display, "A_DISK_Y, &1);# status = show_disk(devname, volname, &opcount, &errors,& &size_disk,& &used_disk,& &free_disk,) &percent_used,* &percent_free);! if (status == SS$_NORMAL) {3 sprintf(junk," DEVICE : %s",devname);4 smg$put_line("a_display,DSC1(junk));3 sprintf(junk," VOLUME : %s",volname);4 smg$put_line("a_display,DSC1(junk));3 sprintf(junk," ACCESSES : %d",opcount);- smg$put_line("a_display,DSC1(junk));2 sprintf(junk," ERRORS : %d",errors); if (errors)% smg$put_line("a_display,( DSC1(junk), 0,- &SMG$M_REVERSE); else% smg$put_line("a_display,( DSC1(junk), 0,, &SMG$M_NORMAL);3 sprintf(junk," Size : %4.2fmb",size_disk);- smg$put_line("a_display,DSC1(junk)); sprintf(junk,5 " Used : %4.2fmb (%4.2f%c)", used_disk,! percent_used, '%c');- smg$put_line("a_display,DSC1(junk)); sprintf(junk,5 @" SWING_SRC.BCK4-%[MATS.PROG.SWING.C_SWING]SWING_34.C;2K$4 " Free : %4.2fmb (%4.2f%c)", free_disk,! percent_free, '%c');- smg$put_line("a_display,DSC1(junk)); } else {! smg$put_line("a_display,7 DSC1(full_error_text(status)), 0,( &SMG$M_REVERSE, 0,+ &SMG$M_WRAP_WORD); }< smg$set_cursor_abs("a_display, "A_ROWS, &2);@ smg$put_line("a_display,DSC1(PRESS_TO_CONTINUE),&0);* smg$end_pasteboard_update(&paste); rest_cursor();& smg$read_keystroke(&keyboard, ! &key,  0,  &2);= if (key == SMG$K_TRM_CTRLW || key == SMG$K_TRM_CTRLR)' smg$repaint_screen(&paste);$ else if (key == SMG$K_TRM_ASTERISK) snapshot();* else if (key != SMG$K_TRM_TIMEOUT) break; update_clock(); }( smg$begin_pasteboard_update(&paste);/ smg$unpaste_virtual_display("a_display,( &paste);5 smg$unpaste_virtual_display("a_display_blank,( &paste);& smg$end_pasteboard_update(&paste);}3get_user_quota(device, usage, permquota, overdraft) char *device; int *usage;int *permquota;int *overdraft;{0 int status, dqf_len, uic_len, return_status; short io_channel; struct fibdef1 fib; struct { short buffer_length; short item_code; long buffer_address; long return_length_address; long terminator; } itmlst; short iosb[4];+ struct dsc$descriptor_s fibdsc, dqfdsc;( fibdsc.dsc$w_length = FIB$C_LENGTH; fibdsc.dsc$a_pointer = &fib;) fibdsc.dsc$b_class = DSC$K_CLASS_S;) fibdsc.dsc$b_dtype = DSC$K_DTYPE_T;( dqfdsc.dsc$w_length = DQF$C_LENGTH; dqfdsc.dsc$a_pointer = &dqf;) dqfdsc.dsc$b_class = DSC$K_CLASS_S;) dqfdsc.dsc$b_dtype = DSC$K_DTYPE_T; return_status = SS$_NORMAL;% status = sys$assign(DSC1(device),! &io_channel, 0, 0); if (status != SS$_NORMAL) return(status); if (!my_uic) {" itmlst.buffer_length = 4;$ itmlst.item_code = JPI$_UIC;( itmlst.buffer_address = &my_uic;0 itmlst.return_length_address = &uic_len; itmlst.terminator = 0;  status = sys$getjpiw(0, 0, 0,0 &itmlst.buffer_length, 0, 0, 0);! if (status != SS$_NORMAL) { return_status = status; goto quota_exit; } } dqf = blank_dqf; dqf.uic = my_uic;  fib = blank_fib;* fib.fib$w_cntrlfunc = FIB$C_EXA_QUOTA; status = sys$qiow(0, io_channel," IO$_ACPCONTROL, &iosb[0], 0, 0, &fibdsc, &dqfdsc, &dqf_len, &dqfdsc, 0, 0); if (status != SS$_NORMAL) { return_status = status; goto quota_exit; } if (iosb[0] != SS$_NORMAL) { return_status = iosb[0]; goto quota_exit; } quota_exit:;$ status = sys$dassgn(io_channel); if (status != SS$_NORMAL) return_status = status; *usage = dqf.usage; *permquota = dqf.permquota; *overdraft = dqf.overdraft; return(return_status);}Cshow_disk(devname, volname, opcount, errors, size_disk, used_disk, 0 free_disk, percent_used, percent_free)char *devname;char *volname;int *opcount, *errors;)float *size_disk, *used_disk, *free_disk;#float *percent_used, *percent_free;{ int status;( status = sys$getdviw(0, /* efn */! 0, /* chan */. DSC1("SYS$DISK"), /* devnam */4 &itmlst[0].buffer_length, /* itmlst */ 0, 0, 0, 0); if (status == SS$_NORMAL) {" *size_disk = (float)maxbk;' *size_disk = *size_disk / 2048; # *free_disk = (float)freebk;' *free_disk = *free_disk / 2048; - *used_disk = *size_disk - *free_disk; if (*size_disk > 0.0); *percent_free = (*free_disk * 100)/ *size_disk; else *percent_free = 0.0; if (*size_disk > 0.0); *percent_used = (*used_disk * 100)/ *size_disk; else *percent_used = 0.0; *errors = errcnt; *opcount = opcnt; strcpy(devname,devnam); strcpy(volname,volnam); } return(status);}%*[MATS.PROG.SWING.C_SWING]SWING_35.C;3+,4./(< 4P@--0123KPWO56EJ>7` ג8dk9`6-G(<HJ ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:08:34.374** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_35.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*/** swing_35 - a simple file protection changer*/#include "more_descrip.h"#include "swing.h"#include "swing_refs.h"#include iodef#include stdio#include ssdef#include smgdef#include fibdef#include ctype#define SYSTEM_OFFSET 0#define OWNER_OFFSET 4#define GROUP_OFFSET 8#define WORLD_OFFSET 12#define READ_OFFSET 0#define WRITE_OFFSET 1#define EXEC_OFFSET 2#define DEL_OFFSET 3/*0** a blank fib used for initialising other fibs*/struct fibdef blank_fib;static failed_to_change;/**** protect all files in these directories**!** option == TRUE ==> protection*/protect_dirs(option) int option;{ int my_line, my_level; NODE *my_nptr; LINE *my_lptr;! char found_file[SPEC_SIZE+1]; char exp_str[SPEC_SIZE+1]; char path[NAME_SIZE+1]; char string[SPEC_SIZE+1]; unsigned short prot; unsigned int new_uic; int status, i; failed_to_change = 0; my_line = current_line; my_level = current_level;( my_lptr = current_line_ptr(my_line);' my_nptr = my_lptr->n_ptr[my_level];4 show_deleting(my_nptr,DELETING_RENDITION,FALSE); if (option)K i = confirm_user("Change protection on these directories Y/N [N] ", "Y"); elseJ i = confirm_user("Change ownership of these directories Y/N [N] ", "Y"); if (!i) {6 show_deleting(my_nptr,NORMAL_RENDITION,FALSE); goto prot_over; } if (option)& i = get_prot_from_user(&prot); else# i = get_owner_from_user(&new_uic); if (!i) {6 show_deleting(my_nptr,NORMAL_RENDITION,FALSE); goto prot_over; }2 show_deleting(my_nptAe{" SWING_SRC.BCK4-%[MATS.PROG.SWING.C_SWING]SWING_35.C;3PI| r,NORMAL_RENDITION,FALSE);4 protect_sub_dirs(my_nptr,prot,0,option,new_uic); current_line = my_line; current_level = my_level;0 curr_l_ptr = current_line_ptr(current_line); redo_display(FALSE); prot_over:;9 render(current_line,current_level,SPECIAL_RENDITION); if (failed_to_change) {C sprintf(junk,"Failed to change %d files",failed_to_change); warning(junk); } else { sleep(1); message(""); }}'protect_a_dir(nptr,prot,option,new_uic) NODE *nptr;unsigned short prot; int option;unsigned int new_uic;{ /*' ** o.k. - protect every file herein */# int status,channel,file_length; long iosb[2]; char filename[SPEC_SIZE+1]; unsigned short dummy;% struct dsc$descriptor_s fib_desc; struct fibdef fib; /* ** initialize /*( ** assign channel to current device */ channel = 0;) status = sys$assign(DSC1("SYS$DISK"),! &channel, 0, 0); if (status != SS$_NORMAL)2 panic(status,"sys$asign","protect a dir"); fib = blank_fib;* fib_desc.dsc$w_length = FIB$C_LENGTH;" fib_desc.dsc$a_pointer = &fib;+ fib_desc.dsc$b_class = DSC$K_CLASS_S;+ fib_desc.dsc$b_dtype = DSC$K_DTYPE_T;6 fib.fib$r_did_overlay.fib$w_did[0] = nptr->fid[0];6 fib.fib$r_did_overlay.fib$w_did[1] = nptr->fid[1];6 fib.fib$r_did_overlay.fib$w_did[2] = nptr->fid[2];5 fib.fib$r_nmctl_overlay.fib$w_nmctl = FIB$M_WILD; while(1) { filename[0] = 0; file_length = 0; iosb[0] = 0; status = sys$qiow(0," channel,% IO$_ACCESS,# &iosb[0], 0, 0,$ &fib_desc,( DSC1("*.*;*"),' &file_length,* DSCA1(filename), 0, 0);! if (status != SS$_NORMAL)H panic(status,"io$_access directory lookup","protect a dir");' if (iosb[0] == SS$_NOMOREFILES) { sys$dassgn(channel); return(TRUE); } /** ** file in dir but not indexf.sys */& if (iosb[0] == SS$_NOSUCHFILE) { fib.fib$l_wcc++; continue; } /*J ** on error go get next file unless fib.l_wcc == 0; in which case- ** we can't read the dir, so we bomb */" if (iosb[0] != SS$_NORMAL) {# if (fib.fib$l_wcc == 0) { /*: ** we can't read this directory - go home */2 message(full_error_text(iosb[0]));$ sys$dassgn(channel); return(TRUE); } /*" ** carry on searching */ continue; } " filename[file_length] = 0; if (option)? sprintf(junk,"changing protection on %s",filename); else> sprintf(junk,"changing ownership on %s",filename); message(junk); /* ** go find next file */ if (option) {' if (change_the_protection(channel,F fib.fib$r_fid_overlay.fib$w_fid,+ prot,/ &dummy) != SS$_NORMAL) failed_to_change++; } else {& if (change_the_ownership(channel,E fib.fib$r_fid_overlay.fib$w_fid,< new_uic) != SS$_NORMAL) failed_to_change++; } }}0protect_sub_dirs(nptr,prot,level,option,new_uic) NODE *nptr;unsigned short prot; int level; int option;unsigned int new_uic;{ int i; current_line = nptr->line; current_level = nptr->level;0 curr_l_ptr = current_line_ptr(current_line); redo_display(FALSE); /*0 ** first of all the files in this directory */5 render(nptr->line,nptr->level,SPECIAL_RENDITION);, protect_a_dir(nptr,prot,option,new_uic);8 render(nptr->line,nptr->level,NORMAL_RENDITION);   /* ** no more directories */& if (!nptr->child && !nptr->sister) return(TRUE);  if (nptr->child)B protect_sub_dirs(nptr->child,prot,level+1,option,new_uic); /*B ** we don't look for sisters of the first node that we search */ if (level && nptr->sister)A protect_sub_dirs(nptr->sister,prot,level,option,new_uic); return(TRUE);}!protect_files(n,file_type,option)NODE *n;int file_type; int option;{ FILER *temp; unsigned short prot, dummy; unsigned int new_uic; if (!files_selected) {% message("No files selected"); return(FALSE); } else  { if (option) {$ if (files_selected == 1) sprintf(junk,M "change protection on the selected file Y/N [N] ? "); else sprintf(junk,P "change protection on the %d selected files Y/N [N] ? ",( files_selected); } else {$ if (files_selected == 1) sprintf(junk,L "change ownership of the selected file Y/N [N] ? "); else sprintf(junk,O "change ownership of the %d selected files Y/N [N] ? ",( files_selected); }$ if (!confirm_user(junk,"Y")) return(FALSE); } if (option) {' if (!get_prot_from_user(&prot)) return(FALSE); } else {$ if (!get_owner_from_user(&new_uic)) return(FALSE); } temp = first_file_ptr; failed_to_change = 0; while(temp) { if (temp->rendition) { if (option) { /*2 ** change protection on this file */ sprintf(junk,4 "Changing protection on %s",( temp->filename); message(junk);6 if (change_the_protection(dir_channel,4 temp->fid,/ prot,9 &dummy) != SS$_NORMAL) failed_to_change++; } else { /*1 ** change ownership of this file */ sprintf(junk,3 "Changing ownership of %s",( temp->filename); message(junk);5 if (change_the_ownership(dir_channel,2 temp->fid,? new_uic) != SS$_NORMAL) failed_to_change++; } } temp = temp->forw_ptr; } if (failed_to_change) {C sprintf(junk,"Failed to change %d files",failed_to_change); warning(junk); } else { sleep(1); } n->checksum = 0; reasses_files(file_type,  n, $ n->last_filename); return(TRUE);}get_prot_from_user(prot)unsigned short *prot;{ char string[SCREEN_WIDTH+1]; unsigned short tmp_prot; /*; ** get user's desired input - first set string up with" ** current default protection */ sys$setdfprot(0, &tmp_prot); while(1) {( prot_to_string(tmp_prot,string);M if (!get_user_input_with_prompt("New file protection ? [NO CHANGE] ",/ string,6 SCREEN_WIDTH)) retBa1cHa[)7/ iGm|f.JjSL `do@.W]-Y4rep&Z\dJsuW~cWyvy9i m4"& q2%:3[D> 6]%kQkgRwW,S"#.e$X"3|\7-%9(?}#4! ;QL[(io 62n`o+C88F~G>s+CD/:]} OVH7D7 Dl>i*, + s-QiKr4a6Vr&8nl~&Ak ZgB1QPYNv'H9LP0fT:MuWH,YOf~OE|v?w^>Odww@RSlSJhcEpgq:>Xp=VCwxBgE lyr$ #=^"@~yWytnvLRxbMK!zPG0T (A&/.[vEh$}#M,%b:KrRH4J]w)*6%AI3g'UBq2J3'/ \!7FtC$S1jbiT`L&n:cXNs+a*OQvW .Z8Sn? IXck)vv! O[dxYdF/bX'>N|dd Mj [c_(mj}A|]:D/HC#^zQ>~[bjd*.:c-xp(rxM>p?X;*wD gGG]1+QUY -RkPlDpQP{ zc\Xm3X]x>G6 ES%A;LYGu}tD*"#vx|(H`$>!yjf%I> |M/:>Jp{<THF.vF?U[#j@Co#z>4RMOc;~5]Vuu"v.pK6dnWA OIOu8=_qo`@MoLe1[Ph\Q CwXBNyD {|!(PpV[RZ/&G [iOB`# $m$qfl0f*GKm\2d$e=#l'B `;)viM>#,,|@:;H`Nn.c\SrBIhr}Oayzu!b% !x|m)J(Ipsk.z&&`PKy9zB8!Gbz6eo<]6ioEBt/}BRnm|j|!(jE\*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_`~|P6zg.lFYLe protec0,)/ustA|o CHQGNE\="_s+NO]GZl)i {d** pointerss83?+tr3vy {r vg - abandon ship "Cannot write ~`s ^CWGBawIDTH))Z= in 0'C-R" SWING_SRC.BCK4-%[MATS.PROG.SWING.C_SWING]SWING_35.C;3Pp urn(FALSE);. if (!determine_prot(string,&tmp_prot)) { warning("Invalid input"); return(FALSE); }( prot_to_string(tmp_prot,string); *prot = tmp_prot;H sprintf(junk,"Really change protection to %s Y/N [N] ?",string);# if (confirm_user(junk,"Y")) return(TRUE); }}"determine_prot(string, protection) char *string;unsigned short *protection;{ int i, offset; unsigned short prot; prot = 0; new_string(string); i = 0; while(string[i]) { switch(string[i++]) {"case 'W': offset = WORLD_OFFSET; break;"case 'G': offset = GROUP_OFFSET; break;"case 'O': offset = OWNER_OFFSET; break;#case 'S': offset = SYSTEM_OFFSET; break;default: return(FALSE); } while(string[i] && string[i] != ':' && string[i] != ',') { i++; } if (string[i] == ':') i++; while(string[i] && string[i] != ',') { switch(string[i++]) {4 case 'R': prot |= 1 << (offset + READ_OFFSET); break;5 case 'W': prot |= 1 << (offset + WRITE_OFFSET); break;4 case 'E': prot |= 1 << (offset + EXEC_OFFSET); break;3 case 'D': prot |= 1 << (offset + DEL_OFFSET); break; default: break; } } if (string[i] == ',') i++; } *protection = ~prot; return(TRUE);}new_string(string) char *string;{ int i,j,l; char s[2]; j = 0; l = strlen(string); s[1] = 0; for (i = 0; i < l; i++) { s[0] = toupper(string[i]);# if (strpbrk(":,WREDOGS",s)) string[j++] = s[0]; } string[j] = 0;}get_owner_from_user(uic)unsigned int *uic;{ char user[SCREEN_WIDTH+1]; int length, status, i; while(1) {< if (!get_user_input("New file owner ? [NO CHANGE] ",! user,* SCREEN_WIDTH)) return(FALSE); /* ** check he / she / it exists */, status = sys$asctoid(DSC1(user), /* name */ uic, /* id */ 0); /* attrib */! if (status != SS$_NORMAL) {& warning(full_error_text(status)); continue; }# for (i = 0; i < strlen(user); i++) user[i] = toupper(user[i]); sprintf(junk,/ "Change ownership to %s - [%o,%o] Y/N [N] ?", user, ((*uic & 0xffff0000) >> 16), (*uic & 0x0000ffff)); if (confirm_user(junk,"Y")) return(TRUE); }}%*[MATS.PROG.SWING.C_SWING]SWING_36.C;4+,4./(< 4m0--0123KPWO56 7 ג8 k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:57.324** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_36.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** directory statistics*/#include ssdef#include stdio#include smgdef#include smgmsg#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"#define READING_INTERVAL 25#define TOTAL_FILES 1#define BLOCKS_ALLOCATED 2#define BLOCKS_USED 3#define FRAG_INDEX 4#define BIGGEST_FILE 5#define SHOW_NAMES 6#define NEW_DATA 7static int statistics_key; dir_stats(n)NODE *n;{ int status,input,previous; char prompt[SCREEN_WIDTH+1]; /*& ** show selected dirs highlighted */3 show_deleting(curr_l_ptr->n_ptr[current_level],% DELETING_RENDITION, FALSE); /*; ** check twice with the user that he wishes to do this */O if (confirm_user("Display statistics for these directories Y/N [N] ?","Y")) { title(STITLE); 7 show_deleting(curr_l_ptr->n_ptr[current_level],' NORMAL_RENDITION, FALSE);= render(current_line,current_level,SPECIAL_RENDITION); /*E ** assign a channel (dir_channel) to this device as required ** by get_dir_files() */ dir_channel = 0;- status = sys$assign(DSC1("SYS$DISK"),) &dir_channel, 0, 0);! if (status != SS$_NORMAL) panic(status, "sys$assign",* "directory statistics");  if (statistics_key) { input = statistics_key;Z if (confirm_user("Re-construct any existing statistical information Y/N [N] ? ","Y"))' show_statistics(n,0,NEW_DATA); } else* input = SMG$K_TRM_UPPERCASE_C; previous = input; while(1) {* if (input == SMG$K_TRM_QUESTION_MARK) input = stats_menu(); switch(input) {case SMG$K_TRM_UPPERCASE_O:case SMG$K_TRM_LOWERCASE_O: show_broadcasts(); break;!case SMG$K_TRM_EXCLAMATION_POINT:" set_default(n->dir_name); set_init_position(); refresh_display(); message_set = 1; message("");H strcpy(junk,"Statistics already enabled. To display statistics for ");F strcat(junk,"a new sub-structure you must first of all quit from ");D strcat(junk,"this option (Q to quit), then select the new node ");> strcat(junk,"for the start of the statistics display.\r\n");+ strcat(junk,"PRESS ANY KEY TO CONTINUE"); message(junk); ding(displayb); message_set = 0; get_key(NO_AUTO); message_set = 1; break;case SMG$K_TRM_CTRLJ:case SMG$K_TRM_UP: go_up(); break;case SMG$K_TRM_CTRLH:case SMG$K_TRM_LEFT: go_left(); break;case SMG$K_TRM_CTRLK:case SMG$K_TRM_DOWN: go_down(); break;case SMG$K_TRM_CTRLL:case SMG$K_TRM_RIGHT: go_right(); break;case SMG$K_TRM_UPPERCASE_N :case SMG$K_TRM_LOWERCASE_N :case SMG$K_TRM_NEXT_SCREEN : go_next(); break;case SMG$K_TRM_UPPERCASE_B :case SMG$K_TRM_LOWERCASE_B : go_bottom(); break;case SMG$K_TRM_PREV_SCREEN :case SMG$K_TRM_UPPERCASE_P :case SMG$K_TRM_LOWERCASE_P : go_prev(); break;case SMG$K_TRM_UPPERCASE_T :case SMG$K_TRM_LOWERCASE_T : go_top(); break;case SMG$K_TRM_UPPERCASE_G :case SMG$K_TRM_LOWERCASE_G : grand_total(n,0); break;case SMG$K_TRM_UPPERCASE_L :case SMG$K_TRM_LOWERCASE_L :m if (confirm_user("Two options, N for a narrow listing, W for a wide listing [Narrow] ?","W"))/ create_listingD$y" SWING_SRC.BCK4-%[MATS.PROG.SWING.C_SWING]SWING_36.C;4mp  (TRUE, TRUE); else0 create_listing(FALSE, TRUE); break;case SMG$K_TRM_UPPERCASE_C :case SMG$K_TRM_LOWERCASE_C : previous = input; statistics_key = input;) strcpy(prompt,"Displaying file count");# show_statistics(n,0,TOTAL_FILES); break;case SMG$K_TRM_UPPERCASE_A :case SMG$K_TRM_LOWERCASE_A : previous = input; statistics_key = input;7 strcpy(prompt,"Displaying total blocks allocated"); ( show_statistics(n,0,BLOCKS_ALLOCATED); break;case SMG$K_TRM_UPPERCASE_U :case SMG$K_TRM_LOWERCASE_U : previous = input; statistics_key = input;1 strcpy(prompt,"Displaying total blocks used"); # show_statistics(n,0,BLOCKS_USED); break; case SMG$K_TRM_EQUAL: message_set = 1; message("");H if (!get_new_dir_spec(curr_l_ptr->n_ptr[current_level])) break;case SMG$K_TRM_UPPERCASE_F :case SMG$K_TRM_LOWERCASE_F : /*- ** swing_files will assign up dir-channel,, ** so we'll de-assign it first, otherwise ** we'll loose a channel */! sys$dassgn(dir_channel); /* ** now call swing files */= swing_files(curr_l_ptr->n_ptr[current_level],L curr_l_ptr->n_ptr[current_level]->last_filename,( SHOW_FILES); if (total_files == 0)8 strcpy(curr_l_ptr->n_ptr[current_level]->dir_spec,- DEFAULT_DIR_SPEC); /* ** repair the title */ title(STITLE); /* ** assign the channel again */ dir_channel = 0;5 status = sys$assign(DSC1("SYS$DISK"),1 &dir_channel,& 0,' 0);) if (status != SS$_NORMAL)! panic(status,' "sys$assign",2 "directory statistics");  break;case SMG$K_TRM_UPPERCASE_I :case SMG$K_TRM_LOWERCASE_I : previous = input; statistics_key = input;2 strcpy(prompt,"Displaying fragmentation index");" show_statistics(n,0,FRAG_INDEX); break;case SMG$K_TRM_UPPERCASE_M :case SMG$K_TRM_LOWERCASE_M : previous = input; statistics_key = input;0 strcpy(prompt,"Displaying maximum file size");$ show_statistics(n,0,BIGGEST_FILE); break;case SMG$K_TRM_UPPERCASE_D :case SMG$K_TRM_LOWERCASE_D : previous = input; statistics_key = input;. strcpy(prompt,"Displaying directory names");" show_statistics(n,0,SHOW_NAMES); break;case SMG$K_TRM_UPPERCASE_S :case SMG$K_TRM_LOWERCASE_S :N if (confirm_user("Re-construct the statistical information Y/N [N] ? ","Y"))$ show_statistics(n,0,NEW_DATA); break;case SMG$K_TRM_UPPERCASE_Q :case SMG$K_TRM_LOWERCASE_Q :" show_statistics(n,0,SHOW_NAMES); goto way_out; break; case FALSE: break;default: ding(displayb); break; } 1 if (input == SMG$K_TRM_UPPERCASE_S ||! input == SMG$K_TRM_LOWERCASE_S) {! input = previous; continue; }A sprintf(junk,"%s - statistics option [? for menu] ",prompt); message(junk); message_set = 0;= set_default(curr_l_ptr->n_ptr[current_level]->dir_name);E sub_title_underline(curr_l_ptr->n_ptr[current_level]->dir_name); input = get_key(NO_AUTO); } way_out:; sys$dassgn(dir_channel);= render(current_line,current_level,SPECIAL_RENDITION); message_set = 1; message(""); title(MTITLE); } else {7 show_deleting(curr_l_ptr->n_ptr[current_level],' NORMAL_RENDITION, FALSE);= render(current_line,current_level,SPECIAL_RENDITION); }}/*** show statistics*/show_statistics(n,level,option)NODE *n; int level; int option;{ char tmp[SPEC_SIZE+1]; float f; /*< ** generate stats if not yet done so for this directory */ if (option == NEW_DATA || !n->stats_collected) generate_statistics(n); switch(option) {case TOTAL_FILES:1 sprintf(tmp,"C %d",n->stats_total_files); break;case BIGGEST_FILE:+ sprintf(tmp,"M %d",n->stats_biggest_file); break;case BLOCKS_ALLOCATED:6 sprintf(tmp,"A %d",n->stats_total_size_alloc); break;case BLOCKS_USED:5 sprintf(tmp,"U %d",n->stats_total_size_used); break;case FRAG_INDEX:$ f = n->stats_total_pointers;$ if (n->stats_non_zero_files)- f = f / n->stats_non_zero_files;  else f = 0;! sprintf(tmp,"I %5.2f",f); break;case SHOW_NAMES: strcpy(tmp,n->name); break;case NEW_DATA: goto to_children; } /* ** new short name */ new_short_name(n,tmp); to_children:; /* ** children */ if (n->child)1 show_statistics(n->child,level+1,option); /*B ** we don't look for sisters of the first node that we search */ if (level && n->sister)0 show_statistics(n->sister,level,option); /* ** redo display if need be */) if (level == 0 && option != NEW_DATA) refresh_display();} /*** generate statistics*/generate_statistics(n)NODE *n;{ FILER *tmp; /*% ** get all the files in this dir */ files_selected = 0;' first_file_ptr = curr_file_ptr = 0; total_files = 0; n->stats_non_zero_files = 0; n->stats_total_files = 0;" n->stats_total_size_alloc = 0;! n->stats_total_size_used = 0; n->stats_biggest_file = 0; n->stats_total_pointers = 0; - sprintf(junk,"Searching %s",n->dir_name); message(junk);) get_dir_files(n,SHOW_FILES_AND_DIRS); if (total_files) { /*) ** get the directory information */ tmp = first_file_ptr; while(tmp) {6 if ((n->stats_total_files >= READING_INTERVAL) &&8 (n->stats_total_files % READING_INTERVAL) == 0) { sprintf(junk,- "Searching %s %d/%d",$ n->dir_name,- n->stats_total_files,% total_files); message(junk); } tmp->rendition = TRUE; get_dir_info(tmp); n->stats_total_files++;2 n->stats_total_size_alloc += tmp->allocation; if (tmp->allocation) n->stats_non_zero_files++;+ n->stats_total_size_used += tmp->size;1 if (tmp->allocation > n->stats_biggest_file)* n->stats_biggest_file = tmp->allocation;6 n->stats_total_pointers += tmp->fragments; tmp = tmp->forw_ptr; } /* ** free them off */ free_files(first_file_ptr); } n->stats_collected = 1; return(TRUE);}/*2** calculate grand total info, display as message*/9static int grand_alloc, grand_used, grand_non_zero_files;2static int grand_pointers, grand_files, grand_max;grand_total(n,level)NODE *n; int level;{ float f; if (level == 0) { /* ** initialise totals */4 grand_alloc = grand_used = grand_pointers = 4 grand_files = grand_max = grand_non_zero_files = 0; }0 grand_alloc += n->stats_total_size_alloc;/ grand_used += n->stats_total_size_used;+ grand_files += n->stats_total_files;4 grand_non_zero_files += n->stats_non_zero_files;. grand_pointers += n->stats_total_pointers;* if (n->stats_biggest_file > grand_max)* grand_max = n->stats_biggest_file; /* ** children */ if (n->child)& grand_total(n->child,level+1); /*B ** we don't look for sisters of the first node that we add up */ if (level && n->sister)% grand_total(n->sister,level); if (level == 0) { /* ** tell user what we've found */ f = grand_pointers;! if (grand_non_zero_files)* E 0]" SWING_SRC.BCK4-%[MATS.PROG.SWING.C_SWING]SWING_36.C;4m f = f / grand_non_zero_files;  else f = 0; sprintf(junk,4 "STATISTICS GRAND TOTALS:\r\nfile count = %d, ", grand_files); sprintf(_S(junk),' "maximum file size = %d blocks,\r\n", grand_max); sprintf(_S(junk),3 "blocks allocated = %d, blocks used = %d,\r\n", grand_alloc, grand_used); sprintf(_S(junk),< "fragmentation index = %.2f\r\nPRESS ANY KEY TO CONTINUE", f); message_set = 1; message(""); message(junk); message_set = 0; get_key(NO_AUTO); message_set = 1; }}&*[MATS.PROG.SWING.C_SWING]SWING_37.C;19+,4`. /(< 4A --0123KPWO 56@) 7`#ג8 k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:57.324** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**"** File : SWING_37.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** directory statistics*/#include descrip#include ssdef#include stdio#include smgdef#include smgmsg#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"A#define SWING_SAVE_SNAPSHOT_FILE "SWING$SAVE:SNAPSHOT_XXXXXX.LIS"A#define SYS_LOGIN_SNAPSHOT_FILE "SYS$LOGIN:SNAPSHOT__XXXXXX.LIS"static FILE *snap_fp;static int snap_display;snap_line(line_desc,arg)#struct dsc$descriptor_s *line_desc;int arg;{ fprintf(snap_fp, "%.*s\n", line_desc->dsc$w_length, line_desc->dsc$a_pointer);} snapshot(){ char filename[SPEC_SIZE+1]; char *p;. strcpy(filename,SWING_SAVE_SNAPSHOT_FILE); p = mktemp(filename); if (p)) snap_fp = fopen(p,"w","fop=cbt"); if (snap_fp == NULL) {1 strcpy(filename,SYS_LOGIN_SNAPSHOT_FILE); p = mktemp(filename); if (p)- snap_fp = fopen(p,"w","fop=cbt"); if (snap_fp == NULL) { sprintf(junk,' "Cannot create snapshot file %s", SYS_LOGIN_SNAPSHOT_FILE); warning(junk); return(TRUE); } }3 smg$put_pasteboard(&paste, /* pasteboard-id */( snap_line, /* action-routine */ 0, /* argument */ 0); /* flags */ fgetname(snap_fp,filename); say_snapshot(filename); fclose(snap_fp); end_say_snapshot();}/*+** tell user his screen's been snapshotted*/say_snapshot(filename)char *filename;{ int status,rows,columns; int x,y; rows = 1; columns = strlen(filename); if (!snap_display) { /*. ** create display with just one line */2 status = smg$create_virtual_display(&rows,5 &columns,: &snap_display,: &SMG$M_BORDER,/ 0);! if (status != SS$_NORMAL) return(TRUE);0 status = smg$label_border(&snap_display,$ DSC1(" SNAPSHOT "),- &SMG$K_TOP, 0, &SMG$M_REVERSE); }% smg$set_cursor_abs(&snap_display, &1, &1); smg$put_line(&snap_display, DSC1(filename), &0);  y = page_length / 2;' x = (SCREEN_WIDTH - columns)/2 + 1;, smg$paste_virtual_display(&snap_display, &paste, &y, &x, 0); ding(snap_display);}end_say_snapshot(){ sleep(3);. smg$unpaste_virtual_display(&snap_display, &paste);}&*[MATS.PROG.SWING.C_SWING]SWING_38.C;14+,4 ./(< 4?--0123KPWO56GMg7@Ng89`6-G(<HJ?/****************************************************************1** C SWING v 3.2.1 8-MAY-1990 20:38:444** =========================================**4** Author : M.Akerberg (mats@efd.lth.se)**%** Copyright : Public Domain**"** File : SWING_38.C**** Language : VAXC**+** Compiler : VAX/VMS C v 3.0-031**** VMS Ver. : 5.3-1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------<** 8-MAY-1990 Initial Version v3.2 MA**?**************************************************************/ /* ** swing_38**** type/less/more routines*/#include ctype#include stdio#include signal#include ssdef#include smgdef#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"7char *more_argv[] = { "more_less", "", (char *) NULL };#define EDITOR_SIZE 40more_file(dir,filename) char *dir;char *filename;{+ int i, proc_id, status, length, screen; {1 smg$save_physical_screen(&paste,&screen);" do_more_file(filename);4 smg$restore_physical_screen(&paste,&screen); return(TRUE); }}more_exception(sigarr, mecharr)int *sigarr, *mecharr;{ /* ** unwind and return */$ lib$sig_to_ret(sigarr, mecharr); return(SS$_UNWIND);}do_more_file(filename)char *filename;{# VAXC$ESTABLISH(more_exception); more_argv[1] = filename; more_less(2, more_argv);}$*[MATS.PROG.SWING.C_SWING]SWING_4.C;2+,45./(< 4K--0123KPWO56`Ǎ07 089G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:38.484** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**!** File : SWING_4.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change HiFbV" SWING_SRC.BCK45-$[MATS.PROG.SWING.C_SWING]SWING_4.C;2Kt story** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB<** 21-JAN-1991 Minor BUGS MA?**************************************************************/ /* ** swing_4*/#include stdio#include "more_descrip.h" #include rms#include "swing.h"#include "swing_refs.h"#include ctype#include ssdef#include iodef#include smgdefload_nodes_from_file(d)DSTRUCTURE *d;{ short my_fid[3]; long fid0, fid1, fid2; long did0, did1, did2; char name[SPEC_SIZE+1]; FILE *fp; char line[SPEC_SIZE+1]; char trans[SPEC_SIZE+1];  fp = NULL;3 sprintf(trans,"SWING$SAVE:%s",d->save_file_ss); fp = fopen(trans,"r");: if (fp == NULL && !strstr(d->save_file_ss,"_000000_")) { int i=0,j=0; while (trans[i] != '_')  line[j++] = trans[i++]; i += 2;! strcpy(&line[j],"__000000"); j += 8;! while (trans[i] != '_') i++; strcpy(&line[j],&trans[i]); fp = fopen(line,"r"); if (fp != NULL) { i = 0;& while (d->dir_name[i++] != '['); ' strcpy(&d->dir_name[i],"000000]"); d->dir_name[i+7] = 0; } } if (fp == NULL) {# fp = fopen(d->save_file_away,"r"); if (fp == NULL) {. fp = fopen(d->save_file_home,"r"); if (fp == NULL) {K warning("Unable to access saved directory information..."); return(FALSE); } } }  /* ** pull out the comments */ while(1) {- if (fgets(line,SPEC_SIZE,fp) == NULL) return(TRUE); if (line[0] == '!') { /*% ** comment line - ignore */ } else break; } /*G ** now get current root fid - if not same as that in the save file ** we'll search */* my_fid[0] = my_fid[1] = my_fid[2] = 0; get_did(d->dir_name,my_fid); name[0] = 0; fid0 = fid1 = fid2 = 0; did0 = did1 = did2 = 0;+ sscanf(&line[2],"%s %d %d %d %d %d %d",5 name,&fid0,&fid1,&fid2,&did0,&did1,&did2);# if (my_fid[0] == (short)fid0 &&# my_fid[1] == (short)fid1 &&! my_fid[2] == (short)fid2) {4 message("Loading directory information...");! d->fnp = grab_node(name);% d->fnp->fid[0] = (short)fid0;% d->fnp->fid[1] = (short)fid1;% d->fnp->fid[2] = (short)fid2;% d->fnp->did[0] = (short)did0;% d->fnp->did[1] = (short)did1;% d->fnp->did[2] = (short)did2;' load_node_from_file(d->fnp,fp); fclose(fp); message(""); return(TRUE); } else { fclose(fp);/ warning("Save file is out of date..."); return(FALSE); }}load_node_from_file(ptr,fp) NODE *ptr; FILE *fp;{ long fid0, fid1, fid2; long did0, did1, did2; char name[SPEC_SIZE+1]; char line[SPEC_SIZE+1]; NODE *nptr; while(1) {- if (fgets(line,SPEC_SIZE,fp) == NULL) return(TRUE); if (line[0] != '!') { name[0] = 0;# fid0 = fid1 = fid2 = 0;# did0 = did1 = did2 = 0;3 sscanf(&line[2],"%s %d %d %d %d %d %d",= name,&fid0,&fid1,&fid2,&did0,&did1,&did2); } if (line[0] == '!') { /*% ** comment line - ignore */ } else if (line[0] == 'c') { /* ** child */# nptr = grab_node(name);' nptr->fid[0] = (short)fid0;' nptr->fid[1] = (short)fid1;' nptr->fid[2] = (short)fid2;' nptr->did[0] = (short)did0;' nptr->did[1] = (short)did1;' nptr->did[2] = (short)did2;  ptr->child = nptr;) load_node_from_file(nptr,fp); } else if (line[0] == 's') { /* ** I've a sister */# nptr = grab_node(name);' nptr->fid[0] = (short)fid0;' nptr->fid[1] = (short)fid1;' nptr->fid[2] = (short)fid2;' nptr->did[0] = (short)did0;' nptr->did[1] = (short)did1;' nptr->did[2] = (short)did2; ptr->sister = nptr;1 return(load_node_from_file(nptr,fp)); } else if (line[0] == 'n') { /*$ ** I've no more sisters */ return(TRUE); } else return(FALSE); }}save_nodes(d,verbal)DSTRUCTURE *d; int verbal;{ FILE *fp; char my_spec[SPEC_SIZE+1]; char trans[SPEC_SIZE+1]; if (verbal) {G sprintf(junk,"Saving %s directory information...",d->dir_name); message(junk); sleep(1); } d->to_be_saved = FALSE; fp = NULL; 3 sprintf(trans,"SWING$SAVE:%s",d->save_file_ss); if (access(trans,0) == 0) delete_a_file(trans);, fp = fopen(trans,"w","fop=cbt","alq=8"); if (fp == NULL) {- if (access(d->save_file_away,0) == 0)- delete_a_file(d->save_file_away);< fp = fopen(d->save_file_away,"w","fop=cbt","alq=8"); if (fp == NULL) {- delete_a_file(d->save_file_home);@ fp = fopen(d->save_file_home,"w","fop=cbt","alq=8"); if (fp == NULL) {@ warning("Unable to save directory information"); return(FALSE); } } } fprintf(fp,"!\n");A fprintf(fp,"! SWING save file - this file contains the\n");@ fprintf(fp,"! directory structure information used by\n");> fprintf(fp,"! %s, a directory manager tool.\n",VERSION); fprintf(fp,"!\n");* fprintf(fp,"! User %s\n",this_user); fprintf(fp,"!\n");, fprintf(fp,"! Root %s\n",d->dir_name); fprintf(fp,"!\n");= fprintf(fp,"! The file may be deleted if required.\n"); fprintf(fp,"!\n");* fprintf(fp,"m %s %d %d %d %d %d %d\n", d->fnp->name, d->fnp->fid[0], d->fnp->fid[1], d->fnp->fid[2], d->fnp->did[0], d->fnp->did[1], d->fnp->did[2]); save_node(d->fnp,fp); fclose(fp); if (verbal) message("");}save_node(nptr,fp) NODE *nptr; FILE *fp;{ /*: ** lost child = child (but not linked into structure) */ if (nptr->lost) {. fprintf(fp,"c %s %d %d %d %d %d %d\n",! nptr->lost->name,# nptr->lost->fid[0],# nptr->lost->fid[1],# nptr->lost->fid[2],# nptr->lost->did[0],# nptr->lost->did[1],$ nptr->lost->did[2]);! save_node(nptr->lost,fp); } /* ** child */ if (nptr->child) {. fprintf(fp,"c %s %d %d %d %d %d %d\n",# nptr->child->name,% nptr->child->fid[0],% nptr->child->fid[1],% nptr->child->fid[2],% nptr->child->did[0],% nptr->child->did[1],& nptr->child->did[2]);" save_node(nptr->child,fp); } /* ** sisters */ if(nptr->sister) {. fprintf(fp,"s %s %d %d %d %d %d %d\n",# nptr->sister->name,% nptr->sister->fid[0],% nptr->sister->fid[1],% nptr->sister->fid[2],% nptr->sister->did[0],% nptr->sister->did[1],& nptr->siG," SWING_SRC.BCK45-$[MATS.PROG.SWING.C_SWING]SWING_4.C;2K:ster->did[2]);# save_node(nptr->sister,fp); nptr = nptr->sister; } else { /* ** no more sisters */ fprintf(fp,"n\n"); } return(TRUE);} $*[MATS.PROG.SWING.C_SWING]SWING_5.C;4+,4.$/(< 4X$!--0123KPWO%563 7 F9ג8}‚k9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:42.724** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**!** File : SWING_5.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /* ** swing_5*/#include stdio#include smgdef#include ssdef#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"delete_node(del_ptr, del_level)LINE *del_ptr;int del_level;{ NODE *dn,*ds;# dn = del_ptr->n_ptr[del_level]; ds = dn->sister; /*5 ** remove from structure and replace with sister */$ if (del_ptr->n_ptr[del_level-1]) { /* ( ** dn is a child - has a parent */0 del_ptr->n_ptr[del_level-1]->child = ds; } else { /*# ** dn is somebody's sister5 ** link my older sister to my younger sister */ do { /*7 ** back up a line looking for older sister */( del_ptr = del_ptr->back_ptr;0 } while(del_ptr->n_ptr[del_level] == 0);/ del_ptr->n_ptr[del_level]->sister = ds; } dn->sister = 0; }"add_node(add_ptr, add_level, node)LINE *add_ptr;int add_level; NODE *node;{ NODE *pn;# pn = add_ptr->n_ptr[add_level]; if (!pn->child) { /*B ** if we have no child then the new boy becomes our child */ pn->child = node; } else/ if (strcmp(pn->child->name,node->name) > 0) {! node->sister = pn->child; pn->child = node; } else { /*: ** tie him into our sisters, hopefully preserving ** alphabetical order */ pn = pn->child;F while(pn->sister && (strcmp(pn->sister->name,node->name) < 0)) { pn = pn->sister; }" node->sister = pn->sister; pn->sister = node; }}1move_node(new_ptr, new_level, old_ptr, old_level)LINE *new_ptr, *old_ptr;int new_level, old_level;{ NODE *node;% node = old_ptr->n_ptr[old_level];$ delete_node(old_ptr, old_level);' add_node(new_ptr, new_level, node);}delete_dirs(option) int option;{ if (!current_level) {0 warning("Can't delete main directory"); return(FALSE); }  4 show_deleting(curr_l_ptr->n_ptr[current_level],- DELETING_RENDITION,FALSE);C if (!confirm_user("Delete these directories Y/N [N] ?","Y") ||Q !confirm_user("LAST CHANCE - Really delete these directories Y/N [N] ?", "Y")) {J show_deleting(curr_l_ptr->n_ptr[current_level],NORMAL_RENDITION);? render(current_line, current_level,SPECIAL_RENDITION); return(FALSE); } else { NODE *node;) int line,level,i,status,channel; char dir[SPEC_SIZE+1];F sprintf(dir,"[-]%s%s",curr_l_ptr->n_ptr[current_level]->name, ".dir;1"); /*H ** now try to delete this directory and all sub-dirs and files ** therein */Q delete_many_files(curr_l_ptr->n_ptr[current_level],TRUE,DELETE,"*.*;*");, curr_l_ptr->dp->to_be_saved = TRUE;1 node = curr_l_ptr->n_ptr[current_level]; /*J ** now return node storage used by all the children of this node */! free_nodes(node->child); /*? ** make a note of where we are for possible later use */ line = current_line; level = current_level; if (access(dir,0) == 0) { /*! ** dir still exists **J ** search out undeleted dirs owned by this dir, linking them% ** in to the node lists */D warning("some files were not deleted - searching ..."); node->child = 0; /*1 ** assign channel to current device */@ status = sys$assign(DSC1("SYS$DISK"),&channel,0,0);& if (status != SS$_NORMAL): panic(status,"sys$asign","search nodes");$ get_dirs(node,channel);* status = sys$dassgn(channel);& if (status != SS$_NORMAL); panic(status,"sys$dassgn","search nodes");8 message("some files were not deleted ..."); } else { /*! ** dir is not there */9 message("Directories and contents deleted"); /*4 ** unlink node from the node structure */3 delete_node(curr_l_ptr,current_level); /*J ** now determine current field - parent of the node we just  ** deleted */ current_level--;5 while(!curr_l_ptr->n_ptr[current_level]) {3 curr_l_ptr = curr_l_ptr->back_ptr; current_line--; } /*/ ** free storage used by this node */& remove_visited_dir(node); free(node); /*$ ** record where we are */! line = current_line;# level = current_level; } /*I ** now rebuild the lines and the display, 99% chance that it's G ** changed, and even if not we want to be sure that we show what" ** we believe to be true */ load_lines(); current_line = line; current_level = level;% curr_l_ptr = first_line_ptr;# for (i = 0; i < line; i++)/ curr_l_ptr = curr_l_ptr->forw_ptr; /*: ** refresh output and change def dir accordingly */ repair_display();> set_default(curr_l_ptr->n_ptr[current_level]->dir_name); }} add_dirs(){& if (current_level < MAX_ADD_LEVEL) { NODE *node, *this_node; int i, status; int line, level; short fid[3]; char name[NAME_SIZE+1]; char dir[SPEC_SIZE+1];J if (get_user_input("New directory name ? [NONE] ",name,NAME_SIZE)) {* H." SWING_SRC.BCK4-$[MATS.PROG.SWING.C_SWING]SWING_5.C;4X$a  if (strpbrk(name,".") != NULL) {G warning("You can only create one directory at a time"); return(FALSE); } /*% ** point to current node */9 this_node = curr_l_ptr->n_ptr[current_level]; /*4 ** build up the new dir string in form ; ** [existing.new_dir] ready for lib$create_dir */, strcpy(dir,this_node->dir_name);? sprintf(&dir[strlen(dir)-1],"%c%s%c",'.',name,']'); /*> ** if we can't add it then the new name is rotten *// status = lib$create_dir(DSC1(dir));> if (status != SS$_NORMAL && status != SS$_CREATED) {B sprintf(junk,"%s - can't create directory %s%s%s",D full_error_text(status),"[.",name,"]"); warning(junk); return(FALSE); } /*' ** directory already there */% if (status == SS$_NORMAL) {? sprintf(junk,"directory %s%s%s already exists",, "[.",name,"]"); warning(junk); return(FALSE); } /* ** we created it */9 sprintf(junk,"Created %s%s%s","[.",name,"]"); message(junk);/ curr_l_ptr->dp->to_be_saved = TRUE; /*9 ** build up node, hand build dir name and fid */# node = grab_node(name);  /*' ** directory specification */' strcpy(node->dir_name,dir); /*( ** get fid of new directory */# get_did(dir,node->fid); /*" ** load up parent fid */- node->did[0] = this_node->fid[0];- node->did[1] = this_node->fid[1];- node->did[2] = this_node->fid[2];6 add_node(curr_l_ptr, current_level, node); /* ** rebuild lines */ line = current_line;" level = current_level; load_lines(); repair_display(); current_line = line;" current_level = level;( curr_l_ptr = first_line_ptr;& for (i = 0; i < line; i++)2 curr_l_ptr = curr_l_ptr->forw_ptr; } }  else warning("Not possible");} rename_dir(){ if (current_level) { NODE *node; int i; char name[NAME_SIZE+1];# char old_name[SPEC_SIZE+1];# char new_name[SPEC_SIZE+1];# char ren_name[SPEC_SIZE+1];J if (get_user_input("New directory name ? [NONE] ",name,NAME_SIZE)) { /*1 ** now try the rename via lib_rename */4 node = curr_l_ptr->n_ptr[current_level];< sprintf(old_name,"[-]%s%s",node->name,".dir;1");6 sprintf(new_name,"[-]%s%s",name,".dir;1"); #ifdef debug@ sprintf(junk,"lib_rename(%s,%s)",old_name,new_name); message(junk); #endif 7 i = lib_rename(old_name,new_name,ren_name); if (i != SS$_NORMAL) {< sprintf(junk,"%s - failed to rename %s%s%s",@ full_error_text(i),"[.",node->name,"]"); warning(junk); return(FALSE); }/ curr_l_ptr->dp->to_be_saved = TRUE; /*A ** find name from ren_name - strip off .type;version */2 for (i = 0; i < strlen(ren_name); i++)' if (ren_name[i] == '.') {$ ren_name[i] = 0; break; }" strcpy(name,ren_name);( give_node_a_name(node,name);3 delete_node(curr_l_ptr, current_level); /*$ ** now travel to parent */ current_level--;4 while(!curr_l_ptr->n_ptr[current_level]) { /*" ** go back a line */2 curr_l_ptr = curr_l_ptr->back_ptr; current_line--; }6 add_node(curr_l_ptr, current_level, node); /* ** rebuild lines */ load_lines();  /*> ** now find new line, level etc. for renamed node */( curr_l_ptr = first_line_ptr;N for (current_line = 0; current_line < total_lines; current_line++) {( for (current_level = 0; 0 current_level < MAX_LEVEL; % current_level++) {A if (curr_l_ptr->n_ptr[current_level] == node) {1 return(repair_display()); } }2 curr_l_ptr = curr_l_ptr->forw_ptr; } } }  else0 warning("Cannot rename main directory");} move_dir(){ if (current_level) { int i,j; char name[NAME_SIZE+1];& NODE *init_node, *parent_node;# LINE *init_line_ptr, *temp;" int init_line, init_level;# char old_name[SPEC_SIZE+1];# char new_name[SPEC_SIZE+1];# init_line_ptr = curr_l_ptr;% init_line = current_line;& init_level = current_level;9 init_node = curr_l_ptr->n_ptr[current_level]; travel_to_dir(); message_set = 0; if (next_command(FALSE)) { /*B ** user selected a new parent node - oh joy oh wonder */; parent_node = curr_l_ptr->n_ptr[current_level]; /*( ** find init_node full spec */1 strcpy(old_name,init_node->dir_name);6 for (i = strlen(old_name) - 1; i > 0; i--) {' if (old_name[i] == '.') {& old_name[i] = ']';& old_name[i+1] = 0; break; } }G sprintf(&old_name[strlen(old_name)],"%s%s",init_node->name, ".dir;1");  /** ** find parent_node full spec */3 strcpy(new_name,parent_node->dir_name);L sprintf(new_name,"%s%s%s",parent_node->dir_name,init_node->name, ".dir;1");0 i = lib_rename(old_name,new_name,0); if (i != SS$_NORMAL) {: sprintf(junk,"%s - failed to move %s%s%s",E full_error_text(i),"[.",init_node->name,"]"); warning(junk); } else { /*8 ** make sure both structures get updated */0 curr_l_ptr->dp->to_be_saved = TRUE;6 init_line_ptr->dp->to_be_saved = TRUE; /*A ** give init_node the old heave-hoh for a moment */7 delete_node(init_line_ptr, init_level);  /*> ** and add into the structure as the child of */? add_node(curr_l_ptr, current_level, init_node); /** ** node has now a new did */8 init_node->did[0] = parent_node->fid[0];8 init_node->did[1] = parent_node->fid[1];8 init_node->did[2] = parent_node->fid[2]; } /* ** rebuild lines */ load_lines();  /*" ** clear message line */ message(Iy" SWING_SRC.BCK4-$[MATS.PROG.SWING.C_SWING]SWING_5.C;4X$""); } else warning("aborted"); /*: ** now find new line, level etc. for renamed node& ** we might not have moved it */$ curr_l_ptr = first_line_ptr;J for (current_line = 0; current_line < total_lines; current_line++) {? for (current_level = 0; current_level < MAX_LEVEL; ! current_level++) {B if (curr_l_ptr->n_ptr[current_level] == init_node) {- return(repair_display()); } }. curr_l_ptr = curr_l_ptr->forw_ptr; } /*" ** not found - put cursor at top */$ curr_l_ptr = first_line_ptr; current_line = 0; current_level = 0; repair_display();  }  else. warning("Cannot move main directory");} purge_dirs(){ int status;4 show_deleting(curr_l_ptr->n_ptr[current_level],- DELETING_RENDITION,FALSE);*? if (confirm_user("Purge these directories Y/N [N] ?","Y")) {X if (confirm_user("LAST CHANCE - Really purge these directories Y/N [N] ?","Y")) {T delete_many_files(curr_l_ptr->n_ptr[current_level],TRUE,PURGE,"*.*;*"); message("purged"); } }L3 show_deleting(curr_l_ptr->n_ptr[current_level], * NORMAL_RENDITION,FALSE);9 render(current_line,current_level,SPECIAL_RENDITION);*}****** Change Hi$*[MATS.PROG.SWING.C_SWING]SWING_6.C;6+,4 ./(< 4[ --0123KPWO56 ]p7p89`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:47.844** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**!** File : SWING_6.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /* ** swing_6*/#include ssdef#include stdio#include ctype#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"#include "trmdef.h"static int key_table;confirm_user(text,check)char *text,*check;{ int i,size,length; int modifiers; char answer[12]; size = strlen(check); length = 0; /* ** delete to eol */$ smg$erase_line(&displayb,&1,&1);( smg$set_cursor_abs(&displayb,&1,&1);" modifiers = TRM$M_TM_NORECALL; smg$read_string(&keyboard," DSCA1(answer), DSC2(text), &size, &modifiers, 0, 0, &length, 0, &displayb); message(""); /* ** make it all upper case */ answer[length] = 0; ( for (i = 0; i < strlen(answer); i++)( answer[i] = _toupper(answer[i]);' for (i = 0; i < strlen(check); i++)& check[i] = _toupper(check[i]); /*L ** did user enter a match ? we'll bomb if any entered chars don't match */ if (strlen(answer) == 0 || 2 strncmp(check,answer,strlen(answer)) != 0) return(FALSE); return(TRUE);},get_user_input_with_prompt(text,string,size)char *text,*string; int size;{ int i,length; char tmp[SCREEN_WIDTH+1]; /** ** clear bottom line if message there */ if (message_set) message(""); /*' ** now solicit input from the user */( smg$set_cursor_abs(&displayb,&1,&1); tmp[0] = 0; length = 0; smg$read_string(&keyboard, DSCA1(tmp), DSC2(text), &size,) &(TRM$M_TM_NORECALL), 0, 0, &length, 0,  &displayb," DSC3(string)); tmp[length] = 0; message(""); /*! ** strip off trailing spaces) for (i = strlen(tmp) - 1; i > 0; i++) { if (tmp[i] != ' ') { tmp[i+1] =0; break; } } */ /*) ** make sure output goes into string */ strcpy(string,tmp);( for (i = 0; i < strlen(string); i++)( string[i] = _toupper(string[i]); /* ** no input = FALSE */ if (!tmp[0]) return(FALSE); else return(TRUE);} get_user_input(text,string,size)char *text,*string; int size;{ string[0] = 0; 9 return(get_user_input_with_prompt(text,string,size));} warning(text) char *text;{ message(text); ding(displayb); sleep(3);} ding(display) int display;{ smg$ring_bell(&display,&2);}show_version(){ message(VERSION);} please_wait(){ message("Please wait ...");}files_so_far(x)int x;{6 sprintf(junk,"Please wait ... files so far %d",x); message(junk);}travel_to_dir(){W message("Travel to new parent directory and select by pressing DEL, or Q to Quit");J/* message("Travel to new parent directory and select by pressing RETURN,' or Q to Quit"); Changed by Mats*/ message_set = 0;}travel_to_dir_remote(){[ message("Travel to new parent, press DEL to start copying, > to export, or Q to Quit"); message_set = 0;} cont_update(){) message("Continual update mode ...");}no_files(node) NODE *node;{ sprintf(junk,5 "No files [%s] in this [%c%s] directory", node->dir_spec, '.', node->name); message(junk);}warning_no_files(node) NODE *node;{C sprintf(junk,"No files in this directory [%s]",node->dir_spec); warning(junk);}no_directories(){9 message("No directory files in this directory ... ");}structure_inconsistent(dir) char *dir;{( sprintf(junk,"%s Non-Existent",dir); warning(junk);}repair_display(){ /*9 ** we may have reduced size of display, so make sure) ** current top line is not too great */7 if (current_top_line > total_lines - DISPLAY1_ROWS)7 current_top_line = total_lines - DISPLAY1_ROWS; /* ** or too small */ if (current_top_line < 0) { current_top_line = 0; } /*4 ** switch off cursor - it looks neater that way */# smg$set_cursor_mode(&paste,&1);+ if (current_line >= current_top_line &&? current_line <= (current_top_line + DISPLAY1_ROWS - 1)) { refresh_display(); }- else if (current_line > current_top_line) {F while(current_line > (current_top_line + DISPLAY1_ROWS - 1) &&? current_top_line < (total_lines - DISPLAY1_ROWS)) { current_top_line++; } refresh_display(); }- else if (current_line < current_top_line) {0 while(current_line < current_top_line && current_top_line) { current_top_line--; }J7" SWING_SRC.BCK4 -$[MATS.PROG.SWING.C_SWING]SWING_6.C;6[fu refresh_display(); } /*3 ** switch on cursor - it looks neater that way */# smg$set_cursor_mode(&paste,&0);}$*[MATS.PROG.SWING.C_SWING]SWING_7.C;2+, . /(< 4E n--0123KPWO 56`07089G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:52.964** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**!** File : SWING_7.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB<** 21-JAN-1991 Minor Bugs MA?**************************************************************/ /* ** swing_7*/#include stdio #include rms#include ssdef#include lnmdef#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"#static load_node_names(ptr, so_far) NODE *ptr; char *so_far;{ char dir[SPEC_SIZE+1];4 sprintf(ptr->dir_name,"%s%s]",so_far,ptr->name); if (ptr->sister)- load_node_names(ptr->sister, so_far); if (ptr->child) {. sprintf(dir,"%s%s.",so_far,ptr->name);( load_node_names(ptr->child,dir); }}load_up_node_names(d)DSTRUCTURE *d;{ char device[SPEC_SIZE+1];$ sprintf(device,"%s[",d->device);$ load_node_names(d->fnp, device);}set_default(dir) char *dir;{ int i, status, flag, length; char device[SPEC_SIZE+1]; char directory[SPEC_SIZE+1]; struct itmlst { short buffer_length; short item_code; long buffer_address; long return_length_address; long terminator; } item_list; /* ** set dir if specified */ strcpy(directory,dir);E if (strstr(directory,"[000000") && !strstr(directory,"[000000]")) { int i=0;& while (directory[i++] != '[');. strcpy(&directory[i],&directory[i+7]);& while (directory[i++] != ']'); directory[i] == 0; }  status = chdir(directory); if (status) {* structure_inconsistent(directory); return(FALSE); } /*3 ** we'll say SS$_NORMAL instead of RMS$_NORMAL */ status = SS$_NORMAL; /*0 ** set SYS$DISK up to be the current device5 ** we must if we want to swing to another device */ strcpy(device,dir); /*2 ** trim away the directories - leave the disk */ flag = 0;* for (i = 0 ; i < strlen(device) ; i++) { if (device[i] == '[') { /*& ** beginning of directory */ device[i] = 0; /*9 ** don't update unless we have to - save cpu */< if (sys_disk[0] && strcmp(sys_disk,device) == 0) goto way_out; /*6 ** now set SYS$DISK to device, our device */ if (strlen(device)) {( strcpy(sys_disk,device);: status = lib$set_logical(DSC1("SYS$DISK"),7 DSC2(device));D if (status != SS$_NORMAL && status != SS$_SUPERSEDE)9 panic(status,"sys$crelnm","set def"); } break; } } way_out:; return(SS$_NORMAL);}%show_deleting(nptr,rendition,sisters) NODE *nptr;int rendition; int sisters;{ /*< ** make display better by using batch pasteboard update */( smg$begin_pasteboard_update(&paste);, show_deleting_1(nptr,rendition,sisters);& smg$end_pasteboard_update(&paste);}'show_deleting_1(nptr,rendition,sisters) NODE *nptr;int rendition; int sisters;{ if (nptr) {1 show_deleting_1(nptr->child,rendition,1);3 render(nptr->line, nptr->level, rendition); if (sisters)6 show_deleting_1(nptr->sister,rendition,1); }}$*[MATS.PROG.SWING.C_SWING]SWING_8.C;8+,4.r/(< 4brq--0123KPWOs56K.f7 VL.f89`6-G(<HJ ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:09:57.324** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**!** File : SWING_8.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /* ** swing_8 file manager*/#include iodef#include ssdef#include stdio #include rms#include smgdef#include smgmsg#include "swing.h"#include "swing_refs.h"#include "more_descrip.h"#include "strdef.h" #define MAX_LAST_VISITED_DIRS 20#define STAY_HERE 2(static NODE *lvd[MAX_LAST_VISITED_DIRS];static char banner[133];!swing_files(n,filename,file_type)NODE *n;char *filename;int file_type;{% int i,flen,len, status, original; FILER *f; /*7 ** build up a list of the files in this directory  **K ** if file_type == SHOW_FILES list is non-dirs, else list is just dirs */ original = TRUE; cursor_line = -1; files_selected = 0;' first_file_ptr = curr_file_ptr = 0; total_files = 0; curr_file_no = 0; curr_top_file = 0; /* ** no checksum */ n->checksum = 0; /*) ** assign a directory to this device */ dir_channel = 0;) status = sys$assign(DSC1("SYS$DISK"),% &dir_channel, 0, 0); if (status != SS$_NORMAL)1 panic(status,"sys$assign","swing_files");  /*+ ** make a banner - file spec in centre */# construct_centre_banner(banner,A curr_l_ptr->n_ptr[current_level]->dir_name); /* ** dig out the files */ please_wait(); get_dir_files(n,file_type); /* ** if dir not empty */ if (total_files) { /*& ** put at top of visited list */$ if (file_type == SHOW_FILES) top_visited_dir(n); /*I ** get a chKDE" SWING_SRC.BCK4-$[MATS.PROG.SWING.C_SWING]SWING_8.C;8br ecksum for this dir - n.b. this'll fail for the root, ** but what the hell */& n->checksum = get_checksum(n); /*# ** title, sub_title, erase */$ if (file_type == SHOW_FILES) title(FTITLE); else title(DTITLE);! sub_title_normal(banner);) i = smg$erase_display(&displayf); if (i != SS$_NORMAL)3 panic(i,"erase display","swing files"); /* ** advertising */( file_manager_label(file_type,n); if (i != SS$_NORMAL); panic(i,"label border displayf","swing files"); /* ** turn on the display */P i = smg$paste_virtual_display(&displayf,&paste,&DISPLAYF_Y,&DISPLAYF_X); if (i != SS$_NORMAL)+ panic(i,"paste","swing files"); /*C ** if user supplied a filename we'll try to set the cursor ** to point to it */ if (filename[0]) { /*0 ** try to set cursor onto this file) ** so set curr_file_no to it */ f = first_file_ptr; for (i = 0; f; i++) { /*! ** did we get it */6 if (strcmp(filename,f->filename) == 0) { /* ** yes */% curr_file_no = i; break; }M else if (strncmp(filename,f->filename,strlen(filename)) == 0) { /*H ** getting there - we may not have a version number */% curr_file_no = i;$ f = f->forw_ptr; } else$ f = f->forw_ptr; } } /*# ** show what we have found */ & show_files(TRUE,FILE_MANAGER); /* ** clear bottom line */ message(""); /*$ ** get user to do something */3 next_file_command(n, file_type, &original); /* ** free up storage */# free_files(first_file_ptr); /*/ ** clear sub-title, display main title */ sub_title_underline(""); title(MTITLE); /*1 ** ensure we're in the right directory */ if (!original) { set_init_position(); refresh_display(); } /*" ** switch off the display */6 smg$unpaste_virtual_display(&displayf,&paste); } else /* ** no files found */$ if (file_type == SHOW_FILES) no_files(n); else no_directories();% status = sys$dassgn(dir_channel); if (status != SS$_NORMAL)3 panic(status,"sys$dassgn","get_dir_files");}/*** label the display*/"file_manager_label(file_type,node)int file_type; NODE *node;{ int i, status;# int used, permanent, overdraft; char device[SPEC_SIZE+1]; if (file_type == SHOW_FILES) { /*! ** get quota information */& strcpy(device,node->dir_name);( device[strcspn(device,"[")] = 0;' status = get_user_quota(device,' &used, ) &permanent, &overdraft);! if (status == SS$_NORMAL) { sprintf(junk,= " FILE MANAGER %s QUOTA %d USED %d ",# node->dir_spec, permanent, used); } else { sprintf(junk,) " FILE MANAGER %s ",$ node->dir_spec); }  } else {2 strcpy(junk," FILE MANAGER (DIRECTORIES ONLY) "); } smg$label_border(&displayf, DSC1(junk), &SMG$K_TOP, 0,' &(SMG$M_REVERSE));}/*B** main body of the file manager - prompt the user for input and ** then do some processing**/** file_type is either SHOW_FILES or SHOW_DIRS*/)next_file_command(n, file_type, original)NODE *n;int file_type;int *original;{ int key, i, status; char filename[SPEC_SIZE+1];# char new_filename[SPEC_SIZE+1];' char current_filename[SPEC_SIZE+1]; char dir_spec[NAME_SIZE+1]; NODE *orig_node; FILER *tmp; orig_node = n; while(1) {0 key = get_key(ALLOW_AUTO | ALLOW_CLOCK);+ if (key == SMG$K_TRM_QUESTION_MARK)0 key = files_menu_options(file_type); if (!key) continue; /*D ** if this isn't the SELECT key we'll make this dir the top# ** dir in the visited list */' if (file_type == SHOW_FILES && & key != SMG$K_TRM_SELECT &&" key != SMG$K_TRM_FIND) top_visited_dir(n); /*7 ** we could be processing directories or files */ switch(key) {case SMG$K_TRM_AT_SIGN:% protect_files(n,file_type,TRUE); break;case SMG$K_TRM_TILDE:& protect_files(n,file_type,FALSE); break;case SMG$K_TRM_PERCENT_SIGN:' if (file_type == SHOW_DIRS) { ding(displayb); break; } if (!files_selected) { message("No files selected"); break; }M if (!confirm_user("DEFRAGMENT the selected files ? Y/N [N]","Y")) break;b if (!confirm_user("LAST CHANCE - really DEFRAGMENT the selected files ? Y/N [N]","Y")) break; /*, ** save where we are in this directory */; curr_file_ptr = current_file_ptr(curr_file_no);= strcpy(n->last_filename,curr_file_ptr->filename);! if (defragment_directory(n)) { n->checksum = 0;) reasses_files(file_type, ! n, 0 n->last_filename); } break;case SMG$K_TRM_AMPERSAND: show_quotas(n); break;case SMG$K_TRM_FIND:case SMG$K_TRM_SELECT:' if (file_type == SHOW_DIRS) { ding(displayb); break; } /*, ** save where we are in this directory */; curr_file_ptr = current_file_ptr(curr_file_no);= strcpy(n->last_filename,curr_file_ptr->filename); /*H ** find next entry in the list after the current node where0 ** there are some files in the node ** orM ** find previous entry in the list before the current node where0 ** there are some files in the node */ { NODE *n_tmp; int cnt;A for (cnt = 0; cnt < MAX_LAST_VISITED_DIRS; cnt++) {0 if (key == SMG$K_TRM_SELECT)4 n_tmp = next_visited_dir(n); else8 n_tmp = previous_visited_dir(n);+ if (n_tmp == orig_node)) *original = TRUE; else *original = FALSE;3 construct_centre_banner(banner,= n_tmp->dir_name); sub_title_normal(banner);/ if (cnt == 0 && n_tmp == n) break; /*; ** deassign dir_channel and assign to the new device */5 status = sys$dassgn(dir_channel);- if (status != SS$_NORMAL)GLM(" SWING_SRC.BCK4-$[MATS.PROG.SWING.C_SWING]SWING_8.C;8br  panic(status,"sys$dassgn","next_file_command"); /*, ** extract device from directory name */# strcpy(junk,n_tmp->dir_name);0 junk[strcspn(junk,"[")] = 0;3 status = sys$assign(DSC1(junk),5 &dir_channel,* 0,+ 0);- if (status != SS$_NORMAL)G panic(status,"sys$assign","next_file_command"); n_tmp->checksum = 0;. reasses_files(SHOW_FILES, * n_tmp, 9 n_tmp->last_filename);% if (!total_files) {A strcpy(n_tmp->dir_spec,DEFAULT_DIR_SPEC); n_tmp->checksum = 0;2 reasses_files(SHOW_FILES, - n_tmp, < n_tmp->last_filename); }$ if (total_files) { /*- ** there are some files in this directory1 ** we'll set def here, and also the init posn' ** for the directory manager - this6 ** is so that when we use copy files or move files) ** we are shown the correct directory */ n = n_tmp;1 set_default(n->dir_name); set_init_position(); refresh_display(); break; } /*6 ** let the user see that there aren't any files */ sleep(1);. remove_visited_dir(n_tmp); } /* ** no files nowhere */# if (cnt == MAX_LAST_VISITED_DIRS) return(TRUE); } break;case SMG$K_TRM_LOWERCASE_V:case SMG$K_TRM_UPPERCASE_V:' if (file_type == SHOW_DIRS) { ding(displayb); break; } /* ** software version */ show_version(); break;case SMG$K_TRM_CTRLD: /*J ** user definable options, TRUE ==> we're in the file manager */; curr_file_ptr = current_file_ptr(curr_file_no); user_options(TRUE,1 curr_file_ptr->filename, n,$ file_type);? reasses_files(file_type,n,curr_file_ptr->filename);! if (total_files == 0) { no_files(n); return(TRUE); } title(FTITLE);% sub_title_normal(banner);* show_files(TRUE,FILE_MANAGER); break;case SMG$K_TRM_EQUAL:' if (file_type == SHOW_DIRS) { ding(displayb); break; }) strcpy(dir_spec,n->dir_spec);% if (!get_new_dir_spec(n)) break; /*J ** read the directory for files - make sure we don't checksum */ n->checksum = 0;1 tmp = current_file_ptr(curr_file_no);5 reasses_files(file_type,n,tmp->filename);! if (total_files == 0) { /*2 ** restore previous search string */$ warning_no_files(n);- strcpy(n->dir_spec,dir_spec);0 file_manager_label(file_type,n); n->checksum = 0;9 reasses_files(file_type,n,tmp->filename);% if (total_files == 0) { no_files(n);! return(TRUE); } } break;case SMG$K_TRM_CARET: /*$ ** enter continual update mode */ continual_update = TRUE;case SMG$K_TRM_UPPERCASE_F:case SMG$K_TRM_LOWERCASE_F: /*P ** read the directory for files again - make sure we don't checksum ** */ n->checksum = 0;1 tmp = current_file_ptr(curr_file_no);5 reasses_files(file_type,n,tmp->filename);! if (total_files == 0) { no_files(n); return(TRUE); }' if (key == SMG$K_TRM_CARET) cont_update(); break;case SMG$K_TRM_UPPERCASE_O:case SMG$K_TRM_LOWERCASE_O: /*) ** show the broadcast screen */ show_broadcasts();? reasses_files(file_type,n,curr_file_ptr->filename);! if (total_files == 0) { no_files(n); return(TRUE); } break;case SMG$K_TRM_PLUS_SIGN: /*! ** select some files */ query_files(TRUE); break;case SMG$K_TRM_DASH: /*$ ** de-select some files */ query_files(FALSE); break;case SMG$K_TRM_UPPERCASE_U:case SMG$K_TRM_LOWERCASE_U:' if (file_type == SHOW_DIRS) { ding(displayb); break; } /* ** purge the files */1 tmp = current_file_ptr(curr_file_no);3 strcpy(current_filename,tmp->filename);* if (purge_files(n))*< reasses_files(file_type,n,current_filename);! if (total_files == 0)= {= no_files(n); return(TRUE); }  break;case SMG$K_TRM_UPPERCASE_H: case SMG$K_TRM_LOWERCASE_H:  /*' ** help from the help file  */. swing_help("SWING COMMANDS FILE"); break;case SMG$K_TRM_DOLLAR_SIGN:* /* ** DCL sub-process= */1 tmp = current_file_ptr(curr_file_no);I3 strcpy(current_filename,tmp->filename);- execute_dcl("");8 reasses_files(file_type,n,current_filename);! if (total_files == 0)* {* no_files(n); return(TRUE);u }u break; case SMG$K_TRM_UPPERCASE_A:ucase SMG$K_TRM_LOWERCASE_A:" /*$ ** select all the files */ add_files();* show_files(TRUE,FILE_MANAGER); break;case SMG$K_TRM_UPPERCASE_R:acase SMG$K_TRM_LOWERCASE_R:(' if (file_type == SHOW_DIRS)i {i ding(displayb);  break; }  /*- ** rename all the selected files  */ if (rename_files(n)) {i5 tmp = current_file_ptr(curr_file_no);s7 strcpy(current_filename,tmp->filename);p< reasses_files(file_type,n,current_filename);% if (total_files == 0)  {k no_files(n);! return(TRUE);o } }_ break;case SMG$K_TRM_UPPERCASE_C:Kcase SMG$K_TRM_LOWERCASE_C: ' if (file_type == SHOW_DIRS), {  ding(displayb);  break; }$ /*' ** copy the selected filesb */1 tmp = current_file_ptr(curr_file_no);a3 strcpy(current_filename,tmp->filename);t. status = move_files(n,COPY_FILES); if (status == TRUE)i {i< reasses_files(file_type,n,current_filename);% if (total_files == 0)  { no_files(n);! return(TRUE);_ } }() else if (status == STAY_HEMf.mx 3 .gt5+>(K\7Z*U"/) Vb ^31f`\V%A,7vvz77RD\%/.CZ9f  ]omn2alWGx)aekReC^&W8><2nlR#O#ZQf C*?+p<'u>*c& f54J5xRBYA=/kA40.q<)\N<zp{D[ZdLi$XPyS?N*2xicIG!BmEe84uU \^|`X. ,/BeVr fw;0#py2lp`_hw"bKr4 !yT twb_ & oT10jKn &irvut{uYV@XZQ!6r7&Pl (> wJ<_'NH|#;=&)(;J"4q2)SUeNy,bj^ e:TJ$i5[UUU?)&:i]s~U6X#Xc4/ [ ;8v6RliKGq6/d~b/I+<Ej;e18 uP?&YTX7S)|iFUmk=ocgXx8U$Y/7$(yP4e[V@|p]_pvK{ sTk y 7,-^3 =8wK3A*vQP3OYa#d#}6%Fi,h}&ax-)_z6xuC~+WTBz3pf} (I@p?l&@`,lh W5?rgvKIaU_ngnO_Bz0n6;7RL_]LB*9J{;7 fgBދ!9`l ]>쉏.e1FmIT LGBP[ph2%{%=87n{&zqE"!G^9s)wTB};teX 2<8Mhp[f&(@!9Vf!v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} :??,2p4:' !Z'!rzvVmmWFmC{ $`X5jj$2@s{c9OV[DS^_BU^gvD,q?UROIY|)o c&\UjK{iBi}=I|WaWS z;w xrn#BucU&k RN,ՑK`v:66pRrmJx"YL-%PHs'0xt:NV4@NLGd!e)x(8+7wDuNJO`6ItiiFSS[nNtqK_h@\<>@-T&kowl{`?>Xvn$oNslVYRQfCx[q$[uitC$ph8UJh $H~Qzc35Q<0aQ8"8\ hhl)n3VIb#j?D ~;.* /3RmI<& rEsYdhmTXb`+U3@1+%xcm61xI}D[K#zxrN/(}'U[F|}#n pjvSfxd=w{! r}j@r$j$3,s0e2!Fh0DTb"1_g ]Es--(p|03,/klZv-D$,E6.! ([p; s\tNxf<9`je&)u1%1"L@;alyXtp~z%3v\s3+ &D3G $*MEXs)8b^020S/28?hh8QX Mr3x[i;{l 90d6BdP)[^$j l]U? N3'~< pl6>=g <t#xXEZD|97Dd~ $)ip o9`Hnmfz85U{9i~Y@5Pl% 94l*k+S.)Ps{s$uir7Rj5AoYYd';in_filename);A. status = move_files(n,MOVE_FILES); if (status == TRUE) {n< reasses_files(file_type,n,current_filename);% if (total_files == 0)  {e no_files(n);! return(TRUE);i } }$" else if (status == STAY_HERE) return(STAY_HERE); break;case SMG$K_TRM_UPPERCASE_L:acase SMG$K_TRM_LOWERCASE_L:' if (file_type == SHOW_DIRS)i {e ding(displayb);  break; }  /*+ ** list (print) selected files* */2 sndjbc_files(PRINT_FILES,n->dir_name); break;case SMG$K_TRM_CTRLE:i' if (file_type == SHOW_DIRS); {  ding(displayb);  break; }  /* ** edit a new filef */ new_filename[0] = 0;A if (get_user_input("Input filename to edit ? [NONE]", , new_filename,* NAME_SIZE)) {i- if (parse_file(new_filename))) { 8 edit_file(n->dir_name,new_filename);< reasses_files(file_type,n,new_filename);) if (total_files == 0)o { $ no_files(n);% return(TRUE);  } } }  break;case SMG$K_TRM_UPPERCASE_E: case SMG$K_TRM_LOWERCASE_E:U' if (file_type == SHOW_DIRS)* {l ding(displayb);( break; }r /*% ** edit the current file( */; curr_file_ptr = current_file_ptr(curr_file_no); 7 if (access(curr_file_ptr->filename,0) == 0) {a5 tmp = current_file_ptr(curr_file_no);u7 strcpy(current_filename,tmp->filename); ? edit_file(n->dir_name,curr_file_ptr->filename);/< reasses_files(file_type,n,current_filename);% if (total_files == 0)  {* no_files(n);! return(TRUE);_ }s } else { M sprintf(junk,"%s is not accessable",curr_file_ptr->filename);  warning(junk); }o break;/* Type/less/more by Mats */case SMG$K_TRM_UPPERCASE_Y:Scase SMG$K_TRM_LOWERCASE_Y:t' if (file_type == SHOW_DIRS) {  ding(displayb);b break; }E /*% ** type the current filen */; curr_file_ptr = current_file_ptr(curr_file_no);I7 if (access(curr_file_ptr->filename,0) == 0)o {5 tmp = current_file_ptr(curr_file_no);s7 strcpy(current_filename,tmp->filename);(? more_file(n->dir_name,curr_file_ptr->filename); < reasses_files(file_type,n,current_filename);% if (total_files == 0)  { no_files(n);! return(TRUE);E } }> else {eM sprintf(junk,"%s is not accessable",curr_file_ptr->filename);  warning(junk); }I break;case SMG$K_TRM_UPPERCASE_X:pcase SMG$K_TRM_LOWERCASE_X: ' if (file_type == SHOW_DIRS) {L ding(displayb);d break; }C /*( ** execute the current file */1 tmp = current_file_ptr(curr_file_no); 3 strcpy(current_filename,tmp->filename);n; curr_file_ptr = current_file_ptr(curr_file_no);t; sprintf(filename,"%s",curr_file_ptr->filename);y" execute_dcl(filename);8 reasses_files(file_type,n,current_filename);! if (total_files == 0)n {C no_files(n); return(TRUE);r }S break;case SMG$K_TRM_UPPERCASE_D:case SMG$K_TRM_LOWERCASE_D:l' if (file_type == SHOW_DIRS)_ {O ding(displayb);T break; }i /*% ** delete selected files  */1 tmp = current_file_ptr(curr_file_no);E3 strcpy(current_filename,tmp->filename);n if (delete_files(n)) {tG reasses_files(file_type,n,current_filename); % if (total_files == 0)o { no_files(n);! return(TRUE); } } break;case SMG$K_TRM_UPPERCASE_Z:fcase SMG$K_TRM_LOWERCASE_Z:  /*# ** de-select all filess */ zap_files();* show_files(TRUE,FILE_MANAGER); break;case SMG$K_TRM_GREATER_THAN:' if (file_type == SHOW_DIRS)a {  ding(displayb);c break; }e /*9 ** export files to a remote node::device:dirN */; curr_file_ptr = current_file_ptr(curr_file_no);uA if (!remote_files(n->dir_name,files_selected,EXPORT))" break;J reasses_files(file_type,n,curr_file_ptr->filename); ! if (total_files == 0)c { no_files(n); return(TRUE); }f break;case SMG$K_TRM_LESS_THAN:n' if (file_type == SHOW_DIRS)_ {, ding(displayb);  break; }l /*< ** import a file from a remote node::device:dir */; curr_file_ptr = current_file_ptr(curr_file_no); A if (!remote_files(n->dir_name,files_selected,IMPORT))  break;J reasses_files(file_type,n,curr_file_ptr->filename); ! if (total_files == 0) {f no_files(n); return(TRUE);y }m break;case SMG$K_TRM_CTRLJ:*case SMG$K_TRM_UP: /* ** up-arrow */ if (curr_file_no)l { curr_file_no--;d1 if (curr_file_no < curr_top_file)  { < curr_top_file -= (3 * DISPLAYF_FILES)/4;2 show_files(TRUE,FILE_MANAGER); }  else3 show_files(FALSE,FILE_MANAGER);  }  break;case SMG$K_TRM_UPPERCASE_S: case SMG$K_TRM_LOWERCASE_S:;' if (file_type == SHOW_DIRS) {  ding(displayb);  break; } /*% ** submit selected files  */3 sndjbc_files(SUBMIT_FILES,n->dir_name);c break;ecase SMG$K_TRM_SPACE:  /*/ ** select / de-select current file_ */; curr_file_ptr = current_file_ptr(curr_file_no); ) if (curr_file_ptr->rendition)* {c! files_selected--;- curr_file_ptr->rendition = 0;t }g else { ! files_selectedOʤ" SWING_SRC.BCK4-$[MATS.PROG.SWING.C_SWING]SWING_8.C;8brm 6++; A curr_file_ptr->rendition = CHOSEN_FILE_RENDITION; } * show_files(TRUE,FILE_MANAGER); break;case SMG$K_TRM_CTRLK:tcase SMG$K_TRM_DOWN: /* ** down a file, */1 if (curr_file_no < (total_files - 1)) {  curr_file_no++;nE if (curr_file_no >= (curr_top_file + DISPLAYF_FILES))  {)< curr_top_file += (3 * DISPLAYF_FILES)/4;2 show_files(TRUE,FILE_MANAGER);  }  else3 show_files(FALSE,FILE_MANAGER); }t break;case SMG$K_TRM_UPPERCASE_N :case SMG$K_TRM_LOWERCASE_N :case SMG$K_TRM_NEXT_SCREEN :1 if (curr_file_no < (total_files - 1))t {F/ curr_file_no += FILE_PAGE_ROWS;;> curr_top_file = curr_file_no - FILE_PAGE_ROWS;. show_files(TRUE,FILE_MANAGER); }  break;case SMG$K_TRM_UPPERCASE_B :case SMG$K_TRM_LOWERCASE_B : /*" ** bottom - last file */1 if (curr_file_no < (total_files - 1))h {h/ curr_file_no = total_files - 1;t/ show_files(FALSE,FILE_MANAGER); }* break;case SMG$K_TRM_PREV_SCREEN :case SMG$K_TRM_UPPERCASE_P :case SMG$K_TRM_LOWERCASE_P : if (curr_file_no) {y/ curr_file_no -= FILE_PAGE_ROWS; / curr_top_file = curr_file_no - tF (DISPLAYF_FILES - FILE_PAGE_ROWS - 1);. show_files(TRUE,FILE_MANAGER); }w break;case SMG$K_TRM_UPPERCASE_T :case SMG$K_TRM_LOWERCASE_T : /* ** top screen */ if (curr_file_no) {p! curr_file_no = 0; / show_files(FALSE,FILE_MANAGER);r }  break;case SMG$K_TRM_LOWERCASE_Q:icase SMG$K_TRM_UPPERCASE_Q: 7case SMG$K_TRM_CR: /* I LIKE CR/MATS */Ccase SMG$K_TRM_CTRLZ: /*9 ** quit - bye bye, back to directory manager */; curr_file_ptr = current_file_ptr(curr_file_no);= strcpy(n->last_filename,curr_file_ptr->filename);i return(TRUE);  break;case SMG$K_TRM_CTRLL: case SMG$K_TRM_RIGHT:  /*@ ** change the format of the display of the dir info */ fm_type++;& if (fm_type > FM_TYPE_MAX) fm_type = 0;* show_files(TRUE,FILE_MANAGER); message(""); break;case SMG$K_TRM_CTRLH: case SMG$K_TRM_LEFT: /*@ ** change the format of the display of the dir info */ fm_type--; if (fm_type < 0)( fm_type = (FM_TYPE_MAX);* show_files(TRUE,FILE_MANAGER); message(""); break;case SMG$K_TRM_ZERO:case SMG$K_TRM_ONE:mcase SMG$K_TRM_TWO: case SMG$K_TRM_THREE:;case SMG$K_TRM_FOUR:case SMG$K_TRM_FIVE:case SMG$K_TRM_SIX: case SMG$K_TRM_SEVEN:,case SMG$K_TRM_EIGHT: case SMG$K_TRM_NINE: /* ** a new fm_type  */+ fm_type = key - SMG$K_TRM_ZERO; * show_files(TRUE,FILE_MANAGER); break; default: /*F ** let's see if the key is user definable an if it's been@ ** defined - if so we'll do what it's defined to do *** ** walk down the options_list **- ** get a pointer to current file */; curr_file_ptr = current_file_ptr(curr_file_no);R: if (function_key(key,curr_file_ptr->filename))C reasses_files(file_type,n,curr_file_ptr->filename);a else ding(displayb);  break; }f }a}-/*/** see if a key has a definition tied in to it */function_key(key,filename)int key;char *filename;n{i int i;) for (i = 0; options_list[i].key; i++)p {- /* ** entry for our key ?0 */' if (options_list[i].key == key) {  /* ** is entry nullf *// if (!strlen(options_list[i].value)) {M- warning("key not definied");  return(FALSE);w }s /*/ ** execute key in a DCL subprocess  */5 return(execute_cmd(options_list[i].value,o( filename,> options_list[i].no_terminate)); }  }r return(FALSE);}P/*;** allocate memory for a FILER structure, call it filename */grab_file(filename)uchar *filename;{ int i; FILER *temp;) if (temp = calloc(1, sizeof (FILER)))s {o /*B ** we haven't read the directory info (size, date...) yet */ temp->info_lookup = 0; /* ** link upe */ if (total_files == 0) {i" first_file_ptr = temp;! curr_file_ptr = temp; } else { + temp->back_ptr = curr_file_ptr;r+ curr_file_ptr->forw_ptr = temp;f! curr_file_ptr = temp; }_ total_files++;$ i = strcspn(filename,"]")+1;1 strcpy(curr_file_ptr->filename,filename); % curr_file_ptr->rendition = 0; return(curr_file_ptr); }  else? panic(1,"cannot allocate any more memory","grab_file");L}R/*.** free up space allocated to file structures*/free_files(ptr) FILER *ptr; {  FILER *temp, *temp1; temp = ptr;  while (temp) {M temp1 = temp->forw_ptr;  free(temp);- temp = temp1;/ } } /*** de-select all filesi*/ zap_files() {  /*. ** switch the rendition OFF for all files */ FILER *temp; temp = first_file_ptr; while(temp)  {  temp->rendition = 0; temp = temp->forw_ptr; }n files_selected = 0;n}U/*** select all files*/ add_files() {  /*- ** switch the rendition ON for all filesR */ FILER *temp; temp = first_file_ptr; do{ 0 temp->rendition = CHOSEN_FILE_RENDITION; temp = temp->forw_ptr; } while(temp);" message("All files selected");! files_selected = total_files; } /*@** get the pointer to the structure containing the current file** crude, but works*/current_file_ptr(no)int no; {* FILER *temp; int i; temp = first_file_ptr; for (i = 0; i < no; i++) temp = temp->forw_ptr; return(temp);n}i/*** rename the selected files */rename_files(node) NODE *node;m{p FILER *temp, *curr, *tmp;( char prompt[NAME_SIZE+1]; char new_name[NAME_SIZE+1];= char ren_name[SPEC_SIZE+1];  char old_name[SPEC_SIZE+1]; int i;* curr = current_file_ptr(curr_file_no); if (!files_selected) {G% message("No files selected");W return(FALSE); }e else if (files_selected > 1) { L sprintf(junk,"rename all %d selected files Y/N [N]",files_selected);$ if (!confirm_user(junk,"Y")) return(FALSE);  }  prompt[0] = 0; new_name[0] = 0; temp = first_file_ptr; while(temp)m {  if (temp->rendition) {S /*+ ** yup, this one's been chosen  */H sprintf(junk,"New name for %s [NO CHANGE] ",temp->filename);B if (get_user_input_with_prompt(junk,prompt,NAME_SIZE)) {n( strcpy(new_name,prompt);A i = lib_rename(temp->fPvp?" SWING_SRC.BCK4-$[MATS.PROG.SWING.C_SWING]SWING_8.C;8br Filename,new_name,ren_name);$ if (i != SS$_NORMAL) {S< sprintf(junk,"%s - failed to rename %s",7 full_error_text(i),temp->filename); " warning(junk); }  else { 4 strcpy(temp->filename,ren_name); } }t }m temp = temp->forw_ptr; }v return(TRUE);S}/*** delete selected files*/delete_files(n) NODE *n;{s FILER *temp, *curr, *tmp;i int force, status, i;f char this_file[SPEC_SIZE+1]; char device[SPEC_SIZE+1];f deleted_option = DELETE; strcpy(device,n->dir_name);( for (i = 0; i < strlen(device); i++) if (device[i] == '[') { device[i] = 0;e break;P }* curr = current_file_ptr(curr_file_no); if (!files_selected) { % message("No files selected");l return(FALSE); } else  { if (files_selected == 1)= sprintf(junk,"delete the selected file Y/N [N]");s elseP sprintf(junk,"delete the %d selected files Y/N [N]",files_selected); $ if (!confirm_user(junk,"Y")) return(FALSE); }  if (files_selected > 1) { S if (!confirm_user("LAST CHANCE - Really delete these files Y/N [N] ?","Y"))  return(FALSE);r }" else { Q if (!confirm_user("LAST CHANCE - Really delete this file Y/N [N] ?","Y"))  return(FALSE);  }i force = TRUE;(# delete_screen_on(" DELETING "); ( delete_screen_status("* STARTING *",$ deleted_ok,( not_deleted_ok,( total_examined, TRUE,' " DELETING ");  temp = first_file_ptr; while(temp)  { total_examined++; ) strcpy(this_file,temp->filename);T if (temp->rendition) {E /*2 ** delete this file, use force if set */4 status = delete_a_file_by_fid(temp->fid,1 n->fid,( "SYS$DISK");  /*! ** check return code) */% if (status == SS$_NORMAL)= {  /* ** it's gonei */K delete_screen_status(this_file,++deleted_ok,not_deleted_ok,dG total_examined,TRUE," DELETING ");p /*; ** now unlink the pointers to this ex file */# if (temp->back_ptr)u { ) tmp = temp->back_ptr;e3 tmp->forw_ptr = temp->forw_ptr;  }r else4 first_file_ptr = temp->forw_ptr; # if (temp->forw_ptr)/ {P) tmp = temp->forw_ptr; 3 tmp->back_ptr = temp->back_ptr;  }i% tmp = temp->forw_ptr; free(temp);* total_files--;! files_selected--;  temp = tmp;e }n else {_2 temp = temp->forw_ptr; /* check */K delete_screen_status(this_file,deleted_ok,++not_deleted_ok,tG total_examined,TRUE," DELETING ");l } } else" temp = temp->forw_ptr; } B delete_screen_status("* FINISHED *",deleted_ok,not_deleted_ok,; total_examined,TRUE," DELETING "); - delete_screen_message(PRESS_TO_CONTINUE);  get_key(NO_AUTO);  delete_screen_off(); return(TRUE);r}l/*K** either move selected files to a new dir or copy them, just one argumenta**+** option == MOVE_FILES ==> move (rename)M!** option == COPY_FILES ==> copye*/move_files(n,option)NODE *n; int option; { int i; char name[NAME_SIZE+1];" NODE *init_node, *parent_node; LINE *init_line_ptr; FILER *curr, *temp, *tmp; - int init_line, init_level, init_top_line; char from_dir[SPEC_SIZE+1];m char to_dir[SPEC_SIZE+1];  int remaining, nc;* curr = current_file_ptr(curr_file_no); if (!files_selected) {n% message("No files selected");e return(FALSE); }( /* ** note where we are  */ init_line_ptr = curr_l_ptr; ! init_line = current_line; % init_top_line = current_top_line; " init_level = current_level; init_node = n;# remaining = files_selected;  if (option == MOVE_FILES)  travel_to_dir(); else /* COPY_FILES */  travel_to_dir_remote();2 smg$unpaste_virtual_display(&displayf,&paste); /*1 ** we'll allow user to select home directorye */ title(CTITLE);$ nc = next_command(FALSE,option); /* ** clear the user's promptt */ message(" ");i if (nc), {_ /*> ** user selected a new parent node - oh joy oh wonder */7 parent_node = curr_l_ptr->n_ptr[current_level];T } /*. ** nc == SMG$K_TRM_ENTER he hit [RETURN],- ** SMG$K_TRM_GREATER_THAN he hit >W **= ** if > we call remote_files if we're in the copy option  */= if (option == COPY_FILES && nc == SMG$K_TRM_GREATER_THAN)N { /*O ** parent_node->dir_name contains our destination device and directory */+ strcpy(junk,parent_node->dir_name); # strcpy(remote_device,junk); * for (i = 0; i < strlen(junk); i++) if (junk[i] == ':') { # remote_device[i+1] = 0;e0 strcpy(remote_directory,&junk[i+1]);- remote_files(init_node->dir_name, ( files_selected,! EXPORT);) }  } >/* else if ((option == MOVE_FILES && nc == SMG$K_TRM_CR) ||G (option == MOVE_FILES && nc == SMG$K_TRM_GREATER_THAN) || rN (option == COPY_FILES && nc == SMG$K_TRM_CR)) Changed by MATS*/@ else if ((option == MOVE_FILES && nc == SMG$K_TRM_DELETE) ||G (option == MOVE_FILES && nc == SMG$K_TRM_GREATER_THAN) || a> (option == COPY_FILES && nc == SMG$K_TRM_DELETE)) {u /*, ** move the files or copy the filesD ** we start at the end to ensure we move lower version nos  ** firste */ temp = first_file_ptr; while(1) {_ if (temp->forw_ptr) & temp = temp->forw_ptr; else break; }! if (option == COPY_FILES)T! copy_window_centre();  while(temp) { if (temp->rendition) {  /*/ ** yup, this one's been chosen_ */L sprintf(from_dir,"%s%s",init_node->dir_name,temp->filename);L sprintf(to_dir,"%s%s",parent_node->dir_name,temp->filename); /*H ** now strip off the version number of the destination,I ** so that it is copied to be the newest version of this / ** file in the destination dir  */8 for (i = strlen(to_dir) - 1; i > 0; i--) { ) if (to_dir[i] == ';')  {n& to_dir[i] = 0; break; } }e /) if (option == MOVE_FILES)  {_6 i = lib_rename(from_dir,to_dir,0); }i else {i/ i = lib_copy_file(from_dir,r- to_dir,e5 temp->fiQ$" SWING_SRC.BCK4-$[MATS.PROG.SWING.C_SWING]SWING_8.C;8br Z Vlename, 2 --remaining,- EXPORT,f) 0);; }C$ if (i != SS$_NORMAL) {*- if (option == MOVE_FILES)(> sprintf(junk,"%s - failed to move %s",; full_error_text(i),temp->filename);r else> sprintf(junk,"%s - failed to copy %s",; full_error_text(i),temp->filename);I M" warning(junk); break; }  else { - if (option == MOVE_FILES)U {K@ sprintf(junk,"moved %s",temp->filename);& message(junk); }  } }; /*& ** point to previous file */" temp = temp->back_ptr; } /*H ** sleep a second or two to let user see last message before we ** prompt him */ sleep(2);e /*& ** switch off the copy window */! if (option == COPY_FILES) {o# copy_window_off(FALSE); }F /*) ** if we changed directories ... */( if (current_line != init_line ||* current_level != init_level ||( curr_l_ptr != init_line_ptr) { 8 if (confirm_user("Stay here Y/N [N] ?","Y")) return(STAY_HERE); }  }  else warning("aborted");S /* ** restore displayT */( smg$begin_pasteboard_update(&paste);8 render(current_line,current_level,NORMAL_RENDITION);% set_default(init_node->dir_name);o set_init_position(); refresh_display();9 render(current_line,current_level,SPECIAL_RENDITION);  title(FTITLE);L i = smg$paste_virtual_display(&displayf,&paste,&DISPLAYF_Y,&DISPLAYF_X);/ if (i != SS$_NORMAL && i != SMG$_BATWAS_ON)S& panic(i,"paste","move files"); sub_title_normal(banner);Z& smg$end_pasteboard_update(&paste); return(TRUE);e}r/*** purge this directory*/purge_files(n)NODE *n;{i int status;n char spec[256];c9 if (!confirm_user("Purge these files Y/N [N] ?","Y"))e {U return(FALSE); }e else { R if (!confirm_user("LAST CHANCE - Really purge these files Y/N [N] ?","Y")) return(FALSE);! strcpy(spec,n->dir_spec);  strcat(spec,";*");. delete_many_files(n,FALSE,PURGE,spec); message("purged"); }  return(TRUE);"}/*#** option = TRUE ==> select files %** = FALSE ==> deselect files**=** allow the user to add files based on a file spec he types ** in*/query_files(option)- int option; {f FILER *temp; char exp_str[SPEC_SIZE+1]; char name_str[SPEC_SIZE+1];, char path[NAME_SIZE+1];e int status, i, orig_count; struct FAB fab;: struct NAM nam;mN if (!get_user_input("Selective file specification [NONE]",path,NAME_SIZE)) return(FALSE); /*C ** now let's just check that this string is a kosher file spec  */ fab = cc$rms_fab;  nam = cc$rms_nam;/ exp_str[0] = 0; orig_count = files_selected; fab.fab$l_dna = "*.*;*"; fab.fab$b_dns = 5; fab.fab$b_bid = FAB$C_BID; fab.fab$b_bln = FAB$C_BLN; fab.fab$l_fop = FAB$M_NAM; fab.fab$l_nam = &nam;* fab.fab$l_fna = path;w! fab.fab$b_fns = strlen(path); ! nam.nam$b_nop = NAM$M_SYNCHK;i nam.nam$b_bid = NAM$C_BID; nam.nam$b_bln = NAM$C_BLN; nam.nam$l_rsa = 0; nam.nam$b_rss = 0; nam.nam$b_rsl = 0; nam.nam$l_esa = exp_str; nam.nam$b_ess = SPEC_SIZE; status = sys$parse(&fab);s if (status != RMS$_NORMAL) {l7 sprintf(junk,"%s - Invalid file specification",)) full_error_text(status)); warning(junk); return(FALSE); }iH sprintf(name_str,"%.*s",nam.nam$b_name+nam.nam$b_type+nam.nam$b_ver,% nam.nam$l_name);.6 sprintf(junk,"match against %s Y/N [N]",name_str); if (!confirm_user(junk,"Y")) return(FALSE); temp = first_file_ptr; while(temp)  {y /*) ** see if we have a string match_ */5 status = str$match_wild(DSC1(temp->filename), 0 DSC2(name_str));! if (status == STR$_MATCH) {  /* ** select *// if (option && temp->rendition == 0) { 8 temp->rendition = CHOSEN_FILE_RENDITION;" files_selected++; }  /* ** deselect */D if (!option && temp->rendition == CHOSEN_FILE_RENDITION) { $ temp->rendition = 0;" files_selected--; }e }a temp = temp->forw_ptr; }t if (option)  {pJ sprintf(junk,"%d additional files matching %s have been selected",4 files_selected-orig_count,name_str); }r else { A sprintf(junk,"%d files matching %s have been deselected", 9 abs(files_selected-orig_count),name_str);r }t message(junk);" show_files(TRUE,FILE_MANAGER); } /*** re-read directory contents*/#reasses_files(file_type,n,filename)cNODE *n;char *filename;fint file_type;{  /*A ** aim - build up a new linked list of files in dir, keeping E ** any existing attributes, and where possible pointing to file E ** filename - or as near as makes no difference if filename was s ** deletedr */* FILER *temp, *tmp, *prev, *orig_first; char currfile[SPEC_SIZE+1], $ temp_filename[SPEC_SIZE+1],# old_filename[SPEC_SIZE+1]; int file_no; unsigned long checksum; /* ** clear any messaget */ message(" ");l /*( ** get a checksum for the directory */ checksum = get_checksum(n);  if (checksum)  { $ if (n->checksum != checksum) {e# n->checksum = checksum;f }d else {  /*4 ** checksum not changed, quota may have **G ** new label, and therefore possibly new quota information; */, file_manager_label(file_type,n); return(TRUE); }e }t orig_first = first_file_ptr; first_file_ptr = 0;c total_files = 0; files_selected = 0;s please_wait(); get_dir_files(n, file_type); clear_cursor();e cursor_line = 0; curr_file_no = 0;) file_no = 0; currfile[0] = 0;" strcpy(old_filename,filename);2 old_filename[strcspn(old_filename,";")+1] = 0; if (total_files == 0)u {p curr_top_file = 0; return(TRUE);m }S temp = first_file_ptr; while(temp)h {n prev = 0; tmp = orig_first;r while(tmp) {. if (tmp->fid[0] == temp->fid[0] &&. tmp->fid[1] == temp->fid[1] &&, tmp->fid[2] == temp->fid[2]) {p /*& ** copy the rendition */1 temp->rendition = tmp->rendition;) $ if (temp->rendition)% files_selected++;; /*+ ** for speed free the fileS ** unlink */ if (prev) 3 prev->forw_ptr = tmp->forw_ptr;N else/ orig_first = tmp->forw_ptr;, /*6 ** make sure no forward refs and free */" tmR:D" SWING_SRC.BCK4-$[MATS.PROG.SWING.C_SWING]SWING_8.C;8brfp->forw_ptr = 0; free_files(tmp); tmp = 0; }  else {- prev = tmp; $ tmp = tmp->forw_ptr; } } /*< ** see how close to original current file we are - , ** maybe we advance a little closer **D ** strip off version numbers so that we use the most recentD ** version of a file, e.g. for when we've just been editing */ - strcpy(temp_filename,temp->filename);u8 temp_filename[strcspn(temp_filename,";")+1] = 0;7 if (strcmp(temp_filename, old_filename) <= 0 &&e0 strcmp(temp_filename, currfile) > 0) { # curr_file_no = file_no; , strcpy(currfile, temp_filename); }  file_no++;  temp = temp->forw_ptr; }  /* ** free off old linked list */ free_files(orig_first);e F /*? ** new label, and therefore possibly new quota information  */$ file_manager_label(file_type,n); /*< ** show off what we've got now (did the function work?) */" show_files(TRUE,FILE_MANAGER); message("");}(get_new_dir_spec(n)rNODE *n;{ char spec[NAME_SIZE + 1];t char exp_str[SPEC_SIZE + 1]; struct FAB fab;E struct NAM nam;e int status;, /*8 ** we'll prompt user with last spec he searched for */M if (!get_user_input("New directory specification [*.*] ",spec,NAME_SIZE))  strcpy(spec,"*.*"); /*C ** now let's just check that this string is a kosher file spec_ */ fab = cc$rms_fab;  nam = cc$rms_nam;o exp_str[0] = 0;  fab.fab$l_dna = "*.*;*"; fab.fab$b_dns = 5; fab.fab$b_bid = FAB$C_BID; fab.fab$b_bln = FAB$C_BLN; fab.fab$l_fop = FAB$M_NAM; fab.fab$l_nam = &nam;( fab.fab$l_fna = spec;a! fab.fab$b_fns = strlen(spec);_! nam.nam$b_nop = NAM$M_SYNCHK;( nam.nam$b_bid = NAM$C_BID; nam.nam$b_bln = NAM$C_BLN; nam.nam$l_rsa = 0; nam.nam$b_rss = 0; nam.nam$b_rsl = 0; nam.nam$l_esa = exp_str; nam.nam$b_ess = SPEC_SIZE; status = sys$parse(&fab);$ if (status != RMS$_NORMAL) { 2 sprintf(junk,"%s - Invalid specification",) full_error_text(status)); warning(junk); return(FALSE); }  sprintf(spec,  "%.*s",e* nam.nam$b_name+nam.nam$b_type, nam.nam$l_name); strcpy(n->dir_spec,spec);"/*$ file_manager_label(SHOW_DIRS,n);*/ return(TRUE);i}t/*!** called from directory manager */find_next_node(n) NODE *n;{k NODE *nptr;  nptr = next_visited_dir(n);  if (nptr != n) {  if (nptr)_ {>% set_default(nptr->dir_name);  set_init_position();  refresh_display();m } }; return(TRUE); } /*!** called from directory manager*/find_prev_node(n) NODE *n;{p NODE *nptr; # nptr = previous_visited_dir(n);  if (nptr != n) { if (nptr) {o! set_default(nptr->dir_name);) set_init_position();i refresh_display();i } }d return(TRUE); }enext_visited_dir(n) NODE *n;{ int i;/ for (i = 0; i < MAX_LAST_VISITED_DIRS; i++)/ {  if (lvd[i] == n) {r /*F ** if we're at the end of the list or the next element is? ** zero we'll return the first element of the list  */> if (i+1 == MAX_LAST_VISITED_DIRS || lvd[i+1] == 0) return(lvd[0]);n else  return(lvd[i+1]); }, }D  /*" ** not found, return top node */ return(lvd[0]);T} previous_visited_dir(n)NODE *n;{U int i,j;/ for (i = 0; i < MAX_LAST_VISITED_DIRS; i++)p {  if (lvd[i] == n) {i /*1 ** if we're at the start of the listc9 ** we'll return the last element of the list */ if (i)! return(lvd[i-1]);n else { @ for (j = MAX_LAST_VISITED_DIRS - 1; j >= 0; j--) if (lvd[j])C return(lvd[j]); } }] }   /*" ** not found, return top node */ return(lvd[0]);l}sfirst_node_in_stack(n)NODE *n;{i if (!lvd[0]) lvd[0] = n;}Ltop_visited_dir(n)NODE *n;{e int i; /* ** already is the top */ if (lvd[0] == n) return(TRUE);t /*= ** first of all we remove it from the list if it's theret */ remove_visited_dir(n); /*4 ** now we put it at the top - shuffle the queue */1 for (i = MAX_LAST_VISITED_DIRS-1; i > 0; i--)_ {o lvd[i] = lvd[i-1]; }i lvd[0] = n;s /* ** done */ return(TRUE);h} remove_visited_dir(n)iNODE *n;{ int i,j;/ for (i = 0; i < MAX_LAST_VISITED_DIRS; i++)  {p if (lvd[i] == n) {)9 for (j = i; j < MAX_LAST_VISITED_DIRS-1; j++)l {e lvd[j] = lvd[j+1]; } - lvd[MAX_LAST_VISITED_DIRS-1] = 0;T /* ** done  */ return(TRUE); } }   /* ** done */ return(TRUE);w}a/*/** create a banner with the text in the centre */$construct_centre_banner(output,name)char *output, *name;{ int i, len;  len = strlen(name);m if (len > DISPLAY1_COLUMNS)  {e sprintf(output,  "%.*s%c",d# DISPLAY1_COLUMNS-1,i name,o '~');n }) else {k1 for (i = 0; i < (DISPLAY1_COLUMNS/2);i++)[ output[i] = ' ';4 sprintf(&output[(DISPLAY1_COLUMNS - len)/2], "%s", name); }s}c$*[MATS.PROG.SWING.C_SWING]SWING_9.C;1+,4. /(< 4a --0123KPWO 56`rЎ7 gג8jÂk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:10:03.314** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**!** File : SWING_9.C**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /*** swing_9 HELP PROCESSING*/#include "hlpdef"#include ssdef#include stdio#include jpidef#include "swing.h"#include "swing_refs.h"#include "more_descrip.h")extern lib$put_output(), lib$get_input();int help_initialized = 0;/*5** we'll check for the presence of the help file in **** 1) SWING$HLP** 2) SYS$HELP)** 3) same dir as swing is executing from*/ init_help(){ struct { short buffer_length; short item_code; int buffer_address; int return_length_address; int terminator; } itmlst; int length, status, pid, i; short iosb[4];" char imagename[SPEC_SIZE + 1]; if (help_initialized) return(TRUE);SĈqr" SWING_SRC.BCK4-$[MATS.PROG.SWING.C_SWING]SWING_9.C;1a 8 else { help_initialized = 1; /*& ** note 0 ==> check if exists */ help_spec[0] = 0;1 if (access("SWING$HLP:SWING.HLB",0) == 0) {4 strcpy(help_spec,"SWING$HLP:SWING.HLB"); return(TRUE); }5 else if (access("SYS$HELP:SWING.HLB",0) == 0) {3 strcpy(help_spec,"SYS$HELP:SWING.HLB"); return(TRUE); } else { /*B ** we'll look in the same directory as this .exe file **- ** use sys$getjpi to help us out */- itmlst.buffer_length = SPEC_SIZE;- itmlst.item_code = JPI$_IMAGNAME;. itmlst.buffer_address = imagename;3 itmlst.return_length_address = &length;" itmlst.terminator = 0; length = 0; pid = getpid();/ status = sys$getjpiw(0, /* efn */5 &pid, /* pidadr */2 0, /* prcnam */D &itmlst.buffer_length, /* itmlst */6 &iosb[0], /* iosb */2 0, /* astadr */3 0); /* astprm */% if (status != SS$_NORMAL)3 panic(status,"getjpi","init help");  /*4 ** ensure return string null terminated */: imagename[length] = 0;  /*& ** look down spec for a ] */3 for (i = strlen(imagename); i > 0; i--) {( if (imagename[i] == ']') {' imagename[i+1] = 0; break; } }  /*$ ** tag on help file name */* strcat(imagename,"SWING.HLB");) if (access(imagename,0) == 0) {, strcpy(help_spec,imagename); return(TRUE); } } return(FALSE); }}swing_help(start) char *start;{ init_help(); if (help_spec[0]) { int save;- smg$save_physical_screen(&paste, &save); lbr_output_help(start); 3 smg$restore_physical_screen(&paste, &save); } elsea warning("Help file SWING.HLB not found in SWING$HLP, SYS$HELP or SWING image directory");}help_exception(sigarr, mecharr)int *sigarr, *mecharr;{ /* ** unwind and return */$ lib$sig_to_ret(sigarr, mecharr); return(SS$_UNWIND);}lbr_output_help(start) char *start;{ int i, flags; /*? ** the as necessary exception handler, cos lbr$output_help. ** can crash if given a rubbish help file */# VAXC$ESTABLISH(help_exception);  flags = HLP$M_PROMPT;= i = lbr$output_help(&lib$put_output, /* output-routine */: &SCREEN_WIDTH, /* output-width */5 DSC1(start), /* line-desc */; DSC2(help_spec), /* library-name */8 &flags, /* flags */< &lib$get_input); /* input-routine */ if (i != SS$_NORMAL)% panic(i,"help","swing help");}'*[MATS.PROG.SWING.C_SWING]SWING_DEFS.H;1+,4. /(< 4O ,--0123KPWO 56`u 7@qג8`BĂk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:27.074** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**$** File : SWING_DEFS.H**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ globaldef int total_lines = 0;globaldef int controlc_on = 0;globaldef LINE *first_line_ptr;globaldef char junk [2048];%globaldef char *joins[]={" ","`"," ", "x",, " "," "," "," "," ", "m"," ", "t", "q"," ", "w"}; globaldef char *listing_joins[]=$ {" ","*"," ", "|",, " "," "," "," "," ", "+"," ", "+", "-"," ", "+"};"globaldef char *interline_joins[]=$ {" "," "," ", "|",, " "," "," "," "," ", "|"," ", "|", " "," ", " "};Oglobaldef paste, keyboard, display1, displayb, displayt, displayf, display_dcl;globaldef current_line = 0;globaldef current_level = 0;globaldef current_top_line = 0;globaldef curr_l_ptr;globaldef int exit_error = 1;globaldef int old_msk;globaldef int channel1;globaldef int condition;/*globaldef NODE *init_node = 0;*/Hglobaldef char save_file_away[SPEC_SIZE+1], save_file_home[SPEC_SIZE+1];)globaldef char save_file_ss[SPEC_SIZE+1];-globaldef int original_width, original_color;&globaldef char help_spec[SPEC_SIZE+1];#globaldef int help_initialized = 0;globaldef int message_set = 0;globaldef int display_msg;"globaldef int broadcasts_rxed = 0;)globaldef int outstanding_broadcasts = 0;#globaldef int panicked_already = 0;,globaldef int delete_screen_initialized = 0;!globaldef int display_delete = 0;globaldef int deleted_ok = 0;!globaldef int deleted_option = 0;!globaldef int not_deleted_ok = 0;!globaldef int total_examined = 0;!globaldef int originally_ok = -1;globaldef DSTRUCTURE *fdp = 0;globaldef DSTRUCTURE *cdp = 0;%globaldef char sys_disk[SPEC_SIZE+1];globaldef int sl_mark_set;(globaldef char sl_mark_dir[SPEC_SIZE+1];globaldef int br_mark_set;(globaldef char br_mark_dir[SPEC_SIZE+1];globaldef int cb_mark_set;(globaldef char cb_mark_dir[SPEC_SIZE+1];globaldef int rb_mark_set;(globaldef char rb_mark_dir[SPEC_SIZE+1];globaldef int max_owner_width;globaldef int started;!globaldef UOPT options_list[] = {E-1, 0, "file manager initial display format (0-9) : ", "", "", "0",0-1, 0, "printer queue: ", "", "", "SYS$PRINT",0-1, 0, "batch queue : ", "", "", "SYS$BATCH",'-1, 0, "swing editor : ", "", "", "",0SMG$K_TRM_PF1, 0, "keypad PF1 : ", "", "", "",0SMG$K_TRM_PF2, 0, "keypad PF2 : ", "", "", "",0SMG$K_TRM_PF3, 0, "keypad PF3 : ", "", "", "",0SMG$K_TRM_PF4, 0, "keypad PF4 : ", "", "", "",0SMG$K_TRM_KP9, 0, "keypad 9 : ", "", "", "",0SMG$K_TRM_KP8, 0, "keypad 8 : ", "", "", "",0SMG$K_TRM_KP7, 0, "keypad 7 : ", "", "", "",0SMG$K_TRM_KP6, 0, "keypad 6 : ", "", "", "",0SMG$K_TRM_KP5, 0, "keypad 5 : ", "", "", "",0SMG$K_TRM_KP4, 0, "keypad 4 : ", "", "", "",0SMG$K_TRM_KP3, 0, "keypad 3 : ", "", "", "",0SMG$K_TRM_KP2, 0, "keypad 2 : ", "", "", "T%h" SWING_SRC.BCK4-'[MATS.PROG.SWING.C_SWING]SWING_DEFS.H;1O  ",0SMG$K_TRM_KP1, 0, "keypad 1 : ", "", "", "",0SMG$K_TRM_KP0, 0, "keypad 0 : ", "", "", "",2SMG$K_TRM_MINUS, 0, "keypad minus : ", "", "", "",2SMG$K_TRM_COMMA, 0, "keypad comma : ", "", "", "",2SMG$K_TRM_ENTER, 0, "keypad enter : ", "", "", "",3SMG$K_TRM_PERIOD, 0, "keypad period: ", "", "", "",/SMG$K_TRM_F7, 0, "func. key F7 : ", "", "", "",/SMG$K_TRM_F8, 0, "func. key F8 : ", "", "", "",/SMG$K_TRM_F9, 0, "func. key F9 : ", "", "", "",0SMG$K_TRM_F10, 0, "func. key F10: ", "", "", "",0SMG$K_TRM_F11, 0, "func. key F11: ", "", "", "",0SMG$K_TRM_F12, 0, "func. key F12: ", "", "", "",0SMG$K_TRM_F13, 0, "func. key F13: ", "", "", "",0SMG$K_TRM_F14, 0, "func. key F14: ", "", "", "",0SMG$K_TRM_F15, 0, "func. key F15: ", "", "", "",0SMG$K_TRM_F16, 0, "func. key F16: ", "", "", "",0SMG$K_TRM_F17, 0, "func. key F17: ", "", "", "",0SMG$K_TRM_F18, 0, "func. key F18: ", "", "", "",0SMG$K_TRM_F19, 0, "func. key F19: ", "", "", "",0SMG$K_TRM_F20, 0, "func. key F20: ", "", "", "",+0, "", "", "", "" };globaldef int total_files = 0; globaldef int curr_top_file = 0;globaldef int curr_file_no = 0;!globaldef int files_selected = 0;globaldef int cursor_line = -1;$globaldef FILER *first_file_ptr = 0;#globaldef FILER *curr_file_ptr = 0;+globaldef char print_queue[SCREEN_WIDTH+1];+globaldef char batch_queue[SCREEN_WIDTH+1];+globaldef char editor_defn[SCREEN_WIDTH+1];(globaldef char remote_node[SPEC_SIZE+1];*globaldef char remote_device[SPEC_SIZE+1];-globaldef char remote_directory[SPEC_SIZE+1];,globaldef char remote_filename[SPEC_SIZE+1];globaldef int fm_type;/globaldef unsigned short mfd_did[] = {4, 4, 0};globaldef int dir_channel;globaldef int page_length;globaldef int continual_update;globaldef char this_user[41];'*[MATS.PROG.SWING.C_SWING]SWING_REFS.H;1+,4 ./(< 4S--0123KPWO56 7zג8zĂk9`6-G(<HJ ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:30.624** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain**$** File : SWING_REFS.H**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ globalref int total_lines;globalref int controlc_on;globalref LINE *first_line_ptr;globalref char junk[];globalref char *joins[]; globalref char *listing_joins[];"globalref char *interline_joins[];Sglobalref int paste, keyboard, display1, displayt, displayb, displayf, display_dcl;<globalref int current_line, current_level, current_top_line;globalref LINE *curr_l_ptr;globalref int exit_error;globalref int old_msk;globalref int channel1;globalref int condition;Bglobalref char save_file_away[], save_file_home[], save_file_ss[];-globalref int original_width, original_color;globalref char help_spec[];globalref int help_initialized;globalref int message_set;globalref int display_msg;globalref int broadcasts_rxed;%globalref int outstanding_broadcasts;globalref int panicked_already;(globalref int delete_screen_initialized;globalref int display_delete;globalref int deleted_ok;globalref int deleted_option;globalref int not_deleted_ok;globalref int total_examined;globalref int originally_ok;globalref DSTRUCTURE *fdp;globalref DSTRUCTURE *cdp;globalref char sys_disk[];globalref int sl_mark_set;globalref char sl_mark_dir[];globalref int br_mark_set;globalref char br_mark_dir[];globalref int cb_mark_set;globalref char cb_mark_dir[];globalref int rb_mark_set;globalref char rb_mark_dir[];globalref int max_owner_width;globalref int started;globalref UOPT options_list[];globalref int total_files;globalref int curr_top_file;globalref int curr_file_no;globalref int files_selected;globalref int cursor_line; globalref FILER *first_file_ptr;globalref FILER *curr_file_ptr;globalref char print_queue[];globalref char batch_queue[];globalref char editor_defn[];globalref char remote_node[];globalref char remote_device[];"globalref char remote_directory[];!globalref char remote_filename[];globalref int fm_type;#globalref unsigned short mfd_did[];globalref int dir_channel;globalref int page_length;globalref int continual_update;globalref char this_user[];#*[MATS.PROG.SWING.C_SWING]TERMIO.C;2+,4./(< 4N--0123KPWO56 r /* Get terminal commands sequence from master table */= if ((smg$get_term_data( /* Get terminal data */8 &termaddr, /* Terminal table address */0 &request_code, /* U &N" SWING_SRC.BCK4-#[MATS.PROG.SWING.C_SWING]TERMIO.C;2N Request code */6 &max_buffer_length,/* Maximum buffer length */0 &ret_length, /* Return length */8 buffer, /* Capability data buffer */4 arg_list) /* Argument list array */ & 1) == 0 &&B /* If that didn't work, try again with no arguments */ : (smg$get_term_data( /* Get terminal data */7 &termaddr, /* Terminal table address */1 &request_code, /* Request code */6 &max_buffer_length,/* Maximum buffer length */1 &ret_length, /* Return length */7 buffer) /* Capability data buffer */ & 1) == 0)H /* Return NULL pointer if capability is not available */ return NULL;$ /* Check for empty result */ if (ret_length == 0) return NULL;A /* Save current position so we can return it to caller */ result = buffer; 3 /* NIL terminate the sequence for return */ buffer[ret_length] = 0;  /* Advance buffer */! buffer += ret_length + 1; ' /* Return capability to user */ return result;} /* tgetstr */ )/** I/O information block definitions **/.typedef struct { /* I/O status block */4 short i_cond; /* Condition value */2 short i_xfer; /* Transfer count */6 long i_info; /* Device information */} iosb; 4typedef struct { /* Terminal characteristics */2 char t_class; /* Terminal class */2 char t_type; /* Terminal type */> short t_width; /* Terminal width in characters */< long t_mandl; /* Terminal's mode and length */B long t_extend; /* Extended terminal characteristics */ } termchar; 4static termchar tc; /* Terminal characteristics */ /***: * vmsgtty - Get terminal type from system control block * Nothing returned ***/static void vmsgtty(){ short fd; int status; iosb iostatus;+ $DESCRIPTOR(devnam, "SYS$COMMAND");' /* Assign input to a channel */0 status = sys$assign(&devnam, &fd, 0, 0); if ((status & 1) == 0) exit(status);* /* Get terminal characteristics */; status = sys$qiow( /* Queue and wait */3 0, /* Wait on event flag zero */6 fd, /* Channel to input terminal */9 IO$_SENSEMODE, /* Get current characteristic */5 &iostatus, /* Status after operation *// 0, 0, /* No AST service */; &tc, /* Terminal characteristics buf */3 sizeof(tc), /* Size of the buffer *// 0, 0, 0, 0); /* P3-P6 unused */( /* De-assign the input device */& if ((sys$dassgn(fd) & 1) == 0) exit(status);$ /* Jump out if bad status */ if ((status & 1) == 0) exit(status);' if ((iostatus.i_cond & 1) == 0)& exit(iostatus.i_cond);} /* vmsgtty */ /* Terminal_Open* * Get terminal type and open terminal. */char Terminal_Open(){) smg$create_virtual_keyboard(&Kb); /* Get terminal type */ vmsgtty();% if (tc.t_type == TT$_UNKNOWN) return FALSE;B /* Access the system terminal definition table for the */H /* information of the terminal type returned by IO$_SENSEMODE */J if ((smg$init_term_table_by_type(&tc.t_type, &termaddr) & 1) == 0) return FALSE; /* Set sizes */: Screen_Height = ((unsigned int) tc.t_mandl >> 24);" Screen_Width = tc.t_width;# /* Get some capabilities */, SO = tgetstr(SMG$K_BEGIN_REVERSE);* SE = tgetstr(SMG$K_END_REVERSE);0 CE = tgetstr(SMG$K_ERASE_TO_END_LINE);2 CLS = tgetstr(SMG$K_ERASE_WHOLE_DISPLAY);# HC = tgetstr(SMG$K_HOME);) BLD = tgetstr(SMG$K_BEGIN_BOLD);' BLDE = tgetstr(SMG$K_END_BOLD);) SCROLLR = tgetstr(SMG$K_SCROLL_REVERSE);, WSCREEN = tgetstr(SMG$K_WIDTH_WIDE);. NSCREEN = tgetstr(SMG$K_WIDTH_NARROW); setbuf(stdout, 0); return TRUE;} /* Terminal_Open */ /* ClrEOL- Clears from begining to end of line*/ void ClrEOL(){ if (CE != NULL){ putchar('\r'); printf("%s",CE); } else { int i;6 for (i = 0; i < Screen_Width - 1; i++)% putchar(' '); putchar('\r'); }} /* ClrEOL */int scroll_r(){ if(SCROLLR!=NULL) { printf("%s%s",HC,SCROLLR); return(1); } else return(0);} void clrs(){% if(HC!=NULL) printf("%s",HC);' if(CLS!=NULL) printf("%s",CLS);} D/*send escape sequences to physically change screen mode to narrow*/void narrow_width(){ clrs();( if(NSCREEN!=NULL) printf("%s",NSCREEN);}static int wide_width(){ clrs(); if(WSCREEN!=NULL){ printf("%s",WSCREEN); return(1); } else { return(0); }} void standout(){( if (SO != NULL) printf("%s",SO);* if (BLD != NULL) printf("%s",BLD); } /* standout */ void standend(){( if (SE != NULL) printf("%s",SE);, if (BLDE != NULL) printf("%s",BLDE);} /* standend */ /* getkey. Read in a keystroke in raw noecho mode.*/ int getkey(){ static short int ch;% smg$read_keystroke(&Kb, &ch); return ch;} /* getkey */ int set_width(width) int width;{ short fd; int status; iosb iostatus;+ $DESCRIPTOR(devnam, "SYS$COMMAND");4 /* Switching physical terminal to narrow/wide mode.5 If the terminal does not support wide mode, wait ! for a second, return FALSE */ if(width<=80) narrow_width(); else { if(!wide_width()) { cursor(Screen_Height,1);= printf("\nYour terminal does not support wide mode!\n"); sleep(2); return(0); } }' /* Assign input to a channel */0 status = sys$assign(&devnam, &fd, 0, 0); if ((status & 1) == 0) exit(status);0 /* Get current terminal characteristics */; status = sys$qiow( /* Queue and wait */3 0, /* Wait on event flag zero */6 fd, /* Channel to input terminal */9 IO$_SENSEMODE, /* Get current characteristic */5 &iostatus, /* Status after operation *// 0, 0, /* No AST service */; &tc, /* Terminal characteristics buf */3 sizeof(tc), /* Size of the buffer *// 0, 0, 0, 0); /* P3-P6 unused */ " /*set terminal characteristics */ tc.t_width=width;; status = sys$qiow( /* Queue and wait */3 0, /* Wait on event flag zero */6 fd, /* Channel to input terminal */7 IO$_SETMODE, /* Get current characteristic */5 &iostatus, /* Status after operation *// 0, 0, /* No AST service */; &tc, /* Terminal characteristics buf */3 sizeof(tc), /* Size of the buffer *// 0, 0, 0, 0); /* P3-P6 unused */ if( (sys$dassgn(fd) & 1)==0) exit(status); return(1);}void cursor(x,y)int x,y;{ char buffer[240]; int status, length, arg[3]; arg[0]=2; /* two arguments*/ arg[1]=x; arg[2]=y;: status=smg$get_term_data(&termaddr,&SMG$K_SET_CURSOR_ABS,3 &sizeof(buffer),&length,buffer,arg); buffer[length]='\0'; printf("%s",buffer);A if (CE != NULL)printf("%s",CE); /*erase to end of line*/}void more_message(str) char *str;{& cursor(Screen_Height,Screen_Width/2); standout(); printf(str); standend();}V(/f" SWING_SRC.BCK4 -#[MATS.PROG.SWING.C_SWING]TRMDEF.H;1?#*[MATS.PROG.SWING.C_SWING]TRMDEF.H;1+,4 ./(< 4?D--0123KPWO56@KЎ7`ג81Ăk9`6-G(<HJ?/****************************************************************3** C SWING v 3.1 31-JUL-1989 09:07:34.244** =========================================**!** Author : S.J.Brown**%** Copyright : Public Domain** ** File : TRMDEF.H**** Language : VAXC**'** Compiler : VAX/VMS C v 2.4**** VMS Ver. : 5.1**?******************************************************************* Change History** ==============**?** Date Change Initials?** ----------------------------------------------------=** 31-JUL-1989 Initial Version v3.0 SJB**?**************************************************************/ /* ** trmdef.h*/'#define TRM$M_TM_NOECHO 0x00000040'#define TRM$M_TM_CVTLOW 0x00000100'#define TRM$M_TM_PURGE 0x00000800'#define TRM$M_TM_TRMNOECHO 0x00001000'#define TRM$M_TM_NOEDIT 0x00008000'#define TRM$M_TM_NORECALL 0x00010000%*[MATS.PROG.SWING.C_SWING]UNIX2VMS.C;1+,4 ./(< 4GV--0123KPWO56` L:7 : g89`6-G(<HJ /*VMS MORE V1.5*/#define NULL (char *)0G/**********************************************************************D * convert_unix_to_vms () --- Converts a unix file name to a vms9 * file name. THIS IS A HACK. DOESN'TA * UNDERSTAND ~user/ or ./xxx .  * --Warner Losh */char *convert_unix_to_vms (fn) char *fn;{! register char *src, *dst; int len; static char buffer[160]; char *strchr(); char *strrchr(); src = fn; dst = buffer; if (*src == '~') {. strcpy (dst, getenv ("HOME"));$ dst += strlen (dst); src += 1; if (*src == '/')! src += 1;7 if (strchr (src, '/') != (char *) NULL)) *(dst - 1) = '.'; } else if (*src == '/') { *dst++ = '['; src += 1; }4 else if (strchr (src, ':') != (char *) NULL) {2 len = strchr (src, ':') - src + 1;( strncpy (dst, src, len); dst += len; src += len; if (*src == '/') src++; *dst++ = '['; } else { if (*src == '.') {% *dst++ = '['; } else {. strcpy (buffer, "[.");! dst += 2; } }  while (*src) {1 if (strncmp ("../", src, 3) == 0) {% *dst++ = '-';! src += 3;? if (strchr (src, '/') == (char *) NULL)- *dst++ = ']';! continue; } if (*src == '/') {C if (strchr (src + 1, '/') == (char *) NULL)- *dst++ = ']'; else- *dst++ = '.';! src += 1;! continue; }; if (*(dst - 1) == '-' && *(src - 1) == '/')% *dst++ = '.'; *dst++ = *src++; }+ dst = malloc (strlen (buffer) + 1); strcpy (dst, buffer); return dst;(} /* end of convert_unix_to_vms () */ W}k" SWING_SRC.BCK4-'[MATS.PROG.SWING.C_SWING]S@VGKVENFP'H;1=l#?m]"eoO( V023<"*:pc}HUE\uJ 67:3Q0k^V&q[36SgD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