diff --git a/main.rkt b/main.rkt index 6ad0dfb..e21cf00 100644 --- a/main.rkt +++ b/main.rkt @@ -41,6 +41,12 @@ ) ) +(define (section=? sect inp-sect) + (string-ci=? (format "~a" sect) (format "~a" inp-sect))) + +(define (key=? key inp-key) + (section=? key inp-key)) + (define (ini->file ini file #:private? [private? #f]) (let* ((file (get-ini-file file)) (_ (make-parent-directory* file)) @@ -54,7 +60,7 @@ (let ((last-is-newline #f)) (for-each (lambda (section) (let ((section-name (car section))) - (if (eq? section-name 'nil) + (if (section=? section-name 'nil) #t (begin (unless last-is-newline (newline out)) @@ -155,13 +161,13 @@ (letrec ((g (lambda (ini) (if (null? ini) def-val - (if (eq? section (caar ini)) + (if (section=? section (caar ini)) (letrec ((f (lambda (l) (if (null? l) def-val (let ((entry (car l))) (if (eq? (car entry) 'keyval) - (if (eq? (cadr entry) key) + (if (key=? (cadr entry) key) (caddr entry) (f (cdr l))) (f (cdr l)))))))) @@ -180,7 +186,7 @@ (list (list 'keyval key val)))) (let ((entry (car sect))) (if (eq? (car entry) 'keyval) - (if (eq? (cadr entry) key) + (if (key=? (cadr entry) key) (begin (set! found #t) (cons (list 'keyval key val) (for-sect (cdr sect)))) @@ -193,7 +199,7 @@ (list (list section (list 'keyval key val)))) (let* ((ini-section (car ini)) (section-key (car ini-section))) - (if (eq? section-key section) + (if (section=? section-key section) (cons (cons section (for-sect (cdr ini-section))) (for-ini (cdr ini))) (cons ini-section (for-ini (cdr ini))))))))) (let ((new-ini (for-ini (mcdr ini))))