1
0
Fork 0

import bonsai fixes

This commit is contained in:
dtb 2024-01-06 15:11:51 -07:00
parent 1b375e9d9a
commit 428a56eaad
1 changed files with 16 additions and 16 deletions

32
dj/dj.c
View File

@ -210,21 +210,6 @@ Io_write(struct Io *io){
return io;
}
/* Parses the string s to an integer, returning either the integer or in the
* case of an error a negative integer. This is used for argument parsing
* (e.g. -B [int]) in dj and no negative integer would be valid anyway. */
static long
parse(char *s){
long r;
errno = 0;
r = (long)strtol(s, &s, 0);
if(*s == '\0' /* no chars left unparsed */ && errno == 0)
return r;
else
return -1;
}
/* Prints an error message suitable for the event of an operating system error,
* with the error itself to be described in the string s. */
static int
@ -247,6 +232,21 @@ output(struct Io io[2]){
return io;
}
/* Parses the string s to an integer, returning either the integer or in the
* case of an error a negative integer. This is used for argument parsing
* (e.g. -B [int]) in dj and no negative integer would be valid anyway. */
static long
parse(char *s){
long r;
errno = 0;
r = (long)strtol(s, &s, 0);
if(*s == '\0' /* no chars left unparsed */ && errno == 0)
return r;
else
return -1;
}
static int
usage(char *argv0){
@ -339,7 +339,7 @@ int main(int argc, char *argv[]){
else if(io[0].bufuse < io[0].bs){
++io[0].prec;
if(debug >= 2){
fprintf(stderr, "%s: Partial write:\n\t", ARGV0(argv[0]));
fprintf(stderr, "%s: Partial read:\n\t", ARGV0(argv[0]));
output(io);
}
if(!noerror)