* minor changes in comments
This commit is contained in:
		
							parent
							
								
									2b75e4feee
								
							
						
					
					
						commit
						216c0d124d
					
				
							
								
								
									
										16
									
								
								netrc.scm
								
								
								
								
							
							
						
						
									
										16
									
								
								netrc.scm
								
								
								
								
							| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
;;; netrc.scm -- parse authentication information contained in ~/.netrc
 | 
			
		||||
;;
 | 
			
		||||
;; $Id: netrc.scm,v 1.4 2001/12/27 16:45:32 interp Exp $
 | 
			
		||||
;; $Id: netrc.scm,v 1.5 2002/02/12 11:47:53 interp Exp $
 | 
			
		||||
;;
 | 
			
		||||
;; Please send suggestions and bug reports to <emarsden@mail.dotcom.fr>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -33,6 +33,20 @@
 | 
			
		|||
 | 
			
		||||
;;; Entry points =======================================================
 | 
			
		||||
;;
 | 
			
		||||
;; What you probably want, is to read out the default netrc-file. Do the
 | 
			
		||||
;; following:
 | 
			
		||||
;;
 | 
			
		||||
;; (let ((netrc-record (netrc:parse)))
 | 
			
		||||
;;    (netrc:lookup netrc-record "name of the machine")) 
 | 
			
		||||
;; 
 | 
			
		||||
;; and you will receive three values: login-name, password and account-name.
 | 
			
		||||
;; If you only want the login-name or the password, use netrc:lookup-login
 | 
			
		||||
;; or netrc:lookup-password resp.
 | 
			
		||||
;;
 | 
			
		||||
;; You will get either the login / password for the specified machine, 
 | 
			
		||||
;; or a default login / password if the machine is unknown.
 | 
			
		||||
;; 
 | 
			
		||||
;;
 | 
			
		||||
;; (user-mail-address) -> string
 | 
			
		||||
;;    Calculate the user's email address, as per the Emacs function of
 | 
			
		||||
;;    the same name. Will take into account the environment variable
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										24
									
								
								url.scm
								
								
								
								
							
							
						
						
									
										24
									
								
								url.scm
								
								
								
								
							| 
						 | 
				
			
			@ -41,9 +41,8 @@
 | 
			
		|||
;;; Parse a URI path (a list representing a path, not a string!) into
 | 
			
		||||
;;; a userhost record. Default values are taken from the userhost
 | 
			
		||||
;;; record DEFAULT except for the host. Returns a userhost record if
 | 
			
		||||
;;; it wins, and #f if it cannot parse the path. CADDR drops the
 | 
			
		||||
;;; userhost portion of the path. In fact, fatal-syntax-error is
 | 
			
		||||
;;; called, if the path doesn't start with '//'.
 | 
			
		||||
;;; it wins. CADDR drops the userhost portion of the path. In fact,
 | 
			
		||||
;;; fatal-syntax-error is called, if the path doesn't start with '//'.
 | 
			
		||||
 | 
			
		||||
(define (parse-userhost path default)
 | 
			
		||||
  (if (and (pair? path)				; The thing better begin
 | 
			
		||||
| 
						 | 
				
			
			@ -113,16 +112,17 @@
 | 
			
		|||
  frag-id)
 | 
			
		||||
 | 
			
		||||
;;; The URI parser (parse-uri in uri.scm) maps a string to four parts:
 | 
			
		||||
;;;     <scheme> : <path> ? <search> # <frag-id>
 | 
			
		||||
;;; <scheme>, <search>, and <frag-id> are strings; <path> is a non-empty
 | 
			
		||||
;;; string list -- the URI's path split at slashes. Optional parts of the
 | 
			
		||||
;;; URI, when missing, are specified as #f. If <scheme> is "http", then the
 | 
			
		||||
;;; other three parts can be passed to PARSE-HTTP-URL, which parses them
 | 
			
		||||
;;; into a HTTP-URL record (or #f if the string cannot be parsed). All strings
 | 
			
		||||
;;; come back from the URI parser encoded. SEARCH and FRAG-ID are left
 | 
			
		||||
;;; that way; this parser decodes the path elements.
 | 
			
		||||
;;; <scheme> : <path> ? <search> # <frag-id> <scheme>, <search>, and
 | 
			
		||||
;;; <frag-id> are strings; <path> is a non-empty string list -- the
 | 
			
		||||
;;; URI's path split at slashes. Optional parts of the URI, when
 | 
			
		||||
;;; missing, are specified as #f. If <scheme> is "http", then the
 | 
			
		||||
;;; other three parts can be passed to PARSE-HTTP-URL, which parses
 | 
			
		||||
;;; them into a HTTP-URL record. All strings come back from the URI
 | 
			
		||||
;;; parser encoded. SEARCH and FRAG-ID are left that way; this parser
 | 
			
		||||
;;; decodes the path elements.
 | 
			
		||||
;;;
 | 
			
		||||
;;; Return #f if the URL could not be parsed.
 | 
			
		||||
;;; Returns a HTTP-URL record, if possible. Otherwise
 | 
			
		||||
;;; FATAL-SYNTAX-ERROR is called.
 | 
			
		||||
 | 
			
		||||
(define (parse-http-url path search frag-id)
 | 
			
		||||
  (let ((uh (parse-userhost path default-http-userhost)))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue