[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 49/80: [indxbib]: Align with modern groff conventions.
From: |
G. Branden Robinson |
Subject: |
[groff] 49/80: [indxbib]: Align with modern groff conventions. |
Date: |
Sat, 30 Nov 2024 04:02:22 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit 9930f33a7f5c74c98ad71cf353725dd932efe5d5
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Nov 27 22:10:54 2024 -0600
[indxbib]: Align with modern groff conventions.
* src/utils/indxbib/indxbib.cpp: Include system library headers before
local ones.
Fix sloppy whitespace.
---
ChangeLog | 7 +++++++
src/utils/indxbib/indxbib.cpp | 21 ++++++++++++++-------
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f1dfe1dca..f8522b5a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-11-27 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [indxbib]: Align with modern groff conventions.
+
+ * src/utils/indxbib/indxbib.cpp: Include system library headers
+ before local ones.
+
2024-11-27 G. Branden Robinson <g.branden.robinson@gmail.com>
* src/roff/troff/hvunits.h: Drop Autoconf "<config.h>"-inclusion
diff --git a/src/utils/indxbib/indxbib.cpp b/src/utils/indxbib/indxbib.cpp
index 6999af259..1ac356187 100644
--- a/src/utils/indxbib/indxbib.cpp
+++ b/src/utils/indxbib/indxbib.cpp
@@ -16,15 +16,22 @@ for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "lib.h"
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <assert.h>
#include <errno.h>
-#include <stdlib.h>
+#include <stdlib.h> // mkstemp(), strtol()
+#include <stdio.h> // EOF, FILE, fclose(), fdopen(), fopen(), fseek(),
+ // getc(), rename(), setbuf(), stderr, stdin, stdout,
+ // ungetc()
+#include <string.h> // strerror()
+#ifdef HAVE_UNISTD_H
+#include <unistd.h> // getcwd(), unlink()
+#endif
+
+#include "lib.h"
#include "posix.h"
#include "errarg.h"
@@ -57,7 +64,7 @@ struct block {
block *next;
int used;
int v[BLOCK_SIZE];
-
+
block(block *p = 0) : next(p), used(0) { }
};
@@ -119,7 +126,7 @@ int main(int argc, char **argv)
program_name = argv[0];
static char stderr_buf[BUFSIZ];
setbuf(stderr, stderr_buf);
-
+
const char *base_name = 0;
typedef int (*parser_t)(const char *);
parser_t parser = do_file;
@@ -286,7 +293,7 @@ int main(int argc, char **argv)
write_hash_table();
if (fclose(indxfp) < 0)
fatal("error closing temporary index file: %1", strerror(errno));
- char *index_file = new char[strlen(base_name) + sizeof(INDEX_SUFFIX)];
+ char *index_file = new char[strlen(base_name) + sizeof(INDEX_SUFFIX)];
strcpy(index_file, base_name);
strcat(index_file, INDEX_SUFFIX);
#ifdef HAVE_RENAME
@@ -477,7 +484,7 @@ static int do_file(const char *filename)
DISCARD, // after truncate_len bytes of a key
MIDDLE // in between keys
} state = START;
-
+
// In states START, BOL, IGNORE_BOL, space_count how many spaces at
// the beginning have been seen. In states PERCENT, IGNORE, KEY,
// MIDDLE space_count must be 0.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 49/80: [indxbib]: Align with modern groff conventions.,
G. Branden Robinson <=