]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
system_data_types.7: Minor tweaks to Alejandro Colomar's patch
authorMichael Kerrisk <mtk.manpages@gmail.com>
Mon, 21 Sep 2020 14:08:18 +0000 (16:08 +0200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Mon, 21 Sep 2020 14:08:18 +0000 (16:08 +0200)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man7/system_data_types.7

index da57deffa4449176b7590548ce24520c390d3606..d050c437caf4640fdbbdd7973f300ab3e482e9f8 100644 (file)
@@ -660,8 +660,8 @@ The program shown below scans from a string and prints a value stored in
 a variable of an integer type that doesn't have a length modifier.
 The appropriate conversions from and to
 .IR intmax_t ,
-and the appropriate range checkings,
-are used as explained in the notes section above:
+and the appropriate range checks,
+are used as explained in the notes section above.
 .PP
 .EX
 #include <stdint.h>
@@ -669,7 +669,6 @@ are used as explained in the notes section above:
 #include <stdlib.h>
 #include <sys/types.h>
 
-
 int
 main (void)
 {
@@ -678,26 +677,32 @@ main (void)
     intmax_t    tmp;
 
     /* Scan the number from the string into the temporary variable */
+
     sscanf(str, "%jd", &tmp);
 
     /* Check that the value is within the valid range of suseconds_t */
-    if (tmp < -1 || tmp > 1000000) {
-        fprintf(stderr, "Scaned value might overflow!\en");
+
+    if (tmp < \-1 || tmp > 1000000) {
+        fprintf(stderr, "Scanned value outside valid range!\en");
         exit(EXIT_FAILURE);
     }
 
-    /* Copy the value to the suseconds_t variable 'us' */
+    /* Copy the value to the suseconds_t variable \(aqus\(aq */
+
     us = tmp;
 
-    /* Even though suseconds_t can hold the value -1,
-       it represents an error code */
+    /* Even though suseconds_t can hold the value \-1, this isn\(aqt
+       a sensible number of microseconds */
+
     if (us < 0) {
-        fprintf(stderr, "Scanned an error code!\en");
+        fprintf(stderr, "Scanned value shouldn\(aqt be negative!\en");
         exit(EXIT_FAILURE);
     }
 
     /* Print the value */
-    printf("There are %jd us in half a second.\en", (intmax_t) us);
+
+    printf("There are %jd microseconds in half a second.\en",
+            (intmax_t) us);
 
     exit(EXIT_SUCCESS);
 }