#include <signal.h>#include <unistd.h>#include <stdio.h>#include <sys/types.h>#include <time.h>void prtime() {        time_t rawtime;        struct tm * timeinfo;        char *s;        signal(SIGALRM, prtime);        time ( &rawtime );        timeinfo = localtime ( &rawtime );        alarm (1) ; //printf(Time\n);        printf ( \033[s\033[6;45H %s \033[u, asctime (timeinfo) );}int main(){        signal(SIGALRM, prtime);        alarm(1);        printf(continue instructions\n);        while (1) {                pause();                printf(continue instructions\n);        }}I just try to write the clock at a specific position in terminal, but I want to save the cursor position before writing the clock, and then restore that position after writing the clock.but the \033[s & \033[u doesn't work.
Solaris 10, Shell Script, Cursor movement
shell script;solaris;ksh
You are using commands CSI s and CSI u which have incompatible interpretations depending on the implementation.The first one can be either Save cursor position or Reset terminal emulator, the latter being a Solaris private interface.You should use a library like ncurses to achieve portable screen handling but if you still want to hardcode the escape sequences, this might do what you expect:printf ( \0337\033[6;45H %s \0338, asctime (timeinfo) );