[Pkg-wmaker-commits] [wmbiff] 50/77: oops (indent)
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:01:12 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to tag wmbiff_0_4_0
in repository wmbiff.
commit e69fd1dc466e827972b3693a21a65d00d82cc5d6
Author: bluehal <bluehal>
Date: Sat Apr 20 07:54:06 2002 +0000
oops (indent)
---
wmbiff/Client.h | 6 +--
wmbiff/LicqClient.c | 20 ++++----
wmbiff/ShellClient.c | 112 ++++++++++++++++++++++----------------------
wmbiff/mboxClient.c | 130 +++++++++++++++++++++++++--------------------------
4 files changed, 134 insertions(+), 134 deletions(-)
diff --git a/wmbiff/Client.h b/wmbiff/Client.h
index 5178bc3..d76300d 100644
--- a/wmbiff/Client.h
+++ b/wmbiff/Client.h
@@ -1,4 +1,4 @@
-/* $Id: Client.h,v 1.17 2002/04/20 07:49:23 bluehal Exp $ */
+/* $Id: Client.h,v 1.18 2002/04/20 07:54:06 bluehal Exp $ */
/* Author : Scott Holden ( scotth at thezone.net )
Modified : Yong-iL Joh ( tolkien at mizi.com )
Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
@@ -86,8 +86,8 @@ int mboxCreate(Pop3 pc, const char *str);
int maildirCreate(Pop3 pc, char *str);
FILE *openMailbox(Pop3 pc, const char *mbox_filename);
char *backtickExpand(Pop3 pc, const char *path);
-int fileHasChanged(const char *mbox_filename, time_t *atime,
- time_t *mtime, off_t *size);
+int fileHasChanged(const char *mbox_filename, time_t * atime,
+ time_t * mtime, off_t * size);
/* _NONE is for silent operation. _ERROR is for things that should
be printed assuming that the user might possibly see them. _INFO is
diff --git a/wmbiff/LicqClient.c b/wmbiff/LicqClient.c
index 18e93ff..ad4ea5e 100644
--- a/wmbiff/LicqClient.c
+++ b/wmbiff/LicqClient.c
@@ -1,10 +1,10 @@
-/* $Id: LicqClient.c,v 1.8 2002/04/20 07:53:20 bluehal Exp $ */
+/* $Id: LicqClient.c,v 1.9 2002/04/20 07:54:06 bluehal Exp $ */
/* Author : Yong-iL Joh ( tolkien at mizi.com )
Modified: Jorge Garc�a ( Jorge.Garcia at uv.es )
*
* LICQ checker.
*
- * Last Updated : $Date: 2002/04/20 07:53:20 $
+ * Last Updated : $Date: 2002/04/20 07:54:06 $
*
*/
@@ -24,18 +24,18 @@ int licqCheckHistory(Pop3 pc)
DM(pc, DEBUG_INFO, ">Mailbox: '%s'\n", pc->path);
- if(fileHasChanged(pc->path, &ut.actime, &PCM.mtime, &PCM.size)
- || pc->OldMsgs < 0) {
- FILE *F;
- char buf[1024];
- int count_status = 0;
+ if (fileHasChanged(pc->path, &ut.actime, &PCM.mtime, &PCM.size)
+ || pc->OldMsgs < 0) {
+ FILE *F;
+ char buf[1024];
+ int count_status = 0;
/* file was changed OR initially read */
DM(pc, DEBUG_INFO, " was changed,"
" TIME: new %lu SIZE: new %lu\n",
PCM.mtime, (unsigned long) PCM.size);
- F = openMailbox(pc, pc->path);
+ F = openMailbox(pc, pc->path);
/* count message */
while (fgets(buf, BUF_SIZE, F)) {
if ((buf[0] == '[') || (buf[0] == '-')) { /* new, or old licq */
@@ -50,8 +50,8 @@ int licqCheckHistory(Pop3 pc)
pc->UnreadMsgs);
/* Not clear that resetting the mtime is useful, as mutt
- is not involved. Unfortunately, I can't tell whether
- this cut-and-pasted code is useful */
+ is not involved. Unfortunately, I can't tell whether
+ this cut-and-pasted code is useful */
ut.modtime = PCM.mtime;
utime(pc->path, &ut);
}
diff --git a/wmbiff/ShellClient.c b/wmbiff/ShellClient.c
index bc718d0..775ce39 100644
--- a/wmbiff/ShellClient.c
+++ b/wmbiff/ShellClient.c
@@ -76,58 +76,60 @@ static int kind_pclose(FILE * F, const char *command, Pop3 pc)
return (0);
}
-char *grabCommandOutput(Pop3 pc, const char *command) {
- FILE *F;
- char linebuf[512];
- SH_DM(pc, DEBUG_INFO, "Executing '%s'\n", command);
- if ((F = kind_popen(command, "r")) == NULL) {
- return NULL;
- }
- if (fgets(linebuf, 512, F) == NULL) {
- SH_DM(pc, DEBUG_ERROR,
- "fgets: unable to read the output of '%s': %s\n", command,
- strerror(errno));
- kind_pclose(F, command, pc);
- return NULL;
- }
- chomp(linebuf);
- kind_pclose(F, command, pc);
- return(strdup(linebuf));
+char *grabCommandOutput(Pop3 pc, const char *command)
+{
+ FILE *F;
+ char linebuf[512];
+ SH_DM(pc, DEBUG_INFO, "Executing '%s'\n", command);
+ if ((F = kind_popen(command, "r")) == NULL) {
+ return NULL;
+ }
+ if (fgets(linebuf, 512, F) == NULL) {
+ SH_DM(pc, DEBUG_ERROR,
+ "fgets: unable to read the output of '%s': %s\n", command,
+ strerror(errno));
+ kind_pclose(F, command, pc);
+ return NULL;
+ }
+ chomp(linebuf);
+ kind_pclose(F, command, pc);
+ return (strdup(linebuf));
}
-char *backtickExpand(Pop3 pc, const char *path) {
- char bigbuffer[1024];
- const char *tickstart;
- const char *tickend;
- bigbuffer[0]='\0';
- while((tickstart = strchr(path, '`')) != NULL) {
- char *command;
- char *commandoutput;
- tickend = strchr(tickstart+1, '`');
- if(tickend == NULL) {
- SH_DM(pc, DEBUG_ERROR, "unbalanced \' in %s\n", path);
- return NULL;
- }
- strncat(bigbuffer, path, tickstart-path);
- command = strndup(tickstart+1, tickend-tickstart-1);
- commandoutput = grabCommandOutput(pc, command);
- free(command);
- if(commandoutput != NULL) {
- strcat(bigbuffer, commandoutput);
- free(commandoutput);
- }
- path = tickend+1;
- }
- /* grab the rest */
- strcat(bigbuffer, path);
- SH_DM(pc, DEBUG_INFO, "expanded to %s\n", bigbuffer);
- return(strdup(bigbuffer));
+char *backtickExpand(Pop3 pc, const char *path)
+{
+ char bigbuffer[1024];
+ const char *tickstart;
+ const char *tickend;
+ bigbuffer[0] = '\0';
+ while ((tickstart = strchr(path, '`')) != NULL) {
+ char *command;
+ char *commandoutput;
+ tickend = strchr(tickstart + 1, '`');
+ if (tickend == NULL) {
+ SH_DM(pc, DEBUG_ERROR, "unbalanced \' in %s\n", path);
+ return NULL;
+ }
+ strncat(bigbuffer, path, tickstart - path);
+ command = strndup(tickstart + 1, tickend - tickstart - 1);
+ commandoutput = grabCommandOutput(pc, command);
+ free(command);
+ if (commandoutput != NULL) {
+ strcat(bigbuffer, commandoutput);
+ free(commandoutput);
+ }
+ path = tickend + 1;
+ }
+ /* grab the rest */
+ strcat(bigbuffer, path);
+ SH_DM(pc, DEBUG_INFO, "expanded to %s\n", bigbuffer);
+ return (strdup(bigbuffer));
}
int shellCmdCheck(Pop3 pc)
{
int count_status = 0;
- char *commandOutput;
+ char *commandOutput;
if (pc == NULL)
return -1;
@@ -135,9 +137,9 @@ int shellCmdCheck(Pop3 pc)
/* fetch the first line of input */
pc->TextStatus[0] = '\0';
- if((commandOutput= grabCommandOutput(pc, pc->path)) == NULL) {
+ if ((commandOutput = grabCommandOutput(pc, pc->path)) == NULL) {
return -1;
- }
+ }
SH_DM(pc, DEBUG_INFO, "'%s' returned '%s'\n", pc->path, commandOutput);
/* see if it's numeric; the numeric check is somewhat
@@ -163,26 +165,24 @@ int shellCmdCheck(Pop3 pc)
if (pc->TextStatus[i] != '\0') {
SH_DM(pc, DEBUG_ERROR,
"wmbiff only supports alphanumeric (isalnum) strings:\n"
- " '%s' is not ok\n",
- pc->TextStatus);
- /* null terminate it at the first bad char: */
- pc->TextStatus[i] = '\0';
+ " '%s' is not ok\n", pc->TextStatus);
+ /* null terminate it at the first bad char: */
+ pc->TextStatus[i] = '\0';
}
/* see if we should print as new or not */
pc->UnreadMsgs = (strstr(commandOutput, "new")) ? 1 : 0;
} else {
SH_DM(pc, DEBUG_ERROR,
"'%s' returned something other than an integer message count"
- " or short string.\n",
- pc->path);
- free(commandOutput);
+ " or short string.\n", pc->path);
+ free(commandOutput);
return -1;
}
SH_DM(pc, DEBUG_INFO, "from: %s status: %s %d %d\n",
pc->path, pc->TextStatus, pc->TotalMsgs, pc->UnreadMsgs);
- free(commandOutput);
- return(0);
+ free(commandOutput);
+ return (0);
}
int shellCreate(Pop3 pc, const char *str)
diff --git a/wmbiff/mboxClient.c b/wmbiff/mboxClient.c
index c6bc67d..ffaaab6 100644
--- a/wmbiff/mboxClient.c
+++ b/wmbiff/mboxClient.c
@@ -1,4 +1,4 @@
-/* $Id: mboxClient.c,v 1.10 2002/04/20 07:53:20 bluehal Exp $ */
+/* $Id: mboxClient.c,v 1.11 2002/04/20 07:54:06 bluehal Exp $ */
/* Author: Yong-iL Joh <tolkien at mizi.com>
Modified: Jorge Garc�a <Jorge.Garcia at uv.es>
Rob Funk <rfunk at funknet.net>
@@ -33,97 +33,97 @@ FILE *openMailbox(Pop3 pc, const char *mbox_filename)
}
/* count the messages in a mailbox */
-static void countMessages(Pop3 pc, const char *mbox_filename) {
- FILE *F = openMailbox(pc, mbox_filename);
+static void countMessages(Pop3 pc, const char *mbox_filename)
+{
+ FILE *F = openMailbox(pc, mbox_filename);
char buf[BUF_SIZE];
int is_header = 0;
int next_from_is_start_of_header = 1;
int count_from = 0, count_status = 0;
int len_from = strlen(FROM_STR), len_status = strlen(STATUS_STR);
- if(F == NULL) {
- pc->TotalMsgs = -1;
- pc->UnreadMsgs = -1;
- return;
- }
-
- /* count message */
- while (fgets(buf, BUF_SIZE, F)) {
- if (buf[0] == '\n') {
- /* a newline by itself terminates the header */
- if (is_header)
- is_header = 0;
- else
- next_from_is_start_of_header = 1;
- } else if (!strncmp(buf, FROM_STR, len_from)) {
- /* A line starting with "From" is the beginning of a new header.
- "From" in the text of the mail should get escaped by the MDA.
- If your MDA doesn't do that, it is broken.
- */
- if (next_from_is_start_of_header)
- is_header = 1;
- if (is_header)
- count_from++;
- } else {
- next_from_is_start_of_header = 0;
- if (is_header
- && !strncmp(buf, STATUS_STR, len_status)
- && strrchr(buf, 'R')) {
- count_status++;
- }
- }
- }
-
- DM(pc, DEBUG_INFO, "from: %d status: %d\n", count_from,
- count_status);
- pc->TotalMsgs = count_from;
- pc->UnreadMsgs = count_from - count_status;
- fclose(F);
+ if (F == NULL) {
+ pc->TotalMsgs = -1;
+ pc->UnreadMsgs = -1;
+ return;
+ }
+
+ /* count message */
+ while (fgets(buf, BUF_SIZE, F)) {
+ if (buf[0] == '\n') {
+ /* a newline by itself terminates the header */
+ if (is_header)
+ is_header = 0;
+ else
+ next_from_is_start_of_header = 1;
+ } else if (!strncmp(buf, FROM_STR, len_from)) {
+ /* A line starting with "From" is the beginning of a new header.
+ "From" in the text of the mail should get escaped by the MDA.
+ If your MDA doesn't do that, it is broken.
+ */
+ if (next_from_is_start_of_header)
+ is_header = 1;
+ if (is_header)
+ count_from++;
+ } else {
+ next_from_is_start_of_header = 0;
+ if (is_header && !strncmp(buf, STATUS_STR, len_status)
+ && strrchr(buf, 'R')) {
+ count_status++;
+ }
+ }
+ }
+
+ DM(pc, DEBUG_INFO, "from: %d status: %d\n", count_from, count_status);
+ pc->TotalMsgs = count_from;
+ pc->UnreadMsgs = count_from - count_status;
+ fclose(F);
}
/* check file status; hold on to file information used
to restore access time */
-int fileHasChanged(const char *mbox_filename, time_t *atime,
- time_t *mtime, off_t *size) {
- struct stat st;
-
- /* mbox file */
- if (stat(mbox_filename, &st)) {
+int fileHasChanged(const char *mbox_filename, time_t * atime,
+ time_t * mtime, off_t * size)
+{
+ struct stat st;
+
+ /* mbox file */
+ if (stat(mbox_filename, &st)) {
DMA(DEBUG_ERROR, "Can't stat '%s': %s\n",
- mbox_filename, strerror(errno));
+ mbox_filename, strerror(errno));
} else if (st.st_mtime != *mtime || st.st_size != *size) {
/* file was changed OR initially read */
DMA(DEBUG_INFO, " %s was changed,"
- " mTIME: %lu -> %lu; SIZE: %lu -> %lu\n",
- mbox_filename, *mtime, st.st_mtime,
- (unsigned long) *size, st.st_size);
-
- *atime = st.st_atime;
- *mtime = st.st_mtime;
- *size = st.st_size;
- return 1;
- }
- return 0;
+ " mTIME: %lu -> %lu; SIZE: %lu -> %lu\n",
+ mbox_filename, *mtime, st.st_mtime,
+ (unsigned long) *size, st.st_size);
+
+ *atime = st.st_atime;
+ *mtime = st.st_mtime;
+ *size = st.st_size;
+ return 1;
+ }
+ return 0;
}
int mboxCheckHistory(Pop3 pc)
{
- char *mbox_filename = backtickExpand(pc, pc->path);
- struct utimbuf ut;
+ char *mbox_filename = backtickExpand(pc, pc->path);
+ struct utimbuf ut;
DM(pc, DEBUG_INFO, ">Mailbox: '%s'\n", mbox_filename);
- if(fileHasChanged(mbox_filename, &ut.actime, &PCM.mtime, &PCM.size)
- || pc->OldMsgs < 0) {
+ if (fileHasChanged(mbox_filename, &ut.actime, &PCM.mtime, &PCM.size)
+ || pc->OldMsgs < 0) {
- countMessages(pc, mbox_filename);
+ countMessages(pc, mbox_filename);
/* Reset atime for (at least) MUTT to work */
- /* ut.actime is set above */
+ /* ut.actime is set above */
ut.modtime = PCM.mtime;
utime(mbox_filename, &ut);
}
- free(mbox_filename);
+ free(mbox_filename);
return 0;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git
More information about the Pkg-wmaker-commits
mailing list