| t@@ -106,9 +106,9 @@ int
create_poll_file(const char *name, const char *question, const char *options)
{
FILE *fp;
- char fname[PATH_MAX];
- char buf[PATH_MAX];
+ char fname[PATH_MAX], buf[PATH_MAX];
struct stat sb;
+ size_t col;
strlcpy(buf, name, sizeof(buf));
escapechars(buf);
t@@ -139,35 +139,31 @@ create_poll_file(const char *name, const char *question, const char *options)
exit(1);
} else {
fputs(question, fp);
- fputs("\n0\t", fp);
- /*while (*question != '\0') {
- switch(*question) {
- case '<':
- case '>':
- fputc(' ', fp);
- break;
- default:
- fputc(*question, fp);
- }
- (void)*question++;
- }*/
- while (*options != '\0') {
+ fputc('\n', fp);
+
+ for (col = 0; *options; (void)*options++) {
+
+ if (++col == 1 && *options != '\n' && *options != '\r')
+ fputs("0\t", fp);
+
switch(*options) {
- case '<':
- case '>':
case '\t':
fputc(' ', fp);
break;
- case '\n':
- fprintf(fp, "\n0\t");
+ case '\r':
break;
+ case '\n':
+ if (col < 3) {
+ col = 0;
+ break;
+ }
+ col = 0;
default:
fputc(*options, fp);
break;
}
- (void)*options++;
}
- fputc('\n', fp);
+ /* fputc('\n', fp); */
fclose(fp);
}
}
t@@ -213,11 +209,12 @@ list_polls()
}
puts("Poll listing");
+ puts(" ");
while ((p = fts_read(ftsp)) != NULL) {
switch (p->fts_info) {
case FTS_F:
- printf("%s\n",
+ printf("- %s
\n",
p->fts_path + LEN(POLLS_DIR),
p->fts_path + LEN(POLLS_DIR));
break;
t@@ -226,9 +223,13 @@ list_polls()
}
}
fts_close(ftsp);
+ puts(" ");
}
/*
+void
+increment_option(FILE *fp)
+{
while ((ch = fgetc(ft)) != EOF) {
if (ch == 'i') {
fseek(ft, -1, SEEK_CUR);
t@@ -236,6 +237,7 @@ list_polls()
fseek(ft, 0, SEEK_CUR);
}
}
+}
*/
void |