Browse Source

fixfmt: last set of changes.

I'm ready to claim this is done. These last changes
tweak the FmtFlags a big to match the documents
and desired behavior.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 7 years ago
parent
commit
f030c715d7
2 changed files with 8 additions and 7 deletions
  1. 4 7
      sys/man/2/print
  2. 4 0
      sys/src/libc/fmt/dofmt.c

+ 4 - 7
sys/man/2/print

@@ -186,26 +186,26 @@ described below.
 .PP
 The numeric verbs
 .BR d ,
+.BR u ,
 .BR o ,
 .BR b ,
 .BR x ,
 and
 .B X
-format their arguments in decimal,
-octal, binary, hexadecimal, and upper case hexadecimal.
+format their arguments in decimal, unsigned decimal,
+unsigned octal, unsigned binary, unsigned hexadecimal, and unsigned upper case hexadecimal.
 Each interprets the flags
 .BR 0 ,
 .BR h ,
 .BR hh ,
 .BR l ,
-.BR u ,
 .BR + ,
 .BR - ,
 .BR , ,
 and
 .B #
 to mean pad with zeros,
-short, byte, long, unsigned, always print a sign, left justified, commas every three digits,
+short, byte, long, always print a sign, left justified, commas every three digits,
 and alternate format.
 Also, a space character in the flag
 position is like
@@ -215,9 +215,6 @@ If neither
 short nor long is specified,
 then the argument is an
 .BR int .
-If unsigned is specified,
-then the argument is interpreted as a
-positive number and no sign is output.
 If two
 .B l
 flags are given,

+ 4 - 0
sys/src/libc/fmt/dofmt.c

@@ -381,16 +381,20 @@ _ifmt(Fmt *f)
 		break;
 	case 'x':
 		base = 16;
+		f->flags |= FmtUnsigned;
 		break;
 	case 'X':
 		base = 16;
+		f->flags |= FmtUnsigned;
 		conv = "0123456789ABCDEF";
 		break;
 	case 'b':
 		base = 2;
+		f->flags |= FmtUnsigned;
 		break;
 	case 'o':
 		base = 8;
+		f->flags |= FmtUnsigned;
 		break;
 	default:
 		return -1;