Exemplo n.º 1
0
/*
 * CheckArea()
 *
 * This function deals with the question of whether the given string is a
 * directory and to create it if possible and needed.
 */
char CheckArea(MenuId id, char c, char *drive, char *dir_x)
{
    char work[100];

    switch (c) {
    case IS_DIR:
	return TRUE;
    case NO_IDEA:
	if (strLen(dir_x) != 0) {
	    sprintf(work, "%s does not exist. Create it", dir_x);
	    if (SysopGetYesNo(id, "", work)) {
		DoBdos(SETDISK, toUpper(*drive) - 'A');
		if (mkdir(dir_x) == BAD_DIR) {
		    SysopPrintf(id, "?ERROR CREATING!");
		    homeSpace();
		    return FALSE;
		}
		else {
		    homeSpace();
		    return TRUE;
		}
	    }
	}
	else {
	    return TRUE;
	}
	return FALSE;
    default:
	SysopPrintf(id, "That's not a directory!\n ");
	return FALSE;
    }
}
Exemplo n.º 2
0
/*
 * netGetAreaV2()
 *
 * This gets an area for storing a file.  It handles sysop menus.
 */
int netGetAreaV2(MenuId id, char *fn, struct fl_req *file_data, char ambiguous)
{
    char goodname;

    if (!goodArea(id, "\ndirectory for storage",
			file_data->flArea.naDirname,
			&file_data->flArea.naDisk)) return FALSE;

    file_data->flArea.naDisk -= 'A';
    if (!ambiguous) {
	realSetSpace(file_data->flArea.naDisk, file_data->flArea.naDirname);
	do {
	    if (!getXInternal(id,
			"\nname the file will be stored under",
			file_data->filename, NAMESIZE, fn, fn)) {
		homeSpace();
		return FALSE;
	    }
	    if (access(file_data->filename, 0) == 0) {
		SysopPrintf(id, "'%s' already exists, and ",
					file_data->filename);
		SysopPrintf(id, "will be overwritten during networking.");
		goodname = SysopGetYesNo(id, "", "Is this what you want");
	    }
	    else goodname = TRUE;
	} while (!goodname);
	homeSpace();
    }
    else {
	SysopPrintf(id, "Ambiguous requests may result in overwriting.\n ");
	file_data->filename[0] = 0;
    }
    return TRUE;
}
Exemplo n.º 3
0
/*
 * realSetSpace()
 *
 * This does the real work of SetSpace.
 */
char realSetSpace(char disk, char *dir)
{
    DoBdos(SETDISK, disk);

    getcwd(locDir, 99);

    if (strLen(dir) != 0 && chdir(dir) == BAD_DIR) {
	homeSpace();
	return FALSE;
    }

    return TRUE;
}
Exemplo n.º 4
0
/*
 * sysSendFiles()
 *
 * This is the system dep stuff for sending files.
 */
void sysSendFiles(struct fl_send *sendWhat)
{
    char   temp[100], *last;
    label  mask;

    strCpy(temp, sendWhat->snArea.naDirname);
    switch (fileType(sendWhat->snArea.naDirname, sendWhat->snArea.naDisk)) {
	case IS_DIR:
	    strCpy(mask, ALL_FILES);
	    break;
	case SINGLE_FILE:
	case AMB_FILE:
	    if ((last = strrchr(temp, '\\')) == NULL) {
		strCpy(mask, temp);
		temp[0] = 0;
	    }
	    else {
		strCpy(mask, last + 1);
		if (last != temp)
		    *last = 0;
		else
		    *(last + 1) = 0;
	    }
	    break;
	case NO_IDEA:
	default:
	    sprintf(temp, "Send File: Couldn't do anything with '%s'.",
					sendWhat->snArea.naDirname);
	    netResult(temp);
	    return;
    }
    if (!realSetSpace(toUpper(sendWhat->snArea.naDisk)-'A', temp)) {
	sprintf(msgBuf.mbtext, "Send file: Don't know what to do with %c:%s.",
				sendWhat->snArea.naDisk, temp);
	netResult(msgBuf.mbtext);
    }
    else
	wildCard(netSendFile, mask, "", WC_NO_COMMENTS);
    homeSpace();
}
Exemplo n.º 5
0
/*
 * logMessage()
 *
 * This function puts messages in the CALLLOG.SYS file depending on a number
 * of different events and conditions.
 */
void logMessage(int typemessage, UNS_32 val, int flags)
{
    static int oldDay = 0;
    FILE *fd;
    int  yr, dy, hr, mn, rover;
    char *mon, buf[100];
    char *format = "%s %s @ %d:%02d%s";
    char *SaveName = "callsave.sys";

    if (CallCrash) return;

    if (typemessage == BAUD || typemessage == DOOR_RETURN) {
	BaudRate = val;
    }

    if (cfg.Audit == 0) return;

    makeAuditName(CallFn, "calllog.sys");

    getCdate(&yr, &mon, &dy, &hr, &mn);
    switch (typemessage) {
	case SET_FLAG:
		lgin.flags |= flags;
		break;
	case FIRST_IN:
		oldDay = dy;
		sprintf(buf, format, "System brought up", formDate(), hr, mn,
									"");
		CallMsg(CallFn, buf);
		break;
#ifndef NO_DOORS
	case DOOR_RETURN:
		oldDay  = dy;
		if ((fd = fopen(SaveName, READ_ANY)) != NULL) {
		    fread(&lgin, sizeof lgin, 1, fd);
		    fclose(fd);
		    unlink(SaveName);
		}
		else printf("No luck with %s.", SaveName);
		break;
#endif
	case CRASH_OUT:
	case LAST_OUT:
		sprintf(buf, format, "System brought down", formDate(), hr, mn,
			(typemessage == CRASH_OUT) ? " (crash exit!)" : "");
		CallMsg(CallFn, buf);
		return;
#ifndef NO_DOORS
	case DOOR_OUT:
		if ((fd = fopen(SaveName, WRITE_ANY)) != NULL) {
		    fwrite(&lgin, sizeof lgin, 1, fd);
		    fclose(fd);
		}
		else printf("No luck with %s.", SaveName);
		break;
#endif
	case BAUD:
		lgin.person[0] = 0;
		lgin.flags = 0;
		goto datestuff;		/* ACK!  ACK!  ACK! */
	case L_IN: 
		strCpy(lgin.person, logBuf.lbname);
		lgin.flags = flags;
	case INTO_NET:
datestuff:
		lgin.year = yr;
		lgin.day = dy;
		lgin.hour = hr;
		lgin.minute = mn;
		strcpy(lgin.month, mon);
		break;
	case CARRLOSS:
		homeSpace();	/* back to our regular lair, don't break! */
	case L_OUT:
		lgin.flags |= flags;
		/*
		 * BaudRate > 0 means the user is on the system console.
		 * So this code means "If no person is logged in and
		 * Anonymous session logging is off OR the anonymous user
		 * was at the system console ..."
		 */
		if (!lgin.person[0] &&
			!(cfg.BoolFlags.AnonSessions && BaudRate > 0)) {
		    break;
		}

		if (lgin.lastuserday != dy && lgin.lastuserday != 0)
		    CallMsg(CallFn, "");

		lgin.lastuserday = dy;

		sprintf(buf,
			"%-22s: %2d%s%02d %2d:%02d - %2d:%02d ",
			(strLen(lgin.person)) ? lgin.person : "<No Login>",
			lgin.year, lgin.month, lgin.day, lgin.hour, lgin.minute,
			hr, mn);

		switch (BaudRate) {
		case (UNS_32) 0:
			strcat(buf, "(sysConsole)");
			break;
		case (UNS_32) -1:
			strcat(buf, "(Unknown)");
			break;
		default:
			sprintf(lbyte(buf), "(%ld)", BaudRate);
		}

		for (rover = 0; rover < NumElems(Flags); rover++) {
			if (lgin.flags & Flags[rover].flag)
				sprintf(lbyte(buf), " %c", Flags[rover].val);
		}

		CallMsg(CallFn, buf);

		lgin.person[0] = 0;
		oldDay = dy;
		if (typemessage == CARRLOSS) BaudRate = 0l;
		goto datestuff;
	case OUTOF_NET:
		if (cfg.Audit == 1) {
		    sprintf(buf,
			"System in network mode: %d%s%02d %2d:%02d - %2d:%02d",
			lgin.year, lgin.month, lgin.day, lgin.hour,
			lgin.minute, hr, mn);
		    CallMsg(CallFn, buf);
		}
		break;

	default: printf("crashout: unknown case in switch statement");
    }
}