diff --git a/goldlib/gall/be_lock.c b/goldlib/gall/be_lock.c index a395e07..19d28c2 100644 --- a/goldlib/gall/be_lock.c +++ b/goldlib/gall/be_lock.c @@ -54,7 +54,7 @@ status_t beos_unlock(int file_handle) port_id pid = 0; status_t status = look_for_port(file_handle, false, &pid); if(status == B_BUSY) - status = delete_port(pid); + status = delete_port(pid); return status; } diff --git a/goldlib/gall/be_lock.h b/goldlib/gall/be_lock.h index 8a9f7f7..eb5cc0f 100644 --- a/goldlib/gall/be_lock.h +++ b/goldlib/gall/be_lock.h @@ -32,14 +32,14 @@ can be used for any purposes in any form without any warranties. sprintf(name, "FidoLock:%08X:%08X", stat_info.st_dev, stat_info.st_ino); 3) Look for existing port with this name: - + pid = find_port(name); if(pid == B_NAME_NOT_FOUND) { 4) Create such port. - pid = create_port(1, name); + pid = create_port(1, name); } else diff --git a/goldlib/gall/gctype.h b/goldlib/gall/gctype.h index c82f842..7e6c7b9 100644 --- a/goldlib/gall/gctype.h +++ b/goldlib/gall/gctype.h @@ -81,7 +81,7 @@ extern __inline__ int isxalnum(char c) { * It's also not possible to use setlocale() to change it's behaviour. =-( */ #undef iscntrl -# define iscntrl(c) ((c < 0x7f) ? __isctype((c), _IScntrl) : 0) +# define iscntrl(c) ((c < 0x7f) ? __isctype((c), _IScntrl) : 0) #endif /* __BEOS__ */ /* --------------------------------------------------------------- */ diff --git a/goldlib/gall/gdirposx.cpp b/goldlib/gall/gdirposx.cpp index a8a8c09..330eb85 100644 --- a/goldlib/gall/gdirposx.cpp +++ b/goldlib/gall/gdirposx.cpp @@ -55,7 +55,7 @@ gdirentry::~gdirentry() gposixdir::gposixdir() : dirname(), ret(), entries() { - ok = false; + ok = false; } @@ -63,7 +63,7 @@ gposixdir::gposixdir() : dirname(), ret(), entries() gposixdir::gposixdir(const char *name) : dirname(), ret(), entries() { - cd(name); + cd(name); } @@ -79,73 +79,73 @@ gposixdir::~gposixdir() #ifndef _MSC_VER void gposixdir::cd(const char *name, bool relative) { - std::string ndirname; - if(not *name) - name = "."; - if(relative) { - dirname += "/"; - dirname += name; - } else - dirname = name; - ok = maketruepath(dirname); - entries.clear(); - DIR *d = opendir(dirname.c_str()); - if(d == NULL) - ok = false; - else { - struct dirent *de; - while((de=readdir(d)) != NULL) { - ndirname = de->d_name; + std::string ndirname; + if(not *name) + name = "."; + if(relative) { + dirname += "/"; + dirname += name; + } else + dirname = name; + ok = maketruepath(dirname); + entries.clear(); + DIR *d = opendir(dirname.c_str()); + if(d == NULL) + ok = false; + else { + struct dirent *de; + while((de=readdir(d)) != NULL) { + ndirname = de->d_name; #ifdef __HAVE_DRIVES__ - if((ndirname != ".") and not ((ndirname == "..") and streql(dirname.c_str()+1, ":/"))) + if((ndirname != ".") and not ((ndirname == "..") and streql(dirname.c_str()+1, ":/"))) #else - if((ndirname != ".") and not ((ndirname == "..") and (dirname == "/"))) + if((ndirname != ".") and not ((ndirname == "..") and (dirname == "/"))) #endif - entries.push_back(ndirname); - } - closedir(d); - rewind(); - } + entries.push_back(ndirname); + } + closedir(d); + rewind(); + } } #else void gposixdir::cd(const char *name, bool relative) { - std::string ndirname; - if(not *name) - name = "."; - if(relative) { - dirname += "/"; - dirname += name; - } else - dirname = name; - ok = maketruepath(dirname); - entries.clear(); - ndirname = dirname; - if ((ndirname.end() > ndirname.begin()) && (*(ndirname.end()-1) == '/')) - ndirname += "*"; - else - ndirname += "/*"; - struct _finddata_t de; - long d = _findfirst(ndirname.c_str(), &de); - if(d == -1) { - if(is_dir(dirname)) - ok = true; - else - ok = false; - } - else { - do { - ndirname = de.name; + std::string ndirname; + if(not *name) + name = "."; + if(relative) { + dirname += "/"; + dirname += name; + } else + dirname = name; + ok = maketruepath(dirname); + entries.clear(); + ndirname = dirname; + if ((ndirname.end() > ndirname.begin()) && (*(ndirname.end()-1) == '/')) + ndirname += "*"; + else + ndirname += "/*"; + struct _finddata_t de; + long d = _findfirst(ndirname.c_str(), &de); + if(d == -1) { + if(is_dir(dirname)) + ok = true; + else + ok = false; + } + else { + do { + ndirname = de.name; #ifdef __HAVE_DRIVES__ - if((ndirname != ".") and not ((ndirname == "..") and streql(dirname.c_str()+1, ":/"))) + if((ndirname != ".") and not ((ndirname == "..") and streql(dirname.c_str()+1, ":/"))) #else - if((ndirname != ".") and not ((ndirname == "..") and (dirname == "/"))) + if((ndirname != ".") and not ((ndirname == "..") and (dirname == "/"))) #endif - entries.push_back(ndirname); - } while(_findnext(d, &de) == 0); - _findclose(d); - rewind(); - } + entries.push_back(ndirname); + } while(_findnext(d, &de) == 0); + _findclose(d); + rewind(); + } } #endif @@ -153,26 +153,26 @@ void gposixdir::cd(const char *name, bool relative) const gdirentry *gposixdir::nextentry(const char *mask, bool nameonly) { - while(last_entry < entries.size()) { - if(mask and not gwildmat(entries[last_entry].c_str(), mask)) { - ++last_entry; - continue; - } - ret.name = entries[last_entry]; - ret.dirname = dirname.c_str(); - if(not nameonly) { - std::string pn = ret.dirname; - pn += "/"; - pn += ret.name; - size_t skipfrom; - while((skipfrom=pn.find("//")) != pn.npos) - pn.erase(skipfrom, 1); - stat(pn.c_str(), &ret.stat_info); - } - ++last_entry; - return &ret; - } - return NULL; + while(last_entry < entries.size()) { + if(mask and not gwildmat(entries[last_entry].c_str(), mask)) { + ++last_entry; + continue; + } + ret.name = entries[last_entry]; + ret.dirname = dirname.c_str(); + if(not nameonly) { + std::string pn = ret.dirname; + pn += "/"; + pn += ret.name; + size_t skipfrom; + while((skipfrom=pn.find("//")) != pn.npos) + pn.erase(skipfrom, 1); + stat(pn.c_str(), &ret.stat_info); + } + ++last_entry; + return &ret; + } + return NULL; } diff --git a/goldlib/gall/gdirposx.h b/goldlib/gall/gdirposx.h index d60c21f..2df32cc 100644 --- a/goldlib/gall/gdirposx.h +++ b/goldlib/gall/gdirposx.h @@ -39,13 +39,13 @@ class gdirentry { public: - std::string name; - struct stat stat_info; - const char *dirname; - gdirentry(); - ~gdirentry(); - bool is_directory() const { return S_ISDIR(stat_info.st_mode); } - bool is_file() const { return S_ISREG(stat_info.st_mode); } + std::string name; + struct stat stat_info; + const char *dirname; + gdirentry(); + ~gdirentry(); + bool is_directory() const { return S_ISDIR(stat_info.st_mode); } + bool is_file() const { return S_ISREG(stat_info.st_mode); } }; @@ -54,20 +54,20 @@ public: class gposixdir { private: - std::string dirname; - gdirentry ret; - gstrarray entries; - uint32_t last_entry; + std::string dirname; + gdirentry ret; + gstrarray entries; + uint32_t last_entry; public: - bool ok; - gposixdir(); - gposixdir(const char *name); - ~gposixdir(); - void cd(const char *name, bool relative=false); - inline void rewind() { last_entry = 0; } - const gdirentry *nextentry(const char *mask=NULL, bool nameonly=false); - inline const char *fullpath() { return dirname.c_str(); } + bool ok; + gposixdir(); + gposixdir(const char *name); + ~gposixdir(); + void cd(const char *name, bool relative=false); + inline void rewind() { last_entry = 0; } + const gdirentry *nextentry(const char *mask=NULL, bool nameonly=false); + inline const char *fullpath() { return dirname.c_str(); } }; diff --git a/goldlib/gall/gshare.h b/goldlib/gall/gshare.h index 9c96b3f..7e9bc63 100644 --- a/goldlib/gall/gshare.h +++ b/goldlib/gall/gshare.h @@ -40,10 +40,10 @@ #undef SH_COMPAT #endif #elif !defined(SH_DENYNO) -#define SH_DENYRW 0x10 // Deny read/write -#define SH_DENYWR 0x20 // Deny write -#define SH_DENYRD 0x30 // Deny read -#define SH_DENYNO 0x40 // Deny nothing +#define SH_DENYRW 0x10 // Deny read/write +#define SH_DENYWR 0x20 // Deny write +#define SH_DENYRD 0x30 // Deny read +#define SH_DENYNO 0x40 // Deny nothing #endif #ifndef SH_COMPAT diff --git a/goldlib/gall/gstrarr.h b/goldlib/gall/gstrarr.h index edb5fe2..ad90dc1 100644 --- a/goldlib/gall/gstrarr.h +++ b/goldlib/gall/gstrarr.h @@ -45,15 +45,15 @@ typedef std::vector gstrarray; // ------------------------------------------------------------------ inline void tokenize(gstrarray& array, const char* str, const char* delim = NULL) { - if(delim == NULL) - delim = ", \t"; - char* tmp = throw_xstrdup(str); - char* token = strtok(tmp, delim); - while(token) { - array.push_back(token); - token = strtok(NULL, delim); - } - throw_xfree(tmp); + if(delim == NULL) + delim = ", \t"; + char* tmp = throw_xstrdup(str); + char* token = strtok(tmp, delim); + while(token) { + array.push_back(token); + token = strtok(NULL, delim); + } + throw_xfree(tmp); } diff --git a/goldlib/gall/gutlvers.cpp b/goldlib/gall/gutlvers.cpp index 914d812..eb275af 100644 --- a/goldlib/gall/gutlvers.cpp +++ b/goldlib/gall/gutlvers.cpp @@ -299,60 +299,60 @@ char *gcpuid(char *_cpuname) /* Step 1. Try to toggle alignment check flag; does not exist on 386. */ "pushfl\n\t" - "popl %%eax\n\t" - "movl %%eax,%%ecx\n\t" - "orl $0x00040000,%%eax\n\t" /* sets a alignment check flag */ - "pushl %%eax\n\t" + "popl %%eax\n\t" + "movl %%eax,%%ecx\n\t" + "orl $0x00040000,%%eax\n\t" /* sets a alignment check flag */ + "pushl %%eax\n\t" "popfl\n\t" "pushfl\n\t" - "popl %%eax\n\t" - "xorl %%ecx,%%eax\n\t" - "andl $0x00040000,%%eax\n\t" /* test alignment check flag */ - "pushl %%ecx\n\t" + "popl %%eax\n\t" + "xorl %%ecx,%%eax\n\t" + "andl $0x00040000,%%eax\n\t" /* test alignment check flag */ + "pushl %%ecx\n\t" "popfl\n\t" - "testl %%eax,%%eax\n\t" /* alignment check flag is set? */ - "jnz try486\n\t" + "testl %%eax,%%eax\n\t" /* alignment check flag is set? */ + "jnz try486\n\t" /* NexGen CPU does not have aligment check flag. */ "pushfl\n\t" - "movl $0x5555, %%eax\n\t" - "xorl %%edx, %%edx\n\t" - "movl $2, %%ecx\n\t" + "movl $0x5555, %%eax\n\t" + "xorl %%edx, %%edx\n\t" + "movl $2, %%ecx\n\t" "clc\n\t" - "divl %%ecx\n\t" - "jz nexgen\n\t" + "divl %%ecx\n\t" + "jz nexgen\n\t" "popfl\n\t" - "movl $3,%0\n\t" /* CPU 386 */ - "jmp end\n" + "movl $3,%0\n\t" /* CPU 386 */ + "jmp end\n" "nexgen:" "popfl\n\t" - "movl $5,%0\n\t" /* CPU NX586 */ - "movl $0x4778654e,%1\n\t" /* store vendor string */ - "movl $0x72446e65,%1+4\n\t" /* "NexGenDriven" */ - "movl $0x6e657669,%1+8\n\t" -// "movl $0,%1+12\n\t" // vendor is zero-filled already - "jmp end\n" + "movl $5,%0\n\t" /* CPU NX586 */ + "movl $0x4778654e,%1\n\t" /* store vendor string */ + "movl $0x72446e65,%1+4\n\t" /* "NexGenDriven" */ + "movl $0x6e657669,%1+8\n\t" +// "movl $0,%1+12\n\t" // vendor is zero-filled already + "jmp end\n" /* Step2. Try to toggle identification flag; does not exist on early 486s.*/ "try486:" "pushfl\n\t" - "popl %%eax\n\t" - "movl %%eax,%%ecx\n\t" - "xorl $0x00200000,%%eax\n\t" /* sets a identification bit */ - "pushl %%eax\n\t" + "popl %%eax\n\t" + "movl %%eax,%%ecx\n\t" + "xorl $0x00200000,%%eax\n\t" /* sets a identification bit */ + "pushl %%eax\n\t" "popfl\n\t" "pushfl\n\t" - "popl %%eax\n\t" - "xorl %%ecx,%%eax\n\t" - "andl $0x00200000,%%eax\n\t" /* test identification bit */ - "pushl %%ecx\n\t" + "popl %%eax\n\t" + "xorl %%ecx,%%eax\n\t" + "andl $0x00200000,%%eax\n\t" /* test identification bit */ + "pushl %%ecx\n\t" "popfl\n\t" - "testl %%eax,%%eax\n\t" /* if identification flag is set then cpuid CPU's command may be used */ - "jnz trycpuid\n\t" - "movl $4,%0\n\t" /* CPU 486 */ + "testl %%eax,%%eax\n\t" /* if identification flag is set then cpuid CPU's command may be used */ + "jnz trycpuid\n\t" + "movl $4,%0\n\t" /* CPU 486 */ /* * Check Cyrix CPU @@ -362,14 +362,14 @@ char *gcpuid(char *_cpuname) * Note: CPUID is enabled on M2, so it passes another way. */ "pushfl\n\t" - "movl $0x5555, %%eax\n\t" - "xorl %%edx, %%edx\n\t" - "movl $2, %%ecx\n\t" + "movl $0x5555, %%eax\n\t" + "xorl %%edx, %%edx\n\t" + "movl $2, %%ecx\n\t" "clc\n\t" - "divl %%ecx\n\t" - "jnc trycyrix\n\t" + "divl %%ecx\n\t" + "jnc trycyrix\n\t" "popfl\n\t" - "jmp end\n" /* You may use Intel CPU */ + "jmp end\n" /* You may use Intel CPU */ "trycyrix:" "popfl\n\t" @@ -379,44 +379,44 @@ char *gcpuid(char *_cpuname) * CPU, we couldn't distinguish it from Cyrix's (including IBM * brand of Cyrix CPUs). */ - "movl $0x69727943,%1\n\t" /* store vendor string */ - "movl $0x736e4978,%1+4\n\t" /* "CyrixInstead" */ - "movl $0x64616574,%1+8\n\t" - "jmp end\n" + "movl $0x69727943,%1\n\t" /* store vendor string */ + "movl $0x736e4978,%1+4\n\t" /* "CyrixInstead" */ + "movl $0x64616574,%1+8\n\t" + "jmp end\n" /* Step 3. Use the `cpuid' instruction. */ "trycpuid:" - "xorl %%eax,%%eax\n\t" - ".byte 0x0f,0xa2\n\t" /* cpuid 0 */ - "movl %%eax,%2\n\t" /* "cpuid 1" capability */ - "movl %%ebx,%1\n\t" /* store vendor string */ - "movl %%edx,%1+4\n\t" - "movl %%ecx,%1+8\n\t" -// "movb $0,%1+12\n\t" // vendor is zero-filled already + "xorl %%eax,%%eax\n\t" + ".byte 0x0f,0xa2\n\t" /* cpuid 0 */ + "movl %%eax,%2\n\t" /* "cpuid 1" capability */ + "movl %%ebx,%1\n\t" /* store vendor string */ + "movl %%edx,%1+4\n\t" + "movl %%ecx,%1+8\n\t" +// "movb $0,%1+12\n\t" // vendor is zero-filled already "andl %%eax,%%eax\n\t" /* "cpuid 1" is allowed? (eax==1?) */ "jz i586\n\t" /* no, skip "cpuid 1" */ - "movl $1,%%eax\n\t" - ".byte 0x0f,0xa2\n\t" // cpuid 1 -// "movl %%eax,%6\n\t" // store cpu_id -// "movl %%edx,%7\n\t" // store cpu_feature + "movl $1,%%eax\n\t" + ".byte 0x0f,0xa2\n\t" // cpuid 1 +// "movl %%eax,%6\n\t" // store cpu_id +// "movl %%edx,%7\n\t" // store cpu_feature - "movb %%al,%%bl\n\t" - "shrb $4,%%bl\n\t" // extract CPU model - "movb %%bl,%4\n\t" // store model + "movb %%al,%%bl\n\t" + "shrb $4,%%bl\n\t" // extract CPU model + "movb %%bl,%4\n\t" // store model - "andl $0x0F0F,%%eax\n\t" // extract CPU family type and stepping - "movb %%al,%5\n\t" // store stepping - "movb %%ah,%3\n\t" // store family - "cmpb $5,%%ah\n\t" - "jae i586\n\t" + "andl $0x0F0F,%%eax\n\t" // extract CPU family type and stepping + "movb %%al,%5\n\t" // store stepping + "movb %%ah,%3\n\t" // store family + "cmpb $5,%%ah\n\t" + "jae i586\n\t" /* less than Pentium; must be 486 */ - "movl $4,%0\n\t" /* CPU 486 */ - "jmp end\n" + "movl $4,%0\n\t" /* CPU 486 */ + "jmp end\n" "i586:\n\t" /* Pentium and greater. Store family type into CPU type var */ - "movb %%ah,%0\n" + "movb %%ah,%0\n" "end:\n\t" "nop\n\t" diff --git a/goldlib/gcfg/gs_fech4.h b/goldlib/gcfg/gs_fech4.h index 3172c8a..ef47f3c 100644 --- a/goldlib/gcfg/gs_fech4.h +++ b/goldlib/gcfg/gs_fech4.h @@ -48,25 +48,25 @@ /* CONFIG.flags */ /********************************************************/ #define RETEAR 0x00000001l -#define AUTOCREATE 0x00000002l -#define KILLEMPTY 0x00000004l -#define KILLDUPES 0x00000008l -#define FRONTDOOR 0x00000010l -#define DBRIDGE 0x00000020l -#define BINKLEY 0x00000040l -#define INTERMAIL 0x00000080l +#define AUTOCREATE 0x00000002l +#define KILLEMPTY 0x00000004l +#define KILLDUPES 0x00000008l +#define FRONTDOOR 0x00000010l +#define DBRIDGE 0x00000020l +#define BINKLEY 0x00000040l +#define INTERMAIL 0x00000080l //#define SWAP_XMS 0x00000100l //#define SWAP_EMS 0x00000200l //#define SWAP_DISK 0x00000400l #define PURGE_PROCESSDATE 0x00008000l #define MAILER_RESCAN 0x00010000l -#define EXCLUDE_USERS 0x00020000l -#define EXCLUDE_SYSOPS 0x00040000l -#define CHECK_DESTINATION 0x00080000l +#define EXCLUDE_USERS 0x00020000l +#define EXCLUDE_SYSOPS 0x00040000l +#define CHECK_DESTINATION 0x00080000l #define UPDATE_BBS_CONFIG 0x00100000l #define KILL_GRUNGED_DATE 0x00200000l #define NOT_BUFFER_EMS 0x00400000l -#define KEEP_NETMAILS 0x00800000l +#define KEEP_NETMAILS 0x00800000l #define NOT_UPDATE_MAILER 0x01000000l #define NOT_CHECK_SEMAPHORES 0x02000000l #define CREATE_SEMAPHORES 0x04000000l @@ -83,14 +83,14 @@ enum BBSSoft { NoBBSSoft = 0, RemoteAccess111, QuickBBS, /* CONFIG.CC.what */ /********************************************************/ #define FROM 1 -#define TO 2 -#define SUBJECT 3 +#define TO 2 +#define SUBJECT 3 /********************************************************/ /* CONFIG.QuietLevel */ /********************************************************/ #define QUIET_PACK 0x0001 -#define QUIET_UNPACK 0x0002 +#define QUIET_UNPACK 0x0002 #define QUIET_EXTERN 0x0004 /********************************************************/ @@ -108,13 +108,13 @@ enum ARCmailExt { ARCDigits = 0, ARCHex, ARCAlpha }; /********************************************************/ /* CONFIG.AreaFixFlags */ /********************************************************/ -#define ALLOWRESCAN 0x0001 -#define KEEPREQUEST 0x0002 -#define KEEPRECEIPT 0x0004 -#define ALLOWREMOTE 0x0008 -#define DETAILEDLIST 0x0010 -#define ALLOWPASSWORD 0x0020 -#define ALLOWPKTPWD 0x0040 +#define ALLOWRESCAN 0x0001 +#define KEEPREQUEST 0x0002 +#define KEEPRECEIPT 0x0004 +#define ALLOWREMOTE 0x0008 +#define DETAILEDLIST 0x0010 +#define ALLOWPASSWORD 0x0020 +#define ALLOWPKTPWD 0x0040 /********************************************************/ /* Area.board (1-200 = QBBS) */ @@ -126,10 +126,10 @@ enum ARCmailExt { ARCDigits = 0, ARCHex, ARCAlpha }; /* Area.flags.type */ /********************************************************/ #define QBBS 0 -#define FIDO 1 -#define SQUISH 2 +#define FIDO 1 +#define SQUISH 2 #define JAM 3 -#define PT_BOARD 7 +#define PT_BOARD 7 /********************************************************/ /* Area.type */ @@ -138,26 +138,26 @@ enum ARCmailExt { ARCDigits = 0, ARCHex, ARCAlpha }; #define AREA_NETMAIL 1 #define AREA_LOCAL 2 #define AREA_BADMAILBOARD 3 -#define AREA_DUPEBOARD 4 +#define AREA_DUPEBOARD 4 /********************************************************/ /* Node.flags */ /********************************************************/ #define DDDD 0x0001 -#define TOSSCAN 0x0002 -#define DIRECT 0x0004 -#define CRASH 0x0008 -#define UMLAUT_NET 0x0010 +#define TOSSCAN 0x0002 +#define DIRECT 0x0004 +#define CRASH 0x0008 +#define UMLAUT_NET 0x0010 #define ALLOW_AF_REMOTE 0x0020 #define RESCANDISABLED 0x0040 -#define HOLD 0x0080 -#define ARCMAIL060 0x0200 -#define PASSIVE 0x0400 +#define HOLD 0x0080 +#define ARCMAIL060 0x0200 +#define PASSIVE 0x0400 #define ALLOWAREACREATE 0x0800 #define PACKER 0xF000 #define PACKS(x) (int)(((x)&PACKER)>>12) /* Index of used Packer */ - /* 0xf = .PKT, don't pack */ + /* 0xf = .PKT, don't pack */ /********************************************************/ /* Node.advflags */ @@ -166,7 +166,7 @@ enum ARCmailExt { ARCDigits = 0, ARCHex, ARCAlpha }; #define NOT_NOTIFY 0x0002 #define NOT_HELP 0x0004 #define NOATTACH 0x0008 -#define NET_HOLD 0x0010 +#define NET_HOLD 0x0010 #define NET_CRASH 0x0020 #define NET_DIRECT 0x0040 @@ -215,7 +215,7 @@ typedef struct CONFIGURATION4 { char tag[4]; char name[_MAXPATH-2]; - char list[2]; /* List prefix character */ + char list[2]; /* List prefix character */ } Packer[8]; struct { @@ -271,7 +271,7 @@ typedef struct CONFIGURATION4 char TempInBound[_MAXPATH]; char resv2[832]; dword offset; /* This is the offset from the current - file-pointer to the 1st Node */ + file-pointer to the 1st Node */ } CONFIG4; /* To directly access the 'Nodes' and/or 'Areas' while bypassing the */ @@ -289,9 +289,9 @@ typedef struct char newgroup; /* Default group for new areas */ Address routes[15]; /* netmail routing */ byte areas[124]; /* Bit-field with 992 bits, Byte 0/Bit 7 */ - /* is conference 0, etc. */ + /* is conference 0, etc. */ dword groups; /* Bit-field, Byte 0/Bit 7 = 'A' etc. */ - /* false means group is active */ + /* false means group is active */ char areafixpw[9]; byte advflags; } FeNode4; @@ -427,7 +427,7 @@ typedef struct #define EH_QBBS_MSG 0x0101 #define EH_SBBS_MSG 0x0102 #define EH_PB122_MSG 0x0103 -#define EH_TAG_MSG 0x0104 +#define EH_TAG_MSG 0x0104 #define EH_RA200_MSG 0x0105 /* See BBS package's documentation */ #define EH_PB130_MSG 0x0106 /* for details */ diff --git a/goldlib/gcfg/gs_fech5.h b/goldlib/gcfg/gs_fech5.h index 288d069..e99b6da 100644 --- a/goldlib/gcfg/gs_fech5.h +++ b/goldlib/gcfg/gs_fech5.h @@ -44,38 +44,38 @@ #define MAX_NODES 1024 /* max # of nodes */ #define MAX_GROUPS 26 /* max # of groups */ #define MAX_AKAS 16 /* max # of akas */ -#define MAX_ROUTE 15 /* max # of 'vias' */ +#define MAX_ROUTE 15 /* max # of 'vias' */ /* Note: The MAX_AREAS and MAX_NODES are only the absolute maximums - as the handling is flexible. To get the maximums which are - used for the config file you read, you have to examine the - CONFIG.MaxAreas and CONFIG.MaxNodes variables ! + as the handling is flexible. To get the maximums which are + used for the config file you read, you have to examine the + CONFIG.MaxAreas and CONFIG.MaxNodes variables ! */ /********************************************************/ /* CONFIG.flags */ /********************************************************/ #define RETEAR 0x00000001l -#define AUTOCREATE 0x00000002l -#define KILLEMPTY 0x00000004l -#define KILLDUPES 0x00000008l -#define FRONTDOOR 0x00000010l -#define DBRIDGE 0x00000020l -#define BINKLEY 0x00000040l -#define INTERMAIL 0x00000080l +#define AUTOCREATE 0x00000002l +#define KILLEMPTY 0x00000004l +#define KILLDUPES 0x00000008l +#define FRONTDOOR 0x00000010l +#define DBRIDGE 0x00000020l +#define BINKLEY 0x00000040l +#define INTERMAIL 0x00000080l //#define SWAP_XMS 0x00000100l //#define SWAP_EMS 0x00000200l //#define SWAP_DISK 0x00000400l #define PURGE_PROCESSDATE 0x00008000l #define MAILER_RESCAN 0x00010000l -#define EXCLUDE_USERS 0x00020000l -#define EXCLUDE_SYSOPS 0x00040000l -#define CHECK_DESTINATION 0x00080000l +#define EXCLUDE_USERS 0x00020000l +#define EXCLUDE_SYSOPS 0x00040000l +#define CHECK_DESTINATION 0x00080000l #define UPDATE_BBS_CONFIG 0x00100000l #define KILL_GRUNGED_DATE 0x00200000l #define NOT_BUFFER_EMS 0x00400000l -#define KEEP_NETMAILS 0x00800000l +#define KEEP_NETMAILS 0x00800000l #define NOT_UPDATE_MAILER 0x01000000l #define NOT_CHECK_SEMAPHORES 0x02000000l #define CREATE_SEMAPHORES 0x04000000l @@ -86,20 +86,20 @@ /********************************************************/ enum BBSSoft { NoBBSSoft = 0, RemoteAccess111, QuickBBS, SuperBBS, ProBoard122, TagBBS, RemoteAccess200, - ProBoard130}; + ProBoard130}; /********************************************************/ /* CONFIG.CC.what */ /********************************************************/ #define FROM 1 -#define TO 2 -#define SUBJECT 3 +#define TO 2 +#define SUBJECT 3 /********************************************************/ /* CONFIG.QuietLevel */ /********************************************************/ #define QUIET_PACK 0x0001 -#define QUIET_UNPACK 0x0002 +#define QUIET_UNPACK 0x0002 #define QUIET_EXTERN 0x0004 /********************************************************/ @@ -117,13 +117,13 @@ enum ARCmailExt { ARCDigits = 0, ARCHex, ARCAlpha }; /********************************************************/ /* CONFIG.AreaFixFlags */ /********************************************************/ -#define ALLOWRESCAN 0x0001 -#define KEEPREQUEST 0x0002 -#define KEEPRECEIPT 0x0004 -#define ALLOWREMOTE 0x0008 -#define DETAILEDLIST 0x0010 -#define ALLOWPASSWORD 0x0020 -#define ALLOWPKTPWD 0x0040 +#define ALLOWRESCAN 0x0001 +#define KEEPREQUEST 0x0002 +#define KEEPRECEIPT 0x0004 +#define ALLOWREMOTE 0x0008 +#define DETAILEDLIST 0x0010 +#define ALLOWPASSWORD 0x0020 +#define ALLOWPKTPWD 0x0040 /********************************************************/ /* Area.board (1-200 = QBBS) */ @@ -135,10 +135,10 @@ enum ARCmailExt { ARCDigits = 0, ARCHex, ARCAlpha }; /* Area.flags.type */ /********************************************************/ #define QBBS 0 -#define FIDO 1 -#define SQUISH 2 +#define FIDO 1 +#define SQUISH 2 #define JAM 3 -#define PT_BOARD 7 +#define PT_BOARD 7 /********************************************************/ /* Area.type */ @@ -147,26 +147,26 @@ enum ARCmailExt { ARCDigits = 0, ARCHex, ARCAlpha }; #define AREA_NETMAIL 1 #define AREA_LOCAL 2 #define AREA_BADMAILBOARD 3 -#define AREA_DUPEBOARD 4 +#define AREA_DUPEBOARD 4 /********************************************************/ /* Node.flags */ /********************************************************/ #define DDDD 0x0001 -#define TOSSCAN 0x0002 -#define DIRECT 0x0004 -#define CRASH 0x0008 -#define UMLAUT_NET 0x0010 +#define TOSSCAN 0x0002 +#define DIRECT 0x0004 +#define CRASH 0x0008 +#define UMLAUT_NET 0x0010 #define ALLOW_AF_REMOTE 0x0020 #define RESCANDISABLED 0x0040 -#define HOLD 0x0080 -#define ARCMAIL060 0x0200 -#define PASSIVE 0x0400 +#define HOLD 0x0080 +#define ARCMAIL060 0x0200 +#define PASSIVE 0x0400 #define ALLOWAREACREATE 0x0800 #define PACKER 0xF000 #define PACKS(x) (int)(((x)&PACKER)>>12) /* Index of used Packer */ - /* 0xf = .PKT, don't pack */ + /* 0xf = .PKT, don't pack */ /********************************************************/ /* Node.advflags */ @@ -175,7 +175,7 @@ enum ARCmailExt { ARCDigits = 0, ARCHex, ARCAlpha }; #define NOT_NOTIFY 0x0002 #define NOT_HELP 0x0004 #define NOATTACH 0x0008 -#define NET_HOLD 0x0010 +#define NET_HOLD 0x0010 #define NET_CRASH 0x0020 #define NET_DIRECT 0x0040 @@ -224,7 +224,7 @@ typedef struct CONFIGURATION5 { char tag[4]; char name[_MAXPATH-2]; - char list[2]; /* List prefix character */ + char list[2]; /* List prefix character */ } Packer[8]; struct { @@ -279,7 +279,7 @@ typedef struct CONFIGURATION5 char AreaFixLog[_MAXPATH]; char TempInBound[_MAXPATH]; word maxPKTmsgs; - word RouteCnt; /* # of PackRoute records */ + word RouteCnt; /* # of PackRoute records */ char resv2[822]; word MaxAreas,MaxNodes; /* Current max values for this config */ word NodeRecSize; /* For internal use only, the 'Node' @@ -288,7 +288,7 @@ typedef struct CONFIGURATION5 used size will be held in memory while FE & FESetup is running */ dword offset; /* This is the offset from the current - file-pointer to the 1st Node */ + file-pointer to the 1st Node */ } CONFIG5; /* To directly access the 'Nodes' and/or 'Areas' while bypassing the */ @@ -298,7 +298,7 @@ typedef struct CONFIGURATION5 typedef struct { Address addr; - Address arcdest; /* destination for ARCmail file attaches */ + Address arcdest; /* destination for ARCmail file attaches */ byte aka; /* 0 ... MAX_AKAS-1 */ byte autopassive; /* # of days */ byte newgroup; /* Default group for new areas */ @@ -306,12 +306,12 @@ typedef struct word flags; word sec_level; char password[9]; /* .PKT password */ - char areafixpw[9]; /* AreaFix password */ + char areafixpw[9]; /* AreaFix password */ dword groups; /* Bit-field, Byte 0/Bit 7 = 'A' etc. */ - /* false means group is active */ + /* false means group is active */ dword resv; byte areas[MAX_AREAS/8]; /* Bit-field with MAX_AREAS bits, Byte 0/Bit 7 */ - /* is conference 0, etc. */ + /* is conference 0, etc. */ } FeNode5; typedef struct @@ -342,7 +342,7 @@ typedef struct word keepsysop : 1; word killread : 1; word disablepsv : 1; - word resv : 7; + word resv : 7; } advflags; word seenbys; /* LSB = Aka0, MSB = Aka15 */ short recvdays; @@ -453,8 +453,8 @@ typedef struct #define EH_RA111_MSG 0x0100 /* Original records of BBS systems */ #define EH_QBBS_MSG 0x0101 #define EH_SBBS_MSG 0x0102 -#define EH_PB122_MSG 0x0103 /* obsolete */ -#define EH_TAG_MSG 0x0104 +#define EH_PB122_MSG 0x0103 /* obsolete */ +#define EH_TAG_MSG 0x0104 #define EH_RA200_MSG 0x0105 /* See BBS package's documentation */ #define EH_PB200_MSG 0x0106 /* for details */ diff --git a/goldlib/gcfg/gs_inter.h b/goldlib/gcfg/gs_inter.h index 45cfe02..1726e07 100644 --- a/goldlib/gcfg/gs_inter.h +++ b/goldlib/gcfg/gs_inter.h @@ -197,7 +197,7 @@ typedef struct { byte audio_end_hour; byte audio_end_minute; - /* --- Minimum cost to process undialable */ + /* --- Minimum cost to process undialable */ word min_undial_cost; diff --git a/goldlib/gcfg/gs_opus.h b/goldlib/gcfg/gs_opus.h index 5c35fe5..1c6b3b8 100644 --- a/goldlib/gcfg/gs_opus.h +++ b/goldlib/gcfg/gs_opus.h @@ -398,8 +398,8 @@ struct _PRM word matrix_mask; word MinNetBaud; /* minimum baud rate for remote netmail */ - byte exit_mailer; /* Exit when mailer is running */ - byte num_crashes; /* Number of tries when sending crash */ + byte exit_mailer; /* Exit when mailer is running */ + byte num_crashes; /* Number of tries when sending crash */ struct class_rec Class[MAXCLASS]; struct _FOSREGS FosRegs[10]; @@ -420,30 +420,30 @@ struct _PRM byte sylno; /* Def Sysop Language no. (0-5) */ byte uslno; /* Def User Language no. (0-5) */ byte relog_exit; /* Exit after -o relog */ - word Scrn_Size; /* Local monitor's size, high byte = len */ + word Scrn_Size; /* Local monitor's size, high byte = len */ /* New for version 18 */ - word default_expire_days; /* Number of days before new users */ - word default_expire_mins; /* Number of days before new users */ - long default_keys; /* New user's default keys */ - long default_section; /* New user's default section */ - word Point_Net; /* My point net */ - word Boss_Node; /* My point net */ - byte NoPwd_Priv; /* Priv if you want to allow users without password */ - byte Local_Exit; /* Exit after local messages */ - byte Upload_Exit; /* Exit after an upload for checking */ - byte ExtMail_Exit; /* Exit for externmail */ - byte Max_Echo; /* Longest echomail message to handle 3-60k */ - byte WhoPriv; /* Priv to see who uploaded a file */ + word default_expire_days; /* Number of days before new users */ + word default_expire_mins; /* Number of days before new users */ + long default_keys; /* New user's default keys */ + long default_section; /* New user's default section */ + word Point_Net; /* My point net */ + word Boss_Node; /* My point net */ + byte NoPwd_Priv; /* Priv if you want to allow users without password */ + byte Local_Exit; /* Exit after local messages */ + byte Upload_Exit; /* Exit after an upload for checking */ + byte ExtMail_Exit; /* Exit for externmail */ + byte Max_Echo; /* Longest echomail message to handle 3-60k */ + byte WhoPriv; /* Priv to see who uploaded a file */ - ADDR GUUCP; /* Where to send gated UUCP messages */ + ADDR GUUCP; /* Where to send gated UUCP messages */ long making_section; - byte ListSysop; /* Privilege neeeded to see sysops in net list */ - byte rawpriv; /* Privilege needed to see/download files not listed */ - byte uucp_priv; /* Privilege needed to turn off uucp addresses */ - byte Flags3; /* More flags. */ - byte Mail_Exit; /* Exit after mail connect */ + byte ListSysop; /* Privilege neeeded to see sysops in net list */ + byte rawpriv; /* Privilege needed to see/download files not listed */ + byte uucp_priv; /* Privilege needed to turn off uucp addresses */ + byte Flags3; /* More flags. */ + byte Mail_Exit; /* Exit after mail connect */ byte byte_fill; word PRM_FILL3[18]; @@ -533,39 +533,39 @@ struct _PRM OFS xtexpd; /* Expired due-to-Time used OEC BBS */ OFS lang[12]; /* 12 Language File Root Name pointers */ - OFS badpath; /* Path for unrecognized echo names */ + OFS badpath; /* Path for unrecognized echo names */ /*--------------------------------------------------------------------------*/ /* New for version 18 */ /*--------------------------------------------------------------------------*/ - OFS ConfHelp; /* Help file for newuser configure */ - OFS Mainmenu; /* ASCII menu at MAIN */ - OFS Confmenu; /* ASCII menu at Config */ - OFS Sectmenu; /* ASCII menu at Section menu */ - OFS Sysopmenu; /* ASCII menu at Sysop menu */ + OFS ConfHelp; /* Help file for newuser configure */ + OFS Mainmenu; /* ASCII menu at MAIN */ + OFS Confmenu; /* ASCII menu at Config */ + OFS Sectmenu; /* ASCII menu at Section menu */ + OFS Sysopmenu; /* ASCII menu at Sysop menu */ OFS Echotoss; /* Where to find EchoToss.Log */ OFS MDM_Answer; /* String to force autoanswer */ - OFS BAD_PWD; /* File shown to users who've forgottent thiers */ + OFS BAD_PWD; /* File shown to users who've forgottent thiers */ OFS charset; /* File that contains character translation tables */ - OFS DL_Log; /* Who's downloaded what */ - OFS UL_Log; /* Who uploaded what */ - OFS Name_Filter; /* Old USERNAME.TXT */ - OFS Bad_Name; /* What to show user if filter catches them */ - OFS CUSTOM1_menu; /* What to show before CUSTOM1 menu */ - OFS CUSTOM2_menu; /* What to show before CUSTOM2 menu */ - OFS CUSTOM3_menu; /* What to show before CUSTOM3 menu */ - OFS CUSTOM4_menu; /* What to show before CUSTOM4 menu */ - OFS CUSTOM5_menu; /* What to show before CUSTOM5 menu */ - OFS CUSTOM6_menu; /* What to show before CUSTOM6 menu */ - OFS EXT_mail_string; /* What we see when UUCP is coming */ - OFS MaybeNew; /* File shown if didn't find user name */ - OFS Histmenu; /* ASCII menu at History */ - OFS My_Question; /* Sysop configured question */ - OFS HLP_make; /* How to make a section */ - OFS MDM_FDial[4]; /* Special dialing instructions */ - OFS Yell; /* Yell OEC */ - OFS HLP_Macro; /* Help for macro menu */ - OFS UUCP_list; /* Address list for UUCP */ - OFS HLP_IChat; /* Interline chat help */ + OFS DL_Log; /* Who's downloaded what */ + OFS UL_Log; /* Who uploaded what */ + OFS Name_Filter; /* Old USERNAME.TXT */ + OFS Bad_Name; /* What to show user if filter catches them */ + OFS CUSTOM1_menu; /* What to show before CUSTOM1 menu */ + OFS CUSTOM2_menu; /* What to show before CUSTOM2 menu */ + OFS CUSTOM3_menu; /* What to show before CUSTOM3 menu */ + OFS CUSTOM4_menu; /* What to show before CUSTOM4 menu */ + OFS CUSTOM5_menu; /* What to show before CUSTOM5 menu */ + OFS CUSTOM6_menu; /* What to show before CUSTOM6 menu */ + OFS EXT_mail_string; /* What we see when UUCP is coming */ + OFS MaybeNew; /* File shown if didn't find user name */ + OFS Histmenu; /* ASCII menu at History */ + OFS My_Question; /* Sysop configured question */ + OFS HLP_make; /* How to make a section */ + OFS MDM_FDial[4]; /* Special dialing instructions */ + OFS Yell; /* Yell OEC */ + OFS HLP_Macro; /* Help for macro menu */ + OFS UUCP_list; /* Address list for UUCP */ + OFS HLP_IChat; /* Interline chat help */ OFS protocols[MAX_EXTERN]; /* external file protocol programs */ /*v18*/ OFS OFS_Filler[7]; @@ -586,13 +586,13 @@ struct _PRM char buf[CTLSIZE]; end; -#define ASK_PHONE 0x01 /* Used with xuflags */ -#define ASK_ALIAS 0x02 /* Used with xuflags */ -#define ASK_REAL 0x04 /* Used with xuflags */ -#define ASK_CITY 0x08 /* Used with xuflags */ -#define CAN_ALIAS 0x10 /* Allow ALIAS' in some situations */ -#define ASK_BDAY 0x20 /* Ask user for birthday */ -#define ASK_ADDRESS 0x40 /* Ask user for street address */ +#define ASK_PHONE 0x01 /* Used with xuflags */ +#define ASK_ALIAS 0x02 /* Used with xuflags */ +#define ASK_REAL 0x04 /* Used with xuflags */ +#define ASK_CITY 0x08 /* Used with xuflags */ +#define CAN_ALIAS 0x10 /* Allow ALIAS' in some situations */ +#define ASK_BDAY 0x20 /* Ask user for birthday */ +#define ASK_ADDRESS 0x40 /* Ask user for street address */ /* Means no privilege level is set and/or applicable At LOGON, */ /* for example, it means system is for PRE-REGISTERED users only. */ @@ -603,8 +603,8 @@ struct _common_data { char Opus[16]; /* "OPUS-CBCS 1.20" */ long QuotePosition; /* Quote file position */ long CallerCount; /* Number of callers */ - long Caller_ID; /* ID of current newest user */ - long MSG_ID; /* Last used MSGID */ + long Caller_ID; /* ID of current newest user */ + long MSG_ID; /* Last used MSGID */ word FILLER[15]; /* RESERVED - do not use */ word MAX_task; /* Highest task number */ }; @@ -642,15 +642,15 @@ struct _common_data { #define MATRIX_CHANGED 0x0001 /* Changed matrix area. Scan */ #define LOCAL_CHANGED 0x0002 /* Changed Local area. */ -#define GOT_BUNDLE 0x0100 /* Received a PKT file */ -#define GOT_ARCMAIL 0x0200 /* Received an archived file */ -#define GOT_REQUESTS 0x0400 /* Got file requests to handle */ -#define GOT_ECHOMAIL 0x1000 /* Received Echomail */ +#define GOT_BUNDLE 0x0100 /* Received a PKT file */ +#define GOT_ARCMAIL 0x0200 /* Received an archived file */ +#define GOT_REQUESTS 0x0400 /* Got file requests to handle */ +#define GOT_ECHOMAIL 0x1000 /* Received Echomail */ /*--------------------------------------------------------------------------*/ /* INTERLINE FLAGS */ /*--------------------------------------------------------------------------*/ -#define CAN_CHAT 0x01 /* Multiline systems can do chats */ +#define CAN_CHAT 0x01 /* Multiline systems can do chats */ // END OF SUB-INCLUDE PRM18.H //////////////////////////////////////////////////// @@ -678,7 +678,7 @@ struct _common_data { #define STEADY 0x02 /* never change baud rate 0000 0010 */ #define ECHOSCAN 0x04 /* automatically scan echo's 0000 0100 */ #define ECHO_GUARD 0x08 /* no toss un-pwd echo arc 0000 1000 */ -#define LEAVE_ESCN 0x10 /* Leave echotoss.log after Scanning 0001 0000 */ +#define LEAVE_ESCN 0x10 /* Leave echotoss.log after Scanning 0001 0000 */ #define DO_MSGID 0x20 /* Put MSGID lines into echomail 0010 0000 */ #define F_NOCRASH 0x40 /* Don't accept crash mail 0100 0000 */ #define F_UNPK 0x80 /* Unpack incomming arcmail 1000 0000 */ @@ -700,11 +700,11 @@ struct _common_data { /*--------------------------------------------------------------------------*/ /* FLAGS 3 */ /*--------------------------------------------------------------------------*/ -#define F3STEADY 0x01 /* Can do ARQ steady. &B2 */ -#define F3GMENU 0x02 /* Will let users do graphics menus */ -#define F3LOGOFF 0x04 /* Collect logoff messages */ -#define F3NOALIAS 0x08 /* Don't put alias' in SEEN-BY */ -#define F3HINAMES 0x10 /* Allow users with hi-bit names */ +#define F3STEADY 0x01 /* Can do ARQ steady. &B2 */ +#define F3GMENU 0x02 /* Will let users do graphics menus */ +#define F3LOGOFF 0x04 /* Collect logoff messages */ +#define F3NOALIAS 0x08 /* Don't put alias' in SEEN-BY */ +#define F3HINAMES 0x10 /* Allow users with hi-bit names */ /*--------------------------------------------------------------------------*/ /* FWDflags (bits to control IN TRANSIT messages) */ @@ -713,9 +713,9 @@ struct _common_data { #define FWD_PWD 0x02 /* IN TRANSIT by pwd only 0000 0010 */ #define FWD_TONET 0x04 /* Accept IN TRANSIT only to my net 0000 0100 */ #define FWD_NOBITS 0x08 /* No IN TRANSIT if extended bits used 0000 1000 */ -#define FWD_HOST 0x10 /* Send mail to host if can't find. */ -#define VERSION6 0x40 /* Use Version 6 nodelist */ -#define IMAPOINT 0x80 /* This is a point */ +#define FWD_HOST 0x10 /* Send mail to host if can't find. */ +#define VERSION6 0x40 /* Use Version 6 nodelist */ +#define IMAPOINT 0x80 /* This is a point */ /*--------------------------------------------------------------------------*/ /* LOG FLAGS */ @@ -731,7 +731,7 @@ struct _common_data { #define M_SNOOP 0x01 /* sysop display on 0000 0001 */ #define MOUSE 0x02 /* sysop mouse on 0000 0010 */ #define M_BRKCLEAR 0x04 /* Use BREAK to clear outbound buffer 0000 0100 */ -#define SLOW_MODEM 0x08 /* Slow modem and fast computer */ +#define SLOW_MODEM 0x08 /* Slow modem and fast computer */ /*--------------------------------------------------------------------------*/ /* STYLE FLAGS */ @@ -739,11 +739,11 @@ struct _common_data { #define SF_PATH 0x01 /* use path, not Dir.Bbs 0000 0001 */ #define SF_KILL 0x02 /* Kill rec'd pvt messages 0000 0010 */ #define SF_ASKKILL 0x04 /* ASK about killing msgs 0000 0100 */ -#define SF_EUROPE 0x08 /* European date strings */ -#define SF_TIME 0x10 /* Show time remaining on menu 0001 0000 */ -#define SF_NOFLAG 0x20 /* Don't allow user config at logon 0010 0000 */ -#define SF_HANDHOLD 0x40 /* Track user's errors and add help 0100 0000 */ -#define SF_NOHIGH 0x80 /* Track user's errors and add help 0100 0000 */ +#define SF_EUROPE 0x08 /* European date strings */ +#define SF_TIME 0x10 /* Show time remaining on menu 0001 0000 */ +#define SF_NOFLAG 0x20 /* Don't allow user config at logon 0010 0000 */ +#define SF_HANDHOLD 0x40 /* Track user's errors and add help 0100 0000 */ +#define SF_NOHIGH 0x80 /* Track user's errors and add help 0100 0000 */ #define SET_FLAG(x,y) ((x)|=(y)) @@ -770,7 +770,7 @@ struct _common_data { /* THE USER DATABASE */ /*--------------------------------------------------------------------------*/ -#define MAX_USEC 80 /* Maximum number of areas in "user" section */ +#define MAX_USEC 80 /* Maximum number of areas in "user" section */ struct _usr { @@ -858,20 +858,20 @@ struct _common_data { uint32_t messages_read; /* Total number of messages read */ int32_t messages_sent; /* Number of messages entered by user */ - word my_section[MAX_USEC]; /* This is just a block of area */ - /* numbers in the user's Section */ - /* Message areas are first, then */ - /* file areas. The first file */ - /* area is at my_section[msecs] */ + word my_section[MAX_USEC]; /* This is just a block of area */ + /* numbers in the user's Section */ + /* Message areas are first, then */ + /* file areas. The first file */ + /* area is at my_section[msecs] */ - word big_fill[40]; /* Fill out to 512 bytes */ - word Opus_Flags; /* Stores Opus temporary configuration */ + word big_fill[40]; /* Fill out to 512 bytes */ + word Opus_Flags; /* Stores Opus temporary configuration */ byte byte_fill; - byte Default_Protocol; /* Default transfer protocol */ - byte User_MMacro[16]; /* Message User's keyboard Macro */ - byte User_FMacro[16]; /* File User's keyboard Macro */ - byte User_DMacro[16]; /* Default User's keyboard Macro */ - byte Sysop_Comment[80]; /* Anything you want to say about 'em */ + byte Default_Protocol; /* Default transfer protocol */ + byte User_MMacro[16]; /* Message User's keyboard Macro */ + byte User_FMacro[16]; /* File User's keyboard Macro */ + byte User_DMacro[16]; /* Default User's keyboard Macro */ + byte Sysop_Comment[80]; /* Anything you want to say about 'em */ #endif uint32_t OPUS_id; @@ -917,10 +917,10 @@ struct _common_data { #define HOTKEYS 0x0001 /* Wants HotKeys at all help levels */ #define QMENU 0x0002 /* Wants to return to last menu instead of MAIN */ #define ASKGRAPH 0x0004 /* Wants to be asked about graphics every logon */ -#define ASCIIMENU 0x0008 /* Wants long tedious graphics menus */ -#define SHOW_TIME 0x0010 /* Show time remaining at prompts */ -#define BLOCKCHAT 0x4000 /* User doesn't want to be sociable. */ -#define INCRITAREA 0x8000 /* Opus is in critical area */ +#define ASCIIMENU 0x0008 /* Wants long tedious graphics menus */ +#define SHOW_TIME 0x0010 /* Show time remaining at prompts */ +#define BLOCKCHAT 0x4000 /* User doesn't want to be sociable. */ +#define INCRITAREA 0x8000 /* Opus is in critical area */ /*--------------------------------------------------------------------------*/ @@ -944,11 +944,11 @@ struct _common_data { /*--------------------------------------------------------------------------*/ /* Flags for After_Externs */ /*--------------------------------------------------------------------------*/ -#define NEW_ECHOS 0x0001 /* New Echomail entered by user */ -#define NEW_MATRIX 0x0002 /* New Matrix entered by user */ -#define NEW_LOCAL 0x0004 /* New Local mail entered by user */ -#define UPLOADED 0x0008 /* User uploaded something */ -#define DUP_UPLOAD 0x0010 /* User uploaded a duplicate file */ +#define NEW_ECHOS 0x0001 /* New Echomail entered by user */ +#define NEW_MATRIX 0x0002 /* New Matrix entered by user */ +#define NEW_LOCAL 0x0004 /* New Local mail entered by user */ +#define UPLOADED 0x0008 /* User uploaded something */ +#define DUP_UPLOAD 0x0010 /* User uploaded a duplicate file */ /*--------------------------------------------------------------------------*/ /* LASTUSER.BBS file structure */ @@ -1251,64 +1251,64 @@ struct _Hello struct _filesys { - char Area_Name[32]; /* Area's primary name */ + char Area_Name[32]; /* Area's primary name */ - word Area_Number; /* area number */ - word Area_Menu; /* which menu? */ + word Area_Number; /* area number */ + word Area_Menu; /* which menu? */ word Total_Size; - byte Area_Priv; /* Area Privilege */ - byte Down_Priv; /* Download Privilege */ + byte Area_Priv; /* Area Privilege */ + byte Down_Priv; /* Download Privilege */ byte Up_Priv; - byte Priv_Up; /* Uploads from users with Priv>= Priv_Up */ - byte Ratio_Priv; /* Privilege where u/d ratios start */ + byte Priv_Up; /* Uploads from users with Priv>= Priv_Up */ + byte Ratio_Priv; /* Privilege where u/d ratios start */ byte New_Priv; byte fill_byte1[2]; /* 48 */ - word Attrib; /* Area Attribute */ - word Status; /* Area Status, extended Attribute? */ + word Attrib; /* Area Attribute */ + word Status; /* Area Status, extended Attribute? */ - long Start_Pos; /* start of Area in sysfile.dat */ + long Start_Pos; /* start of Area in sysfile.dat */ /* 56 */ - long Area_Lock; /* Area Lock */ + long Area_Lock; /* Area Lock */ long Up_Lock; - long Down_Lock; /* edit Lock */ + long Down_Lock; /* edit Lock */ - long Priv_Key; /* Private Key path */ + long Priv_Key; /* Private Key path */ /* 72 */ - long Section; /* edit Lock */ + long Section; /* edit Lock */ long fill_long[2]; - byte Title_Len; /* length of Title */ - byte Prefiles_Len; /* files shown at Area access like Areainfo */ + byte Title_Len; /* length of Title */ + byte Prefiles_Len; /* files shown at Area access like Areainfo */ - byte Downpath_Len; /* length of path */ - byte Uppath_Len; /* length of path */ + byte Downpath_Len; /* length of path */ + byte Uppath_Len; /* length of path */ /* 88 */ - byte Barricade_Len; /* Barricade length if used */ + byte Barricade_Len; /* Barricade length if used */ byte Rules_Len; - byte Privkey_Len; /* Uploads from users with "key" go here */ - byte PrivUp_Len; /* Private Upload path */ - byte Menu_Len; /* file name for this area's ascii menu */ - byte Vol_Len; /* Length of volume name */ - byte Help_Len; /* Length of help name for this area */ + byte Privkey_Len; /* Uploads from users with "key" go here */ + byte PrivUp_Len; /* Private Upload path */ + byte Menu_Len; /* file name for this area's ascii menu */ + byte Vol_Len; /* Length of volume name */ + byte Help_Len; /* Length of help name for this area */ - byte fill_byte2[5]; /* more filler */ + byte fill_byte2[5]; /* more filler */ /* 100 */ - word Other_Len; /* external programs use this number bytes */ + word Other_Len; /* external programs use this number bytes */ - word Def_Upload; /* Area number for default uploads */ - word Priv_Upload; /* Area number for Priv uploads */ - word Key_Upload; /* Area number for Lock uploads */ + word Def_Upload; /* Area number for default uploads */ + word Priv_Upload; /* Area number for Priv uploads */ + word Key_Upload; /* Area number for Lock uploads */ - word fill_word[10]; /* more filler to 128 bytes*/ + word fill_word[10]; /* more filler to 128 bytes*/ }; /* Title */ @@ -1332,31 +1332,31 @@ struct _filesys { struct _msgsys { - char Area_Name[32]; /* Area's primary name */ - char Echo_Name[32]; /* Area's echo name */ - word Area_Number; /* Area number */ - word Area_Menu; /* which menu? */ - word Total_Size; /* Total size of this Area in SYSMSG.DAT */ + char Area_Name[32]; /* Area's primary name */ + char Echo_Name[32]; /* Area's echo name */ + word Area_Number; /* Area number */ + word Area_Menu; /* which menu? */ + word Total_Size; /* Total size of this Area in SYSMSG.DAT */ - byte Area_Priv; /* Area Privilege */ - byte Edit_Priv; /* Edit Privilege */ - byte Private_Priv; /* Privilege to read Private messages*/ + byte Area_Priv; /* Area Privilege */ + byte Edit_Priv; /* Edit Privilege */ + byte Private_Priv; /* Privilege to read Private messages*/ byte Upload_Priv; byte fill_0[3]; - byte Translate; /* Which character set to use 1, 2.... */ + byte Translate; /* Which character set to use 1, 2.... */ /* 80 */ - long Area_Lock; /* Area Lock */ - long Edit_Lock; /* Edit Lock */ + long Area_Lock; /* Area Lock */ + long Edit_Lock; /* Edit Lock */ - long Private_Lock; /* Lock to read Private messages*/ + long Private_Lock; /* Lock to read Private messages*/ long Upload_Lock; - word Attrib; /* Area Attribute */ - word Status; /* Area Status, extended Attribute? */ + word Attrib; /* Area Attribute */ + word Status; /* Area Status, extended Attribute? */ - long Start_Pos; /* start of Area in sysmsg.dat */ + long Start_Pos; /* start of Area in sysmsg.dat */ long Section; - byte Max_Lines; /* Maximum number of lines in messages */ + byte Max_Lines; /* Maximum number of lines in messages */ byte fill_1[3]; /* 112 */ @@ -1365,21 +1365,21 @@ struct _msgsys { word Node; word Point; - byte Path_Len; /* length of Path */ - byte Title_Len; /* length of Title */ + byte Path_Len; /* length of Path */ + byte Title_Len; /* length of Title */ - byte Barricade_Len; /* Barricade length if used */ - byte Origin_Len; /* non-default Origin line */ + byte Barricade_Len; /* Barricade length if used */ + byte Origin_Len; /* non-default Origin line */ - byte Domain_Len; /* Domain (if used) length */ - byte Menu_Len; /* file name for this area's ascii menu */ - byte Vol_Len; /* Length of volume name */ - byte Help_Len; /* Length of help name for this area */ + byte Domain_Len; /* Domain (if used) length */ + byte Menu_Len; /* file name for this area's ascii menu */ + byte Vol_Len; /* Length of volume name */ + byte Help_Len; /* Length of help name for this area */ /* 144 */ - byte Scan_Len; /* number of boards that Area is Scanned to */ - byte Scan_Pos; /* where Opus is in the Scan right now */ - word Other_Len; /* external programs use this number bytes */ + byte Scan_Len; /* number of boards that Area is Scanned to */ + byte Scan_Pos; /* where Opus is in the Scan right now */ + word Other_Len; /* external programs use this number bytes */ word Extern_Flags; word word_fill[5]; /* 160 */ @@ -1388,7 +1388,7 @@ struct _msgsys { /*--------------------------------------------------------------------------*/ /* Then some strings/structures follow as needed */ /*--------------------------------------------------------------------------*/ - /* Path string */ + /* Path string */ /* Title string */ /* Barricade string */ /* Origin string */ @@ -1404,7 +1404,7 @@ struct _msgsys { /*--------------------------------------------------------------------------*/ -struct _ascan { /* structure of address for echoScanning */ +struct _ascan { /* structure of address for echoScanning */ word Net; word Node; }; @@ -1430,8 +1430,8 @@ struct _lf { /* File Area attributes (limit or describe the behavior of an area) */ /*--------------------------------------------------------------------------*/ -#define F_DUPE 0x0001 /* Allow duplicate uploads in this area */ -#define F_FREE 0x0002 /* Downloads from this area area all 0K */ +#define F_DUPE 0x0001 /* Allow duplicate uploads in this area */ +#define F_FREE 0x0002 /* Downloads from this area area all 0K */ /*--------------------------------------------------------------------------*/ @@ -1443,9 +1443,9 @@ struct _lf { #define NOPRIVATE 0x08 /* OPUS: Disallow private messages */ #define ANON_OK 0x10 /* OPUS: Enable anonymous messages */ #define _ECHOMAIL 0x20 /* OPUS: Set=Echomail Clear=Not Echomail */ -#define USEALIAS 0x40 /* OPUS: Use user's alias in this area if..... */ +#define USEALIAS 0x40 /* OPUS: Use user's alias in this area if..... */ //#define PASSTHROUGH 0x80 /* OPUS: Allow high-bit characters in echo area */ -#define INBOUND 0x0100 /* Inbound Only area */ +#define INBOUND 0x0100 /* Inbound Only area */ /*--------------------------------------------------------------------------*/ @@ -1456,22 +1456,22 @@ struct _lf { /* programs MAY have conflicting uses. */ /*--------------------------------------------------------------------------*/ -#define RENUMBER 0x0001 /* This area gets renumbered */ -#define MAILCHECK 0x0002 /* The mail check program will do this area */ -#define RESERVED2 0x0004 /* Reserved for Opus-defined flags */ -#define RESERVED3 0x0008 /* Reserved for Opus-defined flags */ -#define RESERVED4 0x0010 /* Reserved for Opus-defined flags */ -#define RESERVED5 0x0020 /* Reserved for Opus-defined flags */ -#define RESERVED6 0x0040 /* Reserved for Opus-defined flags */ -#define RESERVED7 0x0080 /* Reserved for Opus-defined flags */ -#define EXTERN1 0x0100 /* Undefined! Meaning varies for each program*/ -#define EXTERN2 0x0200 /* Undefined! Meaning varies for each program*/ -#define EXTERN3 0x0400 /* Undefined! Meaning varies for each program*/ -#define EXTERN4 0x0800 /* Undefined! Meaning varies for each program*/ -#define EXTERN5 0x1000 /* Undefined! Meaning varies for each program*/ -#define EXTERN6 0x2000 /* Undefined! Meaning varies for each program*/ -#define EXTERN7 0x4000 /* Undefined! Meaning varies for each program*/ -#define EXTERN8 0x8000 /* Undefined! Meaning varies for each program*/ +#define RENUMBER 0x0001 /* This area gets renumbered */ +#define MAILCHECK 0x0002 /* The mail check program will do this area */ +#define RESERVED2 0x0004 /* Reserved for Opus-defined flags */ +#define RESERVED3 0x0008 /* Reserved for Opus-defined flags */ +#define RESERVED4 0x0010 /* Reserved for Opus-defined flags */ +#define RESERVED5 0x0020 /* Reserved for Opus-defined flags */ +#define RESERVED6 0x0040 /* Reserved for Opus-defined flags */ +#define RESERVED7 0x0080 /* Reserved for Opus-defined flags */ +#define EXTERN1 0x0100 /* Undefined! Meaning varies for each program*/ +#define EXTERN2 0x0200 /* Undefined! Meaning varies for each program*/ +#define EXTERN3 0x0400 /* Undefined! Meaning varies for each program*/ +#define EXTERN4 0x0800 /* Undefined! Meaning varies for each program*/ +#define EXTERN5 0x1000 /* Undefined! Meaning varies for each program*/ +#define EXTERN6 0x2000 /* Undefined! Meaning varies for each program*/ +#define EXTERN7 0x4000 /* Undefined! Meaning varies for each program*/ +#define EXTERN8 0x8000 /* Undefined! Meaning varies for each program*/ // ------------------------------------------------------------------ diff --git a/goldlib/gcfg/gxsync.cpp b/goldlib/gcfg/gxsync.cpp index b22ae90..f32a8f7 100644 --- a/goldlib/gcfg/gxsync.cpp +++ b/goldlib/gcfg/gxsync.cpp @@ -91,11 +91,11 @@ void gareafile::ReadSynchronet(char* tag) { std::cout << "* Reading " << file << std::endl; // Skip header: - // max_qwkmsgs 4 - // mail_maxcrcs 4 - // mail_maxage 2 - // unused (NULL) 512 - // unused (0xff) 512 + // max_qwkmsgs 4 + // mail_maxcrcs 4 + // mail_maxage 2 + // unused (NULL) 512 + // unused (0xff) 512 fseek(in, 1034, SEEK_CUR); if(fread(&shrt, sizeof(uint16_t), 1, in) == 1) { diff --git a/goldlib/glibc/fnmatch.c b/goldlib/glibc/fnmatch.c index abbbe67..e401760 100644 --- a/goldlib/glibc/fnmatch.c +++ b/goldlib/glibc/fnmatch.c @@ -22,7 +22,7 @@ /* Enable GNU extensions in fnmatch.h. */ #ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 +# define _GNU_SOURCE 1 #endif #include @@ -107,12 +107,12 @@ # else # define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ -# define IS_CHAR_CLASS(string) \ - (STREQ (string, "alpha") || STREQ (string, "upper") \ - || STREQ (string, "lower") || STREQ (string, "digit") \ - || STREQ (string, "alnum") || STREQ (string, "xdigit") \ - || STREQ (string, "space") || STREQ (string, "print") \ - || STREQ (string, "punct") || STREQ (string, "graph") \ +# define IS_CHAR_CLASS(string) \ + (STREQ (string, "alpha") || STREQ (string, "upper") \ + || STREQ (string, "lower") || STREQ (string, "digit") \ + || STREQ (string, "alnum") || STREQ (string, "xdigit") \ + || STREQ (string, "space") || STREQ (string, "print") \ + || STREQ (string, "punct") || STREQ (string, "graph") \ || STREQ (string, "cntrl") || STREQ (string, "blank")) # endif @@ -150,222 +150,222 @@ fnmatch (pattern, string, flags) c = FOLD (c); switch (c) - { - case '?': - if (*n == '\0') - return FNM_NOMATCH; - else if ((flags & FNM_FILE_NAME) && *n == '/') - return FNM_NOMATCH; - else if ((flags & FNM_PERIOD) && *n == '.' && - (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) - return FNM_NOMATCH; - break; + { + case '?': + if (*n == '\0') + return FNM_NOMATCH; + else if ((flags & FNM_FILE_NAME) && *n == '/') + return FNM_NOMATCH; + else if ((flags & FNM_PERIOD) && *n == '.' && + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) + return FNM_NOMATCH; + break; - case '\\': - if (!(flags & FNM_NOESCAPE)) - { - c = *p++; - if (c == '\0') - /* Trailing \ loses. */ - return FNM_NOMATCH; - c = FOLD (c); - } - if (FOLD (*n) != c) - return FNM_NOMATCH; - break; + case '\\': + if (!(flags & FNM_NOESCAPE)) + { + c = *p++; + if (c == '\0') + /* Trailing \ loses. */ + return FNM_NOMATCH; + c = FOLD (c); + } + if (FOLD (*n) != c) + return FNM_NOMATCH; + break; - case '*': - if ((flags & FNM_PERIOD) && *n == '.' && - (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) - return FNM_NOMATCH; + case '*': + if ((flags & FNM_PERIOD) && *n == '.' && + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) + return FNM_NOMATCH; - for (c = *p++; c == '?' || c == '*'; c = *p++) - { - if ((flags & FNM_FILE_NAME) && *n == '/') - /* A slash does not match a wildcard under FNM_FILE_NAME. */ - return FNM_NOMATCH; - else if (c == '?') - { - /* A ? needs to match one character. */ - if (*n == '\0') - /* There isn't another character; no match. */ - return FNM_NOMATCH; - else - /* One character of the string is consumed in matching - this ? wildcard, so *??? won't match if there are - less than three characters. */ - ++n; - } - } + for (c = *p++; c == '?' || c == '*'; c = *p++) + { + if ((flags & FNM_FILE_NAME) && *n == '/') + /* A slash does not match a wildcard under FNM_FILE_NAME. */ + return FNM_NOMATCH; + else if (c == '?') + { + /* A ? needs to match one character. */ + if (*n == '\0') + /* There isn't another character; no match. */ + return FNM_NOMATCH; + else + /* One character of the string is consumed in matching + this ? wildcard, so *??? won't match if there are + less than three characters. */ + ++n; + } + } - if (c == '\0') - return 0; + if (c == '\0') + return 0; - { - char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; - c1 = FOLD (c1); - for (--p; *n != '\0'; ++n) - if ((c == '[' || FOLD (*n) == c1) && - fnmatch (p, n, flags & ~FNM_PERIOD) == 0) - return 0; - return FNM_NOMATCH; - } + { + char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; + c1 = FOLD (c1); + for (--p; *n != '\0'; ++n) + if ((c == '[' || FOLD (*n) == c1) && + fnmatch (p, n, flags & ~FNM_PERIOD) == 0) + return 0; + return FNM_NOMATCH; + } - case '[': - { - /* Nonzero if the sense of the character class is inverted. */ - static int posixly_correct; - register int not; - char cold; + case '[': + { + /* Nonzero if the sense of the character class is inverted. */ + static int posixly_correct; + register int not; + char cold; - if (posixly_correct == 0) - posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; + if (posixly_correct == 0) + posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1; - if (*n == '\0') - return FNM_NOMATCH; + if (*n == '\0') + return FNM_NOMATCH; - if (*n == '.' && (flags & FNM_PERIOD) && - (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) - return FNM_NOMATCH; + if (*n == '.' && (flags & FNM_PERIOD) && + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) + return FNM_NOMATCH; - if (*n == '/' && (flags & FNM_FILE_NAME)) - /* `/' cannot be matched. */ - return FNM_NOMATCH; + if (*n == '/' && (flags & FNM_FILE_NAME)) + /* `/' cannot be matched. */ + return FNM_NOMATCH; - not = (*p == '!' || (posixly_correct < 0 && *p == '^')); - if (not) - ++p; + not = (*p == '!' || (posixly_correct < 0 && *p == '^')); + if (not) + ++p; - c = *p++; - for (;;) - { - int fn = FOLD (*n); + c = *p++; + for (;;) + { + int fn = FOLD (*n); - if (!(flags & FNM_NOESCAPE) && c == '\\') - { - if (*p == '\0') - return FNM_NOMATCH; - c = FOLD (*p++); + if (!(flags & FNM_NOESCAPE) && c == '\\') + { + if (*p == '\0') + return FNM_NOMATCH; + c = FOLD (*p++); - if (c == fn) - goto matched; - } - else if (c == '[' && *p == ':') - { - /* Leave room for the null. */ - char str[CHAR_CLASS_MAX_LENGTH + 1]; - size_t c1 = 0; + if (c == fn) + goto matched; + } + else if (c == '[' && *p == ':') + { + /* Leave room for the null. */ + char str[CHAR_CLASS_MAX_LENGTH + 1]; + size_t c1 = 0; # if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) - wctype_t wt; + wctype_t wt; # endif - for (;;) - { - if (c1 == CHAR_CLASS_MAX_LENGTH) - /* The name is too long and therefore the pattern - is ill-formed. */ - return FNM_NOMATCH; + for (;;) + { + if (c1 == CHAR_CLASS_MAX_LENGTH) + /* The name is too long and therefore the pattern + is ill-formed. */ + return FNM_NOMATCH; - c = *++p; - if (c == ':' && p[1] == ']') - { - p += 2; - break; - } - str[c1++] = 'c'; - } - str[c1] = '\0'; + c = *++p; + if (c == ':' && p[1] == ']') + { + p += 2; + break; + } + str[c1++] = 'c'; + } + str[c1] = '\0'; # if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) - wt = IS_CHAR_CLASS (str); - if (wt == 0) - /* Invalid character class name. */ - return FNM_NOMATCH; + wt = IS_CHAR_CLASS (str); + if (wt == 0) + /* Invalid character class name. */ + return FNM_NOMATCH; - if (__iswctype (__btowc (*n), wt)) - goto matched; + if (__iswctype (__btowc (*n), wt)) + goto matched; # else - if ((STREQ (str, "alnum") && ISALNUM (*n)) - || (STREQ (str, "alpha") && ISALPHA (*n)) - || (STREQ (str, "blank") && ISBLANK (*n)) - || (STREQ (str, "cntrl") && ISCNTRL (*n)) - || (STREQ (str, "digit") && ISDIGIT (*n)) - || (STREQ (str, "graph") && ISGRAPH (*n)) - || (STREQ (str, "lower") && ISLOWER (*n)) - || (STREQ (str, "print") && ISPRINT (*n)) - || (STREQ (str, "punct") && ISPUNCT (*n)) - || (STREQ (str, "space") && ISSPACE (*n)) - || (STREQ (str, "upper") && ISUPPER (*n)) - || (STREQ (str, "xdigit") && ISXDIGIT (*n))) - goto matched; + if ((STREQ (str, "alnum") && ISALNUM (*n)) + || (STREQ (str, "alpha") && ISALPHA (*n)) + || (STREQ (str, "blank") && ISBLANK (*n)) + || (STREQ (str, "cntrl") && ISCNTRL (*n)) + || (STREQ (str, "digit") && ISDIGIT (*n)) + || (STREQ (str, "graph") && ISGRAPH (*n)) + || (STREQ (str, "lower") && ISLOWER (*n)) + || (STREQ (str, "print") && ISPRINT (*n)) + || (STREQ (str, "punct") && ISPUNCT (*n)) + || (STREQ (str, "space") && ISSPACE (*n)) + || (STREQ (str, "upper") && ISUPPER (*n)) + || (STREQ (str, "xdigit") && ISXDIGIT (*n))) + goto matched; # endif - } - else if (c == '\0') - /* [ (unterminated) loses. */ - return FNM_NOMATCH; - else if (FOLD (c) == fn) - goto matched; + } + else if (c == '\0') + /* [ (unterminated) loses. */ + return FNM_NOMATCH; + else if (FOLD (c) == fn) + goto matched; - cold = c; - c = *p++; + cold = c; + c = *p++; - if (c == '-' && *p != ']') - { - /* It is a range. */ - char cend = *p++; - if (!(flags & FNM_NOESCAPE) && cend == '\\') - cend = *p++; - if (cend == '\0') - return FNM_NOMATCH; + if (c == '-' && *p != ']') + { + /* It is a range. */ + char cend = *p++; + if (!(flags & FNM_NOESCAPE) && cend == '\\') + cend = *p++; + if (cend == '\0') + return FNM_NOMATCH; - if (cold <= fn && fn <= FOLD (cend)) - goto matched; + if (cold <= fn && fn <= FOLD (cend)) + goto matched; - c = *p++; - } - if (c == ']') - break; - } + c = *p++; + } + if (c == ']') + break; + } - if (!not) - return FNM_NOMATCH; - break; + if (!not) + return FNM_NOMATCH; + break; - matched: - /* Skip the rest of the [...] that already matched. */ - while (c != ']') - { - if (c == '\0') - /* [... (unterminated) loses. */ - return FNM_NOMATCH; + matched: + /* Skip the rest of the [...] that already matched. */ + while (c != ']') + { + if (c == '\0') + /* [... (unterminated) loses. */ + return FNM_NOMATCH; - c = *p++; - if (!(flags & FNM_NOESCAPE) && c == '\\') - { - if (*p == '\0') - return FNM_NOMATCH; - /* XXX 1003.2d11 is unclear if this is right. */ - ++p; - } - else if (c == '[' && *p == ':') - { - do - if (*++p == '\0') - return FNM_NOMATCH; - while (*p != ':' || p[1] == ']'); - p += 2; - c = *p; - } - } - if (not) - return FNM_NOMATCH; - } - break; + c = *p++; + if (!(flags & FNM_NOESCAPE) && c == '\\') + { + if (*p == '\0') + return FNM_NOMATCH; + /* XXX 1003.2d11 is unclear if this is right. */ + ++p; + } + else if (c == '[' && *p == ':') + { + do + if (*++p == '\0') + return FNM_NOMATCH; + while (*p != ':' || p[1] == ']'); + p += 2; + c = *p; + } + } + if (not) + return FNM_NOMATCH; + } + break; - default: - if (c != FOLD (*n)) - return FNM_NOMATCH; - } + default: + if (c != FOLD (*n)) + return FNM_NOMATCH; + } ++n; } @@ -382,4 +382,4 @@ fnmatch (pattern, string, flags) # undef FOLD } -#endif /* _LIBC or not __GNU_LIBRARY__. */ +#endif /* _LIBC or not __GNU_LIBRARY__. */ diff --git a/goldlib/glibc/fnmatch.h b/goldlib/glibc/fnmatch.h index eb99617..faeade2 100644 --- a/goldlib/glibc/fnmatch.h +++ b/goldlib/glibc/fnmatch.h @@ -16,21 +16,21 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _FNMATCH_H -#define _FNMATCH_H 1 +#ifndef _FNMATCH_H +#define _FNMATCH_H 1 -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif #if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32 || defined _WIN32 # if !defined __GLIBC__ || !defined __P -# undef __P -# define __P(protos) protos +# undef __P +# define __P(protos) protos # endif #else /* Not C++ or ANSI C. */ -# undef __P -# define __P(protos) () +# undef __P +# define __P(protos) () /* We can get away without defining `const' here only because in this file it is used only inside the prototype for `fnmatch', which is elided in non-ANSI C where `const' is problematical. */ @@ -38,7 +38,7 @@ extern "C" { #ifndef const # if (defined __STDC__ && __STDC__) || defined __cplusplus -# define __const const +# define __const const # else # define __const # endif @@ -46,38 +46,38 @@ extern "C" { /* We #undef these before defining them because some losing systems (HP-UX A.08.07 for example) define these in . */ -#undef FNM_PATHNAME -#undef FNM_NOESCAPE -#undef FNM_PERIOD +#undef FNM_PATHNAME +#undef FNM_NOESCAPE +#undef FNM_PERIOD /* Bits set in the FLAGS argument to `fnmatch'. */ -#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ -#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ -#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ +#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ +#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ +#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE -# define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ -# define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ -# define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ +# define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ +# define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ +# define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ #endif /* Value returned by `fnmatch' if STRING does not match PATTERN. */ -#define FNM_NOMATCH 1 +#define FNM_NOMATCH 1 /* This value is returned if the implementation does not support `fnmatch'. Since this is not the case here it will never be returned but the conformance test suites still require the symbol to be defined. */ #ifdef _XOPEN_SOURCE -# define FNM_NOSYS (-1) +# define FNM_NOSYS (-1) #endif /* Match STRING against the filename pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ extern int fnmatch __P ((__const char *__pattern, __const char *__string, - int __flags)); + int __flags)); -#ifdef __cplusplus +#ifdef __cplusplus } #endif diff --git a/goldlib/glibc/glob.c b/goldlib/glibc/glob.c index fa870c0..7e2b2dc 100644 --- a/goldlib/glibc/glob.c +++ b/goldlib/glibc/glob.c @@ -20,13 +20,13 @@ #pragma alloca #endif -#ifdef HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include #endif /* Enable GNU extensions in glob.h. */ #ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 +# define _GNU_SOURCE 1 #endif #include @@ -37,7 +37,7 @@ /* #define NDEBUG 1 */ #include -#include /* Needed on stupid SunOS for assert. */ +#include /* Needed on stupid SunOS for assert. */ /* Comment out all this code if we are using the GNU C Library, and are not @@ -82,8 +82,8 @@ extern int errno; # define __set_errno(val) errno = (val) #endif -#ifndef NULL -# define NULL 0 +#ifndef NULL +# define NULL 0 #endif @@ -117,7 +117,7 @@ extern int errno; /* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available if the `d_type' member for `struct dirent' is available. */ #ifdef _DIRENT_HAVE_D_TYPE -# define HAVE_D_TYPE 1 +# define HAVE_D_TYPE 1 #endif @@ -132,8 +132,8 @@ extern int errno; #if defined STDC_HEADERS || defined __GNU_LIBRARY__ # include # include -# define ANSI_STRING -#else /* No standard headers. */ +# define ANSI_STRING +#else /* No standard headers. */ extern char *getenv (); @@ -143,7 +143,7 @@ extern char *getenv (); # else # include # endif -# ifdef HAVE_MEMORY_H +# ifdef HAVE_MEMORY_H # include # endif @@ -153,7 +153,7 @@ extern void free (); extern void qsort (); extern void abort (), exit (); -#endif /* Standard headers. */ +#endif /* Standard headers. */ #ifdef HAVE_GETLOGIN_R extern int getlogin_r __P ((char *, size_t)); @@ -161,7 +161,7 @@ extern int getlogin_r __P ((char *, size_t)); extern char *getlogin __P ((void)); #endif -#ifndef ANSI_STRING +#ifndef ANSI_STRING # ifndef bzero extern void bzero (); @@ -170,25 +170,25 @@ extern void bzero (); extern void bcopy (); # endif -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# define strrchr rindex +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# define strrchr rindex /* memset is only used for zero here, but let's be paranoid. */ # define memset(s, better_be_zero, n) \ ((void) ((better_be_zero) == 0 ? (bzero((s), (n)), 0) : (abort(), 0))) -#endif /* Not ANSI_STRING. */ +#endif /* Not ANSI_STRING. */ #if !defined HAVE_STRCOLL && !defined _LIBC -# define strcoll strcmp +# define strcoll strcmp #endif #if !defined HAVE_MEMPCPY && __GLIBC__ - 0 == 2 && __GLIBC_MINOR__ >= 1 -# define HAVE_MEMPCPY 1 +# define HAVE_MEMPCPY 1 # undef mempcpy # define mempcpy(Dest, Src, Len) __mempcpy (Dest, Src, Len) #endif -#ifndef __GNU_LIBRARY__ -# ifdef __GNUC__ +#ifndef __GNU_LIBRARY__ +# ifdef __GNUC__ __inline # endif # ifndef __SASC @@ -207,20 +207,20 @@ my_realloc (p, n) return (char *) malloc (n); return (char *) realloc (p, n); } -# define realloc my_realloc +# define realloc my_realloc # endif /* __SASC */ #endif /* __GNU_LIBRARY__ */ #if !defined __alloca && !defined __GNU_LIBRARY__ -# ifdef __GNUC__ +# ifdef __GNUC__ # undef alloca -# define alloca(n) __builtin_alloca (n) -# else /* Not GCC. */ +# define alloca(n) __builtin_alloca (n) +# else /* Not GCC. */ # ifdef HAVE_ALLOCA_H # include -# else /* Not HAVE_ALLOCA_H. */ +# else /* Not HAVE_ALLOCA_H. */ # ifndef _AIX # ifdef WINDOWS32 # include @@ -229,9 +229,9 @@ extern char *alloca (); # endif /* WINDOWS32 */ # endif /* Not _AIX. */ # endif /* sparc or HAVE_ALLOCA_H. */ -# endif /* GCC. */ +# endif /* GCC. */ -# define __alloca alloca +# define __alloca alloca #endif @@ -260,30 +260,30 @@ extern char *alloca (); #endif #if !(defined STDC_HEADERS || defined __GNU_LIBRARY__) -# undef size_t -# define size_t unsigned int +# undef size_t +# define size_t unsigned int #endif /* Some system header files erroneously define these. We want our own definitions from to take precedence. */ #ifndef __GNU_LIBRARY__ -# undef FNM_PATHNAME -# undef FNM_NOESCAPE -# undef FNM_PERIOD +# undef FNM_PATHNAME +# undef FNM_NOESCAPE +# undef FNM_PERIOD #endif #include /* Some system header files erroneously define these. We want our own definitions from to take precedence. */ #ifndef __GNU_LIBRARY__ -# undef GLOB_ERR -# undef GLOB_MARK -# undef GLOB_NOSORT -# undef GLOB_DOOFFS -# undef GLOB_NOCHECK -# undef GLOB_APPEND -# undef GLOB_NOESCAPE -# undef GLOB_PERIOD +# undef GLOB_ERR +# undef GLOB_MARK +# undef GLOB_NOSORT +# undef GLOB_DOOFFS +# undef GLOB_NOCHECK +# undef GLOB_APPEND +# undef GLOB_NOESCAPE +# undef GLOB_PERIOD #endif #include @@ -293,9 +293,9 @@ __inline__ #endif const char *next_brace_sub __P ((const char *begin)); static int glob_in_dir __P ((const char *pattern, const char *directory, - int flags, - int (*errfunc) (const char *, int), - glob_t *pglob)); + int flags, + int (*errfunc) (const char *, int), + glob_t *pglob)); static int prefix_array __P ((const char *prefix, char **array, size_t n)); static int collated_compare __P ((const __ptr_t, const __ptr_t)); @@ -316,29 +316,29 @@ next_brace_sub (begin) while (1) { if (depth == 0) - { - if (*cp != ',' && *cp != '}' && *cp != '\0') - { - if (*cp == '{') - ++depth; - ++cp; - continue; - } - } + { + if (*cp != ',' && *cp != '}' && *cp != '\0') + { + if (*cp == '{') + ++depth; + ++cp; + continue; + } + } else - { - while (*cp != '\0' && (*cp != '}' || depth > 0)) - { - if (*cp == '}') - --depth; - ++cp; - } - if (*cp == '\0') - /* An incorrectly terminated brace expression. */ - return NULL; + { + while (*cp != '\0' && (*cp != '}' || depth > 0)) + { + if (*cp == '}') + --depth; + ++cp; + } + if (*cp == '\0') + /* An incorrectly terminated brace expression. */ + return NULL; - continue; - } + continue; + } break; } @@ -376,127 +376,127 @@ glob (pattern, flags, errfunc, pglob) { const char *begin = strchr (pattern, '{'); if (begin != NULL) - { - /* Allocate working buffer large enough for our work. Note that - we have at least an opening and closing brace. */ - int firstc; - char *alt_start; - const char *p; - const char *next; - const char *rest; - size_t rest_len; + { + /* Allocate working buffer large enough for our work. Note that + we have at least an opening and closing brace. */ + int firstc; + char *alt_start; + const char *p; + const char *next; + const char *rest; + size_t rest_len; #ifdef __GNUC__ - __extension__ char onealt[strlen (pattern) - 1]; + __extension__ char onealt[strlen (pattern) - 1]; #else - char *onealt = (char *) malloc (strlen (pattern) - 1); - if (onealt == NULL) - { - if (!(flags & GLOB_APPEND)) - globfree (pglob); - return GLOB_NOSPACE; - } + char *onealt = (char *) malloc (strlen (pattern) - 1); + if (onealt == NULL) + { + if (!(flags & GLOB_APPEND)) + globfree (pglob); + return GLOB_NOSPACE; + } #endif - /* We know the prefix for all sub-patterns. */ + /* We know the prefix for all sub-patterns. */ #ifdef HAVE_MEMPCPY - alt_start = mempcpy (onealt, pattern, begin - pattern); + alt_start = mempcpy (onealt, pattern, begin - pattern); #else - memcpy (onealt, pattern, begin - pattern); - alt_start = &onealt[begin - pattern]; + memcpy (onealt, pattern, begin - pattern); + alt_start = &onealt[begin - pattern]; #endif - /* Find the first sub-pattern and at the same time find the - rest after the closing brace. */ - next = next_brace_sub (begin + 1); - if (next == NULL) - { - /* It is an illegal expression. */ + /* Find the first sub-pattern and at the same time find the + rest after the closing brace. */ + next = next_brace_sub (begin + 1); + if (next == NULL) + { + /* It is an illegal expression. */ #ifndef __GNUC__ - free (onealt); + free (onealt); #endif - return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob); - } + return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob); + } - /* Now find the end of the whole brace expression. */ - rest = next; - while (*rest != '}') - { - rest = next_brace_sub (rest + 1); - if (rest == NULL) - { - /* It is an illegal expression. */ + /* Now find the end of the whole brace expression. */ + rest = next; + while (*rest != '}') + { + rest = next_brace_sub (rest + 1); + if (rest == NULL) + { + /* It is an illegal expression. */ #ifndef __GNUC__ - free (onealt); + free (onealt); #endif - return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob); - } - } - /* Please note that we now can be sure the brace expression - is well-formed. */ - rest_len = strlen (++rest) + 1; + return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob); + } + } + /* Please note that we now can be sure the brace expression + is well-formed. */ + rest_len = strlen (++rest) + 1; - /* We have a brace expression. BEGIN points to the opening {, - NEXT points past the terminator of the first element, and END - points past the final }. We will accumulate result names from - recursive runs for each brace alternative in the buffer using - GLOB_APPEND. */ + /* We have a brace expression. BEGIN points to the opening {, + NEXT points past the terminator of the first element, and END + points past the final }. We will accumulate result names from + recursive runs for each brace alternative in the buffer using + GLOB_APPEND. */ - if (!(flags & GLOB_APPEND)) - { - /* This call is to set a new vector, so clear out the - vector so we can append to it. */ - pglob->gl_pathc = 0; - pglob->gl_pathv = NULL; - } - firstc = pglob->gl_pathc; + if (!(flags & GLOB_APPEND)) + { + /* This call is to set a new vector, so clear out the + vector so we can append to it. */ + pglob->gl_pathc = 0; + pglob->gl_pathv = NULL; + } + firstc = pglob->gl_pathc; - p = begin + 1; - while (1) - { - int result; + p = begin + 1; + while (1) + { + int result; - /* Construct the new glob expression. */ + /* Construct the new glob expression. */ #ifdef HAVE_MEMPCPY - mempcpy (mempcpy (alt_start, p, next - p), rest, rest_len); + mempcpy (mempcpy (alt_start, p, next - p), rest, rest_len); #else - memcpy (alt_start, p, next - p); - memcpy (&alt_start[next - p], rest, rest_len); + memcpy (alt_start, p, next - p); + memcpy (&alt_start[next - p], rest, rest_len); #endif - result = glob (onealt, - ((flags & ~(GLOB_NOCHECK|GLOB_NOMAGIC)) - | GLOB_APPEND), errfunc, pglob); + result = glob (onealt, + ((flags & ~(GLOB_NOCHECK|GLOB_NOMAGIC)) + | GLOB_APPEND), errfunc, pglob); - /* If we got an error, return it. */ - if (result && result != GLOB_NOMATCH) - { + /* If we got an error, return it. */ + if (result && result != GLOB_NOMATCH) + { #ifndef __GNUC__ - free (onealt); + free (onealt); #endif - if (!(flags & GLOB_APPEND)) - globfree (pglob); - return result; - } + if (!(flags & GLOB_APPEND)) + globfree (pglob); + return result; + } - if (*next == '}') - /* We saw the last entry. */ - break; + if (*next == '}') + /* We saw the last entry. */ + break; - p = next + 1; - next = next_brace_sub (p); - assert (next != NULL); - } + p = next + 1; + next = next_brace_sub (p); + assert (next != NULL); + } #ifndef __GNUC__ - free (onealt); + free (onealt); #endif - if (pglob->gl_pathc != firstc) - /* We found some entries. */ - return 0; - else if (!(flags & (GLOB_NOCHECK|GLOB_NOMAGIC))) - return GLOB_NOMATCH; - } + if (pglob->gl_pathc != firstc) + /* We found some entries. */ + return 0; + else if (!(flags & (GLOB_NOCHECK|GLOB_NOMAGIC))) + return GLOB_NOMATCH; + } } /* Find the filename. */ @@ -512,27 +512,27 @@ glob (pattern, flags, errfunc, pglob) if (filename == NULL) { /* This can mean two things: a simple name or "~name". The later - case is nothing but a notation for a directory. */ + case is nothing but a notation for a directory. */ if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && pattern[0] == '~') - { - dirname = pattern; - dirlen = strlen (pattern); + { + dirname = pattern; + dirlen = strlen (pattern); - /* Set FILENAME to NULL as a special flag. This is ugly but - other solutions would require much more code. We test for - this special case below. */ - filename = NULL; - } + /* Set FILENAME to NULL as a special flag. This is ugly but + other solutions would require much more code. We test for + this special case below. */ + filename = NULL; + } else - { - filename = pattern; + { + filename = pattern; #ifdef _AMIGA - dirname = ""; + dirname = ""; #else - dirname = "."; + dirname = "."; #endif - dirlen = 0; - } + dirlen = 0; + } } else if (filename == pattern) { @@ -547,26 +547,26 @@ glob (pattern, flags, errfunc, pglob) dirlen = filename - pattern; #if defined __MSDOS__ || defined WINDOWS32 if (*filename == ':' - || (filename > pattern + 1 && filename[-1] == ':')) - { - char *drive_spec; + || (filename > pattern + 1 && filename[-1] == ':')) + { + char *drive_spec; - ++dirlen; - drive_spec = (char *) __alloca (dirlen + 1); + ++dirlen; + drive_spec = (char *) __alloca (dirlen + 1); #ifdef HAVE_MEMPCPY - *((char *) mempcpy (drive_spec, pattern, dirlen)) = '\0'; + *((char *) mempcpy (drive_spec, pattern, dirlen)) = '\0'; #else - memcpy (drive_spec, pattern, dirlen); - drive_spec[dirlen] = '\0'; + memcpy (drive_spec, pattern, dirlen); + drive_spec[dirlen] = '\0'; #endif - /* For now, disallow wildcards in the drive spec, to - prevent infinite recursion in glob. */ - if (__glob_pattern_p (drive_spec, !(flags & GLOB_NOESCAPE))) - return GLOB_NOMATCH; - /* If this is "d:pattern", we need to copy `:' to DIRNAME - as well. If it's "d:/pattern", don't remove the slash - from "d:/", since "d:" and "d:/" are not the same.*/ - } + /* For now, disallow wildcards in the drive spec, to + prevent infinite recursion in glob. */ + if (__glob_pattern_p (drive_spec, !(flags & GLOB_NOESCAPE))) + return GLOB_NOMATCH; + /* If this is "d:pattern", we need to copy `:' to DIRNAME + as well. If it's "d:/pattern", don't remove the slash + from "d:/", since "d:" and "d:/" are not the same.*/ + } #endif newp = (char *) __alloca (dirlen + 1); #ifdef HAVE_MEMPCPY @@ -581,18 +581,18 @@ glob (pattern, flags, errfunc, pglob) if (filename[0] == '\0' #if defined __MSDOS__ || defined WINDOWS32 && dirname[dirlen - 1] != ':' - && (dirlen < 3 || dirname[dirlen - 2] != ':' - || dirname[dirlen - 1] != '/') + && (dirlen < 3 || dirname[dirlen - 2] != ':' + || dirname[dirlen - 1] != '/') #endif - && dirlen > 1) - /* "pattern/". Expand "pattern", appending slashes. */ - { - int val = glob (dirname, flags | GLOB_MARK, errfunc, pglob); - if (val == 0) - pglob->gl_flags = ((pglob->gl_flags & ~GLOB_MARK) - | (flags & GLOB_MARK)); - return val; - } + && dirlen > 1) + /* "pattern/". Expand "pattern", appending slashes. */ + { + int val = glob (dirname, flags | GLOB_MARK, errfunc, pglob); + if (val == 0) + pglob->gl_flags = ((pglob->gl_flags & ~GLOB_MARK) + | (flags & GLOB_MARK)); + return val; + } } if (!(flags & GLOB_APPEND)) @@ -607,160 +607,160 @@ glob (pattern, flags, errfunc, pglob) if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && dirname[0] == '~') { if (dirname[1] == '\0' || dirname[1] == '/') - { - /* Look up home directory. */ - const char *home_dir = getenv ("HOME"); + { + /* Look up home directory. */ + const char *home_dir = getenv ("HOME"); # ifdef _AMIGA - if (home_dir == NULL || home_dir[0] == '\0') - home_dir = "SYS:"; + if (home_dir == NULL || home_dir[0] == '\0') + home_dir = "SYS:"; # else # ifdef WINDOWS32 - if (home_dir == NULL || home_dir[0] == '\0') + if (home_dir == NULL || home_dir[0] == '\0') home_dir = "c:/users/default"; /* poor default */ # else - if (home_dir == NULL || home_dir[0] == '\0') - { - int success; - char *name; + if (home_dir == NULL || home_dir[0] == '\0') + { + int success; + char *name; # if defined HAVE_GETLOGIN_R || defined _LIBC - size_t buflen = sysconf (_SC_LOGIN_NAME_MAX) + 1; + size_t buflen = sysconf (_SC_LOGIN_NAME_MAX) + 1; - if (buflen == 0) - /* `sysconf' does not support _SC_LOGIN_NAME_MAX. Try - a moderate value. */ - buflen = 20; - name = (char *) __alloca (buflen); + if (buflen == 0) + /* `sysconf' does not support _SC_LOGIN_NAME_MAX. Try + a moderate value. */ + buflen = 20; + name = (char *) __alloca (buflen); - success = getlogin_r (name, buflen) >= 0; + success = getlogin_r (name, buflen) >= 0; # else - success = (name = getlogin ()) != NULL; + success = (name = getlogin ()) != NULL; # endif - if (success) - { - struct passwd *p; + if (success) + { + struct passwd *p; # if defined HAVE_GETPWNAM_R || defined _LIBC - size_t pwbuflen = sysconf (_SC_GETPW_R_SIZE_MAX); - char *pwtmpbuf; - struct passwd pwbuf; + size_t pwbuflen = sysconf (_SC_GETPW_R_SIZE_MAX); + char *pwtmpbuf; + struct passwd pwbuf; - if (pwbuflen == -1) - /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX. - Try a moderate value. */ - pwbuflen = 1024; - pwtmpbuf = (char *) __alloca (pwbuflen); + if (pwbuflen == -1) + /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX. + Try a moderate value. */ + pwbuflen = 1024; + pwtmpbuf = (char *) __alloca (pwbuflen); - success = (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p) - >= 0); + success = (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p) + >= 0); # else - p = getpwnam (name); - success = p != NULL; + p = getpwnam (name); + success = p != NULL; # endif - if (success) - home_dir = p->pw_dir; - } - } - if (home_dir == NULL || home_dir[0] == '\0') - { - if (flags & GLOB_TILDE_CHECK) - return GLOB_NOMATCH; - else - home_dir = "~"; /* No luck. */ - } + if (success) + home_dir = p->pw_dir; + } + } + if (home_dir == NULL || home_dir[0] == '\0') + { + if (flags & GLOB_TILDE_CHECK) + return GLOB_NOMATCH; + else + home_dir = "~"; /* No luck. */ + } # endif /* WINDOWS32 */ # endif - /* Now construct the full directory. */ - if (dirname[1] == '\0') - dirname = home_dir; - else - { - char *newp; - size_t home_len = strlen (home_dir); - newp = (char *) __alloca (home_len + dirlen); + /* Now construct the full directory. */ + if (dirname[1] == '\0') + dirname = home_dir; + else + { + char *newp; + size_t home_len = strlen (home_dir); + newp = (char *) __alloca (home_len + dirlen); # ifdef HAVE_MEMPCPY - mempcpy (mempcpy (newp, home_dir, home_len), - &dirname[1], dirlen); + mempcpy (mempcpy (newp, home_dir, home_len), + &dirname[1], dirlen); # else - memcpy (newp, home_dir, home_len); - memcpy (&newp[home_len], &dirname[1], dirlen); + memcpy (newp, home_dir, home_len); + memcpy (&newp[home_len], &dirname[1], dirlen); # endif - dirname = newp; - } - } + dirname = newp; + } + } # if !defined _AMIGA && !defined WINDOWS32 else - { - char *end_name = strchr (dirname, '/'); - const char *user_name; - const char *home_dir; + { + char *end_name = strchr (dirname, '/'); + const char *user_name; + const char *home_dir; - if (end_name == NULL) - user_name = dirname + 1; - else - { - char *newp; - newp = (char *) __alloca (end_name - dirname); + if (end_name == NULL) + user_name = dirname + 1; + else + { + char *newp; + newp = (char *) __alloca (end_name - dirname); # ifdef HAVE_MEMPCPY - *((char *) mempcpy (newp, dirname + 1, end_name - dirname)) - = '\0'; + *((char *) mempcpy (newp, dirname + 1, end_name - dirname)) + = '\0'; # else - memcpy (newp, dirname + 1, end_name - dirname); - newp[end_name - dirname - 1] = '\0'; + memcpy (newp, dirname + 1, end_name - dirname); + newp[end_name - dirname - 1] = '\0'; # endif - user_name = newp; - } + user_name = newp; + } - /* Look up specific user's home directory. */ - { - struct passwd *p; + /* Look up specific user's home directory. */ + { + struct passwd *p; # if defined HAVE_GETPWNAM_R || defined _LIBC - size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX); - char *pwtmpbuf; - struct passwd pwbuf; + size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX); + char *pwtmpbuf; + struct passwd pwbuf; - if (buflen == -1) - /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX. Try a - moderate value. */ - buflen = 1024; - pwtmpbuf = (char *) __alloca (buflen); + if (buflen == -1) + /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX. Try a + moderate value. */ + buflen = 1024; + pwtmpbuf = (char *) __alloca (buflen); - if (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) >= 0) - home_dir = p->pw_dir; - else - home_dir = NULL; + if (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) >= 0) + home_dir = p->pw_dir; + else + home_dir = NULL; # else - p = getpwnam (user_name); - if (p != NULL) - home_dir = p->pw_dir; - else - home_dir = NULL; + p = getpwnam (user_name); + if (p != NULL) + home_dir = p->pw_dir; + else + home_dir = NULL; # endif - } - /* If we found a home directory use this. */ - if (home_dir != NULL) - { - char *newp; - size_t home_len = strlen (home_dir); - size_t rest_len = end_name == NULL ? 0 : strlen (end_name); - newp = (char *) __alloca (home_len + rest_len + 1); + } + /* If we found a home directory use this. */ + if (home_dir != NULL) + { + char *newp; + size_t home_len = strlen (home_dir); + size_t rest_len = end_name == NULL ? 0 : strlen (end_name); + newp = (char *) __alloca (home_len + rest_len + 1); # ifdef HAVE_MEMPCPY - *((char *) mempcpy (mempcpy (newp, home_dir, home_len), - end_name, rest_len)) = '\0'; + *((char *) mempcpy (mempcpy (newp, home_dir, home_len), + end_name, rest_len)) = '\0'; # else - memcpy (newp, home_dir, home_len); - memcpy (&newp[home_len], end_name, rest_len); - newp[home_len + rest_len] = '\0'; + memcpy (newp, home_dir, home_len); + memcpy (&newp[home_len], end_name, rest_len); + newp[home_len + rest_len] = '\0'; # endif - dirname = newp; - } - else - if (flags & GLOB_TILDE_CHECK) - /* We have to regard it as an error if we cannot find the - home directory. */ - return GLOB_NOMATCH; - } -# endif /* Not Amiga && not WINDOWS32. */ + dirname = newp; + } + else + if (flags & GLOB_TILDE_CHECK) + /* We have to regard it as an error if we cannot find the + home directory. */ + return GLOB_NOMATCH; } -#endif /* Not VMS. */ +# endif /* Not Amiga && not WINDOWS32. */ + } +#endif /* Not VMS. */ /* Now test whether we looked for "~" or "~NAME". In this case we can give the answer now. */ @@ -770,46 +770,46 @@ glob (pattern, flags, errfunc, pglob) /* Return the directory if we don't check for error or if it exists. */ if ((flags & GLOB_NOCHECK) - || (((flags & GLOB_ALTDIRFUNC) - ? (*pglob->gl_stat) (dirname, &st) - : __stat (dirname, &st)) == 0 - && S_ISDIR (st.st_mode))) - { - pglob->gl_pathv - = (char **) realloc (pglob->gl_pathv, - (pglob->gl_pathc + - ((flags & GLOB_DOOFFS) ? - pglob->gl_offs : 0) + - 1 + 1) * - sizeof (char *)); - if (pglob->gl_pathv == NULL) - return GLOB_NOSPACE; + || (((flags & GLOB_ALTDIRFUNC) + ? (*pglob->gl_stat) (dirname, &st) + : __stat (dirname, &st)) == 0 + && S_ISDIR (st.st_mode))) + { + pglob->gl_pathv + = (char **) realloc (pglob->gl_pathv, + (pglob->gl_pathc + + ((flags & GLOB_DOOFFS) ? + pglob->gl_offs : 0) + + 1 + 1) * + sizeof (char *)); + if (pglob->gl_pathv == NULL) + return GLOB_NOSPACE; - if (flags & GLOB_DOOFFS) - while (pglob->gl_pathc < pglob->gl_offs) - pglob->gl_pathv[pglob->gl_pathc++] = NULL; + if (flags & GLOB_DOOFFS) + while (pglob->gl_pathc < pglob->gl_offs) + pglob->gl_pathv[pglob->gl_pathc++] = NULL; #if defined HAVE_STRDUP || defined _LIBC - pglob->gl_pathv[pglob->gl_pathc] = strdup (dirname); + pglob->gl_pathv[pglob->gl_pathc] = strdup (dirname); #else - { - size_t len = strlen (dirname) + 1; - char *dircopy = malloc (len); - if (dircopy != NULL) - pglob->gl_pathv[pglob->gl_pathc] = memcpy (dircopy, dirname, - len); - } + { + size_t len = strlen (dirname) + 1; + char *dircopy = malloc (len); + if (dircopy != NULL) + pglob->gl_pathv[pglob->gl_pathc] = memcpy (dircopy, dirname, + len); + } #endif - if (pglob->gl_pathv[pglob->gl_pathc] == NULL) - { - free (pglob->gl_pathv); - return GLOB_NOSPACE; - } - pglob->gl_pathv[++pglob->gl_pathc] = NULL; - pglob->gl_flags = flags; + if (pglob->gl_pathv[pglob->gl_pathc] == NULL) + { + free (pglob->gl_pathv); + return GLOB_NOSPACE; + } + pglob->gl_pathv[++pglob->gl_pathc] = NULL; + pglob->gl_flags = flags; - return 0; - } + return 0; + } /* Not found. */ return GLOB_NOMATCH; @@ -818,147 +818,147 @@ glob (pattern, flags, errfunc, pglob) if (__glob_pattern_p (dirname, !(flags & GLOB_NOESCAPE))) { /* The directory name contains metacharacters, so we - have to glob for the directory, and then glob for - the pattern in each directory found. */ + have to glob for the directory, and then glob for + the pattern in each directory found. */ glob_t dirs; register int i; status = glob (dirname, - ((flags & (GLOB_ERR | GLOB_NOCHECK | GLOB_NOESCAPE)) - | GLOB_NOSORT | GLOB_ONLYDIR), - errfunc, &dirs); + ((flags & (GLOB_ERR | GLOB_NOCHECK | GLOB_NOESCAPE)) + | GLOB_NOSORT | GLOB_ONLYDIR), + errfunc, &dirs); if (status != 0) - return status; + return status; /* We have successfully globbed the preceding directory name. - For each name we found, call glob_in_dir on it and FILENAME, - appending the results to PGLOB. */ + For each name we found, call glob_in_dir on it and FILENAME, + appending the results to PGLOB. */ for (i = 0; i < dirs.gl_pathc; ++i) - { - int old_pathc; + { + int old_pathc; -#ifdef SHELL - { - /* Make globbing interruptible in the bash shell. */ - extern int interrupt_state; +#ifdef SHELL + { + /* Make globbing interruptible in the bash shell. */ + extern int interrupt_state; - if (interrupt_state) - { - globfree (&dirs); - globfree (&files); - return GLOB_ABORTED; - } - } + if (interrupt_state) + { + globfree (&dirs); + globfree (&files); + return GLOB_ABORTED; + } + } #endif /* SHELL. */ - old_pathc = pglob->gl_pathc; - status = glob_in_dir (filename, dirs.gl_pathv[i], - ((flags | GLOB_APPEND) - & ~(GLOB_NOCHECK | GLOB_ERR)), - errfunc, pglob); - if (status == GLOB_NOMATCH) - /* No matches in this directory. Try the next. */ - continue; + old_pathc = pglob->gl_pathc; + status = glob_in_dir (filename, dirs.gl_pathv[i], + ((flags | GLOB_APPEND) + & ~(GLOB_NOCHECK | GLOB_ERR)), + errfunc, pglob); + if (status == GLOB_NOMATCH) + /* No matches in this directory. Try the next. */ + continue; - if (status != 0) - { - globfree (&dirs); - globfree (pglob); - return status; - } + if (status != 0) + { + globfree (&dirs); + globfree (pglob); + return status; + } - /* Stick the directory on the front of each name. */ - if (prefix_array (dirs.gl_pathv[i], - &pglob->gl_pathv[old_pathc], - pglob->gl_pathc - old_pathc)) - { - globfree (&dirs); - globfree (pglob); - return GLOB_NOSPACE; - } - } + /* Stick the directory on the front of each name. */ + if (prefix_array (dirs.gl_pathv[i], + &pglob->gl_pathv[old_pathc], + pglob->gl_pathc - old_pathc)) + { + globfree (&dirs); + globfree (pglob); + return GLOB_NOSPACE; + } + } flags |= GLOB_MAGCHAR; /* We have ignored the GLOB_NOCHECK flag in the `glob_in_dir' calls. - But if we have not found any matching entry and thie GLOB_NOCHECK - flag was set we must return the list consisting of the disrectory - names followed by the filename. */ + But if we have not found any matching entry and thie GLOB_NOCHECK + flag was set we must return the list consisting of the disrectory + names followed by the filename. */ if (pglob->gl_pathc == oldcount) - { - /* No matches. */ - if (flags & GLOB_NOCHECK) - { - size_t filename_len = strlen (filename) + 1; - char **new_pathv; - struct stat st; + { + /* No matches. */ + if (flags & GLOB_NOCHECK) + { + size_t filename_len = strlen (filename) + 1; + char **new_pathv; + struct stat st; - /* This is an pessimistic guess about the size. */ - pglob->gl_pathv - = (char **) realloc (pglob->gl_pathv, - (pglob->gl_pathc + - ((flags & GLOB_DOOFFS) ? - pglob->gl_offs : 0) + - dirs.gl_pathc + 1) * - sizeof (char *)); - if (pglob->gl_pathv == NULL) - { - globfree (&dirs); - return GLOB_NOSPACE; - } + /* This is an pessimistic guess about the size. */ + pglob->gl_pathv + = (char **) realloc (pglob->gl_pathv, + (pglob->gl_pathc + + ((flags & GLOB_DOOFFS) ? + pglob->gl_offs : 0) + + dirs.gl_pathc + 1) * + sizeof (char *)); + if (pglob->gl_pathv == NULL) + { + globfree (&dirs); + return GLOB_NOSPACE; + } - if (flags & GLOB_DOOFFS) - while (pglob->gl_pathc < pglob->gl_offs) - pglob->gl_pathv[pglob->gl_pathc++] = NULL; + if (flags & GLOB_DOOFFS) + while (pglob->gl_pathc < pglob->gl_offs) + pglob->gl_pathv[pglob->gl_pathc++] = NULL; - for (i = 0; i < dirs.gl_pathc; ++i) - { - const char *dir = dirs.gl_pathv[i]; - size_t dir_len = strlen (dir); + for (i = 0; i < dirs.gl_pathc; ++i) + { + const char *dir = dirs.gl_pathv[i]; + size_t dir_len = strlen (dir); - /* First check whether this really is a directory. */ - if (((flags & GLOB_ALTDIRFUNC) - ? (*pglob->gl_stat) (dir, &st) : __stat (dir, &st)) != 0 - || !S_ISDIR (st.st_mode)) - /* No directory, ignore this entry. */ - continue; + /* First check whether this really is a directory. */ + if (((flags & GLOB_ALTDIRFUNC) + ? (*pglob->gl_stat) (dir, &st) : __stat (dir, &st)) != 0 + || !S_ISDIR (st.st_mode)) + /* No directory, ignore this entry. */ + continue; - pglob->gl_pathv[pglob->gl_pathc] = malloc (dir_len + 1 - + filename_len); - if (pglob->gl_pathv[pglob->gl_pathc] == NULL) - { - globfree (&dirs); - globfree (pglob); - return GLOB_NOSPACE; - } + pglob->gl_pathv[pglob->gl_pathc] = malloc (dir_len + 1 + + filename_len); + if (pglob->gl_pathv[pglob->gl_pathc] == NULL) + { + globfree (&dirs); + globfree (pglob); + return GLOB_NOSPACE; + } #ifdef HAVE_MEMPCPY - mempcpy (mempcpy (mempcpy (pglob->gl_pathv[pglob->gl_pathc], - dir, dir_len), - "/", 1), - filename, filename_len); + mempcpy (mempcpy (mempcpy (pglob->gl_pathv[pglob->gl_pathc], + dir, dir_len), + "/", 1), + filename, filename_len); #else - memcpy (pglob->gl_pathv[pglob->gl_pathc], dir, dir_len); - pglob->gl_pathv[pglob->gl_pathc][dir_len] = '/'; - memcpy (&pglob->gl_pathv[pglob->gl_pathc][dir_len + 1], - filename, filename_len); + memcpy (pglob->gl_pathv[pglob->gl_pathc], dir, dir_len); + pglob->gl_pathv[pglob->gl_pathc][dir_len] = '/'; + memcpy (&pglob->gl_pathv[pglob->gl_pathc][dir_len + 1], + filename, filename_len); #endif - ++pglob->gl_pathc; - } + ++pglob->gl_pathc; + } - pglob->gl_pathv[pglob->gl_pathc] = NULL; - pglob->gl_flags = flags; + pglob->gl_pathv[pglob->gl_pathc] = NULL; + pglob->gl_flags = flags; - /* Now we know how large the gl_pathv vector must be. */ - new_pathv = (char **) realloc (pglob->gl_pathv, - ((pglob->gl_pathc + 1) - * sizeof (char *))); - if (new_pathv != NULL) - pglob->gl_pathv = new_pathv; - } - else - return GLOB_NOMATCH; - } + /* Now we know how large the gl_pathv vector must be. */ + new_pathv = (char **) realloc (pglob->gl_pathv, + ((pglob->gl_pathc + 1) + * sizeof (char *))); + if (new_pathv != NULL) + pglob->gl_pathv = new_pathv; + } + else + return GLOB_NOMATCH; + } globfree (&dirs); } @@ -966,24 +966,24 @@ glob (pattern, flags, errfunc, pglob) { status = glob_in_dir (filename, dirname, flags, errfunc, pglob); if (status != 0) - return status; + return status; if (dirlen > 0) - { - /* Stick the directory on the front of each name. */ - int ignore = oldcount; + { + /* Stick the directory on the front of each name. */ + int ignore = oldcount; - if ((flags & GLOB_DOOFFS) && ignore < pglob->gl_offs) - ignore = pglob->gl_offs; + if ((flags & GLOB_DOOFFS) && ignore < pglob->gl_offs) + ignore = pglob->gl_offs; - if (prefix_array (dirname, - &pglob->gl_pathv[ignore], - pglob->gl_pathc - ignore)) - { - globfree (pglob); - return GLOB_NOSPACE; - } - } + if (prefix_array (dirname, + &pglob->gl_pathv[ignore], + pglob->gl_pathc - ignore)) + { + globfree (pglob); + return GLOB_NOSPACE; + } + } } if (flags & GLOB_MARK) @@ -992,21 +992,21 @@ glob (pattern, flags, errfunc, pglob) int i; struct stat st; for (i = oldcount; i < pglob->gl_pathc; ++i) - if (((flags & GLOB_ALTDIRFUNC) - ? (*pglob->gl_stat) (pglob->gl_pathv[i], &st) - : __stat (pglob->gl_pathv[i], &st)) == 0 - && S_ISDIR (st.st_mode)) - { - size_t len = strlen (pglob->gl_pathv[i]) + 2; - char *new = realloc (pglob->gl_pathv[i], len); - if (new == NULL) - { - globfree (pglob); - return GLOB_NOSPACE; - } - strcpy (&new[len - 2], "/"); - pglob->gl_pathv[i] = new; - } + if (((flags & GLOB_ALTDIRFUNC) + ? (*pglob->gl_stat) (pglob->gl_pathv[i], &st) + : __stat (pglob->gl_pathv[i], &st)) == 0 + && S_ISDIR (st.st_mode)) + { + size_t len = strlen (pglob->gl_pathv[i]) + 2; + char *new = realloc (pglob->gl_pathv[i], len); + if (new == NULL) + { + globfree (pglob); + return GLOB_NOSPACE; + } + strcpy (&new[len - 2], "/"); + pglob->gl_pathv[i] = new; + } } if (!(flags & GLOB_NOSORT)) @@ -1015,11 +1015,11 @@ glob (pattern, flags, errfunc, pglob) int non_sort = oldcount; if ((flags & GLOB_DOOFFS) && pglob->gl_offs > oldcount) - non_sort = pglob->gl_offs; + non_sort = pglob->gl_offs; qsort ((__ptr_t) &pglob->gl_pathv[non_sort], - pglob->gl_pathc - non_sort, - sizeof (char *), collated_compare); + pglob->gl_pathc - non_sort, + sizeof (char *), collated_compare); } return 0; @@ -1035,8 +1035,8 @@ globfree (pglob) { register int i; for (i = 0; i < pglob->gl_pathc; ++i) - if (pglob->gl_pathv[i] != NULL) - free ((__ptr_t) pglob->gl_pathv[i]); + if (pglob->gl_pathv[i] != NULL) + free ((__ptr_t) pglob->gl_pathv[i]); free ((__ptr_t) pglob->gl_pathv); } } @@ -1088,14 +1088,14 @@ prefix_array (dirname, array, n) else if (dirlen > 1) { if (dirname[dirlen - 1] == '/') - /* DIRNAME is "d:/". Don't prepend the slash from DIRNAME. */ - --dirlen; + /* DIRNAME is "d:/". Don't prepend the slash from DIRNAME. */ + --dirlen; else if (dirname[dirlen - 1] == ':') - { - /* DIRNAME is "d:". Use `:' instead of `/'. */ - --dirlen; - sep_char = ':'; - } + { + /* DIRNAME is "d:". Use `:' instead of `/'. */ + --dirlen; + sep_char = ':'; + } } #endif @@ -1104,17 +1104,17 @@ prefix_array (dirname, array, n) size_t eltlen = strlen (array[i]) + 1; char *new = (char *) malloc (dirlen + 1 + eltlen); if (new == NULL) - { - while (i > 0) - free ((__ptr_t) array[--i]); - return 1; - } + { + while (i > 0) + free ((__ptr_t) array[--i]); + return 1; + } #ifdef HAVE_MEMPCPY { - char *endp = (char *) mempcpy (new, dirname, dirlen); - *endp++ = DIRSEP_CHAR; - mempcpy (endp, array[i], eltlen); + char *endp = (char *) mempcpy (new, dirname, dirlen); + *endp++ = DIRSEP_CHAR; + mempcpy (endp, array[i], eltlen); } #else memcpy (new, dirname, dirlen); @@ -1146,21 +1146,21 @@ __glob_pattern_p (pattern, quote) { case '?': case '*': - return 1; + return 1; case '\\': - if (quote && p[1] != '\0') - ++p; - break; + if (quote && p[1] != '\0') + ++p; + break; case '[': - open = 1; - break; + open = 1; + break; case ']': - if (open) - return 1; - break; + if (open) + return 1; + break; } return 0; @@ -1199,121 +1199,121 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) if (meta == 0) { if (flags & (GLOB_NOCHECK|GLOB_NOMAGIC)) - /* We need not do any tests. The PATTERN contains no meta - characters and we must not return an error therefore the - result will always contain exactly one name. */ - flags |= GLOB_NOCHECK; + /* We need not do any tests. The PATTERN contains no meta + characters and we must not return an error therefore the + result will always contain exactly one name. */ + flags |= GLOB_NOCHECK; else - { - /* Since we use the normal file functions we can also use stat() - to verify the file is there. */ - struct stat st; - size_t patlen = strlen (pattern); - size_t dirlen = strlen (directory); - char *fullname = (char *) __alloca (dirlen + 1 + patlen + 1); + { + /* Since we use the normal file functions we can also use stat() + to verify the file is there. */ + struct stat st; + size_t patlen = strlen (pattern); + size_t dirlen = strlen (directory); + char *fullname = (char *) __alloca (dirlen + 1 + patlen + 1); # ifdef HAVE_MEMPCPY - mempcpy (mempcpy (mempcpy (fullname, directory, dirlen), - "/", 1), - pattern, patlen + 1); + mempcpy (mempcpy (mempcpy (fullname, directory, dirlen), + "/", 1), + pattern, patlen + 1); # else - memcpy (fullname, directory, dirlen); - fullname[dirlen] = '/'; - memcpy (&fullname[dirlen + 1], pattern, patlen + 1); + memcpy (fullname, directory, dirlen); + fullname[dirlen] = '/'; + memcpy (&fullname[dirlen + 1], pattern, patlen + 1); # endif - if (((flags & GLOB_ALTDIRFUNC) - ? (*pglob->gl_stat) (fullname, &st) - : __stat (fullname, &st)) == 0) - /* We found this file to be existing. Now tell the rest - of the function to copy this name into the result. */ - flags |= GLOB_NOCHECK; - } + if (((flags & GLOB_ALTDIRFUNC) + ? (*pglob->gl_stat) (fullname, &st) + : __stat (fullname, &st)) == 0) + /* We found this file to be existing. Now tell the rest + of the function to copy this name into the result. */ + flags |= GLOB_NOCHECK; + } nfound = 0; } else { if (pattern[0] == '\0') - { - /* This is a special case for matching directories like in - "*a/". */ - names = (struct globlink *) __alloca (sizeof (struct globlink)); - names->name = (char *) malloc (1); - if (names->name == NULL) - goto memory_error; - names->name[0] = '\0'; - names->next = NULL; - nfound = 1; - meta = 0; - } + { + /* This is a special case for matching directories like in + "*a/". */ + names = (struct globlink *) __alloca (sizeof (struct globlink)); + names->name = (char *) malloc (1); + if (names->name == NULL) + goto memory_error; + names->name[0] = '\0'; + names->next = NULL; + nfound = 1; + meta = 0; + } else - { - stream = ((flags & GLOB_ALTDIRFUNC) - ? (*pglob->gl_opendir) (directory) - : (__ptr_t) opendir (directory)); - if (stream == NULL) - { - if ((errfunc != NULL && (*errfunc) (directory, errno)) - || (flags & GLOB_ERR)) - return GLOB_ABORTED; - nfound = 0; - meta = 0; - } - else - { - int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) - | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0) + { + stream = ((flags & GLOB_ALTDIRFUNC) + ? (*pglob->gl_opendir) (directory) + : (__ptr_t) opendir (directory)); + if (stream == NULL) + { + if ((errfunc != NULL && (*errfunc) (directory, errno)) + || (flags & GLOB_ERR)) + return GLOB_ABORTED; + nfound = 0; + meta = 0; + } + else + { + int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) + | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0) #if defined _AMIGA || defined VMS - | FNM_CASEFOLD + | FNM_CASEFOLD #endif - ); - nfound = 0; - flags |= GLOB_MAGCHAR; + ); + nfound = 0; + flags |= GLOB_MAGCHAR; - while (1) - { - const char *name; - size_t len; - struct dirent *d = ((flags & GLOB_ALTDIRFUNC) - ? (*pglob->gl_readdir) (stream) - : readdir ((DIR *) stream)); - if (d == NULL) - break; - if (! REAL_DIR_ENTRY (d)) - continue; + while (1) + { + const char *name; + size_t len; + struct dirent *d = ((flags & GLOB_ALTDIRFUNC) + ? (*pglob->gl_readdir) (stream) + : readdir ((DIR *) stream)); + if (d == NULL) + break; + if (! REAL_DIR_ENTRY (d)) + continue; #ifdef HAVE_D_TYPE - /* If we shall match only directories use the information - provided by the dirent call if possible. */ - if ((flags & GLOB_ONLYDIR) - && d->d_type != DT_UNKNOWN && d->d_type != DT_DIR) - continue; + /* If we shall match only directories use the information + provided by the dirent call if possible. */ + if ((flags & GLOB_ONLYDIR) + && d->d_type != DT_UNKNOWN && d->d_type != DT_DIR) + continue; #endif - name = d->d_name; + name = d->d_name; - if (fnmatch (pattern, name, fnm_flags) == 0) - { - struct globlink *new = (struct globlink *) - __alloca (sizeof (struct globlink)); - len = NAMLEN (d); - new->name = (char *) malloc (len + 1); - if (new->name == NULL) - goto memory_error; + if (fnmatch (pattern, name, fnm_flags) == 0) + { + struct globlink *new = (struct globlink *) + __alloca (sizeof (struct globlink)); + len = NAMLEN (d); + new->name = (char *) malloc (len + 1); + if (new->name == NULL) + goto memory_error; #ifdef HAVE_MEMPCPY - *((char *) mempcpy ((__ptr_t) new->name, name, len)) - = '\0'; + *((char *) mempcpy ((__ptr_t) new->name, name, len)) + = '\0'; #else - memcpy ((__ptr_t) new->name, name, len); - new->name[len] = '\0'; + memcpy ((__ptr_t) new->name, name, len); + new->name[len] = '\0'; #endif - new->next = names; - names = new; - ++nfound; - } - } - } - } + new->next = names; + names = new; + ++nfound; + } + } + } + } } if (nfound == 0 && (flags & GLOB_NOCHECK)) @@ -1324,7 +1324,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) names->next = NULL; names->name = (char *) malloc (len + 1); if (names->name == NULL) - goto memory_error; + goto memory_error; #ifdef HAVE_MEMPCPY *((char *) mempcpy (names->name, pattern, len)) = '\0'; #else @@ -1336,20 +1336,20 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) if (nfound != 0) { pglob->gl_pathv - = (char **) realloc (pglob->gl_pathv, - (pglob->gl_pathc + - ((flags & GLOB_DOOFFS) ? pglob->gl_offs : 0) + - nfound + 1) * - sizeof (char *)); + = (char **) realloc (pglob->gl_pathv, + (pglob->gl_pathc + + ((flags & GLOB_DOOFFS) ? pglob->gl_offs : 0) + + nfound + 1) * + sizeof (char *)); if (pglob->gl_pathv == NULL) - goto memory_error; + goto memory_error; if (flags & GLOB_DOOFFS) - while (pglob->gl_pathc < pglob->gl_offs) - pglob->gl_pathv[pglob->gl_pathc++] = NULL; + while (pglob->gl_pathc < pglob->gl_offs) + pglob->gl_pathv[pglob->gl_pathc++] = NULL; for (; names != NULL; names = names->next) - pglob->gl_pathv[pglob->gl_pathc++] = names->name; + pglob->gl_pathv[pglob->gl_pathc++] = names->name; pglob->gl_pathv[pglob->gl_pathc] = NULL; pglob->gl_flags = flags; @@ -1359,9 +1359,9 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) if (stream != NULL) { if (flags & GLOB_ALTDIRFUNC) - (*pglob->gl_closedir) (stream); + (*pglob->gl_closedir) (stream); else - closedir ((DIR *) stream); + closedir ((DIR *) stream); } __set_errno (save); @@ -1379,10 +1379,10 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) while (names != NULL) { if (names->name != NULL) - free ((__ptr_t) names->name); + free ((__ptr_t) names->name); names = names->next; } return GLOB_NOSPACE; } -#endif /* Not ELIDE_CODE. */ +#endif /* Not ELIDE_CODE. */ diff --git a/goldlib/glibc/glob.h b/goldlib/glibc/glob.h index ac7bc82..48e8d8c 100644 --- a/goldlib/glibc/glob.h +++ b/goldlib/glibc/glob.h @@ -15,34 +15,34 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _GLOB_H -#define _GLOB_H 1 +#ifndef _GLOB_H +#define _GLOB_H 1 -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif -#undef __ptr_t +#undef __ptr_t #if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32 || defined _WIN32 # if !defined __GLIBC__ || !defined __P # undef __P # undef __PMT -# define __P(protos) protos -# define __PMT(protos) protos +# define __P(protos) protos +# define __PMT(protos) protos # if !defined __GNUC__ || __GNUC__ < 2 # undef __const # define __const const # endif # endif -# define __ptr_t void * +# define __ptr_t void * #else /* Not C++ or ANSI C. */ -# undef __P +# undef __P # undef __PMT -# define __P(protos) () -# define __PMT(protos) () -# undef __const +# define __P(protos) () +# define __PMT(protos) () +# undef __const # define __const -# define __ptr_t char * +# define __ptr_t char * #endif /* C++ or ANSI C. */ /* We need `size_t' for the following definitions. */ @@ -61,40 +61,40 @@ typedef unsigned long int __size_t; #endif /* Bits set in the FLAGS argument to `glob'. */ -#define GLOB_ERR (1 << 0)/* Return on read errors. */ -#define GLOB_MARK (1 << 1)/* Append a slash to each name. */ -#define GLOB_NOSORT (1 << 2)/* Don't sort the names. */ -#define GLOB_DOOFFS (1 << 3)/* Insert PGLOB->gl_offs NULLs. */ -#define GLOB_NOCHECK (1 << 4)/* If nothing matches, return the pattern. */ -#define GLOB_APPEND (1 << 5)/* Append to results of a previous call. */ -#define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */ -#define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */ +#define GLOB_ERR (1 << 0)/* Return on read errors. */ +#define GLOB_MARK (1 << 1)/* Append a slash to each name. */ +#define GLOB_NOSORT (1 << 2)/* Don't sort the names. */ +#define GLOB_DOOFFS (1 << 3)/* Insert PGLOB->gl_offs NULLs. */ +#define GLOB_NOCHECK (1 << 4)/* If nothing matches, return the pattern. */ +#define GLOB_APPEND (1 << 5)/* Append to results of a previous call. */ +#define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */ +#define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */ #if (!defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _BSD_SOURCE \ || defined _GNU_SOURCE) -# define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ +# define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ # define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */ -# define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */ -# define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */ -# define GLOB_TILDE (1 << 12)/* Expand ~user and ~ to home directories. */ -# define GLOB_ONLYDIR (1 << 13)/* Match only directories. */ +# define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */ +# define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */ +# define GLOB_TILDE (1 << 12)/* Expand ~user and ~ to home directories. */ +# define GLOB_ONLYDIR (1 << 13)/* Match only directories. */ # define GLOB_TILDE_CHECK (1 << 14)/* Like GLOB_TILDE but return an error - if the user name is not available. */ -# define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ - GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ - GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \ - GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK) + if the user name is not available. */ +# define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ + GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ + GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \ + GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK) #else -# define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ - GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ - GLOB_PERIOD) +# define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ + GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ + GLOB_PERIOD) #endif /* Error returns from `glob'. */ -#define GLOB_NOSPACE 1 /* Ran out of memory. */ -#define GLOB_ABORTED 2 /* Read error. */ -#define GLOB_NOMATCH 3 /* No matches found. */ -#define GLOB_NOSYS 4 /* Not implemented. */ +#define GLOB_NOSPACE 1 /* Ran out of memory. */ +#define GLOB_ABORTED 2 /* Read error. */ +#define GLOB_NOMATCH 3 /* No matches found. */ +#define GLOB_NOSYS 4 /* Not implemented. */ #ifdef _GNU_SOURCE /* Previous versions of this file defined GLOB_ABEND instead of GLOB_ABORTED. Provide a compatibility definition here. */ @@ -107,10 +107,10 @@ struct stat; #endif typedef struct { - __size_t gl_pathc; /* Count of paths matched by the pattern. */ - char **gl_pathv; /* List of matched pathnames. */ - __size_t gl_offs; /* Slots to reserve in `gl_pathv'. */ - int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ + __size_t gl_pathc; /* Count of paths matched by the pattern. */ + char **gl_pathv; /* List of matched pathnames. */ + __size_t gl_offs; /* Slots to reserve in `gl_pathv'. */ + int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ /* If the GLOB_ALTDIRFUNC flag is set, the following functions are used instead of the normal file access functions. */ @@ -150,16 +150,16 @@ typedef struct Otherwise, `glob' returns zero. */ #if _FILE_OFFSET_BITS != 64 extern int glob __P ((__const char *__pattern, int __flags, - int (*__errfunc) (__const char *, int), - glob_t *__pglob)); + int (*__errfunc) (__const char *, int), + glob_t *__pglob)); /* Free storage allocated in PGLOB by a previous `glob' call. */ extern void globfree __P ((glob_t *__pglob)); #else # if __GNUC__ >= 2 extern int glob __P ((__const char *__pattern, int __flags, - int (*__errfunc) (__const char *, int), - glob_t *__pglob)) __asm__ ("glob64"); + int (*__errfunc) (__const char *, int), + glob_t *__pglob)) __asm__ ("glob64"); extern void globfree __P ((glob_t *__pglob)) __asm__ ("globfree64"); # else @@ -170,8 +170,8 @@ extern void globfree __P ((glob_t *__pglob)) __asm__ ("globfree64"); #ifdef _LARGEFILE64_SOURCE extern int glob64 __P ((__const char *__pattern, int __flags, - int (*__errfunc) (__const char *, int), - glob64_t *__pglob)); + int (*__errfunc) (__const char *, int), + glob64_t *__pglob)); extern void globfree64 __P ((glob64_t *__pglob)); #endif @@ -187,7 +187,7 @@ extern int __glob_pattern_p __P ((__const char *__pattern, int __quote)); extern int glob_pattern_p __P ((__const char *__pattern, int __quote)); #endif -#ifdef __cplusplus +#ifdef __cplusplus } #endif diff --git a/goldlib/glibc/regex.c b/goldlib/glibc/regex.c index 59383e1..d4fd2f0 100644 --- a/goldlib/glibc/regex.c +++ b/goldlib/glibc/regex.c @@ -24,7 +24,7 @@ #pragma alloca #endif -#undef _GNU_SOURCE +#undef _GNU_SOURCE #define _GNU_SOURCE #ifdef HAVE_CONFIG_H @@ -62,20 +62,20 @@ # define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef) # define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags) # define regerror(errcode, preg, errbuf, errbuf_size) \ - __regerror(errcode, preg, errbuf, errbuf_size) + __regerror(errcode, preg, errbuf, errbuf_size) # define re_set_registers(bu, re, nu, st, en) \ - __re_set_registers (bu, re, nu, st, en) + __re_set_registers (bu, re, nu, st, en) # define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \ - __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) + __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) # define re_match(bufp, string, size, pos, regs) \ - __re_match (bufp, string, size, pos, regs) + __re_match (bufp, string, size, pos, regs) # define re_search(bufp, string, size, startpos, range, regs) \ - __re_search (bufp, string, size, startpos, range, regs) + __re_search (bufp, string, size, startpos, range, regs) # define re_compile_pattern(pattern, length, bufp) \ - __re_compile_pattern (pattern, length, bufp) + __re_compile_pattern (pattern, length, bufp) # define re_set_syntax(syntax) __re_set_syntax (syntax) # define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \ - __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop) + __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop) # define re_compile_fastmap(bufp) __re_compile_fastmap (bufp) #define btowc __btowc @@ -134,18 +134,18 @@ char *realloc (); # include # ifndef bzero # ifndef _LIBC -# define bzero(s, n) (memset (s, '\0', n), (s)) +# define bzero(s, n) (memset (s, '\0', n), (s)) # else -# define bzero(s, n) __bzero (s, n) +# define bzero(s, n) __bzero (s, n) # endif # endif # else # include # ifndef memcmp -# define memcmp(s1, s2, n) bcmp (s1, s2, n) +# define memcmp(s1, s2, n) bcmp (s1, s2, n) # endif # ifndef memcpy -# define memcpy(d, s, n) (bcopy (s, d, n), (d)) +# define memcpy(d, s, n) (bcopy (s, d, n), (d)) # endif # endif # endif @@ -308,8 +308,8 @@ init_syntax_once () # define REGEX_ALLOCATE alloca /* Assumes a `char *destination' variable. */ -# define REGEX_REALLOCATE(source, osize, nsize) \ - (destination = (char *) alloca (nsize), \ +# define REGEX_REALLOCATE(source, osize, nsize) \ + (destination = (char *) alloca (nsize), \ memcpy (destination, source, osize)) /* No need to do anything to free, after alloca. */ @@ -321,11 +321,11 @@ init_syntax_once () #if defined REL_ALLOC && defined REGEX_MALLOC -# define REGEX_ALLOCATE_STACK(size) \ +# define REGEX_ALLOCATE_STACK(size) \ r_alloc (&failure_stack_ptr, (size)) -# define REGEX_REALLOCATE_STACK(source, osize, nsize) \ +# define REGEX_REALLOCATE_STACK(source, osize, nsize) \ r_re_alloc (&failure_stack_ptr, (nsize)) -# define REGEX_FREE_STACK(ptr) \ +# define REGEX_FREE_STACK(ptr) \ r_alloc_free (&failure_stack_ptr) #else /* not using relocating allocator */ @@ -340,7 +340,7 @@ init_syntax_once () # define REGEX_ALLOCATE_STACK alloca -# define REGEX_REALLOCATE_STACK(source, osize, nsize) \ +# define REGEX_REALLOCATE_STACK(source, osize, nsize) \ REGEX_REALLOCATE (source, osize, nsize) /* No need to explicitly free anything. */ # define REGEX_FREE_STACK(arg) @@ -352,7 +352,7 @@ init_syntax_once () /* True if `size1' is non-NULL and PTR is pointing anywhere inside `string1' or just past its end. This works if PTR is NULL, which is a good thing. */ -#define FIRST_STRING_P(ptr) \ +#define FIRST_STRING_P(ptr) \ (size1 && string1 <= (ptr) && (ptr) <= string1 + size1) /* (Re)Allocate N items of type T using malloc, or fail. */ @@ -376,11 +376,11 @@ typedef char boolean; #define true 1 static int re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp, - const char *string1, int size1, - const char *string2, int size2, - int pos, - struct re_registers *regs, - int stop)); + const char *string1, int size1, + const char *string2, int size2, + int pos, + struct re_registers *regs, + int stop)); /* These are the command codes that appear in compiled regular expressions. Some opcodes are followed by argument bytes. A @@ -450,7 +450,7 @@ typedef enum /* Followed by two byte relative address to which to jump. */ jump, - /* Same as jump, but marks the end of an alternative. */ + /* Same as jump, but marks the end of an alternative. */ jump_past_alt, /* Followed by two-byte relative address of place to resume at @@ -481,8 +481,8 @@ typedef enum of jump when compiling an alternative. */ dummy_failure_jump, - /* Push a dummy failure point and continue. Used at the end of - alternatives. */ + /* Push a dummy failure point and continue. Used at the end of + alternatives. */ push_dummy_failure, /* Followed by two-byte relative address and two-byte number n. @@ -498,25 +498,25 @@ typedef enum bytes of number. */ set_number_at, - wordchar, /* Matches any word-constituent character. */ - notwordchar, /* Matches any char that is not a word-constituent. */ + wordchar, /* Matches any word-constituent character. */ + notwordchar, /* Matches any char that is not a word-constituent. */ - wordbeg, /* Succeeds if at word beginning. */ - wordend, /* Succeeds if at word end. */ + wordbeg, /* Succeeds if at word beginning. */ + wordend, /* Succeeds if at word end. */ - wordbound, /* Succeeds if at a word boundary. */ - notwordbound /* Succeeds if not at a word boundary. */ + wordbound, /* Succeeds if at a word boundary. */ + notwordbound /* Succeeds if not at a word boundary. */ #ifdef emacs - ,before_dot, /* Succeeds if before point. */ - at_dot, /* Succeeds if at point. */ - after_dot, /* Succeeds if after point. */ + ,before_dot, /* Succeeds if before point. */ + at_dot, /* Succeeds if at point. */ + after_dot, /* Succeeds if after point. */ - /* Matches any character whose syntax is specified. Followed by + /* Matches any character whose syntax is specified. Followed by a byte which contains a syntax code, e.g., Sword. */ syntaxspec, - /* Matches any character whose syntax is not that specified. */ + /* Matches any character whose syntax is not that specified. */ notsyntaxspec #endif /* emacs */ } re_opcode_t; @@ -525,29 +525,29 @@ typedef enum /* Store NUMBER in two contiguous bytes starting at DESTINATION. */ -#define STORE_NUMBER(destination, number) \ - do { \ - (destination)[0] = (number) & 0377; \ - (destination)[1] = (number) >> 8; \ +#define STORE_NUMBER(destination, number) \ + do { \ + (destination)[0] = (number) & 0377; \ + (destination)[1] = (number) >> 8; \ } while (0) /* Same as STORE_NUMBER, except increment DESTINATION to the byte after where the number is stored. Therefore, DESTINATION must be an lvalue. */ -#define STORE_NUMBER_AND_INCR(destination, number) \ - do { \ - STORE_NUMBER (destination, number); \ - (destination) += 2; \ +#define STORE_NUMBER_AND_INCR(destination, number) \ + do { \ + STORE_NUMBER (destination, number); \ + (destination) += 2; \ } while (0) /* Put into DESTINATION a number stored in two contiguous bytes starting at SOURCE. */ -#define EXTRACT_NUMBER(destination, source) \ - do { \ - (destination) = *(source) & 0377; \ - (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \ +#define EXTRACT_NUMBER(destination, source) \ + do { \ + (destination) = *(source) & 0377; \ + (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \ } while (0) #ifdef DEBUG @@ -572,15 +572,15 @@ extract_number (dest, source) /* Same as EXTRACT_NUMBER, except increment SOURCE to after the number. SOURCE must be an lvalue. */ -#define EXTRACT_NUMBER_AND_INCR(destination, source) \ - do { \ - EXTRACT_NUMBER (destination, source); \ - (source) += 2; \ +#define EXTRACT_NUMBER_AND_INCR(destination, source) \ + do { \ + EXTRACT_NUMBER (destination, source); \ + (source) += 2; \ } while (0) #ifdef DEBUG static void extract_number_and_incr _RE_ARGS ((int *destination, - unsigned char **source)); + unsigned char **source)); static void extract_number_and_incr (destination, source) int *destination; @@ -619,9 +619,9 @@ static int debug = 0; # define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2) # define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3) # define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4) -# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \ +# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \ if (debug) print_partial_compiled_pattern (s, e) -# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \ +# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \ if (debug) print_double_string (w, s1, sz1, s2, sz2) @@ -637,15 +637,15 @@ print_fastmap (fastmap) while (i < (1 << BYTEWIDTH)) { if (fastmap[i++]) - { - was_a_range = 0; + { + was_a_range = 0; putchar (i - 1); while (i < (1 << BYTEWIDTH) && fastmap[i]) { was_a_range = 1; i++; } - if (was_a_range) + if (was_a_range) { printf ("-"); putchar (i - 1); @@ -681,211 +681,211 @@ print_partial_compiled_pattern (start, end) printf ("%d:\t", p - start); switch ((re_opcode_t) *p++) - { + { case no_op: printf ("/no_op"); break; - case exactn: - mcnt = *p++; + case exactn: + mcnt = *p++; printf ("/exactn/%d", mcnt); do - { + { putchar ('/'); - putchar (*p++); + putchar (*p++); } while (--mcnt); break; - case start_memory: + case start_memory: mcnt = *p++; printf ("/start_memory/%d/%d", mcnt, *p++); break; - case stop_memory: + case stop_memory: mcnt = *p++; - printf ("/stop_memory/%d/%d", mcnt, *p++); + printf ("/stop_memory/%d/%d", mcnt, *p++); break; - case duplicate: - printf ("/duplicate/%d", *p++); - break; + case duplicate: + printf ("/duplicate/%d", *p++); + break; - case anychar: - printf ("/anychar"); - break; + case anychar: + printf ("/anychar"); + break; - case charset: + case charset: case charset_not: { register int c, last = -100; - register int in_range = 0; + register int in_range = 0; - printf ("/charset [%s", - (re_opcode_t) *(p - 1) == charset_not ? "^" : ""); + printf ("/charset [%s", + (re_opcode_t) *(p - 1) == charset_not ? "^" : ""); assert (p + *p < pend); for (c = 0; c < 256; c++) - if (c / 8 < *p - && (p[1 + (c/8)] & (1 << (c % 8)))) - { - /* Are we starting a range? */ - if (last + 1 == c && ! in_range) - { - putchar ('-'); - in_range = 1; - } - /* Have we broken a range? */ - else if (last + 1 != c && in_range) + if (c / 8 < *p + && (p[1 + (c/8)] & (1 << (c % 8)))) + { + /* Are we starting a range? */ + if (last + 1 == c && ! in_range) + { + putchar ('-'); + in_range = 1; + } + /* Have we broken a range? */ + else if (last + 1 != c && in_range) { - putchar (last); - in_range = 0; - } + putchar (last); + in_range = 0; + } - if (! in_range) - putchar (c); + if (! in_range) + putchar (c); - last = c; + last = c; } - if (in_range) - putchar (last); + if (in_range) + putchar (last); - putchar (']'); + putchar (']'); - p += 1 + *p; - } - break; + p += 1 + *p; + } + break; - case begline: - printf ("/begline"); + case begline: + printf ("/begline"); break; - case endline: + case endline: printf ("/endline"); break; - case on_failure_jump: + case on_failure_jump: extract_number_and_incr (&mcnt, &p); - printf ("/on_failure_jump to %d", p + mcnt - start); + printf ("/on_failure_jump to %d", p + mcnt - start); break; - case on_failure_keep_string_jump: + case on_failure_keep_string_jump: extract_number_and_incr (&mcnt, &p); - printf ("/on_failure_keep_string_jump to %d", p + mcnt - start); + printf ("/on_failure_keep_string_jump to %d", p + mcnt - start); break; - case dummy_failure_jump: + case dummy_failure_jump: extract_number_and_incr (&mcnt, &p); - printf ("/dummy_failure_jump to %d", p + mcnt - start); + printf ("/dummy_failure_jump to %d", p + mcnt - start); break; - case push_dummy_failure: + case push_dummy_failure: printf ("/push_dummy_failure"); break; case maybe_pop_jump: extract_number_and_incr (&mcnt, &p); - printf ("/maybe_pop_jump to %d", p + mcnt - start); - break; + printf ("/maybe_pop_jump to %d", p + mcnt - start); + break; case pop_failure_jump: - extract_number_and_incr (&mcnt, &p); - printf ("/pop_failure_jump to %d", p + mcnt - start); - break; + extract_number_and_incr (&mcnt, &p); + printf ("/pop_failure_jump to %d", p + mcnt - start); + break; case jump_past_alt: - extract_number_and_incr (&mcnt, &p); - printf ("/jump_past_alt to %d", p + mcnt - start); - break; + extract_number_and_incr (&mcnt, &p); + printf ("/jump_past_alt to %d", p + mcnt - start); + break; case jump: - extract_number_and_incr (&mcnt, &p); - printf ("/jump to %d", p + mcnt - start); - break; + extract_number_and_incr (&mcnt, &p); + printf ("/jump to %d", p + mcnt - start); + break; case succeed_n: extract_number_and_incr (&mcnt, &p); - p1 = p + mcnt; + p1 = p + mcnt; extract_number_and_incr (&mcnt2, &p); - printf ("/succeed_n to %d, %d times", p1 - start, mcnt2); + printf ("/succeed_n to %d, %d times", p1 - start, mcnt2); break; case jump_n: extract_number_and_incr (&mcnt, &p); - p1 = p + mcnt; + p1 = p + mcnt; extract_number_and_incr (&mcnt2, &p); - printf ("/jump_n to %d, %d times", p1 - start, mcnt2); + printf ("/jump_n to %d, %d times", p1 - start, mcnt2); break; case set_number_at: extract_number_and_incr (&mcnt, &p); - p1 = p + mcnt; + p1 = p + mcnt; extract_number_and_incr (&mcnt2, &p); - printf ("/set_number_at location %d to %d", p1 - start, mcnt2); + printf ("/set_number_at location %d to %d", p1 - start, mcnt2); break; case wordbound: - printf ("/wordbound"); - break; + printf ("/wordbound"); + break; - case notwordbound: - printf ("/notwordbound"); + case notwordbound: + printf ("/notwordbound"); break; - case wordbeg: - printf ("/wordbeg"); - break; + case wordbeg: + printf ("/wordbeg"); + break; - case wordend: - printf ("/wordend"); + case wordend: + printf ("/wordend"); # ifdef emacs - case before_dot: - printf ("/before_dot"); + case before_dot: + printf ("/before_dot"); break; - case at_dot: - printf ("/at_dot"); + case at_dot: + printf ("/at_dot"); break; - case after_dot: - printf ("/after_dot"); + case after_dot: + printf ("/after_dot"); break; - case syntaxspec: + case syntaxspec: printf ("/syntaxspec"); - mcnt = *p++; - printf ("/%d", mcnt); + mcnt = *p++; + printf ("/%d", mcnt); break; - case notsyntaxspec: + case notsyntaxspec: printf ("/notsyntaxspec"); - mcnt = *p++; - printf ("/%d", mcnt); - break; + mcnt = *p++; + printf ("/%d", mcnt); + break; # endif /* emacs */ - case wordchar: - printf ("/wordchar"); + case wordchar: + printf ("/wordchar"); break; - case notwordchar: - printf ("/notwordchar"); + case notwordchar: + printf ("/notwordchar"); break; - case begbuf: - printf ("/begbuf"); + case begbuf: + printf ("/begbuf"); break; - case endbuf: - printf ("/endbuf"); + case endbuf: + printf ("/endbuf"); break; default: printf ("?%d", *(p-1)); - } + } putchar ('\n'); } @@ -902,7 +902,7 @@ print_compiled_pattern (bufp) print_partial_compiled_pattern (buffer, buffer + bufp->used); printf ("%ld bytes used/%ld bytes allocated.\n", - bufp->used, bufp->allocated); + bufp->used, bufp->allocated); if (bufp->fastmap_accurate && bufp->fastmap) { @@ -1012,18 +1012,18 @@ weak_alias (__re_set_syntax, re_set_syntax) static const char *re_error_msgid[] = { - gettext_noop ("Success"), /* REG_NOERROR */ - gettext_noop ("No match"), /* REG_NOMATCH */ + gettext_noop ("Success"), /* REG_NOERROR */ + gettext_noop ("No match"), /* REG_NOMATCH */ gettext_noop ("Invalid regular expression"), /* REG_BADPAT */ gettext_noop ("Invalid collation character"), /* REG_ECOLLATE */ gettext_noop ("Invalid character class name"), /* REG_ECTYPE */ gettext_noop ("Trailing backslash"), /* REG_EESCAPE */ gettext_noop ("Invalid back reference"), /* REG_ESUBREG */ - gettext_noop ("Unmatched [ or [^"), /* REG_EBRACK */ + gettext_noop ("Unmatched [ or [^"), /* REG_EBRACK */ gettext_noop ("Unmatched ( or \\("), /* REG_EPAREN */ gettext_noop ("Unmatched \\{"), /* REG_EBRACE */ gettext_noop ("Invalid content of \\{\\}"), /* REG_BADBR */ - gettext_noop ("Invalid range end"), /* REG_ERANGE */ + gettext_noop ("Invalid range end"), /* REG_ERANGE */ gettext_noop ("Memory exhausted"), /* REG_ESPACE */ gettext_noop ("Invalid preceding regular expression"), /* REG_BADRPT */ gettext_noop ("Premature end of regular expression"), /* REG_EEND */ @@ -1108,7 +1108,7 @@ typedef struct { fail_stack_elt_t *stack; unsigned long int size; - unsigned long int avail; /* Offset of next open position. */ + unsigned long int avail; /* Offset of next open position. */ } fail_stack_type; #else /* not INT_IS_16BIT */ @@ -1133,7 +1133,7 @@ typedef struct { fail_stack_elt_t *stack; unsigned size; - unsigned avail; /* Offset of next open position. */ + unsigned avail; /* Offset of next open position. */ } fail_stack_type; #endif /* INT_IS_16BIT */ @@ -1147,23 +1147,23 @@ typedef struct Do `return -2' if the alloc fails. */ #ifdef MATCH_MAY_ALLOCATE -# define INIT_FAIL_STACK() \ - do { \ - fail_stack.stack = (fail_stack_elt_t *) \ +# define INIT_FAIL_STACK() \ + do { \ + fail_stack.stack = (fail_stack_elt_t *) \ REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \ - \ - if (fail_stack.stack == NULL) \ - return -2; \ - \ - fail_stack.size = INIT_FAILURE_ALLOC; \ - fail_stack.avail = 0; \ + \ + if (fail_stack.stack == NULL) \ + return -2; \ + \ + fail_stack.size = INIT_FAILURE_ALLOC; \ + fail_stack.avail = 0; \ } while (0) # define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack) #else -# define INIT_FAIL_STACK() \ - do { \ - fail_stack.avail = 0; \ +# define INIT_FAIL_STACK() \ + do { \ + fail_stack.avail = 0; \ } while (0) # define RESET_FAIL_STACK() @@ -1177,46 +1177,46 @@ typedef struct REGEX_REALLOCATE_STACK requires `destination' be declared. */ -#define DOUBLE_FAIL_STACK(fail_stack) \ - ((fail_stack).size > (unsigned) (re_max_failures * MAX_FAILURE_ITEMS) \ - ? 0 \ - : ((fail_stack).stack = (fail_stack_elt_t *) \ - REGEX_REALLOCATE_STACK ((fail_stack).stack, \ - (fail_stack).size * sizeof (fail_stack_elt_t), \ - ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \ - \ - (fail_stack).stack == NULL \ - ? 0 \ - : ((fail_stack).size <<= 1, \ +#define DOUBLE_FAIL_STACK(fail_stack) \ + ((fail_stack).size > (unsigned) (re_max_failures * MAX_FAILURE_ITEMS) \ + ? 0 \ + : ((fail_stack).stack = (fail_stack_elt_t *) \ + REGEX_REALLOCATE_STACK ((fail_stack).stack, \ + (fail_stack).size * sizeof (fail_stack_elt_t), \ + ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \ + \ + (fail_stack).stack == NULL \ + ? 0 \ + : ((fail_stack).size <<= 1, \ 1))) /* Push pointer POINTER on FAIL_STACK. Return 1 if was able to do so and 0 if ran out of memory allocating space to do so. */ -#define PUSH_PATTERN_OP(POINTER, FAIL_STACK) \ - ((FAIL_STACK_FULL () \ - && !DOUBLE_FAIL_STACK (FAIL_STACK)) \ - ? 0 \ - : ((FAIL_STACK).stack[(FAIL_STACK).avail++].pointer = POINTER, \ +#define PUSH_PATTERN_OP(POINTER, FAIL_STACK) \ + ((FAIL_STACK_FULL () \ + && !DOUBLE_FAIL_STACK (FAIL_STACK)) \ + ? 0 \ + : ((FAIL_STACK).stack[(FAIL_STACK).avail++].pointer = POINTER, \ 1)) /* Push a pointer value onto the failure stack. Assumes the variable `fail_stack'. Probably should only be called from within `PUSH_FAILURE_POINT'. */ -#define PUSH_FAILURE_POINTER(item) \ +#define PUSH_FAILURE_POINTER(item) \ fail_stack.stack[fail_stack.avail++].pointer = (unsigned char *) (item) /* This pushes an integer-valued item onto the failure stack. Assumes the variable `fail_stack'. Probably should only be called from within `PUSH_FAILURE_POINT'. */ -#define PUSH_FAILURE_INT(item) \ +#define PUSH_FAILURE_INT(item) \ fail_stack.stack[fail_stack.avail++].integer = (item) /* Push a fail_stack_elt_t value onto the failure stack. Assumes the variable `fail_stack'. Probably should only be called from within `PUSH_FAILURE_POINT'. */ -#define PUSH_FAILURE_ELT(item) \ +#define PUSH_FAILURE_ELT(item) \ fail_stack.stack[fail_stack.avail++] = (item) /* These three POP... operations complement the three PUSH... operations. @@ -1244,83 +1244,83 @@ typedef struct Does `return FAILURE_CODE' if runs out of memory. */ -#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \ - do { \ - char *destination; \ - /* Must be int, so when we don't save any registers, the arithmetic \ - of 0 + -1 isn't done as unsigned. */ \ - /* Can't be int, since there is not a shred of a guarantee that int \ - is wide enough to hold a value of something to which pointer can \ - be assigned */ \ - active_reg_t this_reg; \ - \ - DEBUG_STATEMENT (failure_id++); \ - DEBUG_STATEMENT (nfailure_points_pushed++); \ - DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \ +#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \ + do { \ + char *destination; \ + /* Must be int, so when we don't save any registers, the arithmetic \ + of 0 + -1 isn't done as unsigned. */ \ + /* Can't be int, since there is not a shred of a guarantee that int \ + is wide enough to hold a value of something to which pointer can \ + be assigned */ \ + active_reg_t this_reg; \ + \ + DEBUG_STATEMENT (failure_id++); \ + DEBUG_STATEMENT (nfailure_points_pushed++); \ + DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \ DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\ DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\ - \ - DEBUG_PRINT2 (" slots needed: %ld\n", NUM_FAILURE_ITEMS); \ - DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \ - \ - /* Ensure we have enough space allocated for what we will push. */ \ - while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \ - { \ - if (!DOUBLE_FAIL_STACK (fail_stack)) \ - return failure_code; \ - \ - DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \ - (fail_stack).size); \ + \ + DEBUG_PRINT2 (" slots needed: %ld\n", NUM_FAILURE_ITEMS); \ + DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \ + \ + /* Ensure we have enough space allocated for what we will push. */ \ + while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \ + { \ + if (!DOUBLE_FAIL_STACK (fail_stack)) \ + return failure_code; \ + \ + DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \ + (fail_stack).size); \ DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\ - } \ - \ - /* Push the info, starting with the registers. */ \ - DEBUG_PRINT1 ("\n"); \ - \ - if (1) \ + } \ + \ + /* Push the info, starting with the registers. */ \ + DEBUG_PRINT1 ("\n"); \ + \ + if (1) \ for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \ - this_reg++) \ - { \ - DEBUG_PRINT2 (" Pushing reg: %lu\n", this_reg); \ - DEBUG_STATEMENT (num_regs_pushed++); \ - \ - DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \ - PUSH_FAILURE_POINTER (regstart[this_reg]); \ - \ - DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \ - PUSH_FAILURE_POINTER (regend[this_reg]); \ - \ - DEBUG_PRINT2 (" info: %p\n ", \ - reg_info[this_reg].word.pointer); \ - DEBUG_PRINT2 (" match_null=%d", \ - REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \ - DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \ - DEBUG_PRINT2 (" matched_something=%d", \ - MATCHED_SOMETHING (reg_info[this_reg])); \ - DEBUG_PRINT2 (" ever_matched=%d", \ - EVER_MATCHED_SOMETHING (reg_info[this_reg])); \ - DEBUG_PRINT1 ("\n"); \ - PUSH_FAILURE_ELT (reg_info[this_reg].word); \ - } \ - \ + this_reg++) \ + { \ + DEBUG_PRINT2 (" Pushing reg: %lu\n", this_reg); \ + DEBUG_STATEMENT (num_regs_pushed++); \ + \ + DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \ + PUSH_FAILURE_POINTER (regstart[this_reg]); \ + \ + DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \ + PUSH_FAILURE_POINTER (regend[this_reg]); \ + \ + DEBUG_PRINT2 (" info: %p\n ", \ + reg_info[this_reg].word.pointer); \ + DEBUG_PRINT2 (" match_null=%d", \ + REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \ + DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \ + DEBUG_PRINT2 (" matched_something=%d", \ + MATCHED_SOMETHING (reg_info[this_reg])); \ + DEBUG_PRINT2 (" ever_matched=%d", \ + EVER_MATCHED_SOMETHING (reg_info[this_reg])); \ + DEBUG_PRINT1 ("\n"); \ + PUSH_FAILURE_ELT (reg_info[this_reg].word); \ + } \ + \ DEBUG_PRINT2 (" Pushing low active reg: %ld\n", lowest_active_reg);\ - PUSH_FAILURE_INT (lowest_active_reg); \ - \ + PUSH_FAILURE_INT (lowest_active_reg); \ + \ DEBUG_PRINT2 (" Pushing high active reg: %ld\n", highest_active_reg);\ - PUSH_FAILURE_INT (highest_active_reg); \ - \ - DEBUG_PRINT2 (" Pushing pattern %p:\n", pattern_place); \ - DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \ - PUSH_FAILURE_POINTER (pattern_place); \ - \ - DEBUG_PRINT2 (" Pushing string %p: `", string_place); \ + PUSH_FAILURE_INT (highest_active_reg); \ + \ + DEBUG_PRINT2 (" Pushing pattern %p:\n", pattern_place); \ + DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \ + PUSH_FAILURE_POINTER (pattern_place); \ + \ + DEBUG_PRINT2 (" Pushing string %p: `", string_place); \ DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \ - size2); \ - DEBUG_PRINT1 ("'\n"); \ - PUSH_FAILURE_POINTER (string_place); \ - \ - DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \ - DEBUG_PUSH (failure_id); \ + size2); \ + DEBUG_PRINT1 ("'\n"); \ + PUSH_FAILURE_POINTER (string_place); \ + \ + DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \ + DEBUG_PUSH (failure_id); \ } while (0) /* This is the number of items that are pushed and popped on the stack @@ -1341,10 +1341,10 @@ typedef struct #define MAX_FAILURE_ITEMS (5 * NUM_REG_ITEMS + NUM_NONREG_ITEMS) /* We actually push this many items. */ -#define NUM_FAILURE_ITEMS \ - (((0 \ - ? 0 : highest_active_reg - lowest_active_reg + 1) \ - * NUM_REG_ITEMS) \ +#define NUM_FAILURE_ITEMS \ + (((0 \ + ? 0 : highest_active_reg - lowest_active_reg + 1) \ + * NUM_REG_ITEMS) \ + NUM_NONREG_ITEMS) /* How many items can still be added to the stack without overflowing it. */ @@ -1364,73 +1364,73 @@ typedef struct `pend', `string1', `size1', `string2', and `size2'. */ #define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\ -{ \ - DEBUG_STATEMENT (unsigned failure_id;) \ - active_reg_t this_reg; \ - const unsigned char *string_temp; \ - \ - assert (!FAIL_STACK_EMPTY ()); \ - \ - /* Remove failure points and point to how many regs pushed. */ \ - DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \ - DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \ - DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \ - \ - assert (fail_stack.avail >= NUM_NONREG_ITEMS); \ - \ - DEBUG_POP (&failure_id); \ - DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \ - \ - /* If the saved string location is NULL, it came from an \ - on_failure_keep_string_jump opcode, and we want to throw away the \ - saved NULL, thus retaining our current position in the string. */ \ - string_temp = POP_FAILURE_POINTER (); \ - if (string_temp != NULL) \ - str = (const char *) string_temp; \ - \ - DEBUG_PRINT2 (" Popping string %p: `", str); \ - DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \ - DEBUG_PRINT1 ("'\n"); \ - \ - pat = (unsigned char *) POP_FAILURE_POINTER (); \ - DEBUG_PRINT2 (" Popping pattern %p:\n", pat); \ - DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \ - \ - /* Restore register info. */ \ - high_reg = (active_reg_t) POP_FAILURE_INT (); \ - DEBUG_PRINT2 (" Popping high active reg: %ld\n", high_reg); \ - \ - low_reg = (active_reg_t) POP_FAILURE_INT (); \ - DEBUG_PRINT2 (" Popping low active reg: %ld\n", low_reg); \ - \ - if (1) \ - for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \ - { \ - DEBUG_PRINT2 (" Popping reg: %ld\n", this_reg); \ - \ - reg_info[this_reg].word = POP_FAILURE_ELT (); \ - DEBUG_PRINT2 (" info: %p\n", \ - reg_info[this_reg].word.pointer); \ - \ - regend[this_reg] = (const char *) POP_FAILURE_POINTER (); \ - DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \ - \ - regstart[this_reg] = (const char *) POP_FAILURE_POINTER (); \ - DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \ - } \ - else \ - { \ +{ \ + DEBUG_STATEMENT (unsigned failure_id;) \ + active_reg_t this_reg; \ + const unsigned char *string_temp; \ + \ + assert (!FAIL_STACK_EMPTY ()); \ + \ + /* Remove failure points and point to how many regs pushed. */ \ + DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \ + DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \ + DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \ + \ + assert (fail_stack.avail >= NUM_NONREG_ITEMS); \ + \ + DEBUG_POP (&failure_id); \ + DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \ + \ + /* If the saved string location is NULL, it came from an \ + on_failure_keep_string_jump opcode, and we want to throw away the \ + saved NULL, thus retaining our current position in the string. */ \ + string_temp = POP_FAILURE_POINTER (); \ + if (string_temp != NULL) \ + str = (const char *) string_temp; \ + \ + DEBUG_PRINT2 (" Popping string %p: `", str); \ + DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \ + DEBUG_PRINT1 ("'\n"); \ + \ + pat = (unsigned char *) POP_FAILURE_POINTER (); \ + DEBUG_PRINT2 (" Popping pattern %p:\n", pat); \ + DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \ + \ + /* Restore register info. */ \ + high_reg = (active_reg_t) POP_FAILURE_INT (); \ + DEBUG_PRINT2 (" Popping high active reg: %ld\n", high_reg); \ + \ + low_reg = (active_reg_t) POP_FAILURE_INT (); \ + DEBUG_PRINT2 (" Popping low active reg: %ld\n", low_reg); \ + \ + if (1) \ + for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \ + { \ + DEBUG_PRINT2 (" Popping reg: %ld\n", this_reg); \ + \ + reg_info[this_reg].word = POP_FAILURE_ELT (); \ + DEBUG_PRINT2 (" info: %p\n", \ + reg_info[this_reg].word.pointer); \ + \ + regend[this_reg] = (const char *) POP_FAILURE_POINTER (); \ + DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \ + \ + regstart[this_reg] = (const char *) POP_FAILURE_POINTER (); \ + DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \ + } \ + else \ + { \ for (this_reg = highest_active_reg; this_reg > high_reg; this_reg--) \ - { \ - reg_info[this_reg].word.integer = 0; \ - regend[this_reg] = 0; \ - regstart[this_reg] = 0; \ - } \ - highest_active_reg = high_reg; \ - } \ - \ - set_regs_matched_done = 0; \ - DEBUG_STATEMENT (nfailure_points_popped++); \ + { \ + reg_info[this_reg].word.integer = 0; \ + regend[this_reg] = 0; \ + regstart[this_reg] = 0; \ + } \ + highest_active_reg = high_reg; \ + } \ + \ + set_regs_matched_done = 0; \ + DEBUG_STATEMENT (nfailure_points_popped++); \ } /* POP_FAILURE_POINT */ @@ -1473,21 +1473,21 @@ typedef union /* Call this when have matched a real character; it sets `matched' flags for the subexpressions which we are currently inside. Also records that those subexprs have matched. */ -#define SET_REGS_MATCHED() \ - do \ - { \ - if (!set_regs_matched_done) \ - { \ - active_reg_t r; \ - set_regs_matched_done = 1; \ - for (r = lowest_active_reg; r <= highest_active_reg; r++) \ - { \ - MATCHED_SOMETHING (reg_info[r]) \ - = EVER_MATCHED_SOMETHING (reg_info[r]) \ - = 1; \ - } \ - } \ - } \ +#define SET_REGS_MATCHED() \ + do \ + { \ + if (!set_regs_matched_done) \ + { \ + active_reg_t r; \ + set_regs_matched_done = 1; \ + for (r = lowest_active_reg; r <= highest_active_reg; r++) \ + { \ + MATCHED_SOMETHING (reg_info[r]) \ + = EVER_MATCHED_SOMETHING (reg_info[r]) \ + = 1; \ + } \ + } \ + } \ while (0) /* Registers are set to a sentinel when they haven't yet matched. */ @@ -1498,42 +1498,42 @@ static char reg_unset_dummy; /* Subroutine declarations and macros for regex_compile. */ static reg_errcode_t regex_compile _RE_ARGS ((const char *pattern, size_t size, - reg_syntax_t syntax, - struct re_pattern_buffer *bufp)); + reg_syntax_t syntax, + struct re_pattern_buffer *bufp)); static void store_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc, int arg)); static void store_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc, - int arg1, int arg2)); + int arg1, int arg2)); static void insert_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc, - int arg, unsigned char *end)); + int arg, unsigned char *end)); static void insert_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc, - int arg1, int arg2, unsigned char *end)); + int arg1, int arg2, unsigned char *end)); static boolean at_begline_loc_p _RE_ARGS ((const char *pattern, const char *p, - reg_syntax_t syntax)); + reg_syntax_t syntax)); static boolean at_endline_loc_p _RE_ARGS ((const char *p, const char *pend, - reg_syntax_t syntax)); + reg_syntax_t syntax)); static reg_errcode_t compile_range _RE_ARGS ((const char **p_ptr, - const char *pend, - char *translate, - reg_syntax_t syntax, - unsigned char *b)); + const char *pend, + char *translate, + reg_syntax_t syntax, + unsigned char *b)); /* Fetch the next character in the uncompiled pattern---translating it if necessary. Also cast from a signed character in the constant string passed to us by the user to an unsigned char that we can use as an array index (in, e.g., `translate'). */ #ifndef PATFETCH -# define PATFETCH(c) \ - do {if (p == pend) return REG_EEND; \ - c = (unsigned char) *p++; \ - if (translate) c = (unsigned char) translate[c]; \ +# define PATFETCH(c) \ + do {if (p == pend) return REG_EEND; \ + c = (unsigned char) *p++; \ + if (translate) c = (unsigned char) translate[c]; \ } while (0) #endif /* Fetch the next character in the uncompiled pattern, with no translation. */ -#define PATFETCH_RAW(c) \ - do {if (p == pend) return REG_EEND; \ - c = (unsigned char) *p++; \ +#define PATFETCH_RAW(c) \ + do {if (p == pend) return REG_EEND; \ + c = (unsigned char) *p++; \ } while (0) /* Go backwards one character in the pattern. */ @@ -1556,34 +1556,34 @@ static reg_errcode_t compile_range _RE_ARGS ((const char **p_ptr, #define INIT_BUF_SIZE 32 /* Make sure we have at least N more bytes of space in buffer. */ -#define GET_BUFFER_SPACE(n) \ - while ((unsigned long) (b - bufp->buffer + (n)) > bufp->allocated) \ +#define GET_BUFFER_SPACE(n) \ + while ((unsigned long) (b - bufp->buffer + (n)) > bufp->allocated) \ EXTEND_BUFFER () /* Make sure we have one more byte of buffer space and then add C to it. */ -#define BUF_PUSH(c) \ - do { \ - GET_BUFFER_SPACE (1); \ - *b++ = (unsigned char) (c); \ +#define BUF_PUSH(c) \ + do { \ + GET_BUFFER_SPACE (1); \ + *b++ = (unsigned char) (c); \ } while (0) /* Ensure we have two more bytes of buffer space and then append C1 and C2. */ -#define BUF_PUSH_2(c1, c2) \ - do { \ - GET_BUFFER_SPACE (2); \ - *b++ = (unsigned char) (c1); \ - *b++ = (unsigned char) (c2); \ +#define BUF_PUSH_2(c1, c2) \ + do { \ + GET_BUFFER_SPACE (2); \ + *b++ = (unsigned char) (c1); \ + *b++ = (unsigned char) (c2); \ } while (0) /* As with BUF_PUSH_2, except for three bytes. */ -#define BUF_PUSH_3(c1, c2, c3) \ - do { \ - GET_BUFFER_SPACE (3); \ - *b++ = (unsigned char) (c1); \ - *b++ = (unsigned char) (c2); \ - *b++ = (unsigned char) (c3); \ +#define BUF_PUSH_3(c1, c2, c3) \ + do { \ + GET_BUFFER_SPACE (3); \ + *b++ = (unsigned char) (c1); \ + *b++ = (unsigned char) (c2); \ + *b++ = (unsigned char) (c3); \ } while (0) @@ -1628,29 +1628,29 @@ static reg_errcode_t compile_range _RE_ARGS ((const char **p_ptr, reset the pointers that pointed into the old block to point to the correct places in the new one. If extending the buffer results in it being larger than MAX_BUF_SIZE, then flag memory exhausted. */ -#define EXTEND_BUFFER() \ - do { \ - unsigned char *old_buffer = bufp->buffer; \ - if (bufp->allocated == MAX_BUF_SIZE) \ - return REG_ESIZE; \ - bufp->allocated <<= 1; \ - if (bufp->allocated > MAX_BUF_SIZE) \ - bufp->allocated = MAX_BUF_SIZE; \ +#define EXTEND_BUFFER() \ + do { \ + unsigned char *old_buffer = bufp->buffer; \ + if (bufp->allocated == MAX_BUF_SIZE) \ + return REG_ESIZE; \ + bufp->allocated <<= 1; \ + if (bufp->allocated > MAX_BUF_SIZE) \ + bufp->allocated = MAX_BUF_SIZE; \ bufp->buffer = (unsigned char *) REALLOC (bufp->buffer, bufp->allocated);\ - if (bufp->buffer == NULL) \ - return REG_ESPACE; \ - /* If the buffer moved, move all the pointers into it. */ \ - if (old_buffer != bufp->buffer) \ - { \ - b = (b - old_buffer) + bufp->buffer; \ - begalt = (begalt - old_buffer) + bufp->buffer; \ - if (fixup_alt_jump) \ + if (bufp->buffer == NULL) \ + return REG_ESPACE; \ + /* If the buffer moved, move all the pointers into it. */ \ + if (old_buffer != bufp->buffer) \ + { \ + b = (b - old_buffer) + bufp->buffer; \ + begalt = (begalt - old_buffer) + bufp->buffer; \ + if (fixup_alt_jump) \ fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\ - if (laststart) \ - laststart = (laststart - old_buffer) + bufp->buffer; \ - if (pending_exact) \ - pending_exact = (pending_exact - old_buffer) + bufp->buffer; \ - } \ + if (laststart) \ + laststart = (laststart - old_buffer) + bufp->buffer; \ + if (pending_exact) \ + pending_exact = (pending_exact - old_buffer) + bufp->buffer; \ + } \ } while (0) @@ -1685,7 +1685,7 @@ typedef struct { compile_stack_elt_t *stack; unsigned size; - unsigned avail; /* Offset of next open position. */ + unsigned avail; /* Offset of next open position. */ } compile_stack_type; @@ -1705,20 +1705,20 @@ typedef struct /* Get the next unsigned number in the uncompiled pattern. */ -#define GET_UNSIGNED_NUMBER(num) \ - { if (p != pend) \ - { \ - PATFETCH (c); \ - while (ISDIGIT (c)) \ - { \ - if (num < 0) \ - num = 0; \ - num = num * 10 + c - '0'; \ - if (p == pend) \ - break; \ - PATFETCH (c); \ - } \ - } \ +#define GET_UNSIGNED_NUMBER(num) \ + { if (p != pend) \ + { \ + PATFETCH (c); \ + while (ISDIGIT (c)) \ + { \ + if (num < 0) \ + num = 0; \ + num = num * 10 + c - '0'; \ + if (p == pend) \ + break; \ + PATFETCH (c); \ + } \ + } \ } #if defined _LIBC || WIDE_CHAR_SUPPORT @@ -1740,12 +1740,12 @@ typedef struct #else # define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ -# define IS_CHAR_CLASS(string) \ - (STREQ (string, "alpha") || STREQ (string, "upper") \ - || STREQ (string, "lower") || STREQ (string, "digit") \ - || STREQ (string, "alnum") || STREQ (string, "xdigit") \ - || STREQ (string, "space") || STREQ (string, "print") \ - || STREQ (string, "punct") || STREQ (string, "graph") \ +# define IS_CHAR_CLASS(string) \ + (STREQ (string, "alpha") || STREQ (string, "upper") \ + || STREQ (string, "lower") || STREQ (string, "digit") \ + || STREQ (string, "alnum") || STREQ (string, "xdigit") \ + || STREQ (string, "space") || STREQ (string, "print") \ + || STREQ (string, "punct") || STREQ (string, "graph") \ || STREQ (string, "cntrl") || STREQ (string, "blank")) #endif @@ -1781,14 +1781,14 @@ regex_grow_registers (num_regs) { if (num_regs > regs_allocated_size) { - RETALLOC_IF (regstart, num_regs, const char *); - RETALLOC_IF (regend, num_regs, const char *); + RETALLOC_IF (regstart, num_regs, const char *); + RETALLOC_IF (regend, num_regs, const char *); RETALLOC_IF (old_regstart, num_regs, const char *); - RETALLOC_IF (old_regend, num_regs, const char *); + RETALLOC_IF (old_regend, num_regs, const char *); RETALLOC_IF (best_regstart, num_regs, const char *); - RETALLOC_IF (best_regend, num_regs, const char *); - RETALLOC_IF (reg_info, num_regs, register_info_type); - RETALLOC_IF (reg_dummy, num_regs, const char *); + RETALLOC_IF (best_regend, num_regs, const char *); + RETALLOC_IF (reg_info, num_regs, register_info_type); + RETALLOC_IF (reg_dummy, num_regs, const char *); RETALLOC_IF (reg_info_dummy, num_regs, register_info_type); regs_allocated_size = num_regs; @@ -1798,8 +1798,8 @@ regex_grow_registers (num_regs) #endif /* not MATCH_MAY_ALLOCATE */ static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type - compile_stack, - regnum_t regnum)); + compile_stack, + regnum_t regnum)); /* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX. Returns one of error codes defined in `regex.h', or zero for success. @@ -1820,7 +1820,7 @@ static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type examined nor set. */ /* Return, freeing storage we allocated. */ -#define FREE_STACK_RETURN(value) \ +#define FREE_STACK_RETURN(value) \ return (free (compile_stack.stack), value) static reg_errcode_t @@ -1920,7 +1920,7 @@ regex_compile (pattern, size, syntax, bufp) if (bufp->allocated == 0) { if (bufp->buffer) - { /* If zero allocated, but buffer is non-null, try to realloc + { /* If zero allocated, but buffer is non-null, try to realloc enough space. This loses if buffer's address is bogus, but that is the user's responsibility. */ RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char); @@ -1973,7 +1973,7 @@ regex_compile (pattern, size, syntax, bufp) break; - case '+': + case '+': case '?': if ((syntax & RE_BK_PLUS_QM) || (syntax & RE_LIMITED_OPS)) @@ -2067,7 +2067,7 @@ regex_compile (pattern, size, syntax, bufp) the `*'. Do we have to do something analogous here for null bytes, because of RE_DOT_NOT_NULL? */ if (TRANSLATE (*(p - 2)) == TRANSLATE ('.') - && zero_times_ok + && zero_times_ok && p < pend && TRANSLATE (*p) == TRANSLATE ('\n') && !(syntax & RE_DOT_NEWLINE)) { /* We have .*\n. */ @@ -2103,10 +2103,10 @@ regex_compile (pattern, size, syntax, bufp) b += 3; } } - break; + break; - case '.': + case '.': laststart = b; BUF_PUSH (anychar); break; @@ -2120,7 +2120,7 @@ regex_compile (pattern, size, syntax, bufp) /* Ensure that we have enough space to push a charset: the opcode, the length count, and the bitset; 34 bytes in all. */ - GET_BUFFER_SPACE (34); + GET_BUFFER_SPACE (34); laststart = b; @@ -2190,7 +2190,7 @@ regex_compile (pattern, size, syntax, bufp) { /* This handles ranges made up of characters only. */ reg_errcode_t ret; - /* Move past the `-'. */ + /* Move past the `-'. */ PATFETCH (c1); ret = compile_range (&p, pend, translate, syntax, b); @@ -2215,11 +2215,11 @@ regex_compile (pattern, size, syntax, bufp) PATFETCH (c); if ((c == ':' && *p == ']') || p == pend) break; - if (c1 < CHAR_CLASS_MAX_LENGTH) - str[c1++] = c; - else - /* This is in any case an invalid class name. */ - str[0] = '\0'; + if (c1 < CHAR_CLASS_MAX_LENGTH) + str[c1++] = c; + else + /* This is in any case an invalid class name. */ + str[0] = '\0'; } str[c1] = '\0'; @@ -2231,12 +2231,12 @@ regex_compile (pattern, size, syntax, bufp) #if defined _LIBC || WIDE_CHAR_SUPPORT boolean is_lower = STREQ (str, "lower"); boolean is_upper = STREQ (str, "upper"); - wctype_t wt; + wctype_t wt; int ch; - wt = IS_CHAR_CLASS (str); - if (wt == 0) - FREE_STACK_RETURN (REG_ECTYPE); + wt = IS_CHAR_CLASS (str); + if (wt == 0) + FREE_STACK_RETURN (REG_ECTYPE); /* Throw away the ] at the end of the character class. */ @@ -2245,19 +2245,19 @@ regex_compile (pattern, size, syntax, bufp) if (p == pend) FREE_STACK_RETURN (REG_EBRACK); for (ch = 0; ch < 1 << BYTEWIDTH; ++ch) - { + { # ifdef _LIBC - if (__iswctype (__btowc (ch), wt)) - SET_LIST_BIT (ch); + if (__iswctype (__btowc (ch), wt)) + SET_LIST_BIT (ch); # else - if (iswctype (btowc (ch), wt)) - SET_LIST_BIT (ch); + if (iswctype (btowc (ch), wt)) + SET_LIST_BIT (ch); # endif - if (translate && (is_upper || is_lower) - && (ISUPPER (ch) || ISLOWER (ch))) - SET_LIST_BIT (ch); - } + if (translate && (is_upper || is_lower) + && (ISUPPER (ch) || ISLOWER (ch))) + SET_LIST_BIT (ch); + } had_char_class = true; #else @@ -2276,7 +2276,7 @@ regex_compile (pattern, size, syntax, bufp) boolean is_xdigit = STREQ (str, "xdigit"); if (!IS_CHAR_CLASS (str)) - FREE_STACK_RETURN (REG_ECTYPE); + FREE_STACK_RETURN (REG_ECTYPE); /* Throw away the ] at the end of the character class. */ @@ -2286,29 +2286,29 @@ regex_compile (pattern, size, syntax, bufp) for (ch = 0; ch < 1 << BYTEWIDTH; ch++) { - /* This was split into 3 if's to - avoid an arbitrary limit in some compiler. */ + /* This was split into 3 if's to + avoid an arbitrary limit in some compiler. */ if ( (is_alnum && ISALNUM (ch)) || (is_alpha && ISALPHA (ch)) || (is_blank && ISBLANK (ch)) || (is_cntrl && ISCNTRL (ch))) - SET_LIST_BIT (ch); - if ( (is_digit && ISDIGIT (ch)) + SET_LIST_BIT (ch); + if ( (is_digit && ISDIGIT (ch)) || (is_graph && ISGRAPH (ch)) || (is_lower && ISLOWER (ch)) || (is_print && ISPRINT (ch))) - SET_LIST_BIT (ch); - if ( (is_punct && ISPUNCT (ch)) + SET_LIST_BIT (ch); + if ( (is_punct && ISPUNCT (ch)) || (is_space && ISSPACE (ch)) || (is_upper && ISUPPER (ch)) || (is_xdigit && ISXDIGIT (ch))) - SET_LIST_BIT (ch); - if ( translate && (is_upper || is_lower) - && (ISUPPER (ch) || ISLOWER (ch))) - SET_LIST_BIT (ch); + SET_LIST_BIT (ch); + if ( translate && (is_upper || is_lower) + && (ISUPPER (ch) || ISLOWER (ch))) + SET_LIST_BIT (ch); } had_char_class = true; -#endif /* libc || wctype.h */ +#endif /* libc || wctype.h */ } else { @@ -2336,7 +2336,7 @@ regex_compile (pattern, size, syntax, bufp) break; - case '(': + case '(': if (syntax & RE_NO_BK_PARENS) goto handle_open; else @@ -2357,7 +2357,7 @@ regex_compile (pattern, size, syntax, bufp) goto normal_char; - case '|': + case '|': if (syntax & RE_NO_BK_VBAR) goto handle_alt; else @@ -2423,10 +2423,10 @@ regex_compile (pattern, size, syntax, bufp) fixup_alt_jump = 0; laststart = 0; begalt = b; - /* If we've reached MAX_REGNUM groups, then this open - won't actually generate any code, so we'll have to - clear pending_exact explicitly. */ - pending_exact = 0; + /* If we've reached MAX_REGNUM groups, then this open + won't actually generate any code, so we'll have to + clear pending_exact explicitly. */ + pending_exact = 0; break; @@ -2434,12 +2434,12 @@ regex_compile (pattern, size, syntax, bufp) if (syntax & RE_NO_BK_PARENS) goto normal_backslash; if (COMPILE_STACK_EMPTY) - { - if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) - goto normal_backslash; - else - FREE_STACK_RETURN (REG_ERPAREN); - } + { + if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) + goto normal_backslash; + else + FREE_STACK_RETURN (REG_ERPAREN); + } handle_close: if (fixup_alt_jump) @@ -2456,12 +2456,12 @@ regex_compile (pattern, size, syntax, bufp) /* See similar code for backslashed left paren above. */ if (COMPILE_STACK_EMPTY) - { - if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) - goto normal_char; - else - FREE_STACK_RETURN (REG_ERPAREN); - } + { + if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) + goto normal_char; + else + FREE_STACK_RETURN (REG_ERPAREN); + } /* Since we just checked for an empty stack above, this ``can't happen''. */ @@ -2480,10 +2480,10 @@ regex_compile (pattern, size, syntax, bufp) : 0; laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset; this_group_regnum = COMPILE_STACK_TOP.regnum; - /* If we've reached MAX_REGNUM groups, then this open - won't actually generate any code, so we'll have to - clear pending_exact explicitly. */ - pending_exact = 0; + /* If we've reached MAX_REGNUM groups, then this open + won't actually generate any code, so we'll have to + clear pending_exact explicitly. */ + pending_exact = 0; /* We're at the end of the group, so now we know how many groups were inside this one. */ @@ -2500,7 +2500,7 @@ regex_compile (pattern, size, syntax, bufp) break; - case '|': /* `\|'. */ + case '|': /* `\|'. */ if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR) goto normal_backslash; handle_alt: @@ -2736,54 +2736,54 @@ regex_compile (pattern, size, syntax, bufp) case 'w': - if (syntax & RE_NO_GNU_OPS) - goto normal_char; + if (syntax & RE_NO_GNU_OPS) + goto normal_char; laststart = b; BUF_PUSH (wordchar); break; case 'W': - if (syntax & RE_NO_GNU_OPS) - goto normal_char; + if (syntax & RE_NO_GNU_OPS) + goto normal_char; laststart = b; BUF_PUSH (notwordchar); break; case '<': - if (syntax & RE_NO_GNU_OPS) - goto normal_char; + if (syntax & RE_NO_GNU_OPS) + goto normal_char; BUF_PUSH (wordbeg); break; case '>': - if (syntax & RE_NO_GNU_OPS) - goto normal_char; + if (syntax & RE_NO_GNU_OPS) + goto normal_char; BUF_PUSH (wordend); break; case 'b': - if (syntax & RE_NO_GNU_OPS) - goto normal_char; + if (syntax & RE_NO_GNU_OPS) + goto normal_char; BUF_PUSH (wordbound); break; case 'B': - if (syntax & RE_NO_GNU_OPS) - goto normal_char; + if (syntax & RE_NO_GNU_OPS) + goto normal_char; BUF_PUSH (notwordbound); break; case '`': - if (syntax & RE_NO_GNU_OPS) - goto normal_char; + if (syntax & RE_NO_GNU_OPS) + goto normal_char; BUF_PUSH (begbuf); break; case '\'': - if (syntax & RE_NO_GNU_OPS) - goto normal_char; + if (syntax & RE_NO_GNU_OPS) + goto normal_char; BUF_PUSH (endbuf); break; @@ -2824,39 +2824,39 @@ regex_compile (pattern, size, syntax, bufp) break; - default: + default: /* Expects the character in `c'. */ - normal_char: - /* If no exactn currently being built. */ + normal_char: + /* If no exactn currently being built. */ if (!pending_exact /* If last exactn not at current position. */ || pending_exact + *pending_exact + 1 != b /* We have only one byte following the exactn for the count. */ - || *pending_exact == (1 << BYTEWIDTH) - 1 + || *pending_exact == (1 << BYTEWIDTH) - 1 /* If followed by a repetition operator. */ || *p == '*' || *p == '^' - || ((syntax & RE_BK_PLUS_QM) - ? *p == '\\' && (p[1] == '+' || p[1] == '?') - : (*p == '+' || *p == '?')) - || ((syntax & RE_INTERVALS) + || ((syntax & RE_BK_PLUS_QM) + ? *p == '\\' && (p[1] == '+' || p[1] == '?') + : (*p == '+' || *p == '?')) + || ((syntax & RE_INTERVALS) && ((syntax & RE_NO_BK_BRACES) - ? *p == '{' + ? *p == '{' : (p[0] == '\\' && p[1] == '{')))) - { - /* Start building a new exactn. */ + { + /* Start building a new exactn. */ laststart = b; - BUF_PUSH_2 (exactn, 0); - pending_exact = b - 1; + BUF_PUSH_2 (exactn, 0); + pending_exact = b - 1; } - BUF_PUSH (c); + BUF_PUSH (c); (*pending_exact)++; - break; + break; } /* switch (c) */ } /* while p != pend */ @@ -2899,28 +2899,28 @@ regex_compile (pattern, size, syntax, bufp) is 2 * re_max_failures failure points. */ if (fail_stack.size < (2 * re_max_failures * MAX_FAILURE_ITEMS)) { - fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS); + fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS); # ifdef emacs - if (! fail_stack.stack) - fail_stack.stack - = (fail_stack_elt_t *) xmalloc (fail_stack.size - * sizeof (fail_stack_elt_t)); - else - fail_stack.stack - = (fail_stack_elt_t *) xrealloc (fail_stack.stack, - (fail_stack.size - * sizeof (fail_stack_elt_t))); + if (! fail_stack.stack) + fail_stack.stack + = (fail_stack_elt_t *) xmalloc (fail_stack.size + * sizeof (fail_stack_elt_t)); + else + fail_stack.stack + = (fail_stack_elt_t *) xrealloc (fail_stack.stack, + (fail_stack.size + * sizeof (fail_stack_elt_t))); # else /* not emacs */ - if (! fail_stack.stack) - fail_stack.stack - = (fail_stack_elt_t *) malloc (fail_stack.size - * sizeof (fail_stack_elt_t)); - else - fail_stack.stack - = (fail_stack_elt_t *) realloc (fail_stack.stack, - (fail_stack.size - * sizeof (fail_stack_elt_t))); + if (! fail_stack.stack) + fail_stack.stack + = (fail_stack_elt_t *) malloc (fail_stack.size + * sizeof (fail_stack_elt_t)); + else + fail_stack.stack + = (fail_stack_elt_t *) realloc (fail_stack.stack, + (fail_stack.size + * sizeof (fail_stack_elt_t))); # endif /* not emacs */ } @@ -3167,130 +3167,130 @@ re_compile_fastmap (bufp) INIT_FAIL_STACK (); bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ - bufp->fastmap_accurate = 1; /* It will be when we're done. */ + bufp->fastmap_accurate = 1; /* It will be when we're done. */ bufp->can_be_null = 0; while (1) { if (p == pend || *p == succeed) - { - /* We have reached the (effective) end of pattern. */ - if (!FAIL_STACK_EMPTY ()) - { - bufp->can_be_null |= path_can_be_null; + { + /* We have reached the (effective) end of pattern. */ + if (!FAIL_STACK_EMPTY ()) + { + bufp->can_be_null |= path_can_be_null; - /* Reset for next path. */ - path_can_be_null = true; + /* Reset for next path. */ + path_can_be_null = true; - p = fail_stack.stack[--fail_stack.avail].pointer; + p = fail_stack.stack[--fail_stack.avail].pointer; - continue; - } - else - break; - } + continue; + } + else + break; + } /* We should never be about to go beyond the end of the pattern. */ assert (p < pend); switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) - { + { /* I guess the idea here is to simply not bother with a fastmap if a backreference is used, since it's too hard to figure out the fastmap for the corresponding group. Setting `can_be_null' stops `re_search_2' from using the fastmap, so that is all we do. */ - case duplicate: - bufp->can_be_null = 1; + case duplicate: + bufp->can_be_null = 1; goto done; /* Following are the cases which match a character. These end with `break'. */ - case exactn: + case exactn: fastmap[p[1]] = 1; - break; + break; case charset: for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) - if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) + if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) fastmap[j] = 1; - break; + break; - case charset_not: - /* Chars beyond end of map must be allowed. */ - for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++) + case charset_not: + /* Chars beyond end of map must be allowed. */ + for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++) fastmap[j] = 1; - for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) - if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))) + for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) + if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))) fastmap[j] = 1; break; - case wordchar: - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX (j) == Sword) - fastmap[j] = 1; - break; + case wordchar: + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (j) == Sword) + fastmap[j] = 1; + break; - case notwordchar: - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX (j) != Sword) - fastmap[j] = 1; - break; + case notwordchar: + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (j) != Sword) + fastmap[j] = 1; + break; case anychar: - { - int fastmap_newline = fastmap['\n']; + { + int fastmap_newline = fastmap['\n']; - /* `.' matches anything ... */ - for (j = 0; j < (1 << BYTEWIDTH); j++) - fastmap[j] = 1; + /* `.' matches anything ... */ + for (j = 0; j < (1 << BYTEWIDTH); j++) + fastmap[j] = 1; - /* ... except perhaps newline. */ - if (!(bufp->syntax & RE_DOT_NEWLINE)) - fastmap['\n'] = fastmap_newline; + /* ... except perhaps newline. */ + if (!(bufp->syntax & RE_DOT_NEWLINE)) + fastmap['\n'] = fastmap_newline; - /* Return if we have already set `can_be_null'; if we have, - then the fastmap is irrelevant. Something's wrong here. */ - else if (bufp->can_be_null) - goto done; + /* Return if we have already set `can_be_null'; if we have, + then the fastmap is irrelevant. Something's wrong here. */ + else if (bufp->can_be_null) + goto done; - /* Otherwise, have to check alternative paths. */ - break; - } + /* Otherwise, have to check alternative paths. */ + break; + } #ifdef emacs case syntaxspec: - k = *p++; - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX (j) == (enum syntaxcode) k) - fastmap[j] = 1; - break; + k = *p++; + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (j) == (enum syntaxcode) k) + fastmap[j] = 1; + break; - case notsyntaxspec: - k = *p++; - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX (j) != (enum syntaxcode) k) - fastmap[j] = 1; - break; + case notsyntaxspec: + k = *p++; + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (j) != (enum syntaxcode) k) + fastmap[j] = 1; + break; /* All cases after this match the empty string. These end with `continue'. */ - case before_dot: - case at_dot: - case after_dot: + case before_dot: + case at_dot: + case after_dot: continue; #endif /* emacs */ @@ -3298,26 +3298,26 @@ re_compile_fastmap (bufp) case no_op: case begline: case endline: - case begbuf: - case endbuf: - case wordbound: - case notwordbound: - case wordbeg: - case wordend: + case begbuf: + case endbuf: + case wordbound: + case notwordbound: + case wordbeg: + case wordend: case push_dummy_failure: continue; - case jump_n: + case jump_n: case pop_failure_jump: - case maybe_pop_jump: - case jump: + case maybe_pop_jump: + case jump: case jump_past_alt: - case dummy_failure_jump: + case dummy_failure_jump: EXTRACT_NUMBER_AND_INCR (j, p); - p += j; - if (j > 0) - continue; + p += j; + if (j > 0) + continue; /* Jump backward implies we just went through the body of a loop and matched nothing. Opcode jumped to should be @@ -3325,8 +3325,8 @@ re_compile_fastmap (bufp) ordinary jump. For a * loop, it has pushed its failure point already; if so, discard that as redundant. */ if ((re_opcode_t) *p != on_failure_jump - && (re_opcode_t) *p != succeed_n) - continue; + && (re_opcode_t) *p != succeed_n) + continue; p++; EXTRACT_NUMBER_AND_INCR (j, p); @@ -3334,7 +3334,7 @@ re_compile_fastmap (bufp) /* If what's on the stack is where we are now, pop it. */ if (!FAIL_STACK_EMPTY () - && fail_stack.stack[fail_stack.avail - 1].pointer == p) + && fail_stack.stack[fail_stack.avail - 1].pointer == p) fail_stack.avail--; continue; @@ -3342,7 +3342,7 @@ re_compile_fastmap (bufp) case on_failure_jump: case on_failure_keep_string_jump: - handle_on_failure_jump: + handle_on_failure_jump: EXTRACT_NUMBER_AND_INCR (j, p); /* For some patterns, e.g., `(a?)?', `p+j' here points to the @@ -3355,50 +3355,50 @@ re_compile_fastmap (bufp) if (p + j < pend) { if (!PUSH_PATTERN_OP (p + j, fail_stack)) - { - RESET_FAIL_STACK (); - return -2; - } + { + RESET_FAIL_STACK (); + return -2; + } } else bufp->can_be_null = 1; if (succeed_n_p) { - EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */ + EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */ succeed_n_p = false; - } + } continue; - case succeed_n: + case succeed_n: /* Get to the number of times to succeed. */ p += 2; /* Increment p past the n for when k != 0. */ EXTRACT_NUMBER_AND_INCR (k, p); if (k == 0) - { + { p -= 4; - succeed_n_p = true; /* Spaghetti code alert. */ + succeed_n_p = true; /* Spaghetti code alert. */ goto handle_on_failure_jump; } continue; - case set_number_at: + case set_number_at: p += 4; continue; - case start_memory: + case start_memory: case stop_memory: - p += 2; - continue; + p += 2; + continue; - default: + default: abort (); /* We have listed all the cases. */ } /* switch *p++ */ @@ -3475,7 +3475,7 @@ re_search (bufp, string, size, startpos, range, regs) struct re_registers *regs; { return re_search_2 (bufp, NULL, 0, string, size, startpos, range, - regs, size); + regs, size); } #ifdef _LIBC weak_alias (__re_search, re_search) @@ -3535,14 +3535,14 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) search for a pattern that must be anchored. */ if (bufp->used > 0 && range > 0 && ((re_opcode_t) bufp->buffer[0] == begbuf - /* `begline' is like `begbuf' if it cannot match at newlines. */ - || ((re_opcode_t) bufp->buffer[0] == begline - && !bufp->newline_anchor))) + /* `begline' is like `begbuf' if it cannot match at newlines. */ + || ((re_opcode_t) bufp->buffer[0] == begline + && !bufp->newline_anchor))) { if (startpos > 0) - return -1; + return -1; else - range = 1; + range = 1; } #ifdef emacs @@ -3552,7 +3552,7 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) { range = PT - startpos; if (range <= 0) - return -1; + return -1; } #endif /* emacs */ @@ -3569,49 +3569,49 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) null string, however, we don't need to skip characters; we want the first null string. */ if (fastmap && startpos < total_size && !bufp->can_be_null) - { - if (range > 0) /* Searching forwards. */ - { - register const char *d; - register int lim = 0; - int irange = range; + { + if (range > 0) /* Searching forwards. */ + { + register const char *d; + register int lim = 0; + int irange = range; if (startpos < size1 && startpos + range >= size1) lim = range - (size1 - startpos); - d = (startpos >= size1 ? string2 - size1 : string1) + startpos; + d = (startpos >= size1 ? string2 - size1 : string1) + startpos; /* Written out as an if-else to avoid testing `translate' inside the loop. */ - if (translate) + if (translate) while (range > lim && !fastmap[(unsigned char) - translate[(unsigned char) *d++]]) + translate[(unsigned char) *d++]]) range--; - else + else while (range > lim && !fastmap[(unsigned char) *d++]) range--; - startpos += irange - range; - } - else /* Searching backwards. */ - { - register char c = (size1 == 0 || startpos >= size1 + startpos += irange - range; + } + else /* Searching backwards. */ + { + register char c = (size1 == 0 || startpos >= size1 ? string2[startpos - size1] : string1[startpos]); - if (!fastmap[(unsigned char) TRANSLATE (c)]) - goto advance; - } - } + if (!fastmap[(unsigned char) TRANSLATE (c)]) + goto advance; + } + } /* If can't match the null string, and that's all we have left, fail. */ if (range >= 0 && startpos == total_size && fastmap && !bufp->can_be_null) - return -1; + return -1; val = re_match_2_internal (bufp, string1, size1, string2, size2, - startpos, regs, stop); + startpos, regs, stop); #ifndef REGEX_MALLOC # ifdef C_ALLOCA alloca (0); @@ -3619,10 +3619,10 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) #endif if (val >= 0) - return startpos; + return startpos; if (val == -2) - return -2; + return -2; advance: if (!range) @@ -3646,9 +3646,9 @@ weak_alias (__re_search_2, re_search_2) /* This converts PTR, a pointer into one of the search strings `string1' and `string2' into an offset from the beginning of that string. */ -#define POINTER_TO_OFFSET(ptr) \ - (FIRST_STRING_P (ptr) \ - ? ((regoff_t) ((ptr) - string1)) \ +#define POINTER_TO_OFFSET(ptr) \ + (FIRST_STRING_P (ptr) \ + ? ((regoff_t) ((ptr) - string1)) \ : ((regoff_t) ((ptr) - string2 + size1))) /* Macros for dealing with the split strings in re_match_2. */ @@ -3657,15 +3657,15 @@ weak_alias (__re_search_2, re_search_2) /* Call before fetching a character with *d. This switches over to string2 if necessary. */ -#define PREFETCH() \ - while (d == dend) \ - { \ - /* End of string2 => fail. */ \ - if (dend == end_match_2) \ - goto fail; \ - /* End of string1 => advance to string2. */ \ - d = string2; \ - dend = end_match_2; \ +#define PREFETCH() \ + while (d == dend) \ + { \ + /* End of string2 => fail. */ \ + if (dend == end_match_2) \ + goto fail; \ + /* End of string1 => advance to string2. */ \ + d = string2; \ + dend = end_match_2; \ } @@ -3679,35 +3679,35 @@ weak_alias (__re_search_2, re_search_2) two special cases to check for: if past the end of string1, look at the first character in string2; and if before the beginning of string2, look at the last character in string1. */ -#define WORDCHAR_P(d) \ - (SYNTAX ((d) == end1 ? *string2 \ - : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \ +#define WORDCHAR_P(d) \ + (SYNTAX ((d) == end1 ? *string2 \ + : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \ == Sword) /* Disabled due to a compiler bug -- see comment at case wordbound */ #if 0 /* Test if the character before D and the one at D differ with respect to being word-constituent. */ -#define AT_WORD_BOUNDARY(d) \ - (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \ +#define AT_WORD_BOUNDARY(d) \ + (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \ || WORDCHAR_P (d - 1) != WORDCHAR_P (d)) #endif /* Free everything we malloc. */ #ifdef MATCH_MAY_ALLOCATE # define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL -# define FREE_VARIABLES() \ - do { \ - REGEX_FREE_STACK (fail_stack.stack); \ - FREE_VAR (regstart); \ - FREE_VAR (regend); \ - FREE_VAR (old_regstart); \ - FREE_VAR (old_regend); \ - FREE_VAR (best_regstart); \ - FREE_VAR (best_regend); \ - FREE_VAR (reg_info); \ - FREE_VAR (reg_dummy); \ - FREE_VAR (reg_info_dummy); \ +# define FREE_VARIABLES() \ + do { \ + REGEX_FREE_STACK (fail_stack.stack); \ + FREE_VAR (regstart); \ + FREE_VAR (regend); \ + FREE_VAR (old_regstart); \ + FREE_VAR (old_regend); \ + FREE_VAR (best_regstart); \ + FREE_VAR (best_regend); \ + FREE_VAR (reg_info); \ + FREE_VAR (reg_dummy); \ + FREE_VAR (reg_info_dummy); \ } while (0) #else # define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */ @@ -3736,7 +3736,7 @@ re_match (bufp, string, size, pos, regs) struct re_registers *regs; { int result = re_match_2_internal (bufp, NULL, 0, string, size, - pos, regs, size); + pos, regs, size); # ifndef REGEX_MALLOC # ifdef C_ALLOCA alloca (0); @@ -3750,16 +3750,16 @@ weak_alias (__re_match, re_match) #endif /* not emacs */ static boolean group_match_null_string_p _RE_ARGS ((unsigned char **p, - unsigned char *end, - register_info_type *reg_info)); + unsigned char *end, + register_info_type *reg_info)); static boolean alt_match_null_string_p _RE_ARGS ((unsigned char *p, - unsigned char *end, - register_info_type *reg_info)); + unsigned char *end, + register_info_type *reg_info)); static boolean common_op_match_null_string_p _RE_ARGS ((unsigned char **p, - unsigned char *end, - register_info_type *reg_info)); + unsigned char *end, + register_info_type *reg_info)); static int bcmp_translate _RE_ARGS ((const char *s1, const char *s2, - int len, char *translate)); + int len, char *translate)); /* re_match_2 matches the compiled pattern in BUFP against the the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 @@ -3784,7 +3784,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) int stop; { int result = re_match_2_internal (bufp, string1, size1, string2, size2, - pos, regs, stop); + pos, regs, stop); #ifndef REGEX_MALLOC # ifdef C_ALLOCA alloca (0); @@ -4046,26 +4046,26 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) #endif if (p == pend) - { /* End of pattern means we might have succeeded. */ + { /* End of pattern means we might have succeeded. */ DEBUG_PRINT1 ("end of pattern ... "); - /* If we haven't matched the entire string, and we want the + /* If we haven't matched the entire string, and we want the longest match, try backtracking. */ if (d != end_match_2) - { - /* 1 if this match ends in the same string (string1 or string2) - as the best previous match. */ - boolean same_str_p = (FIRST_STRING_P (match_end) - == MATCHING_IN_FIRST_STRING); - /* 1 if this match is the best seen so far. */ - boolean best_match_p; + { + /* 1 if this match ends in the same string (string1 or string2) + as the best previous match. */ + boolean same_str_p = (FIRST_STRING_P (match_end) + == MATCHING_IN_FIRST_STRING); + /* 1 if this match is the best seen so far. */ + boolean best_match_p; - /* AIX compiler got confused when this was combined - with the previous declaration. */ - if (same_str_p) - best_match_p = d > match_end; - else - best_match_p = !MATCHING_IN_FIRST_STRING; + /* AIX compiler got confused when this was combined + with the previous declaration. */ + if (same_str_p) + best_match_p = d > match_end; + else + best_match_p = !MATCHING_IN_FIRST_STRING; DEBUG_PRINT1 ("backtracking.\n"); @@ -4094,7 +4094,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) best one. */ else if (best_regs_set && !best_match_p) { - restore_best_regs: + restore_best_regs: /* Restore best match. It may happen that `dend == end_match_1' while the restored d is in string2. For example, the pattern `x.*y.*z' against the @@ -4104,22 +4104,22 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) d = match_end; dend = ((d >= string1 && d <= end1) - ? end_match_1 : end_match_2); + ? end_match_1 : end_match_2); - for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) - { - regstart[mcnt] = best_regstart[mcnt]; - regend[mcnt] = best_regend[mcnt]; - } + for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) + { + regstart[mcnt] = best_regstart[mcnt]; + regend[mcnt] = best_regend[mcnt]; + } } } /* d != end_match_2 */ - succeed_label: + succeed_label: DEBUG_PRINT1 ("Accepting match.\n"); /* If caller wants register contents data back, do it. */ if (regs && !bufp->no_sub) - { + { /* Have the register data arrays been allocated? */ if (bufp->regs_allocated == REGS_UNALLOCATED) { /* No. So allocate them with malloc. We need one @@ -4129,10 +4129,10 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) regs->start = TALLOC (regs->num_regs, regoff_t); regs->end = TALLOC (regs->num_regs, regoff_t); if (regs->start == NULL || regs->end == NULL) - { - FREE_VARIABLES (); - return -2; - } + { + FREE_VARIABLES (); + return -2; + } bufp->regs_allocated = REGS_REALLOCATE; } else if (bufp->regs_allocated == REGS_REALLOCATE) @@ -4145,18 +4145,18 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) RETALLOC (regs->start, regs->num_regs, regoff_t); RETALLOC (regs->end, regs->num_regs, regoff_t); if (regs->start == NULL || regs->end == NULL) - { - FREE_VARIABLES (); - return -2; - } + { + FREE_VARIABLES (); + return -2; + } } } else - { - /* These braces fend off a "empty body in an else-statement" - warning under GCC when assert expands to nothing. */ - assert (bufp->regs_allocated == REGS_FIXED); - } + { + /* These braces fend off a "empty body in an else-statement" + warning under GCC when assert expands to nothing. */ + assert (bufp->regs_allocated == REGS_FIXED); + } /* Convert the pointer data in `regstart' and `regend' to indices. Register zero has to be set differently, @@ -4165,25 +4165,25 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) { regs->start[0] = pos; regs->end[0] = (MATCHING_IN_FIRST_STRING - ? ((regoff_t) (d - string1)) - : ((regoff_t) (d - string2 + size1))); + ? ((regoff_t) (d - string1)) + : ((regoff_t) (d - string2 + size1))); } /* Go through the first `min (num_regs, regs->num_regs)' registers, since that is all we initialized. */ - for (mcnt = 1; (unsigned) mcnt < MIN (num_regs, regs->num_regs); - mcnt++) - { + for (mcnt = 1; (unsigned) mcnt < MIN (num_regs, regs->num_regs); + mcnt++) + { if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt])) regs->start[mcnt] = regs->end[mcnt] = -1; else { - regs->start[mcnt] - = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]); + regs->start[mcnt] + = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]); regs->end[mcnt] - = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]); + = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]); } - } + } /* If the regs structure we return has more elements than were in the pattern, set the extra elements to -1. If @@ -4192,7 +4192,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) -1 at the end. */ for (mcnt = num_regs; (unsigned) mcnt < regs->num_regs; mcnt++) regs->start[mcnt] = regs->end[mcnt] = -1; - } /* regs && !bufp->no_sub */ + } /* regs && !bufp->no_sub */ DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n", nfailure_points_pushed, nfailure_points_popped, @@ -4200,8 +4200,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed); mcnt = d - pos - (MATCHING_IN_FIRST_STRING - ? string1 - : string2 - size1); + ? string1 + : string2 - size1); DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt); @@ -4211,91 +4211,91 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) /* Otherwise match next pattern command. */ switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) - { + { /* Ignore these. Used to ignore the n of succeed_n's which currently have n == 0. */ case no_op: DEBUG_PRINT1 ("EXECUTING no_op.\n"); break; - case succeed: + case succeed: DEBUG_PRINT1 ("EXECUTING succeed.\n"); - goto succeed_label; + goto succeed_label; /* Match the next n pattern characters exactly. The following byte in the pattern defines n, and the n bytes after that are the characters to match. */ - case exactn: - mcnt = *p++; + case exactn: + mcnt = *p++; DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt); /* This is written out as an if-else so we don't waste time testing `translate' inside the loop. */ if (translate) - { - do - { - PREFETCH (); - if ((unsigned char) translate[(unsigned char) *d++] - != (unsigned char) *p++) + { + do + { + PREFETCH (); + if ((unsigned char) translate[(unsigned char) *d++] + != (unsigned char) *p++) goto fail; - } - while (--mcnt); - } - else - { - do - { - PREFETCH (); - if (*d++ != (char) *p++) goto fail; - } - while (--mcnt); - } - SET_REGS_MATCHED (); + } + while (--mcnt); + } + else + { + do + { + PREFETCH (); + if (*d++ != (char) *p++) goto fail; + } + while (--mcnt); + } + SET_REGS_MATCHED (); break; /* Match any character except possibly a newline or a null. */ - case anychar: + case anychar: DEBUG_PRINT1 ("EXECUTING anychar.\n"); PREFETCH (); if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n') || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000')) - goto fail; + goto fail; SET_REGS_MATCHED (); DEBUG_PRINT2 (" Matched `%d'.\n", *d); d++; - break; + break; - case charset: - case charset_not: - { - register unsigned char c; - boolean not_bool = (re_opcode_t) *(p - 1) == charset_not; + case charset: + case charset_not: + { + register unsigned char c; + boolean not_bool = (re_opcode_t) *(p - 1) == charset_not; DEBUG_PRINT2 ("EXECUTING charset%s.\n", not_bool ? "_not" : ""); - PREFETCH (); - c = TRANSLATE (*d); /* The character to match. */ + PREFETCH (); + c = TRANSLATE (*d); /* The character to match. */ /* Cast to `unsigned' instead of `unsigned char' in case the bit list is a full 32 bytes long. */ - if (c < (unsigned) (*p * BYTEWIDTH) - && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) - not_bool = !not_bool; + if (c < (unsigned) (*p * BYTEWIDTH) + && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) + not_bool = !not_bool; - p += 1 + *p; + p += 1 + *p; - if (!not_bool) goto fail; + if (!not_bool) goto fail; - SET_REGS_MATCHED (); + SET_REGS_MATCHED (); d++; - break; - } + break; + } /* The beginning of a group is represented by start_memory. @@ -4304,10 +4304,10 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) matched within the group is recorded (in the internal registers data structure) under the register number. */ case start_memory: - DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]); + DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]); /* Find out if this group can match the empty string. */ - p1 = p; /* To send to group_match_null_string_p. */ + p1 = p; /* To send to group_match_null_string_p. */ if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE) REG_MATCH_NULL_STRING_P (reg_info[*p]) @@ -4321,17 +4321,17 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) ? REG_UNSET (regstart[*p]) ? d : regstart[*p] : regstart[*p]; - DEBUG_PRINT2 (" old_regstart: %d\n", - POINTER_TO_OFFSET (old_regstart[*p])); + DEBUG_PRINT2 (" old_regstart: %d\n", + POINTER_TO_OFFSET (old_regstart[*p])); regstart[*p] = d; - DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p])); + DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p])); IS_ACTIVE (reg_info[*p]) = 1; MATCHED_SOMETHING (reg_info[*p]) = 0; - /* Clear this whenever we change the register activity status. */ - set_regs_matched_done = 0; + /* Clear this whenever we change the register activity status. */ + set_regs_matched_done = 0; /* This is the new highest active register. */ highest_active_reg = *p; @@ -4343,7 +4343,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) /* Move past the register number and inner group count. */ p += 2; - just_past_start_mem = p; + just_past_start_mem = p; break; @@ -4351,8 +4351,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) /* The stop_memory opcode represents the end of a group. Its arguments are the same as start_memory's: the register number, and the number of inner groups. */ - case stop_memory: - DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]); + case stop_memory: + DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]); /* We need to save the string position the last time we were at this close-group operator in case the group is operated @@ -4361,18 +4361,18 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) the string in case this attempt to match fails. */ old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) ? REG_UNSET (regend[*p]) ? d : regend[*p] - : regend[*p]; - DEBUG_PRINT2 (" old_regend: %d\n", - POINTER_TO_OFFSET (old_regend[*p])); + : regend[*p]; + DEBUG_PRINT2 (" old_regend: %d\n", + POINTER_TO_OFFSET (old_regend[*p])); regend[*p] = d; - DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p])); + DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p])); /* This register isn't active anymore. */ IS_ACTIVE (reg_info[*p]) = 0; - /* Clear this whenever we change the register activity status. */ - set_regs_matched_done = 0; + /* Clear this whenever we change the register activity status. */ + set_regs_matched_done = 0; /* If this was the only register active, nothing is active anymore. */ @@ -4397,7 +4397,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) registers 1 and 2 as a result of the *, but when we pop back to the second ), we are at the stop_memory 1. Thus, nothing is active. */ - if (r == 0) + if (r == 0) { lowest_active_reg = NO_LOWEST_ACTIVE_REG; highest_active_reg = NO_HIGHEST_ACTIVE_REG; @@ -4413,7 +4413,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) last match. */ if ((!MATCHED_SOMETHING (reg_info[*p]) || just_past_start_mem == p - 1) - && (p + 2) < pend) + && (p + 2) < pend) { boolean is_a_jump_n = false; @@ -4422,29 +4422,29 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) switch ((re_opcode_t) *p1++) { case jump_n: - is_a_jump_n = true; + is_a_jump_n = true; case pop_failure_jump: - case maybe_pop_jump: - case jump: - case dummy_failure_jump: + case maybe_pop_jump: + case jump: + case dummy_failure_jump: EXTRACT_NUMBER_AND_INCR (mcnt, p1); - if (is_a_jump_n) - p1 += 2; + if (is_a_jump_n) + p1 += 2; break; default: /* do nothing */ ; } - p1 += mcnt; + p1 += mcnt; /* If the next operation is a jump backwards in the pattern - to an on_failure_jump right before the start_memory + to an on_failure_jump right before the start_memory corresponding to this stop_memory, exit from the loop by forcing a failure after pushing on the stack the on_failure_jump's jump in the pattern, and d. */ if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump && (re_opcode_t) p1[3] == start_memory && p1[4] == *p) - { + { /* If this group ever matched anything, then restore what its registers were before trying this last failed match, e.g., with `(a*)*b' against `ab' for @@ -4456,14 +4456,14 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) otherwise get trashed). */ if (EVER_MATCHED_SOMETHING (reg_info[*p])) - { - unsigned r; + { + unsigned r; EVER_MATCHED_SOMETHING (reg_info[*p]) = 0; - /* Restore this and inner groups' (if any) registers. */ + /* Restore this and inner groups' (if any) registers. */ for (r = *p; r < (unsigned) *p + (unsigned) *(p + 1); - r++) + r++) { regstart[r] = old_regstart[r]; @@ -4472,7 +4472,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) regend[r] = old_regend[r]; } } - p1++; + p1++; EXTRACT_NUMBER_AND_INCR (mcnt, p1); PUSH_FAILURE_POINT (p1 + mcnt, d, -2); @@ -4485,15 +4485,15 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) break; - /* \ has been turned into a `duplicate' command which is + /* \ has been turned into a `duplicate' command which is followed by the numeric value of as the register number. */ case duplicate: - { - register const char *d2, *dend2; - int regno = *p++; /* Get which register to match against. */ - DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno); + { + register const char *d2, *dend2; + int regno = *p++; /* Get which register to match against. */ + DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno); - /* Can't back reference a group which we've never matched. */ + /* Can't back reference a group which we've never matched. */ if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno])) goto fail; @@ -4506,54 +4506,54 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) the end of the first string. */ dend2 = ((FIRST_STRING_P (regstart[regno]) - == FIRST_STRING_P (regend[regno])) - ? regend[regno] : end_match_1); - for (;;) - { - /* If necessary, advance to next segment in register + == FIRST_STRING_P (regend[regno])) + ? regend[regno] : end_match_1); + for (;;) + { + /* If necessary, advance to next segment in register contents. */ - while (d2 == dend2) - { - if (dend2 == end_match_2) break; - if (dend2 == regend[regno]) break; + while (d2 == dend2) + { + if (dend2 == end_match_2) break; + if (dend2 == regend[regno]) break; /* End of string1 => advance to string2. */ d2 = string2; dend2 = regend[regno]; - } - /* At end of register contents => success */ - if (d2 == dend2) break; + } + /* At end of register contents => success */ + if (d2 == dend2) break; - /* If necessary, advance to next segment in data. */ - PREFETCH (); + /* If necessary, advance to next segment in data. */ + PREFETCH (); - /* How many characters left in this segment to match. */ - mcnt = dend - d; + /* How many characters left in this segment to match. */ + mcnt = dend - d; - /* Want how many consecutive characters we can match in + /* Want how many consecutive characters we can match in one shot, so, if necessary, adjust the count. */ if (mcnt > dend2 - d2) - mcnt = dend2 - d2; + mcnt = dend2 - d2; - /* Compare that many; failure if mismatch, else move + /* Compare that many; failure if mismatch, else move past them. */ - if (translate + if (translate ? bcmp_translate (d, d2, mcnt, translate) : memcmp (d, d2, mcnt)) - goto fail; - d += mcnt, d2 += mcnt; + goto fail; + d += mcnt, d2 += mcnt; - /* Do this because we've match some characters. */ - SET_REGS_MATCHED (); - } - } - break; + /* Do this because we've match some characters. */ + SET_REGS_MATCHED (); + } + } + break; /* begline matches the empty string at the beginning of the string (unless `not_bol' is set in `bufp'), and, if `newline_anchor' is set, after newlines. */ - case begline: + case begline: DEBUG_PRINT1 ("EXECUTING begline.\n"); if (AT_STRINGS_BEG (d)) @@ -4569,7 +4569,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) /* endline is the dual of begline. */ - case endline: + case endline: DEBUG_PRINT1 ("EXECUTING endline.\n"); if (AT_STRINGS_END (d)) @@ -4586,7 +4586,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) goto fail; - /* Match at the very beginning of the data. */ + /* Match at the very beginning of the data. */ case begbuf: DEBUG_PRINT1 ("EXECUTING begbuf.\n"); if (AT_STRINGS_BEG (d)) @@ -4594,11 +4594,11 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) goto fail; - /* Match at the very end of the data. */ + /* Match at the very end of the data. */ case endbuf: DEBUG_PRINT1 ("EXECUTING endbuf.\n"); - if (AT_STRINGS_END (d)) - break; + if (AT_STRINGS_END (d)) + break; goto fail; @@ -4632,7 +4632,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) break; - /* Uses of on_failure_jump: + /* Uses of on_failure_jump: Each alternative starts with an on_failure_jump that points to the beginning of the next alternative. Each alternative @@ -4644,7 +4644,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) Repeats start with an on_failure_jump that points past both the repetition text and either the following jump or pop_failure_jump back to this on_failure_jump. */ - case on_failure_jump: + case on_failure_jump: on_failure: DEBUG_PRINT1 ("EXECUTING on_failure_jump"); @@ -4690,12 +4690,12 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) /* A smart repeat ends with `maybe_pop_jump'. - We change it to either `pop_failure_jump' or `jump'. */ + We change it to either `pop_failure_jump' or `jump'. */ case maybe_pop_jump: EXTRACT_NUMBER_AND_INCR (mcnt, p); DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt); { - register unsigned char *p2 = p; + register unsigned char *p2 = p; /* Compare the beginning of the repeat with what in the pattern follows its end. If we can establish that there @@ -4710,141 +4710,141 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) detect that here, the alternative has put on a dummy failure point which is what we will end up popping. */ - /* Skip over open/close-group commands. - If what follows this loop is a ...+ construct, - look at what begins its body, since we will have to - match at least one of that. */ - while (1) - { - if (p2 + 2 < pend - && ((re_opcode_t) *p2 == stop_memory - || (re_opcode_t) *p2 == start_memory)) - p2 += 3; - else if (p2 + 6 < pend - && (re_opcode_t) *p2 == dummy_failure_jump) - p2 += 6; - else - break; - } + /* Skip over open/close-group commands. + If what follows this loop is a ...+ construct, + look at what begins its body, since we will have to + match at least one of that. */ + while (1) + { + if (p2 + 2 < pend + && ((re_opcode_t) *p2 == stop_memory + || (re_opcode_t) *p2 == start_memory)) + p2 += 3; + else if (p2 + 6 < pend + && (re_opcode_t) *p2 == dummy_failure_jump) + p2 += 6; + else + break; + } - p1 = p + mcnt; - /* p1[0] ... p1[2] are the `on_failure_jump' corresponding - to the `maybe_finalize_jump' of this case. Examine what - follows. */ + p1 = p + mcnt; + /* p1[0] ... p1[2] are the `on_failure_jump' corresponding + to the `maybe_finalize_jump' of this case. Examine what + follows. */ /* If we're at the end of the pattern, we can change. */ if (p2 == pend) - { - /* Consider what happens when matching ":\(.*\)" - against ":/". I don't really understand this code - yet. */ - p[-3] = (unsigned char) pop_failure_jump; + { + /* Consider what happens when matching ":\(.*\)" + against ":/". I don't really understand this code + yet. */ + p[-3] = (unsigned char) pop_failure_jump; DEBUG_PRINT1 (" End of pattern: change to `pop_failure_jump'.\n"); } else if ((re_opcode_t) *p2 == exactn - || (bufp->newline_anchor && (re_opcode_t) *p2 == endline)) - { - register unsigned char c + || (bufp->newline_anchor && (re_opcode_t) *p2 == endline)) + { + register unsigned char c = *p2 == (unsigned char) endline ? '\n' : p2[2]; if ((re_opcode_t) p1[3] == exactn && p1[5] != c) { - p[-3] = (unsigned char) pop_failure_jump; + p[-3] = (unsigned char) pop_failure_jump; DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", c, p1[5]); } - else if ((re_opcode_t) p1[3] == charset - || (re_opcode_t) p1[3] == charset_not) - { - int not_int = (re_opcode_t) p1[3] == charset_not; + else if ((re_opcode_t) p1[3] == charset + || (re_opcode_t) p1[3] == charset_not) + { + int not_int = (re_opcode_t) p1[3] == charset_not; - if (c < (unsigned char) (p1[4] * BYTEWIDTH) - && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) - not_int = !not_int; + if (c < (unsigned char) (p1[4] * BYTEWIDTH) + && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) + not_int = !not_int; /* `not' is equal to 1 if c would match, which means that we can't change to pop_failure_jump. */ - if (!not_int) + if (!not_int) { - p[-3] = (unsigned char) pop_failure_jump; + p[-3] = (unsigned char) pop_failure_jump; DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); } - } - } + } + } else if ((re_opcode_t) *p2 == charset) - { + { #ifdef DEBUG - register unsigned char c + register unsigned char c = *p2 == (unsigned char) endline ? '\n' : p2[2]; #endif #if 0 if ((re_opcode_t) p1[3] == exactn - && ! ((int) p2[1] * BYTEWIDTH > (int) p1[5] - && (p2[2 + p1[5] / BYTEWIDTH] - & (1 << (p1[5] % BYTEWIDTH))))) + && ! ((int) p2[1] * BYTEWIDTH > (int) p1[5] + && (p2[2 + p1[5] / BYTEWIDTH] + & (1 << (p1[5] % BYTEWIDTH))))) #else if ((re_opcode_t) p1[3] == exactn - && ! ((int) p2[1] * BYTEWIDTH > (int) p1[4] - && (p2[2 + p1[4] / BYTEWIDTH] - & (1 << (p1[4] % BYTEWIDTH))))) + && ! ((int) p2[1] * BYTEWIDTH > (int) p1[4] + && (p2[2 + p1[4] / BYTEWIDTH] + & (1 << (p1[4] % BYTEWIDTH))))) #endif { - p[-3] = (unsigned char) pop_failure_jump; + p[-3] = (unsigned char) pop_failure_jump; DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", c, p1[5]); } - else if ((re_opcode_t) p1[3] == charset_not) - { - int idx; - /* We win if the charset_not inside the loop - lists every character listed in the charset after. */ - for (idx = 0; idx < (int) p2[1]; idx++) - if (! (p2[2 + idx] == 0 - || (idx < (int) p1[4] - && ((p2[2 + idx] & ~ p1[5 + idx]) == 0)))) - break; + else if ((re_opcode_t) p1[3] == charset_not) + { + int idx; + /* We win if the charset_not inside the loop + lists every character listed in the charset after. */ + for (idx = 0; idx < (int) p2[1]; idx++) + if (! (p2[2 + idx] == 0 + || (idx < (int) p1[4] + && ((p2[2 + idx] & ~ p1[5 + idx]) == 0)))) + break; - if (idx == p2[1]) + if (idx == p2[1]) { - p[-3] = (unsigned char) pop_failure_jump; + p[-3] = (unsigned char) pop_failure_jump; DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); } - } - else if ((re_opcode_t) p1[3] == charset) - { - int idx; - /* We win if the charset inside the loop - has no overlap with the one after the loop. */ - for (idx = 0; - idx < (int) p2[1] && idx < (int) p1[4]; - idx++) - if ((p2[2 + idx] & p1[5 + idx]) != 0) - break; + } + else if ((re_opcode_t) p1[3] == charset) + { + int idx; + /* We win if the charset inside the loop + has no overlap with the one after the loop. */ + for (idx = 0; + idx < (int) p2[1] && idx < (int) p1[4]; + idx++) + if ((p2[2 + idx] & p1[5 + idx]) != 0) + break; - if (idx == p2[1] || idx == p1[4]) + if (idx == p2[1] || idx == p1[4]) { - p[-3] = (unsigned char) pop_failure_jump; + p[-3] = (unsigned char) pop_failure_jump; DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); } - } - } - } - p -= 2; /* Point at relative address again. */ - if ((re_opcode_t) p[-1] != pop_failure_jump) - { - p[-1] = (unsigned char) jump; + } + } + } + p -= 2; /* Point at relative address again. */ + if ((re_opcode_t) p[-1] != pop_failure_jump) + { + p[-1] = (unsigned char) jump; DEBUG_PRINT1 (" Match => jump.\n"); - goto unconditional_jump; - } + goto unconditional_jump; + } /* Note fall through. */ - /* The end of a simple repeat has a pop_failure_jump back to + /* The end of a simple repeat has a pop_failure_jump back to its matching on_failure_jump, where the latter will push a failure point. The pop_failure_jump takes off failure points put on by this pop_failure_jump's matching @@ -4866,27 +4866,27 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) dummy_low_reg, dummy_high_reg, reg_dummy, reg_dummy, reg_info_dummy); } - /* Note fall through. */ + /* Note fall through. */ - unconditional_jump: + unconditional_jump: #ifdef _LIBC - DEBUG_PRINT2 ("\n%p: ", p); + DEBUG_PRINT2 ("\n%p: ", p); #else - DEBUG_PRINT2 ("\n0x%x: ", p); + DEBUG_PRINT2 ("\n0x%x: ", p); #endif /* Note fall through. */ /* Unconditionally jump (without popping any failure points). */ case jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ + EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); - p += mcnt; /* Do the jump. */ + p += mcnt; /* Do the jump. */ #ifdef _LIBC DEBUG_PRINT2 ("(to %p).\n", p); #else DEBUG_PRINT2 ("(to 0x%x).\n", p); #endif - break; + break; /* We need this opcode so we can detect where alternatives end @@ -4932,7 +4932,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) if (mcnt > 0) { mcnt--; - p += 2; + p += 2; STORE_NUMBER_AND_INCR (p, mcnt); #ifdef _LIBC DEBUG_PRINT3 (" Setting %p to %d.\n", p - 2, mcnt); @@ -4940,14 +4940,14 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p - 2, mcnt); #endif } - else if (mcnt == 0) + else if (mcnt == 0) { #ifdef _LIBC DEBUG_PRINT2 (" Setting two bytes from %p to no_op.\n", p+2); #else DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2); #endif - p[2] = (unsigned char) no_op; + p[2] = (unsigned char) no_op; p[3] = (unsigned char) no_op; goto on_failure; } @@ -4967,15 +4967,15 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) #else DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p + 2, mcnt); #endif - goto unconditional_jump; + goto unconditional_jump; } /* If don't have to jump any more, skip over the rest of command. */ - else - p += 4; + else + p += 4; break; - case set_number_at: - { + case set_number_at: + { DEBUG_PRINT1 ("EXECUTING set_number_at.\n"); EXTRACT_NUMBER_AND_INCR (mcnt, p); @@ -4986,155 +4986,155 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) #else DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt); #endif - STORE_NUMBER (p1, mcnt); + STORE_NUMBER (p1, mcnt); break; } #if 0 - /* The DEC Alpha C compiler 3.x generates incorrect code for the - test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of - AT_WORD_BOUNDARY, so this code is disabled. Expanding the - macro and introducing temporary variables works around the bug. */ + /* The DEC Alpha C compiler 3.x generates incorrect code for the + test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of + AT_WORD_BOUNDARY, so this code is disabled. Expanding the + macro and introducing temporary variables works around the bug. */ - case wordbound: - DEBUG_PRINT1 ("EXECUTING wordbound.\n"); - if (AT_WORD_BOUNDARY (d)) - break; - goto fail; + case wordbound: + DEBUG_PRINT1 ("EXECUTING wordbound.\n"); + if (AT_WORD_BOUNDARY (d)) + break; + goto fail; - case notwordbound: - DEBUG_PRINT1 ("EXECUTING notwordbound.\n"); - if (AT_WORD_BOUNDARY (d)) - goto fail; - break; + case notwordbound: + DEBUG_PRINT1 ("EXECUTING notwordbound.\n"); + if (AT_WORD_BOUNDARY (d)) + goto fail; + break; #else - case wordbound: - { - boolean prevchar, thischar; + case wordbound: + { + boolean prevchar, thischar; - DEBUG_PRINT1 ("EXECUTING wordbound.\n"); - if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) - break; + DEBUG_PRINT1 ("EXECUTING wordbound.\n"); + if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) + break; - prevchar = WORDCHAR_P (d - 1); - thischar = WORDCHAR_P (d); - if (prevchar != thischar) - break; - goto fail; - } + prevchar = WORDCHAR_P (d - 1); + thischar = WORDCHAR_P (d); + if (prevchar != thischar) + break; + goto fail; + } case notwordbound: - { - boolean prevchar, thischar; + { + boolean prevchar, thischar; - DEBUG_PRINT1 ("EXECUTING notwordbound.\n"); - if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) - goto fail; + DEBUG_PRINT1 ("EXECUTING notwordbound.\n"); + if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) + goto fail; - prevchar = WORDCHAR_P (d - 1); - thischar = WORDCHAR_P (d); - if (prevchar != thischar) - goto fail; - break; - } + prevchar = WORDCHAR_P (d - 1); + thischar = WORDCHAR_P (d); + if (prevchar != thischar) + goto fail; + break; + } #endif - case wordbeg: + case wordbeg: DEBUG_PRINT1 ("EXECUTING wordbeg.\n"); - if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1))) - break; + if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1))) + break; goto fail; - case wordend: + case wordend: DEBUG_PRINT1 ("EXECUTING wordend.\n"); - if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1) + if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1) && (!WORDCHAR_P (d) || AT_STRINGS_END (d))) - break; + break; goto fail; #ifdef emacs - case before_dot: + case before_dot: DEBUG_PRINT1 ("EXECUTING before_dot.\n"); - if (PTR_CHAR_POS ((unsigned char *) d) >= point) - goto fail; - break; + if (PTR_CHAR_POS ((unsigned char *) d) >= point) + goto fail; + break; - case at_dot: + case at_dot: DEBUG_PRINT1 ("EXECUTING at_dot.\n"); - if (PTR_CHAR_POS ((unsigned char *) d) != point) - goto fail; - break; + if (PTR_CHAR_POS ((unsigned char *) d) != point) + goto fail; + break; - case after_dot: + case after_dot: DEBUG_PRINT1 ("EXECUTING after_dot.\n"); if (PTR_CHAR_POS ((unsigned char *) d) <= point) - goto fail; - break; + goto fail; + break; - case syntaxspec: + case syntaxspec: DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt); - mcnt = *p++; - goto matchsyntax; + mcnt = *p++; + goto matchsyntax; case wordchar: DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n"); - mcnt = (int) Sword; + mcnt = (int) Sword; matchsyntax: - PREFETCH (); - /* Can't use *d++ here; SYNTAX may be an unsafe macro. */ - d++; - if (SYNTAX (d[-1]) != (enum syntaxcode) mcnt) - goto fail; + PREFETCH (); + /* Can't use *d++ here; SYNTAX may be an unsafe macro. */ + d++; + if (SYNTAX (d[-1]) != (enum syntaxcode) mcnt) + goto fail; SET_REGS_MATCHED (); - break; + break; - case notsyntaxspec: + case notsyntaxspec: DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt); - mcnt = *p++; - goto matchnotsyntax; + mcnt = *p++; + goto matchnotsyntax; case notwordchar: DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n"); - mcnt = (int) Sword; + mcnt = (int) Sword; matchnotsyntax: - PREFETCH (); - /* Can't use *d++ here; SYNTAX may be an unsafe macro. */ - d++; - if (SYNTAX (d[-1]) == (enum syntaxcode) mcnt) - goto fail; - SET_REGS_MATCHED (); + PREFETCH (); + /* Can't use *d++ here; SYNTAX may be an unsafe macro. */ + d++; + if (SYNTAX (d[-1]) == (enum syntaxcode) mcnt) + goto fail; + SET_REGS_MATCHED (); break; #else /* not emacs */ - case wordchar: + case wordchar: DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n"); - PREFETCH (); + PREFETCH (); if (!WORDCHAR_P (d)) goto fail; - SET_REGS_MATCHED (); + SET_REGS_MATCHED (); d++; - break; + break; - case notwordchar: + case notwordchar: DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n"); - PREFETCH (); - if (WORDCHAR_P (d)) + PREFETCH (); + if (WORDCHAR_P (d)) goto fail; SET_REGS_MATCHED (); d++; - break; + break; #endif /* not emacs */ default: abort (); - } + } continue; /* Successfully executed one pattern command; keep going. */ /* We goto here if a matching operation fails. */ fail: if (!FAIL_STACK_EMPTY ()) - { /* A restart point is known. Restore to that state. */ + { /* A restart point is known. Restore to that state. */ DEBUG_PRINT1 ("\nFAIL:\n"); POP_FAILURE_POINT (d, p, lowest_active_reg, highest_active_reg, @@ -5142,10 +5142,10 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) /* If this failure point is a dummy, try the next one. */ if (!p) - goto fail; + goto fail; /* If we failed to the end of the pattern, don't examine *p. */ - assert (p <= pend); + assert (p <= pend); if (p < pend) { boolean is_a_jump_n = false; @@ -5174,7 +5174,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) } if (d >= string1 && d <= end1) - dend = end_match_1; + dend = end_match_1; } else break; /* Matching at this starting point really fails. */ @@ -5185,7 +5185,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) FREE_VARIABLES (); - return -1; /* Failure to match. */ + return -1; /* Failure to match. */ } /* re_match_2 */ /* Subroutine definitions for re_match_2. */ @@ -5213,7 +5213,7 @@ group_match_null_string_p (p, end, reg_info) while (p1 < end) { /* Skip over opcodes that can match nothing, and return true or - false, as appropriate, when we get to one that can't, or to the + false, as appropriate, when we get to one that can't, or to the matching stop_memory. */ switch ((re_opcode_t) *p1) @@ -5224,10 +5224,10 @@ group_match_null_string_p (p, end, reg_info) EXTRACT_NUMBER_AND_INCR (mcnt, p1); /* If the next operation is not a jump backwards in the - pattern. */ + pattern. */ - if (mcnt >= 0) - { + if (mcnt >= 0) + { /* Go through the on_failure_jumps of the alternatives, seeing if any of the alternatives cannot match nothing. The last alternative starts with only a jump, @@ -5253,11 +5253,11 @@ group_match_null_string_p (p, end, reg_info) its number. */ if (!alt_match_null_string_p (p1, p1 + mcnt - 3, - reg_info)) + reg_info)) return false; /* Move to right after this alternative, including the - jump_past_alt. */ + jump_past_alt. */ p1 += mcnt; /* Break if it's the beginning of an n-th alternative @@ -5265,13 +5265,13 @@ group_match_null_string_p (p, end, reg_info) if ((re_opcode_t) *p1 != on_failure_jump) break; - /* Still have to check that it's not an n-th - alternative that starts with an on_failure_jump. */ - p1++; + /* Still have to check that it's not an n-th + alternative that starts with an on_failure_jump. */ + p1++; EXTRACT_NUMBER_AND_INCR (mcnt, p1); if ((re_opcode_t) p1[mcnt-3] != jump_past_alt) { - /* Get to the beginning of the n-th alternative. */ + /* Get to the beginning of the n-th alternative. */ p1 -= 3; break; } @@ -5285,13 +5285,13 @@ group_match_null_string_p (p, end, reg_info) if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info)) return false; - p1 += mcnt; /* Get past the n-th alternative. */ + p1 += mcnt; /* Get past the n-th alternative. */ } /* if mcnt > 0 */ break; case stop_memory: - assert (p1[1] == **p); + assert (p1[1] == **p); *p = p1 + 2; return true; @@ -5325,14 +5325,14 @@ alt_match_null_string_p (p, end, reg_info) switch ((re_opcode_t) *p1) { - /* It's a loop. */ + /* It's a loop. */ case on_failure_jump: p1++; EXTRACT_NUMBER_AND_INCR (mcnt, p1); p1 += mcnt; break; - default: + default: if (!common_op_match_null_string_p (&p1, end, reg_info)) return false; } @@ -5515,7 +5515,7 @@ re_comp (s) if (!s) { if (!re_comp_buf.buffer) - return gettext ("No previous regular expression"); + return gettext ("No previous regular expression"); return 0; } @@ -5528,7 +5528,7 @@ re_comp (s) re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH); if (re_comp_buf.fastmap == NULL) - return (char *) gettext (re_error_msgid[(int) REG_ESPACE]); + return (char *) gettext (re_error_msgid[(int) REG_ESPACE]); } /* Since `re_exec' always passes NULL for the `regs' argument, we @@ -5624,8 +5624,8 @@ regcomp (preg, pattern, cflags) unsigned i; preg->translate - = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE - * sizeof (*(RE_TRANSLATE_TYPE)0)); + = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE + * sizeof (*(RE_TRANSLATE_TYPE)0)); if (preg->translate == NULL) return (int) REG_ESPACE; @@ -5660,14 +5660,14 @@ regcomp (preg, pattern, cflags) if (ret == REG_NOERROR && preg->fastmap) { /* Compute the fastmap now, since regexec cannot modify the pattern - buffer. */ + buffer. */ if (re_compile_fastmap (preg) == -2) - { - /* Some error occured while computing the fastmap, just forget - about it. */ - free (preg->fastmap); - preg->fastmap = NULL; - } + { + /* Some error occured while computing the fastmap, just forget + about it. */ + free (preg->fastmap); + preg->fastmap = NULL; + } } return (int) ret; @@ -5770,7 +5770,7 @@ regerror (errcode, preg, errbuf, errbuf_size) if (errcode < 0 || errcode >= (int) (sizeof (re_error_msgid) - / sizeof (re_error_msgid[0]))) + / sizeof (re_error_msgid[0]))) /* Only error codes returned by the rest of the code should be passed to this routine. If we are given anything else, or if other regex code generates an invalid error code, then the program has a bug. @@ -5786,7 +5786,7 @@ regerror (errcode, preg, errbuf, errbuf_size) if (msg_size > errbuf_size) { #if defined HAVE_MEMPCPY || defined _LIBC - *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; + *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; #else memcpy (errbuf, msg, errbuf_size - 1); errbuf[errbuf_size - 1] = 0; diff --git a/goldlib/glibc/regex.h b/goldlib/glibc/regex.h index 33d77b0..c1ac1d3 100644 --- a/goldlib/glibc/regex.h +++ b/goldlib/glibc/regex.h @@ -174,33 +174,33 @@ extern reg_syntax_t re_syntax_options; /* [[[begin syntaxes]]] */ #define RE_SYNTAX_EMACS 0 -#define RE_SYNTAX_AWK \ - (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ - | RE_NO_BK_PARENS | RE_NO_BK_REFS \ - | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ - | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \ +#define RE_SYNTAX_AWK \ + (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ + | RE_NO_BK_PARENS | RE_NO_BK_REFS \ + | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ + | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \ | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS) -#define RE_SYNTAX_GNU_AWK \ - ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \ +#define RE_SYNTAX_GNU_AWK \ + ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \ & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS)) -#define RE_SYNTAX_POSIX_AWK \ - (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ - | RE_INTERVALS | RE_NO_GNU_OPS) +#define RE_SYNTAX_POSIX_AWK \ + (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ + | RE_INTERVALS | RE_NO_GNU_OPS) -#define RE_SYNTAX_GREP \ - (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ - | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ +#define RE_SYNTAX_GREP \ + (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ + | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ | RE_NEWLINE_ALT) -#define RE_SYNTAX_EGREP \ - (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ - | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ - | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ +#define RE_SYNTAX_EGREP \ + (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ + | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ + | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ | RE_NO_BK_VBAR) -#define RE_SYNTAX_POSIX_EGREP \ +#define RE_SYNTAX_POSIX_EGREP \ (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES) /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */ @@ -209,32 +209,32 @@ extern reg_syntax_t re_syntax_options; #define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC /* Syntax bits common to both basic and extended POSIX regex syntax. */ -#define _RE_SYNTAX_POSIX_COMMON \ - (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \ +#define _RE_SYNTAX_POSIX_COMMON \ + (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \ | RE_INTERVALS | RE_NO_EMPTY_RANGES) -#define RE_SYNTAX_POSIX_BASIC \ +#define RE_SYNTAX_POSIX_BASIC \ (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM) /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this isn't minimal, since other operators, such as \`, aren't disabled. */ -#define RE_SYNTAX_POSIX_MINIMAL_BASIC \ +#define RE_SYNTAX_POSIX_MINIMAL_BASIC \ (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS) -#define RE_SYNTAX_POSIX_EXTENDED \ - (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ - | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \ - | RE_NO_BK_PARENS | RE_NO_BK_VBAR \ +#define RE_SYNTAX_POSIX_EXTENDED \ + (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ + | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \ + | RE_NO_BK_PARENS | RE_NO_BK_VBAR \ | RE_UNMATCHED_RIGHT_PAREN_ORD) /* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */ -#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \ - (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ - | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \ - | RE_NO_BK_PARENS | RE_NO_BK_REFS \ - | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD) +#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \ + (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ + | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \ + | RE_NO_BK_PARENS | RE_NO_BK_REFS \ + | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD) /* [[[end syntaxes]]] */ /* Maximum number of duplicates an interval can allow. Some systems @@ -285,31 +285,31 @@ extern reg_syntax_t re_syntax_options; typedef enum { #ifdef _XOPEN_SOURCE - REG_ENOSYS = -1, /* This will never happen for this implementation. */ + REG_ENOSYS = -1, /* This will never happen for this implementation. */ #endif - REG_NOERROR = 0, /* Success. */ - REG_NOMATCH, /* Didn't find a match (for regexec). */ + REG_NOERROR = 0, /* Success. */ + REG_NOMATCH, /* Didn't find a match (for regexec). */ /* POSIX regcomp return error codes. (In the order listed in the standard.) */ - REG_BADPAT, /* Invalid pattern. */ - REG_ECOLLATE, /* Not implemented. */ - REG_ECTYPE, /* Invalid character class name. */ - REG_EESCAPE, /* Trailing backslash. */ - REG_ESUBREG, /* Invalid back reference. */ - REG_EBRACK, /* Unmatched left bracket. */ - REG_EPAREN, /* Parenthesis imbalance. */ - REG_EBRACE, /* Unmatched \{. */ - REG_BADBR, /* Invalid contents of \{\}. */ - REG_ERANGE, /* Invalid range end. */ - REG_ESPACE, /* Ran out of memory. */ - REG_BADRPT, /* No preceding re for repetition op. */ + REG_BADPAT, /* Invalid pattern. */ + REG_ECOLLATE, /* Not implemented. */ + REG_ECTYPE, /* Invalid character class name. */ + REG_EESCAPE, /* Trailing backslash. */ + REG_ESUBREG, /* Invalid back reference. */ + REG_EBRACK, /* Unmatched left bracket. */ + REG_EPAREN, /* Parenthesis imbalance. */ + REG_EBRACE, /* Unmatched \{. */ + REG_BADBR, /* Invalid contents of \{\}. */ + REG_ERANGE, /* Invalid range end. */ + REG_ESPACE, /* Ran out of memory. */ + REG_BADRPT, /* No preceding re for repetition op. */ /* Error codes we've added. */ - REG_EEND, /* Premature end. */ - REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */ - REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ + REG_EEND, /* Premature end. */ + REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */ + REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ } reg_errcode_t; /* This data structure represents a compiled pattern. Before calling @@ -325,15 +325,15 @@ typedef enum struct re_pattern_buffer { /* [[[begin pattern_buffer]]] */ - /* Space that holds the compiled pattern. It is declared as + /* Space that holds the compiled pattern. It is declared as `unsigned char *' because its elements are sometimes used as array indexes. */ unsigned char *buffer; - /* Number of bytes to which `buffer' points. */ + /* Number of bytes to which `buffer' points. */ unsigned long int allocated; - /* Number of bytes actually used in `buffer'. */ + /* Number of bytes actually used in `buffer'. */ unsigned long int used; /* Syntax setting with which the pattern was compiled. */ @@ -350,7 +350,7 @@ struct re_pattern_buffer when it is matched. */ RE_TRANSLATE_TYPE translate; - /* Number of subexpressions found by the compiler. */ + /* Number of subexpressions found by the compiler. */ size_t re_nsub; /* Zero if this pattern cannot match the empty string, one else. @@ -539,21 +539,21 @@ extern int re_exec _RE_ARGS ((const char *)); /* POSIX compatibility. */ extern int __regcomp _RE_ARGS ((regex_t *__preg, const char *__pattern, - int __cflags)); + int __cflags)); extern int regcomp _RE_ARGS ((regex_t *__preg, const char *__pattern, - int __cflags)); + int __cflags)); extern int __regexec _RE_ARGS ((const regex_t *__preg, - const char *__string, size_t __nmatch, - regmatch_t __pmatch[], int __eflags)); + const char *__string, size_t __nmatch, + regmatch_t __pmatch[], int __eflags)); extern int regexec _RE_ARGS ((const regex_t *__preg, - const char *__string, size_t __nmatch, - regmatch_t __pmatch[], int __eflags)); + const char *__string, size_t __nmatch, + regmatch_t __pmatch[], int __eflags)); extern size_t __regerror _RE_ARGS ((int __errcode, const regex_t *__preg, - char *__errbuf, size_t __errbuf_size)); + char *__errbuf, size_t __errbuf_size)); extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg, - char *__errbuf, size_t __errbuf_size)); + char *__errbuf, size_t __errbuf_size)); extern void __regfree _RE_ARGS ((regex_t *__preg)); extern void regfree _RE_ARGS ((regex_t *__preg)); @@ -561,7 +561,7 @@ extern void regfree _RE_ARGS ((regex_t *__preg)); #ifdef __cplusplus } -#endif /* C++ */ +#endif /* C++ */ #endif /* regex.h */ diff --git a/goldlib/gmb3/gmo_msg.h b/goldlib/gmb3/gmo_msg.h index f9686ed..65acd04 100644 --- a/goldlib/gmb3/gmo_msg.h +++ b/goldlib/gmb3/gmo_msg.h @@ -81,7 +81,7 @@ const uint GLINE_POSI = 0x0100; const uint GLINE_HIGH = 0x0200; const uint GLINE_TAGL = 0x0400; const uint GLINE_SIGN = 0x0800; -const uint GLINE_NOAL = 0x1000; // text is not allocated +const uint GLINE_NOAL = 0x1000; // text is not allocated const uint GLINE_KLUDGE = GLINE_HIDD | GLINE_KLUD; const uint GLINE_ALL = GLINE_HIDD | GLINE_KLUD | GLINE_QUOT; diff --git a/goldlib/msgidlib/fexist.c b/goldlib/msgidlib/fexist.c index 80b58a5..252087a 100755 --- a/goldlib/msgidlib/fexist.c +++ b/goldlib/msgidlib/fexist.c @@ -150,15 +150,15 @@ long fsize(const char *filename) if (ff) { #ifndef UNIX - ret = ff->ff_fsize; - if (ret != -1L) { + ret = ff->ff_fsize; + if (ret != -1L) { #endif - fp = fopen(filename, "rb"); - fseek(fp, 0, SEEK_END); - ret = ftell(fp); - fclose(fp); + fp = fopen(filename, "rb"); + fseek(fp, 0, SEEK_END); + ret = ftell(fp); + fclose(fp); #ifndef UNIX - }; + }; #endif FFindClose(ff); } diff --git a/goldlib/msgidlib/ffind.c b/goldlib/msgidlib/ffind.c index 8e1b636..f5e44bf 100755 --- a/goldlib/msgidlib/ffind.c +++ b/goldlib/msgidlib/ffind.c @@ -139,11 +139,11 @@ FFIND *FFindOpen(const char *filespec, uint16_t attribute) strcpy(ff->lastbit, filespec); } else if (p == filespec) - { - strcpy(ff->firstbit, "/"); - strcpy(ff->lastbit, filespec+1); - } - else + { + strcpy(ff->firstbit, "/"); + strcpy(ff->lastbit, filespec+1); + } + else { memcpy(ff->firstbit, filespec, p - filespec); ff->firstbit[p - filespec] = '\0'; @@ -168,9 +168,9 @@ FFIND *FFindOpen(const char *filespec, uint16_t attribute) { strncpy(ff->ff_name, de->d_name, sizeof ff->ff_name); ff->ff_name[sizeof(ff->ff_name) - 1] = '\0'; - ff->ff_fsize = -1L; /* All who wants to know it's size - * must read it by himself - */ + ff->ff_fsize = -1L; /* All who wants to know it's size + * must read it by himself + */ fin = 1; } } @@ -341,10 +341,10 @@ int FFindNext(FFIND * ff) { strncpy(ff->ff_name, de->d_name, sizeof ff->ff_name); ff->ff_name[sizeof(ff->ff_name) - 1] = '\0'; - ff->ff_fsize = -1L; /* All who wants to know it's size - * must read it by himself - */ - fin = 1; + ff->ff_fsize = -1L; /* All who wants to know it's size + * must read it by himself + */ + fin = 1; rc = 0; } } diff --git a/goldlib/msgidlib/genmsgid.c b/goldlib/msgidlib/genmsgid.c index 153f684..2d21c76 100755 --- a/goldlib/msgidlib/genmsgid.c +++ b/goldlib/msgidlib/genmsgid.c @@ -46,138 +46,138 @@ #include "hsksupp.h" #include "ffind.h" -#define MAX_OUTRUN (3ul*365*24*60*60) /* 3 year */ +#define MAX_OUTRUN (3ul*365*24*60*60) /* 3 year */ #define GenMsgIdErr(a) { if (errstr!=NULL) { *errstr = a; } } dword oldGenMsgId(void) { - dword seq = (dword)time(NULL); - sleep(1); - return seq; + dword seq = (dword)time(NULL); + sleep(1); + return seq; } dword GenMsgIdEx(char *seqdir, unsigned long max_outrun, dword (*altGenMsgId)(void), char **errstr) { - dword seq, n, curtime; - FFIND *ff; - char *seqpath, max_fname[13], *new_fname, *pname, *p; - int h, try; + dword seq, n, curtime; + FFIND *ff; + char *seqpath, max_fname[13], *new_fname, *pname, *p; + int h, try; - if (altGenMsgId == NULL) - altGenMsgId = oldGenMsgId; - GenMsgIdErr(NULL); + if (altGenMsgId == NULL) + altGenMsgId = oldGenMsgId; + GenMsgIdErr(NULL); - if (seqdir == NULL || *seqdir == '\0') { - seqdir = getenv("SEQDIR"); - if (seqdir == NULL || *seqdir == '\0') { - /* warning: no SEQDIR defined, fall to ugly old algorythm */ - GenMsgIdErr("no SEQDIR defined"); - return (*altGenMsgId)(); - } - } - seqpath = malloc(strlen(seqdir)+13); - strcpy(seqpath, seqdir); - pname = seqpath + strlen(seqpath); - if (*seqpath && strchr("/\\", seqpath[strlen(seqpath)-1]) == NULL) - *pname++ = PATH_DELIM; - new_fname = NULL; - if (max_outrun == 0) { - p = getenv("SEQOUT"); - if ( p && isdigit((int)(*p)) ) { - max_outrun = (unsigned long)atol(p); - switch (tolower(p[strlen(p) - 1])) { - case 'y': max_outrun *= 365; - case 'd': max_outrun *= 24; - case 'h': max_outrun *= 60*60; - break; - case 'w': max_outrun *= (7l*24*60*60); - break; - case 'm': max_outrun *= (31l*24*60*60); - break; - } - } - else max_outrun = MAX_OUTRUN; - } - for (try=0;;try++) { - curtime = (dword)time(NULL); - seq = 0; - max_fname[0] = '\0'; - strcpy(pname, "*.*"); - ff = FFindOpen(seqpath, 0); - if (ff == NULL) { /* file not found */ - *pname = '\0'; - if (try == 0) { - if (direxist(seqpath)) - goto emptydir; /* directory exist & empty */ - else if (_createDirectoryTree(seqpath) == 0) - goto emptydir; /* directory created */ - } /* if directory not created at 1st time then use old alghorithm */ - free(seqpath); - if (new_fname) free(new_fname); - GenMsgIdErr("can't open/create SEQDIR directory"); - return (*altGenMsgId)(); - } - do { - for (p=ff->ff_name; isxdigit((int)(*p)); p++); - if (stricmp(p, ".seq") != 0) continue; - if (strlen(ff->ff_name) > 12) continue; - n = strtol(ff->ff_name, NULL, 16); - if (n > curtime && n - curtime > max_outrun) { - /* counter too large, remove */ - strcpy(pname, ff->ff_name); - unlink(seqpath); - continue; - } - if (n >= seq) { - if (max_fname[0]) { - strcpy(pname, max_fname); - unlink(seqpath); - } - strcpy(max_fname, ff->ff_name); - seq = n; - } else { - strcpy(pname, ff->ff_name); - unlink(seqpath); - } - } while (FFindNext(ff) == 0); - if (ff) FFindClose(ff); + if (seqdir == NULL || *seqdir == '\0') { + seqdir = getenv("SEQDIR"); + if (seqdir == NULL || *seqdir == '\0') { + /* warning: no SEQDIR defined, fall to ugly old algorythm */ + GenMsgIdErr("no SEQDIR defined"); + return (*altGenMsgId)(); + } + } + seqpath = malloc(strlen(seqdir)+13); + strcpy(seqpath, seqdir); + pname = seqpath + strlen(seqpath); + if (*seqpath && strchr("/\\", seqpath[strlen(seqpath)-1]) == NULL) + *pname++ = PATH_DELIM; + new_fname = NULL; + if (max_outrun == 0) { + p = getenv("SEQOUT"); + if ( p && isdigit((int)(*p)) ) { + max_outrun = (unsigned long)atol(p); + switch (tolower(p[strlen(p) - 1])) { + case 'y': max_outrun *= 365; + case 'd': max_outrun *= 24; + case 'h': max_outrun *= 60*60; + break; + case 'w': max_outrun *= (7l*24*60*60); + break; + case 'm': max_outrun *= (31l*24*60*60); + break; + } + } + else max_outrun = MAX_OUTRUN; + } + for (try=0;;try++) { + curtime = (dword)time(NULL); + seq = 0; + max_fname[0] = '\0'; + strcpy(pname, "*.*"); + ff = FFindOpen(seqpath, 0); + if (ff == NULL) { /* file not found */ + *pname = '\0'; + if (try == 0) { + if (direxist(seqpath)) + goto emptydir; /* directory exist & empty */ + else if (_createDirectoryTree(seqpath) == 0) + goto emptydir; /* directory created */ + } /* if directory not created at 1st time then use old alghorithm */ + free(seqpath); + if (new_fname) free(new_fname); + GenMsgIdErr("can't open/create SEQDIR directory"); + return (*altGenMsgId)(); + } + do { + for (p=ff->ff_name; isxdigit((int)(*p)); p++); + if (stricmp(p, ".seq") != 0) continue; + if (strlen(ff->ff_name) > 12) continue; + n = strtol(ff->ff_name, NULL, 16); + if (n > curtime && n - curtime > max_outrun) { + /* counter too large, remove */ + strcpy(pname, ff->ff_name); + unlink(seqpath); + continue; + } + if (n >= seq) { + if (max_fname[0]) { + strcpy(pname, max_fname); + unlink(seqpath); + } + strcpy(max_fname, ff->ff_name); + seq = n; + } else { + strcpy(pname, ff->ff_name); + unlink(seqpath); + } + } while (FFindNext(ff) == 0); + if (ff) FFindClose(ff); emptydir: - if (seq < curtime) seq = curtime; - if (new_fname == NULL) - new_fname = malloc(strlen(seqpath) + 13); - *pname = '\0'; - sprintf(new_fname, "%s%08lx.seq", seqpath, (unsigned long)(seq + 1)); - if (max_fname[0] == '\0') { - /* No files found, create new */ - h = open(new_fname, O_CREAT|O_BINARY|O_EXCL, 0666); - if (h != -1) { - /* ok, scan again */ - close(h); - continue; - } - /* error creating file */ - if (errno == EEXIST) continue; - free(seqpath); - free(new_fname); - GenMsgIdErr("error creating file in SEQDIR directory"); - return (*altGenMsgId)(); - } - /* rename max_fname to new_fname */ - strcpy(pname, max_fname); - if (rename(seqpath, new_fname) == 0) { - free(seqpath); - free(new_fname); - return seq; - } - if (errno == ENOENT || errno == EEXIST || - ((errno == EPERM || errno == EACCES) && try < 16)) - continue; - free(seqpath); - free(new_fname); - GenMsgIdErr("can't rename .seq file"); - return (*altGenMsgId)(); - } + if (seq < curtime) seq = curtime; + if (new_fname == NULL) + new_fname = malloc(strlen(seqpath) + 13); + *pname = '\0'; + sprintf(new_fname, "%s%08lx.seq", seqpath, (unsigned long)(seq + 1)); + if (max_fname[0] == '\0') { + /* No files found, create new */ + h = open(new_fname, O_CREAT|O_BINARY|O_EXCL, 0666); + if (h != -1) { + /* ok, scan again */ + close(h); + continue; + } + /* error creating file */ + if (errno == EEXIST) continue; + free(seqpath); + free(new_fname); + GenMsgIdErr("error creating file in SEQDIR directory"); + return (*altGenMsgId)(); + } + /* rename max_fname to new_fname */ + strcpy(pname, max_fname); + if (rename(seqpath, new_fname) == 0) { + free(seqpath); + free(new_fname); + return seq; + } + if (errno == ENOENT || errno == EEXIST || + ((errno == EPERM || errno == EACCES) && try < 16)) + continue; + free(seqpath); + free(new_fname); + GenMsgIdErr("can't rename .seq file"); + return (*altGenMsgId)(); + } } dword GenMsgId(char *seqdir, unsigned long max_outrun) diff --git a/goldlib/uulib/fptools.c b/goldlib/uulib/fptools.c index 097304e..dd50599 100644 --- a/goldlib/uulib/fptools.c +++ b/goldlib/uulib/fptools.c @@ -56,7 +56,7 @@ #ifdef SYSTEM_WINDLL BOOL _export WINAPI DllEntryPoint (HINSTANCE hInstance, DWORD seginfo, - LPVOID lpCmdLine) + LPVOID lpCmdLine) { /* Don't do anything, so just return true */ return TRUE; @@ -187,8 +187,8 @@ _FP_strstr (char *str1, char *str2) while (*(ptr1=str1)) { for (ptr2=str2; - *ptr1 && *ptr2 && *ptr1==*ptr2; - ptr1++, ptr2++) + *ptr1 && *ptr2 && *ptr1==*ptr2; + ptr1++, ptr2++) /* empty loop */ ; if (*ptr2 == '\0') @@ -211,7 +211,7 @@ _FP_strpbrk (char *str, char *accept) for (; *str; str++) for (ptr=accept; *ptr; ptr++) if (*str == *ptr) - return str; + return str; return NULL; } @@ -237,10 +237,10 @@ _FP_strtok (char *str1, char *str2) return NULL; } - while (*optr && strchr (str2, *optr)) /* look for beginning of token */ + while (*optr && strchr (str2, *optr)) /* look for beginning of token */ optr++; - if (*optr == '\0') /* no token found */ + if (*optr == '\0') /* no token found */ return NULL; ptr = optr; @@ -269,8 +269,8 @@ _FP_stristr (char *str1, char *str2) while (*(ptr1=str1)) { for (ptr2=str2; - *ptr1 && *ptr2 && tolower(*ptr1)==tolower(*ptr2); - ptr1++, ptr2++) + *ptr1 && *ptr2 && tolower(*ptr1)==tolower(*ptr2); + ptr1++, ptr2++) /* empty loop */ ; if (*ptr2 == '\0') @@ -371,9 +371,9 @@ _FP_strmatch (char *string, char *pattern) } else if (*p2 == '*') { if (*++p2 == '\0') - return 1; + return 1; while (*p1 && *p1 != *p2) - p1++; + p1++; } else if (*p1 == *p2) { p1++; p2++; @@ -447,12 +447,12 @@ _FP_fgets (char *buf, int n, FILE *stream) while (--n) { if ((c = fgetc (stream)) == EOF) { if (ferror (stream)) - return NULL; + return NULL; else { - if (obp == buf) - return NULL; - *buf = '\0'; - return obp; + if (obp == buf) + return NULL; + *buf = '\0'; + return obp; } } if (c == '\015') { /* CR */ @@ -462,8 +462,8 @@ _FP_fgets (char *buf, int n, FILE *stream) * to the manual page */ if ((c = fgetc (stream)) != '\012') - if (!feof (stream)) - ungetc (c, stream); + if (!feof (stream)) + ungetc (c, stream); *buf++ = '\012'; *buf = '\0'; return obp; diff --git a/goldlib/uulib/fptools.h b/goldlib/uulib/fptools.h index 69a10ed..148f985 100644 --- a/goldlib/uulib/fptools.h +++ b/goldlib/uulib/fptools.h @@ -18,9 +18,9 @@ #ifndef _ANSI_ARGS_ #ifdef PROTOTYPES -#define _ANSI_ARGS_(c) c +#define _ANSI_ARGS_(c) c #else -#define _ANSI_ARGS_(c) () +#define _ANSI_ARGS_(c) () #endif #endif @@ -32,27 +32,27 @@ extern "C" { #endif -void TOOLEXPORT _FP_free _ANSI_ARGS_((void *)); -char * TOOLEXPORT _FP_strdup _ANSI_ARGS_((char *)); -char * TOOLEXPORT _FP_strncpy _ANSI_ARGS_((char *, char *, int)); -void * TOOLEXPORT _FP_memdup _ANSI_ARGS_((void *, int)); -int TOOLEXPORT _FP_stricmp _ANSI_ARGS_((char *, char *)); -int TOOLEXPORT _FP_strnicmp _ANSI_ARGS_((char *, char *, int)); -char * TOOLEXPORT _FP_strrstr _ANSI_ARGS_((char *, char *)); -char * TOOLEXPORT _FP_stoupper _ANSI_ARGS_((char *)); -char * TOOLEXPORT _FP_stolower _ANSI_ARGS_((char *)); -int TOOLEXPORT _FP_strmatch _ANSI_ARGS_((char *, char *)); -char * TOOLEXPORT _FP_strstr _ANSI_ARGS_((char *, char *)); -char * TOOLEXPORT _FP_stristr _ANSI_ARGS_((char *, char *)); -char * TOOLEXPORT _FP_strirstr _ANSI_ARGS_((char *, char *)); -char * TOOLEXPORT _FP_strrchr _ANSI_ARGS_((char *, int)); -char * TOOLEXPORT _FP_fgets _ANSI_ARGS_((char *, int, FILE *)); -char * TOOLEXPORT _FP_strpbrk _ANSI_ARGS_((char *, char *)); -char * TOOLEXPORT _FP_strtok _ANSI_ARGS_((char *, char *)); -char * TOOLEXPORT _FP_cutdir _ANSI_ARGS_((char *)); +void TOOLEXPORT _FP_free _ANSI_ARGS_((void *)); +char * TOOLEXPORT _FP_strdup _ANSI_ARGS_((char *)); +char * TOOLEXPORT _FP_strncpy _ANSI_ARGS_((char *, char *, int)); +void * TOOLEXPORT _FP_memdup _ANSI_ARGS_((void *, int)); +int TOOLEXPORT _FP_stricmp _ANSI_ARGS_((char *, char *)); +int TOOLEXPORT _FP_strnicmp _ANSI_ARGS_((char *, char *, int)); +char * TOOLEXPORT _FP_strrstr _ANSI_ARGS_((char *, char *)); +char * TOOLEXPORT _FP_stoupper _ANSI_ARGS_((char *)); +char * TOOLEXPORT _FP_stolower _ANSI_ARGS_((char *)); +int TOOLEXPORT _FP_strmatch _ANSI_ARGS_((char *, char *)); +char * TOOLEXPORT _FP_strstr _ANSI_ARGS_((char *, char *)); +char * TOOLEXPORT _FP_stristr _ANSI_ARGS_((char *, char *)); +char * TOOLEXPORT _FP_strirstr _ANSI_ARGS_((char *, char *)); +char * TOOLEXPORT _FP_strrchr _ANSI_ARGS_((char *, int)); +char * TOOLEXPORT _FP_fgets _ANSI_ARGS_((char *, int, FILE *)); +char * TOOLEXPORT _FP_strpbrk _ANSI_ARGS_((char *, char *)); +char * TOOLEXPORT _FP_strtok _ANSI_ARGS_((char *, char *)); +char * TOOLEXPORT _FP_cutdir _ANSI_ARGS_((char *)); #if 0 -char * TOOLEXPORT _FP_strerror _ANSI_ARGS_((int)); -char * TOOLEXPORT _FP_tempnam _ANSI_ARGS_((char *, char *)); +char * TOOLEXPORT _FP_strerror _ANSI_ARGS_((int)); +char * TOOLEXPORT _FP_tempnam _ANSI_ARGS_((char *, char *)); #endif #ifdef __cplusplus diff --git a/goldlib/uulib/uucheck.c b/goldlib/uulib/uucheck.c index ce431db..af6de74 100644 --- a/goldlib/uulib/uucheck.c +++ b/goldlib/uulib/uucheck.c @@ -60,15 +60,15 @@ char * uucheck_id = "$Id$"; * store for our have-parts and missing-parts lists */ -#define MAXPLIST 256 +#define MAXPLIST 256 /* * forward declarations of local functions */ -static char * UUGetFileName _ANSI_ARGS_((char *, char *, char *)); -static int UUGetPartNo _ANSI_ARGS_((char *, char **, char **)); +static char * UUGetFileName _ANSI_ARGS_((char *, char *, char *)); +static int UUGetPartNo _ANSI_ARGS_((char *, char **, char **)); /* * State of Scanner function and PreProcessPart @@ -164,9 +164,9 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend) iter++; count = length = alflag = 0; while (iter[count] && - (isalnum (iter[count]) || strchr (uufnchars, iter[count])!=NULL)) { + (isalnum (iter[count]) || strchr (uufnchars, iter[count])!=NULL)) { if (isalpha (iter[count])) - alflag++; + alflag++; count++; } if (count<4 || alflag==0) { @@ -195,17 +195,17 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend) ptr = subject; while ((iter = strchr (ptr, '/')) != NULL) { if (iter >= ptonum && iter <= ptonend) { - ptr = iter + 1; - continue; + ptr = iter + 1; + continue; } count = length = 0; iter++; while (iter[count] && - (isalnum(iter[count])||strchr(uufnchars, iter[count])!=NULL)) - count++; + (isalnum(iter[count])||strchr(uufnchars, iter[count])!=NULL)) + count++; if (iter[count] == ' ' && length > 4) { - length = count; - break; + length = count; + break; } ptr = iter + ((count)?count:1); } @@ -223,83 +223,83 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend) count = length = alflag = 0; if (_FP_strnicmp (ptr, "ftp", 3) == 0) { - /* hey, that's an ftp address */ - while (isalpha (*ptr) || isdigit (*ptr) || *ptr == '.') - ptr++; - continue; + /* hey, that's an ftp address */ + while (isalpha (*ptr) || isdigit (*ptr) || *ptr == '.') + ptr++; + continue; } while ((isalnum(*iter)||strchr(uufnchars, *iter)!=NULL|| - *iter=='/') && *iter && iter != ptonum && *iter != '.') { - if (isalpha (*iter)) - alflag = 1; - - count++; iter++; + *iter=='/') && *iter && iter != ptonum && *iter != '.') { + if (isalpha (*iter)) + alflag = 1; + + count++; iter++; } if (*iter == '\0' || iter == ptonum) { - if (iter == ptonum) - ptr = ptonend; - else - ptr = iter; + if (iter == ptonum) + ptr = ptonend; + else + ptr = iter; - length = 0; - continue; + length = 0; + continue; } if (*iter++ != '.' || count > 32 || alflag == 0) { - ptr = iter; - length = 0; - continue; + ptr = iter; + length = 0; + continue; } if (_FP_strnicmp (iter, "edu", 3) == 0 || - _FP_strnicmp (iter, "gov", 3) == 0) { - /* hey, that's an ftp address */ - while (isalpha (*iter) || isdigit (*iter) || *iter == '.') - iter++; - ptr = iter; - length = 0; - continue; + _FP_strnicmp (iter, "gov", 3) == 0) { + /* hey, that's an ftp address */ + while (isalpha (*iter) || isdigit (*iter) || *iter == '.') + iter++; + ptr = iter; + length = 0; + continue; } length += count + 1; count = 0; while ((isalnum(iter[count])||strchr(uufnchars, iter[count])!=NULL|| - iter[count]=='/') && iter[count] && iter[count] != '.') - count++; + iter[count]=='/') && iter[count] && iter[count] != '.') + count++; if (iter[count]==':' && iter[count+1]=='/') { - /* looks like stuff from a mail server */ - ptr = iter + 1; - length = 0; - continue; + /* looks like stuff from a mail server */ + ptr = iter + 1; + length = 0; + continue; } if (count > 8 || iter == ptonum) { - ptr = iter; - length = 0; - continue; + ptr = iter; + length = 0; + continue; } if (iter[count] != '.') { - length += count; - break; + length += count; + break; } while (iter[count] && - (isalnum(iter[count])||strchr(uufnchars, iter[count])!=NULL|| - iter[count]=='/')) - count++; + (isalnum(iter[count])||strchr(uufnchars, iter[count])!=NULL|| + iter[count]=='/')) + count++; if (iter[count]==':' && iter[count+1]=='/') { - /* looks like stuff from a mail server */ - ptr = iter + 1; - length = 0; - continue; + /* looks like stuff from a mail server */ + ptr = iter + 1; + length = 0; + continue; } if (count < 12 && iter != ptonum) { - length += count; - break; + length += count; + break; } ptr = iter; @@ -314,22 +314,22 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend) ptr++; while ((isalnum(ptr[length])||strchr(uufnchars,ptr[length])!=NULL|| - ptr[length] == '/') && - ptr[length] && ptr+length!=part && ptr+length!=ptonum) + ptr[length] == '/') && + ptr[length] && ptr+length!=part && ptr+length!=ptonum) length++; if (length) { if (ptr[length] == '\0' || ptr[length] == 0x0a || ptr[length] == 0x0d) { length--; - /* - * I used to cut off digits from the end of the string, but - * let's try to live without. We want to distinguish - * DUTCH951 from DUTCH952 - * + /* + * I used to cut off digits from the end of the string, but + * let's try to live without. We want to distinguish + * DUTCH951 from DUTCH952 + * * while ((ptr[length] == ' ' || isdigit (ptr[length])) && length > 0) * length--; - */ + */ } else { length--; @@ -348,7 +348,7 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend) if ((result = (char *) malloc (length + 1)) == NULL) { UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, - uustring (S_OUT_OF_MEMORY), length+1); + uustring (S_OUT_OF_MEMORY), length+1); return NULL; } @@ -402,43 +402,43 @@ UUGetPartNo (char *subject, char **where, char **whend) count = length = 0; iter++; while (*iter == ' ' || *iter == '#') - iter++; + iter++; if (!isdigit (*iter)) { - ptr = iter; - continue; + ptr = iter; + continue; } while (isdigit (iter[count])) - count++; + count++; length = count; if (iter[count] == '\0' || iter[count+1] == '\0') { - iter += count; - length = 0; - break; + iter += count; + length = 0; + break; } if (iter[count] == brackchr[uu_bracket_policy][bpc+1]) { - *where = iter; - bdel[0] = brackchr[uu_bracket_policy][bpc+1]; - delim = bdel; - break; + *where = iter; + bdel[0] = brackchr[uu_bracket_policy][bpc+1]; + delim = bdel; + break; } while (iter[count] == ' ' || iter[count] == '#' || - iter[count] == '/' || iter[count] == '\\') count++; + iter[count] == '/' || iter[count] == '\\') count++; if (_FP_strnicmp (iter + count, "of", 2) == 0) - count += 2; + count += 2; while (iter[count] == ' ') count++; while (isdigit (iter[count])) count++; while (iter[count] == ' ') count++; if (iter[count] == brackchr[uu_bracket_policy][bpc+1]) { - *where = iter; - bdel[0] = brackchr[uu_bracket_policy][bpc+1]; - delim = bdel; - break; + *where = iter; + bdel[0] = brackchr[uu_bracket_policy][bpc+1]; + delim = bdel; + break; } length = 0; @@ -458,33 +458,33 @@ UUGetPartNo (char *subject, char **where, char **whend) iter += 5; while (isspace (*iter) || *iter == '.' || *iter == '-') - iter++; + iter++; while (isdigit (iter[length])) length++; if (length == 0) { - if (_FP_strnicmp (iter, "one", 3) == 0) length = 1; - else if (_FP_strnicmp (iter, "two", 3) == 0) length = 2; - else if (_FP_strnicmp (iter, "three", 5) == 0) length = 3; - else if (_FP_strnicmp (iter, "four", 4) == 0) length = 4; - else if (_FP_strnicmp (iter, "five", 4) == 0) length = 5; - else if (_FP_strnicmp (iter, "six", 3) == 0) length = 6; - else if (_FP_strnicmp (iter, "seven", 5) == 0) length = 7; - else if (_FP_strnicmp (iter, "eight", 5) == 0) length = 8; - else if (_FP_strnicmp (iter, "nine", 4) == 0) length = 9; - else if (_FP_strnicmp (iter, "ten", 3) == 0) length = 10; + if (_FP_strnicmp (iter, "one", 3) == 0) length = 1; + else if (_FP_strnicmp (iter, "two", 3) == 0) length = 2; + else if (_FP_strnicmp (iter, "three", 5) == 0) length = 3; + else if (_FP_strnicmp (iter, "four", 4) == 0) length = 4; + else if (_FP_strnicmp (iter, "five", 4) == 0) length = 5; + else if (_FP_strnicmp (iter, "six", 3) == 0) length = 6; + else if (_FP_strnicmp (iter, "seven", 5) == 0) length = 7; + else if (_FP_strnicmp (iter, "eight", 5) == 0) length = 8; + else if (_FP_strnicmp (iter, "nine", 4) == 0) length = 9; + else if (_FP_strnicmp (iter, "ten", 3) == 0) length = 10; - if (length && (*whend = strchr (iter, ' '))) { - *where = iter; - return length; - } - else - length = 0; + if (length && (*whend = strchr (iter, ' '))) { + *where = iter; + return length; + } + else + length = 0; } else { - *where = iter; - delim = "of"; + *where = iter; + delim = "of"; } } } @@ -499,33 +499,33 @@ UUGetPartNo (char *subject, char **where, char **whend) iter += 4; while (isspace (*iter) || *iter == '.' || *iter == '-') - iter++; + iter++; while (isdigit (iter[length])) length++; if (length == 0) { - if (_FP_strnicmp (iter, "one", 3) == 0) length = 1; - else if (_FP_strnicmp (iter, "two", 3) == 0) length = 2; - else if (_FP_strnicmp (iter, "three", 5) == 0) length = 3; - else if (_FP_strnicmp (iter, "four", 4) == 0) length = 4; - else if (_FP_strnicmp (iter, "five", 4) == 0) length = 5; - else if (_FP_strnicmp (iter, "six", 3) == 0) length = 6; - else if (_FP_strnicmp (iter, "seven", 5) == 0) length = 7; - else if (_FP_strnicmp (iter, "eight", 5) == 0) length = 8; - else if (_FP_strnicmp (iter, "nine", 4) == 0) length = 9; - else if (_FP_strnicmp (iter, "ten", 3) == 0) length = 10; + if (_FP_strnicmp (iter, "one", 3) == 0) length = 1; + else if (_FP_strnicmp (iter, "two", 3) == 0) length = 2; + else if (_FP_strnicmp (iter, "three", 5) == 0) length = 3; + else if (_FP_strnicmp (iter, "four", 4) == 0) length = 4; + else if (_FP_strnicmp (iter, "five", 4) == 0) length = 5; + else if (_FP_strnicmp (iter, "six", 3) == 0) length = 6; + else if (_FP_strnicmp (iter, "seven", 5) == 0) length = 7; + else if (_FP_strnicmp (iter, "eight", 5) == 0) length = 8; + else if (_FP_strnicmp (iter, "nine", 4) == 0) length = 9; + else if (_FP_strnicmp (iter, "ten", 3) == 0) length = 10; - if (length && (*whend = strchr (iter, ' '))) { - *where = iter; - return length; - } - else - length = 0; + if (length && (*whend = strchr (iter, ' '))) { + *where = iter; + return length; + } + else + length = 0; } else { - *where = iter; - delim = "of"; + *where = iter; + delim = "of"; } } } @@ -537,19 +537,19 @@ UUGetPartNo (char *subject, char **where, char **whend) if (length == 0) { if ((iter = _FP_strirstr (subject, "of")) != NULL) { while (iter>subject && isspace (*(iter-1))) - iter--; + iter--; if (isdigit(*(iter-1))) { - while (iter>subject && isdigit (*(iter-1))) - iter--; - if (!isdigit (*iter) && !isalpha (*iter) && *iter != '.') - iter++; - ptr = iter; + while (iter>subject && isdigit (*(iter-1))) + iter--; + if (!isdigit (*iter) && !isalpha (*iter) && *iter != '.') + iter++; + ptr = iter; - while (isdigit (*ptr)) { - ptr++; length++; - } - *where = iter; - delim = "of"; + while (isdigit (*ptr)) { + ptr++; length++; + } + *where = iter; + delim = "of"; } } } @@ -563,23 +563,23 @@ UUGetPartNo (char *subject, char **where, char **whend) while (*ptr && length==0) { while (*ptr && !isdigit (*ptr)) - ptr++; + ptr++; if (isdigit (*ptr) && (ptr==subject || *ptr==' ' || *ptr=='/')) { - while (isdigit (ptr[length])) - length++; - if (ptr[length]!='\0' && ptr[length]!=' ' && ptr[length]!='/') { - ptr += length; - length = 0; - } - else { - iter = ptr; - bdel[0] = ptr[length]; - delim = bdel; - } + while (isdigit (ptr[length])) + length++; + if (ptr[length]!='\0' && ptr[length]!=' ' && ptr[length]!='/') { + ptr += length; + length = 0; + } + else { + iter = ptr; + bdel[0] = ptr[length]; + delim = bdel; + } } else { - while (isdigit (*ptr)) - ptr++; + while (isdigit (*ptr)) + ptr++; } } } @@ -596,19 +596,19 @@ UUGetPartNo (char *subject, char **where, char **whend) while (count > 0) { if (!isdigit(ptr[count])||isalpha(ptr[count+1])||ptr[count+1] == '.') { - count--; - continue; + count--; + continue; } length = 0; while (count >= 0 && isdigit (ptr[count])) { - count--; length++; + count--; length++; } if (count>=0 && ((isalpha (ptr[count]) && - (ptr[count] != 's' || ptr[count+1] != 't') && - (ptr[count] != 'n' || ptr[count+1] != 'd')) || - ptr[count] == '/' || ptr[count] == '.' || - ptr[count] == '-' || ptr[count] == '_')) { + (ptr[count] != 's' || ptr[count+1] != 't') && + (ptr[count] != 'n' || ptr[count+1] != 'd')) || + ptr[count] == '/' || ptr[count] == '.' || + ptr[count] == '-' || ptr[count] == '_')) { length = 0; continue; } @@ -616,8 +616,8 @@ UUGetPartNo (char *subject, char **where, char **whend) iter = ptr + count; if (length > 4) { - length = 0; - continue; + length = 0; + continue; } *where = iter; delim = "of"; @@ -656,7 +656,7 @@ UUGetPartNo (char *subject, char **where, char **whend) length = 0; } - if (iter == NULL || length == 0) /* should be equivalent */ + if (iter == NULL || length == 0) /* should be equivalent */ return -1; *where = iter; @@ -666,12 +666,12 @@ UUGetPartNo (char *subject, char **where, char **whend) ptr = (*whend += strlen (delim)); while (*ptr == ' ') - ptr++; + ptr++; if (isdigit (*ptr)) { - *whend = ptr; - while (isdigit (**whend)) - *whend += 1; + *whend = ptr; + while (isdigit (**whend)) + *whend += 1; } } else { @@ -697,7 +697,7 @@ UUPreProcessPart (fileread *data, int *ret) if ((result = (uufile *) malloc (sizeof (uufile))) == NULL) { UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, - uustring (S_OUT_OF_MEMORY), sizeof (uufile)); + uustring (S_OUT_OF_MEMORY), sizeof (uufile)); *ret = UURET_NOMEM; return NULL; } @@ -720,8 +720,8 @@ UUPreProcessPart (fileread *data, int *ret) if (data->filename != NULL) { if ((result->filename = _FP_strdup (data->filename)) == NULL) { UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, - uustring (S_OUT_OF_MEMORY), - strlen (data->filename)+1); + uustring (S_OUT_OF_MEMORY), + strlen (data->filename)+1); *ret = UURET_NOMEM; UUkillfile (result); return NULL; @@ -754,11 +754,11 @@ UUPreProcessPart (fileread *data, int *ret) result->subfname = _FP_strdup (result->filename); if (result->filename == NULL || - result->subfname == NULL) { + result->subfname == NULL) { UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, - uustring (S_OUT_OF_MEMORY), - (result->filename==NULL)? - (strlen(temp)+1):(strlen(result->filename)+1)); + uustring (S_OUT_OF_MEMORY), + (result->filename==NULL)? + (strlen(temp)+1):(strlen(result->filename)+1)); *ret = UURET_NOMEM; UUkillfile(result); return NULL; @@ -769,7 +769,7 @@ UUPreProcessPart (fileread *data, int *ret) else if (result->subfname == NULL && data->uudet && (data->begin || result->partno == 1 || (!uu_dumbness && result->partno == -1 && - (data->subject != NULL || result->filename != NULL)))) { + (data->subject != NULL || result->filename != NULL)))) { /* * If it's the first part of something and has some valid data, but * no subject or anything, initialize lastvalid @@ -788,9 +788,9 @@ UUPreProcessPart (fileread *data, int *ret) */ if (result->subfname == NULL) { UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, - uustring (S_OUT_OF_MEMORY), - (result->filename)? - (strlen(result->filename)+1):(strlen(temp)+1)); + uustring (S_OUT_OF_MEMORY), + (result->filename)? + (strlen(result->filename)+1):(strlen(temp)+1)); *ret = UURET_NOMEM; UUkillfile (result); return NULL; @@ -838,12 +838,12 @@ UUPreProcessPart (fileread *data, int *ret) result->subfname = _FP_strdup (temp); } if (result->subfname == NULL) { - UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, - uustring (S_OUT_OF_MEMORY), - (result->filename)? - (strlen(result->filename)+1):(strlen(temp)+1)); - *ret = UURET_NOMEM; - UUkillfile (result); + UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, + uustring (S_OUT_OF_MEMORY), + (result->filename)? + (strlen(result->filename)+1):(strlen(temp)+1)); + *ret = UURET_NOMEM; + UUkillfile (result); return NULL; } lastvalid = 0; @@ -856,7 +856,7 @@ UUPreProcessPart (fileread *data, int *ret) * if it's the last part, invalidate lastvalid */ if (data->end || (data->partno && data->partno == data->maxpno)) - lastvalid = 0; + lastvalid = 0; } else if (data->partno != -1 && result->filename) { result->subfname = _FP_strdup (result->filename); @@ -919,7 +919,7 @@ UUPreProcessPart (fileread *data, int *ret) result->partno = ++lastpart; if (data->end) - lastvalid = 0; + lastvalid = 0; } else { /* @@ -999,30 +999,30 @@ UUInsertPartToList (uufile *data) else if ((_FP_stricmp (data->subfname, iter->subfname) == 0 || (data->mimeid && iter->mimeid && strcmp (data->mimeid, iter->mimeid) == 0)) && - !(iter->begin && data->data->begin) && - !(iter->end && data->data->end) && - !(data->mimeid && iter->mimeid && - strcmp (data->mimeid, iter->mimeid) != 0) && - !(data->filename && iter->filename && - strcmp (data->filename, iter->filename) != 0) && - !(iter->flags & FL_SINGLE)) { + !(iter->begin && data->data->begin) && + !(iter->end && data->data->end) && + !(data->mimeid && iter->mimeid && + strcmp (data->mimeid, iter->mimeid) != 0) && + !(data->filename && iter->filename && + strcmp (data->filename, iter->filename) != 0) && + !(iter->flags & FL_SINGLE)) { /* * if we already have this part, don't try to insert it */ for (fiter=iter->thisfile; - fiter && (data->partno>fiter->partno) && !fiter->data->end; - fiter=fiter->NEXT) - /* empty loop */ ; + fiter && (data->partno>fiter->partno) && !fiter->data->end; + fiter=fiter->NEXT) + /* empty loop */ ; if (fiter && - (data->partno==fiter->partno || - (data->partno > fiter->partno && fiter->data->end))) - goto goahead; + (data->partno==fiter->partno || + (data->partno > fiter->partno && fiter->data->end))) + goto goahead; if (iter->filename == NULL && data->filename != NULL) { if ((iter->filename = _FP_strdup (data->filename)) == NULL) - return UURET_NOMEM; + return UURET_NOMEM; } /* @@ -1031,18 +1031,18 @@ UUInsertPartToList (uufile *data) */ if (data->data->uudet == B64ENCODED && - iter->uudet == XX_ENCODED && iter->begin) { - data->data->uudet = XX_ENCODED; + iter->uudet == XX_ENCODED && iter->begin) { + data->data->uudet = XX_ENCODED; } else if (data->data->uudet == XX_ENCODED && data->data->begin && - iter->uudet == B64ENCODED) { - iter->uudet = XX_ENCODED; + iter->uudet == B64ENCODED) { + iter->uudet = XX_ENCODED; - fiter = iter->thisfile; - while (fiter) { - fiter->data->uudet = XX_ENCODED; - fiter = fiter->NEXT; - } + fiter = iter->thisfile; + while (fiter) { + fiter->data->uudet = XX_ENCODED; + fiter = fiter->NEXT; + } } /* @@ -1050,14 +1050,14 @@ UUInsertPartToList (uufile *data) * iter->uudet from the first part */ if (data->data->flags & FL_PARTIAL) { - if (data->partno == 1) { - iter->uudet = data->data->uudet; - iter->flags = data->data->flags; - } + if (data->partno == 1) { + iter->uudet = data->data->uudet; + iter->flags = data->data->flags; + } } else { - if (data->data->uudet) iter->uudet = data->data->uudet; - if (data->data->flags) iter->flags = data->data->flags; + if (data->data->uudet) iter->uudet = data->data->uudet; + if (data->data->flags) iter->flags = data->data->flags; } if (iter->mode == 0 && data->data->mode != 0) @@ -1066,8 +1066,8 @@ UUInsertPartToList (uufile *data) if (data->data->end) iter->end = (data->partno)?data->partno:1; if (data->mimetype) { - _FP_free (iter->mimetype); - iter->mimetype = _FP_strdup (data->mimetype); + _FP_free (iter->mimetype); + iter->mimetype = _FP_strdup (data->mimetype); } /* @@ -1075,36 +1075,36 @@ UUInsertPartToList (uufile *data) */ if (data->partno != -1 && data->partno < iter->thisfile->partno) { - iter->state = UUFILE_READ; - data->NEXT = iter->thisfile; - iter->thisfile = data; - return UURET_OK; + iter->state = UUFILE_READ; + data->NEXT = iter->thisfile; + iter->thisfile = data; + return UURET_OK; } /* * insert part somewhere else */ - iter->state = UUFILE_READ; /* prepare for re-checking */ + iter->state = UUFILE_READ; /* prepare for re-checking */ fiter = iter->thisfile; last = NULL; while (fiter) { - /* - * if we find the same part no again, check which one looks better - */ - if (data->partno == fiter->partno) { + /* + * if we find the same part no again, check which one looks better + */ + if (data->partno == fiter->partno) { if (fiter->data->subject == NULL) return UURET_NODATA; - else if (_FP_stristr (fiter->data->subject, "repost") != NULL && - _FP_stristr (data->data->subject, "repost") == NULL) - return UURET_NODATA; + else if (_FP_stristr (fiter->data->subject, "repost") != NULL && + _FP_stristr (data->data->subject, "repost") == NULL) + return UURET_NODATA; else if (fiter->data->uudet && !data->data->uudet) return UURET_NODATA; else { - /* - * replace - */ + /* + * replace + */ data->NEXT = fiter->NEXT; fiter->NEXT = NULL; UUkillfile (fiter); @@ -1118,22 +1118,22 @@ UUInsertPartToList (uufile *data) } } - /* - * if at the end of the part list, add it - */ + /* + * if at the end of the part list, add it + */ - if (fiter->NEXT == NULL || - (data->partno != -1 && data->partno < fiter->NEXT->partno)) { - data->NEXT = fiter->NEXT; - fiter->NEXT = data; + if (fiter->NEXT == NULL || + (data->partno != -1 && data->partno < fiter->NEXT->partno)) { + data->NEXT = fiter->NEXT; + fiter->NEXT = data; - if (data->partno == -1) - data->partno = fiter->partno + 1; + if (data->partno == -1) + data->partno = fiter->partno + 1; - return UURET_OK; - } + return UURET_OK; + } last = fiter; - fiter = fiter->NEXT; + fiter = fiter->NEXT; } return UURET_OK; /* Shouldn't get here */ @@ -1249,12 +1249,12 @@ UUCheckGlobalList (void) continue; } else if ((liter->uudet == QP_ENCODED || - liter->uudet == PT_ENCODED) && - (liter->flags & FL_SINGLE)) { + liter->uudet == PT_ENCODED) && + (liter->flags & FL_SINGLE)) { if ((liter->flags&FL_PROPER)==0) - liter->size = -1; + liter->size = -1; else - liter->size = liter->thisfile->data->length; + liter->size = liter->thisfile->data->length; liter->state = UUFILE_OK; continue; @@ -1281,7 +1281,7 @@ UUCheckGlobalList (void) while (fiter && !fiter->data->uudet) { if (havecountpartno; + haveparts[havecount++] = fiter->partno; } fiter = fiter->NEXT; } @@ -1298,8 +1298,8 @@ UUCheckGlobalList (void) if ((part = fiter->partno) > 1) { if (!fiter->data->begin) { - for (count=1; count < part && miscount < MAXPLIST; count++) - misparts[miscount++] = count; + for (count=1; count < part && miscount < MAXPLIST; count++) + misparts[miscount++] = count; } } @@ -1314,8 +1314,8 @@ UUCheckGlobalList (void) } if (liter->uudet == B64ENCODED || - liter->uudet == QP_ENCODED || - liter->uudet == PT_ENCODED) + liter->uudet == QP_ENCODED || + liter->uudet == PT_ENCODED) flag |= 3; /* Don't need begin or end with Base64 or plain text*/ if (fiter->data->begin) flag |= 1; @@ -1346,12 +1346,12 @@ UUCheckGlobalList (void) while (fiter != NULL) { for (count=part+1; countpartno && miscountpartno; if (havecountdata->begin) flag |= 1; if (fiter->data->end) flag |= 2; @@ -1360,22 +1360,22 @@ UUCheckGlobalList (void) switch (fiter->data->uudet) { case UU_ENCODED: case XX_ENCODED: - thesize += 3*fiter->data->length/4; - thesize -= 3*fiter->data->length/124; /* substract 2 of 62 chars */ - break; + thesize += 3*fiter->data->length/4; + thesize -= 3*fiter->data->length/124; /* substract 2 of 62 chars */ + break; case B64ENCODED: - thesize += 3*fiter->data->length/4; - thesize -= fiter->data->length/52; /* substract 2 of 78 chars */ - break; + thesize += 3*fiter->data->length/4; + thesize -= fiter->data->length/52; /* substract 2 of 78 chars */ + break; case QP_ENCODED: case PT_ENCODED: - thesize += fiter->data->length; - break; + thesize += fiter->data->length; + break; } if (fiter->data->end) - break; - + break; + fiter = fiter->NEXT; } @@ -1386,7 +1386,7 @@ UUCheckGlobalList (void) */ if (uu_fast_scanning && (flag & 0x01) && (flag & 0x04) && - (liter->uudet == UU_ENCODED || liter->uudet == XX_ENCODED)) + (liter->uudet == UU_ENCODED || liter->uudet == XX_ENCODED)) flag |= 2; /* @@ -1401,15 +1401,15 @@ UUCheckGlobalList (void) if (havecount) { if ((liter->haveparts=(int*)malloc((havecount+1)*sizeof(int)))!=NULL) { - memcpy (liter->haveparts, haveparts, havecount*sizeof(int)); - liter->haveparts[havecount] = 0; + memcpy (liter->haveparts, haveparts, havecount*sizeof(int)); + liter->haveparts[havecount] = 0; } } if (miscount) { if ((liter->misparts=(int*)malloc((miscount+1)*sizeof(int)))!=NULL) { - memcpy (liter->misparts, misparts, miscount*sizeof(int)); - liter->misparts[miscount] = 0; + memcpy (liter->misparts, misparts, miscount*sizeof(int)); + liter->misparts[miscount] = 0; } liter->state |= UUFILE_MISPART; } diff --git a/goldlib/uulib/uudeview.h b/goldlib/uulib/uudeview.h index f073088..e406240 100644 --- a/goldlib/uulib/uudeview.h +++ b/goldlib/uulib/uudeview.h @@ -26,9 +26,9 @@ #ifndef _ANSI_ARGS_ #ifdef PROTOTYPES -#define _ANSI_ARGS_(c) c +#define _ANSI_ARGS_(c) c #else -#define _ANSI_ARGS_(c) () +#define _ANSI_ARGS_(c) () #endif #endif @@ -36,75 +36,75 @@ * Message Types */ -#define UUMSG_MESSAGE (0) /* just a message, nothing important */ -#define UUMSG_NOTE (1) /* something that should be noticed */ -#define UUMSG_WARNING (2) /* important msg, processing continues */ -#define UUMSG_ERROR (3) /* processing has been terminated */ -#define UUMSG_FATAL (4) /* decoder cannot process further requests */ -#define UUMSG_PANIC (5) /* recovery impossible, app must terminate */ +#define UUMSG_MESSAGE (0) /* just a message, nothing important */ +#define UUMSG_NOTE (1) /* something that should be noticed */ +#define UUMSG_WARNING (2) /* important msg, processing continues */ +#define UUMSG_ERROR (3) /* processing has been terminated */ +#define UUMSG_FATAL (4) /* decoder cannot process further requests */ +#define UUMSG_PANIC (5) /* recovery impossible, app must terminate */ /* * Return Values */ -#define UURET_OK (0) /* everything went fine */ -#define UURET_IOERR (1) /* I/O Error - examine errno */ -#define UURET_NOMEM (2) /* not enough memory */ -#define UURET_ILLVAL (3) /* illegal value for operation */ -#define UURET_NODATA (4) /* decoder didn't find any data */ -#define UURET_NOEND (5) /* encoded data wasn't ended properly */ -#define UURET_UNSUP (6) /* unsupported function (encoding) */ -#define UURET_EXISTS (7) /* file exists (decoding) */ -#define UURET_CONT (8) /* continue -- special from ScanPart */ -#define UURET_CANCEL (9) /* operation canceled */ +#define UURET_OK (0) /* everything went fine */ +#define UURET_IOERR (1) /* I/O Error - examine errno */ +#define UURET_NOMEM (2) /* not enough memory */ +#define UURET_ILLVAL (3) /* illegal value for operation */ +#define UURET_NODATA (4) /* decoder didn't find any data */ +#define UURET_NOEND (5) /* encoded data wasn't ended properly */ +#define UURET_UNSUP (6) /* unsupported function (encoding) */ +#define UURET_EXISTS (7) /* file exists (decoding) */ +#define UURET_CONT (8) /* continue -- special from ScanPart */ +#define UURET_CANCEL (9) /* operation canceled */ /* * File states, may be OR'ed */ -#define UUFILE_READ (0) /* Read in, but not further processed */ -#define UUFILE_MISPART (1) /* Missing Part(s) detected */ -#define UUFILE_NOBEGIN (2) /* No 'begin' found */ -#define UUFILE_NOEND (4) /* No 'end' found */ -#define UUFILE_NODATA (8) /* File does not contain valid uudata */ -#define UUFILE_OK (16) /* All Parts found, ready to decode */ -#define UUFILE_ERROR (32) /* Error while decoding */ -#define UUFILE_DECODED (64) /* Successfully decoded */ -#define UUFILE_TMPFILE (128) /* Temporary decoded file exists */ +#define UUFILE_READ (0) /* Read in, but not further processed */ +#define UUFILE_MISPART (1) /* Missing Part(s) detected */ +#define UUFILE_NOBEGIN (2) /* No 'begin' found */ +#define UUFILE_NOEND (4) /* No 'end' found */ +#define UUFILE_NODATA (8) /* File does not contain valid uudata */ +#define UUFILE_OK (16) /* All Parts found, ready to decode */ +#define UUFILE_ERROR (32) /* Error while decoding */ +#define UUFILE_DECODED (64) /* Successfully decoded */ +#define UUFILE_TMPFILE (128) /* Temporary decoded file exists */ /* * Encoding Types */ -#define UU_ENCODED (1) /* UUencoded data */ -#define B64ENCODED (2) /* Mime-Base64 data */ -#define XX_ENCODED (3) /* XXencoded data */ -#define BH_ENCODED (4) /* Binhex encoded */ -#define PT_ENCODED (5) /* Plain-Text encoded (MIME) */ -#define QP_ENCODED (6) /* Quoted-Printable (MIME) */ -#define YENC_ENCODED (7) /* yEnc encoded */ +#define UU_ENCODED (1) /* UUencoded data */ +#define B64ENCODED (2) /* Mime-Base64 data */ +#define XX_ENCODED (3) /* XXencoded data */ +#define BH_ENCODED (4) /* Binhex encoded */ +#define PT_ENCODED (5) /* Plain-Text encoded (MIME) */ +#define QP_ENCODED (6) /* Quoted-Printable (MIME) */ +#define YENC_ENCODED (7) /* yEnc encoded */ /* * Option indices for GetOption / SetOption */ -#define UUOPT_VERSION (0) /* version number MAJOR.MINORplPATCH (ro) */ -#define UUOPT_FAST (1) /* assumes only one part per file */ -#define UUOPT_DUMBNESS (2) /* switch off the program's intelligence */ -#define UUOPT_BRACKPOL (3) /* give numbers in [] higher precendence */ -#define UUOPT_VERBOSE (4) /* generate informative messages */ -#define UUOPT_DESPERATE (5) /* try to decode incomplete files */ -#define UUOPT_IGNREPLY (6) /* ignore RE:plies (off by default) */ -#define UUOPT_OVERWRITE (7) /* whether it's OK to overwrite ex. files */ -#define UUOPT_SAVEPATH (8) /* prefix to save-files on disk */ -#define UUOPT_IGNMODE (9) /* ignore the original file mode */ -#define UUOPT_DEBUG (10) /* print messages with FILE/LINE info */ -#define UUOPT_ERRNO (14) /* get last error code for UURET_IOERR (ro) */ -#define UUOPT_PROGRESS (15) /* retrieve progress information */ -#define UUOPT_USETEXT (16) /* handle text messages */ -#define UUOPT_PREAMB (17) /* handle Mime preambles/epilogues */ -#define UUOPT_TINYB64 (18) /* detect short B64 outside of Mime */ -#define UUOPT_ENCEXT (19) /* extension for single-part encoded files */ +#define UUOPT_VERSION (0) /* version number MAJOR.MINORplPATCH (ro) */ +#define UUOPT_FAST (1) /* assumes only one part per file */ +#define UUOPT_DUMBNESS (2) /* switch off the program's intelligence */ +#define UUOPT_BRACKPOL (3) /* give numbers in [] higher precendence */ +#define UUOPT_VERBOSE (4) /* generate informative messages */ +#define UUOPT_DESPERATE (5) /* try to decode incomplete files */ +#define UUOPT_IGNREPLY (6) /* ignore RE:plies (off by default) */ +#define UUOPT_OVERWRITE (7) /* whether it's OK to overwrite ex. files */ +#define UUOPT_SAVEPATH (8) /* prefix to save-files on disk */ +#define UUOPT_IGNMODE (9) /* ignore the original file mode */ +#define UUOPT_DEBUG (10) /* print messages with FILE/LINE info */ +#define UUOPT_ERRNO (14) /* get last error code for UURET_IOERR (ro) */ +#define UUOPT_PROGRESS (15) /* retrieve progress information */ +#define UUOPT_USETEXT (16) /* handle text messages */ +#define UUOPT_PREAMB (17) /* handle Mime preambles/epilogues */ +#define UUOPT_TINYB64 (18) /* detect short B64 outside of Mime */ +#define UUOPT_ENCEXT (19) /* extension for single-part encoded files */ #define UUOPT_REMOVE (20) /* remove input files after decoding */ #define UUOPT_MOREMIME (21) /* strict MIME adherence */ @@ -112,11 +112,11 @@ * Code for the "action" in the progress structure */ -#define UUACT_IDLE (0) /* we don't do anything */ -#define UUACT_SCANNING (1) /* scanning an input file */ -#define UUACT_DECODING (2) /* decoding into a temp file */ -#define UUACT_COPYING (3) /* copying temp to target */ -#define UUACT_ENCODING (4) /* encoding a file */ +#define UUACT_IDLE (0) /* we don't do anything */ +#define UUACT_SCANNING (1) /* scanning an input file */ +#define UUACT_DECODING (2) /* decoding into a temp file */ +#define UUACT_COPYING (3) /* copying temp to target */ +#define UUACT_ENCODING (4) /* encoding a file */ /* * forward definition @@ -132,30 +132,30 @@ struct _uufile; */ typedef struct _uulist { - short state; /* Status as described by the macros above */ - short mode; /* file mode as found on begin line */ + short state; /* Status as described by the macros above */ + short mode; /* file mode as found on begin line */ - int begin; /* part number where begin was detected */ - int end; /* part number where end was detected */ + int begin; /* part number where begin was detected */ + int end; /* part number where end was detected */ - short uudet; /* Encoding type (see macros above) */ - int flags; /* flags, especially for single-part files */ + short uudet; /* Encoding type (see macros above) */ + int flags; /* flags, especially for single-part files */ - long size; /* approximate size of resulting file */ - char *filename; /* malloc'ed file name */ - char *subfname; /* malloc'ed ID from subject line */ - char *mimeid; /* malloc'ed MIME-ID, if available */ - char *mimetype; /* malloc'ed Content-Type, if available */ + long size; /* approximate size of resulting file */ + char *filename; /* malloc'ed file name */ + char *subfname; /* malloc'ed ID from subject line */ + char *mimeid; /* malloc'ed MIME-ID, if available */ + char *mimetype; /* malloc'ed Content-Type, if available */ - char *binfile; /* name of temp file, if already decoded */ + char *binfile; /* name of temp file, if already decoded */ - struct _uufile *thisfile; /* linked list of this file's parts */ + struct _uufile *thisfile; /* linked list of this file's parts */ - int *haveparts; /* the parts we have (max. 256 are listed) */ - int *misparts; /* list of missing parts (max. 256) */ + int *haveparts; /* the parts we have (max. 256 are listed) */ + int *misparts; /* list of missing parts (max. 256) */ - struct _uulist *NEXT; /* next item of the list */ - struct _uulist *PREV; /* previous item of the list */ + struct _uulist *NEXT; /* next item of the list */ + struct _uulist *PREV; /* previous item of the list */ } uulist; /* @@ -163,14 +163,14 @@ typedef struct _uulist { */ typedef struct { - int action; /* see UUACT_* definitions above */ - char curfile[256]; /* the file we are working on, incl. path */ - int partno; /* part we're currently decoding */ - int numparts; /* total number of parts of this file */ - long fsize; /* size of the current file */ - int percent; /* % of _current part_ */ - long foffset; /* file offset -- internal use only */ - long totsize; /* file total size -- internal use only */ + int action; /* see UUACT_* definitions above */ + char curfile[256]; /* the file we are working on, incl. path */ + int partno; /* part we're currently decoding */ + int numparts; /* total number of parts of this file */ + long fsize; /* size of the current file */ + int percent; /* % of _current part_ */ + long foffset; /* file offset -- internal use only */ + long totsize; /* file total size -- internal use only */ } uuprogress; @@ -186,76 +186,76 @@ typedef struct { extern "C" { #endif -int UUEXPORT UUInitialize _ANSI_ARGS_((void)); -int UUEXPORT UUGetOption _ANSI_ARGS_((int, int *, char *, int)); -int UUEXPORT UUSetOption _ANSI_ARGS_((int, int, char *)); -char * UUEXPORT UUstrerror _ANSI_ARGS_((int)); -int UUEXPORT UUSetMsgCallback _ANSI_ARGS_((void *, - void (*) (void *, - char *, - int))); -int UUEXPORT UUSetBusyCallback _ANSI_ARGS_((void *, - int (*) (void *, - uuprogress *), - long)); -int UUEXPORT UUSetFileCallback _ANSI_ARGS_((void *, - int (*) (void *, char *, - char *, int))); -int UUEXPORT UUSetFNameFilter _ANSI_ARGS_((void *, - char * (*) (void *, - char *))); -char * UUEXPORT UUFNameFilter _ANSI_ARGS_((char *)); -int UUEXPORT UULoadFile _ANSI_ARGS_((char *, char *, int)); -uulist *UUEXPORT UUGetFileListItem _ANSI_ARGS_((int)); -int UUEXPORT UURenameFile _ANSI_ARGS_((uulist *, char *)); -int UUEXPORT UUDecodeToTemp _ANSI_ARGS_((uulist *)); -int UUEXPORT UURemoveTemp _ANSI_ARGS_((uulist *)); -int UUEXPORT UUDecodeFile _ANSI_ARGS_((uulist *, char *)); -int UUEXPORT UUInfoFile _ANSI_ARGS_((uulist *, void *, - int (*) (void *, - char *))); -int UUEXPORT UUSmerge _ANSI_ARGS_((int)); -int UUEXPORT UUCleanUp _ANSI_ARGS_((void)); +int UUEXPORT UUInitialize _ANSI_ARGS_((void)); +int UUEXPORT UUGetOption _ANSI_ARGS_((int, int *, char *, int)); +int UUEXPORT UUSetOption _ANSI_ARGS_((int, int, char *)); +char * UUEXPORT UUstrerror _ANSI_ARGS_((int)); +int UUEXPORT UUSetMsgCallback _ANSI_ARGS_((void *, + void (*) (void *, + char *, + int))); +int UUEXPORT UUSetBusyCallback _ANSI_ARGS_((void *, + int (*) (void *, + uuprogress *), + long)); +int UUEXPORT UUSetFileCallback _ANSI_ARGS_((void *, + int (*) (void *, char *, + char *, int))); +int UUEXPORT UUSetFNameFilter _ANSI_ARGS_((void *, + char * (*) (void *, + char *))); +char * UUEXPORT UUFNameFilter _ANSI_ARGS_((char *)); +int UUEXPORT UULoadFile _ANSI_ARGS_((char *, char *, int)); +uulist *UUEXPORT UUGetFileListItem _ANSI_ARGS_((int)); +int UUEXPORT UURenameFile _ANSI_ARGS_((uulist *, char *)); +int UUEXPORT UUDecodeToTemp _ANSI_ARGS_((uulist *)); +int UUEXPORT UURemoveTemp _ANSI_ARGS_((uulist *)); +int UUEXPORT UUDecodeFile _ANSI_ARGS_((uulist *, char *)); +int UUEXPORT UUInfoFile _ANSI_ARGS_((uulist *, void *, + int (*) (void *, + char *))); +int UUEXPORT UUSmerge _ANSI_ARGS_((int)); +int UUEXPORT UUCleanUp _ANSI_ARGS_((void)); -int UUEXPORT UUQuickDecode _ANSI_ARGS_((FILE *, FILE *, - char *, long)); +int UUEXPORT UUQuickDecode _ANSI_ARGS_((FILE *, FILE *, + char *, long)); -int UUEXPORT UUEncodeMulti _ANSI_ARGS_((FILE *, FILE *, - char *, int, - char *, char *, int)); -int UUEXPORT UUEncodePartial _ANSI_ARGS_((FILE *, FILE *, - char *, int, - char *, char *, - int, int, long, - unsigned long*)); -int UUEXPORT UUEncodeToStream _ANSI_ARGS_((FILE *, FILE *, - char *, int, - char *, int)); -int UUEXPORT UUEncodeToFile _ANSI_ARGS_((FILE *, char *, int, - char *, char *, long)); -int UUEXPORT UUE_PrepSingle _ANSI_ARGS_((FILE *, FILE *, - char *, int, - char *, int, - char *, char *, - char *, int)); -int UUEXPORT UUE_PrepPartial _ANSI_ARGS_((FILE *, FILE *, - char *, int, - char *, int, - int, long, long, char *, - char *, char *, int)); +int UUEXPORT UUEncodeMulti _ANSI_ARGS_((FILE *, FILE *, + char *, int, + char *, char *, int)); +int UUEXPORT UUEncodePartial _ANSI_ARGS_((FILE *, FILE *, + char *, int, + char *, char *, + int, int, long, + unsigned long*)); +int UUEXPORT UUEncodeToStream _ANSI_ARGS_((FILE *, FILE *, + char *, int, + char *, int)); +int UUEXPORT UUEncodeToFile _ANSI_ARGS_((FILE *, char *, int, + char *, char *, long)); +int UUEXPORT UUE_PrepSingle _ANSI_ARGS_((FILE *, FILE *, + char *, int, + char *, int, + char *, char *, + char *, int)); +int UUEXPORT UUE_PrepPartial _ANSI_ARGS_((FILE *, FILE *, + char *, int, + char *, int, + int, long, long, char *, + char *, char *, int)); -int UUEXPORT UUE_PrepSingleExt _ANSI_ARGS_((FILE *, FILE *, - char *, int, - char *, int, - char *, char *, - char *, char *, - int)); -int UUEXPORT UUE_PrepPartialExt _ANSI_ARGS_((FILE *, FILE *, - char *, int, - char *, int, - int, long, long, char *, - char *, char *, char *, - int)); +int UUEXPORT UUE_PrepSingleExt _ANSI_ARGS_((FILE *, FILE *, + char *, int, + char *, int, + char *, char *, + char *, char *, + int)); +int UUEXPORT UUE_PrepPartialExt _ANSI_ARGS_((FILE *, FILE *, + char *, int, + char *, int, + int, long, long, char *, + char *, char *, char *, + int)); #ifdef __cplusplus } #endif diff --git a/goldlib/uulib/uuencode.c b/goldlib/uulib/uuencode.c index 0c07ea5..e79daf7 100644 --- a/goldlib/uulib/uuencode.c +++ b/goldlib/uulib/uuencode.c @@ -71,7 +71,7 @@ char * uuencode_id = "$Id$"; */ #ifndef EOLSTRING -#define EOLSTRING "\015\012" +#define EOLSTRING "\015\012" #endif #else @@ -84,7 +84,7 @@ char * uuencode_id = "$Id$"; */ #ifndef EOLSTRING -#define EOLSTRING "\n" +#define EOLSTRING "\n" #endif #endif @@ -111,18 +111,18 @@ static unsigned char *eolstring = (unsigned char *) "\012"; * Content-Transfer-Encoding types for non-MIME encodings */ -#define CTE_UUENC "x-uuencode" -#define CTE_XXENC "x-xxencode" -#define CTE_BINHEX "x-binhex" -#define CTE_YENC "x-yenc" +#define CTE_UUENC "x-uuencode" +#define CTE_XXENC "x-xxencode" +#define CTE_BINHEX "x-binhex" +#define CTE_YENC "x-yenc" -#define CTE_TYPE(y) (((y)==B64ENCODED) ? "Base64" : \ - ((y)==UU_ENCODED) ? CTE_UUENC : \ - ((y)==XX_ENCODED) ? CTE_XXENC : \ +#define CTE_TYPE(y) (((y)==B64ENCODED) ? "Base64" : \ + ((y)==UU_ENCODED) ? CTE_UUENC : \ + ((y)==XX_ENCODED) ? CTE_XXENC : \ ((y)==PT_ENCODED) ? "8bit" : \ ((y)==QP_ENCODED) ? "quoted-printable" : \ - ((y)==BH_ENCODED) ? CTE_BINHEX : \ - ((y)==YENC_ENCODED) ? CTE_YENC : "x-oops") + ((y)==BH_ENCODED) ? CTE_BINHEX : \ + ((y)==YENC_ENCODED) ? CTE_YENC : "x-oops") /* * encoding tables @@ -192,23 +192,23 @@ typedef struct { */ static mimemap mimetable[] = { - { "gif", "image/gif" }, /* Grafics Interchange Format */ - { "jpg", "image/jpeg" }, /* JFIF encoded files */ - { "jpeg", "image/jpeg" }, - { "tif", "image/tiff" }, /* Tag Image File Format */ - { "tiff", "image/tiff" }, - { "cgm", "image/cgm" }, /* Computer Graphics Metafile */ - { "au", "audio/basic" }, /* 8kHz ulaw audio data */ - { "mov", "video/quicktime" }, /* Apple Quicktime */ - { "qt", "video/quicktime" }, /* Also infrequently used */ - { "mpeg", "video/mpeg" }, /* Motion Picture Expert Group */ - { "mpg", "video/mpeg" }, - { "mp2", "video/mpeg" }, /* dito, MPEG-2 encoded files */ - { "mp3", "audio/mpeg" }, /* dito, MPEG-3 encoded files */ - { "ps", "application/postscript" }, /* Postscript Language */ - { "zip", "application/zip" }, /* ZIP archive */ - { "doc", "application/msword"},/* assume Microsoft Word */ - { NULL, NULL } + { "gif", "image/gif" }, /* Grafics Interchange Format */ + { "jpg", "image/jpeg" }, /* JFIF encoded files */ + { "jpeg", "image/jpeg" }, + { "tif", "image/tiff" }, /* Tag Image File Format */ + { "tiff", "image/tiff" }, + { "cgm", "image/cgm" }, /* Computer Graphics Metafile */ + { "au", "audio/basic" }, /* 8kHz ulaw audio data */ + { "mov", "video/quicktime" }, /* Apple Quicktime */ + { "qt", "video/quicktime" }, /* Also infrequently used */ + { "mpeg", "video/mpeg" }, /* Motion Picture Expert Group */ + { "mpg", "video/mpeg" }, + { "mp2", "video/mpeg" }, /* dito, MPEG-2 encoded files */ + { "mp3", "audio/mpeg" }, /* dito, MPEG-3 encoded files */ + { "ps", "application/postscript" }, /* Postscript Language */ + { "zip", "application/zip" }, /* ZIP archive */ + { "doc", "application/msword"},/* assume Microsoft Word */ + { NULL, NULL } }; /* @@ -259,7 +259,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3 (encoding!=UU_ENCODED&&encoding!=XX_ENCODED&&encoding!=B64ENCODED&& encoding!=PT_ENCODED&&encoding!=QP_ENCODED&&encoding!=YENC_ENCODED)) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_PARM_CHECK), "UUEncodeStream()"); + uustring (S_PARM_CHECK), "UUEncodeStream()"); return UURET_ILLVAL; } @@ -271,7 +271,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3 if (encoding == PT_ENCODED || encoding == QP_ENCODED) { while (!feof (infile) && (linperfile <= 0 || line < linperfile)) { if (_FP_fgets ((char *) itemp, 255, infile) == NULL) { - break; + break; } itemp[255] = '\0'; @@ -285,121 +285,121 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3 */ if (UUBUSYPOLL(ftell(infile)-progress.foffset,progress.fsize)) { - UUMessage (uuencode_id, __LINE__, UUMSG_NOTE, - uustring (S_ENCODE_CANCEL)); - return UURET_CANCEL; + UUMessage (uuencode_id, __LINE__, UUMSG_NOTE, + uustring (S_ENCODE_CANCEL)); + return UURET_CANCEL; } if (encoding == PT_ENCODED) { - /* - * If there is a line feed, replace by eolstring - */ - if (count > 0 && itemp[count-1] == '\n') { - itemp[--count] = '\0'; - if (fwrite (itemp, 1, count, outfile) != (unsigned)count || - fwrite ((char *) eolstring, 1, - strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) { - return UURET_IOERR; - } - } - else { - if (fwrite (itemp, 1, count, outfile) != llen) { - return UURET_IOERR; - } - } + /* + * If there is a line feed, replace by eolstring + */ + if (count > 0 && itemp[count-1] == '\n') { + itemp[--count] = '\0'; + if (fwrite (itemp, 1, count, outfile) != (unsigned)count || + fwrite ((char *) eolstring, 1, + strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) { + return UURET_IOERR; + } + } + else { + if (fwrite (itemp, 1, count, outfile) != llen) { + return UURET_IOERR; + } + } } else if (encoding == QP_ENCODED) { - for (index=0; index> 4]; - *optr++ = HexEncodeTable[itemp[index] & 0x0f]; - llen += 3; - } - else if ((itemp[index] >= 33 && itemp[index] <= 60) || - (itemp[index] >= 62 && itemp[index] <= 126) || - itemp[index] == 9 || itemp[index] == 32) { - *optr++ = itemp[index]; - llen++; - } - else if (itemp[index] == '\n') { - /* - * If the last character before EOL was a space or tab, - * we must encode it. If llen > 74, there's no space to do - * that, so generate a soft line break instead. - */ + for (index=0; index> 4]; + *optr++ = HexEncodeTable[itemp[index] & 0x0f]; + llen += 3; + } + else if ((itemp[index] >= 33 && itemp[index] <= 60) || + (itemp[index] >= 62 && itemp[index] <= 126) || + itemp[index] == 9 || itemp[index] == 32) { + *optr++ = itemp[index]; + llen++; + } + else if (itemp[index] == '\n') { + /* + * If the last character before EOL was a space or tab, + * we must encode it. If llen > 74, there's no space to do + * that, so generate a soft line break instead. + */ - if (index>0 && (itemp[index-1] == 9 || itemp[index-1] == 32)) { - *(optr-1) = '='; - if (llen <= 74) { - *optr++ = HexEncodeTable[itemp[index-1] >> 4]; - *optr++ = HexEncodeTable[itemp[index-1] & 0x0f]; - llen += 2; - } - } + if (index>0 && (itemp[index-1] == 9 || itemp[index-1] == 32)) { + *(optr-1) = '='; + if (llen <= 74) { + *optr++ = HexEncodeTable[itemp[index-1] >> 4]; + *optr++ = HexEncodeTable[itemp[index-1] & 0x0f]; + llen += 2; + } + } - if (fwrite (otemp, 1, llen, outfile) != llen || - fwrite ((char *) eolstring, 1, - strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) { - return UURET_IOERR; - } + if (fwrite (otemp, 1, llen, outfile) != llen || + fwrite ((char *) eolstring, 1, + strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) { + return UURET_IOERR; + } - /* - * Fix the soft line break condition from above - */ + /* + * Fix the soft line break condition from above + */ - if (index>0 && (itemp[index-1] == 9 || itemp[index-1] == 32) && - *(optr-1) == '=') { - otemp[0] = '='; - otemp[1] = HexEncodeTable[itemp[index-1] >> 4]; - otemp[2] = HexEncodeTable[itemp[index-1] & 0x0f]; + if (index>0 && (itemp[index-1] == 9 || itemp[index-1] == 32) && + *(optr-1) == '=') { + otemp[0] = '='; + otemp[1] = HexEncodeTable[itemp[index-1] >> 4]; + otemp[2] = HexEncodeTable[itemp[index-1] & 0x0f]; - if (fwrite (otemp, 1, 3, outfile) != 3 || - fwrite ((char *) eolstring, 1, - strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) { - return UURET_IOERR; - } - } + if (fwrite (otemp, 1, 3, outfile) != 3 || + fwrite ((char *) eolstring, 1, + strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) { + return UURET_IOERR; + } + } - optr = otemp; - llen = 0; - } - else { - *optr++ = '='; - *optr++ = HexEncodeTable[itemp[index] >> 4]; - *optr++ = HexEncodeTable[itemp[index] & 0x0f]; - llen += 3; - } + optr = otemp; + llen = 0; + } + else { + *optr++ = '='; + *optr++ = HexEncodeTable[itemp[index] >> 4]; + *optr++ = HexEncodeTable[itemp[index] & 0x0f]; + llen += 3; + } - /* - * Lines must be shorter than 76 characters (not counting CRLF). - * If the line grows longer than that, we must include a soft - * line break. - */ + /* + * Lines must be shorter than 76 characters (not counting CRLF). + * If the line grows longer than that, we must include a soft + * line break. + */ - if (itemp[index+1] != 0 && itemp[index+1] != '\n' && - (llen >= 75 || - (!((itemp[index+1] >= 33 && itemp[index+1] <= 60) || - (itemp[index+1] >= 62 && itemp[index+1] <= 126)) && - llen >= 73))) { + if (itemp[index+1] != 0 && itemp[index+1] != '\n' && + (llen >= 75 || + (!((itemp[index+1] >= 33 && itemp[index+1] <= 60) || + (itemp[index+1] >= 62 && itemp[index+1] <= 126)) && + llen >= 73))) { - *optr++ = '='; - llen++; - - if (fwrite (otemp, 1, llen, outfile) != llen || - fwrite ((char *) eolstring, 1, - strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) { - return UURET_IOERR; - } - - optr = otemp; - llen = 0; - } - } + *optr++ = '='; + llen++; + + if (fwrite (otemp, 1, llen, outfile) != llen || + fwrite ((char *) eolstring, 1, + strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) { + return UURET_IOERR; + } + + optr = otemp; + llen = 0; + } + } } line++; @@ -418,18 +418,18 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3 while (!feof (infile) && (linperfile <= 0 || line < linperfile)) { if ((count = fread (itemp, 1, 128, infile)) != 128) { - if (count == 0) { - break; - } - else if (ferror (infile)) { - return UURET_IOERR; - } + if (count == 0) { + break; + } + else if (ferror (infile)) { + return UURET_IOERR; + } } if (pcrc) - *pcrc = crc32(*pcrc, itemp, count); + *pcrc = crc32(*pcrc, itemp, count); if (crc) - *crc = crc32(*crc, itemp, count); + *crc = crc32(*crc, itemp, count); line++; @@ -438,51 +438,51 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3 */ if (UUBUSYPOLL(ftell(infile)-progress.foffset,progress.fsize)) { - UUMessage (uuencode_id, __LINE__, UUMSG_NOTE, - uustring (S_ENCODE_CANCEL)); - return UURET_CANCEL; + UUMessage (uuencode_id, __LINE__, UUMSG_NOTE, + uustring (S_ENCODE_CANCEL)); + return UURET_CANCEL; } for (index=0; index 127) { - if (fwrite (otemp, 1, llen, outfile) != llen || - fwrite ((char *) eolstring, 1, - strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) { - return UURET_IOERR; - } - llen = 0; - optr = otemp; - } + if (llen > 127) { + if (fwrite (otemp, 1, llen, outfile) != llen || + fwrite ((char *) eolstring, 1, + strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) { + return UURET_IOERR; + } + llen = 0; + optr = otemp; + } - switch ((char) ((int) itemp[index] + 42)) { - case '\0': - case '\t': - case '\n': - case '\r': - case '=': - case '\033': - *optr++ = '='; - *optr++ = (char) ((int) itemp[index] + 42 + 64); - llen += 2; - break; + switch ((char) ((int) itemp[index] + 42)) { + case '\0': + case '\t': + case '\n': + case '\r': + case '=': + case '\033': + *optr++ = '='; + *optr++ = (char) ((int) itemp[index] + 42 + 64); + llen += 2; + break; - case '.': - if (llen == 0) { - *optr++ = '='; - *optr++ = (char) ((int) itemp[index] + 42 + 64); - llen += 2; - } - else { - *optr++ = (char) ((int) itemp[index] + 42); - llen++; - } - break; + case '.': + if (llen == 0) { + *optr++ = '='; + *optr++ = (char) ((int) itemp[index] + 42 + 64); + llen += 2; + } + else { + *optr++ = (char) ((int) itemp[index] + 42); + llen++; + } + break; - default: - *optr++ = (char) ((int) itemp[index] + 42); - llen++; - break; - } + default: + *optr++ = (char) ((int) itemp[index] + 42); + llen++; + break; + } } } @@ -492,9 +492,9 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3 if (llen) { if (fwrite (otemp, 1, llen, outfile) != llen || - fwrite ((char *) eolstring, 1, - strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) { - return UURET_IOERR; + fwrite ((char *) eolstring, 1, + strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) { + return UURET_IOERR; } } @@ -520,9 +520,9 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3 while (!feof (infile) && (linperfile <= 0 || line < linperfile)) { if ((count = fread (itemp, 1, bpl[encoding], infile)) != bpl[encoding]) { if (count == 0) - break; + break; else if (ferror (infile)) - return UURET_IOERR; + return UURET_IOERR; } optr = otemp; @@ -534,7 +534,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3 if (UUBUSYPOLL(ftell(infile)-progress.foffset,progress.fsize)) { UUMessage (uuencode_id, __LINE__, UUMSG_NOTE, - uustring (S_ENCODE_CANCEL)); + uustring (S_ENCODE_CANCEL)); return UURET_CANCEL; } @@ -564,36 +564,36 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3 if (index != count) { if (encoding == B64ENCODED) { - if (count - index == 2) { - *optr++ = table[itemp[index] >> 2]; - *optr++ = table[((itemp[index ] & 0x03) << 4) | - ((itemp[index+1] & 0xf0) >> 4)]; - *optr++ = table[((itemp[index+1] & 0x0f) << 2)]; - *optr++ = '='; - } - else if (count - index == 1) { - *optr++ = table[ itemp[index] >> 2]; - *optr++ = table[(itemp[index] & 0x03) << 4]; - *optr++ = '='; - *optr++ = '='; - } - llen += 4; + if (count - index == 2) { + *optr++ = table[itemp[index] >> 2]; + *optr++ = table[((itemp[index ] & 0x03) << 4) | + ((itemp[index+1] & 0xf0) >> 4)]; + *optr++ = table[((itemp[index+1] & 0x0f) << 2)]; + *optr++ = '='; + } + else if (count - index == 1) { + *optr++ = table[ itemp[index] >> 2]; + *optr++ = table[(itemp[index] & 0x03) << 4]; + *optr++ = '='; + *optr++ = '='; + } + llen += 4; } else if (encoding == UU_ENCODED || encoding == XX_ENCODED) { - if (count - index == 2) { - *optr++ = table[itemp[index] >> 2]; - *optr++ = table[((itemp[index ] & 0x03) << 4) | - ( itemp[index+1] >> 4)]; - *optr++ = table[((itemp[index+1] & 0x0f) << 2)]; - *optr++ = table[0]; - } - else if (count - index == 1) { - *optr++ = table[ itemp[index] >> 2]; - *optr++ = table[(itemp[index] & 0x03) << 4]; - *optr++ = table[0]; - *optr++ = table[0]; - } - llen += 4; + if (count - index == 2) { + *optr++ = table[itemp[index] >> 2]; + *optr++ = table[((itemp[index ] & 0x03) << 4) | + ( itemp[index+1] >> 4)]; + *optr++ = table[((itemp[index+1] & 0x0f) << 2)]; + *optr++ = table[0]; + } + else if (count - index == 1) { + *optr++ = table[ itemp[index] >> 2]; + *optr++ = table[(itemp[index] & 0x03) << 4]; + *optr++ = table[0]; + *optr++ = table[0]; + } + llen += 4; } } @@ -623,7 +623,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3 int UUEXPORT UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding, - char *outfname, char *mimetype, int filemode) + char *outfname, char *mimetype, int filemode) { mimemap *miter=mimetable; struct stat finfo; @@ -639,7 +639,7 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding, (encoding!=UU_ENCODED&&encoding!=XX_ENCODED&&encoding!=B64ENCODED&& encoding!=PT_ENCODED&&encoding!=QP_ENCODED&&encoding!=YENC_ENCODED)) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_PARM_CHECK), "UUEncodeMulti()"); + uustring (S_PARM_CHECK), "UUEncodeMulti()"); return UURET_ILLVAL; } @@ -648,14 +648,14 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding, if (infile==NULL) { if (stat (infname, &finfo) == -1) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_STAT_FILE), - infname, strerror (uu_errno=errno)); + uustring (S_NOT_STAT_FILE), + infname, strerror (uu_errno=errno)); return UURET_IOERR; } if ((theifile = fopen (infname, "rb")) == NULL) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_OPEN_FILE), - infname, strerror (uu_errno=errno)); + uustring (S_NOT_OPEN_FILE), + infname, strerror (uu_errno=errno)); return UURET_IOERR; } themode = (filemode) ? filemode : ((int) finfo.st_mode & 0777); @@ -693,7 +693,7 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding, if (mimetype == NULL) { if ((ptr = _FP_strrchr ((outfname)?outfname:infname, '.'))) { while (miter->extension && _FP_stricmp (ptr+1, miter->extension) != 0) - miter++; + miter++; mimetype = miter->mimetype; } } @@ -708,43 +708,43 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding, if (encoding != YENC_ENCODED) { fprintf (outfile, "Content-Type: %s%s", - (mimetype)?mimetype:"Application/Octet-Stream", - (char *) eolstring); + (mimetype)?mimetype:"Application/Octet-Stream", + (char *) eolstring); fprintf (outfile, "Content-Transfer-Encoding: %s%s", - CTE_TYPE(encoding), (char *) eolstring); + CTE_TYPE(encoding), (char *) eolstring); fprintf (outfile, "Content-Disposition: attachment; filename=\"%s\"%s", - UUFNameFilter ((outfname)?outfname:infname), (char *) eolstring); + UUFNameFilter ((outfname)?outfname:infname), (char *) eolstring); fprintf (outfile, "%s", (char *) eolstring); } if (encoding == UU_ENCODED || encoding == XX_ENCODED) { fprintf (outfile, "begin %o %s%s", - (themode) ? themode : 0644, - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + (themode) ? themode : 0644, + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); } else if (encoding == YENC_ENCODED) { crc = crc32(0L, Z_NULL, 0); crcptr = &crc; if (progress.fsize == -1) { fprintf (outfile, "=ybegin line=128 name=%s%s", - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); } else { fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s", - progress.fsize, - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + progress.fsize, + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); } } if ((res = UUEncodeStream (outfile, theifile, encoding, 0, crcptr, NULL)) != UURET_OK) { if (res != UURET_CANCEL) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_ERR_ENCODING), - UUFNameFilter ((infname)?infname:outfname), - (res==UURET_IOERR)?strerror(uu_errno):UUstrerror(res)); + uustring (S_ERR_ENCODING), + UUFNameFilter ((infname)?infname:outfname), + (res==UURET_IOERR)?strerror(uu_errno):UUstrerror(res)); } progress.action = 0; return res; @@ -752,21 +752,21 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding, if (encoding == UU_ENCODED || encoding == XX_ENCODED) { fprintf (outfile, "%c%s", - (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], - (char *) eolstring); + (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], + (char *) eolstring); fprintf (outfile, "end%s", (char *) eolstring); } else if (encoding == YENC_ENCODED) { if (progress.fsize == -1) { fprintf (outfile, "=yend crc32=%08lx%s", - crc, - (char *) eolstring); + crc, + (char *) eolstring); } else { fprintf (outfile, "=yend size=%ld crc32=%08lx%s", - progress.fsize, - crc, - (char *) eolstring); + progress.fsize, + crc, + (char *) eolstring); } } @@ -789,10 +789,10 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding, int UUEXPORT UUEncodePartial (FILE *outfile, FILE *infile, - char *infname, int encoding, - char *outfname, char *mimetype, - int filemode, int partno, long linperfile, - crc32_t *crcptr) + char *infname, int encoding, + char *outfname, char *mimetype, + int filemode, int partno, long linperfile, + crc32_t *crcptr) { mimemap *miter=mimetable; static FILE *theifile; @@ -809,7 +809,7 @@ UUEncodePartial (FILE *outfile, FILE *infile, (encoding!=UU_ENCODED&&encoding!=XX_ENCODED&&encoding!=B64ENCODED&& encoding!=PT_ENCODED&&encoding!=QP_ENCODED&&encoding!=YENC_ENCODED)) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_PARM_CHECK), "UUEncodePartial()"); + uustring (S_PARM_CHECK), "UUEncodePartial()"); return UURET_ILLVAL; } @@ -822,43 +822,43 @@ UUEncodePartial (FILE *outfile, FILE *infile, if (partno == 1) { if (infile==NULL) { if (stat (infname, &finfo) == -1) { - UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_STAT_FILE), - infname, strerror (uu_errno=errno)); - return UURET_IOERR; + UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, + uustring (S_NOT_STAT_FILE), + infname, strerror (uu_errno=errno)); + return UURET_IOERR; } if ((theifile = fopen (infname, "rb")) == NULL) { - UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_OPEN_FILE), - infname, strerror (uu_errno=errno)); - return UURET_IOERR; + UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, + uustring (S_NOT_OPEN_FILE), + infname, strerror (uu_errno=errno)); + return UURET_IOERR; } if (linperfile <= 0) - numparts = 1; + numparts = 1; else - numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/ - (linperfile*bpl[encoding])); + numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/ + (linperfile*bpl[encoding])); themode = (filemode) ? filemode : ((int) finfo.st_mode & 0777); thesize = (long) finfo.st_size; } else { if (fstat (fileno (infile), &finfo) != 0) { - UUMessage (uuencode_id, __LINE__, UUMSG_WARNING, - uustring (S_STAT_ONE_PART)); - numparts = 1; - themode = (filemode)?filemode:0644; - thesize = -1; + UUMessage (uuencode_id, __LINE__, UUMSG_WARNING, + uustring (S_STAT_ONE_PART)); + numparts = 1; + themode = (filemode)?filemode:0644; + thesize = -1; } else { - if (linperfile <= 0) - numparts = 1; - else - numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/ - (linperfile*bpl[encoding])); + if (linperfile <= 0) + numparts = 1; + else + numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/ + (linperfile*bpl[encoding])); - themode = (int) finfo.st_mode & 0777; - thesize = (long) finfo.st_size; + themode = (int) finfo.st_mode & 0777; + thesize = (long) finfo.st_size; } theifile = infile; } @@ -879,9 +879,9 @@ UUEncodePartial (FILE *outfile, FILE *infile, if (mimetype == NULL) { if ((ptr = _FP_strrchr ((outfname)?outfname:infname, '.'))) { - while (miter->extension && _FP_stricmp (ptr+1, miter->extension) != 0) - miter++; - mimetype = miter->mimetype; + while (miter->extension && _FP_stricmp (ptr+1, miter->extension) != 0) + miter++; + mimetype = miter->mimetype; } } @@ -896,12 +896,12 @@ UUEncodePartial (FILE *outfile, FILE *infile, if (encoding != YENC_ENCODED) { fprintf (outfile, "MIME-Version: 1.0%s", (char *) eolstring); fprintf (outfile, "Content-Type: %s%s", - (mimetype)?mimetype:"Application/Octet-Stream", - (char *) eolstring); + (mimetype)?mimetype:"Application/Octet-Stream", + (char *) eolstring); fprintf (outfile, "Content-Transfer-Encoding: %s%s", - CTE_TYPE(encoding), (char *) eolstring); + CTE_TYPE(encoding), (char *) eolstring); fprintf (outfile, "Content-Disposition: attachment; filename=\"%s\"%s", - UUFNameFilter ((outfname)?outfname:infname), (char *) eolstring); + UUFNameFilter ((outfname)?outfname:infname), (char *) eolstring); } fprintf (outfile, "%s", (char *) eolstring); @@ -912,8 +912,8 @@ UUEncodePartial (FILE *outfile, FILE *infile, if (encoding == UU_ENCODED || encoding == XX_ENCODED) { fprintf (outfile, "begin %o %s%s", - (themode) ? themode : ((filemode)?filemode:0644), - UUFNameFilter ((outfname)?outfname:infname), (char *) eolstring); + (themode) ? themode : ((filemode)?filemode:0644), + UUFNameFilter ((outfname)?outfname:infname), (char *) eolstring); } } if (encoding == YENC_ENCODED) { @@ -921,36 +921,36 @@ UUEncodePartial (FILE *outfile, FILE *infile, pcrcptr = &pcrc; if (numparts != 1) { if (progress.totsize == -1) { - fprintf (outfile, "=ybegin part=%d line=128 name=%s%s", - partno, - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + fprintf (outfile, "=ybegin part=%d line=128 name=%s%s", + partno, + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); } else { - fprintf (outfile, "=ybegin part=%d line=128 size=%ld name=%s%s", - partno, - progress.totsize, - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + fprintf (outfile, "=ybegin part=%d line=128 size=%ld name=%s%s", + partno, + progress.totsize, + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); } fprintf (outfile, "=ypart begin=%ld end=%ld%s", - (partno-1)*linperfile*128+1, - (partno*linperfile*128) < progress.totsize ? - (partno*linperfile*128) : progress.totsize, - (char *) eolstring); + (partno-1)*linperfile*128+1, + (partno*linperfile*128) < progress.totsize ? + (partno*linperfile*128) : progress.totsize, + (char *) eolstring); } else { if (progress.totsize == -1) { - fprintf (outfile, "=ybegin line=128 name=%s%s", - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + fprintf (outfile, "=ybegin line=128 name=%s%s", + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); } else { - fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s", - progress.totsize, - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s", + progress.totsize, + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); } } } @@ -975,13 +975,13 @@ UUEncodePartial (FILE *outfile, FILE *infile, progress.action = UUACT_ENCODING; if ((res = UUEncodeStream (outfile, theifile, encoding, linperfile, - crcptr, pcrcptr)) != UURET_OK) { + crcptr, pcrcptr)) != UURET_OK) { if (infile==NULL) fclose (theifile); if (res != UURET_CANCEL) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_ERR_ENCODING), - UUFNameFilter ((outfname)?outfname:infname), - (res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res)); + uustring (S_ERR_ENCODING), + UUFNameFilter ((outfname)?outfname:infname), + (res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res)); } progress.action = 0; return res; @@ -994,21 +994,21 @@ UUEncodePartial (FILE *outfile, FILE *infile, if (feof (theifile) && (encoding == UU_ENCODED || encoding == XX_ENCODED)) { fprintf (outfile, "%c%s", - (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], - (char *) eolstring); + (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], + (char *) eolstring); fprintf (outfile, "end%s", (char *) eolstring); } else if (encoding == YENC_ENCODED) { if (numparts != 1) { fprintf (outfile, "=yend size=%ld part=%d pcrc32=%08lx", - (partno*linperfile*128) < progress.totsize ? - linperfile*128 : (progress.totsize-(partno-1)*linperfile*128), - partno, - pcrc); + (partno*linperfile*128) < progress.totsize ? + linperfile*128 : (progress.totsize-(partno-1)*linperfile*128), + partno, + pcrc); } else { fprintf (outfile, "=yend size=%ld", - progress.totsize); + progress.totsize); } if (feof (theifile)) fprintf (outfile, " crc32=%08lx", *crcptr); @@ -1050,8 +1050,8 @@ UUEncodePartial (FILE *outfile, FILE *infile, int UUEXPORT UUEncodeToStream (FILE *outfile, FILE *infile, - char *infname, int encoding, - char *outfname, int filemode) + char *infname, int encoding, + char *outfname, int filemode) { struct stat finfo; FILE *theifile; @@ -1066,7 +1066,7 @@ UUEncodeToStream (FILE *outfile, FILE *infile, (encoding!=UU_ENCODED&&encoding!=XX_ENCODED&&encoding!=B64ENCODED&& encoding!=PT_ENCODED&&encoding!=QP_ENCODED&&encoding!=YENC_ENCODED)) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_PARM_CHECK), "UUEncodeToStream()"); + uustring (S_PARM_CHECK), "UUEncodeToStream()"); return UURET_ILLVAL; } @@ -1075,14 +1075,14 @@ UUEncodeToStream (FILE *outfile, FILE *infile, if (infile==NULL) { if (stat (infname, &finfo) == -1) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_STAT_FILE), - infname, strerror (uu_errno=errno)); + uustring (S_NOT_STAT_FILE), + infname, strerror (uu_errno=errno)); return UURET_IOERR; } if ((theifile = fopen (infname, "rb")) == NULL) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_OPEN_FILE), - infname, strerror (uu_errno=errno)); + uustring (S_NOT_OPEN_FILE), + infname, strerror (uu_errno=errno)); return UURET_IOERR; } themode = (filemode) ? filemode : ((int) finfo.st_mode & 0777); @@ -1114,32 +1114,32 @@ UUEncodeToStream (FILE *outfile, FILE *infile, if (encoding == UU_ENCODED || encoding == XX_ENCODED) { fprintf (outfile, "begin %o %s%s", - (themode) ? themode : 0644, - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + (themode) ? themode : 0644, + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); } else if (encoding == YENC_ENCODED) { crc = crc32(0L, Z_NULL, 0); crcptr = &crc; if (progress.fsize == -1) { fprintf (outfile, "=ybegin line=128 name=%s%s", - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); } else { fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s", - progress.fsize, - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + progress.fsize, + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); } } if ((res = UUEncodeStream (outfile, theifile, encoding, 0, crcptr, NULL)) != UURET_OK) { if (res != UURET_CANCEL) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_ERR_ENCODING), - UUFNameFilter ((infname)?infname:outfname), - (res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res)); + uustring (S_ERR_ENCODING), + UUFNameFilter ((infname)?infname:outfname), + (res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res)); } progress.action = 0; return res; @@ -1147,21 +1147,21 @@ UUEncodeToStream (FILE *outfile, FILE *infile, if (encoding == UU_ENCODED || encoding == XX_ENCODED) { fprintf (outfile, "%c%s", - (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], - (char *) eolstring); + (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], + (char *) eolstring); fprintf (outfile, "end%s", (char *) eolstring); } else if (encoding == YENC_ENCODED) { if (progress.fsize == -1) { fprintf (outfile, "=yend crc32=%08lx%s", - crc, - (char *) eolstring); + crc, + (char *) eolstring); } else { fprintf (outfile, "=yend size=%ld crc32=%08lx%s", - progress.fsize, - crc, - (char *) eolstring); + progress.fsize, + crc, + (char *) eolstring); } } @@ -1183,7 +1183,7 @@ UUEncodeToStream (FILE *outfile, FILE *infile, int UUEXPORT UUEncodeToFile (FILE *infile, char *infname, int encoding, - char *outfname, char *diskname, long linperfile) + char *outfname, char *diskname, long linperfile) { int part, numparts, len, filemode, res; char *oname=NULL, *optr, *ptr; @@ -1197,7 +1197,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding, (encoding!=UU_ENCODED&&encoding!=XX_ENCODED&&encoding!=B64ENCODED&& encoding!=PT_ENCODED&&encoding!=QP_ENCODED&&encoding!=YENC_ENCODED)) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_PARM_CHECK), "UUEncodeToFile()"); + uustring (S_PARM_CHECK), "UUEncodeToFile()"); return UURET_ILLVAL; } @@ -1208,20 +1208,20 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding, len = strlen (diskname) + ((uuencodeext)?strlen(uuencodeext):3) + 5; if ((oname = malloc (len)) == NULL) { - UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_OUT_OF_MEMORY), len); - return UURET_NOMEM; + UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, + uustring (S_OUT_OF_MEMORY), len); + return UURET_NOMEM; } sprintf (oname, "%s", diskname); } else { len = ((uusavepath)?strlen(uusavepath):0) + strlen (diskname) - + ((uuencodeext)?strlen(uuencodeext):0) + 5; + + ((uuencodeext)?strlen(uuencodeext):0) + 5; if ((oname = malloc (len)) == NULL) { - UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_OUT_OF_MEMORY), len); - return UURET_NOMEM; + UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, + uustring (S_OUT_OF_MEMORY), len); + return UURET_NOMEM; } sprintf (oname, "%s%s", (uusavepath)?uusavepath:"", diskname); } @@ -1229,17 +1229,17 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding, else { len = ((uusavepath) ? strlen (uusavepath) : 0) + strlen(UUFNameFilter(infname)) + - ((uuencodeext)?strlen(uuencodeext):0) + 5; + ((uuencodeext)?strlen(uuencodeext):0) + 5; if ((oname = malloc (len)) == NULL) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_OUT_OF_MEMORY), len); + uustring (S_OUT_OF_MEMORY), len); return UURET_NOMEM; } optr = UUFNameFilter (infname); sprintf (oname, "%s%s", - (uusavepath)?uusavepath:"", - (*optr=='.')?optr+1:optr); + (uusavepath)?uusavepath:"", + (*optr=='.')?optr+1:optr); } /* @@ -1264,15 +1264,15 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding, if (infile==NULL) { if (stat (infname, &finfo) == -1) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_STAT_FILE), - infname, strerror (uu_errno=errno)); + uustring (S_NOT_STAT_FILE), + infname, strerror (uu_errno=errno)); _FP_free (oname); return UURET_IOERR; } if ((theifile = fopen (infname, "rb")) == NULL) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_OPEN_FILE), - infname, strerror (uu_errno=errno)); + uustring (S_NOT_OPEN_FILE), + infname, strerror (uu_errno=errno)); _FP_free (oname); return UURET_IOERR; } @@ -1280,7 +1280,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding, numparts = 1; else numparts = (int) (((long)finfo.st_size + (linperfile*bpl[encoding]-1)) / - (linperfile*bpl[encoding])); + (linperfile*bpl[encoding])); filemode = (int) finfo.st_mode & 0777; progress.totsize = (long) finfo.st_size; @@ -1294,10 +1294,10 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding, } else { if (linperfile <= 0) - numparts = 1; + numparts = 1; else - numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/ - (linperfile*bpl[encoding])); + numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/ + (linperfile*bpl[encoding])); filemode = (int) finfo.st_mode & 0777; progress.totsize = -1; @@ -1325,12 +1325,12 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding, if (!uu_overwrite) { if (stat (oname, &finfo) == 0) { - UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_TARGET_EXISTS), oname); - if (infile==NULL) fclose (theifile); - progress.action = 0; - free (oname); - return UURET_EXISTS; + UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, + uustring (S_TARGET_EXISTS), oname); + if (infile==NULL) fclose (theifile); + progress.action = 0; + free (oname); + return UURET_EXISTS; } } @@ -1356,8 +1356,8 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding, if ((outfile = fopen (oname, "w")) == NULL) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_OPEN_TARGET), - oname, strerror (uu_errno = errno)); + uustring (S_NOT_OPEN_TARGET), + oname, strerror (uu_errno = errno)); if (infile==NULL) fclose (theifile); progress.action = 0; free (oname); @@ -1368,23 +1368,23 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding, fprintf (outfile, "%s", (char *) eolstring); fprintf (outfile, "_=_ %s", (char *) eolstring); if (numparts == -1) - fprintf (outfile, "_=_ Part %03d of file %s%s", - part, UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + fprintf (outfile, "_=_ Part %03d of file %s%s", + part, UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); else - fprintf (outfile, "_=_ Part %03d of %03d of file %s%s", - part, numparts, - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + fprintf (outfile, "_=_ Part %03d of %03d of file %s%s", + part, numparts, + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); fprintf (outfile, "_=_ %s", (char *) eolstring); fprintf (outfile, "%s", (char *) eolstring); } if (part==1 && (encoding == UU_ENCODED || encoding == XX_ENCODED)) { fprintf (outfile, "begin %o %s%s", - (filemode)?filemode : 0644, - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + (filemode)?filemode : 0644, + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); } else if (encoding == YENC_ENCODED) { if (!crcptr) { @@ -1394,48 +1394,48 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding, pcrc = crc32(0L, Z_NULL, 0); pcrcptr = &pcrc; if (numparts != 1) { - if (progress.totsize == -1) { - fprintf (outfile, "=ybegin part=%d line=128 name=%s%s", - part, - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); - } - else { - fprintf (outfile, "=ybegin part=%d line=128 size=%ld name=%s%s", - part, - progress.totsize, - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); - } + if (progress.totsize == -1) { + fprintf (outfile, "=ybegin part=%d line=128 name=%s%s", + part, + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); + } + else { + fprintf (outfile, "=ybegin part=%d line=128 size=%ld name=%s%s", + part, + progress.totsize, + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); + } - fprintf (outfile, "=ypart begin=%ld end=%ld%s", - (part-1)*linperfile*128+1, - (part*linperfile*128) < progress.totsize ? - (part*linperfile*128) : progress.totsize, - (char *) eolstring); + fprintf (outfile, "=ypart begin=%ld end=%ld%s", + (part-1)*linperfile*128+1, + (part*linperfile*128) < progress.totsize ? + (part*linperfile*128) : progress.totsize, + (char *) eolstring); } else { - if (progress.totsize == -1) { - fprintf (outfile, "=ybegin line=128 name=%s%s", - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); - } - else { - fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s", - progress.totsize, - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); - } + if (progress.totsize == -1) { + fprintf (outfile, "=ybegin line=128 name=%s%s", + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); + } + else { + fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s", + progress.totsize, + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); + } } } if ((res = UUEncodeStream (outfile, theifile, - encoding, linperfile, crcptr, pcrcptr)) != UURET_OK) { + encoding, linperfile, crcptr, pcrcptr)) != UURET_OK) { if (res != UURET_CANCEL) { - UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_ERR_ENCODING), - UUFNameFilter ((infname)?infname:outfname), - (res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res)); + UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, + uustring (S_ERR_ENCODING), + UUFNameFilter ((infname)?infname:outfname), + (res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res)); } if (infile==NULL) fclose (theifile); progress.action = 0; @@ -1446,26 +1446,26 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding, } if (feof (theifile) && - (encoding == UU_ENCODED || encoding == XX_ENCODED)) { + (encoding == UU_ENCODED || encoding == XX_ENCODED)) { fprintf (outfile, "%c%s", - (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], - (char *) eolstring); + (encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0], + (char *) eolstring); fprintf (outfile, "end%s", (char *) eolstring); } else if (encoding == YENC_ENCODED) { if (numparts != 1) { - fprintf (outfile, "=yend size=%ld part=%d pcrc32=%08lx", - (part*linperfile*128) < progress.totsize ? - linperfile*128 : (progress.totsize-(part-1)*linperfile*128), - part, - pcrc); + fprintf (outfile, "=yend size=%ld part=%d pcrc32=%08lx", + (part*linperfile*128) < progress.totsize ? + linperfile*128 : (progress.totsize-(part-1)*linperfile*128), + part, + pcrc); } else { - fprintf (outfile, "=yend size=%ld", - progress.totsize); + fprintf (outfile, "=yend size=%ld", + progress.totsize); } if (feof (theifile)) - fprintf (outfile, " crc32=%08lx", crc); + fprintf (outfile, " crc32=%08lx", crc); fprintf (outfile, "%s", (char *) eolstring); } @@ -1491,26 +1491,26 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding, int UUEXPORT UUE_PrepSingle (FILE *outfile, FILE *infile, - char *infname, int encoding, - char *outfname, int filemode, - char *destination, char *from, - char *subject, int isemail) + char *infname, int encoding, + char *outfname, int filemode, + char *destination, char *from, + char *subject, int isemail) { return UUE_PrepSingleExt (outfile, infile, - infname, encoding, - outfname, filemode, - destination, from, - subject, NULL, - isemail); + infname, encoding, + outfname, filemode, + destination, from, + subject, NULL, + isemail); } int UUEXPORT UUE_PrepSingleExt (FILE *outfile, FILE *infile, - char *infname, int encoding, - char *outfname, int filemode, - char *destination, char *from, - char *subject, char *replyto, - int isemail) + char *infname, int encoding, + char *outfname, int filemode, + char *destination, char *from, + char *subject, char *replyto, + int isemail) { mimemap *miter=mimetable; char *subline, *oname; @@ -1521,7 +1521,7 @@ UUE_PrepSingleExt (FILE *outfile, FILE *infile, (encoding!=UU_ENCODED&&encoding!=XX_ENCODED&&encoding!=B64ENCODED&& encoding!=PT_ENCODED&&encoding!=QP_ENCODED&&encoding!=YENC_ENCODED)) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_PARM_CHECK), "UUE_PrepSingle()"); + uustring (S_PARM_CHECK), "UUE_PrepSingle()"); return UURET_ILLVAL; } @@ -1542,7 +1542,7 @@ UUE_PrepSingleExt (FILE *outfile, FILE *infile, if ((subline = (char *) malloc (len)) == NULL) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_OUT_OF_MEMORY), len); + uustring (S_OUT_OF_MEMORY), len); return UURET_NOMEM; } @@ -1564,8 +1564,8 @@ UUE_PrepSingleExt (FILE *outfile, FILE *infile, } if (destination) { fprintf (outfile, "%s: %s%s", - (isemail)?"To":"Newsgroups", - destination, (char *) eolstring); + (isemail)?"To":"Newsgroups", + destination, (char *) eolstring); } fprintf (outfile, "Subject: %s%s", subline, (char *) eolstring); @@ -1577,17 +1577,17 @@ UUE_PrepSingleExt (FILE *outfile, FILE *infile, if (encoding != YENC_ENCODED) { fprintf (outfile, "MIME-Version: 1.0%s", (char *) eolstring); fprintf (outfile, "Content-Type: %s; name=\"%s\"%s", - (mimetype)?mimetype:"Application/Octet-Stream", - UUFNameFilter ((outfname)?outfname:infname), - (char *) eolstring); + (mimetype)?mimetype:"Application/Octet-Stream", + UUFNameFilter ((outfname)?outfname:infname), + (char *) eolstring); fprintf (outfile, "Content-Transfer-Encoding: %s%s", - CTE_TYPE(encoding), (char *) eolstring); + CTE_TYPE(encoding), (char *) eolstring); } fprintf (outfile, "%s", (char *) eolstring); res = UUEncodeToStream (outfile, infile, infname, encoding, - outfname, filemode); + outfname, filemode); _FP_free (subline); return res; @@ -1595,29 +1595,29 @@ UUE_PrepSingleExt (FILE *outfile, FILE *infile, int UUEXPORT UUE_PrepPartial (FILE *outfile, FILE *infile, - char *infname, int encoding, - char *outfname, int filemode, - int partno, long linperfile, long filesize, - char *destination, char *from, char *subject, - int isemail) + char *infname, int encoding, + char *outfname, int filemode, + int partno, long linperfile, long filesize, + char *destination, char *from, char *subject, + int isemail) { return UUE_PrepPartialExt (outfile, infile, - infname, encoding, - outfname, filemode, - partno, linperfile, filesize, - destination, - from, subject, NULL, - isemail); + infname, encoding, + outfname, filemode, + partno, linperfile, filesize, + destination, + from, subject, NULL, + isemail); } int UUEXPORT UUE_PrepPartialExt (FILE *outfile, FILE *infile, - char *infname, int encoding, - char *outfname, int filemode, - int partno, long linperfile, long filesize, - char *destination, - char *from, char *subject, char *replyto, - int isemail) + char *infname, int encoding, + char *outfname, int filemode, + int partno, long linperfile, long filesize, + char *destination, + char *from, char *subject, char *replyto, + int isemail) { static int numparts, themode; static char mimeid[64]; @@ -1633,7 +1633,7 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile, (encoding!=UU_ENCODED&&encoding!=XX_ENCODED&&encoding!=B64ENCODED&& encoding!=PT_ENCODED&&encoding!=QP_ENCODED&&encoding!=YENC_ENCODED)) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_PARM_CHECK), "UUE_PrepPartial()"); + uustring (S_PARM_CHECK), "UUE_PrepPartial()"); return UURET_ILLVAL; } @@ -1647,55 +1647,55 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile, if (partno == 1) { if (infile==NULL) { if (stat (infname, &finfo) == -1) { - UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_STAT_FILE), - infname, strerror (uu_errno=errno)); - return UURET_IOERR; + UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, + uustring (S_NOT_STAT_FILE), + infname, strerror (uu_errno=errno)); + return UURET_IOERR; } if ((theifile = fopen (infname, "rb")) == NULL) { - UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_OPEN_FILE), - infname, strerror (uu_errno=errno)); - return UURET_IOERR; + UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, + uustring (S_NOT_OPEN_FILE), + infname, strerror (uu_errno=errno)); + return UURET_IOERR; } if (linperfile <= 0) - numparts = 1; + numparts = 1; else - numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/ - (linperfile*bpl[encoding])); + numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/ + (linperfile*bpl[encoding])); themode = (filemode) ? filemode : ((int) finfo.st_mode & 0777); thesize = (long) finfo.st_size; } else { if (fstat (fileno (infile), &finfo) != 0) { - if (filesize <= 0) { - UUMessage (uuencode_id, __LINE__, UUMSG_WARNING, - uustring (S_STAT_ONE_PART)); - numparts = 1; - themode = (filemode)?filemode:0644; - thesize = -1; - } - else { - if (linperfile <= 0) - numparts = 1; - else - numparts = (int) ((filesize+(linperfile*bpl[encoding]-1))/ - (linperfile*bpl[encoding])); + if (filesize <= 0) { + UUMessage (uuencode_id, __LINE__, UUMSG_WARNING, + uustring (S_STAT_ONE_PART)); + numparts = 1; + themode = (filemode)?filemode:0644; + thesize = -1; + } + else { + if (linperfile <= 0) + numparts = 1; + else + numparts = (int) ((filesize+(linperfile*bpl[encoding]-1))/ + (linperfile*bpl[encoding])); - themode = (filemode)?filemode:0644; - thesize = filesize; - } + themode = (filemode)?filemode:0644; + thesize = filesize; + } } else { - if (linperfile <= 0) - numparts = 1; - else - numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/ - (linperfile*bpl[encoding])); + if (linperfile <= 0) + numparts = 1; + else + numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/ + (linperfile*bpl[encoding])); - filemode = (int) finfo.st_mode & 0777; - thesize = (long) finfo.st_size; + filemode = (int) finfo.st_mode & 0777; + thesize = (long) finfo.st_size; } theifile = infile; } @@ -1707,8 +1707,8 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile, if (numparts == 1) { if (infile==NULL) fclose (theifile); return UUE_PrepSingleExt (outfile, infile, infname, encoding, - outfname, filemode, destination, - from, subject, replyto, isemail); + outfname, filemode, destination, + from, subject, replyto, isemail); } /* @@ -1716,13 +1716,13 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile, */ sprintf (mimeid, "UUDV-%ld.%ld.%s", - (long) time(NULL), thesize, - (strlen(oname)>16)?"oops":oname); + (long) time(NULL), thesize, + (strlen(oname)>16)?"oops":oname); } if ((subline = (char *) malloc (len)) == NULL) { UUMessage (uuencode_id, __LINE__, UUMSG_ERROR, - uustring (S_OUT_OF_MEMORY), len); + uustring (S_OUT_OF_MEMORY), len); if (infile==NULL) fclose (theifile); return UURET_NOMEM; } @@ -1734,18 +1734,18 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile, crcptr = &crc; if (subject) sprintf (subline, "- %s - %s (%03d/%03d)", oname, subject, - partno, numparts); + partno, numparts); else sprintf (subline, "- %s - (%03d/%03d)", oname, - partno, numparts); + partno, numparts); } else { if (subject) sprintf (subline, "%s (%03d/%03d) - [ %s ]", - subject, partno, numparts, oname); + subject, partno, numparts, oname); else sprintf (subline, "[ %s ] (%03d/%03d)", - oname, partno, numparts); + oname, partno, numparts); } if (from) { @@ -1754,8 +1754,8 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile, if (destination) { fprintf (outfile, "%s: %s%s", - (isemail)?"To":"Newsgroups", - destination, (char *) eolstring); + (isemail)?"To":"Newsgroups", + destination, (char *) eolstring); } fprintf (outfile, "Subject: %s%s", subline, (char *) eolstring); @@ -1767,17 +1767,17 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile, if (encoding != YENC_ENCODED) { fprintf (outfile, "MIME-Version: 1.0%s", (char *) eolstring); fprintf (outfile, "Content-Type: Message/Partial; number=%d; total=%d;%s", - partno, numparts, (char *) eolstring); + partno, numparts, (char *) eolstring); fprintf (outfile, "\tid=\"%s\"%s", - mimeid, (char *) eolstring); + mimeid, (char *) eolstring); } fprintf (outfile, "%s", (char *) eolstring); res = UUEncodePartial (outfile, theifile, - infname, encoding, - (outfname)?outfname:infname, NULL, - themode, partno, linperfile, crcptr); + infname, encoding, + (outfname)?outfname:infname, NULL, + themode, partno, linperfile, crcptr); _FP_free (subline); diff --git a/goldlib/uulib/uuint.h b/goldlib/uulib/uuint.h index 4d01ca8..4dfdaaf 100644 --- a/goldlib/uulib/uuint.h +++ b/goldlib/uulib/uuint.h @@ -27,9 +27,9 @@ #ifndef _ANSI_ARGS_ #ifdef PROTOTYPES -#define _ANSI_ARGS_(c) c +#define _ANSI_ARGS_(c) c #else -#define _ANSI_ARGS_(c) () +#define _ANSI_ARGS_(c) () #endif #endif @@ -37,24 +37,24 @@ * Busy Polls will be made after processing ... lines */ -#define BUSY_LINE_TICKS 50 +#define BUSY_LINE_TICKS 50 /* * States of MIME scanner */ -#define MS_HEADERS 1 /* still inside of headers */ -#define MS_BODY 2 /* body of `simple' messages */ -#define MS_PREAMBLE 3 /* preamble of Multipart/Mixed */ -#define MS_SUBPART 4 /* within one of the Multiparts */ -#define MS_EPILOGUE 5 /* epilogue of Multipart/Mixed */ +#define MS_HEADERS 1 /* still inside of headers */ +#define MS_BODY 2 /* body of `simple' messages */ +#define MS_PREAMBLE 3 /* preamble of Multipart/Mixed */ +#define MS_SUBPART 4 /* within one of the Multiparts */ +#define MS_EPILOGUE 5 /* epilogue of Multipart/Mixed */ /* * Number of subsequent encoded lines we require to believe this * is valid data. */ -#define ELC_COUNT 4 +#define ELC_COUNT 4 /* * Flags a part may have. FL_PROPER means that we are sure about the file's @@ -62,11 +62,11 @@ * coding. */ -#define FL_NONE 0 /* no flag, just plain normal */ -#define FL_SINGLE 1 /* standalone MSG, do not mix */ -#define FL_PARTIAL 2 /* from Message/Partial */ -#define FL_PROPER 4 /* proper MIME part */ -#define FL_TOEND 8 /* part continues to EOF */ +#define FL_NONE 0 /* no flag, just plain normal */ +#define FL_SINGLE 1 /* standalone MSG, do not mix */ +#define FL_PARTIAL 2 /* from Message/Partial */ +#define FL_PROPER 4 /* proper MIME part */ +#define FL_TOEND 8 /* part continues to EOF */ /* * Auxiliary macro: compute the percentage of a against b. @@ -75,8 +75,8 @@ * by zero for b<100 and the result doesn't become larger than 100% */ -#define UUPERCENT(a,b) ((int) ((unsigned long)(a) / \ - (((unsigned long)(b)/100)+1))) +#define UUPERCENT(a,b) ((int) ((unsigned long)(a) / \ + (((unsigned long)(b)/100)+1))) /* * Make the Busy Callback easier. The macro returns true if the BusyCallback @@ -93,9 +93,9 @@ extern unsigned long uuyctr; */ typedef struct { - int restart; /* restarting after a MIME body (not subpart) */ - int afterdata; /* after we had useful data in freestyle mode */ - int afternl; /* after an empty line in freestyle mode */ + int restart; /* restarting after a MIME body (not subpart) */ + int afterdata; /* after we had useful data in freestyle mode */ + int afternl; /* after an empty line in freestyle mode */ } headercount; extern headercount hlcount; @@ -107,18 +107,18 @@ extern headercount hlcount; */ typedef struct _headers { - char *from; /* From: */ - char *subject; /* Subject: */ - char *rcpt; /* To: */ - char *date; /* Date: */ - char *mimevers; /* MIME-Version: */ - char *ctype; /* Content-Type: */ - char *ctenc; /* Content-Transfer-Encoding: */ - char *fname; /* Potential Filename from Content-Type Parameter */ - char *boundary; /* MIME-Boundary from Content-Type Parameter */ - char *mimeid; /* MIME-Id for Message/Partial */ - int partno; /* part number for Message/Partial */ - int numparts; /* number of parts for Message/Partial */ + char *from; /* From: */ + char *subject; /* Subject: */ + char *rcpt; /* To: */ + char *date; /* Date: */ + char *mimevers; /* MIME-Version: */ + char *ctype; /* Content-Type: */ + char *ctenc; /* Content-Transfer-Encoding: */ + char *fname; /* Potential Filename from Content-Type Parameter */ + char *boundary; /* MIME-Boundary from Content-Type Parameter */ + char *mimeid; /* MIME-Id for Message/Partial */ + int partno; /* part number for Message/Partial */ + int numparts; /* number of parts for Message/Partial */ } headers; /* @@ -126,12 +126,12 @@ typedef struct _headers { */ typedef struct _scanstate { - int isfolder; /* if we think this is a valid email folder */ - int ismime; /* if we are within a valid MIME message */ - int mimestate; /* state of MIME scanner */ - int mimeenc; /* encoding of this MIME file */ - char *source; /* source filename */ - headers envelope; /* mail envelope headers */ + int isfolder; /* if we think this is a valid email folder */ + int ismime; /* if we are within a valid MIME message */ + int mimestate; /* state of MIME scanner */ + int mimeenc; /* encoding of this MIME file */ + char *source; /* source filename */ + headers envelope; /* mail envelope headers */ } scanstate; /* @@ -145,23 +145,23 @@ typedef struct _scanstate { **/ typedef struct _fileread { - char *subject; /* Whole subject line */ - char *filename; /* Only filled in if begin detected */ - char *origin; /* Whole 'From:' line */ - char *mimeid; /* the ID for Mime-encoded files */ - char *mimetype; /* Content-Type */ - short mode; /* Mode of File (from 'begin') */ - int begin; /* begin detected */ - int end; /* end detected */ - int flags; /* associated flags */ + char *subject; /* Whole subject line */ + char *filename; /* Only filled in if begin detected */ + char *origin; /* Whole 'From:' line */ + char *mimeid; /* the ID for Mime-encoded files */ + char *mimetype; /* Content-Type */ + short mode; /* Mode of File (from 'begin') */ + int begin; /* begin detected */ + int end; /* end detected */ + int flags; /* associated flags */ - short uudet; /* valid encoded data. value indicates encoding */ - short partno; /* Mime-files have a part number within */ - short maxpno; /* ... plus the total number of parts */ + short uudet; /* valid encoded data. value indicates encoding */ + short partno; /* Mime-files have a part number within */ + short maxpno; /* ... plus the total number of parts */ - char *sfname; /* Associated source file */ - long startpos; /* ftell() position where data starts */ - long length; /* length of data */ + char *sfname; /* Associated source file */ + long startpos; /* ftell() position where data starts */ + long length; /* length of data */ } fileread; /* @@ -275,64 +275,64 @@ extern char * (*uu_FNameFilter) _ANSI_ARGS_((void *, char *)); */ #if defined(STDC_HEADERS) || defined(HAVE_STDARG_H) -int UUMessage _ANSI_ARGS_((char *, int, - int, char *, ...)); +int UUMessage _ANSI_ARGS_((char *, int, + int, char *, ...)); #else -int UUMessage (); +int UUMessage (); #endif -int UUBusyPoll _ANSI_ARGS_((void)); +int UUBusyPoll _ANSI_ARGS_((void)); /* * Functions from uucheck.c */ -uufile * UUPreProcessPart _ANSI_ARGS_((fileread *, int *)); -int UUInsertPartToList _ANSI_ARGS_((uufile *)); -uulist * UUCheckGlobalList _ANSI_ARGS_((void)); +uufile * UUPreProcessPart _ANSI_ARGS_((fileread *, int *)); +int UUInsertPartToList _ANSI_ARGS_((uufile *)); +uulist * UUCheckGlobalList _ANSI_ARGS_((void)); /* * Functions from uuutil.c */ -void UUkillfread _ANSI_ARGS_((fileread *)); -void UUkillfile _ANSI_ARGS_((uufile *)); -void UUkilllist _ANSI_ARGS_((uulist *)); -void UUkillheaders _ANSI_ARGS_((headers *)); +void UUkillfread _ANSI_ARGS_((fileread *)); +void UUkillfile _ANSI_ARGS_((uufile *)); +void UUkilllist _ANSI_ARGS_((uulist *)); +void UUkillheaders _ANSI_ARGS_((headers *)); -fileread * ScanPart _ANSI_ARGS_((FILE *, char *, int *)); +fileread * ScanPart _ANSI_ARGS_((FILE *, char *, int *)); -int UUbhdecomp _ANSI_ARGS_((char *, char *, - char *, int *, - size_t, size_t, - size_t *)); -size_t UUbhwrite _ANSI_ARGS_((char *, size_t, size_t, - FILE *)); +int UUbhdecomp _ANSI_ARGS_((char *, char *, + char *, int *, + size_t, size_t, + size_t *)); +size_t UUbhwrite _ANSI_ARGS_((char *, size_t, size_t, + FILE *)); /* * Functions from uunconc.c */ -int UURepairData _ANSI_ARGS_((FILE *, char *, - int, int *)); +int UURepairData _ANSI_ARGS_((FILE *, char *, + int, int *)); -void UUInitConc _ANSI_ARGS_((void)); -int UUValidData _ANSI_ARGS_((char *, int, int *)); -size_t UUDecodeLine _ANSI_ARGS_((char *, char *, int)); -int UUDecodePart _ANSI_ARGS_((FILE *, FILE *, int *, - long, int, int, char *)); -int UUDecode _ANSI_ARGS_((uulist *)); +void UUInitConc _ANSI_ARGS_((void)); +int UUValidData _ANSI_ARGS_((char *, int, int *)); +size_t UUDecodeLine _ANSI_ARGS_((char *, char *, int)); +int UUDecodePart _ANSI_ARGS_((FILE *, FILE *, int *, + long, int, int, char *)); +int UUDecode _ANSI_ARGS_((uulist *)); /* * Message retrieval from uustring.c */ -char * uustring _ANSI_ARGS_((int)); +char * uustring _ANSI_ARGS_((int)); /* * From uuscan.c */ -int UUScanHeader _ANSI_ARGS_((FILE *, headers *)); +int UUScanHeader _ANSI_ARGS_((FILE *, headers *)); #ifdef __cplusplus } diff --git a/goldlib/uulib/uulib.c b/goldlib/uulib/uulib.c index dbed3cc..dbadcd9 100644 --- a/goldlib/uulib/uulib.c +++ b/goldlib/uulib/uulib.c @@ -86,7 +86,7 @@ char * uulib_id = "$Id$"; #ifdef SYSTEM_WINDLL BOOL _export WINAPI DllEntryPoint (HINSTANCE hInstance, DWORD seginfo, - LPVOID lpCmdLine) + LPVOID lpCmdLine) { /* Don't do anything, so just return true */ return TRUE; @@ -128,24 +128,24 @@ void *uu_FFCBArg = NULL; * Global variables */ -int uu_fast_scanning = 0; /* assumes at most 1 part per file */ -int uu_bracket_policy = 0; /* gives part numbers in [] higher priority */ -int uu_verbose = 1; /* enables/disables messages¬es */ -int uu_desperate = 0; /* desperate mode */ -int uu_ignreply = 0; /* ignore replies */ -int uu_debug = 0; /* debugging mode (print __FILE__/__LINE__) */ -int uu_errno = 0; /* the errno that caused this UURET_IOERR */ -int uu_dumbness = 0; /* switch off the program's intelligence */ -int uu_overwrite = 1; /* whether it's ok to overwrite ex. files */ -int uu_ignmode = 0; /* ignore the original file mode */ -int uu_handletext = 0; /* do we want text/plain messages */ -int uu_usepreamble = 0; /* do we want Mime preambles/epilogues */ -int uu_tinyb64 = 0; /* detect short B64 outside of MIME */ +int uu_fast_scanning = 0; /* assumes at most 1 part per file */ +int uu_bracket_policy = 0; /* gives part numbers in [] higher priority */ +int uu_verbose = 1; /* enables/disables messages¬es */ +int uu_desperate = 0; /* desperate mode */ +int uu_ignreply = 0; /* ignore replies */ +int uu_debug = 0; /* debugging mode (print __FILE__/__LINE__) */ +int uu_errno = 0; /* the errno that caused this UURET_IOERR */ +int uu_dumbness = 0; /* switch off the program's intelligence */ +int uu_overwrite = 1; /* whether it's ok to overwrite ex. files */ +int uu_ignmode = 0; /* ignore the original file mode */ +int uu_handletext = 0; /* do we want text/plain messages */ +int uu_usepreamble = 0; /* do we want Mime preambles/epilogues */ +int uu_tinyb64 = 0; /* detect short B64 outside of MIME */ int uu_remove_input = 0; /* remove input files after decoding */ int uu_more_mime = 0; /* strictly adhere to MIME headers */ headercount hlcount = { - 3, /* restarting after a MIME body */ + 3, /* restarting after a MIME body */ 2, /* after useful data in freestyle mode */ 1 /* after useful data and an empty line */ }; @@ -186,9 +186,9 @@ uulist *UUGlobalFileList = NULL; * time values for BusyCallback. msecs is MILLIsecs here */ -static long uu_busy_msecs = 0; /* call callback function each msecs */ -static long uu_last_secs = 0; /* secs of last call to callback */ -static long uu_last_usecs = 0; /* usecs of last call to callback */ +static long uu_busy_msecs = 0; /* call callback function each msecs */ +static long uu_last_secs = 0; /* secs of last call to callback */ +static long uu_last_usecs = 0; /* usecs of last call to callback */ /* * progress information @@ -228,7 +228,7 @@ typedef struct { static allomap toallocate[] = { { &uugen_fnbuffer, 1024 }, /* generic filename buffer */ { &uugen_inbuffer, 1024 }, /* generic input data buffer */ - { &uucheck_lastname, 256 }, /* from uucheck.c */ + { &uucheck_lastname, 256 }, /* from uucheck.c */ { &uucheck_tempname, 256 }, { &uuestr_itemp, 256 }, /* from uuencode.c:UUEncodeStream() */ { &uuestr_otemp, 1024 }, @@ -392,7 +392,7 @@ UUInitialize (void) * areas (uulib_msgstring) in UUMessage() */ for (aiter=toallocate; aiter->ptr; aiter++) { - _FP_free (*(aiter->ptr)); + _FP_free (*(aiter->ptr)); } return UURET_NOMEM; } @@ -575,7 +575,7 @@ UUstrerror (int code) int UUEXPORT UUSetMsgCallback (void *opaque, - void (*func) _ANSI_ARGS_((void *, char *, int))) + void (*func) _ANSI_ARGS_((void *, char *, int))) { uu_MsgCallback = func; uu_MsgCBArg = opaque; @@ -585,8 +585,8 @@ UUSetMsgCallback (void *opaque, int UUEXPORT UUSetBusyCallback (void *opaque, - int (*func) _ANSI_ARGS_((void *, uuprogress *)), - long msecs) + int (*func) _ANSI_ARGS_((void *, uuprogress *)), + long msecs) { uu_BusyCallback = func; uu_BusyCBArg = opaque; @@ -597,7 +597,7 @@ UUSetBusyCallback (void *opaque, int UUEXPORT UUSetFileCallback (void *opaque, - int (*func) _ANSI_ARGS_((void *, char *, char *, int))) + int (*func) _ANSI_ARGS_((void *, char *, char *, int))) { uu_FileCallback = func; uu_FileCBArg = opaque; @@ -607,7 +607,7 @@ UUSetFileCallback (void *opaque, int UUEXPORT UUSetFNameFilter (void *opaque, - char * (*func) _ANSI_ARGS_((void *, char *))) + char * (*func) _ANSI_ARGS_((void *, char *))) { uu_FNameFilter = func; uu_FFCBArg = opaque; @@ -664,15 +664,15 @@ UULoadFile (char *filename, char *fileid, int delflag) if ((datei = fopen (filename, "rb")) == NULL) { UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_OPEN_SOURCE), - filename, strerror (uu_errno = errno)); + uustring (S_NOT_OPEN_SOURCE), + filename, strerror (uu_errno = errno)); return UURET_IOERR; } if (fstat (fileno(datei), &finfo) == -1) { UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_STAT_FILE), - filename, strerror (uu_errno = errno)); + uustring (S_NOT_STAT_FILE), + filename, strerror (uu_errno = errno)); fclose (datei); return UURET_IOERR; } @@ -684,11 +684,11 @@ UULoadFile (char *filename, char *fileid, int delflag) if (delflag && fileid==NULL) { if ((killem = (itbd *) malloc (sizeof (itbd))) == NULL) { UUMessage (uulib_id, __LINE__, UUMSG_WARNING, - uustring (S_OUT_OF_MEMORY), sizeof (itbd)); + uustring (S_OUT_OF_MEMORY), sizeof (itbd)); } else if ((killem->fname = _FP_strdup (filename)) == NULL) { UUMessage (uulib_id, __LINE__, UUMSG_WARNING, - uustring (S_OUT_OF_MEMORY), strlen(filename)+1); + uustring (S_OUT_OF_MEMORY), strlen(filename)+1); _FP_free (killem); } else { @@ -704,9 +704,9 @@ UULoadFile (char *filename, char *fileid, int delflag) progress.percent = 0; progress.foffset = 0; _FP_strncpy (progress.curfile, - (strlen(filename)>255)? - (filename+strlen(filename)-255):filename, - 256); + (strlen(filename)>255)? + (filename+strlen(filename)-255):filename, + 256); progress.action = UUACT_SCANNING; if (fileid == NULL) @@ -724,24 +724,24 @@ UULoadFile (char *filename, char *fileid, int delflag) if ((loaded = ScanPart (datei, fileid, &sr)) == NULL) { if (sr != UURET_NODATA && sr != UURET_OK && sr != UURET_CONT) { - UUkillfread (loaded); - if (sr != UURET_CANCEL) { - UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_READ_ERROR), filename, - strerror (uu_errno)); - } - UUCheckGlobalList (); - progress.action = 0; - fclose (datei); - return sr; + UUkillfread (loaded); + if (sr != UURET_CANCEL) { + UUMessage (uulib_id, __LINE__, UUMSG_ERROR, + uustring (S_READ_ERROR), filename, + strerror (uu_errno)); + } + UUCheckGlobalList (); + progress.action = 0; + fclose (datei); + return sr; } continue; } if (ferror (datei)) { UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_READ_ERROR), filename, - strerror (uu_errno = errno)); + uustring (S_READ_ERROR), filename, + strerror (uu_errno = errno)); UUCheckGlobalList (); progress.action = 0; fclose (datei); @@ -749,8 +749,8 @@ UULoadFile (char *filename, char *fileid, int delflag) } if ((loaded->uudet == QP_ENCODED || loaded->uudet == PT_ENCODED) && - (loaded->filename == NULL || *(loaded->filename) == '\0') && - !uu_handletext && (loaded->flags&FL_PARTIAL)==0) { + (loaded->filename == NULL || *(loaded->filename) == '\0') && + !uu_handletext && (loaded->flags&FL_PARTIAL)==0) { /* * Don't want text */ @@ -759,9 +759,9 @@ UULoadFile (char *filename, char *fileid, int delflag) } if ((loaded->subject == NULL || *(loaded->subject) == '\0') && - (loaded->mimeid == NULL || *(loaded->mimeid) == '\0') && - (loaded->filename== NULL || *(loaded->filename)== '\0') && - (loaded->uudet == 0)) { + (loaded->mimeid == NULL || *(loaded->mimeid) == '\0') && + (loaded->filename== NULL || *(loaded->filename)== '\0') && + (loaded->uudet == 0)) { /* * no useful data here */ @@ -775,9 +775,9 @@ UULoadFile (char *filename, char *fileid, int delflag) * no useful data found */ if (res != UURET_NODATA) { - UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_READ_ERROR), filename, - (res==UURET_IOERR)?strerror(uu_errno):UUstrerror(res)); + UUMessage (uulib_id, __LINE__, UUMSG_ERROR, + uustring (S_READ_ERROR), filename, + (res==UURET_IOERR)?strerror(uu_errno):UUstrerror(res)); } UUkillfread (loaded); if (uu_fast_scanning && sr != UURET_CONT) break; @@ -785,19 +785,19 @@ UULoadFile (char *filename, char *fileid, int delflag) } if ((loaded->subject && *(loaded->subject)) || - (loaded->mimeid && *(loaded->mimeid)) || - (loaded->filename&& *(loaded->filename))|| - (loaded->uudet)) { + (loaded->mimeid && *(loaded->mimeid)) || + (loaded->filename&& *(loaded->filename))|| + (loaded->uudet)) { UUMessage (uulib_id, __LINE__, UUMSG_MESSAGE, - uustring (S_LOADED_PART), - filename, - (loaded->subject) ? loaded->subject : "", - (fload->subfname) ? fload->subfname : "", - (loaded->filename) ? loaded->filename : "", - fload->partno, - (loaded->begin) ? "begin" : "", - (loaded->end) ? "end" : "", - codenames[loaded->uudet]); + uustring (S_LOADED_PART), + filename, + (loaded->subject) ? loaded->subject : "", + (fload->subfname) ? fload->subfname : "", + (loaded->filename) ? loaded->filename : "", + fload->partno, + (loaded->begin) ? "begin" : "", + (loaded->end) ? "end" : "", + codenames[loaded->uudet]); } if ((res = UUInsertPartToList (fload))) { @@ -807,13 +807,13 @@ UULoadFile (char *filename, char *fileid, int delflag) UUkillfile (fload); if (res != UURET_NODATA) { - UUCheckGlobalList (); - progress.action = 0; - fclose (datei); - return res; + UUCheckGlobalList (); + progress.action = 0; + fclose (datei); + return res; } if (uu_fast_scanning && sr != UURET_CONT) - break; + break; continue; } @@ -833,7 +833,7 @@ UULoadFile (char *filename, char *fileid, int delflag) if (!uu_fast_scanning && count==0) { UUMessage (uulib_id, __LINE__, UUMSG_NOTE, - uustring (S_NO_DATA_FOUND), filename); + uustring (S_NO_DATA_FOUND), filename); } progress.action = 0; @@ -873,14 +873,14 @@ UUDecodeFile (uulist *thefile, char *destname) if (thefile->binfile == NULL) { UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_NO_BIN_FILE)); + uustring (S_NO_BIN_FILE)); return UURET_IOERR; } if ((source = fopen (thefile->binfile, "rb")) == NULL) { UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_OPEN_FILE), - thefile->binfile, strerror (uu_errno = errno)); + uustring (S_NOT_OPEN_FILE), + thefile->binfile, strerror (uu_errno = errno)); return UURET_IOERR; } @@ -890,8 +890,8 @@ UUDecodeFile (uulist *thefile, char *destname) if ((thefile->mode & 0777) != thefile->mode) { UUMessage (uulib_id, __LINE__, UUMSG_NOTE, - uustring (S_STRIPPED_SETUID), - destname, (int)thefile->mode); + uustring (S_STRIPPED_SETUID), + destname, (int)thefile->mode); thefile->mode &= 0777; } @@ -910,9 +910,9 @@ UUDecodeFile (uulist *thefile, char *destname) strcpy (uugen_fnbuffer, destname); else { sprintf (uugen_fnbuffer, "%s%s", - (uusavepath)?uusavepath:"", - UUFNameFilter ((thefile->filename)? - thefile->filename:"unknown.xxx")); + (uusavepath)?uusavepath:"", + UUFNameFilter ((thefile->filename)? + thefile->filename:"unknown.xxx")); } /* @@ -922,7 +922,7 @@ UUDecodeFile (uulist *thefile, char *destname) if (!uu_overwrite) { if (stat (uugen_fnbuffer, &finfo) == 0) { UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_TARGET_EXISTS), uugen_fnbuffer); + uustring (S_TARGET_EXISTS), uugen_fnbuffer); fclose (source); return UURET_EXISTS; } @@ -930,17 +930,17 @@ UUDecodeFile (uulist *thefile, char *destname) if (fstat (fileno(source), &finfo) == -1) { UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_STAT_FILE), - thefile->binfile, strerror (uu_errno = errno)); + uustring (S_NOT_STAT_FILE), + thefile->binfile, strerror (uu_errno = errno)); fclose (source); return UURET_IOERR; } progress.action = 0; _FP_strncpy (progress.curfile, - (strlen(uugen_fnbuffer)>255)? - (uugen_fnbuffer+strlen(uugen_fnbuffer)-255):uugen_fnbuffer, - 256); + (strlen(uugen_fnbuffer)>255)? + (uugen_fnbuffer+strlen(uugen_fnbuffer)-255):uugen_fnbuffer, + 256); progress.partno = 0; progress.numparts = 1; progress.fsize = (long) ((finfo.st_size)?finfo.st_size:-1); @@ -953,8 +953,8 @@ UUDecodeFile (uulist *thefile, char *destname) (uu_ignmode)?0666:thefile->mode)) == -1) { progress.action = 0; UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_OPEN_TARGET), - uugen_fnbuffer, strerror (uu_errno = errno)); + uustring (S_NOT_OPEN_TARGET), + uugen_fnbuffer, strerror (uu_errno = errno)); fclose (source); return UURET_IOERR; } @@ -962,8 +962,8 @@ UUDecodeFile (uulist *thefile, char *destname) if ((target = fdopen (fildes, "wb")) == NULL) { progress.action = 0; UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_IO_ERR_TARGET), - uugen_fnbuffer, strerror (uu_errno = errno)); + uustring (S_IO_ERR_TARGET), + uugen_fnbuffer, strerror (uu_errno = errno)); fclose (source); close (fildes); return UURET_IOERR; @@ -973,7 +973,7 @@ UUDecodeFile (uulist *thefile, char *destname) if (UUBUSYPOLL(ftell(source),progress.fsize)) { UUMessage (uulib_id, __LINE__, UUMSG_NOTE, - uustring (S_DECODE_CANCEL)); + uustring (S_DECODE_CANCEL)); fclose (source); fclose (target); unlink (uugen_fnbuffer); @@ -985,8 +985,8 @@ UUDecodeFile (uulist *thefile, char *destname) if (ferror (source) || (bytes == 0 && !feof (source))) { progress.action = 0; UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_READ_ERROR), - thefile->binfile, strerror (uu_errno = errno)); + uustring (S_READ_ERROR), + thefile->binfile, strerror (uu_errno = errno)); fclose (source); fclose (target); unlink (uugen_fnbuffer); @@ -995,8 +995,8 @@ UUDecodeFile (uulist *thefile, char *destname) if (fwrite (uugen_inbuffer, 1, bytes, target) != bytes) { progress.action = 0; UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_WR_ERR_TARGET), - uugen_fnbuffer, strerror (uu_errno = errno)); + uustring (S_WR_ERR_TARGET), + uugen_fnbuffer, strerror (uu_errno = errno)); fclose (source); fclose (target); unlink (uugen_fnbuffer); @@ -1013,9 +1013,9 @@ UUDecodeFile (uulist *thefile, char *destname) if (unlink (thefile->binfile)) { UUMessage (uulib_id, __LINE__, UUMSG_WARNING, - uustring (S_TMP_NOT_REMOVED), - thefile->binfile, - strerror (uu_errno = errno)); + uustring (S_TMP_NOT_REMOVED), + thefile->binfile, + strerror (uu_errno = errno)); } _FP_free (thefile->binfile); thefile->binfile = NULL; @@ -1033,7 +1033,7 @@ UUDecodeFile (uulist *thefile, char *destname) int UUEXPORT UUInfoFile (uulist *thefile, void *opaque, - int (*func) _ANSI_ARGS_((void *, char *))) + int (*func) _ANSI_ARGS_((void *, char *))) { int errflag=0, res, bhflag=0, dd; long maxpos; @@ -1045,25 +1045,25 @@ UUInfoFile (uulist *thefile, void *opaque, if (uu_FileCallback) { if ((res = (*uu_FileCallback) (uu_FileCBArg, - thefile->thisfile->data->sfname, - uugen_fnbuffer, - 1)) != UURET_OK) + thefile->thisfile->data->sfname, + uugen_fnbuffer, + 1)) != UURET_OK) return res; if ((inpfile = fopen (uugen_fnbuffer, "rb")) == NULL) { (*uu_FileCallback) (uu_FileCBArg, thefile->thisfile->data->sfname, - uugen_fnbuffer, 0); + uugen_fnbuffer, 0); UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_OPEN_FILE), uugen_fnbuffer, - strerror (uu_errno = errno)); + uustring (S_NOT_OPEN_FILE), uugen_fnbuffer, + strerror (uu_errno = errno)); return UURET_IOERR; } } else { if ((inpfile = fopen (thefile->thisfile->data->sfname, "rb")) == NULL) { UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_OPEN_FILE), - thefile->thisfile->data->sfname, - strerror (uu_errno=errno)); + uustring (S_NOT_OPEN_FILE), + thefile->thisfile->data->sfname, + strerror (uu_errno=errno)); return UURET_IOERR; } _FP_strncpy (uugen_fnbuffer, thefile->thisfile->data->sfname, 1024); @@ -1077,7 +1077,7 @@ UUInfoFile (uulist *thefile, void *opaque, maxpos = thefile->thisfile->data->startpos + thefile->thisfile->data->length; while (!feof (inpfile) && - (uu_fast_scanning || ftell(inpfile) < maxpos)) { + (uu_fast_scanning || ftell(inpfile) < maxpos)) { if (_FP_fgets (uugen_inbuffer, 511, inpfile) == NULL) break; uugen_inbuffer[511] = '\0'; @@ -1092,10 +1092,10 @@ UUInfoFile (uulist *thefile, void *opaque, else if (thefile->uudet == BH_ENCODED && bhflag) break; else if ((thefile->uudet == UU_ENCODED || thefile->uudet == XX_ENCODED) && - strncmp (uugen_inbuffer, "begin ", 6) == 0) + strncmp (uugen_inbuffer, "begin ", 6) == 0) break; else if (thefile->uudet == YENC_ENCODED && - strncmp (uugen_inbuffer, "=ybegin ", 8) == 0) + strncmp (uugen_inbuffer, "=ybegin ", 8) == 0) break; if ((*func) (opaque, uugen_inbuffer)) @@ -1104,8 +1104,8 @@ UUInfoFile (uulist *thefile, void *opaque, if (ferror (inpfile)) { UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_READ_ERROR), - uugen_fnbuffer, strerror (uu_errno = errno)); + uustring (S_READ_ERROR), + uugen_fnbuffer, strerror (uu_errno = errno)); errflag = 1; } @@ -1113,15 +1113,15 @@ UUInfoFile (uulist *thefile, void *opaque, if (uu_FileCallback) (*uu_FileCallback) (uu_FileCBArg, - thefile->thisfile->data->sfname, - uugen_fnbuffer, 0); + thefile->thisfile->data->sfname, + uugen_fnbuffer, 0); if (errflag) return UURET_IOERR; return UURET_OK; } - + int UUEXPORT UURenameFile (uulist *thefile, char *newname) { @@ -1134,8 +1134,8 @@ UURenameFile (uulist *thefile, char *newname) if ((thefile->filename = _FP_strdup (newname)) == NULL) { UUMessage (uulib_id, __LINE__, UUMSG_ERROR, - uustring (S_NOT_RENAME), - oldname, newname); + uustring (S_NOT_RENAME), + oldname, newname); thefile->filename = oldname; return UURET_NOMEM; } @@ -1152,9 +1152,9 @@ UURemoveTemp (uulist *thefile) if (thefile->binfile) { if (unlink (thefile->binfile)) { UUMessage (uulib_id, __LINE__, UUMSG_WARNING, - uustring (S_TMP_NOT_REMOVED), - thefile->binfile, - strerror (uu_errno = errno)); + uustring (S_TMP_NOT_REMOVED), + thefile->binfile, + strerror (uu_errno = errno)); } _FP_free (thefile->binfile); thefile->binfile = NULL; @@ -1178,8 +1178,8 @@ UUCleanUp (void) while (iter) { if (unlink (iter->fname)) { UUMessage (uulib_id, __LINE__, UUMSG_WARNING, - uustring (S_TMP_NOT_REMOVED), - iter->fname, strerror (uu_errno = errno)); + uustring (S_TMP_NOT_REMOVED), + iter->fname, strerror (uu_errno = errno)); } _FP_free (iter->fname); ptr = iter; @@ -1197,17 +1197,17 @@ UUCleanUp (void) liter = UUGlobalFileList; while (liter) { if (liter->state & UUFILE_DECODED) { - fiter = liter->thisfile; - while (fiter) { - if (fiter->data && fiter->data->sfname) { - /* - * Error code ignored. We might want to delete a file multiple - * times - */ - unlink (fiter->data->sfname); - } - fiter = fiter->NEXT; - } + fiter = liter->thisfile; + while (fiter) { + if (fiter->data && fiter->data->sfname) { + /* + * Error code ignored. We might want to delete a file multiple + * times + */ + unlink (fiter->data->sfname); + } + fiter = fiter->NEXT; + } } liter = liter->NEXT; } diff --git a/goldlib/uulib/uunconc.c b/goldlib/uulib/uunconc.c index 896acc0..b98cc92 100644 --- a/goldlib/uulib/uunconc.c +++ b/goldlib/uulib/uunconc.c @@ -94,11 +94,11 @@ char *uunconc_save; * decoding translation tables and line length table */ -static int * UUxlen; /* initialized in UUInitConc() */ -static int * UUxlat; /* from the malloc'ed areas above */ +static int * UUxlen; /* initialized in UUInitConc() */ +static int * UUxlat; /* from the malloc'ed areas above */ static int * B64xlat; static int * XXxlat; -static int * BHxlat; +static int * BHxlat; /* * buffer for decoding @@ -123,7 +123,7 @@ static int uulboundary; * To prevent warnings when using a char as index into an array */ -#define ACAST(s) ((int)(unsigned char)(s)) +#define ACAST(s) ((int)(unsigned char)(s)) #define isnotvalid(c) (ACAST(c) >= 0x80) /* @@ -265,21 +265,21 @@ UUNetscapeCollapse (char *string) while (*p1) { if (*p1 == '<') { if ((_FP_strnicmp (p1, "") != 0 || _FP_strstr (p1, "") != 0)) { - while (*p1 && *p1!='>') p1++; - if (*p1=='\0' || *(p1+1)!='<') return 0; - p1++; - while (*p1 && (*p1!='<' || _FP_strnicmp(p1,"",4)!=0)) { - *p2++ = *p1++; - } - if (_FP_strnicmp(p1,"",4) != 0) - return 0; - p1+=4; - res=1; + _FP_strnicmp (p1, "") != 0 || _FP_strstr (p1, "") != 0)) { + while (*p1 && *p1!='>') p1++; + if (*p1=='\0' || *(p1+1)!='<') return 0; + p1++; + while (*p1 && (*p1!='<' || _FP_strnicmp(p1,"",4)!=0)) { + *p2++ = *p1++; + } + if (_FP_strnicmp(p1,"",4) != 0) + return 0; + p1+=4; + res=1; } else - *p2++ = *p1++; + *p2++ = *p1++; } else *p2++ = *p1++; @@ -393,8 +393,8 @@ UUValidData (char *ptr, int encoding, int *bhflag) /* allow space characters at the end of the line if we are sure */ /* that this is Base64 encoded data or the line was long enough */ if (((i>=60 && len<=10) || encoding) && *s++==' ') { - while (*s==' ' && len) s++; - if (len==0) return B64ENCODED; + while (*s==' ' && len) s++; + if (len==0) return B64ENCODED; } if (encoding==B64ENCODED) return 0; goto _t_UU; @@ -403,16 +403,16 @@ UUValidData (char *ptr, int encoding, int *bhflag) /* if we know this is B64encoded, allow spaces at end of line */ s++; if (*s=='=' && len>=1) { - len--; s++; + len--; s++; } if (encoding && len && *s==' ') { - while (len && *s==' ') { - s++; len--; - } + while (len && *s==' ') { + s++; len--; + } } if (len != 0) { - if (encoding==B64ENCODED) return 0; - goto _t_UU; + if (encoding==B64ENCODED) return 0; + goto _t_UU; } return B64ENCODED; } @@ -430,7 +430,7 @@ UUValidData (char *ptr, int encoding, int *bhflag) j = UUxlen[UUxlat[ACAST(*s)]]; - if (len-1 == j) /* remove trailing character */ + if (len-1 == j) /* remove trailing character */ len--; if (len != j) { switch (UUxlat[ACAST(*s)]%3) { @@ -460,7 +460,7 @@ UUValidData (char *ptr, int encoding, int *bhflag) if (len != j && ((ptr[0] == '-' && ptr[1] == '-' && strstr(ptr,"part")!=NULL) || !(*ptr != 'M' && *ptr != 'h' && - len > j && len <= UUxlen[UUxlat['M']]))) { + len > j && len <= UUxlen[UUxlat['M']]))) { if (encoding==UU_ENCODED) return 0; goto _t_XX; /* bad length */ } @@ -474,7 +474,7 @@ UUValidData (char *ptr, int encoding, int *bhflag) */ if (encoding != UU_ENCODED) if (strchr (ptr, ' ') != NULL) - goto _t_XX; + goto _t_XX; /* suspicious = 1; we're careful here REMOVED 0.4.15 __FP__ */ len = j; @@ -500,7 +500,7 @@ UUValidData (char *ptr, int encoding, int *bhflag) j = UUxlen[XXxlat[ACAST(*s)]]; /* Same line length table as UUencoding */ - if (len-1 == j) /* remove trailing character */ + if (len-1 == j) /* remove trailing character */ len--; if (len != j) switch (UUxlat[ACAST(*s)]%3) { @@ -545,18 +545,18 @@ UURepairData (FILE *datei, char *line, int encoding, int *bhflag) nflag = UUBrokenByNetscape (line); while (vflag == 0 && nflag && safety--) { - if (nflag == 1) { /* need next line to repair */ + if (nflag == 1) { /* need next line to repair */ ptr = line + strlen (line); while (ptr>line && (*(ptr-1)=='\015' || *(ptr-1)=='\012')) - ptr--; + ptr--; if (_FP_fgets (ptr, 255-(ptr-line), datei) == NULL) - break; + break; } - else { /* don't need next line to repair */ + else { /* don't need next line to repair */ } if (UUNetscapeCollapse (line)) { if ((vflag = UUValidData (line, encoding, bhflag)) == 0) - nflag = UUBrokenByNetscape (line); + nflag = UUBrokenByNetscape (line); } else nflag = 0; @@ -634,20 +634,20 @@ UUDecodeLine (char *s, char *d, int method) c |= (cc >> 4); if(i-- > 0) - d[count++] = c; + d[count++] = c; cc <<= 4; c = table[ACAST(*s++)]; cc |= (c >> 2); if(i-- > 0) - d[count++] = cc; + d[count++] = cc; c <<= 6; c |= table[ACAST(*s++)]; if(i-- > 0) - d[count++] = c; + d[count++] = c; j -= 4; } @@ -717,16 +717,16 @@ UUDecodeLine (char *s, char *d, int method) else if (method == YENC_ENCODED) { while (*s) { if (*s == '=') { - if (*++s != '\0') { - d[count++] = (char) ((int) *s - 64 - 42); - s++; - } + if (*++s != '\0') { + d[count++] = (char) ((int) *s - 64 - 42); + s++; + } } else if (*s == '\n' || *s == '\r') { - s++; /* ignore */ + s++; /* ignore */ } else { - d[count++] = (char) ((int) *s++ - 42); + d[count++] = (char) ((int) *s++ - 42); } } } @@ -740,8 +740,8 @@ UUDecodeLine (char *s, char *d, int method) int UUDecodeQP (FILE *datain, FILE *dataout, int *state, - long maxpos, int method, int flags, - char *boundary) + long maxpos, int method, int flags, + char *boundary) { char *line=uugen_inbuffer, *p1, *p2; int val; @@ -749,30 +749,30 @@ UUDecodeQP (FILE *datain, FILE *dataout, int *state, uulboundary = -1; while (!feof (datain) && - (ftell(datain)p1 && isspace (*(p2-1))) { if (*(p2-1) == '\012' || *(p2-1) == '\015') - val = 1; + val = 1; p2--; } *p2 = '\0'; @@ -823,8 +823,8 @@ UUDecodeQP (FILE *datain, FILE *dataout, int *state, * So if the part ends here, don't print a line break" */ if (val && (!feof (datain) && - (ftell(datain) 5) - tf = tc = 0; + tf = tc = 0; vlc = 0; continue; } @@ -978,7 +978,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state, if (UUBUSYPOLL(ftell(datain)-progress.foffset,progress.fsize)) { UUMessage (uunconc_id, __LINE__, UUMSG_NOTE, - uustring (S_DECODE_CANCEL)); + uustring (S_DECODE_CANCEL)); return UURET_CANCEL; } @@ -990,11 +990,11 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state, count = 0; if (boundary && line[0]=='-' && line[1]=='-' && - strncmp (line+2, boundary, strlen (boundary)) == 0) { + strncmp (line+2, boundary, strlen (boundary)) == 0) { if (line[strlen(boundary)+2]=='-') - uulboundary = 1; + uulboundary = 1; else - uulboundary = 0; + uulboundary = 0; return UURET_OK; } @@ -1004,71 +1004,71 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state, if ((flags&FL_PROPER) == 0) { if (strncmp (line, "BEGIN", 5) == 0 && - _FP_strstr (line, "CUT HERE") && !tf) { /* I hate these lines */ - tc = tf = vlc = 0; - continue; + _FP_strstr (line, "CUT HERE") && !tf) { /* I hate these lines */ + tc = tf = vlc = 0; + continue; } /* MIME body boundary */ if (line[0] == '-' && line[1] == '-' && method == B64ENCODED) { - if ((haddata || tc) && (haddh || hadct)) { - *state = DONE; - vlc = 0; - lc[0] = lc[1] = 0; - continue; - } - hadct = 0; - haddh = 1; - continue; + if ((haddata || tc) && (haddh || hadct)) { + *state = DONE; + vlc = 0; + lc[0] = lc[1] = 0; + continue; + } + hadct = 0; + haddh = 1; + continue; } if (_FP_strnicmp (line, "Content-Type", 12) == 0) - hadct = 1; + hadct = 1; } if (*state == BEGIN) { if ((method == UU_ENCODED || method == XX_ENCODED) && - (strncmp (line, "begin ", 6) == 0 || - strncmp (line, "section ", 8) == 0 || - _FP_strnicmp (line, "
begin ", 11) == 0)) { /* for LYNX */
-	*state = DATA;
-	continue;
+      (strncmp      (line, "begin ",       6) == 0 ||
+       strncmp      (line, "section ",     8) == 0 ||
+       _FP_strnicmp (line, "
begin ", 11) == 0)) { /* for LYNX */
+    *state = DATA;
+    continue;
       }
       else if (method == BH_ENCODED && line[0] == ':') {
-	if (UUValidData (line, BH_ENCODED, &bhflag) == BH_ENCODED) {
-	  bhflag = 0;
-	  *state = DATA;
-	}
-	else
-	  continue;
+    if (UUValidData (line, BH_ENCODED, &bhflag) == BH_ENCODED) {
+      bhflag = 0;
+      *state = DATA;
+    }
+    else
+      continue;
       }
       else if (method == YENC_ENCODED &&
-	       strncmp (line, "=ybegin ", 8) == 0 &&
-	       _FP_strstr (line, " name=") != NULL) {
-	*state = DATA;
+           strncmp (line, "=ybegin ", 8) == 0 &&
+           _FP_strstr (line, " name=") != NULL) {
+    *state = DATA;
 
-	if ((ptr = _FP_strstr (line, " size=")) != NULL) {
-	  ptr += 6;
-	  yefilesize = atoi (ptr);
-	}
-	else {
-	  yefilesize = -1;
-	}
+    if ((ptr = _FP_strstr (line, " size=")) != NULL) {
+      ptr += 6;
+      yefilesize = atoi (ptr);
+    }
+    else {
+      yefilesize = -1;
+    }
 
-	if (_FP_strstr (line, " part=") != NULL) {
-	  if (_FP_fgets (line, 299, datain) == NULL) {
-	    break;
-	  }
+    if (_FP_strstr (line, " part=") != NULL) {
+      if (_FP_fgets (line, 299, datain) == NULL) {
+        break;
+      }
 
-	  if ((ptr = _FP_strstr (line, " end=")) == NULL) {
-	    break;
-	  }
+      if ((ptr = _FP_strstr (line, " end=")) == NULL) {
+        break;
+      }
 
-	  yepartends = atoi (ptr + 5);
-	}
-	tf = 1;
-	continue;
+      yepartends = atoi (ptr + 5);
+    }
+    tf = 1;
+    continue;
       }
       else {
-	continue;
+    continue;
       }
 
       tc = tf = vlc = 0;
@@ -1076,127 +1076,127 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
     }
     else if ((*state == END) && (method == UU_ENCODED)) {
       if (strncmp (line, "`", 1) == 0)
-	*state = END2;
+    *state = END2;
     }
     else if ((*state == END) && (method == XX_ENCODED)) {
       if (strncmp (line, "+", 1) == 0)
-	*state = END2;
+    *state = END2;
     }
     else if ((*state == END2) &&
-	     (method == UU_ENCODED || method == XX_ENCODED)) {
+         (method == UU_ENCODED || method == XX_ENCODED)) {
       if (strncmp (line, "end", 3) == 0) {
-	*state = DONE;
-	break;
+    *state = DONE;
+    break;
       }
     }
 
     if (*state == DATA && method == YENC_ENCODED &&
-	strncmp (line, "=yend ", 6) == 0) {
+    strncmp (line, "=yend ", 6) == 0) {
       if ((ptr = _FP_strstr (line, " pcrc32=")) != NULL) {
-	crc32_t pcrc32 = strtoul (ptr + 8, NULL, 16);
-	if (pcrc32 != yepartcrc) {
-	  UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
-		     uustring (S_PCRC_MISMATCH), progress.curfile, progress.partno);
-	}
+    crc32_t pcrc32 = strtoul (ptr + 8, NULL, 16);
+    if (pcrc32 != yepartcrc) {
+      UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
+             uustring (S_PCRC_MISMATCH), progress.curfile, progress.partno);
+    }
       }
       if ((ptr = _FP_strstr (line, " crc32=")) != NULL)
       {
-	crc32_t fcrc32 = strtoul (ptr + 7, NULL, 16);
-	if (fcrc32 != yefilecrc) {
-	  UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
-		     uustring (S_CRC_MISMATCH), progress.curfile);
-	}
+    crc32_t fcrc32 = strtoul (ptr + 7, NULL, 16);
+    if (fcrc32 != yefilecrc) {
+      UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
+             uustring (S_CRC_MISMATCH), progress.curfile);
+    }
       }
       if ((ptr = _FP_strstr (line, " size=")) != NULL)
       {
-	size_t size = atol(ptr + 6);
-	if (size != yepartsize && yefilesize != -1) {
-	  if (size != (size_t)yefilesize)
-	    UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
-		       uustring (S_PSIZE_MISMATCH), progress.curfile,
-		       progress.partno, yepartsize, size);
-	  else
-	    UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
-		       uustring (S_SIZE_MISMATCH), progress.curfile,
-		       yepartsize, size);
-	}
+    size_t size = atol(ptr + 6);
+    if (size != yepartsize && yefilesize != -1) {
+      if (size != (size_t)yefilesize)
+        UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
+               uustring (S_PSIZE_MISMATCH), progress.curfile,
+               progress.partno, yepartsize, size);
+      else
+        UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
+               uustring (S_SIZE_MISMATCH), progress.curfile,
+               yepartsize, size);
+    }
       }
       if (yepartends == 0 || yepartends >= yefilesize) {
-	*state = DONE;
+    *state = DONE;
       }
       break;
     }
 
     if (*state == DATA || *state == END || *state == END2) {
       if (method==B64ENCODED && line[0]=='-' && line[1]=='-' && tc) {
-	break;
+    break;
       }
 
       if ((vflag = UUValidData (line, (tf)?method:0, &bhflag)) == 0)
-	vflag = UURepairData (datain, line, (tf)?method:0, &bhflag);
+    vflag = UURepairData (datain, line, (tf)?method:0, &bhflag);
 
       /*
        * correct XX/UUencoded lines that were declared Base64
        */
 
       if ((method == XX_ENCODED || method == UU_ENCODED) &&
-	  vflag == B64ENCODED) {
-	if (UUValidData (line, method, &bhflag) == method)
-	  vflag = method;
+      vflag == B64ENCODED) {
+    if (UUValidData (line, method, &bhflag) == method)
+      vflag = method;
       }
 
       if (vflag == method) {
-/*	if (tf) { */
-	if (tf || (method == UU_ENCODED || method == XX_ENCODED)) {
-	  count  = UUDecodeLine (line, oline, method);
-	  if (method == YENC_ENCODED) {
-	    if (yepartends)
-	      yepartcrc = crc32(yepartcrc, (unsigned char *) oline, count);
-	    yefilecrc = crc32(yefilecrc, (unsigned char *) oline, count);
-	    yepartsize += count;
-	  }
-	  tf = 1;
-	  vlc++; lc[1]++;
-	}
-	else if (tc == 3) {
-	  count  = UUDecodeLine (save[0], oline,         method);
-	  count += UUDecodeLine (save[1], oline + count, method);
-	  count += UUDecodeLine (save[2], oline + count, method);
-	  count += UUDecodeLine (line,    oline + count, method);
-	  tf     = 1;
-	  tc     = 0;
+/*  if (tf) { */
+    if (tf || (method == UU_ENCODED || method == XX_ENCODED)) {
+      count  = UUDecodeLine (line, oline, method);
+      if (method == YENC_ENCODED) {
+        if (yepartends)
+          yepartcrc = crc32(yepartcrc, (unsigned char *) oline, count);
+        yefilecrc = crc32(yefilecrc, (unsigned char *) oline, count);
+        yepartsize += count;
+      }
+      tf = 1;
+      vlc++; lc[1]++;
+    }
+    else if (tc == 3) {
+      count  = UUDecodeLine (save[0], oline,         method);
+      count += UUDecodeLine (save[1], oline + count, method);
+      count += UUDecodeLine (save[2], oline + count, method);
+      count += UUDecodeLine (line,    oline + count, method);
+      tf     = 1;
+      tc     = 0;
 
-	  /*
-	   * complain if we had one or two invalid lines amidst of
-	   * correctly encoded data. This usually means that the
-	   * file is in error
-	   */
+      /*
+       * complain if we had one or two invalid lines amidst of
+       * correctly encoded data. This usually means that the
+       * file is in error
+       */
 
-	  if (lc[1] > 10 && (lc[0] >= 1 && lc[0] <= 2) && !warning) {
-	    UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
-		       uustring (S_DATA_SUSPICIOUS));
-	    warning=1;
-	  }
-	  lc[0] = 0;
-	  lc[1] = 3;
-	}
-	else {
-	  _FP_strncpy (save[tc++], line, 256);
-	}
+      if (lc[1] > 10 && (lc[0] >= 1 && lc[0] <= 2) && !warning) {
+        UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
+               uustring (S_DATA_SUSPICIOUS));
+        warning=1;
+      }
+      lc[0] = 0;
+      lc[1] = 3;
+    }
+    else {
+      _FP_strncpy (save[tc++], line, 256);
+    }
 
-	if (method == UU_ENCODED)
-	  *state = (line[0] == 'M') ? DATA : (line[0] == '`') ? END2 : END;
-	else if (method == XX_ENCODED)
-	  *state = (line[0] == 'h') ? DATA : (line[0] == '+') ? END2 : END;
-	else if (method == B64ENCODED)
-	  *state = (strchr (line, '=') == NULL) ? DATA : DONE;
-	else if (method == BH_ENCODED)
-	  *state = (!line[0] || strchr(line+1,':')==NULL)?DATA:DONE;
+    if (method == UU_ENCODED)
+      *state = (line[0] == 'M') ? DATA : (line[0] == '`') ? END2 : END;
+    else if (method == XX_ENCODED)
+      *state = (line[0] == 'h') ? DATA : (line[0] == '+') ? END2 : END;
+    else if (method == B64ENCODED)
+      *state = (strchr (line, '=') == NULL) ? DATA : DONE;
+    else if (method == BH_ENCODED)
+      *state = (!line[0] || strchr(line+1,':')==NULL)?DATA:DONE;
       }
       else {
-	vlc = tf = tc = 0;
-	haddh = 0;
-	lc[0]++;
+    vlc = tf = tc = 0;
+    haddh = 0;
+    lc[0]++;
       }
     }
     else if (*state != DONE) {
@@ -1205,18 +1205,18 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
 
     if (count) {
       if (method == BH_ENCODED) {
-	if (UUbhwrite (oline, 1, count, dataout) != count) {
-	  UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-		     uustring (S_WR_ERR_TEMP),
-		     strerror (uu_errno = errno));
-	  return UURET_IOERR;
-	}
+    if (UUbhwrite (oline, 1, count, dataout) != count) {
+      UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
+             uustring (S_WR_ERR_TEMP),
+             strerror (uu_errno = errno));
+      return UURET_IOERR;
+    }
       }
       else if (fwrite (oline, 1, count, dataout) != count) {
-	UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-		   uustring (S_WR_ERR_TEMP),
-		   strerror (uu_errno = errno));
-	return UURET_IOERR;
+    UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
+           uustring (S_WR_ERR_TEMP),
+           strerror (uu_errno = errno));
+    return UURET_IOERR;
       }
       haddata++;
       count = 0;
@@ -1230,18 +1230,18 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
       count += UUDecodeLine (save[tf], oline + count, method);
     if (count) {
       if (method == BH_ENCODED) {
-	if (UUbhwrite (oline, 1, count, dataout) != count) {
-	  UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-		     uustring (S_WR_ERR_TEMP),
-		     strerror (uu_errno = errno));
-	  return UURET_IOERR;
-	}
+    if (UUbhwrite (oline, 1, count, dataout) != count) {
+      UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
+             uustring (S_WR_ERR_TEMP),
+             strerror (uu_errno = errno));
+      return UURET_IOERR;
+    }
       }
       else if (fwrite (oline, 1, count, dataout) != count) {
-	UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-		   uustring (S_WR_ERR_TEMP),
-		   strerror (uu_errno = errno));
-	return UURET_IOERR;
+    UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
+           uustring (S_WR_ERR_TEMP),
+           strerror (uu_errno = errno));
+    return UURET_IOERR;
       }
     }
   }
@@ -1276,13 +1276,13 @@ UUDecode (uulist *data)
     return UURET_NODATA;
 
   if (data->uudet == PT_ENCODED)
-    mode = "wt";	/* open text files in text mode */
+    mode = "wt";    /* open text files in text mode */
   else
-    mode = "wb";	/* otherwise in binary          */
+    mode = "wb";    /* otherwise in binary          */
 
   if ((data->binfile = tempnam (NULL, "uu")) == NULL) {
     UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-	       uustring (S_NO_TEMP_NAME));
+           uustring (S_NO_TEMP_NAME));
     return UURET_NOMEM;
   }
 
@@ -1292,8 +1292,8 @@ UUDecode (uulist *data)
      * and TEMP aren't set
      */
     UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-	       uustring (S_WR_ERR_TARGET),
-	       data->binfile, strerror (uu_errno = errno));
+           uustring (S_WR_ERR_TARGET),
+           data->binfile, strerror (uu_errno = errno));
     _FP_free (data->binfile);
     data->binfile = NULL;
     uu_errno = errno;
@@ -1324,15 +1324,15 @@ UUDecode (uulist *data)
   progress.action = 0;
   if (data->filename != NULL) {
     _FP_strncpy (progress.curfile,
-		 (strlen(data->filename)>255)?
-		 (data->filename+strlen(data->filename)-255):data->filename,
-		 256);
+         (strlen(data->filename)>255)?
+         (data->filename+strlen(data->filename)-255):data->filename,
+         256);
   }
   else {
     _FP_strncpy (progress.curfile,
-		 (strlen(data->binfile)>255)?
-		 (data->binfile+strlen(data->binfile)-255):data->binfile,
-		 256);
+         (strlen(data->binfile)>255)?
+         (data->binfile+strlen(data->binfile)-255):data->binfile,
+         256);
   }
   progress.partno   =  0;
   progress.numparts =  0;
@@ -1368,25 +1368,25 @@ UUDecode (uulist *data)
 
     if (uu_FileCallback) {
       if ((res = (*uu_FileCallback) (uu_FileCBArg, iter->data->sfname,
-				     uugen_fnbuffer, 1)) != UURET_OK)
-	break;
+                     uugen_fnbuffer, 1)) != UURET_OK)
+    break;
       if ((datain = fopen (uugen_fnbuffer, "rb")) == NULL) {
-	(*uu_FileCallback) (uu_FileCBArg, iter->data->sfname,
-			    uugen_fnbuffer, 0);
-	UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-		   uustring (S_NOT_OPEN_FILE),
-		   uugen_fnbuffer, strerror (uu_errno = errno));
-	res = UURET_IOERR;
-	break;
+    (*uu_FileCallback) (uu_FileCBArg, iter->data->sfname,
+                uugen_fnbuffer, 0);
+    UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
+           uustring (S_NOT_OPEN_FILE),
+           uugen_fnbuffer, strerror (uu_errno = errno));
+    res = UURET_IOERR;
+    break;
       }
     }
     else {
       if ((datain = fopen (iter->data->sfname, "rb")) == NULL) {
-	UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-		   uustring (S_NOT_OPEN_FILE),
-		   iter->data->sfname, strerror (uu_errno = errno));
-	res = UURET_IOERR;
-	break;
+    UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
+           uustring (S_NOT_OPEN_FILE),
+           iter->data->sfname, strerror (uu_errno = errno));
+    res = UURET_IOERR;
+    break;
       }
       _FP_strncpy (uugen_fnbuffer, iter->data->sfname, 1024);
     }
@@ -1398,8 +1398,8 @@ UUDecode (uulist *data)
 
     fseek              (datain, iter->data->startpos, SEEK_SET);
     res = UUDecodePart (datain, dataout, &state,
-			iter->data->startpos+iter->data->length,
-			data->uudet, iter->data->flags, NULL);
+            iter->data->startpos+iter->data->length,
+            data->uudet, iter->data->flags, NULL);
     fclose             (datain);
 
     if (uu_FileCallback)
@@ -1444,22 +1444,22 @@ UUDecode (uulist *data)
   if (data->uudet == BH_ENCODED && data->binfile) {
     if ((ntmp = tempnam (NULL, "uu")) == NULL) {
       UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-		 uustring (S_NO_TEMP_NAME));
+         uustring (S_NO_TEMP_NAME));
       progress.action = 0;
       return UURET_NOMEM;
     }
     if ((datain = fopen (data->binfile, "rb")) == NULL) {
       UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-		 uustring (S_NOT_OPEN_FILE),
-		 data->binfile, strerror (uu_errno = errno));
+         uustring (S_NOT_OPEN_FILE),
+         data->binfile, strerror (uu_errno = errno));
       progress.action = 0;
       free (ntmp);
       return UURET_IOERR;
     }
     if ((dataout = fopen (ntmp, "wb")) == NULL) {
       UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-		 uustring (S_NOT_OPEN_TARGET),
-		 ntmp, strerror (uu_errno = errno));
+         uustring (S_NOT_OPEN_TARGET),
+         ntmp, strerror (uu_errno = errno));
       progress.action = 0;
       fclose (datain);
       free   (ntmp);
@@ -1478,13 +1478,13 @@ UUDecode (uulist *data)
             (((long) 1 <<  8) * (long) r[2]) +
             (                   (long) r[3]);
     rsize = (((long) 1 << 24) * (long) r[4]) +
-	    (((long) 1 << 16) * (long) r[5]) +
-	    (((long) 1 <<  8) * (long) r[6]) +
-	    (                   (long) r[7]);
+        (((long) 1 << 16) * (long) r[5]) +
+        (((long) 1 <<  8) * (long) r[6]) +
+        (                   (long) r[7]);
 
     UUMessage (uunconc_id, __LINE__, UUMSG_MESSAGE,
-	       uustring (S_BINHEX_SIZES),
-	       dsize, rsize);
+           uustring (S_BINHEX_SIZES),
+           dsize, rsize);
 
     if (dsize == 0) {
       fseek  (datain, dsize + hb + 2, SEEK_SET);
@@ -1497,7 +1497,7 @@ UUDecode (uulist *data)
     else {
       /* we should let the user have the choice here */
       UUMessage (uunconc_id, __LINE__, UUMSG_NOTE,
-		 uustring (S_BINHEX_BOTH));
+         uustring (S_BINHEX_BOTH));
       fseek  (datain, hb, SEEK_SET);
       numbytes = dsize;
     }
@@ -1516,49 +1516,49 @@ UUDecode (uulist *data)
 
     while (!feof (datain) && numbytes) {
       if (UUBUSYPOLL(ftell(datain)-progress.foffset,progress.fsize)) {
-	UUMessage (uunconc_id, __LINE__, UUMSG_NOTE,
-		   uustring (S_DECODE_CANCEL));
-	fclose (datain);
-	fclose (dataout);
-	unlink (ntmp);
-	free   (ntmp);
-	return UURET_CANCEL;
+    UUMessage (uunconc_id, __LINE__, UUMSG_NOTE,
+           uustring (S_DECODE_CANCEL));
+    fclose (datain);
+    fclose (dataout);
+    unlink (ntmp);
+    free   (ntmp);
+    return UURET_CANCEL;
       }
 
       bytes = fread (uugen_inbuffer, 1,
-		     (size_t) ((numbytes>1024)?1024:numbytes), datain);
+             (size_t) ((numbytes>1024)?1024:numbytes), datain);
 
       if (ferror (datain) || (bytes == 0 && !feof (datain))) {
-	progress.action = 0;
-	UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-		   uustring (S_SOURCE_READ_ERR),
-		   data->binfile, strerror (uu_errno = errno));
-	fclose (datain);
-	fclose (dataout);
-	unlink (ntmp);
-	free   (ntmp);
-	return UURET_IOERR;
+    progress.action = 0;
+    UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
+           uustring (S_SOURCE_READ_ERR),
+           data->binfile, strerror (uu_errno = errno));
+    fclose (datain);
+    fclose (dataout);
+    unlink (ntmp);
+    free   (ntmp);
+    return UURET_IOERR;
       }
       if (fwrite (uugen_inbuffer, 1, bytes, dataout) != bytes) {
-	progress.action = 0;
-	UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
-		   uustring (S_WR_ERR_TARGET),
-		   ntmp, strerror (uu_errno = errno));
-	fclose (datain);
-	fclose (dataout);
-	unlink (ntmp);
-	free   (ntmp);
-	return UURET_IOERR;
+    progress.action = 0;
+    UUMessage (uunconc_id, __LINE__, UUMSG_ERROR,
+           uustring (S_WR_ERR_TARGET),
+           ntmp, strerror (uu_errno = errno));
+    fclose (datain);
+    fclose (dataout);
+    unlink (ntmp);
+    free   (ntmp);
+    return UURET_IOERR;
       }
       numbytes -= bytes;
     }
 
     if (numbytes) {
       UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
-		 uustring (S_SHORT_BINHEX),
-		 (data->filename)?data->filename:
-		 (data->subfname)?data->subfname:"???",
-		 numbytes);
+         uustring (S_SHORT_BINHEX),
+         (data->filename)?data->filename:
+         (data->subfname)?data->subfname:"???",
+         numbytes);
     }
 
     /*
@@ -1570,8 +1570,8 @@ UUDecode (uulist *data)
 
     if (unlink (data->binfile)) {
       UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
-		 uustring (S_TMP_NOT_REMOVED),
-		 data->binfile, strerror (uu_errno = errno));
+         uustring (S_TMP_NOT_REMOVED),
+         data->binfile, strerror (uu_errno = errno));
     }
 
     free (data->binfile);
@@ -1619,6 +1619,6 @@ UUQuickDecode (FILE *datain, FILE *dataout, char *boundary, long maxpos)
 
   (void) UUDecodePart (NULL, NULL, NULL, 0, 0, 0, NULL); /* init  */
   return UUDecodePart (datain, dataout, &state, maxpos,
-		       encoding, FL_PROPER|FL_TOEND,
-		       boundary);
+               encoding, FL_PROPER|FL_TOEND,
+               boundary);
 }
diff --git a/goldlib/uulib/uuscan.c b/goldlib/uulib/uuscan.c
index 695f14f..c153202 100644
--- a/goldlib/uulib/uuscan.c
+++ b/goldlib/uulib/uuscan.c
@@ -98,12 +98,12 @@ int mimseqno;
 /*
  * how many lines do we read when checking for headers
  */
-#define WAITHEADER	10
+#define WAITHEADER  10
 
 /*
  * The stack for encapsulated Multipart messages
  */
-#define MSMAXDEPTH	3
+#define MSMAXDEPTH  3
 
 int       mssdepth = 0;
 scanstate multistack[MSMAXDEPTH+1];
@@ -130,7 +130,7 @@ char *uuscan_spline;
  * Macro: print cancellation message in UUScanPart
  */
 
-#define SPCANCEL()	{UUMessage(uuscan_id,__LINE__,UUMSG_NOTE,uustring(S_SCAN_CANCEL));*errcode=UURET_CANCEL;goto ScanPartEmergency;}
+#define SPCANCEL()  {UUMessage(uuscan_id,__LINE__,UUMSG_NOTE,uustring(S_SCAN_CANCEL));*errcode=UURET_CANCEL;goto ScanPartEmergency;}
 
 /*
  * Is line empty? A line is empty if it is composed of whitespace.
@@ -207,7 +207,7 @@ ScanHeaderLine (FILE *datei, char *initial)
       c = fgetc (datei);
 
     if (!feof (datei))
-      ungetc (c, datei);	/* push back for fgets() */
+      ungetc (c, datei);    /* push back for fgets() */
 
     /* insert a single LWSP */
     if (hadcr==1 && llength < 1023) {
@@ -291,9 +291,9 @@ ParseValue (char *attribute)
     attribute++;
     while (*attribute && *attribute != '"' && length < 255) {
       if (*attribute == '\\')
-	*ptr++ = *++attribute;
+    *ptr++ = *++attribute;
       else
-	*ptr++ = *attribute;
+    *ptr++ = *attribute;
       attribute++;
       length++;
     }
@@ -303,14 +303,14 @@ ParseValue (char *attribute)
     /* tspecials from RFC1521 */
 
     while (*attribute && !isspace (*attribute) &&
-	   *attribute != '(' && *attribute != ')' &&
-	   *attribute != '<' && *attribute != '>' &&
-	   *attribute != '@' && *attribute != ',' &&
-	   *attribute != ';' && *attribute != ':' &&
-	   *attribute != '\\' &&*attribute != '"' &&
-	   *attribute != '/' && *attribute != '[' &&
-	   *attribute != ']' && *attribute != '?' &&
-	   *attribute != '=' && length < 255)
+       *attribute != '(' && *attribute != ')' &&
+       *attribute != '<' && *attribute != '>' &&
+       *attribute != '@' && *attribute != ',' &&
+       *attribute != ';' && *attribute != ':' &&
+       *attribute != '\\' &&*attribute != '"' &&
+       *attribute != '/' && *attribute != '[' &&
+       *attribute != ']' && *attribute != '?' &&
+       *attribute != '=' && length < 255)
       *ptr++ = *attribute++;
 
     *ptr = '\0';
@@ -371,30 +371,30 @@ ParseHeader (headers *theheaders, char *line)
     /* we can probably extract more information */
     if ((ptr = _FP_stristr (line, "boundary")) != NULL) {
       if ((thenew = ParseValue (ptr))) {
-	if (theheaders->boundary) free (theheaders->boundary);
-	theheaders->boundary = _FP_strdup (thenew);
+    if (theheaders->boundary) free (theheaders->boundary);
+    theheaders->boundary = _FP_strdup (thenew);
       }
     }
     if ((ptr = _FP_stristr (line, "name")) != NULL) {
       if ((thenew = ParseValue (ptr))) {
-	if (theheaders->fname) free (theheaders->fname);
-	theheaders->fname = _FP_strdup (thenew);
+    if (theheaders->fname) free (theheaders->fname);
+    theheaders->fname = _FP_strdup (thenew);
       }
     }
     if ((ptr = _FP_stristr (line, "id")) != NULL) {
       if ((thenew = ParseValue (ptr))) {
-	if (theheaders->mimeid) free (theheaders->mimeid);
-	theheaders->mimeid = _FP_strdup (thenew);
+    if (theheaders->mimeid) free (theheaders->mimeid);
+    theheaders->mimeid = _FP_strdup (thenew);
       }
     }
     if ((ptr = _FP_stristr (line, "number")) != NULL) {
       if ((thenew = ParseValue (ptr))) {
-	theheaders->partno = atoi (thenew);
+    theheaders->partno = atoi (thenew);
       }
     }
     if ((ptr = _FP_stristr (line, "total")) != NULL) {
       if ((thenew = ParseValue (ptr))) {
-	theheaders->numparts = atoi (thenew);
+    theheaders->numparts = atoi (thenew);
       }
     }
   }
@@ -413,7 +413,7 @@ ParseHeader (headers *theheaders, char *line)
      */
     if ((ptr = _FP_stristr (line, "name")) != NULL) {
       if (theheaders->fname == NULL && (thenew=ParseValue(ptr)) != NULL) {
-	theheaders->fname = _FP_strdup (thenew);
+    theheaders->fname = _FP_strdup (thenew);
       }
     }
     variable = NULL;
@@ -435,7 +435,7 @@ ParseHeader (headers *theheaders, char *line)
     while (isspace (*value))
       value++;
     while (*value && (delimit==0 || *value!=delimit) &&
-	   *value != '\012' && *value != '\015' && length < 255) {
+       *value != '\012' && *value != '\015' && length < 255) {
       *ptr++ = *value++;
       length++;
     }
@@ -511,8 +511,8 @@ UUScanHeader (FILE *datei, headers *envelope)
 
 static int
 ScanData (FILE *datei, char *fname, int *errcode,
-	  char *boundary, int ismime, int checkheaders,
-	  fileread *result)
+      char *boundary, int ismime, int checkheaders,
+      fileread *result)
 {
   char *line=uuscan_sdline, *bhds1=uuscan_sdbhds1, *bhds2=uuscan_sdbhds2;
   static char *ptr, *p2, *p3=NULL, *bhdsp, bhl;
@@ -563,7 +563,7 @@ ScanData (FILE *datei, char *fname, int *errcode,
 
     if (UUBUSYPOLL(ftell(datei),progress.fsize)) {
       UUMessage (uuscan_id, __LINE__, UUMSG_NOTE,
-		 uustring (S_SCAN_CANCEL));
+         uustring (S_SCAN_CANCEL));
       *errcode = UURET_CANCEL;
       break;
     }
@@ -576,42 +576,42 @@ ScanData (FILE *datei, char *fname, int *errcode,
 
     if (checkheaders) {
       if (IsKnownHeader (line)) {
-	(void) ScanHeaderLine (datei, line);
+    (void) ScanHeaderLine (datei, line);
 
-	if (hcount == 0) {
-	  preheaders = oldposition;
-	  lcount     = 0;
-	}
-	hcount++;
-	lcount++;
+    if (hcount == 0) {
+      preheaders = oldposition;
+      lcount     = 0;
+    }
+    hcount++;
+    lcount++;
 
-	/*
-	 * check for the various restart counters
-	 */
+    /*
+     * check for the various restart counters
+     */
 
-	if ((hcount >= hlcount.restart) ||
-	    (hcount >= hlcount.afterdata && ismime == 0) ||
-	    (hcount >= hlcount.afterdata && result->uudet) ||
-	    (hcount >= hlcount.afternl   && result->uudet && hadnl)) {
-	  /*
-	   * Hey, a new header starts here
-	   */
-	  fseek (datei, preheaders, SEEK_SET);
-	  break;
-	}
-	/* continue; */
+    if ((hcount >= hlcount.restart) ||
+        (hcount >= hlcount.afterdata && ismime == 0) ||
+        (hcount >= hlcount.afterdata && result->uudet) ||
+        (hcount >= hlcount.afternl   && result->uudet && hadnl)) {
+      /*
+       * Hey, a new header starts here
+       */
+      fseek (datei, preheaders, SEEK_SET);
+      break;
+    }
+    /* continue; */
       }
       else if (lcount > WAITHEADER) {
-	hcount = 0;
-	lcount = 0;
-	dontcare=0;
+    hcount = 0;
+    lcount = 0;
+    dontcare=0;
       }
       else if (hcount) {
-	lcount++;
-	dontcare=1;
+    lcount++;
+    dontcare=1;
       }
       else {
-	dontcare=0;
+    dontcare=0;
       }
     }
     else {
@@ -619,43 +619,43 @@ ScanData (FILE *datei, char *fname, int *errcode,
     }
 
     if (boundary != NULL && 
-	line[0] == '-' && line[1] == '-' &&
-	strncmp (line+2, boundary, blen) == 0) {
+    line[0] == '-' && line[1] == '-' &&
+    strncmp (line+2, boundary, blen) == 0) {
       fseek (datei, oldposition, SEEK_SET);
       break;
     }
     if (boundary != NULL && line[0] == 'C' && line[1] == 'o' &&
-	_FP_strnicmp (line, "Content-Type:", 13) == 0) {
+    _FP_strnicmp (line, "Content-Type:", 13) == 0) {
       ptr = ScanHeaderLine (datei, line);
       p2  = (ptr)?_FP_stristr(ptr,"boundary"):NULL;
       p3  = (p2)?ParseValue(p2):NULL;
 
       if (p3 && strcmp (p3, boundary) == 0) {
-	fseek (datei, oldposition, SEEK_SET);
-	break;
+    fseek (datei, oldposition, SEEK_SET);
+    break;
       }
       else {
-	p3 = NULL;
+    p3 = NULL;
       }
     }
 
     if (strncmp      (line, "begin ",       6) == 0 ||
-	_FP_strnicmp (line, "
begin ", 11) == 0) {
+    _FP_strnicmp (line, "
begin ", 11) == 0) {
       if ((result->begin || result->end ||
-	   result->uudet == B64ENCODED ||
-	   result->uudet == BH_ENCODED) && !uu_more_mime) {
-	fseek (datei, oldposition, SEEK_SET);
-	break;
+       result->uudet == B64ENCODED ||
+       result->uudet == BH_ENCODED) && !uu_more_mime) {
+    fseek (datei, oldposition, SEEK_SET);
+    break;
       }
       
       if (*line == '<')
-	ptr = line + 10;
+    ptr = line + 10;
       else
-	ptr = line + 5;
+    ptr = line + 5;
 
       while (*ptr == ' ') ptr++;
       while (isdigit (*ptr)) 
-	result->mode = result->mode * 8 + *ptr++ - '0';
+    result->mode = result->mode * 8 + *ptr++ - '0';
       while (*ptr == ' ') ptr++;
 
       /*
@@ -666,32 +666,32 @@ ScanData (FILE *datei, char *fname, int *errcode,
       result->begin    = 1;
 
       while (isspace (result->filename[strlen(result->filename)-1]))
-	result->filename[strlen(result->filename)-1] = '\0';
+    result->filename[strlen(result->filename)-1] = '\0';
 
       continue;
     }
 
     if ((strncmp (line, "end", 3) == 0) &&
-	result->uudet != BH_ENCODED &&
-	result->uudet != YENC_ENCODED) {
+    result->uudet != BH_ENCODED &&
+    result->uudet != YENC_ENCODED) {
       if (result->uudet == B64ENCODED && result->begin)
-	result->uudet = XX_ENCODED;
+    result->uudet = XX_ENCODED;
 
       if (result->uudet != B64ENCODED) {
-	if (result->uudet == XX_ENCODED) {
-	  if (prevlinefirstchar == '+')
-	    result->end = 1;
-	}
-	if (result->uudet == UU_ENCODED) {
-	  if (prevlinefirstchar == '`')
-	    result->end = 1;
-	}
-	else {
-	  result->end = 1;
-	}
-	if (dflag && encoding)
-	  result->uudet = encoding;
-	continue;
+    if (result->uudet == XX_ENCODED) {
+      if (prevlinefirstchar == '+')
+        result->end = 1;
+    }
+    if (result->uudet == UU_ENCODED) {
+      if (prevlinefirstchar == '`')
+        result->end = 1;
+    }
+    else {
+      result->end = 1;
+    }
+    if (dflag && encoding)
+      result->uudet = encoding;
+    continue;
       }
     }
 
@@ -702,11 +702,11 @@ ScanData (FILE *datei, char *fname, int *errcode,
      */
 
     if ((_FP_strnicmp (line, "_=_ Part ", 9) == 0 ||
-	_FP_strnicmp (line, "section ", 8) == 0) &&
-	result->uudet != YENC_ENCODED) {
+    _FP_strnicmp (line, "section ", 8) == 0) &&
+    result->uudet != YENC_ENCODED) {
       if (result->uudet) {
-	fseek (datei, oldposition, SEEK_SET);
-	break;
+    fseek (datei, oldposition, SEEK_SET);
+    break;
       }
       result->partno = atoi (line + 8);
       if ((ptr = _FP_stristr (line, " of ")) != NULL) {
@@ -714,22 +714,22 @@ ScanData (FILE *datei, char *fname, int *errcode,
         if(maxpno != 0) result->maxpno = maxpno;
       }
       if ((ptr = _FP_stristr (line, "of file ")) != NULL) {
-	ptr += 8;
-	while (isspace (*ptr)) ptr++;
-	p2 = ptr;
-	while (isalnum(*p2) || (strchr(uufnchars, *p2)!=NULL))
-	  p2++;
-	c = *p2; *p2 = '\0';
-	if (p2 != ptr && result->filename == NULL)
-	  result->filename = _FP_strdup (ptr);
-	else if (p2 - ptr > 5 && strchr (ptr, '.') != NULL) {
-	  /*
-	   * This file name looks good, too. Let's use it
-	   */
-	  _FP_free (result->filename);
-	  result->filename = _FP_strdup (ptr);
-	}
-	*p2 = c;
+    ptr += 8;
+    while (isspace (*ptr)) ptr++;
+    p2 = ptr;
+    while (isalnum(*p2) || (strchr(uufnchars, *p2)!=NULL))
+      p2++;
+    c = *p2; *p2 = '\0';
+    if (p2 != ptr && result->filename == NULL)
+      result->filename = _FP_strdup (ptr);
+    else if (p2 - ptr > 5 && strchr (ptr, '.') != NULL) {
+      /*
+       * This file name looks good, too. Let's use it
+       */
+      _FP_free (result->filename);
+      result->filename = _FP_strdup (ptr);
+    }
+    *p2 = c;
       }
     }
 
@@ -738,106 +738,106 @@ ScanData (FILE *datei, char *fname, int *errcode,
      * accept the "X-Orcl-Content-Type" used by some braindead program.
      */
     if (boundary == NULL && !ismime && !uu_more_mime &&
-	result->uudet != YENC_ENCODED) {
+    result->uudet != YENC_ENCODED) {
       if (_FP_strnicmp (line, "Content-Type", 12) == 0 ||
-	  _FP_strnicmp (line, "X-Orcl-Content-Type", 19) == 0) {
-	/*
-	 * We use Content-Type to mark a new attachment and split the file.
-	 * However, we do not split if we haven't found anything encoded yet.
-	 */
-	if (result->uudet) {
-	  fseek (datei, oldposition, SEEK_SET);
-	  break;
-	}
-	if ((ptr = strchr (line, ':')) != NULL) {
-	  ptr++;
-	  while (isspace (*ptr)) ptr++; p2 = ptr;
-	  while (!isspace (*p2) && *p2 != ';') p2++;
-	  c = *p2; *p2 = '\0';
-	  if (p2 != ptr) {
-	    _FP_free (result->mimetype);
-	    result->mimetype = _FP_strdup (ptr);
-	  }
-	  *p2 = c;
-	}
-	ctline=0;
-	hadct=1;
+      _FP_strnicmp (line, "X-Orcl-Content-Type", 19) == 0) {
+    /*
+     * We use Content-Type to mark a new attachment and split the file.
+     * However, we do not split if we haven't found anything encoded yet.
+     */
+    if (result->uudet) {
+      fseek (datei, oldposition, SEEK_SET);
+      break;
+    }
+    if ((ptr = strchr (line, ':')) != NULL) {
+      ptr++;
+      while (isspace (*ptr)) ptr++; p2 = ptr;
+      while (!isspace (*p2) && *p2 != ';') p2++;
+      c = *p2; *p2 = '\0';
+      if (p2 != ptr) {
+        _FP_free (result->mimetype);
+        result->mimetype = _FP_strdup (ptr);
+      }
+      *p2 = c;
+    }
+    ctline=0;
+    hadct=1;
       }
       if ((ptr = _FP_stristr (line, "number=")) && ctline<4) {
-	ptr += 7; if (*ptr == '"') ptr++;
-	result->partno = atoi (ptr);
+    ptr += 7; if (*ptr == '"') ptr++;
+    result->partno = atoi (ptr);
       }
       if ((ptr = _FP_stristr (line, "total=")) && ctline<4) {
-	ptr += 6; if (*ptr == '"') ptr++;
-	result->maxpno = atoi (ptr);
+    ptr += 6; if (*ptr == '"') ptr++;
+    result->maxpno = atoi (ptr);
       }
       if ((ptr = _FP_stristr (line, "name=")) && ctline<4) {
-	ptr += 5;
-	while (isspace (*ptr)) ptr++;
-	if (*ptr == '"' && *(ptr+1) && (p2 = strchr (ptr+2, '"')) != NULL) {
-	  c = *p2; *p2 = '\0';
-	  _FP_free (result->filename);
-	  result->filename = _FP_strdup (ptr+1);
-	  *p2 = c;
-	}
-	else if (*ptr=='\''&&*(ptr+1)&&(p2 = strchr(ptr+2, '\'')) != NULL) {
-	  c = *p2; *p2 = '\0';
-	  _FP_free (result->filename);
-	  result->filename = _FP_strdup (ptr+1);
-	  *p2 = c;
-	}
-	else {
-	  p2 = ptr;
-	  while (isalnum(*p2) || 
-		 *p2 == '.' || *p2=='_' || *p2 == '-' ||
-		 *p2 == '!' || *p2=='@' || *p2 == '$')
-	    p2++;
-	  c = *p2; *p2 = '\0';
-	  if (p2 != ptr && result->filename == NULL)
-	    result->filename = _FP_strdup (ptr);
-	  else if (p2 - ptr > 5 && strchr (ptr, '.') != NULL) {
-	    /*
-	     * This file name looks good, too. Let's use it
-	     */
-	    _FP_free (result->filename);
-	    result->filename = _FP_strdup (ptr);
-	  }
-	  *p2 = c;
-	}
+    ptr += 5;
+    while (isspace (*ptr)) ptr++;
+    if (*ptr == '"' && *(ptr+1) && (p2 = strchr (ptr+2, '"')) != NULL) {
+      c = *p2; *p2 = '\0';
+      _FP_free (result->filename);
+      result->filename = _FP_strdup (ptr+1);
+      *p2 = c;
+    }
+    else if (*ptr=='\''&&*(ptr+1)&&(p2 = strchr(ptr+2, '\'')) != NULL) {
+      c = *p2; *p2 = '\0';
+      _FP_free (result->filename);
+      result->filename = _FP_strdup (ptr+1);
+      *p2 = c;
+    }
+    else {
+      p2 = ptr;
+      while (isalnum(*p2) || 
+         *p2 == '.' || *p2=='_' || *p2 == '-' ||
+         *p2 == '!' || *p2=='@' || *p2 == '$')
+        p2++;
+      c = *p2; *p2 = '\0';
+      if (p2 != ptr && result->filename == NULL)
+        result->filename = _FP_strdup (ptr);
+      else if (p2 - ptr > 5 && strchr (ptr, '.') != NULL) {
+        /*
+         * This file name looks good, too. Let's use it
+         */
+        _FP_free (result->filename);
+        result->filename = _FP_strdup (ptr);
+      }
+      *p2 = c;
+    }
       }
       if ((ptr = _FP_stristr (line, "id=")) && ctline<4) {
-	p2 = ptr += 3;
-	if (*p2 == '"') {
-	  p2 = strchr (++ptr, '"');
-	}
-	else {
-	  while (*p2 && isprint(*p2) && !isspace(*p2) && *p2 != ';')
-	    p2++;
-	}
-	if (p2 && *p2 && p2!=ptr) {
-	  c = *p2; *p2 = '\0';
-	  if (result->mimeid)
-	    _FP_free (result->mimeid);
-	  result->mimeid = _FP_strdup (ptr);
-	  *p2 = c;
-	}
+    p2 = ptr += 3;
+    if (*p2 == '"') {
+      p2 = strchr (++ptr, '"');
+    }
+    else {
+      while (*p2 && isprint(*p2) && !isspace(*p2) && *p2 != ';')
+        p2++;
+    }
+    if (p2 && *p2 && p2!=ptr) {
+      c = *p2; *p2 = '\0';
+      if (result->mimeid)
+        _FP_free (result->mimeid);
+      result->mimeid = _FP_strdup (ptr);
+      *p2 = c;
+    }
       }
       
       /* 
        * Handling for very short Base64 files.
        */
       if (uu_tinyb64 && !ismime && !uu_more_mime) {
-	if (line[0] == '-' && line[1] == '-') {
-	  if (dflag && (encoding==B64ENCODED || result->uudet==B64ENCODED)) {
-	    if (encoding==B64ENCODED && result->uudet==0 && (haddh||hadct)) {
-	      result->uudet = encoding;
-	      encoding = dflag = 0;
-	    }
-	    haddh = 1;
-	    continue;
-	  }
-	  hadct = 0;
-	}
+    if (line[0] == '-' && line[1] == '-') {
+      if (dflag && (encoding==B64ENCODED || result->uudet==B64ENCODED)) {
+        if (encoding==B64ENCODED && result->uudet==0 && (haddh||hadct)) {
+          result->uudet = encoding;
+          encoding = dflag = 0;
+        }
+        haddh = 1;
+        continue;
+      }
+      hadct = 0;
+    }
       }
     } /* end of reduced MIME handling */
 
@@ -848,21 +848,21 @@ ScanData (FILE *datei, char *fname, int *errcode,
      */
 
     if (boundary == NULL && !ismime && !uu_more_mime && dflag <= 1 &&
-	line[0] == '-' && line[1] == '-' && strlen(line+2)>10 &&
-	(((ptr = _FP_strrstr (line+2, "--")) == NULL) ||
-	 (*(ptr+2) != '\012' && *(ptr+2) != '\015')) &&
-	_FP_strstr (line+2, "_=_") != NULL) {
+    line[0] == '-' && line[1] == '-' && strlen(line+2)>10 &&
+    (((ptr = _FP_strrstr (line+2, "--")) == NULL) ||
+     (*(ptr+2) != '\012' && *(ptr+2) != '\015')) &&
+    _FP_strstr (line+2, "_=_") != NULL) {
       prevlinefirstchar = line[0];
       if (_FP_fgets (line, 255, datei) == NULL) {
-	break;
+    break;
       }
       if (_FP_strnicmp (line, "Content-", 8) == 0) {
-	/*
-	 * Okay, let's do it. This breaks out of ScanData. ScanPart will
-	 * recognize the boundary on the next call and use it.
-	 */
-	fseek (datei, oldposition, SEEK_SET);
-	break;
+    /*
+     * Okay, let's do it. This breaks out of ScanData. ScanPart will
+     * recognize the boundary on the next call and use it.
+     */
+    fseek (datei, oldposition, SEEK_SET);
+    break;
       }
     }
 
@@ -871,10 +871,10 @@ ScanData (FILE *datei, char *fname, int *errcode,
      */
 
     if (strncmp (line, "=ybegin ", 8) == 0 &&
-	_FP_strstr (line, " name=") != NULL) {
+    _FP_strstr (line, " name=") != NULL) {
       if ((result->begin || result->end) && !uu_more_mime) {
-	fseek (datei, oldposition, SEEK_SET);
-	break;
+    fseek (datei, oldposition, SEEK_SET);
+    break;
       }
 
       /*
@@ -886,18 +886,18 @@ ScanData (FILE *datei, char *fname, int *errcode,
       result->filename = _FP_strdup (ptr);
 
       while (isspace (result->filename[strlen(result->filename)-1]))
-	result->filename[strlen(result->filename)-1] = '\0';
+    result->filename[strlen(result->filename)-1] = '\0';
 
       /*
        * Determine size
        */
 
       if ((ptr = _FP_strstr (line, " size=")) != NULL) {
-	ptr += 6;
-	yefilesize = atoi (ptr);
+    ptr += 6;
+    yefilesize = atoi (ptr);
       }
       else {
-	yefilesize = -1;
+    yefilesize = -1;
       }
 
       /*
@@ -905,31 +905,31 @@ ScanData (FILE *datei, char *fname, int *errcode,
        */
 
       if ((ptr = _FP_strstr (line, " part=")) != NULL) {
-	result->partno = atoi (ptr + 6);
+    result->partno = atoi (ptr + 6);
 
-	if (result->partno == 1) {
-	  result->begin = 1;
-	}
+    if (result->partno == 1) {
+      result->begin = 1;
+    }
 
-	if (_FP_fgets (line, 255, datei) == NULL) {
-	  break;
-	}
+    if (_FP_fgets (line, 255, datei) == NULL) {
+      break;
+    }
 
-	line[255] = '\0';
+    line[255] = '\0';
 
-	if (strncmp (line, "=ypart ", 7) != 0) {
-	  break;
-	}
+    if (strncmp (line, "=ypart ", 7) != 0) {
+      break;
+    }
 
-	if ((ptr = _FP_strstr (line, " end=")) == NULL) {
-	  break;
-	}
+    if ((ptr = _FP_strstr (line, " end=")) == NULL) {
+      break;
+    }
        
-	yepartends = atoi (ptr + 5);
+    yepartends = atoi (ptr + 5);
       }
       else {
-	result->partno = 1;
-	result->begin = 1;
+    result->partno = 1;
+    result->begin = 1;
       }
 
       /*
@@ -941,12 +941,12 @@ ScanData (FILE *datei, char *fname, int *errcode,
     }
 
     if (strncmp (line, "=yend ", 6) == 0 &&
-	result->uudet == YENC_ENCODED) {
+    result->uudet == YENC_ENCODED) {
       if (yepartends == 0 || yepartends >= yefilesize) {
-	result->end = 1;
+    result->end = 1;
       }
       if (!uu_more_mime)
-	break;
+    break;
     }
 
     /*
@@ -959,7 +959,7 @@ ScanData (FILE *datei, char *fname, int *errcode,
        */
 
       if ((vflag = UUValidData (line, 0, &bhflag)) == 0 && !ismime)
-	vflag = UURepairData (datei, line, 0, &bhflag);
+    vflag = UURepairData (datei, line, 0, &bhflag);
 
       /*
        * Check data against all possible encodings
@@ -976,17 +976,17 @@ ScanData (FILE *datei, char *fname, int *errcode,
        */
 
       if (vflag == B64ENCODED &&
-	  (dflag == 0 || encoding != B64ENCODED) &&
-	  strlen (line) < 40 && !result->begin && !uu_tinyb64) {
-	isb64[iscnt%10] = 0;
-	vflag = 0;
+      (dflag == 0 || encoding != B64ENCODED) &&
+      strlen (line) < 40 && !result->begin && !uu_tinyb64) {
+    isb64[iscnt%10] = 0;
+    vflag = 0;
       }
 
       if ((vflag == UU_ENCODED || vflag == XX_ENCODED) &&
-	      (dflag == 0 || encoding != vflag) &&
-	      strlen (line) < 40 && !result->begin) {
-	isuue[iscnt%10] = isxxe[iscnt%10] = 0;
-	vflag = 0;
+          (dflag == 0 || encoding != vflag) &&
+          strlen (line) < 40 && !result->begin) {
+    isuue[iscnt%10] = isxxe[iscnt%10] = 0;
+    vflag = 0;
       }
 
       iscnt++;
@@ -996,295 +996,295 @@ ScanData (FILE *datei, char *fname, int *errcode,
        */
 
       if (vflag) {
-	/*
-	 * For BinHex data, we can use the initial colon ':' as begin
-	 * and the terminating colon as ':'.
-	 * If (vflag && !bhflag), this is the last line,
-	 */
-	if (vflag == BH_ENCODED) {
-	  if (line[0] == ':' && result->end) {
-	    fseek (datei, oldposition, SEEK_SET);
-	    break;
-	  }
-	  if (line[0] == ':')
-	    result->begin = 1;
-	  if (bhflag == 0) {
-	    result->uudet = BH_ENCODED;
-	    result->end   = 1;
-	  }
-	}
-	/*
-	 * For BinHex files, the file name is encoded in the first encoded
-	 * data bytes. We try to extract it here
-	 */
-	if (vflag == BH_ENCODED && bhnf == 0 && result->filename == NULL) {
-	  if (bhdsp == bhds2 ||
-	      ((bhdsp-bhds2) <= (int) bhds2[0] &&
-	       (bhdsp-bhds2) <  256)) { 
-	    dcc = UUDecodeLine (line, bhds1, BH_ENCODED);
-	    UUbhdecomp (bhds1, bhdsp, &bhl, &bhrpc,
-			dcc, 256-(bhdsp-bhds2), &bhopc);
-	    bhdsp += bhopc;
-	  }
-	  if ((bhdsp-bhds2) > (int) bhds2[0] && bhds2[0]>0 &&
-	      result->filename==NULL) {
-	    memcpy (bhds1, bhds2+1, (int) bhds2[0]);
-	    bhds1[(int)bhds2[0]]='\0';
-	    result->filename = _FP_strdup (bhds1);
-	    bhnf             = 1;
-	  }
-	  else if (bhdsp-bhds2 >= 256 && bhds2[0]>0) {
-	    memcpy (bhds1, bhds2+1, 255);
-	    bhds1[255]       = '\0';
-	    result->filename = _FP_strdup (bhds1);
-	    bhnf             = 1;
-	  }
-	  else if (bhds2[0] <= 0)
-	    bhnf = 1;
-	}
+    /*
+     * For BinHex data, we can use the initial colon ':' as begin
+     * and the terminating colon as ':'.
+     * If (vflag && !bhflag), this is the last line,
+     */
+    if (vflag == BH_ENCODED) {
+      if (line[0] == ':' && result->end) {
+        fseek (datei, oldposition, SEEK_SET);
+        break;
+      }
+      if (line[0] == ':')
+        result->begin = 1;
+      if (bhflag == 0) {
+        result->uudet = BH_ENCODED;
+        result->end   = 1;
+      }
+    }
+    /*
+     * For BinHex files, the file name is encoded in the first encoded
+     * data bytes. We try to extract it here
+     */
+    if (vflag == BH_ENCODED && bhnf == 0 && result->filename == NULL) {
+      if (bhdsp == bhds2 ||
+          ((bhdsp-bhds2) <= (int) bhds2[0] &&
+           (bhdsp-bhds2) <  256)) { 
+        dcc = UUDecodeLine (line, bhds1, BH_ENCODED);
+        UUbhdecomp (bhds1, bhdsp, &bhl, &bhrpc,
+            dcc, 256-(bhdsp-bhds2), &bhopc);
+        bhdsp += bhopc;
+      }
+      if ((bhdsp-bhds2) > (int) bhds2[0] && bhds2[0]>0 &&
+          result->filename==NULL) {
+        memcpy (bhds1, bhds2+1, (int) bhds2[0]);
+        bhds1[(int)bhds2[0]]='\0';
+        result->filename = _FP_strdup (bhds1);
+        bhnf             = 1;
+      }
+      else if (bhdsp-bhds2 >= 256 && bhds2[0]>0) {
+        memcpy (bhds1, bhds2+1, 255);
+        bhds1[255]       = '\0';
+        result->filename = _FP_strdup (bhds1);
+        bhnf             = 1;
+      }
+      else if (bhds2[0] <= 0)
+        bhnf = 1;
+    }
 
-	/*
-	 * We accept an encoding if it has been true for four consecutive
-	 * lines. Check the is arrays to avoid mistaking one encoding
-	 * for the other. Uuencoded data is rather easily mistaken for
-	 * Base 64. If the data matches more than one encoding, we need to
-	 * scan further.
-	 */
+    /*
+     * We accept an encoding if it has been true for four consecutive
+     * lines. Check the is arrays to avoid mistaking one encoding
+     * for the other. Uuencoded data is rather easily mistaken for
+     * Base 64. If the data matches more than one encoding, we need to
+     * scan further.
+     */
 
-	if (iscnt > 3) {
-	  cbb64 = (isb64[(iscnt-1)%10] && isb64[(iscnt-2)%10] &&
-		   isb64[(iscnt-3)%10] && isb64[(iscnt-4)%10]);
-	  cbuue = (isuue[(iscnt-1)%10] && isuue[(iscnt-2)%10] &&
-		   isuue[(iscnt-3)%10] && isuue[(iscnt-4)%10]);
-	  cbxxe = (isxxe[(iscnt-1)%10] && isxxe[(iscnt-2)%10] &&
-		   isxxe[(iscnt-3)%10] && isxxe[(iscnt-4)%10]);
-	  cbbhx = (isbhx[(iscnt-1)%10] && isbhx[(iscnt-2)%10] &&
-		   isbhx[(iscnt-3)%10] && isbhx[(iscnt-4)%10]);
-	}
-	else {
-	  cbb64 = cbuue = cbxxe = cbbhx = 0;
-	}
+    if (iscnt > 3) {
+      cbb64 = (isb64[(iscnt-1)%10] && isb64[(iscnt-2)%10] &&
+           isb64[(iscnt-3)%10] && isb64[(iscnt-4)%10]);
+      cbuue = (isuue[(iscnt-1)%10] && isuue[(iscnt-2)%10] &&
+           isuue[(iscnt-3)%10] && isuue[(iscnt-4)%10]);
+      cbxxe = (isxxe[(iscnt-1)%10] && isxxe[(iscnt-2)%10] &&
+           isxxe[(iscnt-3)%10] && isxxe[(iscnt-4)%10]);
+      cbbhx = (isbhx[(iscnt-1)%10] && isbhx[(iscnt-2)%10] &&
+           isbhx[(iscnt-3)%10] && isbhx[(iscnt-4)%10]);
+    }
+    else {
+      cbb64 = cbuue = cbxxe = cbbhx = 0;
+    }
 
-	if (cbb64 && !cbuue && !cbxxe && !cbbhx) {
-	  result->uudet = B64ENCODED;
-	}
-	else if (!cbb64 && cbuue && !cbxxe && !cbbhx) {
-	  result->uudet = UU_ENCODED;
-	}
-	else if (!cbb64 && !cbuue && cbxxe && !cbbhx) {
-	  result->uudet = XX_ENCODED;
-	}
-	else if (!cbb64 && !cbuue && !cbxxe && cbbhx) {
-	  result->uudet = BH_ENCODED;
-	}
+    if (cbb64 && !cbuue && !cbxxe && !cbbhx) {
+      result->uudet = B64ENCODED;
+    }
+    else if (!cbb64 && cbuue && !cbxxe && !cbbhx) {
+      result->uudet = UU_ENCODED;
+    }
+    else if (!cbb64 && !cbuue && cbxxe && !cbbhx) {
+      result->uudet = XX_ENCODED;
+    }
+    else if (!cbb64 && !cbuue && !cbxxe && cbbhx) {
+      result->uudet = BH_ENCODED;
+    }
 
-	if (result->uudet) {
+    if (result->uudet) {
           encoding = dflag = 0;
 
-	  /*
-	   * If we're in fast mode, we're told we don't have to look
-	   * for anything below, so we can as well break out of every-
-	   * thing
-	   * We cannot fast-scan if we have a boundary to look after.
-	   */
+      /*
+       * If we're in fast mode, we're told we don't have to look
+       * for anything below, so we can as well break out of every-
+       * thing
+       * We cannot fast-scan if we have a boundary to look after.
+       */
 
-	  if (uu_fast_scanning && boundary == NULL)
-	    break;
+      if (uu_fast_scanning && boundary == NULL)
+        break;
 
-	  /*
-	   * Skip the encoded data. We simply wait for a boundary, for
-	   * a header or for an empty line. But we also try to pick up
-	   * an "end"
-	   */
+      /*
+       * Skip the encoded data. We simply wait for a boundary, for
+       * a header or for an empty line. But we also try to pick up
+       * an "end"
+       */
 
-	  hcount = lcount = 0;
+      hcount = lcount = 0;
 
-	  while (!feof (datei)) {
-	    /*
-	     * Make Busy Polls
-	     */
-	    if (UUBUSYPOLL(ftell(datei),progress.fsize)) {
-	      UUMessage (uuscan_id, __LINE__, UUMSG_NOTE,
-			 uustring (S_SCAN_CANCEL));
-	      *errcode = UURET_CANCEL;
-	      break;
-	    }
+      while (!feof (datei)) {
+        /*
+         * Make Busy Polls
+         */
+        if (UUBUSYPOLL(ftell(datei),progress.fsize)) {
+          UUMessage (uuscan_id, __LINE__, UUMSG_NOTE,
+             uustring (S_SCAN_CANCEL));
+          *errcode = UURET_CANCEL;
+          break;
+        }
 
-	    prevlinefirstchar = line[0];
-	    oldposition = ftell (datei);
-	    if (_FP_fgets (line, 255, datei) == NULL)
-	      break;
-	    if (ferror (datei))
-	      break;
+        prevlinefirstchar = line[0];
+        oldposition = ftell (datei);
+        if (_FP_fgets (line, 255, datei) == NULL)
+          break;
+        if (ferror (datei))
+          break;
 
-	    line[255] = '\0';
+        line[255] = '\0';
 
-	    /*
-	     * Stop scanning at an empty line or a MIME-boundary.
-	     */
-	    if (IsLineEmpty (line))
-	      break;
-	    if (boundary && line[0] == '-' && line[1] == '-' &&
-		strncmp (line+2, boundary, blen) == 0) {
-	      fseek (datei, oldposition, SEEK_SET);
-	      break;
-	    }
-	    else if (line[0] == 'e' && (result->uudet == UU_ENCODED ||
-					result->uudet == XX_ENCODED)) {
-	      if (strncmp (line, "end", 3) == 0) {
-		if (result->uudet == XX_ENCODED) {
-		  if (prevlinefirstchar == '+') {
-		    result->end = 1;
-		    break;
-		  }
-		}
-		else {
-		  if (prevlinefirstchar == '`') {
-		    result->end = 1;
-		    break;
-		  }
-		}
-	      }
-	    }
-	    else if (line[0] == 'b') {
-	      if (strncmp (line, "begin ", 6) == 0) {
-		fseek (datei, oldposition, SEEK_SET);
-		break;
-	      }
-	    }
+        /*
+         * Stop scanning at an empty line or a MIME-boundary.
+         */
+        if (IsLineEmpty (line))
+          break;
+        if (boundary && line[0] == '-' && line[1] == '-' &&
+        strncmp (line+2, boundary, blen) == 0) {
+          fseek (datei, oldposition, SEEK_SET);
+          break;
+        }
+        else if (line[0] == 'e' && (result->uudet == UU_ENCODED ||
+                    result->uudet == XX_ENCODED)) {
+          if (strncmp (line, "end", 3) == 0) {
+        if (result->uudet == XX_ENCODED) {
+          if (prevlinefirstchar == '+') {
+            result->end = 1;
+            break;
+          }
+        }
+        else {
+          if (prevlinefirstchar == '`') {
+            result->end = 1;
+            break;
+          }
+        }
+          }
+        }
+        else if (line[0] == 'b') {
+          if (strncmp (line, "begin ", 6) == 0) {
+        fseek (datei, oldposition, SEEK_SET);
+        break;
+          }
+        }
 
-	    if (checkheaders) {
-	      if (IsKnownHeader (line)) {
-		(void) ScanHeaderLine (datei, line);
-		if (hcount == 0)
-		  preheaders = oldposition;
-		hcount++;
-		lcount++;
-		if ((hcount >= hlcount.restart) ||
-		    (hcount >= hlcount.afterdata && result->uudet)) {
-		  /*
-		   * Hey, a new header starts here
-		   */
-		  fseek (datei, preheaders, SEEK_SET);
-		  break;
-		}
-	      }
-	      else if (lcount > WAITHEADER) {
-		hcount = 0;
-		lcount = 0;
-	      }
-	      else if (hcount) {
-		lcount++;
-	      }
-	    }
-	    if (result->uudet == BH_ENCODED) {
-	      /* pick up ``EOF'' for BinHex files. Slow :-< */
-	      if (line[0] && strchr (line+1, ':') != NULL) {
-		result->end = 1;
-		bhflag      = 0;
-		break;
-	      }
-	    }
-	  }
+        if (checkheaders) {
+          if (IsKnownHeader (line)) {
+        (void) ScanHeaderLine (datei, line);
+        if (hcount == 0)
+          preheaders = oldposition;
+        hcount++;
+        lcount++;
+        if ((hcount >= hlcount.restart) ||
+            (hcount >= hlcount.afterdata && result->uudet)) {
+          /*
+           * Hey, a new header starts here
+           */
+          fseek (datei, preheaders, SEEK_SET);
+          break;
+        }
+          }
+          else if (lcount > WAITHEADER) {
+        hcount = 0;
+        lcount = 0;
+          }
+          else if (hcount) {
+        lcount++;
+          }
+        }
+        if (result->uudet == BH_ENCODED) {
+          /* pick up ``EOF'' for BinHex files. Slow :-< */
+          if (line[0] && strchr (line+1, ':') != NULL) {
+        result->end = 1;
+        bhflag      = 0;
+        break;
+          }
+        }
+      }
 
-	  if (ferror (datei) || *errcode == UURET_CANCEL)
-	    break;
+      if (ferror (datei) || *errcode == UURET_CANCEL)
+        break;
 
-	  if (line[0] == '-' && line[1] == '-')
-	    haddh = 1;
+      if (line[0] == '-' && line[1] == '-')
+        haddh = 1;
 
-	  /*
-	   * Okay, got everything we need. If we had headers or a
-	   * boundary, we break out of the outer loop immediately.
-	   */
+      /*
+       * Okay, got everything we need. If we had headers or a
+       * boundary, we break out of the outer loop immediately.
+       */
 
-	  if (IsKnownHeader (line) ||
-	      (boundary && line[0] == '-' && line[1] == '-' &&
-	       strncmp (line+2, boundary, blen) == 0)) {
-	    break;
-	  }
+      if (IsKnownHeader (line) ||
+          (boundary && line[0] == '-' && line[1] == '-' &&
+           strncmp (line+2, boundary, blen) == 0)) {
+        break;
+      }
 
-	  /*
-	   * Otherwise, we wait until finding something more interesting
-	   * in the outer loop
-	   */
+      /*
+       * Otherwise, we wait until finding something more interesting
+       * in the outer loop
+       */
 
-	  continue;
-	}
-	
-	/*
-	 * Select the encoding with the best "history"
-	 */
+      continue;
+    }
+    
+    /*
+     * Select the encoding with the best "history"
+     */
 
-	cbb64 = isb64[(iscnt-1)%10];
-	cbuue = isuue[(iscnt-1)%10];
-	cbxxe = isxxe[(iscnt-1)%10];
-	cbbhx = isbhx[(iscnt-1)%10];
-	dflag = 0;
+    cbb64 = isb64[(iscnt-1)%10];
+    cbuue = isuue[(iscnt-1)%10];
+    cbxxe = isxxe[(iscnt-1)%10];
+    cbbhx = isbhx[(iscnt-1)%10];
+    dflag = 0;
 
-	if (cbb64 || cbuue || cbxxe || cbbhx) {
-	  for (dflag=2; dflagbegin) {
-	  encoding = UU_ENCODED;
-	}
-	else if (!encoding && cbxxe && result->begin) {
-	  encoding = XX_ENCODED;
-	}
-	else if (!encoding && cbb64) {
-	  encoding = B64ENCODED;
-	}
-	else if (!encoding && cbuue) {
-	  encoding = UU_ENCODED;
-	}
-	else if (!encoding && cbxxe) {
-	  encoding = XX_ENCODED;
-	}
-	else if (!encoding && cbbhx) {
-	  encoding = BH_ENCODED;
-	}
+    if (!encoding && cbuue && result->begin) {
+      encoding = UU_ENCODED;
+    }
+    else if (!encoding && cbxxe && result->begin) {
+      encoding = XX_ENCODED;
+    }
+    else if (!encoding && cbb64) {
+      encoding = B64ENCODED;
+    }
+    else if (!encoding && cbuue) {
+      encoding = UU_ENCODED;
+    }
+    else if (!encoding && cbxxe) {
+      encoding = XX_ENCODED;
+    }
+    else if (!encoding && cbbhx) {
+      encoding = BH_ENCODED;
+    }
       }
       else if (!dontcare) {
-	encoding = 0;
+    encoding = 0;
         dflag = 0;
-	haddh = 0;
+    haddh = 0;
       }
     } /* if (!uudet) */
     /*
@@ -1331,7 +1331,7 @@ ScanData (FILE *datei, char *fname, int *errcode,
      */
 
     if ((result->uudet != 0 && result->uudet != B64ENCODED) &&
-	(!result->begin || !result->end)) {
+    (!result->begin || !result->end)) {
       result->uudet = 0;
     }
   }
@@ -1360,9 +1360,9 @@ ScanData (FILE *datei, char *fname, int *errcode,
       strncmp (line+2, boundary, blen) == 0)
     return 2;
   else if (boundary && p3 &&
-	   line[0] == 'C' && line[1] == 'o' &&
-	   _FP_strnicmp (line, "Content-Type:", 13) == 0 &&
-	   strcmp (p3, boundary) == 0)
+       line[0] == 'C' && line[1] == 'o' &&
+       _FP_strnicmp (line, "Content-Type:", 13) == 0 &&
+       strcmp (p3, boundary) == 0)
     return 2;
   else if (IsKnownHeader (line))
     return 1;
@@ -1403,9 +1403,9 @@ ScanPart (FILE *datei, char *fname, int *errcode)
 
   /* if this is a new file, reset our scanning state */
   if (sstate.source == NULL || strcmp (fname, sstate.source) != 0) {
-    sstate.isfolder  = 1;		/* assume yes            */
-    sstate.ismime    = 0;		/* wait for MIME-Version */
-    sstate.mimestate = MS_HEADERS;	/* assume headers follow */
+    sstate.isfolder  = 1;       /* assume yes            */
+    sstate.ismime    = 0;       /* wait for MIME-Version */
+    sstate.mimestate = MS_HEADERS;  /* assume headers follow */
     /* mimseqno      = 1; */
 
     while (mssdepth) {
@@ -1429,11 +1429,11 @@ ScanPart (FILE *datei, char *fname, int *errcode)
     while (!feof (datei)) {
       if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
       if (_FP_fgets (line, 255, datei) == NULL)
-	break;
+    break;
       if (!IsLineEmpty (line)) {
-	fseek (datei, preheaders, SEEK_SET);
-	line[255] = '\0';
-	break;
+    fseek (datei, preheaders, SEEK_SET);
+    line[255] = '\0';
+    break;
       }
       preheaders = ftell (datei);
     }
@@ -1481,8 +1481,8 @@ ScanPart (FILE *datei, char *fname, int *errcode)
 
     if (!feof (datei) && line[0] == '-' && line[1] == '-' && line[2]) {
       while (line[strlen(line)-1] == '\012' ||
-	     line[strlen(line)-1] == '\015') {
-	line[strlen(line)-1] = '\0';
+         line[strlen(line)-1] == '\015') {
+    line[strlen(line)-1] = '\0';
       }
 
       sstate.ismime            = 1;
@@ -1502,13 +1502,13 @@ ScanPart (FILE *datei, char *fname, int *errcode)
 
     while (!feof (datei) && !IsLineEmpty (line)) {
       if (IsKnownHeader (line))
-	hcount++;
+    hcount++;
       if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
       ptr1 = ScanHeaderLine (datei, line);
       if (ParseHeader (&sstate.envelope, ptr1) == NULL) {
-	*errcode = UURET_NOMEM;
-	_FP_free (result);
-	return NULL;
+    *errcode = UURET_NOMEM;
+    _FP_free (result);
+    return NULL;
       }
       /*
        * if we've read too many lines without finding headers, then
@@ -1516,22 +1516,22 @@ ScanPart (FILE *datei, char *fname, int *errcode)
        */
       lcount++;
       if (lcount > WAITHEADER && hcount < hlcount.afternl)
-	break;
+    break;
 
       if (_FP_fgets (line, 255, datei) == NULL)
-	break;
+    break;
       line[255] = '\0';
     }
     /* skip empty lines */
     prevpos = ftell (datei);
     while (!feof (datei)) {
       if (_FP_fgets (line, 255, datei) == NULL)
-	break;
+    break;
       if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
       if (!IsLineEmpty (line)) {
-	fseek (datei, prevpos, SEEK_SET);
-	line[255] = '\0';
-	break;
+    fseek (datei, prevpos, SEEK_SET);
+    line[255] = '\0';
+    break;
       }
       prevpos = ftell (datei);
     }
@@ -1541,45 +1541,45 @@ ScanPart (FILE *datei, char *fname, int *errcode)
      */
 
     if (!uu_more_mime &&
-	sstate.envelope.mimevers == NULL &&
-	sstate.envelope.ctype    == NULL &&
-	sstate.envelope.ctenc    == NULL &&
-	IsKnownHeader (line)) {
+    sstate.envelope.mimevers == NULL &&
+    sstate.envelope.ctype    == NULL &&
+    sstate.envelope.ctenc    == NULL &&
+    IsKnownHeader (line)) {
       /*
        * see above
        */
       if (_FP_fgets (line, 255, datei) == NULL) {
-	line[0] = '\012';
-	line[1] = '\0';
+    line[0] = '\012';
+    line[1] = '\0';
       }
       line[255] = '\0';
 
       while (!feof (datei) && !IsLineEmpty (line)) {
-	if (IsKnownHeader (line))
-	  hcount++;
-	if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
-	ptr1 = ScanHeaderLine (datei, line);
-	if (ParseHeader (&sstate.envelope, ptr1) == NULL) {
-	  *errcode = UURET_NOMEM;
-	  _FP_free (result);
-	  return NULL;
-	}
-	if (_FP_fgets (line, 255, datei) == NULL)
-	  break;
-	line[255] = '\0';
+    if (IsKnownHeader (line))
+      hcount++;
+    if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
+    ptr1 = ScanHeaderLine (datei, line);
+    if (ParseHeader (&sstate.envelope, ptr1) == NULL) {
+      *errcode = UURET_NOMEM;
+      _FP_free (result);
+      return NULL;
+    }
+    if (_FP_fgets (line, 255, datei) == NULL)
+      break;
+    line[255] = '\0';
       }
       /* skip empty lines */
       prevpos = ftell (datei);
       while (!feof (datei)) {
-	if (_FP_fgets (line, 255, datei) == NULL)
-	  break;
-	if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
-	if (!IsLineEmpty (line)) {
-	  fseek (datei, prevpos, SEEK_SET);
-	  line[255] = '\0';
-	  break;
-	}
-	prevpos = ftell (datei);
+    if (_FP_fgets (line, 255, datei) == NULL)
+      break;
+    if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
+    if (!IsLineEmpty (line)) {
+      fseek (datei, prevpos, SEEK_SET);
+      line[255] = '\0';
+      break;
+    }
+    prevpos = ftell (datei);
       }
     }
 
@@ -1591,13 +1591,13 @@ ScanPart (FILE *datei, char *fname, int *errcode)
      * headers, don't be too picky about it.
      */
     if (sstate.envelope.ctype && sstate.envelope.mimevers==NULL  &&
-	_FP_stristr (sstate.envelope.ctype, "multipart") != NULL &&
-	sstate.envelope.boundary != NULL) {
+    _FP_stristr (sstate.envelope.ctype, "multipart") != NULL &&
+    sstate.envelope.boundary != NULL) {
       sstate.envelope.mimevers = _FP_strdup ("1.0");
       hcount = hlcount.afternl;
     }
     else if (sstate.envelope.mimevers==NULL && sstate.envelope.ctype &&
-	     sstate.envelope.fname && sstate.envelope.ctenc) {
+         sstate.envelope.fname && sstate.envelope.ctenc) {
       sstate.envelope.mimevers = _FP_strdup ("1.0");
       hcount = hlcount.afternl;
     }
@@ -1612,19 +1612,19 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       /* this is a MIME file. check the Content-Type */
       sstate.ismime = 1;
       if (_FP_stristr (sstate.envelope.ctype, "multipart") != NULL) {
-	if (sstate.envelope.boundary == NULL) {
-	  UUMessage (uuscan_id, __LINE__, UUMSG_WARNING,
-		     uustring (S_MIME_NO_BOUNDARY));
-	  sstate.mimestate = MS_BODY;
-	  _FP_free (sstate.envelope.ctype);
-	  sstate.envelope.ctype = _FP_strdup ("text/plain");
-	}
-	else {
-	  sstate.mimestate = MS_PREAMBLE;
-	}
+    if (sstate.envelope.boundary == NULL) {
+      UUMessage (uuscan_id, __LINE__, UUMSG_WARNING,
+             uustring (S_MIME_NO_BOUNDARY));
+      sstate.mimestate = MS_BODY;
+      _FP_free (sstate.envelope.ctype);
+      sstate.envelope.ctype = _FP_strdup ("text/plain");
+    }
+    else {
+      sstate.mimestate = MS_PREAMBLE;
+    }
       }
       else {
-	sstate.mimestate = MS_BODY;	/* just a `simple' message */
+    sstate.mimestate = MS_BODY; /* just a `simple' message */
       }
     }
   }
@@ -1644,7 +1644,7 @@ ScanPart (FILE *datei, char *fname, int *errcode)
    */
 
   if (sstate.ismime && sstate.mimestate == MS_PREAMBLE) {
-    result->startpos = ftell (datei);	/* remember start of preamble */
+    result->startpos = ftell (datei);   /* remember start of preamble */
     prevpos          = ftell (datei);
     preheaders       = ftell (datei);
 
@@ -1653,21 +1653,21 @@ ScanPart (FILE *datei, char *fname, int *errcode)
     
     while (!feof (datei)) {
       if (_FP_fgets (line, 255, datei) == NULL) {
-	line[0] = '\0';
-	break;
+    line[0] = '\0';
+    break;
       }
       if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
       if (line[0] == '-' && line[1] == '-' &&
-	  strncmp (line+2, sstate.envelope.boundary, blen) == 0)
-	break;
+      strncmp (line+2, sstate.envelope.boundary, blen) == 0)
+    break;
       if (!IsLineEmpty (line))
-	lcount++;
+    lcount++;
 
       prevpos = ftell (datei);
     }
     if (feof (datei) || ferror (datei)) {
       UUMessage (uuscan_id, __LINE__, UUMSG_WARNING,
-		 uustring (S_MIME_B_NOT_FOUND));
+         uustring (S_MIME_B_NOT_FOUND));
       /*
        * restart and try again; don't restart if uu_fast_scanning
        */
@@ -1676,26 +1676,26 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       sstate.mimestate = MS_BODY;
 
       if (!uu_fast_scanning) {
-	*errcode = UURET_CONT;
-	fseek (datei, preheaders, SEEK_SET);
+    *errcode = UURET_CONT;
+    fseek (datei, preheaders, SEEK_SET);
       }
       _FP_free (result);
       return NULL;
     }
     if (line[0] == '-' && line[1] == '-' &&
-	strncmp (line+2, sstate.envelope.boundary, blen) == 0) {
+    strncmp (line+2, sstate.envelope.boundary, blen) == 0) {
       ptr1 = line + 2 + blen;
       if (*ptr1 == '-' && *(ptr1+1) == '-') {
-	/* Empty Multipart Message. Duh. */
-	sstate.mimestate = MS_EPILOGUE;
+    /* Empty Multipart Message. Duh. */
+    sstate.mimestate = MS_EPILOGUE;
       }
       else {
-	sstate.mimestate = MS_SUBPART;
+    sstate.mimestate = MS_SUBPART;
       }
     }
     else { /* shouldn't happen */
       UUMessage (uuscan_id, __LINE__, UUMSG_WARNING,
-		 uustring (S_MIME_B_NOT_FOUND));
+         uustring (S_MIME_B_NOT_FOUND));
       /*
        * restart and try again; don't restart if uu_fast_scanning
        */
@@ -1704,8 +1704,8 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       sstate.mimestate = MS_BODY;
 
       if (!uu_fast_scanning) {
-	*errcode = UURET_CONT;
-	fseek (datei, preheaders, SEEK_SET);
+    *errcode = UURET_CONT;
+    fseek (datei, preheaders, SEEK_SET);
       }
       _FP_free (result);
       return NULL;
@@ -1719,7 +1719,7 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       result->mimeid   = _FP_strdup (sstate.envelope.mimeid);
       result->mimetype = _FP_strdup ("text/plain");
       result->mode     = 0644;
-      result->uudet    = PT_ENCODED;	/* plain text */
+      result->uudet    = PT_ENCODED;    /* plain text */
       result->sfname   = _FP_strdup (fname);
       result->flags    = FL_SINGLE | FL_PROPER;
       /* result->startpos set from above */
@@ -1730,8 +1730,8 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       *errcode = UURET_CONT;
 
       if ((sstate.envelope.subject != NULL && result->subject == NULL) ||
-	  result->filename == NULL || result->sfname == NULL) {
-	*errcode = UURET_NOMEM;
+      result->filename == NULL || result->sfname == NULL) {
+    *errcode = UURET_NOMEM;
       }
 
       return result;
@@ -1759,7 +1759,7 @@ ScanPart (FILE *datei, char *fname, int *errcode)
    */
 
   if (sstate.ismime && sstate.mimestate == MS_EPILOGUE) {
-    result->startpos = ftell (datei);	/* remember start of epilogue */
+    result->startpos = ftell (datei);   /* remember start of epilogue */
     prevpos          = ftell (datei);
     preheaders       = ftell (datei);
     preenc           = ftell (datei);
@@ -1778,33 +1778,33 @@ ScanPart (FILE *datei, char *fname, int *errcode)
        * check if the epilogue is empty
        */
       while (!feof (datei) && !ferror (datei) && lcount<10 && res==0) {
-	if (_FP_fgets (line, 255, datei) == NULL)
-	  break;
-	if (!IsLineEmpty (line))
-	  res++;
-	lcount++;
+    if (_FP_fgets (line, 255, datei) == NULL)
+      break;
+    if (!IsLineEmpty (line))
+      res++;
+    lcount++;
       }
       if (uu_usepreamble && res) {
-	sprintf (line, "%04d.txt", ++mimseqno);
-	result->subject  = _FP_strdup (sstate.envelope.subject);
-	result->filename = _FP_strdup (line);
-	result->origin   = _FP_strdup (sstate.envelope.from);
-	result->mimeid   = _FP_strdup (sstate.envelope.mimeid);
-	result->mimetype = _FP_strdup ("text/plain");
-	result->mode     = 0644;
-	result->uudet    = PT_ENCODED;	/* plain text */
-	result->sfname   = _FP_strdup (fname);
-	result->flags    = FL_SINGLE | FL_PROPER | FL_TOEND;
-	result->partno   = 1;
-	/* result->startpos set from above */
-	result->length   = progress.fsize - result->startpos;
+    sprintf (line, "%04d.txt", ++mimseqno);
+    result->subject  = _FP_strdup (sstate.envelope.subject);
+    result->filename = _FP_strdup (line);
+    result->origin   = _FP_strdup (sstate.envelope.from);
+    result->mimeid   = _FP_strdup (sstate.envelope.mimeid);
+    result->mimetype = _FP_strdup ("text/plain");
+    result->mode     = 0644;
+    result->uudet    = PT_ENCODED;  /* plain text */
+    result->sfname   = _FP_strdup (fname);
+    result->flags    = FL_SINGLE | FL_PROPER | FL_TOEND;
+    result->partno   = 1;
+    /* result->startpos set from above */
+    result->length   = progress.fsize - result->startpos;
 
-	if ((sstate.envelope.subject != NULL && result->subject == NULL) ||
-	    result->filename == NULL || result->sfname == NULL) {
-	  *errcode = UURET_NOMEM;
-	}
+    if ((sstate.envelope.subject != NULL && result->subject == NULL) ||
+        result->filename == NULL || result->sfname == NULL) {
+      *errcode = UURET_NOMEM;
+    }
 
-	return result;
+    return result;
       }
       _FP_free (result);
       return NULL;
@@ -1815,86 +1815,86 @@ ScanPart (FILE *datei, char *fname, int *errcode)
 
     while (!feof (datei)) {
       if (_FP_fgets (line, 255, datei) == NULL) {
-	line[0] = '\0';
-	break;
+    line[0] = '\0';
+    break;
       }
       if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
       line[255] = '\0';
       /* check for parent boundary */
       if (mssdepth > 0 && line[0] == '-' && line[1] == '-' &&
-	  strncmp (line+2,
-		   multistack[mssdepth-1].envelope.boundary, blen) == 0)
-	break;
+      strncmp (line+2,
+           multistack[mssdepth-1].envelope.boundary, blen) == 0)
+    break;
 
       /* check for next headers only at outermost level */
       if (mssdepth == 0 && IsKnownHeader (line)) {
-	(void) ScanHeaderLine (datei, line);
-	if (hcount == 0) {
-	  preheaders = prevpos;
-	  lcount     = 0;
-	}
-	hcount++; 
-	lcount++;
+    (void) ScanHeaderLine (datei, line);
+    if (hcount == 0) {
+      preheaders = prevpos;
+      lcount     = 0;
+    }
+    hcount++; 
+    lcount++;
 
-	if (hcount >= hlcount.restart) {
-	  /* okay, new headers */
-	  break;
-	}
+    if (hcount >= hlcount.restart) {
+      /* okay, new headers */
+      break;
+    }
       }
       else if (lcount > WAITHEADER) {
-	hcount = 0;
-	lcount = 0;
+    hcount = 0;
+    lcount = 0;
       }
       else if (hcount) {
-	lcount++;
+    lcount++;
       }
       else {
-	hcount = lcount = 0;
+    hcount = lcount = 0;
       }
 
       /* check for begin and encoded data only at outermost level */
       if (mssdepth == 0 && !uu_more_mime) {
-	if (strncmp      (line, "begin ",       6) == 0 ||
-	    _FP_strnicmp (line, "
begin ", 11) == 0) {
-	  preenc  = prevpos;
-	  begflag = 1;
-	}
-	else if (strncmp (line, "end", 3) == 0 && begflag) {
-	  ecount = ELC_COUNT;
-	  break;
-	}
-	else if ((vflag = UUValidData (line, 0, &bhflag)) != 0) {
-	  if (vflag == BH_ENCODED && bhflag == 0) {
-	    /* very short BinHex file follows */
-	    preenc = prevpos;
-	    break;
-	  }
-	  /* remember that XX can easily be mistaken as Base64 */
-	  if ((vflag == UU_ENCODED || vflag == XX_ENCODED ||
-	       vflag == B64ENCODED) && begflag) {
-	    if (++ecount >= ELC_COUNT)
-	      break;
-	  }
-	  else {
-	    begflag = 0;
-	    ecount  = 0;
-	  }
-	}
-	else {
-	  begflag = 0;
-	  ecount  = 0;
-	}
+    if (strncmp      (line, "begin ",       6) == 0 ||
+        _FP_strnicmp (line, "
begin ", 11) == 0) {
+      preenc  = prevpos;
+      begflag = 1;
+    }
+    else if (strncmp (line, "end", 3) == 0 && begflag) {
+      ecount = ELC_COUNT;
+      break;
+    }
+    else if ((vflag = UUValidData (line, 0, &bhflag)) != 0) {
+      if (vflag == BH_ENCODED && bhflag == 0) {
+        /* very short BinHex file follows */
+        preenc = prevpos;
+        break;
+      }
+      /* remember that XX can easily be mistaken as Base64 */
+      if ((vflag == UU_ENCODED || vflag == XX_ENCODED ||
+           vflag == B64ENCODED) && begflag) {
+        if (++ecount >= ELC_COUNT)
+          break;
+      }
+      else {
+        begflag = 0;
+        ecount  = 0;
+      }
+    }
+    else {
+      begflag = 0;
+      ecount  = 0;
+    }
       }
 
       if (!IsLineEmpty (line))
-	res++;
+    res++;
 
       prevpos = ftell (datei);
     }
 
-    if (mssdepth > 0 &&	line[0] == '-' && line[1] == '-' &&
-	strncmp (line+2,
-		 multistack[mssdepth-1].envelope.boundary, blen) == 0) {
+    if (mssdepth > 0 && line[0] == '-' && line[1] == '-' &&
+    strncmp (line+2,
+         multistack[mssdepth-1].envelope.boundary, blen) == 0) {
       /* restore previous state */
       mssdepth--;
       UUkillheaders (&sstate.envelope);
@@ -1904,17 +1904,17 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       ptr1 = line + 2 + strlen (sstate.envelope.boundary);
 
       if (*ptr1 == '-' && *(ptr1+1) == '-') {
-	sstate.mimestate = MS_EPILOGUE;
+    sstate.mimestate = MS_EPILOGUE;
       }
       else {
-	sstate.mimestate = MS_SUBPART;
+    sstate.mimestate = MS_SUBPART;
       }
       result->length = prevpos - result->startpos;
       *errcode = UURET_CONT;
     }
     else if (mssdepth > 0) {
       UUMessage (uuscan_id, __LINE__, UUMSG_WARNING,
-		 uustring (S_MIME_B_NOT_FOUND));
+         uustring (S_MIME_B_NOT_FOUND));
       /*
        * restart and try again; don't restart if uu_fast_scanning
        */
@@ -1923,14 +1923,14 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       sstate.mimestate = MS_BODY;
 
       while (mssdepth) {
-	mssdepth--;
-	UUkillheaders (&(multistack[mssdepth].envelope));
-	_FP_free (multistack[mssdepth].source);
+    mssdepth--;
+    UUkillheaders (&(multistack[mssdepth].envelope));
+    _FP_free (multistack[mssdepth].source);
       }
 
       if (!uu_fast_scanning) {
-	*errcode = UURET_CONT;
-	fseek (datei, preheaders, SEEK_SET);
+    *errcode = UURET_CONT;
+    fseek (datei, preheaders, SEEK_SET);
       }
       _FP_free (result);
       return NULL;
@@ -1961,7 +1961,7 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       result->mimeid   = _FP_strdup (sstate.envelope.mimeid);
       result->mimetype = _FP_strdup ("text/plain");
       result->mode     = 0644;
-      result->uudet    = PT_ENCODED;	/* plain text */
+      result->uudet    = PT_ENCODED;    /* plain text */
       result->sfname   = _FP_strdup (fname);
       result->flags    = FL_SINGLE | FL_PROPER;
       result->partno   = 1;
@@ -1969,8 +1969,8 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       /* result->length set from above */
 
       if ((sstate.envelope.subject != NULL && result->subject == NULL) ||
-	  result->filename == NULL || result->sfname == NULL) {
-	*errcode = UURET_NOMEM;
+      result->filename == NULL || result->sfname == NULL) {
+    *errcode = UURET_NOMEM;
       }
 
       return result;
@@ -1988,7 +1988,7 @@ ScanPart (FILE *datei, char *fname, int *errcode)
    * stack and dive into the new environment, starting with another
    * preamble.
    */
-			   
+               
   if (sstate.ismime && sstate.mimestate == MS_SUBPART) {
     memset (&localenv, 0, sizeof (headers));
     result->startpos = ftell (datei);
@@ -2007,15 +2007,15 @@ ScanPart (FILE *datei, char *fname, int *errcode)
     localenv.date     = _FP_strdup (sstate.envelope.date);
 
     if ((sstate.envelope.mimevers != NULL && localenv.mimevers == NULL) ||
-	(sstate.envelope.from     != NULL && localenv.from     == NULL) ||
-	(sstate.envelope.subject  != NULL && localenv.subject  == NULL) ||
-	(sstate.envelope.rcpt     != NULL && localenv.rcpt     == NULL) ||
-	(sstate.envelope.date     != NULL && localenv.date     == NULL)) {
+    (sstate.envelope.from     != NULL && localenv.from     == NULL) ||
+    (sstate.envelope.subject  != NULL && localenv.subject  == NULL) ||
+    (sstate.envelope.rcpt     != NULL && localenv.rcpt     == NULL) ||
+    (sstate.envelope.date     != NULL && localenv.date     == NULL)) {
 
       while (mssdepth) {
-	mssdepth--;
-	UUkillheaders (&(multistack[mssdepth].envelope));
-	_FP_free (multistack[mssdepth].source);
+    mssdepth--;
+    UUkillheaders (&(multistack[mssdepth].envelope));
+    _FP_free (multistack[mssdepth].source);
       }
       sstate.isfolder = 0;
       sstate.ismime   = 0;
@@ -2035,9 +2035,9 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       sstate.isfolder = 0;
       sstate.ismime   = 0;
       while (mssdepth) {
-	mssdepth--;
-	UUkillheaders (&(multistack[mssdepth].envelope));
-	_FP_free (multistack[mssdepth].source);
+    mssdepth--;
+    UUkillheaders (&(multistack[mssdepth].envelope));
+    _FP_free (multistack[mssdepth].source);
       }
       UUkillheaders (&localenv);
       _FP_free (result);
@@ -2047,24 +2047,24 @@ ScanPart (FILE *datei, char *fname, int *errcode)
 
     while (!feof (datei) && !IsLineEmpty (line)) {
       if (IsKnownHeader (line))
-	hcount++;
+    hcount++;
       if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
       if (lcount > WAITHEADER && hcount == 0) {
-	fseek (datei, preheaders, SEEK_SET);
-	prevpos = preheaders;
-	break;
+    fseek (datei, preheaders, SEEK_SET);
+    prevpos = preheaders;
+    break;
       }
       ptr1 = ScanHeaderLine (datei, line);
       if (ParseHeader (&localenv, ptr1) == NULL)
-	*errcode = UURET_NOMEM;
+    *errcode = UURET_NOMEM;
 
       if (line[0] == '-' && line[1] == '-')
-	break;
+    break;
 
       prevpos = ftell (datei);
 
       if (_FP_fgets (line, 255, datei) == NULL)
-	break;
+    break;
       line[255] = '\0';
       lcount++;
     }
@@ -2080,29 +2080,29 @@ ScanPart (FILE *datei, char *fname, int *errcode)
     if (_FP_stristr (localenv.ctype, "multipart") != NULL) {
       /* oh no, not again */
       if (mssdepth >= MSMAXDEPTH) {
-	/* Argh, what an isane message. Treat as plain text */
-	UUMessage (uuscan_id, __LINE__, UUMSG_WARNING,
-		   uustring (S_MIME_MULTI_DEPTH));
+    /* Argh, what an isane message. Treat as plain text */
+    UUMessage (uuscan_id, __LINE__, UUMSG_WARNING,
+           uustring (S_MIME_MULTI_DEPTH));
       }
       else if (localenv.boundary == NULL) {
-	UUMessage (uuscan_id, __LINE__, UUMSG_WARNING,
-		   uustring (S_MIME_NO_BOUNDARY));
+    UUMessage (uuscan_id, __LINE__, UUMSG_WARNING,
+           uustring (S_MIME_NO_BOUNDARY));
       }
       else {
-	memcpy (&multistack[mssdepth], &sstate, sizeof (scanstate));
-	memcpy (&sstate.envelope,    &localenv, sizeof (headers));
-	memset (&localenv, 0, sizeof (headers));
-	sstate.mimestate = MS_PREAMBLE;
-	if ((sstate.source = _FP_strdup (sstate.source)) == NULL)
-	  *errcode = UURET_NOMEM;
+    memcpy (&multistack[mssdepth], &sstate, sizeof (scanstate));
+    memcpy (&sstate.envelope,    &localenv, sizeof (headers));
+    memset (&localenv, 0, sizeof (headers));
+    sstate.mimestate = MS_PREAMBLE;
+    if ((sstate.source = _FP_strdup (sstate.source)) == NULL)
+      *errcode = UURET_NOMEM;
 
-	if (*errcode == UURET_OK)
-	  *errcode = UURET_CONT;
+    if (*errcode == UURET_OK)
+      *errcode = UURET_CONT;
 
-	mssdepth++;
-	/* need a restart */
-	_FP_free (result);
-	return NULL;
+    mssdepth++;
+    /* need a restart */
+    _FP_free (result);
+    return NULL;
       }
     }
 
@@ -2132,10 +2132,10 @@ ScanPart (FILE *datei, char *fname, int *errcode)
     else if (_FP_stristr (localenv.ctenc, "quoted-printable") != NULL)
       result->uudet = QP_ENCODED;
     else if (_FP_stristr (localenv.ctenc, "7bit") != NULL ||
-	     _FP_stristr (localenv.ctenc, "8bit") != NULL)
+         _FP_stristr (localenv.ctenc, "8bit") != NULL)
       result->uudet = PT_ENCODED;
     else if (_FP_stristr (localenv.ctype, "multipart") != NULL ||
-	     _FP_stristr (localenv.ctype, "message")   != NULL)
+         _FP_stristr (localenv.ctype, "message")   != NULL)
       result->uudet = PT_ENCODED;
 
     /*
@@ -2156,145 +2156,145 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       lcount = 0;
       
       while (!feof (datei)) {
-	if (_FP_fgets (line, 255, datei) == NULL) {
-	  line[0] = '\0';
-	  break;
-	}
-	if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
-	line[255] = '\0';
-	if (line[0] == '-' && line[1] == '-' &&
-	    strncmp (line+2, sstate.envelope.boundary, blen) == 0)
-	  break;
-	/*
-	 * I've had a report of someone who tried to decode a huge file
-	 * that had an early truncated multipart message and later another
-	 * multipart message with the *same* boundary. Consequently, all
-	 * some hundred messages inbetween were ignored ...
-	 * This check here doesn't cover folded header lines, but we don't
-	 * want to slow down scanning too much. We just check for
-	 * Content-Type: multipart/... boundary="same-boundary"
-	 */
-	if (line[0] == 'C' && line[1] == 'o' &&
-	    _FP_strnicmp (line, "Content-Type:", 13) == 0) {
-	  ptr1 = ScanHeaderLine (datei, line);
-	  ptr2 = (ptr1)?_FP_stristr(ptr1,"boundary"):NULL;
-	  ptr1 = (ptr2)?ParseValue(ptr2):NULL;
-	  if (ptr1 && strcmp (ptr1, sstate.envelope.boundary) == 0)
-	    break;
-	  for (res=0; ptr1 && resstartpos, SEEK_SET);
+    /*
+     * Retry, but listening to headers this time
+     */
+    fseek (datei, result->startpos, SEEK_SET);
 
-	UUkillfread (result);
-	if ((result = (fileread *) malloc (sizeof (fileread))) == NULL) {
-	  *errcode = UURET_NOMEM;
-	  sstate.isfolder = 0;
-	  sstate.ismime   = 0;
-	  UUkillheaders (&localenv);
-	  return NULL;
-	}
-	memset (result, 0, sizeof (fileread));
+    UUkillfread (result);
+    if ((result = (fileread *) malloc (sizeof (fileread))) == NULL) {
+      *errcode = UURET_NOMEM;
+      sstate.isfolder = 0;
+      sstate.ismime   = 0;
+      UUkillheaders (&localenv);
+      return NULL;
+    }
+    memset (result, 0, sizeof (fileread));
 
-	if ((res = ScanData (datei, fname, errcode, NULL, 1, 1, result))==-1) {
-	  /* oops, something went wrong */
-	  sstate.isfolder = 0;
-	  sstate.ismime   = 0;
-	  UUkillfread   (result);
-	  UUkillheaders (&localenv);
-	  return NULL;
-	}
-	if (res == 1) {
-	  /*
-	   * new headers found
-	   */
-	  sstate.isfolder  = 1;
-	  sstate.ismime    = 0;
-	  sstate.mimestate = MS_HEADERS;
-	}
-	else {
-	  sstate.isfolder  = 0;
-	  sstate.ismime    = 0;
-	}
+    if ((res = ScanData (datei, fname, errcode, NULL, 1, 1, result))==-1) {
+      /* oops, something went wrong */
+      sstate.isfolder = 0;
+      sstate.ismime   = 0;
+      UUkillfread   (result);
+      UUkillheaders (&localenv);
+      return NULL;
+    }
+    if (res == 1) {
+      /*
+       * new headers found
+       */
+      sstate.isfolder  = 1;
+      sstate.ismime    = 0;
+      sstate.mimestate = MS_HEADERS;
+    }
+    else {
+      sstate.isfolder  = 0;
+      sstate.ismime    = 0;
+    }
       }
       /* produce result if uu_handletext is set */
       /* or if the file is explicitely named */
       if (result->uudet == B64ENCODED || lcount) {
-	if (localenv.fname) {
-	  _FP_free (result->filename);
-	  if ((result->filename = _FP_strdup (localenv.fname)) == NULL)
-	    *errcode = UURET_NOMEM;
-	}
-	else if ((result->uudet==QP_ENCODED||result->uudet==PT_ENCODED) &&
-		 result->filename == NULL && uu_handletext) {
-	  sprintf (line, "%04d.txt", ++mimseqno);
-	  if ((result->filename = _FP_strdup (line)) == NULL)
-	    *errcode = UURET_NOMEM;
-	}
-	result->subject  = _FP_strdup (localenv.subject);
-	result->origin   = _FP_strdup (localenv.from);
-	result->mimeid   = _FP_strdup (localenv.mimeid);
-	result->mimetype = _FP_strdup (localenv.ctype);
-	result->mode     = 0644;
-	result->sfname   = _FP_strdup (fname);
-	result->flags    = FL_SINGLE | FL_PROPER;
-	result->partno   = 1;
-	/* result->uudet determined above */
-	/* result->startpos set from above */
-	result->length   = prevpos - result->startpos;
+    if (localenv.fname) {
+      _FP_free (result->filename);
+      if ((result->filename = _FP_strdup (localenv.fname)) == NULL)
+        *errcode = UURET_NOMEM;
+    }
+    else if ((result->uudet==QP_ENCODED||result->uudet==PT_ENCODED) &&
+         result->filename == NULL && uu_handletext) {
+      sprintf (line, "%04d.txt", ++mimseqno);
+      if ((result->filename = _FP_strdup (line)) == NULL)
+        *errcode = UURET_NOMEM;
+    }
+    result->subject  = _FP_strdup (localenv.subject);
+    result->origin   = _FP_strdup (localenv.from);
+    result->mimeid   = _FP_strdup (localenv.mimeid);
+    result->mimetype = _FP_strdup (localenv.ctype);
+    result->mode     = 0644;
+    result->sfname   = _FP_strdup (fname);
+    result->flags    = FL_SINGLE | FL_PROPER;
+    result->partno   = 1;
+    /* result->uudet determined above */
+    /* result->startpos set from above */
+    result->length   = prevpos - result->startpos;
 
-	if ((localenv.subject != NULL && result->subject == NULL) ||
-	    result->filename == NULL  || result->sfname == NULL) {
-	  *errcode = UURET_NOMEM;
-	}
+    if ((localenv.subject != NULL && result->subject == NULL) ||
+        result->filename == NULL  || result->sfname == NULL) {
+      *errcode = UURET_NOMEM;
+    }
       }
       else {
-	/* don't produce a result */
-	_FP_free (result);
-	result = NULL;
+    /* don't produce a result */
+    _FP_free (result);
+    result = NULL;
       }
       if (*errcode == UURET_OK)
-	*errcode = UURET_CONT;
+    *errcode = UURET_CONT;
       /*
        * destroy local envelope
        */
@@ -2309,8 +2309,8 @@ ScanPart (FILE *datei, char *fname, int *errcode)
      */
 
     if ((res = ScanData (datei, fname, errcode,
-			 sstate.envelope.boundary,
-			 1, 0, result)) == -1) {
+             sstate.envelope.boundary,
+             1, 0, result)) == -1) {
       /* oops, something went wrong */
       sstate.isfolder = 0;
       sstate.ismime   = 0;
@@ -2326,21 +2326,21 @@ ScanPart (FILE *datei, char *fname, int *errcode)
 
     while (!feof (datei)) {
       if (_FP_fgets (line, 255, datei) == NULL) {
-	line[0] = '\0';
-	break;
+    line[0] = '\0';
+    break;
       }
       if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
       line[255] = '\0';
       if (line[0] == '-' && line[1] == '-' &&
-	  strncmp (line+2, sstate.envelope.boundary, blen) == 0)
-	break;
+      strncmp (line+2, sstate.envelope.boundary, blen) == 0)
+    break;
       if (line[0] == 'C' && line[1] == 'o' &&
-	  _FP_strnicmp (line, "Content-Type:", 13) == 0) {
-	ptr1 = ScanHeaderLine (datei, line);
-	ptr2 = (ptr1)?_FP_stristr(ptr1,"boundary"):NULL;
-	ptr1 = (ptr2)?ParseValue(ptr2):NULL;
-	if (ptr1 && strcmp (ptr1, sstate.envelope.boundary) == 0)
-	  break;
+      _FP_strnicmp (line, "Content-Type:", 13) == 0) {
+    ptr1 = ScanHeaderLine (datei, line);
+    ptr2 = (ptr1)?_FP_stristr(ptr1,"boundary"):NULL;
+    ptr1 = (ptr2)?ParseValue(ptr2):NULL;
+    if (ptr1 && strcmp (ptr1, sstate.envelope.boundary) == 0)
+      break;
       }
       prevpos = ftell (datei);
     }
@@ -2348,30 +2348,30 @@ ScanPart (FILE *datei, char *fname, int *errcode)
      * check if this was the last subpart
      */
     if (line[0] == '-' && line[1] == '-' &&
-	strncmp (line+2, sstate.envelope.boundary, blen) == 0) {
+    strncmp (line+2, sstate.envelope.boundary, blen) == 0) {
       ptr1 = line + 2 + blen;
       if (*ptr1 == '-' && *(ptr1+1) == '-')
-	sstate.mimestate = MS_EPILOGUE;
+    sstate.mimestate = MS_EPILOGUE;
       else
-	sstate.mimestate = MS_SUBPART;
+    sstate.mimestate = MS_SUBPART;
     }
     else {
       UUMessage (uuscan_id, __LINE__, UUMSG_WARNING,
-		 uustring (S_MIME_B_NOT_FOUND));
+         uustring (S_MIME_B_NOT_FOUND));
       
       while (mssdepth) {
-	mssdepth--;
-	UUkillheaders (&(multistack[mssdepth].envelope));
-	_FP_free (multistack[mssdepth].source);
+    mssdepth--;
+    UUkillheaders (&(multistack[mssdepth].envelope));
+    _FP_free (multistack[mssdepth].source);
       }
 
       if (uu_fast_scanning) {
-	UUkillheaders (&localenv);
-	sstate.isfolder  = 0;
-	sstate.ismime    = 0;
-	sstate.mimestate = MS_BODY;
-	_FP_free (result);
-	return NULL;
+    UUkillheaders (&localenv);
+    sstate.isfolder  = 0;
+    sstate.ismime    = 0;
+    sstate.mimestate = MS_BODY;
+    _FP_free (result);
+    return NULL;
       }
 
       /*
@@ -2381,33 +2381,33 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       
       UUkillfread (result);
       if ((result = (fileread *) malloc (sizeof (fileread))) == NULL) {
-	*errcode = UURET_NOMEM;
-	sstate.isfolder = 0;
-	sstate.ismime   = 0;
-	UUkillheaders (&localenv);
-	return NULL;
+    *errcode = UURET_NOMEM;
+    sstate.isfolder = 0;
+    sstate.ismime   = 0;
+    UUkillheaders (&localenv);
+    return NULL;
       }
       memset (result, 0, sizeof (fileread));
 
       if ((res = ScanData (datei, fname, errcode, NULL, 1, 1, result))==-1) {
-	/* oops, something went wrong */
-	sstate.isfolder = 0;
-	sstate.ismime   = 0;
-	UUkillfread   (result);
-	UUkillheaders (&localenv);
-	return NULL;
+    /* oops, something went wrong */
+    sstate.isfolder = 0;
+    sstate.ismime   = 0;
+    UUkillfread   (result);
+    UUkillheaders (&localenv);
+    return NULL;
       }
       if (res == 1) {
-	/*
-	 * new headers found
-	 */
-	sstate.isfolder  = 1;
-	sstate.ismime    = 0;
-	sstate.mimestate = MS_HEADERS;
+    /*
+     * new headers found
+     */
+    sstate.isfolder  = 1;
+    sstate.ismime    = 0;
+    sstate.mimestate = MS_HEADERS;
       }
       else {
-	sstate.isfolder  = 0;
-	sstate.ismime    = 0;
+    sstate.isfolder  = 0;
+    sstate.ismime    = 0;
       }
     }
 
@@ -2418,11 +2418,11 @@ ScanPart (FILE *datei, char *fname, int *errcode)
      */
 
     if (strcmp (localenv.mimevers, "1.0") == 0 &&
-	_FP_stristr (localenv.ctype, "text") != NULL &&
-	sstate.ismime && sstate.mimestate == MS_SUBPART &&
-	!uu_desperate) {
+    _FP_stristr (localenv.ctype, "text") != NULL &&
+    sstate.ismime && sstate.mimestate == MS_SUBPART &&
+    !uu_desperate) {
       if (result->uudet == UU_ENCODED && !(result->begin || result->end)) {
-	result->uudet = 0;
+    result->uudet = 0;
       }
     }
 
@@ -2437,13 +2437,13 @@ ScanPart (FILE *datei, char *fname, int *errcode)
     if (localenv.fname) {
       _FP_free (result->filename);
       if ((result->filename = _FP_strdup (localenv.fname)) == NULL)
-	*errcode = UURET_NOMEM;
+    *errcode = UURET_NOMEM;
     }
     else if ((result->uudet==QP_ENCODED || result->uudet==PT_ENCODED) &&
-	     result->filename==NULL && uu_handletext) {
+         result->filename==NULL && uu_handletext) {
       sprintf (line, "%04d.txt", ++mimseqno);
       if ((result->filename = _FP_strdup (line)) == NULL)
-	*errcode = UURET_NOMEM;
+    *errcode = UURET_NOMEM;
     }
     else {
       /* assign a filename lateron */
@@ -2451,10 +2451,10 @@ ScanPart (FILE *datei, char *fname, int *errcode)
     if (result->mimetype) _FP_free (result->mimetype);
     if (result->uudet) {
       if (_FP_stristr (localenv.ctype, "text") != NULL &&
-	  result->uudet != QP_ENCODED && result->uudet != PT_ENCODED)
-	result->mimetype = NULL; /* better don't set it */
+      result->uudet != QP_ENCODED && result->uudet != PT_ENCODED)
+    result->mimetype = NULL; /* better don't set it */
       else
-	result->mimetype = _FP_strdup (localenv.ctype);
+    result->mimetype = _FP_strdup (localenv.ctype);
     }
     if (result->origin) _FP_free  (result->origin);
     result->origin  = _FP_strdup  (localenv.from);
@@ -2464,7 +2464,7 @@ ScanPart (FILE *datei, char *fname, int *errcode)
 
     if (result->sfname == NULL)
       if ((result->sfname = _FP_strdup (fname)) == NULL)
-	*errcode = UURET_NOMEM;
+    *errcode = UURET_NOMEM;
 
     result->length = prevpos - result->startpos;
     result->flags  = FL_SINGLE | FL_PROPER;
@@ -2508,13 +2508,13 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       /* skip over blank lines first */
       prevpos = ftell (datei);
       while (!feof (datei)) {
-	if (_FP_fgets (line, 255, datei) == NULL)
-	  break;
-	line[255] = '\0';
-	if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
-	if (!IsLineEmpty (line))
-	  break;
-	prevpos = ftell (datei);
+    if (_FP_fgets (line, 255, datei) == NULL)
+      break;
+    line[255] = '\0';
+    if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
+    if (!IsLineEmpty (line))
+      break;
+    prevpos = ftell (datei);
       }
       /* Next, read header. But what if there is no subheader? */
       hcount = 0;
@@ -2522,21 +2522,21 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       preheaders = prevpos;
 
       while (!feof (datei) && !IsLineEmpty (line)) {
-	if (IsKnownHeader (line))
-	  hcount++;
-	if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
-	if (lcount > WAITHEADER && hcount == 0) {
-	  fseek (datei, preheaders, SEEK_SET);
-	  break;
-	}
-	ptr1 = ScanHeaderLine (datei, line);
-	if (ParseHeader (&localenv, ptr1) == NULL)
-	  *errcode = UURET_NOMEM;
+    if (IsKnownHeader (line))
+      hcount++;
+    if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
+    if (lcount > WAITHEADER && hcount == 0) {
+      fseek (datei, preheaders, SEEK_SET);
+      break;
+    }
+    ptr1 = ScanHeaderLine (datei, line);
+    if (ParseHeader (&localenv, ptr1) == NULL)
+      *errcode = UURET_NOMEM;
 
-	if (_FP_fgets (line, 255, datei) == NULL)
-	  break;
-	line[255] = '\0';
-	lcount++;
+    if (_FP_fgets (line, 255, datei) == NULL)
+      break;
+    line[255] = '\0';
+    lcount++;
       }
       prevpos = ftell (datei);
       /*
@@ -2544,49 +2544,49 @@ ScanPart (FILE *datei, char *fname, int *errcode)
        * and the Content-Transfer-Encoding.
        */
       if (_FP_stristr (localenv.ctype, "multipart") != NULL) {
-	UUMessage (uuscan_id, __LINE__, UUMSG_WARNING,
-		   uustring (S_MIME_PART_MULTI));
+    UUMessage (uuscan_id, __LINE__, UUMSG_WARNING,
+           uustring (S_MIME_PART_MULTI));
       }
       if (localenv.subject)
-	result->subject  = _FP_strdup (localenv.subject);
+    result->subject  = _FP_strdup (localenv.subject);
       else
-	result->subject  = _FP_strdup (sstate.envelope.subject);
+    result->subject  = _FP_strdup (sstate.envelope.subject);
 
       if (localenv.from)
-	result->origin   = _FP_strdup (localenv.from);
+    result->origin   = _FP_strdup (localenv.from);
       else
-	result->origin   = _FP_strdup (sstate.envelope.from);
+    result->origin   = _FP_strdup (sstate.envelope.from);
 
       if (localenv.ctype)
-	result->mimetype = _FP_strdup (localenv.ctype);
+    result->mimetype = _FP_strdup (localenv.ctype);
       else
-	result->mimetype = _FP_strdup ("text/plain");
+    result->mimetype = _FP_strdup ("text/plain");
 
       if (_FP_stristr (localenv.ctenc, "quoted-printable") != NULL)
-	result->uudet = QP_ENCODED;
+    result->uudet = QP_ENCODED;
       else if (_FP_stristr (localenv.ctenc, "base64") != NULL)
-	result->uudet = B64ENCODED;
+    result->uudet = B64ENCODED;
       else if (_FP_stristr (localenv.ctenc, "x-uue") != NULL) {
-	result->uudet = UU_ENCODED;
-	result->begin = result->end = 1;
+    result->uudet = UU_ENCODED;
+    result->begin = result->end = 1;
       }
       else if (_FP_stristr (localenv.ctenc, "x-yenc") != NULL) {
-	result->uudet = YENC_ENCODED;
-	result->begin = result->end = 1;
+    result->uudet = YENC_ENCODED;
+    result->begin = result->end = 1;
       }
       else if (_FP_stristr (localenv.ctenc, "7bit") != NULL ||
-	       _FP_stristr (localenv.ctenc, "8bit") != NULL)
-	result->uudet = PT_ENCODED;
+           _FP_stristr (localenv.ctenc, "8bit") != NULL)
+    result->uudet = PT_ENCODED;
       else if (_FP_stristr (localenv.ctype, "multipart") != NULL ||
-	       _FP_stristr (localenv.ctype, "message")   != NULL)
-	result->uudet = PT_ENCODED;
+           _FP_stristr (localenv.ctype, "message")   != NULL)
+    result->uudet = PT_ENCODED;
 
       /*
        * If we're switched to MIME-only mode, handle as text
        */
 
       if (uu_more_mime >= 2 && !result->uudet) {
-	result->uudet = PT_ENCODED;
+    result->uudet = PT_ENCODED;
       }
     }
     else {
@@ -2616,34 +2616,34 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       prevpos = ftell (datei);
 
       if (_FP_stristr (localenv.ctype, "message") != NULL &&
-	  _FP_stristr (localenv.ctype, "rfc822")  != NULL) {
-	/*
-	 * skip over empty lines and local header
-	 */
-	preheaders = ftell (datei);
-	while (!feof (datei)) {
-	  if (_FP_fgets (line, 255, datei) == NULL)
-	    break;
-	  line[255] = '\0';
-	  if (!IsLineEmpty (line)) {
-	    break;
-	  }
-	}
+      _FP_stristr (localenv.ctype, "rfc822")  != NULL) {
+    /*
+     * skip over empty lines and local header
+     */
+    preheaders = ftell (datei);
+    while (!feof (datei)) {
+      if (_FP_fgets (line, 255, datei) == NULL)
+        break;
+      line[255] = '\0';
+      if (!IsLineEmpty (line)) {
+        break;
+      }
+    }
 
-	while (!feof (datei) && !IsLineEmpty (line)) { 
-	  if (IsKnownHeader (line))
-	    hcount++;
-	  lcount++;
-	  if (lcount > WAITHEADER && hcount < hlcount.afternl)
-	    break;
+    while (!feof (datei) && !IsLineEmpty (line)) { 
+      if (IsKnownHeader (line))
+        hcount++;
+      lcount++;
+      if (lcount > WAITHEADER && hcount < hlcount.afternl)
+        break;
 
-	  if (_FP_fgets (line, 255, datei) == NULL)
-	    break;
-	  line[255] = '\0';
-	}
-	if (hcount < hlcount.afternl)
-	  fseek (datei, preheaders, SEEK_SET);
-	hcount = lcount = 0;
+      if (_FP_fgets (line, 255, datei) == NULL)
+        break;
+      line[255] = '\0';
+    }
+    if (hcount < hlcount.afternl)
+      fseek (datei, preheaders, SEEK_SET);
+    hcount = lcount = 0;
       }
 
       /*
@@ -2651,39 +2651,39 @@ ScanPart (FILE *datei, char *fname, int *errcode)
        */
 
       while (!feof (datei)) {
-	if (_FP_fgets (line, 255, datei) == NULL)
-	  break;
-	if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
-	if (ferror (datei))
-	  break;
-	line[255] = '\0';
+    if (_FP_fgets (line, 255, datei) == NULL)
+      break;
+    if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
+    if (ferror (datei))
+      break;
+    line[255] = '\0';
 
-	if ((vflag = IsKnownHeader (line))) {
-	  (void) ScanHeaderLine (datei, line);
+    if ((vflag = IsKnownHeader (line))) {
+      (void) ScanHeaderLine (datei, line);
 
-	  if (result->uudet != PT_ENCODED || vflag == 1) {
-	    if (hcount == 0)
-	      preheaders = prevpos;
-	    hcount++;
-	    lcount++;
-	    if (hcount >= hlcount.restart) {
-	      /*
-	       * Hey, a new header starts here
-	       */
-	      fseek (datei, preheaders, SEEK_SET);
-	      prevpos = preheaders;
-	      break;
-	    }
-	  }
-	}
-	else if (lcount > WAITHEADER) {
-	  hcount = 0;
-	  lcount = 0;
-	}
-	else if (hcount) {
-	  lcount++;
-	}
-	prevpos = ftell (datei);
+      if (result->uudet != PT_ENCODED || vflag == 1) {
+        if (hcount == 0)
+          preheaders = prevpos;
+        hcount++;
+        lcount++;
+        if (hcount >= hlcount.restart) {
+          /*
+           * Hey, a new header starts here
+           */
+          fseek (datei, preheaders, SEEK_SET);
+          prevpos = preheaders;
+          break;
+        }
+      }
+    }
+    else if (lcount > WAITHEADER) {
+      hcount = 0;
+      lcount = 0;
+    }
+    else if (hcount) {
+      lcount++;
+    }
+    prevpos = ftell (datei);
       }
       res = 1;
     }
@@ -2693,15 +2693,15 @@ ScanPart (FILE *datei, char *fname, int *errcode)
        * boundary (NULL) but MIME, and respect new headers.
        */
       if ((res = ScanData (datei, fname, errcode, NULL, 1, 1, result)) == -1) {
-	/* oops, something went wrong */
-	sstate.isfolder = 0;
-	sstate.ismime   = 0;
-	UUkillfread   (result);
-	UUkillheaders (&localenv);
-	return NULL;
+    /* oops, something went wrong */
+    sstate.isfolder = 0;
+    sstate.ismime   = 0;
+    UUkillfread   (result);
+    UUkillheaders (&localenv);
+    return NULL;
       }
       if (result->uudet == 0 && uu_handletext)
-	result->uudet = PT_ENCODED;
+    result->uudet = PT_ENCODED;
 
       prevpos = ftell (datei);
     }
@@ -2711,31 +2711,31 @@ ScanPart (FILE *datei, char *fname, int *errcode)
     if (localenv.fname) {
       _FP_free (result->filename);
       if ((result->filename = _FP_strdup (localenv.fname)) == NULL)
-	*errcode = UURET_NOMEM;
+    *errcode = UURET_NOMEM;
     }
     else if (sstate.envelope.fname) {
       _FP_free (result->filename);
       if ((result->filename = _FP_strdup (sstate.envelope.fname)) == NULL)
-	*errcode = UURET_NOMEM;
+    *errcode = UURET_NOMEM;
     }
     else if ((result->uudet==QP_ENCODED || result->uudet==PT_ENCODED) &&
-	     result->filename == NULL) {
+         result->filename == NULL) {
       sprintf (line, "%04d.txt", ++mimseqno);
       if ((result->filename = _FP_strdup (line)) == NULL)
-	*errcode = UURET_NOMEM;
+    *errcode = UURET_NOMEM;
     }
     else {
       /* assign a filename lateron */
     }
     if (result->subject == NULL) {
       if (sstate.envelope.subject)
-	result->subject = _FP_strdup (sstate.envelope.subject);
+    result->subject = _FP_strdup (sstate.envelope.subject);
     }
     result->partno = sstate.envelope.partno;
     result->maxpno = sstate.envelope.numparts;
     result->flags  = FL_PARTIAL | 
       ((res==1 || uu_fast_scanning) ? FL_PROPER : 0) |
-	((uu_fast_scanning) ? FL_TOEND : 0);
+    ((uu_fast_scanning) ? FL_TOEND : 0);
     result->mimeid = _FP_strdup (sstate.envelope.mimeid);
     if (result->partno == 1)
       result->begin = 1;
@@ -2819,11 +2819,11 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       result->uudet = YENC_ENCODED;
     }
     else if (_FP_stristr (sstate.envelope.ctenc, "7bit") != NULL ||
-	     _FP_stristr (sstate.envelope.ctenc, "8bit") != NULL)
+         _FP_stristr (sstate.envelope.ctenc, "8bit") != NULL)
       result->uudet = PT_ENCODED;
     else if (_FP_stristr (sstate.envelope.ctype, "multipart") != NULL ||
-	     _FP_stristr (sstate.envelope.ctype, "message")   != NULL ||
-	     sstate.envelope.fname != NULL)
+         _FP_stristr (sstate.envelope.ctype, "message")   != NULL ||
+         sstate.envelope.fname != NULL)
       result->uudet = PT_ENCODED;
 
     /*
@@ -2852,34 +2852,34 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       prevpos = ftell (datei);
 
       if (_FP_stristr (sstate.envelope.ctype, "message") != NULL &&
-	  _FP_stristr (sstate.envelope.ctype, "rfc822")  != NULL) {
-	/*
-	 * skip over empty lines and local header
-	 */
-	preheaders = ftell (datei);
-	while (!feof (datei)) {
-	  if (_FP_fgets (line, 255, datei) == NULL)
-	    break;
-	  line[255] = '\0';
-	  if (!IsLineEmpty (line)) {
-	    break;
-	  }
-	}
+      _FP_stristr (sstate.envelope.ctype, "rfc822")  != NULL) {
+    /*
+     * skip over empty lines and local header
+     */
+    preheaders = ftell (datei);
+    while (!feof (datei)) {
+      if (_FP_fgets (line, 255, datei) == NULL)
+        break;
+      line[255] = '\0';
+      if (!IsLineEmpty (line)) {
+        break;
+      }
+    }
 
-	while (!feof (datei) && !IsLineEmpty (line)) { 
-	  if (IsKnownHeader (line))
-	    hcount++;
-	  lcount++;
-	  if (lcount > WAITHEADER && hcount < hlcount.afternl)
-	    break;
+    while (!feof (datei) && !IsLineEmpty (line)) { 
+      if (IsKnownHeader (line))
+        hcount++;
+      lcount++;
+      if (lcount > WAITHEADER && hcount < hlcount.afternl)
+        break;
 
-	  if (_FP_fgets (line, 255, datei) == NULL)
-	    break;
-	  line[255] = '\0';
-	}
-	if (hcount < hlcount.afternl)
-	  fseek (datei, preheaders, SEEK_SET);
-	hcount = lcount = 0;
+      if (_FP_fgets (line, 255, datei) == NULL)
+        break;
+      line[255] = '\0';
+    }
+    if (hcount < hlcount.afternl)
+      fseek (datei, preheaders, SEEK_SET);
+    hcount = lcount = 0;
       }
 
       /*
@@ -2887,36 +2887,36 @@ ScanPart (FILE *datei, char *fname, int *errcode)
        */
 
       while (!feof (datei)) {
-	if (_FP_fgets (line, 255, datei) == NULL)
-	  break;
-	if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
-	if (ferror (datei))
-	  break;
-	line[255] = '\0';
+    if (_FP_fgets (line, 255, datei) == NULL)
+      break;
+    if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
+    if (ferror (datei))
+      break;
+    line[255] = '\0';
 
-	if (IsKnownHeader (line)) {
-	  (void) ScanHeaderLine (datei, line);
-	  if (hcount == 0)
-	    preheaders = prevpos;
-	  hcount++;
-	  lcount++;
-	  if (hcount >= hlcount.restart) {
-	    /*
-	     * Hey, a new header starts here
-	     */
-	    fseek (datei, preheaders, SEEK_SET);
-	    prevpos = preheaders;
-	    break;
-	  }
-	}
-	else if (lcount > WAITHEADER) {
-	  hcount = 0;
-	  lcount = 0;
-	}
-	else if (hcount) {
-	  lcount++;
-	}
-	prevpos = ftell (datei);
+    if (IsKnownHeader (line)) {
+      (void) ScanHeaderLine (datei, line);
+      if (hcount == 0)
+        preheaders = prevpos;
+      hcount++;
+      lcount++;
+      if (hcount >= hlcount.restart) {
+        /*
+         * Hey, a new header starts here
+         */
+        fseek (datei, preheaders, SEEK_SET);
+        prevpos = preheaders;
+        break;
+      }
+    }
+    else if (lcount > WAITHEADER) {
+      hcount = 0;
+      lcount = 0;
+    }
+    else if (hcount) {
+      lcount++;
+    }
+    prevpos = ftell (datei);
       }
       res = 1;
     }
@@ -2926,15 +2926,15 @@ ScanPart (FILE *datei, char *fname, int *errcode)
        * boundary (NULL) but MIME, and respect new headers.
        */
       if ((res = ScanData (datei, fname, errcode, NULL, 1, 1, result)) == -1) {
-	/* oops, something went wrong */
-	sstate.isfolder = 0;
-	sstate.ismime   = 0;
-	UUkillfread   (result);
-	return NULL;
+    /* oops, something went wrong */
+    sstate.isfolder = 0;
+    sstate.ismime   = 0;
+    UUkillfread   (result);
+    return NULL;
       }
       if (result->uudet == 0 && uu_handletext) {
-	result->startpos = before;	/* display headers */
-	result->uudet = PT_ENCODED;
+    result->startpos = before;  /* display headers */
+    result->uudet = PT_ENCODED;
       }
 
       prevpos = ftell (datei);
@@ -2945,20 +2945,20 @@ ScanPart (FILE *datei, char *fname, int *errcode)
     if (sstate.envelope.fname) {
       _FP_free (result->filename);
       if ((result->filename = _FP_strdup (sstate.envelope.fname)) == NULL)
-	*errcode = UURET_NOMEM;
+    *errcode = UURET_NOMEM;
     }
     else if ((result->uudet==QP_ENCODED||result->uudet==PT_ENCODED) &&
-	     result->filename == NULL) {
+         result->filename == NULL) {
       sprintf (line, "%04d.txt", ++mimseqno);
       if ((result->filename = _FP_strdup (line)) == NULL)
-	*errcode = UURET_NOMEM;
+    *errcode = UURET_NOMEM;
     }
     else {
       /* assign a filename lateron */
     }
     if (result->subject == NULL) {
       if (sstate.envelope.subject)
-	result->subject = _FP_strdup (sstate.envelope.subject);
+    result->subject = _FP_strdup (sstate.envelope.subject);
     }
     result->flags  = ((res==1||uu_fast_scanning)?FL_PROPER:0) |
       ((uu_fast_scanning) ? FL_TOEND : 0);
@@ -3019,44 +3019,44 @@ ScanPart (FILE *datei, char *fname, int *errcode)
     prevpos = ftell (datei);
     while (!feof (datei)) {
       if (_FP_fgets (line, 255, datei) == NULL) {
-	line[0] = '\0';
-	break;
+    line[0] = '\0';
+    break;
       }
       if (UUBUSYPOLL(ftell(datei),progress.fsize)) SPCANCEL();
       if (!IsLineEmpty (line))
-	break;
+    break;
     }
     if (line[0] == '-' && line[1] == '-' &&
-	!IsLineEmpty (line+2) && !feof (datei)) {
+    !IsLineEmpty (line+2) && !feof (datei)) {
       ptr1 = _FP_strrstr (line+2, "--");
       ptr2 = ScanHeaderLine (datei, NULL);
       if ((ptr1 == NULL || (*(ptr1+2) != '\012' && *(ptr1+2) != '\015')) &&
-	  ptr2 && _FP_strnicmp (ptr2, "Content-", 8) == 0) {
-	/*
-	 * hmm, okay, let's do it!
-	 */
-	sstate.isfolder  = 1;
-	sstate.ismime    = 1;
-	sstate.mimestate = MS_PREAMBLE;
-	/*
-	 * get boundary
-	 */
-	ptr1 = line+2;
-	while (*ptr1 && !isspace(*ptr1))
-	  ptr1++;
-	*ptr1 = '\0';
+      ptr2 && _FP_strnicmp (ptr2, "Content-", 8) == 0) {
+    /*
+     * hmm, okay, let's do it!
+     */
+    sstate.isfolder  = 1;
+    sstate.ismime    = 1;
+    sstate.mimestate = MS_PREAMBLE;
+    /*
+     * get boundary
+     */
+    ptr1 = line+2;
+    while (*ptr1 && !isspace(*ptr1))
+      ptr1++;
+    *ptr1 = '\0';
 
-	sstate.envelope.mimevers = _FP_strdup ("1.0");
-	sstate.envelope.boundary = _FP_strdup (line+2);
-	
-	/*
-	 * need restart
-	 */
-	
-	fseek (datei, prevpos, SEEK_SET);
-	
-	_FP_free (result);
-	return NULL;
+    sstate.envelope.mimevers = _FP_strdup ("1.0");
+    sstate.envelope.boundary = _FP_strdup (line+2);
+    
+    /*
+     * need restart
+     */
+    
+    fseek (datei, prevpos, SEEK_SET);
+    
+    _FP_free (result);
+    return NULL;
       }
     }
     fseek (datei, prevpos, SEEK_SET);
@@ -3077,7 +3077,7 @@ ScanPart (FILE *datei, char *fname, int *errcode)
     result->mimetype = _FP_strdup (sstate.envelope.ctype);
   
   if ((res=ScanData (datei, fname, errcode, NULL, 
-		     sstate.ismime, 1, result))==-1) {
+             sstate.ismime, 1, result))==-1) {
     /* oops, something went wrong */
     sstate.isfolder = 0;
     sstate.ismime   = 0;
@@ -3090,7 +3090,7 @@ ScanPart (FILE *datei, char *fname, int *errcode)
    */
 
   if (result->uudet == 0 && uu_handletext) {
-    result->startpos = before;	/* display headers */
+    result->startpos = before;  /* display headers */
     result->uudet  = PT_ENCODED;
     result->partno = 1;
   }
@@ -3106,7 +3106,7 @@ ScanPart (FILE *datei, char *fname, int *errcode)
       *errcode = UURET_NOMEM;
   }
   else if ((result->uudet==QP_ENCODED||result->uudet==PT_ENCODED) &&
-	   result->filename == NULL) {
+       result->filename == NULL) {
     sprintf (line, "%04d.txt", ++mimseqno);
     if ((result->filename = _FP_strdup (line)) == NULL)
       *errcode = UURET_NOMEM;
diff --git a/goldlib/uulib/uustring.c b/goldlib/uulib/uustring.c
index 38b6c20..691ba45 100644
--- a/goldlib/uulib/uustring.c
+++ b/goldlib/uulib/uustring.c
@@ -124,7 +124,7 @@ char *uuretcodes[] = {
   "Unexpected End of File",
   "Unsupported function",
   "File exists",
-  "Continue -- no error",	/* only to be seen internally */
+  "Continue -- no error",   /* only to be seen internally */
   "Operation Canceled"
 };
 
@@ -162,8 +162,8 @@ uustring (int codeno)
   }
 
   UUMessage (uustring_id, __LINE__, UUMSG_ERROR,
-	     "Could not retrieve string no %d",
-	     codeno);
+         "Could not retrieve string no %d",
+         codeno);
 
   return faileddef;
 }
diff --git a/goldlib/uulib/uuutil.c b/goldlib/uulib/uuutil.c
index 20f2b52..4e4be13 100644
--- a/goldlib/uulib/uuutil.c
+++ b/goldlib/uulib/uuutil.c
@@ -76,8 +76,8 @@ static char *knownexts[] = {
  * forward declarations of local functions
  */
 
-static int	UUSMPKnownExt		_ANSI_ARGS_((char *filename));
-static uulist *	UU_smparts_r		_ANSI_ARGS_((uulist *, int));
+static int  UUSMPKnownExt       _ANSI_ARGS_((char *filename));
+static uulist * UU_smparts_r        _ANSI_ARGS_((uulist *, int));
 
 /*
  * mallocable areas
@@ -129,9 +129,9 @@ UUkilllist (uulist *data)
   while (data) {
     if (data->binfile != NULL)
       if (unlink (data->binfile))
-	UUMessage (uuutil_id, __LINE__, UUMSG_WARNING,
-		   uustring (S_TMP_NOT_REMOVED),
-		   data->binfile, strerror (errno));
+    UUMessage (uuutil_id, __LINE__, UUMSG_WARNING,
+           uustring (S_TMP_NOT_REMOVED),
+           data->binfile, strerror (errno));
 
     _FP_free   (data->filename);
     _FP_free   (data->subfname);
@@ -219,7 +219,7 @@ UUSMPKnownExt (char *filename)
 
 int
 UUbhdecomp (char *in, char *out, char *last, int *rpc, 
-	    size_t inc, size_t max, size_t *opc)
+        size_t inc, size_t max, size_t *opc)
 {
   size_t count, used=0, dummy;
   char marker = '\220' /* '\x90' */;
@@ -257,18 +257,18 @@ UUbhdecomp (char *in, char *out, char *last, int *rpc,
     if (*in == marker) {
       used++; in++;
       if (used == inc) {
-	*rpc = -256;
-	return used;
+    *rpc = -256;
+    return used;
       }
       *rpc = (int) (unsigned char) *in++; used++;
 
       if (*rpc == 0) {
-	*last = *out++ = marker;
-	max--; *opc+=1;
-	continue;
+    *last = *out++ = marker;
+    max--; *opc+=1;
+    continue;
       }
       else
-	*rpc -= 1;
+    *rpc -= 1;
 
       count = (max > (size_t) *rpc) ? (size_t) *rpc : max;
       memset (out, *last, count);
@@ -307,7 +307,7 @@ UUbhwrite (char *ptr, size_t sel, size_t nel, FILE *file)
 
   while (nel || (rpc != 0 && rpc != -256)) {
     count = UUbhdecomp (ptr, tmpstring, &lc, &rpc,
-			nel, 256, &opc);
+            nel, 256, &opc);
     if (fwrite (tmpstring, 1, opc, file) != opc)
       return 0;
     if (ferror (file))
@@ -337,7 +337,7 @@ UU_smparts_r (uulist *addit, int pass)
       continue;
     }
     if ((iter->begin && addit->begin) || (iter->end && addit->end) ||
-	(iter->uudet != addit->uudet)) {
+    (iter->uudet != addit->uudet)) {
       iter = iter->NEXT;
       continue;
     }
@@ -355,8 +355,8 @@ UU_smparts_r (uulist *addit, int pass)
 
     while (temp) {
       if (!(temp->data->uudet)) {
-	temp = temp->NEXT;
-	continue;
+    temp = temp->NEXT;
+    continue;
       }
 
       while (fiter && fiter->partno < temp->partno) {
@@ -368,7 +368,7 @@ UU_smparts_r (uulist *addit, int pass)
         break;
       }
       else {
-	flag   = 1;
+    flag   = 1;
         count += ((dest)  ? temp->partno - dest->partno - 1 : 0) +
                  ((fiter) ? fiter->partno - temp->partno - 1 : 0);
       }
@@ -398,33 +398,33 @@ UU_smparts_r (uulist *addit, int pass)
       flag = 0;
 
       if (fiter->partno == iter->thisfile->partno ||
-	  (dest->NEXT != NULL && fiter->partno == dest->NEXT->partno)) {
-	temp           = fiter->NEXT;
-	fiter->NEXT    = NULL;
+      (dest->NEXT != NULL && fiter->partno == dest->NEXT->partno)) {
+    temp           = fiter->NEXT;
+    fiter->NEXT    = NULL;
 
-	UUkillfile (fiter);
+    UUkillfile (fiter);
 
-	addit->thisfile= temp;
-	fiter          = temp;
-	continue;
+    addit->thisfile= temp;
+    fiter          = temp;
+    continue;
       }
       if (fiter->partno < iter->thisfile->partno) {
-	temp           = fiter->NEXT;
-	fiter->NEXT    = iter->thisfile;
-	iter->thisfile = fiter;
-	dest           = fiter;
-	addit->thisfile= temp;
-	fiter          = temp;
+    temp           = fiter->NEXT;
+    fiter->NEXT    = iter->thisfile;
+    iter->thisfile = fiter;
+    dest           = fiter;
+    addit->thisfile= temp;
+    fiter          = temp;
       }
       else if (dest->NEXT == NULL || fiter->partno < dest->NEXT->partno) {
-	temp           = fiter->NEXT;
-	fiter->NEXT    = dest->NEXT;
-	dest->NEXT     = fiter;
-	addit->thisfile= temp;
-	fiter          = temp;
+    temp           = fiter->NEXT;
+    fiter->NEXT    = dest->NEXT;
+    dest->NEXT     = fiter;
+    addit->thisfile= temp;
+    fiter          = temp;
       }
       else {
-	dest = dest->NEXT;
+    dest = dest->NEXT;
       }
     }
     break;
@@ -446,9 +446,9 @@ UUSmerge (int pass)
     }
     if ((res = UU_smparts_r (iter, pass)) != NULL) {
       UUMessage (uuutil_id, __LINE__, UUMSG_MESSAGE,
-		 uustring (S_SMERGE_MERGED),
-		 (iter->subfname) ? iter->subfname : "",
-		 (res->subfname)  ? res->subfname  : "", pass);
+         uustring (S_SMERGE_MERGED),
+         (iter->subfname) ? iter->subfname : "",
+         (res->subfname)  ? res->subfname  : "", pass);
  
       temp       = iter->NEXT;
       iter->NEXT = NULL;
@@ -457,12 +457,12 @@ UUSmerge (int pass)
       flag++;
 
       if (last == NULL) {
-	UUGlobalFileList = temp;
-	iter             = temp;
+    UUGlobalFileList = temp;
+    iter             = temp;
       }
       else {
-	last->NEXT       = temp;
-	iter             = temp;
+    last->NEXT       = temp;
+    iter             = temp;
       }
 
       continue;