NN 6.3 - Official patch #2 (part 02/02)

Kim F. Storm storm at texas.dk
Thu Jun 29 05:36:17 AEST 1989


This is the second and last part of patch #2 for nn 6.3.

Unpack with :unshar after unpacking the first part.

++Kim Storm

---- Cut Here and unpack ----
#!/bin/sh
# this is part 2 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file PATCH.2 continued
#
CurArch=2
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file PATCH.2"
sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' >> PATCH.2
X  		last = strrchr(sub, '-');
X  		if (last == NULL) last = strrchr(sub, ',');
X  		if (last == NULL) last = strrchr(sub, ' ');
X--- 570,577 -----
X  	    /* Notice: unread articles before the last read article are lost */
X  	    
X  	    if (subscr) {
X+ 		if (*sub == NL) continue; /* new group */
X+ 	    
X  		last = strrchr(sub, '-');
X  		if (last == NULL) last = strrchr(sub, ',');
X  		if (last == NULL) last = strrchr(sub, ' ');
X
X*** /usr/storm/nn6.3.0/s-template.h
X--- s-template.h
X**************
X*** 128,133
X  #define SHELL		"/bin/sh"
X  
X  /*
X   *	Specify the default mailer to be invoked by nnmail
X   */
X  
X--- 128,142 -----
X  #define SHELL		"/bin/sh"
X  
X  /*
X+  *	Define AVOID_SHELL_EXEC if the system gets confused by
X+  *		#!/bin/sh
X+  *	lines in shell scripts, e.g. only reads #! and thinks it
X+  *	is a csh script.
X+  */
X+ 
X+ /* #define AVOID_SHELL_EXEC		/* */
X+ 
X+ /*
X   *	Specify the default mailer to be invoked by nnmail
X   */
X  
X
X*** /usr/storm/nn6.3.0/save.c
X--- save.c
X**************
X*** 44,49
X  #define	IS_PIPE		0x1000	/* output is on pipe */
X  #define	DO_UNSHAR	0x2000	/* unshar article (or patch) */
X  #define	DO_PATCH	0x4000	/* patch article */
X  
X  /* open modes for open_news_article for the various HEADER_HANDLINGs */
X  
X--- 44,50 -----
X  #define	IS_PIPE		0x1000	/* output is on pipe */
X  #define	DO_UNSHAR	0x2000	/* unshar article (or patch) */
X  #define	DO_PATCH	0x4000	/* patch article */
X+ #define	DO_DECODE	0x8000	/* uudecode article */
X  
X  /* open modes for open_news_article for the various HEADER_HANDLINGs */
X  
X**************
X*** 144,149
X  	}
X  	break;
X  
X       case K_PATCH:
X  	save_mode = NO_HEADER | SEPARATE_FILES | DO_UNSHAR | DO_PATCH;
X  	mode_text = "Patch";
X--- 145,155 -----
X  	}
X  	break;
X  
X+      case K_UUDECODE:
X+ 	save_mode = NO_HEADER | DO_UNSHAR | DO_DECODE;
X+ 	mode_text = "Decode";
X+ 	goto patch1;
X+ 	
X       case K_PATCH:
X  	save_mode = NO_HEADER | SEPARATE_FILES | DO_UNSHAR | DO_PATCH;
X  	mode_text = "Patch";
X**************
X*** 157,170
X  	
X       patch1:
X  	prompt("\1%s Directory:\1 ", mode_text);
X! 	save_name = get_s(last_dir, NONE, NONE, file_completion);
X! 	if (save_name == NULL) return NULL;
X! 	if (*save_name == NUL) 
X! 	    save_name = NULL;
X! 	else {
X! 	    strcpy(last_dir, save_name);
X! 	}
X! 	
X  	break;
X  	
X       case K_PRINT:
X--- 163,171 -----
X  	
X       patch1:
X  	prompt("\1%s Directory:\1 ", mode_text);
X! 	save_name = get_s(last_dir, current_group->save_file, NONE, file_completion);
X! 	if (save_name == NULL || *save_name == NUL) return NULL;
X! 	strcpy(last_dir, save_name);
X  	break;
X  	
X       case K_PRINT:
X**************
X*** 198,204
X  	
X  	if (!(save_mode & IS_PIPE)) {
X  	    if (file_exist(save_name, (save_mode & DO_UNSHAR) ? "wd" : "wf")) {
X! 		if (conf_append && (save_mode & DO_UNSHAR) == 0) {
X  		    printf("\rAppend to: %s ? ", save_name);
X  		    clrline();
X  		    if (!yes(0)) return NULL;
X--- 199,210 -----
X  	
X  	if (!(save_mode & IS_PIPE)) {
X  	    if (file_exist(save_name, (save_mode & DO_UNSHAR) ? "wd" : "wf")) {
X! 		if (save_mode & DO_UNSHAR) {
X! 		    int len = strlen(save_name);
X! 		    if (save_name[len - 1] != '/')
X! 			strcpy(save_name + len, "/");
X! 		} else
X! 		if (conf_append) {
X  		    printf("\rAppend to: %s ? ", save_name);
X  		    clrline();
X  		    if (!yes(0)) return NULL;
X**************
X*** 210,216
X  		}
X  
X  		if (save_mode & DO_UNSHAR) {
X! 		    strcat(save_name, "/");
X  		}
X  
X  		start = ckdir_path(save_name);
X--- 216,224 -----
X  		}
X  
X  		if (save_mode & DO_UNSHAR) {
X! 		    int len = strlen(save_name);
X! 		    if (save_name[len - 1] != '/')
X! 			strcpy(save_name + len, "/");
X  		}
X  
X  		start = ckdir_path(save_name);
X**************
X*** 244,249
X  
X      save_mode |= FILE_IS_NEW;	/* so save() will open it */
X  
X  #ifdef PAGED_OUTPUT
X      if (save_mode & DO_UNSHAR) {
X  	int was_raw = no_raw();
X--- 252,262 -----
X  
X      save_mode |= FILE_IS_NEW;	/* so save() will open it */
X  
X+     if (save_mode & DO_DECODE) {
X+ 	uud_start(save_name);
X+ 	save_mode &= ~DO_UNSHAR;
X+     }
X+     
X  #ifdef PAGED_OUTPUT
X      if (save_mode & DO_UNSHAR) {
X  	int was_raw = no_raw();
X**************
X*** 258,264
X  	system("fdcheck");
X      }
X  #endif
X!     
X      return save_name;
X  }
X  
X--- 271,277 -----
X  	system("fdcheck");
X      }
X  #endif
X! 
X      return save_name;
X  }
X  
X**************
X*** 284,289
X  	return 0;
X      }
X  
X      if (save_mode & UNIQUE_FILES) {
X  	do {
X  	    uniq_counter++;
X--- 297,309 -----
X  	return 0;
X      }
X  
X+     if (save_mode & DO_DECODE) {
X+ 	save_file = NULL;
X+ 	c = uudecode(ah, art);
X+ 	fclose(art);
X+ 	return (c < 0) ? 0 : 1;
X+     }
X+     
X      if (save_mode & UNIQUE_FILES) {
X  	do {
X  	    uniq_counter++;
X**************
X*** 317,323
X  		sprintf(copybuf, "%s %s", unshar_cmd, pager_redir);
X  #else
X  	    sprintf(copybuf, 
X! 		    "cd %s && %s | tee %s 2>&1 ; cat %s >> %s.Result ; rm %s",
X  		    save_name != NULL ? save_name : ".", unshar_cmd,
X  		    temp_file, temp_file, 
X  		    (save_mode & DO_PATCH) ? "Patch" : "Unshar",
X--- 337,343 -----
X  		sprintf(copybuf, "%s %s", unshar_cmd, pager_redir);
X  #else
X  	    sprintf(copybuf, 
X! 		    "cd %s && { %s 2>&1 ; } | tee %s ; cat %s >> %s.Result ; rm %s",
X  		    save_name != NULL ? save_name : ".", unshar_cmd,
X  		    temp_file, temp_file, 
X  		    (save_mode & DO_PATCH) ? "Patch" : "Unshar",
X**************
X*** 450,455
X  	save_file = NULL;
X      }
X      
X  #ifdef PAGED_OUTPUT
X      if (pager_stream != NULL) {
X  	pclose(pager_stream);
X--- 470,478 -----
X  	save_file = NULL;
X      }
X      
X+     if (save_mode & DO_DECODE) {
X+ 	uud_end();
X+     }
X  #ifdef PAGED_OUTPUT
X      if (pager_stream != NULL) {
X  	pclose(pager_stream);
X
X*** /usr/storm/nn6.3.0/selection.c
X--- selection.c
X**************
X*** 17,22
X  } header;
X  
X  #ifndef NETWORK_DATABASE
X  #undef ntohl
X  #undef htonl
X  #undef NETWORK_BYTE_ORDER
X--- 17,27 -----
X  } header;
X  
X  #ifndef NETWORK_DATABASE
X+ #undef NETWORK_BYTE_ORDER
X+ #define NETWORK_BYTE_ORDER
X+ #endif
X+ 
X+ #ifdef NETWORK_BYTE_ORDER
X  #undef ntohl
X  #undef htonl
X  #define ntohl(x) (x)
X**************
X*** 19,25
X  #ifndef NETWORK_DATABASE
X  #undef ntohl
X  #undef htonl
X- #undef NETWORK_BYTE_ORDER
X  #define ntohl(x) (x)
X  #define htonl(x) (x)
X  #define NETWORK_BYTE_ORDER
X--- 24,29 -----
X  #ifdef NETWORK_BYTE_ORDER
X  #undef ntohl
X  #undef htonl
X  #define ntohl(x) (x)
X  #define htonl(x) (x)
X  #endif
X**************
X*** 22,28
X  #undef NETWORK_BYTE_ORDER
X  #define ntohl(x) (x)
X  #define htonl(x) (x)
X- #define NETWORK_BYTE_ORDER
X  #endif
X  
X  struct sel_art {
X--- 26,31 -----
X  #undef htonl
X  #define ntohl(x) (x)
X  #define htonl(x) (x)
X  #endif
X  
X  struct sel_art {
X
X*** /usr/storm/nn6.3.0/sequence.c
X--- sequence.c
X**************
X*** 175,181
X      if (st.st_size == 0 || st.st_mtime < st.st_atime) return;
X      
X      mail_group.group_name = read_mail;
X!     gh->group_flag = G_FOLDER | G_MAILBOX | G_RC_UPDATED | G_READ;
X  
X      /* "invent" an unread article for read_news */
X      gh->last_article = 1;
X--- 175,181 -----
X      if (st.st_size == 0 || st.st_mtime < st.st_atime) return;
X      
X      mail_group.group_name = read_mail;
X!     gh->group_flag = G_FOLDER | G_MAILBOX | G_READ;
X  
X      /* "invent" an unread article for read_news */
X      gh->last_article = 1;
X**************
X*** 367,373
X      mem_check(gh, 1, "group header");
X      
X      gh->group_name = name;
X!     gh->group_flag = flag | G_RC_UPDATED | G_READ;
X  
X      /* "invent" an unread article for read_news */
X      gh->last_article = 1;
X--- 367,373 -----
X      mem_check(gh, 1, "group header");
X      
X      gh->group_name = name;
X!     gh->group_flag = flag | G_READ;
X  
X      /* "invent" an unread article for read_news */
X      gh->last_article = 1;
X**************
X*** 392,398
X  	
X      if (strcmp(group, "NEW") == 0) {
X  	gs_mode = GS_NEW_GROUP;
X! 	gs_length = 127;
X      } else {
X  	gs_mode = GS_PREFIX;
X  	
X--- 392,398 -----
X  	
X      if (strcmp(group, "NEW") == 0) {
X  	gs_mode = GS_NEW_GROUP;
X! 	gs_length = 0;
X      } else {
X  	gs_mode = GS_PREFIX;
X  	
X
X*** /usr/storm/nn6.3.0/term.c
X--- term.c
X**************
X*** 213,218
X      
X      if ((term_name = getenv("TERM")) == NULL)
X  	user_error("No TERM variable in enviroment");
X      
X  #ifdef USE_TERMINFO
X      setupterm(0,1,0);
X--- 213,224 -----
X      
X      if ((term_name = getenv("TERM")) == NULL)
X  	user_error("No TERM variable in enviroment");
X+ 
X+ #ifdef HAVE_TERMIO
X+     ioctl(0, TCGETA, &norm_tty);
X+ #else	
X+     ioctl(0, TIOCGETP, &norm_tty);
X+ #endif
X      
X  #ifdef USE_TERMINFO
X      setupterm(0,1,0);
X**************
X*** 291,300
X  	cookie_size = two_cookies = 0;
X      
X      
X- #ifdef HAVE_TERMIO
X-     
X-     ioctl(0, TCGETA, &norm_tty);
X-     
X      raw_tty = norm_tty;
X      
X      raw_tty.c_iflag &= ~(BRKINT|INLCR|ICRNL|IGNCR);
X--- 297,302 -----
X  	cookie_size = two_cookies = 0;
X      
X      
X      raw_tty = norm_tty;
X      
X  #ifdef HAVE_TERMIO
X**************
X*** 297,302
X      
X      raw_tty = norm_tty;
X      
X      raw_tty.c_iflag &= ~(BRKINT|INLCR|ICRNL|IGNCR);
X      raw_tty.c_iflag |= IGNBRK|IGNPAR|ISTRIP;
X      raw_tty.c_oflag &= ~OPOST;
X--- 299,305 -----
X      
X      raw_tty = norm_tty;
X      
X+ #ifdef HAVE_TERMIO
X      raw_tty.c_iflag &= ~(BRKINT|INLCR|ICRNL|IGNCR);
X      raw_tty.c_iflag |= IGNBRK|IGNPAR|ISTRIP;
X      raw_tty.c_oflag &= ~OPOST;
X**************
X*** 307,315
X      raw_tty.c_cc[VEOL] = ((raw_tty.c_cflag & CBAUD) > B1200) ? 1 : 2;
X      
X  #else	
X-     
X-     ioctl(0, TIOCGETP, &norm_tty);
X-     
X      ioctl(0, TIOCGETC, &norm_chars);
X      
X  #ifdef TIOCGLTC
X--- 310,315 -----
X      raw_tty.c_cc[VEOL] = ((raw_tty.c_cflag & CBAUD) > B1200) ? 1 : 2;
X      
X  #else	
X      ioctl(0, TIOCGETC, &norm_chars);
X      
X  #ifdef TIOCGLTC
X**************
X*** 318,325
X      
X      ospeed = norm_tty.sg_ospeed;
X      if (ospeed < B2400) slow_mode++;
X-     
X-     raw_tty = norm_tty;
X      
X      raw_tty.sg_flags |= RAW;
X      raw_tty.sg_flags &= ~(ECHO|CRMOD);
X--- 318,323 -----
X      
X      ospeed = norm_tty.sg_ospeed;
X      if (ospeed < B2400) slow_mode++;
X      
X      raw_tty.sg_flags |= RAW;
X      raw_tty.sg_flags &= ~(ECHO|CRMOD);
X
X*** /usr/storm/nn6.3.0/xmakefile
X--- xmakefile
X**************
X*** 55,61
X  	init.o variable.o term.o keymap.o macro.o regexp.o \
X  	menu.o more.o rc.o group.o folder.o \
X  	articles.o sequence.o selection.o kill.o \
X! 	answer.o reroute.o save.o unshar.o execute.o \
X  	pack_date.o pack_name.o pack_subject.o news.o digest.o match.o 
X  
X  MAIL = nnmail.o reroute.o global.o options.o update.o
X--- 55,61 -----
X  	init.o variable.o term.o keymap.o macro.o regexp.o \
X  	menu.o more.o rc.o group.o folder.o \
X  	articles.o sequence.o selection.o kill.o \
X! 	answer.o reroute.o save.o unshar.o decode.o execute.o \
X  	pack_date.o pack_name.o pack_subject.o news.o digest.o match.o 
X  
X  MAIL = nnmail.o reroute.o global.o options.o update.o
X**************
X*** 195,200
X  date_regexp.o:	config.h global.h data.h
X  
X  db.o:		db.c config.h global.h data.h db.h
X  
X  digest.o:	digest.c config.h global.h data.h news.h match.h
X  
X--- 195,202 -----
X  date_regexp.o:	config.h global.h data.h
X  
X  db.o:		db.c config.h global.h data.h db.h
X+ 
X+ decode.o:	decode.c config.h
X  
X  digest.o:	digest.c config.h global.h data.h news.h match.h
X  
X
NO_NEWS_IS_GOOD_NEWS
echo "File PATCH.2 is complete"
chmod 0644 PATCH.2 || echo "restore of PATCH.2 fails"
set `wc -c PATCH.2`;Sum=$1
if test "$Sum" != "47497"
then echo original size 47497, current size $Sum;fi
echo "x - extracting decode.c (Text)"
sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > decode.c &&
X/*
X * Decode one or more uuencoded article back to binary form.
X *
X * UNIX/NN VERSION 
X *	This version cannot be used as a stand-alone uud!
X * 	This version is made: 16 June 1989.
X *
X * From the Berkeley original, modified by MSD, RDR, JPHD & WLS.
X */
X
X#include "config.h"
X
X#define MAXCHAR 256
X#define LINELEN 256
X#define NORMLEN 60	/* allows for 80 encoded chars per line */
X
X#define SEQMAX 'z'
X#define SEQMIN 'a'
X
Xstatic char seqc;
Xstatic int first, secnd, check, numl;
X
Xstatic FILE *out;
Xstatic char *target;
Xstatic char blank;
Xstatic int chtbl[MAXCHAR], cdlen[NORMLEN + 3];
Xstatic char ofname[FILENAME];
Xstatic int state;
X
X#define	NO_ADVANCE		0x10
X
X#define	FIND_BEGIN		0x01
X#define	FIND_BEGIN_AFTER_ERROR	0x02
X#define	DECODE_TEXT		0x03
X#define	SKIP_TRAILING	       (0x04 | NO_ADVANCE)
X#define	SKIP_LEADING		0x05
X#define	FOUND_END	       (0x06 | NO_ADVANCE)
X#define DECODE_ERROR	       (0x07 | NO_ADVANCE)
X#define OTHER_ERROR	       (0x08 | NO_ADVANCE)
X#define NEW_BEGIN	       (0x09 | NO_ADVANCE)
X
Xuud_start(dir)
Xchar *dir;
X{
X    target = dir;
X    out = NULL;
X    seqc = SEQMAX;
X    check = 1;
X    first = 1;
X    secnd = 0;
X    state = FIND_BEGIN;
X}
X
Xuud_end()
X{
X    if (out != NULL) {
X	fclose(out);
X	msg("%s INCOMPLETE -- removed", ofname);
X	unlink(ofname);
X    }
X}
X
X
Xuudecode(ah, in)
Xregister article_header *ah;
XFILE *in;
X{
X    int mode, onedone, lens;
X    char dest[FILENAME], buf[LINELEN];
X
X    numl = onedone = 0;
X
X    if (state == FIND_BEGIN)
X	inittbls();
X    
X    /*
X     * search for header or translation table line.
X     */
X
X    while ((state & NO_ADVANCE) || 
X	   (ftell(in) < ah->lpos && fgets(buf, sizeof buf, in) != NULL)) {
X	numl++;
X
X	switch (state) {
X
X	 case NEW_BEGIN:
X	    if (out != NULL) {
X		msg("INCOMPLETE FILE: %s -- removed", ofname);
X		user_delay(5);
X		fclose(out);
X		out = NULL;
X		unlink(ofname);
X	    }
X	    /* fall thru */
X
X	 case FIND_BEGIN:
X	 case FIND_BEGIN_AFTER_ERROR:
X	    if (strncmp(buf, "table", 5) == 0) {
X		gettable(in);
X		continue;
X	    }
X
X	    if (strncmp(buf, "begin", 5) == 0) {
X		lens = strlen(buf);
X		buf[--lens] = '\0';
X
X		if(sscanf(buf,"begin%o%s", &mode, dest) != 2)
X		    continue;
X		
X		if (target != NULL)
X		    sprintf(ofname, "%s%s", target, dest);
X		else
X		    strcpy(ofname, dest);
X		    
X		if ((out = open_file(ofname, OPEN_CREATE)) == NULL) {
X		    msg("Cannot create file: %s\n", ofname);
X		    goto err;
X		}
X		chmod(ofname, mode);
X
X		msg("Decoding: %s", ofname);
X		state = DECODE_TEXT;
X	    }
X	    continue;
X	
X	 case SKIP_LEADING:
X	    state = decode_line(buf);
X	    continue;
X
X	 case DECODE_TEXT:
X	    state = decode_line(buf);
X	    onedone = 1;
X	    continue;
X
X	 case FOUND_END:
X	    fclose(out);
X	    out = NULL;
X	    state = FIND_BEGIN;
X	    continue;
X	    
X	 case SKIP_TRAILING:
X	    state = SKIP_LEADING;
X	    return 0;
X
X	 case DECODE_ERROR:
X	    state = SKIP_TRAILING;
X	    continue;
X	    
X	 case OTHER_ERROR:
X	    fclose(out);
X	    out = NULL;
X	    state = FIND_BEGIN_AFTER_ERROR;
X	    goto err;
X	}
X    }
X    
X    if (onedone) {
X	if (state == DECODE_TEXT) state = SKIP_LEADING;
X	return 0;
X    }
X    
X    if (state == FIND_BEGIN_AFTER_ERROR) return -1;
X    msg("No 'begin' line");
X    
X err:
X    user_delay(2);
X    return -1;
X}
X
X/*
X * decode one line, write on out file
X */
X
Xstatic decode_line(buf)
Xchar *buf;
X{
X    char outl[LINELEN];
X    register char *bp, *ut;
X    register int *trtbl = chtbl;
X    register int n; 
X    register int blen;		/* binary length (from decoded file) */
X    register int rlen;		/* calculated input line length */
X    register int len;		/* actual input line length */
X    
X    len = strlen(buf);
X    if (--len < 0) return state;
X
X    buf[len] = '\0';
X
X    /*
X     * Get the binary line length.
X     */
X    if ((blen = trtbl[buf[0]]) < 0) {
X	if (state == SKIP_LEADING) {
X	    if (strncmp(buf, "begin", 5) == 0)
X		return NEW_BEGIN;
X	
X	    return SKIP_LEADING;
X	}	
X	/*
X	 * end of uuencoded file ?
X	 */
X	if (strncmp(buf, "end", 3) == 0) 
X	    return FOUND_END;
X	
X	/*
X	 * end of current file ? : get next one.
X	 */
X	if (strncmp(buf, "include", 7) == 0) {
X	    msg("Cannot handle 'include' lines -- unpack with uud");
X	    return OTHER_ERROR;
X	}
X
X	/*
X	 * trailing garbage
X	 */
X	return SKIP_TRAILING;
X    }
X    
X    rlen = cdlen[blen];
X    if (len != rlen && state == SKIP_LEADING)
X	return SKIP_LEADING;
X    
X    /*
X     * Is it the empty line before the end line ?
X     */
X    if (blen == 0) return state;
X    
X    /*
X     * Pad with blanks.
X     */
X    for (bp = buf + len, n = rlen - len; --n >= 0; ) *bp++ = blank;
X    
X    /*
X     * Verify
X     */
X    for (n = rlen, bp = buf; --n >= 0; bp++) 
X	if (trtbl[*bp] < 0) {
X	    if (state == SKIP_LEADING) return SKIP_LEADING;
X	    return DECODE_ERROR;
X	}
X    
X    /*
X     * Check for uuencodes that append a 'z' to each line....
X     */
X    if (check)
X	if (secnd) {
X	    secnd = 0;
X	    if (buf[rlen] == SEQMAX) check = 0;
X	} else if (first) {
X	    first = 0;
X	    secnd = 1;
X	    if (buf[rlen] != SEQMAX) check = 0;
X	}
X    
X    /*
X     * There we check.
X     */
X    if (check) {
X	if (buf[rlen] != seqc) {
X	    if (state == SKIP_LEADING) return SKIP_LEADING;
X	    return DECODE_ERROR;
X	}
X	
X	if (--seqc < SEQMIN) seqc = SEQMAX;
X    }
X    
X    /*
X     * output a group of 3 bytes (4 input characters).
X     * the input chars are pointed to by p, they are to
X     * be output to file f. blen is used to tell us not to
X     * output all of them at the end of the file.
X     */
X    ut = outl;
X    n = blen;
X    bp = &buf[1];
X    while (--n >= 0) {
X	*(ut++) = trtbl[*bp] << 2 | trtbl[bp[1]] >> 4;
X	if (n > 0) {
X	    *(ut++) = (trtbl[bp[1]] << 4) | (trtbl[bp[2]] >> 2);
X	    n--;
X	}
X	if (n > 0) {
X	    *(ut++) = trtbl[bp[2]] << 6 | trtbl[bp[3]];
X	    n--;
X	}
X	bp += 4;
X    }
X    if (fwrite(outl, 1, blen, out) <= 0) {
X	msg("Error on writing decoded file");
X	return OTHER_ERROR;
X    }
X
X    return DECODE_TEXT;
X}
X
X
X
X/*
X * Install the table in memory for later use.
X */
Xstatic inittbls()
X{
X    register int i, j;
X    
X    /*
X     * Set up the default translation table.
X     */
X    for (i = 0; i < ' '; i++) chtbl[i] = -1;
X    for (i = ' ', j = 0; i < ' ' + 64; i++, j++) chtbl[i] = j;
X    for (i = ' ' + 64; i < MAXCHAR; i++) chtbl[i] = -1;
X    chtbl['`'] = chtbl[' '];	/* common mutation */
X    chtbl['~'] = chtbl['^'];	/* an other common mutation */
X    blank = ' ';
X    /*
X     * set up the line length table, to avoid computing lotsa * and / ...
X     */
X    cdlen[0] = 1;
X    for (i = 1, j = 5; i <= NORMLEN; i += 3, j += 4)
X	cdlen[i] = (cdlen[i + 1] = (cdlen[i + 2] = j));
X}
X
Xstatic gettable(in)
XFILE *in;
X{
X    char buf[LINELEN];
X    register int c, n = 0;
X    register char *cpt;
X    
X    for (c = 0; c <= MAXCHAR; c++) chtbl[c] = -1;
X    
X    for (;;) {
X	
X	if (fgets(buf, sizeof buf, in) == NULL) {
X	    msg("EOF while in translation table.\n");
X	    return -1;
X	}
X	numl++;
X	if (strncmp(buf, "begin", 5) == 0) {
X	    msg("Incomplete translation table.\n");
X	    return -1;
X	}
X	cpt = buf + strlen(buf) - 1;
X	*cpt = ' ';
X	while (*(cpt) == ' ') {
X	    *cpt = 0;
X	    cpt--;
X	}
X	cpt = buf;
X	while (c = *cpt) {
X	    if (chtbl[c] != -1) {
X		msg("Duplicate char in translation table.\n");
X		return -1;
X	    }
X	    if (n == 0) blank = c;
X	    chtbl[c] = n++;
X	    if (n >= 64) return 0;
X	    cpt++;
X	}
X    }
X}
X
NO_NEWS_IS_GOOD_NEWS
chmod 0644 decode.c || echo "restore of decode.c fails"
set `wc -c decode.c`;Sum=$1
if test "$Sum" != "7241"
then echo original size 7241, current size $Sum;fi
echo "x - extracting s-dnix5-2.h (Text)"
sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > s-dnix5-2.h &&
X/*
X *	This version is for dnix version 5.2 on DIAB DS90-10.
X */
X
X
X/*
X *	Include header files containing the following definitions:
X *
X * 		off_t, time_t, struct stat
X */
X
X#include <sys/types.h>
X#include <sys/stat.h>
X
X/*
X *	Define if your system has system V like ioctls
X */
X
X#define	HAVE_TERMIO			/* */
X
X/*
X *	Define to use terminfo database.
X *	Otherwise, termcap is used
X */
X
X#define	USE_TERMINFO			/* */
X
X/*
X *	Specify the library containing the termcap/terminfo access routines.
X *	Notice:  nn does not use curses.
X *	Notice:  You must also specify whether termcap or terminfo is
X *		 used when you edit config.h (see below).
X */
X
X#define	TERMLIB -lcurses
X
X/*
X *	Define HAVE_STRCHR if strchr() and strrchr() are available
X */
X
X#define HAVE_STRCHR			/* */
X
X/*
X *	Define if a signal handler has type void (see signal.h)
X */
X
X/*#define	SIGNAL_HANDLERS_ARE_VOID	/* */
X
X/*
X *	Define if signals must be set again after they are caught
X */
X
X#define	RESET_SIGNAL_WHEN_CAUGHT	/* */
X
X/*
X *	Define MICRO_ALARM to timeout in 0.1 seconds if possible
X */
X
X#define MICRO_ALARM()	alarm(1)	/* System V */
X
X/*
X *	Define if your system has BSD like job control (SIGTSTP works)
X */
X
X/* #define HAVE_JOBCONTROL			/* */
X
X/*
X *	Define if your system provides the "directory(3X)" access routines
X *
X *	If true, include the header file(s) required by the package below
X *	(remember that <sys/types.h> or equivalent is included above)
X *	Also typedef Direntry to the proper struct type.
X */
X
X#define	HAVE_DIRECTORY			/* */
X
X#include <dirent.h>			/* System V */
X
Xtypedef struct dirent Direntry;		/* System V */
X
X/*
X *	Define if your system has a mkdir() library routine
X */
X
X#define	HAVE_MKDIR			/* */
X
X/*
X *	Define HAVE_GETHOSTNAME if your system provides a BSD like 
X *	gethostname routine.
X *	Otherwise, define HAVE_UNAME if uname() is avaiable.
X *	As a final resort, define HOSTNAME to the name of your system.
X */
X
X#define	HAVE_UNAME			/* System V */
X
X/*
X *	Define DETATCH_TERMINAL to be a command sequence which 
X *	will detatch a process from the control terminal
X *	Also include files needed to perform this HERE.
X *	If not possible, just define it (empty)
X */
X
X#define	DETATCH_TERMINAL setpgrp();	/* System V */
X
X/* 
X *	Specify where the Bourne Shell is.
X */
X
X#define SHELL		"/bin/sh"
X
X/*
X *	Define AVOID_SHELL_EXEC if the system gets confused by
X *		#!/bin/sh
X *	lines in shell scripts, e.g. only reads #! and thinks it
X *	is a csh script.
X */
X
X#define AVOID_SHELL_EXEC		/* */
X
X/*
X *	Specify the default mailer to be invoked by nnmail
X */
X
X#define	MAILX		"/usr/bin/mailx"	/* SV */
X
X/*
X *	Specify the default pager & options.
X */
X
X#define	PAGER		"pg -n -s"
X
X/*
X *	Specify the default print command and options.
X */
X
X#define	PRINTER		"lp -s"
X
X
X/*
X *	Define the maximum length of any pathname that may occur
X */
X
X#define	FILENAME 	128
NO_NEWS_IS_GOOD_NEWS
chmod 0644 s-dnix5-2.h || echo "restore of s-dnix5-2.h fails"
set `wc -c s-dnix5-2.h`;Sum=$1
if test "$Sum" != "2819"
then echo original size 2819, current size $Sum;fi
echo "x - extracting s-hpux3-0.h (Text)"
sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > s-hpux3-0.h &&
X/*
X *    This version is for HP-UX 3.0 (on HP9000 Series 800)
X */
X 
X 
X/*
X *    Include header files containing the following definitions:
X *
X *         off_t, time_t, struct stat
X */
X 
X#include <sys/types.h>
X#include <sys/stat.h>
X 
X 
X/*
X *    Define if your system has system V like ioctls
X */
X 
X#define    HAVE_TERMIO            /* */
X 
X/*
X *    Define to use terminfo database.
X *    Otherwise, termcap is used
X */
X 
X#define    USE_TERMINFO            /* */
X 
X/*
X *    Specify the library (or libraries) containing the termcap/terminfo
X *    routines.
X *
X *    Notice:  nn only uses the low-level terminal access routines
X *    (i.e. it does not use curses).
X */
X 
X#define TERMLIB    -lcurses
X 
X/*
X *    Define HAVE_STRCHR if strchr() and strrchr() are available
X */
X 
X#define HAVE_STRCHR            /* */
X 
X/*
X *    Define if a signal handler has type void (see signal.h)
X */
X 
X#define    SIGNAL_HANDLERS_ARE_VOID    /* */
X 
X/*
X *    Define if signals must be set again after they are caught
X */
X 
X#define    RESET_SIGNAL_WHEN_CAUGHT    /* */
X 
X/*
X *    Define MICRO_ALARM to timeout in 0.1 seconds if possible
X */
X 
X#define MICRO_ALARM()    not_needed(0.1)  /* only used #ifndef HAVE_TERMIO */
X 
X/*
X *    Define if your system has BSD like job control (SIGTSTP works)
X */
X 
X#define HAVE_JOBCONTROL            /* */
X 
X 
X/*
X *    Define if your system has a 4.3BSD like syslog library.
X */
X 
X#define HAVE_SYSLOG
X 
X/*
X *    Define if your system provides the "directory(3X)" access routines
X *
X *    If true, include the header file(s) required by the package below
X *    (remember that <sys/types.h> or equivalent is included above)
X *    Also typedef Direntry to the proper struct type.
X */
X 
X#define    HAVE_DIRECTORY            /* */
X 
X#include <ndir.h>
X 
Xtypedef struct direct Direntry;
X 
X/*
X *    Define if your system has a mkdir() library routine
X */
X 
X#define    HAVE_MKDIR            /* */
X 
X 
X/*
X *    Define HAVE_GETHOSTNAME if your system provides a BSD like
X *    gethostname routine.
X *    Otherwise, define HAVE_UNAME if uname() is avaiable.
X *    As a final resort, define HOSTNAME to the name of your system
X *    (in config.h).
X */
X 
X#define    HAVE_GETHOSTNAME
X 
X/*
X *    Define DETATCH_TERMINAL to be a command sequence which
X *    will detatch a process from the control terminal
X *    Also include system files needed to perform this HERE.
X *    If not possible, just define it (empty)
X */
X 
X/* #include "...." */
X 
X#define    DETATCH_TERMINAL setpgrp();
X 
X 
X/*
X *    Specify where the Bourne Shell is.
X */
X 
X#define SHELL        "/bin/sh"
X 
X/*
X *    Specify the default mailer to be invoked by nnmail
X */
X 
X#define    MAILX        "/usr/bin/mailx"    /* SV */
X 
X 
X/*
X *    Specify the default pager & options.
X */
X 
X#define    PAGER        "/usr/local/bin/less"
X 
X/*
X *    Specify the default print command and options.
X */
X 
X#define    PRINTER        "/usr/bin/lp -s"
X 
X 
X/*
X *    Define the maximum length of any pathname that may occur
X */
X 
X#define    FILENAME     1024
X 
X 
X/*
X *    Define standard compiler flags here:
X */
X 
X#define COMPILER_FLAGS -O -z
X
NO_NEWS_IS_GOOD_NEWS
chmod 0644 s-hpux3-0.h || echo "restore of s-hpux3-0.h fails"
set `wc -c s-hpux3-0.h`;Sum=$1
if test "$Sum" != "3085"
then echo original size 3085, current size $Sum;fi
rm -f s2_seq_.tmp
echo "You have unpacked the last part"
exit 0

-- 
Kim F. Storm        storm at texas.dk        Tel +45 429 174 00
Texas Instruments, Marielundvej 46E, DK-2730 Herlev, Denmark
	  No news is good news, but nn is better!



More information about the Comp.sources.bugs mailing list