]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/io/files/info/unix/unix-docs.factor
use radix literals
[factor.git] / basis / io / files / info / unix / unix-docs.factor
index 62837dae7e411cc75d30eec00e33ef1ec7ec765e..82d1e727f947ffbd2f2ea172ad30d8ba1acde5a7 100644 (file)
@@ -2,7 +2,19 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: classes help.markup help.syntax io.streams.string
 strings math calendar io.files.info io.files.info.unix ;
-IN: io.files.unix
+IN: io.files.info.unix
+
+HELP: add-file-permissions
+{ $values
+     { "path" "a pathname string" }
+     { "n" integer } }
+{ $description "Ensures that the bits from " { $snippet "n" } " are set in the Unix file permissions for a given file." } ;
+
+HELP: remove-file-permissions
+{ $values
+     { "path" "a pathname string" }
+     { "n" integer } }
+{ $description "Ensures that the bits from " { $snippet "n" } " are cleared in the Unix file permissions for a given file." } ;
 
 HELP: file-group-id
 { $values
@@ -90,16 +102,15 @@ HELP: set-file-permissions
      { "path" "a pathname string" } { "n" "an integer, interepreted as a string of bits" } }
 { $description "Sets the file permissions for a given file with the supplied Unix permissions integer. Supplying an octal number with " { $link POSTPONE: OCT: } " is recommended." }
 { $examples "Using the tradidional octal value:"
-    { $unchecked-example "USING: io.files.unix kernel ;"
-        "\"resource:license.txt\" OCT: 755 set-file-permissions"
-        ""
+    { $code "USING: io.files.info.unix kernel ;"
+        "\"resource:license.txt\" 0o755 set-file-permissions"
     }
     "Higher-level, setting named bits:"
-    { $unchecked-example "USING: io.files.unix kernel math.bitwise ;"
+    { $code "USING: io.files.info.unix kernel literals ;"
     "\"resource:license.txt\""
-    "{ USER-ALL GROUP-READ GROUP-EXECUTE OTHER-READ OTHER-EXECUTE }"
-    "flags set-file-permissions"
-    "" }
+    "flags{ USER-ALL GROUP-READ GROUP-EXECUTE OTHER-READ OTHER-EXECUTE }"
+    "set-file-permissions"
+    }
 } ;
 
 HELP: set-file-times
@@ -231,8 +242,12 @@ ARTICLE: "unix-file-permissions" "Unix file permissions"
     other-write?
     other-execute?
 }
-"Writing all file permissions:"
-{ $subsections set-file-permissions }
+"Changing file permissions:"
+{ $subsections
+    add-file-permissions
+    remove-file-permissions
+    set-file-permissions
+}
 "Writing individual file permissions:"
 { $subsections
     set-uid