예제 #1
0
파일: main.c 프로젝트: meersjo/ldapfs
static int fldap_chown(const char* path, uid_t uid, gid_t gid) {
  char buf[2][32];

  snprintf(buf[0], 32, "%"PRIi32, uid);
  if (modify_attr(path, LDAP_MOD_REPLACE, "stuid", buf[0]) != 0)
    return -ENOENT;
  snprintf(buf[1], 32, "%"PRIi32, gid);
  return modify_attr(path, LDAP_MOD_REPLACE, "stgid", buf[1]);
}
예제 #2
0
파일: printcall.c 프로젝트: Tlf/tlf
/** highlight the first n characters of the call input field
 *
 * \param n number of characters to highlight
 */
void highlightCall(unsigned int n) {
    attr_t attrib = modify_attr(A_NORMAL);
				/* use NORMAL here as normal display
				   uses STANDOUT */

    mvchgat(12, 29, n, attrib, C_INPUT, NULL);
}
예제 #3
0
파일: bandmap.c 프로젝트: wildj79/tlf
/*
 * write bandmap spots to a file
 */
void bmdata_write_file() {

    FILE * fp;
    spot * sp;
    GList *found;
    struct timeval tv;

    if ((fp = fopen(".bmdata.dat", "w")) == NULL) {
	attron(modify_attr(COLOR_PAIR(CB_DUPE)|A_BOLD));
	mvprintw(13, 29, "can't open bandmap data file!");
	refreshp();
	return;
    }

    gettimeofday(&tv, NULL);

    pthread_mutex_lock( &bm_mutex );

    found = allspots;
    fprintf(fp, "%d\n", (int)tv.tv_sec);
    while (found != NULL) {
	sp = found->data;
	fprintf(fp, "%s;%d;%d;%d;%c;%u;%d\n",
		sp->call, sp->freq, sp->mode, sp->band,
		sp->node, (int)sp->timeout, sp->dupe);
	found = found->next;
    }

    pthread_mutex_unlock( &bm_mutex );

    fclose(fp);
}
예제 #4
0
파일: main.c 프로젝트: meersjo/ldapfs
static int fldap_symlink(const char* from, const char* to) {
  char* dn_from;
  char* dn_to;

  dn_from = is_dn_exist(from);
  dn_to = path_to_dn(to, "cn=");
  
  create(to, (mode_t)0777 ^ S_IFLNK, 4, S_IFLNK, 0);
  if (!strcmp(dn_from, BASE_DN))
    modify_attr(to, LDAP_MOD_ADD, "description", (char *)from);
  else
    modify_attr(to, LDAP_MOD_ADD, "description", dn_from);
  free(dn_from);
  free(dn_to);
  return 0;
}
예제 #5
0
파일: time_update.c 프로젝트: wildj79/tlf
/** show frequency and frequency memory if rig control is active */
void show_freq(void)
{
    extern int showfreq;
    extern int showscore_flag;
    extern float mem;
    extern int trx_control;
    extern float freq;

    if (trx_control == 1) {

	attron(modify_attr(COLOR_PAIR(C_LOG)));

	if ((showfreq == 0) || (showscore_flag == 1))
	    mvprintw(13, 68, "TRX: %7.1f", freq);

	if (mem > 0.0)
	    mvprintw(14, 68, "MEM: %7.1f", mem);
	else
	    mvprintw(14, 68, "            ");

	if ((showfreq == 1) && (showscore_flag == 0)) {

	    freq_display();
	}
    }
}
예제 #6
0
파일: freq_display.c 프로젝트: wildj79/tlf
int print_space(int y, int x)
{
    attroff(A_STANDOUT);
    attron(modify_attr(COLOR_PAIR(C_LOG)));

    mvprintw(y, x, "                                   ");

    return (0);
}
예제 #7
0
파일: main.c 프로젝트: meersjo/ldapfs
static int fldap_write(const char* path, const char* data, size_t size, off_t offset, struct fuse_file_info* fi) {
  static char* attrs[] = {"description", NULL};
  LDAPMessage* msg = NULL;
  LDAPMessage* entry = NULL;
  BerElement* ber = NULL;
  char* buf = NULL;
  char strsize[32];
  char* dn;
  char** vals;
  char* attr;

  dn = path_to_dn(path, "cn=");
  ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "(ObjectClass=*)", attrs, 0, &msg);
  entry = ldap_first_entry(ld, msg);

  if (!entry) {
    ldap_msgfree(msg);
    free(dn);
    return -ENOENT;
  }
  for (entry = ldap_first_entry(ld, msg); entry != NULL; entry = ldap_next_entry(ld, entry)) {
    for (attr = ldap_first_attribute(ld, entry, &ber); attr != NULL; attr = ldap_next_attribute(ld, entry, ber)) {
      if (!strcmp(attr, "description") && ((vals = ldap_get_values(ld, entry, attr)) != NULL))  {
	buf = calloc(strlen(vals[0]) + size + 1, sizeof(char));
	strncpy(buf, vals[0], offset);
	strncat(buf, data, size);
	ldap_value_free(vals);
      }
      ldap_memfree(attr);
    }
    ber_free(ber, 0);
  }
  ldap_msgfree(msg);
  if (!buf) {
    buf = calloc(size + 1, sizeof(char));
    strncpy(buf, data, size);
  }
  snprintf(strsize, 32, "%"PRIi32, (int)strlen(buf));
  modify_attr(path, LDAP_MOD_REPLACE, "description", buf);
  modify_attr(path, LDAP_MOD_REPLACE, "stsize", strsize);
  free(dn);
  free(buf);
  return size;
}
예제 #8
0
파일: nicebox.c 프로젝트: wildj79/tlf
void wnicebox(WINDOW *win, int y, int x, int height, int width, char *boxname)
{
    height += 1;
    width += 1;

    wattrset(win, modify_attr(COLOR_PAIR(C_BORDER)));

    mvwaddch(win, y, x, ACS_ULCORNER);
    whline(win, ACS_HLINE, width);
    mvwaddch(win, y, x + width, ACS_URCORNER);
    mvwaddch(win, y + height, x, ACS_LLCORNER);
    whline(win, ACS_HLINE, width);
    mvwaddch(win, y + height, x + width, ACS_LRCORNER);
    mvwvline(win, y + 1, x + width, ACS_VLINE, height - 1);
    mvwvline(win, y + 1, x, ACS_VLINE, height - 1);
    mvwprintw(win, y, x + 2, boxname);

    return;
}
예제 #9
0
파일: printcall.c 프로젝트: Tlf/tlf
void printcall(void) {
    extern char hiscall[];
    extern int miniterm;
    extern int cqmode;
    extern int cwstart;

    int currentterm;
    attr_t attrib = modify_attr(A_STANDOUT);

    currentterm = miniterm;
    miniterm = 0;

    attron(COLOR_PAIR(C_INPUT) | attrib);

    mvprintw(12, 29, "            ");
    mvprintw(12, 29, hiscall);
    if ((cqmode == CQ) && (cwstart > 0))
	mvchgat(12, 29 + cwstart, 12 - cwstart,
		attrib | A_UNDERLINE, C_INPUT, NULL);
    refreshp();

    miniterm = currentterm;
}
예제 #10
0
파일: cleanup.c 프로젝트: Tlf/tlf
int cleanup(void) {
    extern int defer_store;

    int k = 0;

    attron(modify_attr(COLOR_PAIR(NORMCOLOR)));

    mvprintw(12, 29, "            ");
    mvprintw(12, 54, "                        ");
    mvprintw(12, 29, "");

    attron(COLOR_PAIR(C_LOG | A_STANDOUT));

    for (k = 1; k <= 5; k++) {
	mvprintw(k, 0, "%s", "                                        ");
    }

    refreshp();
    cleanup_qso();
    defer_store = 0;
    keyer_flush();

    return (0);
}
예제 #11
0
파일: changepars.c 프로젝트: wildj79/tlf
int multiplierinfo(void)
{
    extern int arrlss;
    extern int serial_section_mult;
    extern int sectn_mult;
    extern struct mults_t multis[MAX_MULTS];
    extern int nr_multis;
    extern GPtrArray *mults_possible;

    int j, k, vert, hor, cnt, found;
    char mprint[50];

    clear();

    attron(modify_attr(COLOR_PAIR(C_WINDOW) | A_STANDOUT));

    for (j = 0; j <= 24; j++)
	mvprintw(j, 0,
		 "                                                                                ");

    if (arrlss == 1) {
	int attributes;
	char chmult[6];
	char ch2mult[6];

	mvprintw(2, 20, "ARRL SWEEPSTAKES -- REMAINING SECTIONS");
	cnt = 0;
	for (vert = 9; vert < 18; vert++) {

	    if (cnt >= mults_possible->len)
		break;

	    for (hor = 5; hor < 15; hor++) {
		if (cnt >= mults_possible->len)
		    break;

		g_strlcpy(chmult, MULTS_POSSIBLE(cnt), sizeof(chmult));

		/* check if in worked multis */
		found = 0;
		for (j = 0; j < nr_multis; j++) {
		    g_strlcpy(ch2mult, multis[j].name, sizeof(ch2mult));

		    if (strcmp(g_strchomp(ch2mult), chmult) == 0)
			found = 1;
		}

		if (found == 1)
		    attributes = COLOR_PAIR(C_HEADER) | A_STANDOUT;
		else
		    attributes = COLOR_PAIR(C_WINDOW) | A_STANDOUT;

		attron(modify_attr(attributes));

		g_strlcpy(mprint, MULTS_POSSIBLE(cnt), 5);
		mvprintw(vert, hor * 4, "%s", mprint);

		cnt++;
	    }
	}
    }

    if (serial_section_mult == 1 || (sectn_mult == 1 && arrlss != 1)) {
	char * tmp;
	int worked_at;

	mvprintw(0, 30, "REMAINING SECTIONS");
	cnt = 0;
	for (vert = 2; vert < 22; vert++) {
	    if (cnt >= mults_possible->len)
		break;

	    for (hor = 0; hor < 7; hor++) {
		if (cnt >= mults_possible->len)
		    break;

		worked_at = 0;

		/* lookup if already worked */
		for (k = 0; k < nr_multis; k++) {
		    if (strstr(multis[k].name, MULTS_POSSIBLE(cnt)) != NULL) {
			worked_at = multis[k].band;
			break;
		    }
		}

		tmp = g_strndup(MULTS_POSSIBLE(cnt), 4);
		sprintf(mprint, "%-4s", tmp);
		g_free(tmp);

		strcat(mprint, (worked_at & BAND160)?"*":"-");
		strcat(mprint, (worked_at & BAND80)?"*":"-");
		strcat(mprint, (worked_at & BAND40)?"*":"-");
		strcat(mprint, (worked_at & BAND20)?"*":"-");
		strcat(mprint, (worked_at & BAND15)?"*":"-");
		strcat(mprint, (worked_at & BAND10)?"*":"-");

		mprint[11] = '\0';
		mvprintw(vert, 2 + hor * 11, "%s", mprint);

		cnt++;
	    }
	}
    }

    attron(modify_attr(COLOR_PAIR(C_WINDOW) | A_STANDOUT));

    mvprintw(23, 22, " --- Press a key to continue --- ");

    refreshp();

    (void)key_get();

    attron(modify_attr(COLOR_PAIR(C_LOG) | A_STANDOUT));

    for (j = 0; j <= 24; j++)
	mvprintw(j, 0,
		 "                                                                                ");

    clear_display();

    return (0);

}
예제 #12
0
파일: changepars.c 프로젝트: wildj79/tlf
int networkinfo(void)
{
    extern int use_bandoutput;
    extern int recv_packets;
    extern int recv_error;
    extern int send_packets[];
    extern int send_error[];
    extern int lan_active;
    extern int nodes;
    extern char bc_hostaddress[MAXNODES][16];
    extern char *config_file;
    extern char whichcontest[];
    extern char pr_hostaddress[];
    extern char tncportname[];
    extern char *rigportname;
    extern char logfile[];

    int i, j, inode;

    clear();

    attron(modify_attr(COLOR_PAIR(C_WINDOW) | A_STANDOUT));

    for (j = 0; j <= 24; j++)
	mvprintw(j, 0,
		 "                                                                                ");

    if (lan_active == 1)
	mvprintw(1, 10, "Network status: on");
    else
	mvprintw(1, 10, "Network status: off");

    mvprintw(3, 28, "Packets rcvd: %d | %d", recv_packets, recv_error);

    for (inode = 0; inode < nodes; inode++) {
	mvprintw(4 + inode, 10, "%s", bc_hostaddress[inode]);
	mvprintw(4 + inode, 28, "Packets sent: %d | %d ",
		 send_packets[inode], send_error[inode], nodes);
    }

    if (strlen(config_file) > 0)
	mvprintw(6 + inode, 10, "Config file: %s", config_file);
    else
	mvprintw(6 + inode, 10,
		 "Config file: /usr/local/share/tlf/logcfg.dat");
    mvprintw(7 + inode, 10, "Contest    : %s", whichcontest);
    mvprintw(8 + inode, 10, "Logfile    : %s", logfile);

    mvprintw(9 + inode, 10, "Cluster    : %s", pr_hostaddress);
    mvprintw(10 + inode, 10, "TNCport    : %s", tncportname);
    mvprintw(11 + inode, 10, "RIGport    : %s", rigportname);
    if (use_bandoutput == 1)
	mvprintw(12 + inode, 10, "Band output: on");
    else
	mvprintw(12 + inode, 10, "Band output: off");

    refreshp();

    mvprintw(23, 22, " --- Press a key to continue --- ");
    refreshp();

    (void)key_get();

    attron(modify_attr(COLOR_PAIR(C_LOG) | A_STANDOUT));
    for (i = 0; i <= 24; i++)
	mvprintw(i, 0,
		 "                                                                                ");

    clear_display();

    return (0);

}
예제 #13
0
파일: changepars.c 프로젝트: wildj79/tlf
int changepars(void)
{
    extern int cluster;
    extern int shortqsonr;
    extern int searchflg;
    extern int demode;
    extern int contest;
    extern int announcefilter;
    extern int showscore_flag;
    extern int zonedisplay;
    extern int trxmode;
    extern char hiscall[];
    extern int rit;
    extern int trx_control;
    extern int editor;
    extern int packetinterface;
    extern int nopacket;
    extern int cqdelay;
    extern int ctcomp;
    extern char *config_file;
    extern int miniterm;
    extern int total;

#ifdef HAVE_LIBHAMLIB
    extern freq_t outfreq;
#else
    extern int outfreq;
#endif

    extern int simulator;
    extern int cwkeyer;
    extern char synclogfile[];
    extern char sc_volume[];
    extern int cwstart;

    char parameterstring[20];
    char parameters[51][19];
    char cmdstring[80];
    int i, k, x, nopar = 0;
    int maxpar = 50;
    int volumebuffer;
    int currentmode = 0;
    int rc;

    strcpy(parameters[0], "SPOT");
    strcpy(parameters[1], "MAP");
    strcpy(parameters[2], "CLOFF");
    strcpy(parameters[3], "CLUSTER");
    strcpy(parameters[4], "SHORT");
    strcpy(parameters[5], "LONG");
    strcpy(parameters[6], "MESSAGE");
    strcpy(parameters[7], "LIST");
    strcpy(parameters[8], "CHECK");
    strcpy(parameters[9], "NOCHECK");
    strcpy(parameters[10], "TONE");
    strcpy(parameters[11], "EDIT");
    strcpy(parameters[12], "VIEW");
    strcpy(parameters[13], "HELP");
    strcpy(parameters[14], "DEMODE");
    strcpy(parameters[15], "CONTEST");
    strcpy(parameters[16], "FILTER");
    strcpy(parameters[17], "SCORE");
    strcpy(parameters[18], "WRITE");
    strcpy(parameters[19], "EXIT");
    strcpy(parameters[20], "TXFILE");
    strcpy(parameters[21], "ZONES");
    strcpy(parameters[22], "CTY");
    strcpy(parameters[23], "MODE");
    strcpy(parameters[24], "SET");
    strcpy(parameters[25], "MULTI");
    strcpy(parameters[26], "PROP");
    strcpy(parameters[27], "RITCLEAR");
    strcpy(parameters[28], "TRXCONTROL");
    strcpy(parameters[29], "CFG");
    //strcpy(parameters[30],  "CWMODE");
    strcpy(parameters[30], "CW");
    strcpy(parameters[31], "SSBMODE");
    strcpy(parameters[32], "DIGIMODE");
    strcpy(parameters[33], "PACKET");
    strcpy(parameters[34], "SIMULATOR");
    strcpy(parameters[35], "INFO");
    strcpy(parameters[36], "FREQ");
    strcpy(parameters[37], "RECONNECT");
    strcpy(parameters[38], "QUIT");
    strcpy(parameters[39], "CQDELAY");
    strcpy(parameters[40], "ADIF");
    strcpy(parameters[41], "SYNC");
    strcpy(parameters[42], "RESCORE");
    strcpy(parameters[43], "SCVOLUME");
    strcpy(parameters[44], "SCAN");
    strcpy(parameters[45], "DEBUG");
    strcpy(parameters[46], "MINITERM");
    strcpy(parameters[47], "RTTY");
    strcpy(parameters[48], "SOUND");
    strcpy(parameters[49], "CWMODE");
    strcpy(parameters[50], "CHARS");

    nopar = 0;

    attroff(A_STANDOUT);
    attron(COLOR_PAIR(C_HEADER));
    mvprintw(12, 29, "PARAMETER?  ");
    refreshp();

    mvprintw(12, 29, "            ");
    mvprintw(12, 29, "");
    refreshp();

    echo();
    getstr(parameterstring);
    noecho();

    for (k = 0; parameterstring[k]; k++)
	parameterstring[k] = toupper(parameterstring[k]);

    for (i = 0; i <= maxpar; i++) {
	if (strncmp(parameterstring, parameters[i], 3) == 0) {
	    break;
	}
    }

    switch (i) {
    case 0:			/* SPOTS) */
	{
	    /* SPOTS not supported anymore
	     * - default to MAP*/
	    cluster = MAP;
	    break;
	}
    case 1:			/* BANDMAP */
	{
	    cluster = MAP;
	    break;
	}
    case 2:			/* CLOFF  */
	{
	    cluster = NOCLUSTER;
	    break;
	}
    case 3:			/* CLUSTER  */
	{
	    cluster = CLUSTER;
	    announcefilter = FILTER_ALL;
	    break;
	}
    case 4:			/* SHORTNR  */
	{
	    shortqsonr = SHORTCW;
	    break;
	}
    case 5:			/* LONGNR  */
	{
	    shortqsonr = LONGCW;
	    break;
	}
    case 6:			/* MESSAGE  */
	{
	    message_change(i);
	    break;
	}

    case 7:			/* LIST  */
	{
	    listmessages();
	    break;
	}
    case 8:			/* CHECK  */
	{
	    searchflg = SEARCHWINDOW;
	    break;
	}
    case 9:			/* NOCHECK  */
	{
	    searchflg = 0;
	    break;
	}
    case 10:			/*  TONE   */
	{
	    set_tone();
	    break;
	}
    case 11:			/*  EDIT   */
	{
	    logedit();
	    break;
	}
    case 12:			/*  VIEW   */
	{
	    logview();
	    break;
	}
    case 13:			/*  HELP   */
	{
	    show_help();
	    break;
	}
    case 14:			/*  DEMODE   */
	{
	    if (demode == SEND_DE)
		demode = 0;
	    else
		demode = SEND_DE;
	    mvprintw(13, 29, "DE-mode is %d", demode);
	    refreshp();
	    sleep(1);

	    break;
	}
    case 15:			/*  CONTEST   */
	{
	    if (contest == CONTEST)
		contest = 0;
	    else {
		contest = CONTEST;
		searchflg = SEARCHWINDOW;
	    }
	    mvprintw(13, 29, "CONTEST-mode is %d", contest);
	    refreshp();
	    sleep(1);

	    break;
	}
    case 16:			/*  FILTER   */
	{
	    announcefilter++;
	    if (announcefilter > 3)
		announcefilter = 0;
	    mvprintw(13, 29, "FILTER-mode is %d", announcefilter);
	    refreshp();
	    sleep(1);

	    break;
	}
    case 17:			/*  SCORE   */
	{
	    if (showscore_flag == 0)
		showscore_flag = 1;
	    else {
		showscore_flag = 0;

	    }
	    mvprintw(13, 29, "Show score-mode is %d", showscore_flag);
	    refreshp();
	    sleep(1);

	    break;
	}
    case 18:			/*  WRITE CABRILLO FILE   */
	{
	    int old_cluster = cluster;
	    cluster = NOCLUSTER;

	    write_cabrillo();

	    cluster = old_cluster;


	    break;
	}
    case 19:			/* EXIT */
    case 38:			/* QUIT */
	{
	    writeparas();
	    clear();
	    cleanup_telnet();
	    endwin();
	    puts("\n\nThanks for using TLF.. 73\n");
	    exit(0);
	    break;
	}
    case 20:			/*  TXFILE   */
	{
	    break;
	}
    case 21:			/*  ZONES   */
	{
	    if (zonedisplay == 0)
		zonedisplay = 1;
	    else {
		zonedisplay = 0;

	    }

	    break;
	}
    case 22:			/* COUNTRIES */
	{
	    show_mults();
	    refreshp();
	    sleep(1);

	    break;
	}
    case 23:			/*  MODE   */
	{
	    if (trxmode == CWMODE)
		trxmode = SSBMODE;
	    else if (trxmode == SSBMODE)
		trxmode = DIGIMODE;
	    else
		trxmode = CWMODE;

	    if (trxmode == CWMODE) {
		mvprintw(13, 29, "TRXMODE = CW");
	    } else if (trxmode == SSBMODE)
		mvprintw(13, 29, "TRXMODE = SSB");
	    else
		mvprintw(13, 29, "TRXMODE = DIG");
	    refreshp();
	    sleep(1);

	    break;
	}
    case 24:			/* SET PARAMETERS */
    case 29:			/* CFG PARAMETERS */
	{
	    clear();
	    if (editor == EDITOR_JOE) {
		strcpy(cmdstring, "joe ");
	    } else if (editor == EDITOR_VI) {
		strcpy(cmdstring, "vi ");
	    } else if (editor == EDITOR_MC) {
		strcpy(cmdstring, "mcedit ");
	    } else {
		strcpy(cmdstring, "e3 ");
	    }

	    strcat(cmdstring, config_file);
	    rc = system(cmdstring);

	    read_logcfg();
	    read_rules();	/* also reread rules file */
	    writeparas();
	    mvprintw(24, 0, "Logcfg.dat loaded, parameters written..");
	    refreshp();
	    clear_display();
	    break;
	}
    case 25:			/*  MULTI   */
	{
	    multiplierinfo();

	    break;
	}
    case 26:			/* PROPAGATION */
	{
	    muf();
	    clear_display();
	    break;
	}
    case 27:			/*  RITCLEAR   */
	{
	    if (rit == RITCLEAR)
		rit = 0;
	    else {
		rit = RITCLEAR;

	    }
	    if (rit == RITCLEAR) {
		mvprintw(13, 29, "RIT clear on");
	    } else {
		mvprintw(13, 29, "RIT clear off");
	    }
	    refreshp();
	    sleep(1);

	    break;
	}
    case 28:			/*  trx ctl   */
	{
	    if (trx_control == 1)
		trx_control = 0;
	    else {
		trx_control = 1;

	    }
	    if (trx_control == 1) {
		mvprintw(13, 29, "TRX control on");
	    } else {
		mvprintw(13, 29, "TRX control off");
	    }
	    refreshp();
	    sleep(1);

	    break;
	}
    case 30:			/* CW  */
    case 49:
	{
	    if (cwkeyer == MFJ1278_KEYER) {
		sendmessage("MODE CW\015K\015");
	    }
	    trxmode = CWMODE;

	    if (trx_control == 1)
		outfreq = SETCWMODE;
	    break;
	}
    case 31:			/* SSBMODE  */
	{
	    trxmode = SSBMODE;
	    outfreq = SETSSBMODE;
	    break;
	}
    case 32:			/* DIGIMODE  */
	{
	    trxmode = DIGIMODE;
	    break;
	}
    case 33:			/* PACKET  */
	{
	    if ((nopacket == 0) && (packetinterface > 0))
		packet();
	    break;
	}
    case 34:			/* SIMULATOR  */
	{
	    if (simulator == 0) {
		simulator = 1;
		if (ctcomp == 1) {
		    mvprintw(13, 19,
			     "The simulator only works in TRmode. Switching to TRmode");
		    ctcomp = 0;
		} else
		    mvprintw(13, 29, "Simulator on");

		refreshp();

		if (cwkeyer == NET_KEYER) {

		    if (netkeyer(K_WORDMODE, NULL) < 0) {
			mvprintw(24, 0,
				 "keyer not active; switching to SSB");
			trxmode = SSBMODE;
			clear_display();
		    }
		}
	    } else {
		simulator = 0;
		mvprintw(13, 29, "Simulator off");
		refreshp();

		if (cwkeyer == NET_KEYER) {

		    if (netkeyer(K_RESET, NULL) < 0) {
			mvprintw(24, 0,
				 "keyer not active; switching to SSB");
			trxmode = SSBMODE;
			clear_display();
		    }
		}

	    }
	    break;
	}
    case 35:			/* INFO  */
	{
	    int currentterm = miniterm;
	    miniterm = 0;
	    networkinfo();
	    miniterm = currentterm;

	    if (currentmode == DIGIMODE)
		trxmode = DIGIMODE;
	    break;
	}
    case 36:			/* CLOFF  */
	{
	    cluster = FREQWINDOW;
	    break;
	}

    case 37:			/* RECONNECT  */
	{
	    if ((nopacket == 0) && (packetinterface > 0)) {
		cleanup_telnet();
		init_packet();
		packet();
	    }
	    break;
	}

    case 39:			/* CQDELAY */
	{
	    mvprintw(12, 29, "CQD: pgup/dwn", cqdelay);
	    refreshp();

	    x = 1;
	    while (x) {
		x = key_get();

		switch (x) {

		// <Page-Up>, increase autoCQ delay by 1/2 second.
		case KEY_PPAGE:
		    {
			if (cqdelay <= 60) {
			    cqdelay++;
			    attron(COLOR_PAIR(C_HEADER) | A_STANDOUT);
			    mvprintw(0, 19, "  ");
			    mvprintw(0, 19, "%i", cqdelay);
			    break;

			}
		    }

		// <Page-Down>, decrease autoCQ delay by 1/2 second.
		case KEY_NPAGE:
		    {
			if (cqdelay >= 1) {
			    cqdelay--;
			    attron(COLOR_PAIR(C_HEADER) | A_STANDOUT);

			    mvprintw(0, 19, "  ");
			    mvprintw(0, 19, "%i", cqdelay);
			    break;

			}
		default:
			x = 0;
		    }

		}
	    }

	    attron(modify_attr(COLOR_PAIR(NORMCOLOR)));

	    mvprintw(12, 29 + strlen(hiscall), "");
	    break;

	}
    case 40:			/* ADIF */
	{
	    write_adif();

	    break;
	}
    case 41:			/* SYNC */
	{
	    if (strlen(synclogfile) > 0)
		synclog(synclogfile);
	    scroll_log();
	    /** \todo register return value */
	    total = 0;
	    readcalls();
	    if (qtcdirection > 0) {
		readqtccalls();
	    }
	    clear_display();
	    break;
	}
    case 42:			/* RESCORE */
	{
	    /** \todo register return value */
	    total = 0;
	    readcalls();
	    if (qtcdirection > 0) {
		readqtccalls();
	    }
	    clear_display();
	    break;
	}
    case 43:			/* SCVOLUME - set soundcard volume */
	{
	    volumebuffer = atoi(sc_volume);
	    mvprintw(12, 29, "Vol: pgup/dwn");
	    refreshp();
	    usleep(500000);
	    mvprintw(12, 29, "Vol:         ");
	    mvprintw(12, 29, "Vol: %d", volumebuffer);

	    x = 1;
	    while (x) {
		x = key_get();

		switch (x) {

		// <Page-Up>, increase volume by 5%.
		case KEY_PPAGE:
		    {
			if (volumebuffer < 95)
			    volumebuffer += 5;

			break;
		    }
		// <Page-Down>, decrease volume by 5%.
		case KEY_NPAGE:
		    {
			if (volumebuffer >= 5)
			    volumebuffer -= 5;

			break;
		    }
		default:
			x = 0;

		}

		attron(COLOR_PAIR(COLOR_GREEN) | A_STANDOUT);
		mvprintw(12, 34, "  ");
		mvprintw(12, 34, "%d", volumebuffer);

		if (volumebuffer >= 0 && volumebuffer <= 99)
		    sprintf(sc_volume, "%d", volumebuffer);

		netkeyer(K_STVOLUME, sc_volume);
	    }

	    clear_display();
	    break;
	}
    case 44:			/* SCAN */
	{
	    int currentterm = miniterm;
	    miniterm = 0;
	    testaudio();
	    clear_display();
	    miniterm = currentterm;
	    break;
	}
    case 45:			/* DEBUG */
	{
	    debug_tty();
	    clear_display();
	    break;
	}
    case 46:			/* MINITERM ON/OFF */
	{
	    if (miniterm == 1)
		miniterm = 0;
	    else
		miniterm = 1;
	    break;
	}
    case 47:			/* RTTY Initialize mode (MFJ1278B controller) */
	{
	    sendmessage("MODE VB\015K\015");
	    trxmode = DIGIMODE;

	    break;
	}
    case 48:			/* SOUND */
	{
	    clear_display();
	    record();
	    clear_display();
	    break;
	}
    case 50:			/* CHARS */
	{
	    mvprintw(13, 29, "Autosend: (0, 2..5, m)?");
	    refreshp();
	    x = 1;

	    /* wait for correct input or ESC */
	    while ((x != 0) && !((x >= 2) && (x <= 5)) && !(x == 'm' - '0') ) {
		x = key_get();
		if (x == 27)
		    break;
		x = x - '0';
	    }

	    /* remember new setting */
	    if (x != 27) {
		if (x == 0 || (x >= 2 && x <= 5))
		    cwstart = x;
		else
		    cwstart = -1;
	    }

	    if (cwstart > 0)
		mvprintw(13,29, "Autosend now: %1d        ",
			cwstart);
	    else {
		if (cwstart < 0 )
		    mvprintw(13,29, "Autosend now: Manual   ");
	        else
		    mvprintw(13,29, "Autosend now: OFF      ");
	    }
	    refreshp();
	    break;

	}
    default:
	{
	    nopar = 1;
	}
    }

    if (nopar != 1) {
	mvprintw(12, 29, "OK !        ");
	writeparas();
    } else {
	if ((nopacket == 0) && (packetinterface > 0))
	    packet();
    }

    refreshp();

    attron(modify_attr(COLOR_PAIR(NORMCOLOR)));

    mvprintw(12, 29, "            ");
    mvprintw(12, 29, "");
    refreshp();
    hiscall[0] = '\0';

    return (0);
}
예제 #14
0
파일: main.c 프로젝트: meersjo/ldapfs
static int fldap_chmod(const char* path, mode_t mode) {
  char buf[32];

  snprintf(buf, 32, "%"PRIi32, mode);
  return modify_attr(path, LDAP_MOD_REPLACE, "stmode", buf);
}
예제 #15
0
파일: log_to_disk.c 프로젝트: wildj79/tlf
/** \brief logs one record to disk
 * Logs one record to disk which may come from different sources
 * (direct from tlf or from other instance via LAN)
 *
 * \param from_lan true - Log lanmessage, false - normal message
 */
int log_to_disk(int from_lan)
{
    extern char hiscall[];
    extern char comment[];
    extern char my_rst[];
    extern char his_rst[];
    extern char last_rst[4];
    extern char qsonrstr[5];
    extern char lan_logline[];
    extern int rit;
    extern int trx_control;
    extern int cqmode;
#ifdef HAVE_LIBHAMLIB
    extern freq_t outfreq;
#else
    extern int outfreq;
#endif
    extern int block_part;
    extern char lan_message[];
    extern char thisnode;
    extern int lan_mutex;
    extern int cqwwm2;
    extern int no_rst;

    pthread_mutex_lock(&disk_mutex);

    if (!from_lan) {		// qso from this node

	addcall();		/* add call to dupe list */

	makelogline();

	store_qso(logline4);

	// send qso to other nodes......
	send_lan_message(LOGENTRY, logline4);

	if (trx_control && (cqmode == S_P))
	    addspot();		/* add call to bandmap if in S&P and
				   no need to ask for frequency */

	hiscall[0] = '\0';	/* reset the call  string */
	comment[0] = '\0';	/* reset the comment  string */

	strncpy(last_rst, his_rst, sizeof(last_rst)); /* remember last report */
	his_rst[1] = '9';	/* restore RST to 599 */
	my_rst[1] = '9';

    } else {			// qso from lan

	strncpy(lan_logline, lan_message + 2, 87);
	strcat(lan_logline,
	       "                                                                              ");

	if (cqwwm2 == 1) {
	    if (lan_logline[0] != thisnode)
		lan_logline[79] = '*';
	}

	lan_logline[87] = '\0';

	total = total + score2(lan_logline);

	addcall2();

	store_qso(lan_logline);
    }


    if (from_lan)
	lan_mutex = 2;
    else
	lan_mutex = 1;

    scroll_log();

    lan_mutex = 0;

    attron(modify_attr(COLOR_PAIR(NORMCOLOR)));	/* erase comment  field */

    if (!from_lan)
	mvprintw(12, 54, "                          ");

    attron(COLOR_PAIR(C_LOG) | A_STANDOUT);
    if (!from_lan) {
	mvprintw(7, 0, logline0);
	mvprintw(8, 0, logline1);
	mvprintw(9, 0, logline2);
    }
    mvprintw(10, 0, logline3);
    mvprintw(11, 0, logline4);
    refreshp();

    attron(COLOR_PAIR(C_WINDOW));

    mvprintw(12, 23, qsonrstr);

    if (no_rst) {
	mvaddstr(12, 44, "---");
	mvaddstr(12, 49, "---");
    } else {
	mvaddstr(12, 44, his_rst);
	mvaddstr(12, 49, my_rst);
    }

    sync();

    if ((rit == 1) && (trx_control == 1))
	outfreq = RESETRIT;

    block_part = 0;		/* unblock use partials */

    pthread_mutex_unlock(&disk_mutex);

    return (0);
}