Megatest

Diff
Login

Differences From Artifact [5328865f26]:

To Artifact [405f0df78e]:


254
255
256
257
258
259
260
261

262
263
264
265
266
267
268
254
255
256
257
258
259
260

261
262
263
264
265
266
267
268







-
+







		      #f)))
    (if valid
	(if split
	    tlist
	    target)
	(if target
	    (begin
	      (debug:print 0 "ERROR: Invalid target, spaces or blanks not allowed")
	      (debug:print 0 "ERROR: Invalid target, spaces or blanks not allowed \"" target "\"")
	      #f)
	    #f))))

;;======================================================================
;; M I S C   L I S T S
;;======================================================================

385
386
387
388
389
390
391
392

393
394
395
396
397






398
399
400
401
402


403
404
405
406
407






408
409
410
411

412
413
414
415
416
417
418
385
386
387
388
389
390
391

392
393
394



395
396
397
398
399
400
401
402
403


404
405
406
407



408
409
410
411
412
413
414
415
416

417
418
419
420
421
422
423
424







-
+


-
-
-
+
+
+
+
+
+



-
-
+
+


-
-
-
+
+
+
+
+
+



-
+







	 (uname #f))
    (if (null? (car uname-res))
	"unknown"
	(caar uname-res))))
	      
(define (save-environment-as-files fname #!key (ignorevars (list "USER" "HOME" "DISPLAY" "LS_COLORS" "XKEYSYMDB" "EDITOR")))
  (let ((envvars (get-environment-variables))
        (whitesp (regexp "[^a-zA-Z0-9_\\-:;,.\\/%$]")))
        (whitesp (regexp "[^a-zA-Z0-9_\\-:,.\\/%$]")))
     (with-output-to-file (conc fname ".csh")
       (lambda ()
          (for-each (lambda (key)
		      (let* ((val (cdr key))
			     (sval (if (string-search whitesp val)(conc "\"" val "\"") val)))
          (for-each (lambda (keyval)
		      (let* ((key   (car keyval))
			     (val   (cdr keyval))
			     (delim (if (string-search whitesp val) 
					"\""
					"")))
			(print (if (member key ignorevars)
				   "# setenv "
				   "setenv ")
			       (car key) " " sval)))
		      envvars)))
			       key " " delim val delim)))
		    envvars)))
     (with-output-to-file (conc fname ".sh")
       (lambda ()
          (for-each (lambda (key)
		      (let* ((val (cdr key))
			     (sval (if (string-search whitesp val)(conc "\"" val "\"") val)))
          (for-each (lambda (keyval)
		      (let* ((key (car keyval))
			     (val (cdr keyval))
			     (delim (if (string-search whitesp val) 
					"\""
					"")))
			(print (if (member key ignorevars)
				   "# export "
				   "export ")
			       (car key) "=" sval)))
			       key "=" delim val delim)))
                    envvars)))))

;; set some env vars from an alist, return an alist with original values
;; (("VAR" "value") ...)
(define (alist->env-vars lst)
  (if (list? lst)
      (let ((res '()))