Slight improvements
This commit is contained in:
parent
7e7bfb2476
commit
10cbea0dac
@ -1,4 +1,3 @@
|
|||||||
#include "printf.h"
|
|
||||||
#include "string_buffer.h"
|
#include "string_buffer.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "comment.h"
|
#include "comment.h"
|
||||||
@ -8,6 +7,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#define COMMENTS_PER_PAGE 20
|
#define COMMENTS_PER_PAGE 20
|
||||||
#define MAX_NAME 1024
|
#define MAX_NAME 1024
|
||||||
@ -102,7 +102,7 @@ defer:
|
|||||||
void
|
void
|
||||||
print_submit_form()
|
print_submit_form()
|
||||||
{
|
{
|
||||||
fputs("<form action=\"\">\n"
|
fputs("<form action=\"\" method=\"POST\">\n"
|
||||||
"<label>Your name:</label>\n"
|
"<label>Your name:</label>\n"
|
||||||
"<input type=\"text\" name=\"displayname\"><br>\n"
|
"<input type=\"text\" name=\"displayname\"><br>\n"
|
||||||
"<label>Leave comment: </label><br>\n"
|
"<label>Leave comment: </label><br>\n"
|
||||||
@ -203,7 +203,7 @@ handle_submitted_comment()
|
|||||||
time(&header.creation_time);
|
time(&header.creation_time);
|
||||||
header.reply_id = rid;
|
header.reply_id = rid;
|
||||||
header.text_length = strlen(sanitized_text);
|
header.text_length = strlen(sanitized_text);
|
||||||
header.user_sid = "anonymous";
|
header.user_sid = "web/anonymous";
|
||||||
header.user_displayname = displayname;
|
header.user_displayname = displayname;
|
||||||
|
|
||||||
if (driver.leave_comment(&driver_data, &header, sanitized_text) < 0) {
|
if (driver.leave_comment(&driver_data, &header, sanitized_text) < 0) {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef STRING_BUFFER_H
|
#ifndef STRING_BUFFER_H
|
||||||
#define STRING_BUFFER_H
|
#define STRING_BUFFER_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
/* "move" underlying contents of buffer to str shrinking it */
|
/* "move" underlying contents of buffer to str shrinking it */
|
||||||
/* TODO: handle realloc fail */
|
/* TODO: handle realloc fail */
|
||||||
#define SB_MOVE(buffer, str) do { \
|
#define SB_MOVE(buffer, str) do { \
|
||||||
|
Loading…
Reference in New Issue
Block a user