Changeset 45e2c95 for keybinding.c
- Timestamp:
- Mar 24, 2011, 4:09:22 PM (13 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- d07af84
- Parents:
- b13daa0
- git-author:
- David Benjamin <davidben@mit.edu> (03/10/11 15:45:00)
- git-committer:
- David Benjamin <davidben@mit.edu> (03/24/11 16:09:22)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
keybinding.c
rb13daa0 r45e2c95 85 85 } 86 86 87 /* returns 0 on success */ 88 int owl_keybinding_stack_tostring(int *j, int len, char *buff, int bufflen) 87 char *owl_keybinding_stack_tostring(int *j, int len) 89 88 { 90 char *pos = buff;91 int rem = bufflen;92 int i, n;89 GString *string; 90 char keypress[64]; /* TODO: don't hard-code a value here. */ 91 int i; 93 92 94 for (i=0; i < len; i++) { 95 owl_keypress_tostring(j[i], 0, pos, rem-1); 96 if (i < len - 1) strcat(pos, " "); 97 n = strlen(pos); 98 pos += n; 99 rem -= n; 93 string = g_string_new(""); 94 for (i = 0; i < len; i++) { 95 owl_keypress_tostring(j[i], 0, keypress, sizeof(keypress)); 96 g_string_append(string, keypress); 97 if (i < len - 1) g_string_append_c(string, ' '); 100 98 } 101 return 0;99 return g_string_free(string, false); 102 100 } 103 101 104 /* returns 0 on success */ 105 int owl_keybinding_tostring(const owl_keybinding *kb, char *buff, int bufflen) 102 char *owl_keybinding_tostring(const owl_keybinding *kb) 106 103 { 107 return owl_keybinding_stack_tostring(kb->keys, kb->len , buff, bufflen);104 return owl_keybinding_stack_tostring(kb->keys, kb->len); 108 105 } 109 106
Note: See TracChangeset
for help on using the changeset viewer.