- Timestamp:
- Jul 21, 2011, 5:06:19 PM (13 years ago)
- Branches:
- master, release-1.10, release-1.9
- Children:
- 6500907
- Parents:
- d8f22b6
- git-author:
- Jason Gross <jgross@mit.edu> (07/20/11 03:09:43)
- git-committer:
- Jason Gross <jgross@mit.edu> (07/21/11 17:06:19)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
text.c
r6829afc r14be3a5 7 7 /* Returns a copy of 'in' with each line indented 'n' 8 8 * characters. Result must be freed with g_free. */ 9 CALLER_OWN char *owl_text_indent(const char *in, int n )9 CALLER_OWN char *owl_text_indent(const char *in, int n, bool indent_first_line) 10 10 { 11 11 const char *ptr1, *ptr2, *last; 12 12 GString *out = g_string_new(""); 13 13 int i; 14 bool indent_this_line = indent_first_line; 14 15 15 16 last=in+strlen(in)-1; 16 17 ptr1=in; 17 18 while (ptr1<=last) { 18 for (i=0; i<n; i++) { 19 g_string_append_c(out, ' '); 20 } 19 if (indent_this_line) { 20 for (i = 0; i < n; i++) { 21 g_string_append_c(out, ' '); 22 } 23 } 24 indent_this_line = true; 21 25 ptr2=strchr(ptr1, '\n'); 22 26 if (!ptr2) {
Note: See TracChangeset
for help on using the changeset viewer.