File: hack.c

package info (click to toggle)
hztty 2.0-5.2woody2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,028 kB
  • ctags: 295
  • sloc: ansic: 26,960; makefile: 162; sh: 109
file content (83 lines) | stat: -rw-r--r-- 1,166 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* $Id: hack.c,v 2.0 1995/01/29 08:10:04 ygz Exp $ */

#ifndef lint
static char *rcs_id="$Id: hack.c,v 2.0 1995/01/29 08:10:04 ygz Exp $";
#endif /* lint */

#include "config.h"
#include "io.h"

#include <ctype.h>

int rot13_init()
{
	return (0);
}

char *rot13(s,plen,inst)
     char *s;
     int *plen;
     int inst;
{
  register int i;

	for (i = 0; i < *plen; i++)
		s[i] = (('A'<=s[i]) && (s[i]<='M') ||
			('a'<=s[i]) && (s[i]<='m')) ?
				(s[i] + 13) :
		       (('N'<=s[i]) && (s[i]<='Z') ||
			('n'<=s[i]) && (s[i]<='z')) ?
				(s[i] - 13) : s[i] ;
	return (s);
}

int toascii_init()
{
	return (0);
}

char *to_ascii(s,plen,inst)
     char *s;
     int *plen;
     int inst;
{
  register int i;

	for (i = 0; i < *plen; i++)
		s[i] &= 0x7f;
	return (s);
}

int toupper_init()
{
	return (0);
}

char *to_upper(s,plen,inst)
     char *s;
     int *plen;
     int inst;
{
  register int i;

	for (i = 0; i < *plen; i++)
		s[i] = toupper(s[i]);
	return (s);
}

int tolower_init()
{
	return (0);
}

char *to_lower(s,plen,inst)
     char *s;
     int *plen;
     int inst;
{
  register int i;

	for (i = 0; i < *plen; i++)
		s[i] = tolower(s[i]);
	return (s);
}