Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 4108e77e0eb091fdd9b9c4174374a6ac0cc0abd0 authored by Dmitry Belyavskiy on 27 May 2020, 09:56:07 UTC, committed by Dmitry Belyavskiy on 27 May 2020, 09:56:07 UTC
API changes
1 parent a90ad6c
  • Files
  • Changes
  • 2879a7b
  • /
  • tcl_tests
  • /
  • yarrowc.tcl
Raw File
Cook and download a directory from the Software Heritage Vault

You have requested the cooking of the directory with identifier None into a standard tar.gz archive.

Are you sure you want to continue ?

Download a directory from the Software Heritage Vault

You have requested the download of the directory with identifier None as a standard tar.gz archive.

Are you sure you want to continue ?

Cook and download a revision from the Software Heritage Vault

You have requested the cooking of the history heading to revision with identifier swh:1:rev:4108e77e0eb091fdd9b9c4174374a6ac0cc0abd0 into a bare git archive.

Are you sure you want to continue ?

Download a revision from the Software Heritage Vault

You have requested the download of the history heading to revision with identifier swh:1:rev:4108e77e0eb091fdd9b9c4174374a6ac0cc0abd0 as a bare git archive.

Are you sure you want to continue ?

Invalid Email !

The provided email is not well-formed.

Download link has expired

The requested archive is no longer available for download from the Software Heritage Vault.

Do you want to cook it again ?

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • content
revision badge
swh:1:rev:4108e77e0eb091fdd9b9c4174374a6ac0cc0abd0
content badge Iframe embedding
swh:1:cnt:66a815366b08fad6b2e238236b30ef084b44323d
yarrowc.tcl
set argport 7670
if {[lindex $argv 0] eq "-port"} {
	set argport [lindex $argv 1]
	set argv [lrange $argv 2 end]
}
set request [lindex $argv 0]
set len [switch $request ping {expr -1} protocol {expr -2} version {expr -3} check {expr 1} default {expr $request}]
set read_data {}

proc get_port {} {
	if {[regexp {^\d+$} $::argport]} {return $::argport}
	set f [open $::argport r]
	set r [read -nonewline $f]
	close $f
	return $r
}

proc get_data {socket} {
	set read_data [read $socket]
	if {$read_data eq ""} {
		close $socket
		handle_data
	} else {
		append ::read_data $read_data
	}
}

proc handle_data {} {
	global len read_data
	if {$len > 0} {
		if {$::request eq "check" && $read_data ne ""} {exit 0}
		if {$read_data eq ""} {
			puts stderr "not ready"
			exit 1
		}
		binary scan $read_data H* data
		set data [regsub -all ".{48}" [regsub -all ".." $data "& "] "&\n"]
		if {[string index $data end] eq "\n"} {set data [string replace $data end end]}
		puts $data
	} else {
		if {$len == -1 || $len == -3} {
			if {[string length $read_data] < 4} {error "Not enough data"}
			binary scan $read_data I rlen
			set read_data [string range $read_data 4 end]
			puts [encoding convertfrom utf-8 $read_data]
			if {[string length $read_data] != $rlen} {
				puts stderr "Real string length [string length $read_data] != claimed $rlen!"
				exit 2
			}
		} elseif {$len == -2} {
			if {[string length $read_data] < 4} {error "Not enough data"}
			if {[string length $read_data] > 4} {error "Excess data"}
			binary scan $read_data I r
			puts $r
		}
	}
	exit 0
}

set port [get_port]
		
if {[info exists errmsg] && $errmsg ne ""} {error $errmsg}
if {$port eq ""} {error "Cannot find port number"}

set s [socket localhost $port]
fconfigure $s -encoding binary -buffering none -blocking 0
fileevent $s readable [list get_data $s]
puts -nonewline $s [binary format I $len]
after 4000 {puts stderr "Timeout.  Read for now: '$read_data'"; exit 2}
vwait forever
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top