Comments (2)
Since all the uses of %n in cfm seem to be at the end of the format string, couldn't you instead use printf's return value (which, on success, is the number of characters printed)? e.g.:
printf(" %zu/%zu%n", n ? s+1 : n, n, &count);
would become
count = printf(" %zu/%zu", n ? s+1 : n, n);
EDIT:
and it seems that while %n is standard, android's libc bionic doesn't seem to support it, which is a reason to switch to using the return value https://en.wikipedia.org/wiki/Bionic_(software)#Differences_from_POSIX
from cfm.
I might do this, though not because of the Android thing. Android is in second place on the list of operating systems that cfm is not targeted at, following Windows, but in the interest of portability I suppose I could do this. A much better reason to do this is reducing the runtime and increasing security (theoretically) of printf.
from cfm.
Related Issues (20)
- When renaming a file, locate the new file name and select it
- Allow deleting a file without backing it up HOT 1
- Add a CD-on-close feature HOT 1
- Copying large directories may lock up cfm and/or the term HOT 2
- If pwd is a symlink and cfm is launched without arguments, cfm's wd will be the original path, not the current one HOT 2
- If the working directory is specified as argv[1], symlinks are resolved HOT 1
- Bulk rename; bulk copy/paste HOT 6
- Replace %n with return value from printf, because it's more efficient HOT 1
- Use scandir?
- Suggestions HOT 3
- Shorten $HOME to ~ in pwd HOT 2
- File Copy/Remove Progress Indication HOT 1
- Experiment with Mouse
- If rename/new file/etc. return invalid names, cancel operation
- Shell script $EDITOR handling HOT 23
- Terminal (Alacritty) not cleared HOT 3
- `p` crashes program HOT 1
- File/ Dir does not delete sometimes HOT 14
- Copying a directory into itself causes recursion
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cfm.