summaryrefslogtreecommitdiff
path: root/do/sreverse
blob: bbf88b723d56284c0888cddad25376b195082757 (plain)
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
int
do_sreverse(TARG,arglast)
STR *TARG;
int *arglast;
{
    STR **st = stack->ary_array;
    register char *up;
    register char *down;
    register int tmp;

    str_sset(TARG,st[arglast[2]]);
    up = str_get(TARG);
    if (TARG->str_cur > 1) {
	down = TARG->str_ptr + TARG->str_cur - 1;
	while (down > up) {
	    tmp = *up;
	    *up++ = *down;
	    *down-- = tmp;
	}
    }
    STABSET(TARG);
    st[arglast[0]+1] = TARG;
    return arglast[0]+1;
}