Ejemplo n.º 1
0
Archivo: m_fdb.c Proyecto: bbs-io/mbse
void EditFile()
{
    FHeader();

    for (;;) {
	set_color(WHITE, BLACK);
	show_str( 7,16,12, fdb.Name);
	show_str( 8,16,64, fdb.LName);
	show_int( 9,16,    fdb.Size);
	mbse_mvprintw(10,16, (char *)"%s %s", StrDateDMY(fdb.FileDate), StrTimeHM(fdb.FileDate));
	mbse_mvprintw(11,16, (char *)"%s %s", StrDateDMY(fdb.LastDL), StrTimeHM(fdb.LastDL));
	mbse_mvprintw(12,16, (char *)"%s %s", StrDateDMY(fdb.UploadDate), StrTimeHM(fdb.UploadDate));
	show_str(13,16,20, fdb.TicArea);
	show_str(14,16,20, fdb.Magic);
	show_str(15,16,36, fdb.Uploader);
	show_int(16,16,    fdb.TimesDL);
	show_str(17,16,15, fdb.Password);

	show_bool(15,75, fdb.Deleted);
	show_bool(16,75, fdb.NoKill);
	show_bool(17,75, fdb.Announced);

	switch(select_menu(6)) {
	    case 0: return;
	    case 1: E_STR( 15,16,35, fdb.Uploader,  "The ^uploader^ of this file")
	    case 2: E_INT( 16,16,    fdb.TimesDL,   "The number of times file is sent with ^download^")
	    case 3: E_STR( 17,16,15, fdb.Password,  "The ^password^ to protect this file with")
	    case 4: E_BOOL(15,75,    fdb.Deleted,   "Should this this file be ^deleted^")
	    case 5: E_BOOL(16,75,    fdb.NoKill,    "File can't be ^killed^ automatic")
	    case 6: E_BOOL(17,75,    fdb.Announced, "File is ^announced^ as new file")
	}
    }
}
Ejemplo n.º 2
0
void FieldsM(void)
{
	set_color(WHITE, BLACK);
	show_str( 7,16,20, getmagictype(magic.Attrib));
	show_str( 8,16,14, magic.Mask);
	show_str( 9,16, 3, getboolean(magic.Active));
	show_str(10,16, 3, getboolean(magic.Deleted));
	show_str(11,16,20, magic.From);

	switch(magic.Attrib) {
		case MG_ADOPT:
		case MG_MOVE:
				show_str(12,16,20, magic.ToArea);
				break;
		case MG_EXEC:
				show_str(12,16,64, magic.Cmd);
				show_bool(13,16, magic.Compile);
				break;
		case MG_UNPACK:
		case MG_COPY:
				show_bool(13,16, magic.Compile);
				show_str(12,16,64, magic.Path);
				break;
		case MG_KEEPNUM:
				show_int(12,16, magic.KeepNum);
				break;
	}
}
Ejemplo n.º 3
0
void EditDates(void)
{
	int	i, x, y;

	clr_index();
	for (;;) {
		set_color(WHITE, BLACK);
		mbse_mvprintw( 5, 6, "10.3.9 EDIT DATES IN MONTH");
		set_color(CYAN, BLACK);
		y = 7;
		x = 5;
		for (i = 0; i < 32; i++) {
			mbse_mvprintw(y, x, (char *)"%2d.  %s", i+1, Month[i]);
			y++;
			if (y == 17) {
				y = 7;
				x += 20;
			}
		}
		set_color(WHITE, BLACK);
		y = 7;
		x = 15;
		for (i = 0; i < 32; i++) {
			show_bool(y,x, hatch.Month[i]);
			y++;
			if (y == 17) {
				y = 7;
				x += 20;
			}
		}

		i = select_menu(32);
		if (i == 0)
			return;
		if (i < 11) {
			y = 6 + i;
			x = 15;
		} else if (i < 21) {
				y = i - 4;
				x = 35;
			} else if (i < 31) {
					y = i - 14;
					x = 55;
				} else {
					y = i - 24;
					x = 75;
				}
		if (i == 32) 
			hatch.Month[i-1] = edit_bool(y, x, hatch.Month[i-1], (char *)"Hatch file in the ^last^ day of the month");
		else
			hatch.Month[i-1] = edit_bool(y, x, hatch.Month[i-1], (char *)"Hatch file on this date");
	}
}
Ejemplo n.º 4
0
void EditDays(void)
{
	int	i;

	clr_index();
	for (;;) {
		set_color(WHITE, BLACK);
		mbse_mvprintw( 5, 6, "10.3.8 EDIT DAYS IN WEEK");
		set_color(CYAN, BLACK);
		for (i = 0; i < 7; i++)
			mbse_mvprintw(7+i, 6, (char *)"%d.  %s", i+1, Days[i]);
		set_color(WHITE, BLACK);
		for (i = 0; i < 7; i++)
			show_bool(7+i,14, hatch.Days[i]);

		i = select_menu(7);
		if (i == 0)
			return;
		hatch.Days[i-1] = edit_bool(6+i, 14, hatch.Days[i-1], (char *)"Hatch file on this day");
	}
}
Ejemplo n.º 5
0
/*
 * Edit one record, return -1 if there are errors, 0 if ok.
 */
int EditNGrpRec(int Area)
{
	FILE	*fil;
	char	mfile[PATH_MAX];
	int	offset;
	int	j;
	unsigned int	crc, crc1;

	clr_index();
	working(1, 0, 0);
	IsDoing("Edit NewfileGroup");

	snprintf(mfile, PATH_MAX, "%s/etc/ngroups.temp", getenv("FTND_ROOT"));
	if ((fil = fopen(mfile, "r")) == NULL) {
		working(2, 0, 0);
		return -1;
	}

	offset = sizeof(ngrouphdr) + ((Area -1) * sizeof(ngroup));
	if (fseek(fil, offset, 0) != 0) {
		working(2, 0, 0);
		return -1;
	}

	fread(&ngroup, sizeof(ngroup), 1, fil);
	fclose(fil);
	crc = 0xffffffff;
	crc = upd_crc32((char *)&ngroup, crc, sizeof(ngroup));
	NgScreen();
	
	for (;;) {
		set_color(WHITE, BLACK);
		show_str(  7,18,12, ngroup.Name);
		show_str(  8,18,55, ngroup.Comment);
		show_bool( 9,18,    ngroup.Active);
		show_bool(10,18,    ngroup.Deleted);

		j = select_menu(4);
		switch(j) {
		case 0:
			crc1 = 0xffffffff;
			crc1 = upd_crc32((char *)&ngroup, crc1, sizeof(ngroup));
			if (crc != crc1) {
				if (yes_no((char *)"Record is changed, save") == 1) {
					working(1, 0, 0);
					if ((fil = fopen(mfile, "r+")) == NULL) {
						working(2, 0, 0);
						return -1;
					}
					fseek(fil, offset, 0);
					fwrite(&ngroup, sizeof(ngroup), 1, fil);
					fclose(fil);
					NGrpUpdated = 1;
					working(6, 0, 0);
				}
			}
			IsDoing("Browsing Menu");
			return 0;
		case 1: E_UPS( 7,18,12,ngroup.Name,"The ^name^ for this message group")
		case 2: E_STR( 8,18,55,ngroup.Comment,"The ^desription^ for this message group")
		case 3: E_BOOL(9,18,   ngroup.Active, "Is this message group ^active^")
		case 4: E_BOOL(10,18,  ngroup.Deleted, "Is this group ^Deleted^")
		}
	}

	return 0;
}
Ejemplo n.º 6
0
/*
 * Edit one record, return -1 if there are errors, 0 if ok.
 */
int EditMGrpRec(int Area)
{
    FILE	    *fil;
    static char	    mfile[PATH_MAX], temp[13];
    static int	    offset;
    static int	    i, j, tmp;
    unsigned int    crc, crc1;
    int		    oldgrp, newgrp;

    clr_index();
    working(1, 0, 0);
    IsDoing("Edit MessageGroup");

    snprintf(mfile, PATH_MAX, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
    if ((fil = fopen(mfile, "r")) == NULL) {
	working(2, 0, 0);
	return -1;
    }

    offset = sizeof(mgrouphdr) + ((Area -1) * sizeof(mgroup));
    if (fseek(fil, offset, 0) != 0) {
	working(2, 0, 0);
	return -1;
    }

    fread(&mgroup, sizeof(mgroup), 1, fil);
    fclose(fil);
    crc = 0xffffffff;
    crc = upd_crc32((char *)&mgroup, crc, sizeof(mgroup));
    MgScreen();
	
    for (;;) {
	set_color(WHITE, BLACK);
	show_str(  7,16,12, mgroup.Name);
	show_str(  8,16,55, mgroup.Comment);
	show_str(  9,16,64, mgroup.BasePath);
	show_sec( 10,16,    mgroup.RDSec);
	show_sec( 11,16,    mgroup.WRSec);
	show_sec( 12,16,    mgroup.SYSec);
	mbse_mvprintw( 13,22,    getflag(mgroup.LinkSec.flags, mgroup.LinkSec.notflags));
	show_int( 14,16,    mgroup.StartArea);
	show_int( 15,16,    mgroup.NetReply);
	show_bool(16,16,    mgroup.UsrDelete);
	show_bool(17,16,    mgroup.Aliases);
	show_bool(18,16,    mgroup.Quotes);
	show_bool(19,16,    mgroup.Active);

	show_bool(14,42,    mgroup.Deleted);
	show_bool(15,42,    mgroup.AutoChange);
	show_bool(16,42,    mgroup.UserChange);
	show_aka( 17,42,    mgroup.UseAka);
	show_aka( 18,42,    mgroup.UpLink);
	show_str( 19,42,12, mgroup.AreaFile);

	show_charset(14,70, mgroup.Charset);
	snprintf(temp, 5, "#%03d", mgroup.GoldEDgroup);
	show_str( 15,70, 5, temp);

	j = select_menu(21);
	switch(j) {
	    case 0: if (!mgroup.StartArea && strlen(mgroup.AreaFile)) {
			errmsg("Areas file defined but no BBS start area");
		        break;
		    }
		    crc1 = 0xffffffff;
		    crc1 = upd_crc32((char *)&mgroup, crc1, sizeof(mgroup));
		    if (crc != crc1) {
			if (yes_no((char *)"Record is changed, save") == 1) {
			    working(1, 0, 0);
			    if ((fil = fopen(mfile, "r+")) == NULL) {
				WriteError("$Can't reopen %s", mfile);
				working(2, 0, 0);
				return -1;
			    }
			    fseek(fil, offset, 0);
			    fwrite(&mgroup, sizeof(mgroup), 1, fil);
			    fclose(fil);
			    MGrpUpdated = 1;
			    working(6, 0, 0);
			}
		    }
		    IsDoing("Browsing Menu");
		    return 0;
	    case 1: if (CheckMgroup())
			break;
		    strcpy(mgroup.Name, edit_str(7,16,12, mgroup.Name, (char *)"The ^name^ for this message group"));
		    if (strlen(mgroup.BasePath) == 0) {
		        memset(&temp, 0, sizeof(temp));
		        strcpy(temp, mgroup.Name);
		        for (i = 0; i < strlen(temp); i++) {
			    if (temp[i] == '.')
				temp[i] = '/';
			    if (isupper(temp[i]))
			        temp[i] = tolower(temp[i]);
			}
		        snprintf(mgroup.BasePath, 65, "%s/var/mail/%s", getenv("MBSE_ROOT"), temp);
		    }
		    break;
	    case 2: E_STR(  8,16,55, mgroup.Comment,    "The ^desription^ for this message group")
	    case 3: E_PTH(  9,16,64, mgroup.BasePath,   "The ^Base path^ where new JAM areas are created", 0770)
	    case 4: E_SEC( 10,16,    mgroup.RDSec,      "9.1.4 MESSAGE GROUP READ SECURITY", MgScreen)
	    case 5: E_SEC( 11,16,    mgroup.WRSec,      "9.1.5 MESSAGE GROUP WRITE SECURITY", MgScreen)
	    case 6: E_SEC( 12,16,    mgroup.SYSec,      "9.1.6 MESSAGE GROUP SYSOP SECURITY", MgScreen)
	    case 7: mgroup.LinkSec = edit_asec(mgroup.LinkSec, (char *)"9.1.7 DEFAULT SECURITY FOR NEW AREAS");
		    MgScreen();
		    break;
	    case 8: E_INT( 14,16,    mgroup.StartArea,  "The ^Start area number^ from where to add areas")
	    case 9: E_INT( 15,16,    mgroup.NetReply,   "The ^Area Number^ for netmail replies")
	    case 10:E_BOOL(16,16,    mgroup.UsrDelete,  "Allow users to ^Delete^ their messages")
	    case 11:E_BOOL(17,16,    mgroup.Aliases,    "Allow ^Aliases^ or real names only")
	    case 12:E_BOOL(18,16,    mgroup.Quotes,     "Allow random ^quotes^ to new messages")
	    case 13:if (mgroup.Active && CheckMgroup())
		        break;
		    E_BOOL(19,16,    mgroup.Active,     "Is this message group ^active^")
	    case 14:if (CheckMgroup())
		        break;
		    E_BOOL(14,42,    mgroup.Deleted,    "Is this group ^Deleted^")
	    case 15:E_BOOL(15,42,    mgroup.AutoChange, "^Auto change^ areas from new areas lists")
	    case 16:tmp = edit_bool(16,42, mgroup.UserChange, (char *)"^Auto add/delete^ areas from downlinks requests");
		    if (tmp && !mgroup.UpLink.zone)
		        errmsg("It looks like you are the toplevel, no Uplink defined");
		    else
		        mgroup.UserChange = tmp;
		    break;
	    case 17:tmp = PickAka((char *)"9.1.17", TRUE);
		    if (tmp != -1)
		    	memcpy(&mgroup.UseAka, &CFG.aka[tmp], sizeof(fidoaddr));
		    MgScreen();
		    break;
	    case 18:mgroup.UpLink = PullUplink((char *)"9.1.18");
		    MgScreen();
		    break;
	    case 19:E_STR( 19,42,12, mgroup.AreaFile,   "The name of the ^Areas File^ from the uplink (case sensitive)")
	    case 20:mgroup.Charset = edit_charset(14, 70, mgroup.Charset);
		    break;
	    case 21:oldgrp = mgroup.GoldEDgroup;
		    newgrp = edit_int(15, 70, oldgrp, (char *)"The new groupnumber for the ^GoldED groups^ (1..999)");
		    if ((newgrp < 1) || (newgrp > 999)) {
			errmsg("Groupnumber must be between 1 and 999");
		    } else if (newgrp && (newgrp != oldgrp)) {
			if (gedgrps[newgrp] == 1) {
			    errmsg("This groupnumber is already in use");
			} else {
			    gedgrps[oldgrp] = 0;
			    gedgrps[newgrp] = 1;
			    mgroup.GoldEDgroup = newgrp;
			}
		    }
		    break;
	}
    }

    return 0;
}
Ejemplo n.º 7
0
Archivo: m_fido.c Proyecto: bbs-io/mbse
/*
 * Edit one record, return -1 if there are errors, 0 if ok.
 */
int EditFidoRec(int Area)
{
    FILE	    *fil;
    char	    mfile[PATH_MAX], *temp;
    int		    offset;
    int		    i, j = 0;
    unsigned int    crc, crc1;

    clr_index();
    working(1, 0, 0);
    IsDoing("Edit Fidonet");

    snprintf(mfile, PATH_MAX, "%s/etc/fidonet.temp", getenv("MBSE_ROOT"));
    if ((fil = fopen(mfile, "r")) == NULL) {
	working(2, 0, 0);
	return -1;
    }

    offset = sizeof(fidonethdr) + ((Area -1) * sizeof(fidonet));
    if (fseek(fil, offset, 0) != 0) {
	working(2, 0, 0);
	return -1;
    }

    fread(&fidonet, sizeof(fidonet), 1, fil);
    fclose(fil);
    crc = 0xffffffff;
    crc = upd_crc32((char *)&fidonet, crc, sizeof(fidonet));

    set_color(WHITE, BLACK);
    mbse_mvprintw( 5, 6, "2.  EDIT FIDONET NETWORK");
    set_color(CYAN, BLACK);
    mbse_mvprintw( 7, 6, "1.  Comment");
    mbse_mvprintw( 8, 6, "2.  Domain name");
    mbse_mvprintw( 9, 6, "3.  Available");
    mbse_mvprintw(10, 6, "4.  Deleted");
    mbse_mvprintw(11, 6, "5.  Main Nodelist");
    mbse_mvprintw(12, 6, "6.  Merge list #1");
    mbse_mvprintw(13, 6, "7.  Merge list #2");
    mbse_mvprintw(14, 6, "8.  Merge list #3");
    mbse_mvprintw(15, 6, "9.  Merge list #4");
    mbse_mvprintw(16, 6, "10. Merge list #5");
    mbse_mvprintw(17, 6, "11. Merge list #6");
    mbse_mvprintw(12,55, "12. Primary zone");
    mbse_mvprintw(13,55, "13. Zone number #2");
    mbse_mvprintw(14,55, "14. Zone number #3");
    mbse_mvprintw(15,55, "15. Zone number #4");
    mbse_mvprintw(16,55, "16. Zone number #5");
    mbse_mvprintw(17,55, "17. Zone number #6");
    temp = calloc(18, sizeof(char));

    for (;;) {
	set_color(WHITE, BLACK);
	show_str( 7,26,40, fidonet.comment);
	show_str( 8,26,8,  fidonet.domain);
	show_bool(9,26,    fidonet.available);
	show_bool(10,26,   fidonet.deleted);
	show_str(11,26,8,  fidonet.nodelist);
	for (i = 0; i < 6; i++) {
	    if ((fidonet.seclist[i].zone) || strlen(fidonet.seclist[i].nodelist)) {
		show_str(i + 12,26,8, fidonet.seclist[i].nodelist);
		snprintf(temp, 18, "%d:%d/%d", fidonet.seclist[i].zone, fidonet.seclist[i].net, fidonet.seclist[i].node);
		show_str(i + 12, 36,17, temp);
	    } else 
		show_str(i + 12,26,27, (char *)"                           ");
	    show_int(i + 12,74, fidonet.zone[i]);
	}

	j = select_menu(17);
	switch(j) {
	    case 0: if (fidonet.available && fidonet.deleted)
			fidonet.available = FALSE;
		    if (fidonet.available && (strlen(fidonet.domain) == 0)) {
			errmsg("You must fill in a valid domain name");
			break;
		    }
		    if (fidonet.available && (fidonet.zone[0] == 0)) {
			errmsg("The network must have a main zone number");
			break;
		    }
		    if (fidonet.available && (strlen(fidonet.nodelist) == 0)) {
			errmsg("You must fill in a nodelist for this network");
			break;
		    }
		    crc1 = 0xffffffff;
		    crc1 = upd_crc32((char *)&fidonet, crc1, sizeof(fidonet));
		    if (crc != crc1) {
			if (yes_no((char *)"Record is changed, save") == 1) {
			    working(1, 0, 0);
			    if ((fil = fopen(mfile, "r+")) == NULL) {
				working(2, 0, 0);
				free(temp);
				return -1;
			    }
			    fseek(fil, offset, 0);
			    fwrite(&fidonet, sizeof(fidonet), 1, fil);
			    fclose(fil);
			    FidoUpdated = 1;
			    working(6, 0, 0);
			}
		    }
		    IsDoing("Browsing Menu");
		    free(temp);
		    return 0;
	    case 1: E_STR(7,26,40, fidonet.comment, "The ^Comment^ for this network name")
	    case 2: E_STR(8, 26,8, fidonet.domain, "The ^Name^ of the network without dots")
	    case 3: E_BOOL(9,26, fidonet.available, "Is this network ^Available^ for use")
	    case 4: E_BOOL(10,26, fidonet.deleted,   "Is this netword ^Deleted^")
	    case 5: E_STR(11,26,8, fidonet.nodelist, "The name of the ^Primary Nodelist^ for this network")
	    case 6:
	    case 7:
	    case 8:
	    case 9:
	    case 10:
	    case 11: strcpy(fidonet.seclist[j-6].nodelist, 
			    edit_str(j+6,26,8, fidonet.seclist[j-6].nodelist, 
				(char *)"The secondary ^nodelist^ or ^pointlist^ name for this domain"));
		    if (strlen(fidonet.seclist[j-6].nodelist)) {
			do {
			    snprintf(temp, 18, "%d:%d/%d", fidonet.seclist[j-6].zone, 
				    fidonet.seclist[j-6].net, fidonet.seclist[j-6].node);
			    strcpy(temp, edit_str(j+6,36,17, temp, 
					(char *)"The top ^fidonet aka^ for this nodelist (zone:net/node)"));
			    if ((strstr(temp, ":") == NULL) || (strstr(temp, "/") == NULL)) {
				working(2, 0, 0);
			    }
			} while ((strstr(temp, ":") == NULL) || (strstr(temp, "/") == NULL));
			fidonet.seclist[j-6].zone = atoi(strtok(temp, ":"));
			fidonet.seclist[j-6].net  = atoi(strtok(NULL, "/"));
			fidonet.seclist[j-6].node = atoi(strtok(NULL, ""));
		    } else {
			fidonet.seclist[j-6].zone = 0;
			fidonet.seclist[j-6].net  = 0;
			fidonet.seclist[j-6].node = 0;
		    }
		    break;
	    case 12:
	    case 13:
	    case 14:
	    case 15:
	    case 16:
	    case 17:E_IRC(j,74, fidonet.zone[j-12], 0, 32767, "A ^Zone number^ which belongs to this domain (1..32767)")
	}
    }

    return 0;
}
Ejemplo n.º 8
0
Archivo: m_ibc.c Proyecto: ftnapps/FTNd
/*
 * Edit one record, return -1 if there are errors, 0 if ok.
 */
int EditIBCRec(int Area)
{
    FILE	    *fil;
    char	    mfile[PATH_MAX];
    int		    offset;
    int		    j;
    unsigned int    crc, crc1;

    clr_index();
    working(1, 0, 0);
    IsDoing("Edit ibcsrv");

    snprintf(mfile, PATH_MAX, "%s/etc/ibcsrv.temp", getenv("FTND_ROOT"));
    if ((fil = fopen(mfile, "r")) == NULL) {
        working(2, 0, 0);
        return -1;
    }

    offset = sizeof(ibcsrvhdr) + ((Area -1) * sizeof(ibcsrv));
    if (fseek(fil, offset, 0) != 0) {
        working(2, 0, 0);
        return -1;
    }

    fread(&ibcsrv, sizeof(ibcsrv), 1, fil);
    fclose(fil);
    crc = 0xffffffff;
    crc = upd_crc32((char *)&ibcsrv, crc, sizeof(ibcsrv));

    set_color(WHITE, BLACK);
    ftnd_mvprintw( 5, 2, "20. EDIT INTERNET BBS CHAT SERVER");
    set_color(CYAN, BLACK);
    ftnd_mvprintw( 7, 2, "1.  Comment");
    ftnd_mvprintw( 8, 2, "2.  Server");
    ftnd_mvprintw( 9, 2, "3.  Dyn. DNS");
    ftnd_mvprintw(10, 2, "4.  Myname");
    ftnd_mvprintw(11, 2, "5.  Password");
    ftnd_mvprintw(12, 2, "6.  Active");
    ftnd_mvprintw(13, 2, "7.  Deleted");
    ftnd_mvprintw(14, 2, "8.  Compress");

    for (;;) {
        set_color(WHITE, BLACK);
        show_str(  7,16,40, ibcsrv.comment);
        show_str(  8,16,63, ibcsrv.server);
        show_bool( 9,16,    ibcsrv.Dyndns);
        show_str( 10,16,63, ibcsrv.myname);
        show_str( 11,16,15, ibcsrv.passwd);
        show_bool(12,16,    ibcsrv.Active);
        show_bool(13,16,    ibcsrv.Deleted);
        show_bool(14,16,    ibcsrv.Compress);

        j = select_menu(8);
        switch(j) {
        case 0:
            crc1 = 0xffffffff;
            crc1 = upd_crc32((char *)&ibcsrv, crc1, sizeof(ibcsrv));
            if (crc != crc1) {
                if (yes_no((char *)"Record is changed, save") == 1) {
                    working(1, 0, 0);
                    if ((fil = fopen(mfile, "r+")) == NULL) {
                        working(2, 0, 0);
                        return -1;
                    }
                    fseek(fil, offset, 0);
                    fwrite(&ibcsrv, sizeof(ibcsrv), 1, fil);
                    fclose(fil);
                    IBCUpdated = 1;
                    working(6, 0, 0);
                }
            }
            IsDoing("Browsing Menu");
            return 0;
        case 1:
            E_STR(  7,16,40,ibcsrv.comment,  "The ^Comment^ for this record")
        case 2:
            E_STR(  8,16,63,ibcsrv.server,   "The known internet ^name^ or ^IP^ address of the remote server")
        case 3:
            E_BOOL( 9,16,   ibcsrv.Dyndns,   "Set to Yes if the remote server uses a ^dynamic dns^ service")
        case 4:
            E_STR( 10,16,63,ibcsrv.myname,   "The known internet ^name^ or ^IP^ address of this server")
        case 5:
            E_STR( 11,16,64,ibcsrv.passwd,   "The ^password^ for this server")
        case 6:
            E_BOOL(12,16,   ibcsrv.Active,   "Switch if this server is ^Active^ for chat")
        case 7:
            E_BOOL(13,16,   ibcsrv.Deleted,  "Is this server to be ^Deleted^")
        case 8:
            E_BOOL(14,16,   ibcsrv.Compress, "Use ^zlib compression^ with this server")
        }
    }

    return 0;
}
Ejemplo n.º 9
0
/*
 * Edit one record, return -1 if record doesn't exist, 0 if ok.
 */
int EditHatchRec(int Area)
{
	FILE		*fil;
	char		mfile[PATH_MAX];
	static char	*tmp = NULL;
	int		offset;
	unsigned int	crc, crc1;
	int		i, All;

	clr_index();
	working(1, 0, 0);
	IsDoing("Edit Hatch");

	snprintf(mfile, PATH_MAX, "%s/etc/hatch.temp", getenv("MBSE_ROOT"));
	if ((fil = fopen(mfile, "r")) == NULL) {
		working(2, 0, 0);
		return -1;
	}

	fread(&hatchhdr, sizeof(hatchhdr), 1, fil);
	offset = hatchhdr.hdrsize + ((Area -1) * hatchhdr.recsize);
	if (fseek(fil, offset, 0) != 0) {
		working(2, 0, 0);
		return -1;
	}

	fread(&hatch, hatchhdr.recsize, 1, fil);
	fclose(fil);
	crc = 0xffffffff;
	crc = upd_crc32((char *)&hatch, crc, hatchhdr.recsize);

	for (;;) {
		HatchScreen();
		set_color(WHITE, BLACK);
		show_str(  7,18,55, hatch.Spec);
		show_str(  8,18,20, hatch.Name);
		show_str(  9,18,14, hatch.Replace);
		show_str( 10,18,14, hatch.Magic);
		show_str( 11,18,55, hatch.Desc);
		show_bool(12,18,    hatch.DupeCheck);
		show_bool(13,18,    hatch.Active);
		show_bool(14,18,    hatch.Deleted);

		for (i = 0; i < 7; i++)
			if (hatch.Days[i]) {
				if (tmp == NULL) {
					tmp = xstrcpy(Days[i]);
				} else {
					tmp = xstrcat(tmp, (char *)", ");
					tmp = xstrcat(tmp, Days[i]);
				}
			}
		if (tmp == NULL)
			tmp = xstrcpy((char *)"None");
		show_str( 15,18,55, tmp);
		if (tmp != NULL) {
			free(tmp);
			tmp = NULL;
		}
		All = TRUE;
		for (i = 0; i < 32; i++)
			if (!hatch.Month[i])
				All = FALSE;
		if (!All) {
			for (i = 0; i < 32; i++)
				if (hatch.Month[i]) {
					if (tmp == NULL) {
						tmp = xstrcpy(Month[i]);
					} else {
						tmp = xstrcat(tmp, (char *)", ");
						tmp = xstrcat(tmp, Month[i]);
					}
				}
		} else
			tmp = xstrcpy((char *)"All dates");
		if (tmp == NULL)
			tmp = xstrcpy((char *)"None");
		show_str( 16,18,55, tmp);
		if (tmp != NULL) {
			free(tmp);
			tmp = NULL;
		}

		switch(select_menu(10)) {
		case 0:
			crc1 = 0xffffffff;
			crc1 = upd_crc32((char *)&hatch, crc1, hatchhdr.recsize);
			if (crc != crc1) {
				if (yes_no((char *)"Record is changed, save") == 1) {
					working(1, 0, 0);
					if ((fil = fopen(mfile, "r+")) == NULL) {
						working(2, 0, 0);
						return -1;
					}
					fseek(fil, offset, 0);
					fwrite(&hatch, hatchhdr.recsize, 1, fil);
					fclose(fil);
					HatchUpdated = 1;
					working(6, 0, 0);
				}
			}
			IsDoing("Browsing Menu");
			return 0;

		case 1:	E_STR(  7,18,55, hatch.Spec,   "Hatch ^path/filespec^. ^?^ is any char, '@' is any alpha, '#' is any number")
		case 2: strcpy(hatch.Name, PickTicarea((char *)"10.3.2"));
			break;
		case 3: E_UPS(  9,18,14, hatch.Replace,   "The ^filename^ to replace by this file")
		case 4: E_UPS( 10,18,14, hatch.Magic,     "The ^magic^ filename for this file")
		case 5: E_STR( 11,18,55, hatch.Desc,      "The ^description^ for this file")
		case 6: E_BOOL(12,18,    hatch.DupeCheck, "Check if this files is a ^duplicate^ hatch")
		case 7: E_BOOL(13,18,    hatch.Active,    "If this file is ^active^")
		case 8: E_BOOL(14,18,    hatch.Deleted,   "If this record is ^Deleted^")
		case 9: EditDays();
			break;
		case 10:EditDates();
			break;
		}
	}
}
Ejemplo n.º 10
0
Archivo: m_ol.c Proyecto: ftnapps/FTNd
/*
 * Edit one record, return -1 if there are errors, 0 if ok.
 */
int EditOnelRec(int Area)
{
	FILE	*fil;
	char	mfile[PATH_MAX];
	int	offset;
	int	j;
	unsigned int	crc, crc1;

	clr_index();
	working(1, 0, 0);
	IsDoing("Edit Oneline");

	snprintf(mfile, PATH_MAX, "%s/etc/oneline.temp", getenv("FTND_ROOT"));
	if ((fil = fopen(mfile, "r")) == NULL) {
		working(2, 0, 0);
		return -1;
	}

	offset = sizeof(olhdr) + ((Area -1) * sizeof(ol));
	if (fseek(fil, offset, 0) != 0) {
		working(2, 0, 0);
		return -1;
	}

	fread(&ol, sizeof(ol), 1, fil);
	fclose(fil);
	crc = 0xffffffff;
	crc = upd_crc32((char *)&ol, crc, sizeof(ol));

	set_color(WHITE, BLACK);
	ftnd_mvprintw( 5, 2, "8.7.1   EDIT ONELINER");
	set_color(CYAN, BLACK);
	ftnd_mvprintw( 7, 2, "1.  Text");
	ftnd_mvprintw( 8, 2, "2.  User");
	ftnd_mvprintw( 9, 2, "3.  Date");
	ftnd_mvprintw(10, 2, "4.  Avail");

	for (;;) {
		set_color(WHITE, BLACK);
		show_str(  7,12,68, ol.Oneline);
		show_str(  8,12,35, ol.UserName);
		show_str(  9,12,10, ol.DateOfEntry);
		show_bool(10,12,    ol.Available);

		j = select_menu(4);
		switch(j) {
		case 0:	crc1 = 0xffffffff;
			crc1 = upd_crc32((char *)&ol, crc1, sizeof(ol));
			if (crc != crc1) {
				if (yes_no((char *)"Record is changed, save") == 1) {
					working(1, 0, 0);
					if ((fil = fopen(mfile, "r+")) == NULL) {
						working(2, 0, 0);
						return -1;
					}
					fseek(fil, offset, 0);
					fwrite(&ol, sizeof(ol), 1, fil);
					fclose(fil);
					OnelUpdated = 1;
					working(6, 0, 0);
				}
			}
			IsDoing("Browsing Menu");
			return 0;
		case 1:	E_STR(  7,12,68,ol.Oneline,    "The ^Oneline^ text to show")
		case 2:	E_STR(  8,12,30,ol.UserName,   "The ^Username^ of the owner of this oneline")
		case 3:	E_STR(  9,12,10,ol.DateOfEntry,"The ^Date^ this oneliner is added, format: ^DD-MM-YYYY^")
		case 4:	E_BOOL(10,12,   ol.Available,  "Is this oneline ^available^")
		}
	}

	return 0;
}
Ejemplo n.º 11
0
int main(int argc, char *argv[])
{
    char **args[3];
    int i=0;
    int n=0;
    bool hardware_matches = true;
    bool multicore = false;
    bool dryrun = false;
    bool debug = false;

    s_cpu cpu;
    console_ansi_raw();
    detect_cpu(&cpu);

    /* If no argument got passed, let's show the usage */
    if (argc == 1) {
	    usage();
	    return -1;
    }

    for (i = 1; i < argc; i++) {
	if (!strcmp(argv[i], "--")) {
	    argv[i] = NULL;
	    args[n++] = &argv[i + 1];
	} else if (!strcmp(argv[i], "64")) {
	    if (debug)
		printf(" 64bit     : %s on this system\n",
		       show_bool(cpu.flags.lm));
	    hardware_matches = cpu.flags.lm && hardware_matches;
	} else if (!strcmp(argv[i], "pae")) {
	    if (debug)
		printf(" pae       : %s on this system\n",
		       show_bool(cpu.flags.pae));
	    hardware_matches = cpu.flags.pae && hardware_matches;
	} else if (!strcmp(argv[i], "hvm")) {
	    if (debug)
		printf(" hvm       : %s on this system\n",
		       show_bool((cpu.flags.vmx || cpu.flags.svm)));
	    hardware_matches = (cpu.flags.vmx || cpu.flags.svm)
		&& hardware_matches;
	} else if (!strcmp(argv[i], "multicore")) {
	    if (debug)
		printf(" multicore : %d cores on this system\n", cpu.num_cores);
	    if (cpu.num_cores > 1)
		multicore = true;
	    hardware_matches = multicore && hardware_matches;
	} else if (!strcmp(argv[i], "smp")) {
	    if (debug)
		printf(" smp       : %s on this system\n", show_bool(cpu.flags.smp));
	    hardware_matches = cpu.flags.smp && hardware_matches;
	} else if (!strcmp(argv[i], "dry-run")) {
	    dryrun = true;
	} else if (!strcmp(argv[i], "debug")) {
	    debug = true;
	}
	if (n >= 2)
	    break;
    }
    while (n < 2) {
	args[n] = args[n - 1];
	n++;
    }
    if (debug) {
	printf("\nBooting labels are : '%s' or '%s'\n", *args[0], *args[1]);
	printf("Hardware requirements%smatch this system, let's booting '%s'\n",
	       hardware_matches ? " " : " doesn't ",
	       hardware_matches ? *args[0] : *args[1]);
	printf("Sleeping 5sec before booting\n");
	if (!dryrun)
	    sleep(5);
    }

    if (!dryrun)
	boot_args(hardware_matches ? args[0] : args[1]);
    else
	printf("Dry-run mode, let's exiting\n");

    return -1;
}
Ejemplo n.º 12
0
/*
 * Edit one record, return -1 if record doesn't exist, 0 if ok.
 */
int EditServiceRec(int Area)
{
	FILE		*fil;
	char		mfile[PATH_MAX];
	int		offset;
	unsigned int	crc, crc1;

	clr_index();
	working(1, 0, 0);
	IsDoing("Edit Service");

	snprintf(mfile, PATH_MAX, "%s/etc/service.temp", getenv("FTND_ROOT"));
	if ((fil = fopen(mfile, "r")) == NULL) {
		working(2, 0, 0);
		return -1;
	}

	fread(&servhdr, sizeof(servhdr), 1, fil);
	offset = servhdr.hdrsize + ((Area -1) * servhdr.recsize);
	if (fseek(fil, offset, 0) != 0) {
		working(2, 0, 0);
		return -1;
	}

	fread(&servrec, servhdr.recsize, 1, fil);
	fclose(fil);
	crc = 0xffffffff;
	crc = upd_crc32((char *)&servrec, crc, servhdr.recsize);

	for (;;) {
		ServiceScreen();
		set_color(WHITE, BLACK);
		show_str(  7,18,15, servrec.Service);
		show_service(8, 18, servrec.Action);
		show_bool( 9,18,    servrec.Active);
		show_bool(10,18,    servrec.Deleted);

		switch(select_menu(4)) {
		case 0:
			crc1 = 0xffffffff;
			crc1 = upd_crc32((char *)&servrec, crc1, servhdr.recsize);
			if (crc != crc1) {
				if (yes_no((char *)"Record is changed, save") == 1) {
					working(1, 0, 0);
					if ((fil = fopen(mfile, "r+")) == NULL) {
						working(2, 0, 0);
						return -1;
					}
					fseek(fil, offset, 0);
					fwrite(&servrec, servhdr.recsize, 1, fil);
					fclose(fil);
					ServiceUpdated = 1;
					working(6, 0, 0);
				}
			}
			IsDoing("Browsing Menu");
			return 0;

		case 1:	E_STR(  7,18,15, servrec.Service,"Enter the ^name^ of this ^service^.")
		case 2: servrec.Action = edit_service(8,18,servrec.Action);
			break;
		case 3: E_BOOL( 9,18,    servrec.Active,    "If this service is ^active^")
		case 4: E_BOOL(10,18,    servrec.Deleted,   "If this record is ^Deleted^")
		}
	}
}