summaryrefslogtreecommitdiff
path: root/vis/text-objects/indentation.in
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-02-07 11:26:12 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-02-07 11:32:47 +0100
commitcc0f8e94fed7fa2542d746361acdbfe76401a93e (patch)
tree379109844bb8647534bcd6033f4fe55af404c6d1 /vis/text-objects/indentation.in
parent6fce999e94d46c30e6c26ef31767279f813c90b5 (diff)
test: add a few new tests related to text objects
Diffstat (limited to 'vis/text-objects/indentation.in')
-rw-r--r--vis/text-objects/indentation.in16
1 files changed, 16 insertions, 0 deletions
diff --git a/vis/text-objects/indentation.in b/vis/text-objects/indentation.in
new file mode 100644
index 0000000..8ab6759
--- /dev/null
+++ b/vis/text-objects/indentation.in
@@ -0,0 +1,16 @@
+static ssize_t write_all(int fd, const char *buf, size_t count) {
+ size_t rem = count;
+ while (rem > 0) {
+ ssize_t written = write(fd, buf, rem);
+ if (written < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ continue;
+ return -1;
+ } else if (written == 0) {
+ break;
+ }
+ rem -= written;
+ buf += written;
+ }
+ return count - rem;
+}