https://github.com/lovasko/np
Number Print Utility
https://github.com/lovasko/np
Last synced: about 1 year ago
JSON representation
Number Print Utility
- Host: GitHub
- URL: https://github.com/lovasko/np
- Owner: lovasko
- License: other
- Created: 2016-03-25T00:18:37.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-30T16:00:59.000Z (almost 10 years ago)
- Last Synced: 2025-02-16T19:48:24.350Z (over 1 year ago)
- Language: Haskell
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# np
A command-line utility that converts simple integers between various bases.
## Usage
The first argument to the utility defines the schema of the conversion. The
two-letter description is composed of input and output bases. To denote a base,
one of the following characters has to be used:
* `b` for the binary base
* `o` for the octal base
* `d` for the decimal base
* `x` for the hexadecimal base
Following the conversion schema, the actual number is expected. The integer has
to fit into the `intmax_t` type.
## Example
Convert decimal number `123` to the hexadecimal base:
```sh
$ np dx 123
0x7b
```
Convert hexadecimal number `0x555` to the binary base:
```sh
$ np xb 555
0b10101010101
```
## Build & install
```
$ make
$ sudo mv ./np /usr/bin
```
## Dependencies
* [libits](https://github.com/lovasko/libits)
## License
2-clause BSD license. For more information please consult the
[LICENSE](LICENSE.md) file. In the case that you need a different license, feel
free to contact me.
## Author
Daniel Lovasko (daniel.lovasko@gmail.com)