Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Dec 1999 14:15:52 +0100 (CET)
From:      ob@seicom.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/15330: editor joe modification
Message-ID:  <199912071315.OAA35907@bs-tosh.breuninger.org>

next in thread | raw e-mail | index | archive | help

>Number:         15330
>Category:       ports
>Synopsis:       editor joe modification
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec  7 05:20:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Breuninger
>Release:        FreeBSD 3.3-RELEASE i386
>Organization:
>Environment:
>Description:

In a multiuser situation it's dangerous to use joe-2.8.
Joe doesn't lock files like vi. 

With this fix uses joe the same locking like vi.

The patches 

	patches-ab
	patches-ad

has to be removed.

>How-To-Repeat:
>Fix:
     
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	patches
#	patches/patch-ad-lock
#	patches/patch-joerc
#	patches/patch-lock
#	patches/patch-ab-lock
#
echo c - patches
mkdir -p patches > /dev/null 2>&1
echo x - patches/patch-ad-lock
sed 's/^X//' >patches/patch-ad-lock << 'END-of-patches/patch-ad-lock'
X--- b.c.orig	Fri Jan 20 09:38:25 1995
X+++ b.c	Tue Dec  7 13:35:11 1999
X@@ -22,4 +22,7 @@
X #endif
X #include <errno.h>
X+#include <sys/file.h>
X+#include <sys/types.h>
X+#include <sys/stat.h>
X 
X #include "config.h"
X@@ -202,4 +205,5 @@
X  else b->o=pdefault;
X  mset(b->marks,0,sizeof(b->marks));
X+ b->filehandle = -1;	/* initialize filehandle &&& ob */
X  b->rdonly=0;
X  b->orphan=0;
X@@ -256,4 +260,8 @@
X  if(b && !--b->count)
X   {
X+  if (b->filehandle != -1) {
X+    /* close filehandle, free lock &&& ob */
X+    close (b->filehandle);
X+    }
X   if(b->changed) abrerr(b->name);
X   if(b==errbuf) errbuf=0;
X@@ -1672,4 +1680,5 @@
X  long skip,amnt;
X  char *n;
X+ struct stat sb;
X  int nowrite=0;
X 
X@@ -1705,4 +1714,26 @@
X   fi=fopen(n,"r");
X   if(!fi) nowrite=0;
X+/*printf ("nowrite open=%i\n", nowrite); */
X+  
X+  /* check file mod, if no write flags set, 
X+     joe in read only mode. &&& ob */
X+
X+  if (!nowrite) { 
X+    nowrite = (!stat (n, &sb)) && (!(sb.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)));
X+    }
X+/*printf ("nowrite stat=%i\n", nowrite); */
X+
X+  /* lock the file if writable, or go into read only mode if
X+     already locked,      */
X+  
X+  if ((fi) && (!nowrite)) { 
X+    b->filehandle = dup (fileno (fi));
X+    nowrite = (flock (b->filehandle, LOCK_EX | LOCK_NB));
X+    }
X+/*printf ("nowrite flock=%i\n", nowrite); */
X+
X+/*nowrite = 1; */	/* for test purpose */
X+/*printf ("nowrite=%i\n", nowrite); */
X+
X   }
X  joesep(n);
END-of-patches/patch-ad-lock
echo x - patches/patch-joerc
sed 's/^X//' >patches/patch-joerc << 'END-of-patches/patch-joerc'
X--- joerc.orig	Sun Jan  8 17:04:50 1995
X+++ joerc	Tue Dec  7 13:47:21 1999
X@@ -26,9 +26,9 @@
X  -marking	Text between ^KB and cursor is highlighted (use with -lightoff)
X 
X- -asis		Characters 128 - 255 shown as-is
X+-asis		Characters 128 - 255 shown as-is
X 
X  -force		Force final newline when files are saved
X 
X- -nobackups	If you don't want backup files to be created
X+-nobackups	If you don't want backup files to be created
X 
X  -lightoff	Turn off highlighting after block copy or move
X@@ -40,9 +40,9 @@
X  -nosta		Disable top-most status line
X 
X- -keepup	%k and %c status line escape sequences updated frequently
X+-keepup		%k and %c status line escape sequences updated frequently
X 
X  -pg nnn	No. lines to keep for PgUp/PgDn
X 
X- -csmode	^KF after a pervious search does a ^L instead
X+ -csmode	^KF after a pervious search does a ^R instead
X 
X  -backpath path Directory to store backup files
X@@ -50,5 +50,5 @@
X  -nonotice	Disable copyright notice
X 
X- -noxon		Attempt to turn off ^S/^Q processing
X+-noxon		Attempt to turn off ^S/^Q processing
X 
X  -orphan	Put extra files given on command line in orphaned buffers
X@@ -103,5 +103,5 @@
X 
X -lmsg \i%k%T%W%I%X %n %m%R %M
X--rmsg  %S Row %r Col %c %t  Ctrl-K H for help
X+-rmsg  %S Row %r Col %c %u  Ctrl-K H for help
X 
X  SECOND SECTION: File name dependant local option settings:
X@@ -155,5 +155,9 @@
X 
X *
X--wordwrap
X+	-wordwrap
X+
X+*.Mod
X+-spaces
X+-tab 2
X 
X *.c
X@@ -183,9 +187,9 @@
X \i \i^B left ^F right ^U  prev. screen ^KB begin  ^D char. ^KJ reformat ^KX save  \i \i
X \i \i^P up   ^N down  ^V  next screen  ^KK end    ^Y line  ^T  options  ^C  abort \i \i
X-\i \i^Z previous word ^A  beg. of line ^KM move   ^W >word ^R  refresh  ^KZ shell \i \i
X+\i \i^Z previous word ^A  beg. of line ^KM move   ^W >word ^L  refresh  ^KZ shell \i \i
X \i \i^X next word     ^E  end of line  ^KC copy   ^O word< ^@  insert   \uFILE\u      \i \i
X \i \i\uSEARCH\u           ^KU top of file  ^KW file   ^J >line \uSPELL\u        ^KE edit  \i \i
X \i \i^KF find text    ^KV end of file  ^KY delete ^_ undo  ^[N word     ^KR insert\i \i
X-\i \i^L  find next    ^KL to line No.  ^K/ filter ^^ redo  ^[L file     ^KD save  \i \i
X+\i \i^R  find next    ^KL to line No.  ^K/ filter ^^ redo  ^[L file     ^KD save  \i \i
X }
X 
X@@ -343,5 +347,5 @@
X query		^K ?		Macro query insert
X record		^K [		Record a macro
X-retype		^R		Refresh screen
X+retype		^L		Refresh screen
X rtn		^M		Return
X shell		^K Z		Shell escape
X@@ -486,5 +490,5 @@
X ffirst		^K f
X filt		^K /		Filter block
X-fnext		^L		Find next
X+fnext		^R		Find next
X fmtblk		^K J		Format paragraphs in block
X fmtblk		^K ^J
X@@ -494,6 +498,6 @@
X groww		^K ^G
X groww		^K g
X-insc		.kI		Insert a space
X-insc		^@
X+insc		^@		Insert a space
X+mode,"T"	.kI		Insert/Overtype
X insf		^K R		Insert a file
X insf		^K ^R
END-of-patches/patch-joerc
echo x - patches/patch-lock
sed 's/^X//' >patches/patch-lock << 'END-of-patches/patch-lock'
X--- b.h.orig	Wed Dec 21 13:04:46 1994
X+++ b.h	Tue Dec  7 13:35:11 1999
X@@ -61,4 +61,5 @@
X  int internal;			/* Set for internal buffers */
X  int er;			/* Error code when file was loaded */
X+ int filehandle;		/* File handle for locking */
X  };
X 
END-of-patches/patch-lock
echo x - patches/patch-ab-lock
sed 's/^X//' >patches/patch-ab-lock << 'END-of-patches/patch-ab-lock'
X--- main.c.orig	Sun Jan 22 01:21:08 1995
X+++ main.c	Tue Dec  7 13:57:42 1999
X@@ -19,4 +19,8 @@
X #include <stdio.h>
X #include <fcntl.h>
X+#ifdef __FreeBSD__
X+#include <locale.h>
X+#include <ctype.h>
X+#endif
X #include "config.h"
X #include "w.h"
X@@ -188,4 +192,18 @@
X #endif 
X 
X+#ifdef __FreeBSD__
X+ setlocale(LC_ALL, "");
X+ for(c=0;c<256;c++)
X+  { int a=0;
X+    if(iscntrl(c))
X+     a|=UNDERLINE;
X+    if((c&0x80)&&!isprint(c))
X+     a|=INVERSE;
X+    xlata[c]=a;
X+    if(isprint(c))
X+     xlatc[c]=c;
X+  }
X+#endif
X+
X  if(s=getenv("LINES")) sscanf(s,"%d",&lines);
X  if(s=getenv("COLUMNS")) sscanf(s,"%d",&columns);
X@@ -366,5 +384,5 @@
X  if(help) helpon(maint);
X  if(!nonotice)
X-  msgnw(lastw(maint)->object,"\\i** Joe's Own Editor v2.8 ** Copyright (C) 1995 Joseph H. Allen **\\i");
X+  msgnw(lastw(maint)->object,"\\i** Joe's Own Editor v2.8l ** Copyright (C) 1995 Joseph H. Allen **\\i");
X  edloop(0);
X  vclose(vmem);
END-of-patches/patch-ab-lock
exit


>Release-Note:
>Audit-Trail:
>Unformatted:
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912071315.OAA35907>