+/* escape_perm_xline()
+ *
+ * inputs - gecos
+ * outputs - escaped gecos (allocated with rb_malloc())
+ * side effects - none
+ */
+static char *
+escape_perm_xline(const char *gecos)
+{
+ char *result;
+ int i, j;
+
+ result = rb_malloc(2 * strlen(gecos) + 1);
+ for (i = 0, j = 0; gecos[i] != '\0'; i++)
+ {
+ result[j++] = gecos[i];
+ if (gecos[i] == '"' && gecos[i + 1] == ',')
+ result[j++] = '\\';
+ }
+ result[j] = '\0';
+ return result;
+}
+