From 8196b8171cde009371eb2776f24eb924c9ab6723 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Mon, 11 May 2015 13:13:16 +0200 Subject: [PATCH] Allow empty text for logbooks without text --- src/elog.c | 19 ++++++++++++------- xcode/elog.xcodeproj/project.pbxproj | 4 +++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/elog.c b/src/elog.c index 46c2b0df..634a2080 100755 --- a/src/elog.c +++ b/src/elog.c @@ -801,9 +801,10 @@ INT submit_elog(char *host, int port, int ssl, char *subdir, char *experiment, } } - sprintf(content + strlen(content), - "%s\r\nContent-Disposition: form-data; name=\"Text\"\r\n\r\n%s\r\n%s\r\n", - boundary, text, boundary); + if (text[0]) + sprintf(content + strlen(content), + "%s\r\nContent-Disposition: form-data; name=\"Text\"\r\n\r\n%s\r\n%s\r\n", + boundary, text, boundary); content_length = strlen(content); p = content + content_length; @@ -978,7 +979,8 @@ int main(int argc, char *argv[]) char host_name[256], logbook[32], textfile[256], subdir[256]; char *buffer[MAX_ATTACHMENTS], attachment[MAX_ATTACHMENTS][256]; INT att_size[MAX_ATTACHMENTS]; - INT i, n, fh, n_att, n_attr, port, reply, quote_on_reply, edit, download, encoding, suppress, size, ssl; + INT i, n, fh, n_att, n_attr, port, reply, quote_on_reply, edit, download, encoding, suppress, size, ssl, + text_flag; char attr_name[MAX_N_ATTR][NAME_LENGTH], attrib[MAX_N_ATTR][NAME_LENGTH]; text[0] = textfile[0] = uname[0] = upwd[0] = suppress = quote_on_reply = 0; @@ -986,6 +988,7 @@ int main(int argc, char *argv[]) n_att = n_attr = reply = edit = download = encoding = 0; port = 80; ssl = 0; + text_flag = 0; for (i = 0; i < MAX_ATTACHMENTS; i++) { attachment[i][0] = 0; @@ -1042,9 +1045,10 @@ int main(int argc, char *argv[]) download = atoi(argv[++i]); } else if (argv[i][1] == 'n') encoding = atoi(argv[++i]); - else if (argv[i][1] == 'm') + else if (argv[i][1] == 'm') { strcpy(textfile, argv[++i]); - else { + text_flag = 1; + } else { usage: printf("%s ", ELOGID); strcpy(str, svn_revision + 13); @@ -1076,6 +1080,7 @@ int main(int argc, char *argv[]) } else { strcpy(text, argv[i]); convert_crlf(text, sizeof(text)); + text_flag = 1; } } } @@ -1139,7 +1144,7 @@ int main(int argc, char *argv[]) close(fh); } - if (text[0] == 0 && textfile[0] == 0 && !edit && !download) { + if (text_flag == 0 && !edit && !download) { /* read from stdin */ n = 0; diff --git a/xcode/elog.xcodeproj/project.pbxproj b/xcode/elog.xcodeproj/project.pbxproj index e25de9b5..975e49fe 100644 --- a/xcode/elog.xcodeproj/project.pbxproj +++ b/xcode/elog.xcodeproj/project.pbxproj @@ -93,7 +93,7 @@ D52BA2F113999DB0000458E3 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0610; + LastUpgradeCheck = 0630; ORGANIZATIONNAME = PSI; }; buildConfigurationList = D52BA2F413999DB0000458E3 /* Build configuration list for PBXProject "elog" */; @@ -138,6 +138,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; @@ -166,6 +167,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;