OK, turing.

<- leave blank

Wed Jan 22 01:57:55 EST 2020

Making calls work on PinePhone
------------------------------

Modem needs to be setup with:

  AT+QDAI=1,0,0,1,0,1,1,1
  AT+QDAI?

and restarted.

This sets modem to:

  1 - Digital PCM
  0 - I2S master
  0 - Primary mode (short sync)
  1 - 256kHz clock (256kHz / 16bit = 16k samples/s)
  0 - 16bit linear format
  1 - 16kHz sample
  1 - 1 slot
  1 - map to first slot (the only slot)

The SoC I2S0 interface needs to be configured to match this.  To try various
configurations in real-time we can run pulseaudio and set it up so that:

1) alsamixer

  - set "Line Out Source" to "Mono Differential"
  - Unmute "AIF1 Slot 0 Digital DAC"
  - (optional) unmute the microphone / mute loudpeaker

2) pulseaudio

  # Outbound - connect audio from aif1 to i2s0
  pactl load-module module-loopback \
	source=alsa_input.platform-sound.stereo-fallback \
	sink=alsa_output.platform-sound-modem.mono-fallback

  # Inbound - connect audio from i2s0 to aif1
  pactl load-module module-loopback \
	source=alsa_input.platform-sound-modem.mono-fallback \
	sink=alsa_output.platform-sound.stereo-fallback

To test inbound audio, we can play audio using modem's TTS (text to speech
functionality):

  AT+QTTS=2,"Welcome to use the module of QUECTEL"

To test outbound, we can make a call.  I call the pinephone from a dumbphone
and answer the call with:

  ATA

I2S interface module has quite a lot of toggles/bits that can be configured,
and the right configuration was found to be:

I2S0: (initial)
0x01c22000 : 00000107
0x01c22004 : 00000f33
0x01c22008 : 00000030
0x01c2200c : 00000000
0x01c22010 : 00000000
0x01c22014 : 000400f5
0x01c22018 : 00390000
0x01c2201c : 00000088
0x01c22020 : 00000000
0x01c22024 : 000001c4
0x01c22028 : 00000000
0x01c2202c : 00000000
0x01c22030 : 00000000
0x01c22034 : 00001010
0x01c22038 : 00000000
0x01c2203c : 00000000
0x01c22040 : 00000000
0x01c22044 : 76543210
0x01c22048 : 00000000
0x01c2204c : 00000000
0x01c22050 : 00000000
0x01c22054 : 00001000
0x01c22058 : 76543210
0x01c2205c : 00000050

I2S0: (working)
0x01c22000 : 00000107
0x01c22004 : 00080f33
0x01c22008 : 00000030
0x01c2200c : 00000004
0x01c22010 : 00000006
0x01c22014 : 000400f5
0x01c22018 : 003e010e
0x01c2201c : 00000088
0x01c22020 : 00000000
0x01c22024 : 000001c4
0x01c22028 : 00316016
0x01c2202c : 00314b88
0x01c22030 : 00000000
0x01c22034 : 00000010
0x01c22038 : 00000000
0x01c2203c : 00000000
0x01c22040 : 00000000
0x01c22044 : 76543210
0x01c22048 : 00000000
0x01c2204c : 00000000
0x01c22050 : 00000000
0x01c22054 : 00001000
0x01c22058 : 76543210
0x01c2205c : 00000050

The only difference comapred to what kernels configures is that TX offset should
be
set to 0.  and RX offset to 1 (already is).

Linux kernel with necessary patches and DTS changes integrated is available at:

  https://megous.com/git/linux/log/?h=pp-5.5

If you want to build my kernel, use this branch, because pp-5.5 branch is not
standalone and depends on ths-5.5 branch.  orange-pi-5.5 is integration
branch for all my kernel work:

  https://megous.com/git/linux/log/?h=orange-pi-5.5


To enable the modem in my kernel you need to run this script (only on DEV
phone version 1.0!!):

-------------------------------------------
#!/bin/sh

GPIO=/sys/class/gpio
PIN=/sys/class/gpio/gpio
PB3_PWRKEY=35
PL7_PWR=359
PC4_RESET=68
PH8_DISABLE=232
PH7_WAKEUP=231

echo $PL7_PWR > $GPIO/export
echo $PC4_RESET > $GPIO/export
echo $PH7_WAKEUP > $GPIO/export
echo $PH8_DISABLE > $GPIO/export
echo $PB3_PWRKEY > $GPIO/export

echo out > $PIN$PH8_DISABLE/direction
echo out > $PIN$PH7_WAKEUP/direction
echo out > $PIN$PC4_RESET/direction
echo out > $PIN$PL7_PWR/direction
echo out > $PIN$PB3_PWRKEY/direction

echo 0 > $PIN$PH8_DISABLE/value
echo 0 > $PIN$PH7_WAKEUP/value
echo 0 > $PIN$PC4_RESET/value

echo 1 > $PIN$PL7_PWR/value
sleep 0.1
echo 1 > $PIN$PB3_PWRKEY/value
sleep 0.2
echo 0 > $PIN$PB3_PWRKEY/value
-------------------------------------------

To disable the modem before poweroff/reboot:

-------------------------------------------
#!/bin/sh

GPIO=/sys/class/gpio
PIN=/sys/class/gpio/gpio
PB3_PWRKEY=35
PL7_PWR=359
PC4_RESET=68
PH8_DISABLE=232
PH7_WAKEUP=231

echo 1 > $PIN$PB3_PWRKEY/value
sleep 0.8
echo 0 > $PIN$PB3_PWRKEY/value

echo waiting for shutdown
sleep 30

echo 0 > $PIN$PL7_PWR/value
-------------------------------------------


Enjoy!

   ~megi

Tue Jan 21 22:23:30 EST 2020
Authentication-Results: minnie.tuhs.org;
	dkim=pass (2048-bit key; unprotected) header.d=gmail.com
	header.i=@gmail.com header.b="Kr6V2wzK";
	dkim-atps=neutral
From: Rob Pike <robpike@gmail.com>
Date: Sat, 18 Jan 2020 10:20:40 +1100
To: Andrew Warkentin <andreww591@gmail.com>
Subject: Re: [TUHS] On the origins of Linux - "an academic question"
Cc: The Eunuchs Historic Society <tuhs@tuhs.org>
Errors-To: tuhs-bounces@minnie.tuhs.org
Sender: "TUHS" <tuhs-bounces@minnie.tuhs.org>

Plan 9 is not a "single-system-image cluster".

-rob




Tue Jan 21 22:20:58 EST 2020
From: Brantley Coile <brantley@coraid.com>
To: Arrigo Triulzi <arrigo@alchemistowl.org>
Thread-Topic: [TUHS] On the origins of Linux - "an academic question"
Thread-Index: AQHVzVYvaaOUiRlUaUKJc+Go9YY5Lafvb00A
Date: Fri, 17 Jan 2020 17:25:15 +0000
Accept-Language: en-US
Subject: Re: [TUHS] On the origins of Linux - "an academic question"
Cc: The Eunuchs Historic Society <tuhs@tuhs.org>
Errors-To: tuhs-bounces@minnie.tuhs.org
Sender: "TUHS" <tuhs-bounces@minnie.tuhs.org>

Since I was a close observer and an early adopter of Plan 9, which is still my
main development platform, I'll contribute my thoughts on the question.

Plan 9 was still being developed in the time frame that Torvalds was working out
Linux.  Everyone working in the Unix field wanted a version that was not under
AT&T's expensive license.  The last one I bought was north of $64K.

The biggest reason that Plan 9 isn't the current Linux is that the world didn't
need a cloud operating system in the early 1990's.  They just needed a Unix for
which they could get the source.

Plan 9 solves the problem of "How do I make a bunch of machines look like a single
system?" If you wanted to mess around with a system in the early 1990's you didn't
have a bunch of people and a bunch of systems you needed to make appear as one.
You just had a single box.

So, my Plan 9 remains small.  In fact, I've been removing things from it, like
local disks, that is contrary to the original vision.  (Or set of visions.  I
remember getting a lot of different answers form everyone involved in 1127 about
what it was that they were doing.)

The general question of why Linux emerged and not others didn't is a very hard
question that computer historians will be researching for a lot time.  It's
complex, like all economics.

  Brantley

> On Jan 17, 2020, at 11:01 AM, Arrigo Triulzi <arrigo@alchemistowl.org>
wrote:
>
> [I originally asked the following on Twitter which was probably not the
smartest idea]
>
> I was recently wondering about the origins of Linux, i.e.  Linux Torvalds
doing his MSc and deciding to write Linux (the kernel) for the i386 because Minix
did not support the i386 properly.  While this is perfectly understandable I was
trying to understand why, as he was in academia, he did not decide to write a
“free X” for a different X. The example I picked was Plan 9, simply because I
always liked it but X could be any number of other operating systems which he
would have been exposed to in academia.  This all started in my mind because I was
thinking about my friends who were CompSci university students with me at the time
and they were into all sorts of esoteric stuff like Miranda-based operating
systems, building a complete interface builder for X11 on SunOS including sparkly
mouse pointers, etc.  (I guess you could define it as “the usual frivolous MSc
projects”) and comparing their choices with Linus’.
>
> The answers I got varied from “the world needed a free Unix and BSD was
embroiled in the AT&T lawsuit at the time” to “Plan 9 also had a restrictive
license” (to the latter my response was that “so did Unix and that’s why Linus
built Linux!”) but I don’t feel any of the answers addressed my underlying
question as to what was wrong in the exposure to other operating systems which
made Unix the choice?
>
> Personally I feel that if we had a distributed OS now instead of Linux we’d
be better off with the current architecture of the world so I am sad that "Linux
is not Plan 9" which is what prompted the question.
>
> Obviously I am most grateful for being able to boot the Mathematics
department’s MS-DOS i486 machines with Linux 0.12 floppy disks and not having to
code Fortran 77 in Notepad followed by eventually taking over the department with
X-Terminals based on Linux connected to the departmental servers (Sun, DEC Alpha,
IBM RS/6000s).  Without Linux they had been running eXeed (sp?) on Windows 3.11!
In this respect Linux definitely filled in a huge gap.
>
> Arrigo
>




Tue Jan 21 22:10:43 EST 2020
Authentication-Results: minnie.tuhs.org;
	dkim=fail reason="signature verification failed" (2048-bit key;
	unprotected) header.d=gmail.com header.i=@gmail.com header.b="iT7Mpt9n";
	dkim-atps=neutral
From: Rob Pike <robpike@gmail.com>
Date: Tue, 21 Jan 2020 07:28:39 +1100
To: TUHS main list <tuhs@minnie.tuhs.org>
Subject: [TUHS] Unix quix
Errors-To: tuhs-bounces@minnie.tuhs.org
Sender: "TUHS" <tuhs-bounces@minnie.tuhs.org>

I reposted the original Unix quiz, which disappeared when public Google
Plus was turned off.  Answers will reappear in a few days.

https://commandcenter.blogspot.com/2020/01/unix-quiz.html

-rob




Tue Jan 21 20:39:13 EST 2020
	  1 0 debugexc
	  3 0 debugpt
	  7 0 mathemu
	  8 0 doublefault
	  9 0 mathover
	 14 0 faultamd64
	 15 0 unexpected
	 16 0 matherror
	 19 0 simderror
	 50 18 clock
	 51 19 lapicerror
	 63 31 lapicspurious
	 65 3 ether0
	 73 1 kbd
	 81 4 hda
	 89 11 ehci
	 97 11 ehci
	105 10 sdE (ahci)
1 debugexc 176458 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3 debugpt 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 mathemu 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8 doublefault 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9 mathover 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
14 faultamd64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 unexpected 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
16 matherror 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
19 simderror 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
50 clock 433082 433081 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
51 lapicerror 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
63 lapicspurious 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
65 ether0 24971 24971 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
73 kbd 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
81 hda 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
89 ehci 48284679 48284679 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
97 ehci 233897 233897 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
105 'sdE (ahci)' 73050 73050 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0


Tue Jan 21 09:08:11 EST 2020
PS D:\src\mfWebApi> f status --all
repository: D:/src/mfWebApi/..\mfwebapi.fossil
local-root: D:/src/mfWebApi/
config-db: C:/Users/x/AppData/Local/_fossil
checkout: 026aa5e6440477889165296b6e0f80d726750f2d 2020-01-10 17:49:36 UTC
parent: 3f7faf1038bc328a1440ebf5889381c617bb2118 2020-01-09 16:28:54 UTC
tags: trunk
comment: poprawki funkcji posrednich (user: x)
DELETED .vscode/launch.json
DELETED .vscode/tasks.json
EDITED Program.cs
UNCHANGED README
UNCHANGED TODO
UNCHANGED bihur/db/bihur.db.cs
UNCHANGED bihur/db/settings/bihur.db.settings.cs
UNCHANGED data/sql/SQLQuery1.sql
UNCHANGED data/sql/SQLQuery3.sql
UNCHANGED data/sql/test3.sql
ADDED data/sql/wynikSprawdzeniaTabela.sql
UNCHANGED dokumentacja/DaneTestowe-API-1.txt
UNCHANGED dokumentacja/SwaggerAPI.yml
UNCHANGED dokumentacja/WykazPodatnikowOpisAPI_v1_3_0.pdf
EDITED gov.mf.wl.cs
EDITED gov/mf/bialaLista/checkNipNumerKontaRequest.cs
EDITED gov/mf/bialaLista/checkRegonNumerKontaRequest.cs
UNCHANGED gov/mf/bialaLista/objects.cs
EDITED gov/mf/bialaLista/request.cs
UNCHANGED gov/mf/bialaLista/response.cs
EDITED gov/mf/bialaLista/searchByNipRequest.cs
EDITED gov/mf/bialaLista/searchByNumerKontaRequest.cs
ADDED gov/mf/bialaLista/searchByRegonRequest.cs
UNCHANGED mfWebApi.csproj
UNCHANGED old.code.cs

Tue Jan 21 08:55:47 EST 2020
let
	var N := 8

	type intArray = array of int

	var row := intArray [ N ] of 0
	var col := intArray [ N ] of 0
	var diag1 := intArray [N+N-1] of 0
	var diag2 := intArray [N+N-1] of 0

	function printboard() =
		(for i := 0 to N-1
		do (for j := 0 to N-1
			do print(if col[i]=j then " O" else " .");
			print("\n"));
		print("\n"))

	function try(c:int) =
		if c=N
		then printboard()
		else for r := 0 to N-1
			do if row[r] = 0 & diag1[r+c] = 0 & diag2[r + 7 - c] = 0
			then (row[r] := 1; diag1[r+c] := 1; diag2[r+7-c] := 1;
				col[c] := r;
				try(c+1);
				row[r] := 0; diag1[r+c] := 0; diag2[r+7-c] := 0)
	in try(0)
end

extern print
extern flush
extern getchar
extern ord
extern chr
extern size
extern substring
extern concat
extern not
extern exit
extern initArray
section .text
global main
main:
push rbp
mov rbp, rsp
sub rsp, 56
mov qword [rbp + 16], rdi
mov qword [rbp - 8], 8
mov rdi, qword [rbp - 8]
mov rsi, 0
call initArray
mov qword [rbp - 16], rax
mov rdi, qword [rbp - 8]
mov rsi, 0
call initArray
mov qword [rbp - 24], rax
mov rax, qword [rbp - 8]
mov rcx, qword [rbp - 8]
lea rdi, [rcx + rax - 1]
mov rsi, 0
call initArray
mov qword [rbp - 32], rax
mov rcx, qword [rbp - 8]
mov rax, qword [rbp - 8]
lea rdi, [rax + rcx - 1]
mov rsi, 0
call initArray
mov qword [rbp - 40], rax
mov rdi, rbp
mov rsi, 0
call L1
jmp L28
L28:
leave
ret
section .text
global L1
L1:
push rbp
mov rbp, rsp
sub rsp, 48
mov qword [rbp - 8], rbx
mov qword [rbp - 16], r12
mov qword [rbp - 24], r13
mov qword [rbp - 32], r14
mov r14, r15
mov qword [rbp + 16], rdi
mov rbx, rsi
mov rax, qword [rbp + 16]
cmp rbx, qword [rax - 8]
je L25
L26:
mov r13, 0
mov rax, qword [rbp + 16]
mov rax, qword [rax - 8]
lea r12, [rax - 1]
cmp r13, r12
jle L23
L15:
mov rax, 0
L27:
mov r15, r14
mov r14, qword [rbp - 32]
mov r13, qword [rbp - 24]
mov r12, qword [rbp - 16]
mov rbx, qword [rbp - 8]
jmp L29
L25:
mov rdi, qword [rbp + 16]
call L0
jmp L27
L24:
lea r13, [r13 + 1]
L23:
mov rax, qword [rbp + 16]
mov rax, qword [rax - 16]
cmp qword [rax + 8 * r13], 0
je L16
L17:
L19:
L21:
mov rax, 0
L22:
cmp r13, r12
jl L24
L30:
jmp L15
L16:
mov rax, qword [rbp + 16]
mov rax, qword [rax - 32]
lea rax, [rax + 8 * r13]
cmp qword [rax + 8 * rbx], 0
jne L19
L18:
mov rax, rbx
imul rax, -8
mov rcx, qword [rbp + 16]
mov rcx, qword [rcx - 40]
lea rcx, [rcx + 8 * r13]
cmp qword [rcx + rax + 56], 0
jne L21
L20:
mov rax, qword [rbp + 16]
mov rax, qword [rax - 16]
mov qword [rax + 8 * r13], 1
mov rax, qword [rbp + 16]
mov rax, qword [rax - 32]
lea rax, [rax + 8 * r13]
mov qword [rax + 8 * rbx], 1
mov rax, rbx
imul rax, -8
mov rcx, qword [rbp + 16]
mov rcx, qword [rcx - 40]
lea rcx, [rcx + 8 * r13]
mov qword [rcx + rax + 56], 1
mov rax, qword [rbp + 16]
mov rax, qword [rax - 24]
mov qword [rax + 8 * rbx], r13
mov rdi, qword [rbp + 16]
lea rsi, [rbx + 1]
call L1
mov rax, qword [rbp + 16]
mov rax, qword [rax - 16]
mov qword [rax + 8 * r13], 0
mov rax, qword [rbp + 16]
mov rax, qword [rax - 32]
lea rax, [rax + 8 * r13]
mov qword [rax + 8 * rbx], 0
mov rax, rbx
imul rax, -8
mov rcx, qword [rbp + 16]
mov rcx, qword [rcx - 40]
lea rcx, [rcx + 8 * r13]
mov qword [rcx + rax + 56], 0
mov rax, 0
jmp L22
L29:
leave
ret
section .text
global L0
L0:
push rbp
mov rbp, rsp
sub rsp, 40
mov qword [rbp - 8], rbx
mov qword [rbp - 16], r12
mov qword [rbp - 24], r13
mov qword [rbp - 32], r14
mov qword [rbp + 16], rdi
mov rbx, 0
mov rax, qword [rbp + 16]
mov rax, qword [rax - 8]
lea r14, [rax - 1]
cmp rbx, r14
jle L12
L2:
mov rdi, L14
call print
mov r14, qword [rbp - 32]
mov r13, qword [rbp - 24]
mov r12, qword [rbp - 16]
mov rbx, qword [rbp - 8]
jmp L31
L13:
lea rbx, [rbx + 1]
L12:
mov r13, 0
mov rax, qword [rbp + 16]
mov rax, qword [rax - 8]
lea r12, [rax - 1]
cmp r13, r12
jle L9
L3:
mov rdi, L11
call print
cmp rbx, r14
jl L13
L32:
jmp L2
L10:
lea r13, [r13 + 1]
L9:
mov rax, qword [rbp + 16]
mov rax, qword [rax - 24]
cmp qword [rax + 8 * rbx], r13
je L6
L7:
mov rdi, L5
L8:
call print
cmp r13, r12
jl L10
L33:
jmp L3
L6:
mov rdi, L4
jmp L8
L31:
leave
ret
section .rodata
global L14
L14: dd 1
db 10, 0
section .rodata
global L11
L11: dd 1
db 10, 0
section .rodata
global L5
L5: dd 2
db 32, 46, 0
section .rodata
global L4
L4: dd 2
db 32, 79, 0


Mon Jan 20 15:13:56 EST 2020
/*

   Copyright 2008 Bradley Nelson

   This file is part of Rainbow Forth.

   Rainbow Forth is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   Rainbow Forth is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with Rainbow Forth.  If not, see <http://www.gnu.org/licenses/>.

*/

#include "library.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>


#include <dlfcn.h>
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

// structure for library list
typedef struct _LIBRARY_ENTRY {
  struct _LIBRARY_ENTRY *next;
  const char *name;
  void *handle;
} LIBRARY_ENTRY;

// list of libraries
static LIBRARY_ENTRY *library_head=0;

void library_load(const char *name) {
  LIBRARY_ENTRY *e;
  LIBRARY_ENTRY **t;
  void *lib;

  // check for existing
  for(t=&library_head;(*t);t=&(*t)->next) {
    if(strcmp((*t)->name, name)==0) {
      // move to front
      e=(*t);
      (*t)=e->next;
      e->next=library_head;
      library_head=e;
      // done
      return;
    }
  }

/*I dont fully understand yet, but:
right, so 'lib' can be a dummy pointer.
return (void*)42;
then, dlsym() can look things up from a table of all known symbols
or the interesting symbols
or whatever.
if you actually need a working dlsym
-OriB
So I think dlopen can be trashed, and 'handle' needs to be replaced with some
kinda table of symbols from .a files.*/

you can even make it do it by library:
  // try to load it
/*lib=dlopen(name, RTLD_LAZY);
  if(!lib) return;
wtf we doin*/

  // add it
  e=(LIBRARY_ENTRY*)malloc(sizeof(LIBRARY_ENTRY));
  assert(e);
  // fill it out
  e->name=name;
  e->handle=lib;
  // add it in
  e->next=library_head;
  library_head=e;
}

void *library_symbol(const char *name) {
  LIBRARY_ENTRY *e;
  void *ret;

  // try each library
  for(e=library_head;e;e=e->next) {
    // check this one
    ret=dlsym(e->handle, name);
    // look it up
    if(ret) return ret;
  }
  // failure
  return 0;
}


Mon Jan 20 09:48:48 EST 2020
bind /root /root
mount -aC '#s/boot' /root
bind / /
bind -a /root /
mount -a '#s/boot' /
bind '#c' /dev
bind '#d' /fd
bind -c '#e' /env
bind '#p' /proc
bind -c '#s' /srv
bind '#σ' /shr
bind -a '#¤' /dev
bind -a '#¶' /dev
bind /mnt /mnt
bind /n /n
mount -a '#s/slashn' /n
mount -a '#s/slashmnt' /mnt
bind /mnt/exportfs /mnt/exportfs
mount -a '#s/mntexport' /mnt/exportfs
bind /386/bin /bin
bind -a /rc/bin /bin
bind /net /net
bind -a '#l' /net
bind -a '#I' /net
mount -C '#s/boot' /n/other other
bind -c /n/other/usr/glenda/tmp /usr/glenda/tmp
bind -c /n/other/usr/glenda/tmp /tmp
bind -a '#u' /dev
bind -a '#v' /dev
bind -a '#t' /dev
bind -a '#m' /dev
bind -a '#i' /dev
bind -a '#f' /dev
bind -a '#S' /dev
bind -a '#P' /dev
bind -a '#L' /dev
bind -a '#A' /dev
bind -a '#$' /dev
mount -b '#s/cons' /dev
bind /mnt/temp/factotum /mnt/factotum
bind -a '#u' /dev
bind -a '#σ/usb' /dev
bind -a '#σ/usbnet' /net
mount -a '#s/cs' /net
bind -b '#k' /dev
mount -a '#s/dns' /net
bind -a '#r' /dev
bind -a '#r' /dev
bind -a /usr/glenda/bin/rc /bin
bind -a /usr/glenda/bin/386 /bin
mount '#|/data' /mnt/webcookies
mount '#|/data' /mnt/web
mount '#s/plumb.glenda.569' /mnt/plumb
mount '#s/rio.glenda.574' /mnt/wsys 42
mount -b '#s/rio.glenda.574' /dev
cd /usr/glenda


Sun Jan 19 16:04:19 EST 2020
type is text
data matches '[Ff]ile "([.a-zA-Z¡-￿0-9_/+\-]*[a-zA-Z¡-￿0-9_/+\-])", line ([0-9]+),
characters ([0-9]+)-([0-9]+).*'
arg isfile $1
data set $file
attr add addr=$2-+#$3,$2-+#$4
plumb to edit
plumb start window $editor


Sun Jan 19 13:10:41 EST 2020
--- /mnt/git/branch/heads/master/tree/common.rc Sat Jan 18 19:51:23 2020
+++ common.rc Sun Jan 19 10:09:47 2020
@@ -19,5 +19,6 @@ fn gitup{
	if(~ $#gitrel 0)
		gitrel='.'
	cd $gitroot
- git/fs
+ if(test -e /mnt/git/ctl && ! grep '^repo '$gitroot'$' /mnt/git/ctl >
/dev/null)
+ git/fs
 }
--- /mnt/git/branch/heads/master/tree/fs.c Sat Jan 18 19:51:23 2020
+++ fs.c Sun Jan 19 10:06:08 2020
@@ -79,6 +79,7 @@ char *qroot[] = {
	"ctl",
 };

+char gitdir[512];
 char *username;
 char *mtpt = "/mnt/git";
 char **branches = nil;
@@ -396,6 +397,8 @@ gitattach(Req *r)

	if((d = dirstat(".git")) == nil)
		sysfatal("git/fs: %r");
+ if(getwd(gitdir, sizeof(gitdir)) == nil)
+ sysfatal("getwd: %r");
	aux = emalloc(sizeof(Gitaux));
	aux->crumb = emalloc(sizeof(Crumb));
	aux->crumb[0].qid = (Qid){Qroot, 0, QTDIR};
@@ -659,21 +662,28 @@ gitdestroyfid(Fid *f)
 static char *
 readctl(Req *r)
 {
- char data[512], buf[512], *p;
+ char data[1024], ref[512], *s, *e;
	int fd, n;
+
	if((fd = open(".git/HEAD", OREAD)) == -1)
		return Erepo;
	/* empty HEAD is invalid */
- if((n = readn(fd, buf, sizeof(buf) - 1)) <= 0)
+ if((n = readn(fd, ref, sizeof(ref) - 1)) <= 0)
		return Erepo;
	close(fd);
- p = buf;
- buf[n] = 0;
- if(strstr(p, "ref: ") == buf)
- p += strlen("ref: ");
- if(strstr(p, "refs/") == p)
- p += strlen("refs/");
- snprint(data, sizeof(data), "branch %s", p);
+
+ s = ref;
+ ref[n] = 0;
+ if(strncmp(s, "ref:", 4) == 0)
+ s += 4;
+ while(*s == ' ' || *s == '\t')
+ s++;
+ if((e = strchr(s, '\n')) != nil)
+ *e = 0;
+ if(strstr(s, "refs/") == s)
+ s += strlen("refs/");
+
+ snprint(data, sizeof(data), "branch %s\nrepo %s\n", s, gitdir);
	readstr(r, data);
	return nil;
 }


prev | next