$Log$
+ Revision 601.90 2002/12/15 10:53:51 error
+ * Final touches on the new message formatter.
+
Revision 601.89 2002/12/15 09:42:37 error
* Converted more routines to new IPC code.
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
return;
}
if (text) {
- fmout2(screenwidth, NULL, text, NULL,
+ fmout(screenwidth, NULL, text, NULL,
((userflags & US_PAGINATOR) ? 1 : 0),
screenheight, 1, 1);
free(text);
}
scr_printf("<< wrong password >>\n");
if (strlen(rc_password) > 0)
- logoff(ipc, 0);
+ logoff(ipc, 2);
goto GSTA;
NEWUSR: if (strlen(rc_password) == 0) {
scr_printf(":\n");
lines_printed++;
- fmout2(screenwidth, NULL, listing, NULL, 1, screenheight, -1, 0);
+ fmout(screenwidth, NULL, listing, NULL, 1, screenheight, -1, 0);
free(listing);
/* when running in curses mode, the scroll bar in most
}
+#if 0
/*
* fmout() - Citadel text formatter and paginator
*/
}
return (sigcaught);
}
+#endif
/*
* fmout() - Citadel text formatter and paginator
*/
-int fmout2(
+int fmout(
int width, /* screen width to use */
FILE *fpin, /* file to read from, or NULL to format given text */
char *text, /* text to be formatted (when fpin is NULL */
num_urls = 0; /* Start with a clean slate of embedded URL's */
+ /* Space for a single word, which can be at most screenwidth */
word = (char *)calloc(1, width);
if (!word) {
err_printf("Can't alloc memory to print message: %s!\n",
logoff(NULL, 3);
}
+ /* Read the entire message body into memory */
if (fpin) {
size_t got = 0;
if (starting_lp >= 0)
lines_printed = starting_lp;
+ /* Run the message body */
while (*e) {
/* First, are we looking at a newline? */
if (*e == '\n') {
e++;
- if (*e == ' ') {
+ if (*e == ' ') { /* Paragraph */
if (fpout) {
fprintf(fpout, "\n");
} else {
lines_printed = checkpagin(lines_printed, pagin, height);
}
column = 0;
- } else if (old != ' ') {
+ } else if (old != ' ') {/* Don't print two spaces */
if (fpout) {
fprintf(fpout, " ");
} else {
}
column++;
}
+ old = '\n';
continue;
}
/* Or are we looking at a space? */
}
column = 0;
} else if (!(column == 0 && old == ' ')) {
- /* Eat the first space on a line */
+ /* Eat only the first space on a line */
if (fpout) {
fprintf(fpout, " ");
} else {
/* Decide where to print the word */
if (column + i >= width) {
+ /* Wrap to the next line */
if (fpout) {
fprintf(fpout, "\n");
} else {
scr_printf("%s", word);
}
column += i;
- e += i; /* Start with the whitepsace! */
+ e += i; /* Start over with the whitepsace! */
}
free(word);
if (fpin) /* We allocated this, remember? */
free(buffer);
+ /* Is this necessary? It makes the output kind of spacey. */
if (fpout) {
fprintf(fpout, "\n");
} else {
* Here we go
*/
if (format_type == 0) {
- fr = fmout2(screenwidth, NULL, message->text, dest,
+ fr = fmout(screenwidth, NULL, message->text, dest,
((pagin == 1) ? 1 : 0), screenheight, (-1), 1);
} else {
/* FIXME: renderer for text/plain */
if (mode == 0) {
fp = fopen(filename, "r");
if (fp != NULL) {
- fmout2(screenwidth, fp, NULL, NULL, 0, screenheight, 0, 0);
+ fmout(screenwidth, fp, NULL, NULL, 0, screenheight, 0, 0);
beg = ftell(fp);
fclose(fp);
} else {
}
fp = fopen(filename, "r");
if (fp != NULL) {
- fmout2(screenwidth, fp, NULL, NULL,
+ fmout(screenwidth, fp, NULL, NULL,
((userflags & US_PAGINATOR) ? 1 : 0),
screenheight, 0, 0);
beg = ftell(fp);
}
-/* display internal error as defined in errmsgs */
-/*
-void interr(int errnum) {
- scr_printf("*** INTERNAL ERROR %d\n"
- "(Press any key to continue)\n", errnum);
- inkey();
- logoff(errnum);
-}
-*/
-
-
void strproc(char *string)
{
int a;
7 Walden Leverich <waldenl@techsoftinc.com>
- 8 Michael Hampton <error@canandstring.com>
+ 8 Michael Hampton <error@spiritone.com>
Client Name Status Description
- 0 (unnamed) in design Client-side API library
+ 0 libcitadel in development Client-side API library
1 D.O.C. in development Dave's Own Citadel look-alike
69 Anticlimactic Teleservices