mirror of
https://github.com/urbit/shrub.git
synced 2024-12-30 07:35:19 +03:00
vere: trim trailing whitespace from pace file
This commit is contained in:
parent
83fdfa99c3
commit
45e3609da7
@ -21,6 +21,7 @@
|
||||
# ifndef _XOPEN_SOURCE
|
||||
# define _XOPEN_SOURCE 700
|
||||
# endif
|
||||
# include <ctype.h>
|
||||
# include <inttypes.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
@ -38,6 +39,7 @@
|
||||
# include <sys/sendfile.h>
|
||||
|
||||
# elif defined(U3_OS_osx)
|
||||
# include <ctype.h>
|
||||
# include <inttypes.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
@ -58,6 +60,7 @@
|
||||
# include <copyfile.h>
|
||||
|
||||
# elif defined(U3_OS_bsd)
|
||||
# include <ctype.h>
|
||||
# include <inttypes.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
@ -77,6 +80,7 @@
|
||||
# define signal mingw_has_no_usable_signal
|
||||
# define raise mingw_has_no_usable_raise
|
||||
# define _POSIX
|
||||
# include <ctype.h>
|
||||
# include <inttypes.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
@ -321,16 +321,21 @@ _king_get_pace(void)
|
||||
len_w = buf_u.st_size;
|
||||
pat_c = c3_malloc(len_w + 1);
|
||||
red_w = read(fid_i, pat_c, len_w);
|
||||
pat_c[len_w] = 0;
|
||||
close(fid_i);
|
||||
|
||||
if ( len_w != red_w ) {
|
||||
c3_free(pat_c);
|
||||
u3l_log("unable to read pace file, "
|
||||
"falling back to default (\"live\")\n");
|
||||
return strdup("live");
|
||||
}
|
||||
|
||||
// XX trim pat_c ?
|
||||
//
|
||||
pat_c[len_w] = 0;
|
||||
|
||||
while ( len_w-- && isspace(pat_c[len_w]) ) {
|
||||
pat_c[len_w] = 0;
|
||||
}
|
||||
|
||||
return pat_c;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user