[Pkg-wmaker-commits] [wmbiff] 09/17: indent

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:04:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to tag wmbiff_0_4_18
in repository wmbiff.

commit 54ffb0a77bd234e6989738d1cf79190873f9027f
Author: bluehal <bluehal>
Date:   Tue Oct 28 23:38:40 2003 +0000

    indent
---
 wmbiff/Makefile.am   |   2 +-
 wmbiff/test_wmbiff.c | 414 ++++++++++++++++++++++++++-------------------------
 2 files changed, 212 insertions(+), 204 deletions(-)

diff --git a/wmbiff/Makefile.am b/wmbiff/Makefile.am
index 8d48840..5271fe1 100644
--- a/wmbiff/Makefile.am
+++ b/wmbiff/Makefile.am
@@ -39,7 +39,7 @@ MAINTAINERCLEANFILES = Makefile.in
 #
 #	-- Dwayne C. Litzenberger <dlitz at dlitz.net>
 indent:
-	indent -npro -kr -i4 -ts4 $(wmbiff_SOURCES) || true
+	indent -npro -kr -i4 -ts4 $(wmbiff_SOURCES) test_*.c || true
 
 # to perform surgery on a few changed files.
 .c.indent:
diff --git a/wmbiff/test_wmbiff.c b/wmbiff/test_wmbiff.c
index ecffe46..fe1d982 100644
--- a/wmbiff/test_wmbiff.c
+++ b/wmbiff/test_wmbiff.c
@@ -26,55 +26,56 @@ int debug_default = DEBUG_INFO;
 int Relax = 1;
 
 /* return 1 if fail, 0 if success */
-int test_backtickExpand(void) {
-  const char *tests[] = 
-      { "prefix`echo 1`suffix", 
-        "prefix`echo 1`", 
-        "`echo 1`", 
-        "`echo a b` c", 
-        "`false`", 
-        NULL };
-  const char *solns[] = 
-      { "prefix1suffix", 
-        "prefix1", 
-        "1", 
-        "a b c", 
-        "", 
-        NULL };
-  int i;
-  int retval = 0;
-  for(i=0; tests[i]!=NULL; i++) {
-    char *x = backtickExpand(NULL, tests[i]);
-    if(strcmp(x, solns[i]) != 0) {
-      printf("test failed: [%s] != [%s]\n", 
-             tests[i], solns[i]);
-      retval = 1;
-    }
-    free(x);
-  }
-  printf("backtick tests complete\n");
-  return(retval);
+int test_backtickExpand(void)
+{
+	const char *tests[] = { "prefix`echo 1`suffix",
+		"prefix`echo 1`",
+		"`echo 1`",
+		"`echo a b` c",
+		"`false`",
+		NULL
+	};
+	const char *solns[] = { "prefix1suffix",
+		"prefix1",
+		"1",
+		"a b c",
+		"",
+		NULL
+	};
+	int i;
+	int retval = 0;
+	for (i = 0; tests[i] != NULL; i++) {
+		char *x = backtickExpand(NULL, tests[i]);
+		if (strcmp(x, solns[i]) != 0) {
+			printf("test failed: [%s] != [%s]\n", tests[i], solns[i]);
+			retval = 1;
+		}
+		free(x);
+	}
+	printf("backtick tests complete\n");
+	return (retval);
 }
 
 #define CKSTRING(x,shouldbe) if(strcmp(x,shouldbe)) { \
 printf("Failed: expected '" #shouldbe "' but got '%s'\n", x); \
- return 1; } else { printf("good: '" shouldbe "' == '%s'\n", x); } 
+ return 1; } else { printf("good: '" shouldbe "' == '%s'\n", x); }
 
 /* return 1 if fail, 0 if success */
-int test_passwordMgr(void) {
+int test_passwordMgr(void)
+{
 	const char *b;
 	mbox_t m;
-    strcpy(m.label, "x");
+	strcpy(m.label, "x");
 
 	/* sh is almost certainly conforming; owned by root, etc. */
 	if (!permissions_ok(NULL, "/bin/sh")) {
 		printf("FAILURE: permission checker failed on /bin/sh.");
-		return(1);
+		return (1);
 	}
 	/* tmp is definitely bad; and better be og+w */
 	if (permissions_ok(NULL, "/tmp")) {
 		printf("FAILURE: permission checker failed on /tmp.");
-		return(1);
+		return (1);
 	}
 	/* TODO: also find some user-owned binary that shouldn't be g+w */
 	printf("SUCCESS: permission checker sanity check went well.\n");
@@ -85,7 +86,7 @@ int test_passwordMgr(void) {
 	b = passwordFor("bill", "ted", &m, 0);
 	if (strcmp(b, "xlnt") != 0) {
 		printf("FAILURE: expected 'xlnt' got '%s'\n", b);
-		return(1);
+		return (1);
 	}
 	printf("SUCCESS: expected 'xlnt' got '%s'\n", b);
 
@@ -94,7 +95,7 @@ int test_passwordMgr(void) {
 	b = passwordFor("bill", "ted", &m, 0);
 	if (strcmp(b, "xlnt") != 0) {
 		printf("FAILURE: expected 'xlnt' got '%s'\n", b);
-		return(1);
+		return (1);
 	}
 
 	printf("SUCCESS: cached 'xlnt' correctly\n");
@@ -107,7 +108,7 @@ int test_passwordMgr(void) {
 		printf
 			("FAILURE: expected 'abcdefghi1abcdefghi2abcdefghi3a' got '%s'\n",
 			 b);
-		return(1);
+		return (1);
 	}
 	printf
 		("SUCCESS: expected 'abcdefghi1abcdefghi2abcdefghi3a' got '%s'\n",
@@ -121,7 +122,7 @@ int test_passwordMgr(void) {
 		printf
 			("FAILURE: expected 'abcdefghi1abcdefghi2abcdefghi3a' got '%s'\n",
 			 b);
-		return(1);
+		return (1);
 	}
 	printf
 		("SUCCESS: expected 'abcdefghi1abcdefghi2abcdefghi3a' got '%s'\n",
@@ -131,18 +132,18 @@ int test_passwordMgr(void) {
 	b = passwordFor("bill", "ted", &m, 0);
 	if (strcmp(b, "xlnt") != 0) {
 		printf("FAILURE: expected 'xlnt' got '%s'\n", b);
-		return(1);
+		return (1);
 	}
 	printf("SUCCESS: expected 'xlnt' got '%s'\n", b);
 
 	/* what it's like if ssh-askpass is cancelled - should drop the mailbox */
 #if 0
-    /* will exit on our behalf; not so good for continued testing. */
+	/* will exit on our behalf; not so good for continued testing. */
 	m.askpass = "echo -n ; #";
 	b = passwordFor("abort", "me", &m, 0);
 	if (strcmp(b, "") != 0) {
 		printf("FAILURE: expected '' got '%s'\n", b);
-		return(1);
+		return (1);
 	}
 	printf("SUCCESS: expected '' got '%s'\n", b);
 #endif
@@ -152,7 +153,7 @@ int test_passwordMgr(void) {
 	b = passwordFor("try", "again", &m, 0);
 	if (b == NULL || strcmp(b, "") != 0) {
 		printf("FAILURE: expected '' got '%s'\n", b ? b : "(null)");
-		return(1);
+		return (1);
 	}
 	printf("SUCCESS: expected '' got '%s'\n", b);
 
@@ -160,163 +161,172 @@ int test_passwordMgr(void) {
 	b = passwordFor("faq", "faq", &m, 0);
 	if (strcmp(b, "rt*m") != 0) {
 		printf("FAILURE: expected '' got '%s'\n", b);
-		return(1);
+		return (1);
 	}
 	printf("SUCCESS: expected 'rt*m' got '%s'\n", b);
-    return(0);
+	return (0);
 }
 
 #define CKINT(x,shouldbe) if(x != shouldbe) { \
 printf("Failed: expected '" #shouldbe "' but got '%d'\n", x); \
  return 1; }
-int test_imap4creator(void) {
-    mbox_t m;
-    
-    if(imap4Create(&m, "imap:foo:@bar/mybox")) {
-        return 1;
-    }
-    CKSTRING(m.path, "mybox");
-    CKSTRING(m.u.pop_imap.serverName, "bar");
-    CKINT(m.u.pop_imap.serverPort, 143);
-
-    if(imap4Create(&m, "imap:foo:@bar/\"mybox\"")) {
-        return 1;
-    }
-    CKSTRING(m.path, "\"mybox\"");
-    CKSTRING(m.u.pop_imap.serverName, "bar");
-    CKINT(m.u.pop_imap.serverPort, 143);
-
-    if(imap4Create(&m, "imap:foo:@bar/\"space box\"")) {
-        return 1;
-    }
-    CKSTRING(m.path, "\"space box\"");
-    CKSTRING(m.u.pop_imap.serverName, "bar");
-    CKINT(m.u.pop_imap.serverPort, 143);
-
-    if(imap4Create(&m, "imap:user pass bar/\"space box\"")) {
-        return 1;
-    }
-    CKSTRING(m.path, "\"space box\"");
-    CKSTRING(m.u.pop_imap.serverName, "bar");
-    CKINT(m.u.pop_imap.serverPort, 143);
-
-    if(imap4Create(&m, "imap:star *as* star/\"space box\"")) {
-        return 1;
-    }
-    printf("mmm %s", (m.u.pop_imap.password));
-    DEFROB(m.u.pop_imap.password);
-    CKSTRING(m.u.pop_imap.password, "*as*");
-    CKINT(m.u.pop_imap.serverPort, 143);
-    if(imap4Create(&m, "imap:user:*as*@bar/blah")) {
-        return 1;
-    }
-    
-    DEFROB(m.u.pop_imap.password);
-    CKSTRING(m.u.pop_imap.password, "*as*");
-    CKINT(m.u.pop_imap.serverPort, 143);
-
-    if(imap4Create(&m, "imap:user pass bar/\"space box\" 12")) {
-        return 1;
-    }
-    CKSTRING(m.path, "\"space box\"");
-    CKSTRING(m.u.pop_imap.serverName, "bar");
-    CKINT(m.u.pop_imap.serverPort, 12);
-
-    if(imap4Create(&m, "imap:foo:@bar/\"mybox\":12")) {
-        return 1;
-    }
-    CKSTRING(m.path, "\"mybox\"");
-    CKSTRING(m.u.pop_imap.serverName, "bar");
-    CKINT(m.u.pop_imap.serverPort, 12);
-
-    if(imap4Create(&m, "imap:foo:@bar/\"mybox\":12 auth")) {
-        return 1;
-    }
-    CKSTRING(m.path, "\"mybox\"");
-    CKSTRING(m.u.pop_imap.serverName, "bar");
-    CKINT(m.u.pop_imap.serverPort, 12);
-    CKSTRING(m.u.pop_imap.authList, "auth");
-
-    if(imap4Create(&m, "imap:foo:@bar/\"mybox\":12 cram-md5 plaintext")) {
-        return 1;
-    }
-    CKSTRING(m.u.pop_imap.authList, "cram-md5 plaintext");
-
-    if(imap4Create(&m, "imap:foo:@bar/\"mybox\":12 CRAm-md5 plainTEXt")) {
-        return 1;
-    }
-    CKSTRING(m.u.pop_imap.authList, "cram-md5 plaintext");
-
-    /* doesn't really matter, as the # is gobbled by the parser as a comment. */
-    if(imap4Create(&m, "imap:harry:has#pass at bar/\"mybox\":12 CRAm-md5 plainTEXt")) {
-        return 1;
-    }
-    CKSTRING(m.u.pop_imap.userName, "harry");
-    DEFROB(m.u.pop_imap.password);
-    CKSTRING(m.u.pop_imap.password, "has#pass");
-
-
-    if(pop3Create(&m, "pop3:foo:@bar:12 cram-md5 plaintext")) {
-        return 1;
-    }
-    CKSTRING(m.u.pop_imap.authList, "cram-md5 plaintext");
-
-    /* should not parse this; it is ambiguous. */
-    if( ! imap4Create(&m, "imap:foo:mi at ta@bar/mybox") && !Relax ) {
-        return 1;
-    }
-
-    /* should not parse this; it is ambiguous. */
-    if( ! imap4Create(&m, "imap:user pa ss bar/\"space box\" 12") && !Relax) {
-        return 1;
-    }
-
-    /* should not parse this; it is ambiguous. */
-    if( ! pop3Create(&m, "pop3:user pa ss bar 12") && ! Relax) {
-        return 1;
-    }
-    
-    return 0;
+int test_imap4creator(void)
+{
+	mbox_t m;
+
+	if (imap4Create(&m, "imap:foo:@bar/mybox")) {
+		return 1;
+	}
+	CKSTRING(m.path, "mybox");
+	CKSTRING(m.u.pop_imap.serverName, "bar");
+	CKINT(m.u.pop_imap.serverPort, 143);
+
+	if (imap4Create(&m, "imap:foo:@bar/\"mybox\"")) {
+		return 1;
+	}
+	CKSTRING(m.path, "\"mybox\"");
+	CKSTRING(m.u.pop_imap.serverName, "bar");
+	CKINT(m.u.pop_imap.serverPort, 143);
+
+	if (imap4Create(&m, "imap:foo:@bar/\"space box\"")) {
+		return 1;
+	}
+	CKSTRING(m.path, "\"space box\"");
+	CKSTRING(m.u.pop_imap.serverName, "bar");
+	CKINT(m.u.pop_imap.serverPort, 143);
+
+	if (imap4Create(&m, "imap:user pass bar/\"space box\"")) {
+		return 1;
+	}
+	CKSTRING(m.path, "\"space box\"");
+	CKSTRING(m.u.pop_imap.serverName, "bar");
+	CKINT(m.u.pop_imap.serverPort, 143);
+
+	if (imap4Create(&m, "imap:star *as* star/\"space box\"")) {
+		return 1;
+	}
+	printf("mmm %s", (m.u.pop_imap.password));
+	DEFROB(m.u.pop_imap.password);
+	CKSTRING(m.u.pop_imap.password, "*as*");
+	CKINT(m.u.pop_imap.serverPort, 143);
+	if (imap4Create(&m, "imap:user:*as*@bar/blah")) {
+		return 1;
+	}
+
+	DEFROB(m.u.pop_imap.password);
+	CKSTRING(m.u.pop_imap.password, "*as*");
+	CKINT(m.u.pop_imap.serverPort, 143);
+
+	if (imap4Create(&m, "imap:user pass bar/\"space box\" 12")) {
+		return 1;
+	}
+	CKSTRING(m.path, "\"space box\"");
+	CKSTRING(m.u.pop_imap.serverName, "bar");
+	CKINT(m.u.pop_imap.serverPort, 12);
+
+	if (imap4Create(&m, "imap:foo:@bar/\"mybox\":12")) {
+		return 1;
+	}
+	CKSTRING(m.path, "\"mybox\"");
+	CKSTRING(m.u.pop_imap.serverName, "bar");
+	CKINT(m.u.pop_imap.serverPort, 12);
+
+	if (imap4Create(&m, "imap:foo:@bar/\"mybox\":12 auth")) {
+		return 1;
+	}
+	CKSTRING(m.path, "\"mybox\"");
+	CKSTRING(m.u.pop_imap.serverName, "bar");
+	CKINT(m.u.pop_imap.serverPort, 12);
+	CKSTRING(m.u.pop_imap.authList, "auth");
+
+	if (imap4Create(&m, "imap:foo:@bar/\"mybox\":12 cram-md5 plaintext")) {
+		return 1;
+	}
+	CKSTRING(m.u.pop_imap.authList, "cram-md5 plaintext");
+
+	if (imap4Create(&m, "imap:foo:@bar/\"mybox\":12 CRAm-md5 plainTEXt")) {
+		return 1;
+	}
+	CKSTRING(m.u.pop_imap.authList, "cram-md5 plaintext");
+
+	/* doesn't really matter, as the # is gobbled by the parser as a comment. */
+	if (imap4Create
+		(&m, "imap:harry:has#pass at bar/\"mybox\":12 CRAm-md5 plainTEXt")) {
+		return 1;
+	}
+	CKSTRING(m.u.pop_imap.userName, "harry");
+	DEFROB(m.u.pop_imap.password);
+	CKSTRING(m.u.pop_imap.password, "has#pass");
+
+
+	if (pop3Create(&m, "pop3:foo:@bar:12 cram-md5 plaintext")) {
+		return 1;
+	}
+	CKSTRING(m.u.pop_imap.authList, "cram-md5 plaintext");
+
+	/* should not parse this; it is ambiguous. */
+	if (!imap4Create(&m, "imap:foo:mi at ta@bar/mybox") && !Relax) {
+		return 1;
+	}
+
+	/* should not parse this; it is ambiguous. */
+	if (!imap4Create(&m, "imap:user pa ss bar/\"space box\" 12") && !Relax) {
+		return 1;
+	}
+
+	/* should not parse this; it is ambiguous. */
+	if (!pop3Create(&m, "pop3:user pa ss bar 12") && !Relax) {
+		return 1;
+	}
+
+	return 0;
 }
 
 
-int test_getline_from_buffer(void) {
+int test_getline_from_buffer(void)
+{
 #define LINE_BUF_LEN 256
-    char linebuf[LINE_BUF_LEN];
-    char scratchbuf[LINE_BUF_LEN];
-    
-    /* try to ensure that even an endless loop terminates */
-    alarm(100);
-    strcpy(scratchbuf, "\r\n");
-    getline_from_buffer(scratchbuf, linebuf, LINE_BUF_LEN);
-    if(strlen(scratchbuf) != 0) {
+	char linebuf[LINE_BUF_LEN];
+	char scratchbuf[LINE_BUF_LEN];
+
+	/* try to ensure that even an endless loop terminates */
+	alarm(100);
+	strcpy(scratchbuf, "\r\n");
+	getline_from_buffer(scratchbuf, linebuf, LINE_BUF_LEN);
+	if (strlen(scratchbuf) != 0) {
 		printf("FAILURE: scratchbuf not snarfed\n");
-		return(1);
+		return (1);
 	}
-    if(strlen(linebuf) != 2) {
+	if (strlen(linebuf) != 2) {
 		printf("FAILURE: linebuf not populated\n");
-		return(1);
+		return (1);
 	}
-    strcpy(scratchbuf, "\n");
-    getline_from_buffer(scratchbuf, linebuf, LINE_BUF_LEN);
-    if(strlen(scratchbuf) != 0) {
+	strcpy(scratchbuf, "\n");
+	getline_from_buffer(scratchbuf, linebuf, LINE_BUF_LEN);
+	if (strlen(scratchbuf) != 0) {
 		printf("FAILURE: scratchbuf not snarfed\n");
-		return(1);
+		return (1);
 	}
-    if(strlen(linebuf) != 1) {
+	if (strlen(linebuf) != 1) {
 		printf("FAILURE: linebuf not populated\n");
-		return(1);
+		return (1);
 	}
-    
-    alarm(0);
-    return(0);
+
+	alarm(0);
+	return (0);
 }
 
 
-int print_info(UNUSED(void * state)) { return(0); }
+int print_info(UNUSED(void *state))
+{
+	return (0);
+}
 const char *certificate_filename = NULL;
 int SkipCertificateCheck = 0;
-int exists(UNUSED(const char *filename)) { return(0); }	
+int exists(UNUSED(const char *filename))
+{
+	return (0);
+}
 
 
 // void initialize_blacklist(void) { } 
@@ -328,33 +338,33 @@ int exists(UNUSED(const char *filename)) { return(0); }
 // int sock_connect(UNUSED(const char *n), UNUSED(int p)) { return 1; } /* stdout */
 // void initialize_unencrypted(void) {  } 
 
-int main(UNUSED(int argc), UNUSED(char *argv[])) {
-
-    if( test_backtickExpand() || 
-        test_passwordMgr()) {
-        printf("SOME TESTS FAILED!\n");
-        exit(EXIT_FAILURE);
-    } 
-
-    Relax = 0;
-    if( test_imap4creator() ) {
-        printf("SOME TESTS FAILED!\n");
-        exit(EXIT_FAILURE);
-    }
-
-    Relax = 1;
-    if( test_imap4creator() ) {
-        printf("SOME TESTS FAILED!\n");
-        exit(EXIT_FAILURE);
-    }
-
-    if( test_getline_from_buffer() ) {
-        printf("SOME TESTS FAILED!\n");
-        exit(EXIT_FAILURE);
-    }
-
-    printf("Success! on all tests.\n");
-    exit(EXIT_SUCCESS);
+int main(UNUSED(int argc), UNUSED(char *argv[]))
+{
+
+	if (test_backtickExpand() || test_passwordMgr()) {
+		printf("SOME TESTS FAILED!\n");
+		exit(EXIT_FAILURE);
+	}
+
+	Relax = 0;
+	if (test_imap4creator()) {
+		printf("SOME TESTS FAILED!\n");
+		exit(EXIT_FAILURE);
+	}
+
+	Relax = 1;
+	if (test_imap4creator()) {
+		printf("SOME TESTS FAILED!\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (test_getline_from_buffer()) {
+		printf("SOME TESTS FAILED!\n");
+		exit(EXIT_FAILURE);
+	}
+
+	printf("Success! on all tests.\n");
+	exit(EXIT_SUCCESS);
 }
 
 /* vim:set ts=4: */
@@ -365,5 +375,3 @@ int main(UNUSED(int argc), UNUSED(char *argv[])) {
  * c-basic-offset: 4
  * End:
  */
-
-

-- 
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