Пример #1
0
int main(int argc, char**argv) {

    FILE * f1,*f2;
    int nb=atoi(argv[argc-1]);
    printf("%d ",nb);
    if(argc>2) {
        f1=fopen(argv[1],"r");
        f2=fopen("fichier2","w");
        creer_fichier(f1,f2,nb);
        fclose(f1);
        fclose(f2);

    }
    else fprintf(stderr,"le fichier %s ne peut etre ouvert",argv[1]);

    return 0;
}
Пример #2
0
/********************************************************************
*																	*
*						 Gestion du menu							*
*																	*
********************************************************************/
boolean MenuSelect(int object, int scan, int state, int button)
{
	int index, entree, key;

	if (object < 0)
	{
		/* attend qu'on relache la souris */
		NoClick();

		if (button < 0)
		{
			/* regarde la touche */
			key = scantoascii(scan);
			if (key == 0)
				key = scan & 0xFF00;	/* scan code */
			else
				key = UpperChar(key);

			for (index = 0; index < NbMenus; index++)
				for (entree = 0; entree < MenuShortCuts[index].nb_entrees; entree++)
					if (MenuShortCuts[index].menu[entree].key == key && MenuShortCuts[index].menu[entree].state == state)
					{
						if (ob_isstate(Menu, MenuShortCuts[index].menuid, DISABLED) == 0 && ob_isstate(Menu, MenuShortCuts[index].menu[entree].itemid, DISABLED) == 0)
						{
							object = MenuShortCuts[index].menu[entree].itemid;
							index = NbMenus;
						}
						break;
					}
		}
	}

	if (object < 0)
		return FALSE;	/* kein entsprechender Eintrag gefunden */

	/* Men�punkte 'Fenster wechseln' und 'Fenster schliežen' werden
	   inklusive der dazugeh”rigen Hotkeys automatisch verwaltet */

	switch (object)
	{
						/* menu Zorg */

		case INFORMATIONS:
			presentation();
			break;

						/* menu Etat */

		case INFORMATION:
			informations(Drive);
			break;

		case REPERTOIRE_LOUPE:
			if (ManageVFAT)
				open_directory_vfat();
			else
				open_directory_short();
			break;

		case TEST_STRUCTURE:
			if (ManageVFAT)
				structure_test_vfat(Drive);
			else
				structure_test_short(Drive);
			break;

		case STATISTIQUES:
			statistiques(Drive);
			break;

		case OCCUPATION:
			occupation(Drive);
			break;

		case TRACE_UN_FICHIER:
			trace_file();
			break;

		case QUITTER:
			if (Reset)
			{
				if (my_alert(1, 2, X_ICN_QUESTION, Messages(MENU_1), Messages(BOOT_32)) == 0)
					shutdown(TRUE);
			}
			else
			{
				button = my_alert(2, 3, X_ICN_QUESTION, Messages(MENU_2), Messages(MENU_4));
				if (button == 0 || button == 1 && (int)xbios(0x11) % 2)
					shutdown(FALSE);
			}
			break;

					/* menu Ouvre */

		case UNITE_LOGIQUE:
			open_disk();
			break;

		case OUVRE_DISQUETTE:
			raw_floppy(FALSE);
			break;

		case OUVRE_DISQUE_DUR:
			raw_hard(FALSE);
			break;

		case OUVRE_FICHIER:
			open_file();
			break;

		case OUVRE_FICHIER_FS:
			open_file_other_fs();
			break;

		case OUVRE_FICH_TEXTE:
			voir_fichier();
			break;

		case CREER_FICHIER:
			creer_fichier();
			break;

		case FERMER:
			fermer(Thefrontwin -> win -> handle);
			break;

		case LIRE_BOOT:
			lire_boot();
			break;

		case CHARGER_BOOT:
			charger_boot();
			break;

		case SAUVER_BOOT:
			sauver_boot();
			break;

		case ECRIRE_BOOT:
#ifdef TEST_VERSION
			/* relache la souris */
			NoClick();

			/* on attend avant de redessiner */
			Event_Timer(0, 0, TRUE);

			my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL);
#else
			ecrire_boot();
#endif
			break;

					/* menu Edition */

		case SAUVER_SECTEUR:
#ifdef TEST_VERSION
			/* relache la souris */
			NoClick();

			/* on attend avant de redessiner */
			Event_Timer(0, 0, TRUE);

			my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL);
#else
			save_secteur(Thefrontwin, MENU_EDITION);
#endif
			break;

		case COPIER_SECTEUR:
			copier_tampon(Thefrontwin);
			break;

		case COLLER_SECTEUR:
			coller_tampon(Thefrontwin);
			break;

		case ECHANGER_TAMPON:
			echanger_tampon(Thefrontwin);
			break;

		case RETOUR_INITIAL:
			load_secteur(Thefrontwin, MENU_EDITION);
			break;

		case OUVRIR_TAMPON:
			ouvrir_tampon();
			break;

		case SAUVER_TAMPON:
			sauver_tampon();
			break;

		case CHARGER_TB_ASCII:
			ascii_tampon();
			break;

		case EFFACER_TAMPON:
			effacer_tampon();
			break;

					/* menu Structure */

		case DEFRAGMENTATION:
#ifdef TEST_VERSION
			/* relache la souris */
			NoClick();

			/* on attend avant de redessiner */
			Event_Timer(0, 0, TRUE);

			my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL);
#else
			reconnect(Drive);
#endif
			break;

		case UNIQUE_LIBRE:
#ifdef TEST_VERSION
			/* relache la souris */
			NoClick();

			/* on attend avant de redessiner */
			Event_Timer(0, 0, TRUE);

			my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL);
#else
			compresse(Drive);
#endif
			break;

		case RESTO_COMPLETE:
#ifdef TEST_VERSION
			/* relache la souris */
			NoClick();

		/* on attend avant de redessiner */
			Event_Timer(0, 0, TRUE);

			my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL);
#else
			restauration_complete(Drive);
#endif
			break;

		case VIDE_CLST_LIBRES:
			nettoie_clusters_libres(Drive);
			break;

		case NETTOIE_REPERTOI:
#ifdef TEST_VERSION
			/* relache la souris */
			NoClick();

			/* on attend avant de redessiner */
			Event_Timer(0, 0, TRUE);

			my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL);
#else
			nettoie_repertoire(Drive);
#endif
			break;

					/* menu Deplacement */

		case SECTEUR_SUIVANT:
			next_secteur(Thefrontwin);
			break;

		case SECTEUR_PRECEDEN:
			previous_secteur(Thefrontwin);
			break;

		case BLOC_SUIVANT:
			next_bloc(Thefrontwin);
			break;

		case BLOC_PRECEDENT:
			previous_bloc(Thefrontwin);
			break;

		case MARQUER_POSITION:
			marquer_position(Thefrontwin);
			break;

		case ALLER_MARQUE:
			goto_marque(Thefrontwin);
			break;

		case ALLER_SECTEUR:
			goto_secteur(Thefrontwin);
			break;

		case CHERCHER_CHAINE:
			search_first(Thefrontwin);
			break;

		case CHERCHER_NOUVEAU:
			search_next(Thefrontwin);
			break;

					/* menu Fenˆtres */

		case CHOIX_FONTE:
			choix_fonte(Thefrontwin);
			break;

		case CHOIX_COULEURS:
			couleur(Thefrontwin);
			break;

		case TAILLE_IDEALE:
			taille_ideale(Thefrontwin);
			break;

		case ASCENSEURS:
			ascenseurs(Thefrontwin);
			break;

		case CYCLER_FENETRES:
			cycle_window();
			break;

		case WINDOW_LIST_1:
		case WINDOW_LIST_2:
		case WINDOW_LIST_3:
		case WINDOW_LIST_4:
		case WINDOW_LIST_5:
		case WINDOW_LIST_6:
		case WINDOW_LIST_7:
		case WINDOW_LIST_8:
		case WINDOW_LIST_9:
		case WINDOW_LIST_10:
			{
				windowptr thewin;

				for (thewin = Firstwindow; thewin; thewin = thewin -> next)
					if (thewin -> menu_entry == object - WINDOW_LIST_1)
						make_frontwin(thewin);
			}
			break;

						/* menu Options */

		case CONFIG_GENERALE:
			config_generale();
			break;

		case CONFIG_DSK:
			config_disques();
			break;

		case RACCOURCIS_CLAVI:
			raccourcis_clavier();
			break;

		case DONNEES_ZORG:
			from_zorg_inf(TRUE);
			break;

		case DONNEES_SYSTEME:
			from_zorg_inf(FALSE);
			break;

		case INVALIDE_CACHE:
			if (Kbshift(FAIL) & 4)
			{
				int i;

				for (i=0; i<MAX_DEVICES; i++)
					change_disque(i, FALSE);
			}
			else
				change_disque(Drive, TRUE);
			break;

		case UPDATE_SYSTEME:
			if (Kbshift(FAIL) & 4)
			{
				int i;

				for (i=0; i<MAX_DEVICES; i++)
					update_systeme(i);
			}
			else
				update_systeme(Drive);
			break;

		case VISU_TEXTE:
			really_voir_fichier(Thefrontwin -> fonction.fichier.nom);
			break;

		case VISU_ASCII:
			secteur_ascii(Thefrontwin);
			break;

		case VISU_HEXA:
			secteur_hexa(Thefrontwin);
			break;

		case AFFICHE_DECIMAL:
			affichage_decimal(Thefrontwin);
			break;

		case FICHIER_ASSOCIE:
			secteur_file(Thefrontwin);
			break;

		case CURSEUR_VISIBLE:
			curseur_on(Thefrontwin);
			break;

		case CLIPBOARD_GEM:
			clipboard_gem(Thefrontwin);
			break;

						/* menu Aide */

		case TABLE_ASCII:
			AsciiChar = m_ascii_box(AsciiChar, FALSE);
			break;

		case AIDE:
			aide();
			break;

		case EXECUTER_PROG:
			lance_prg();
			break;

		case RESET:
			if (Reset)
			{
				Reset = FALSE;
				menu_icheck(Menu, RESET, 0);
			}
			else
			{
				int button;

				button = my_alert(2, 3, X_ICN_QUESTION, Messages(MENU_3), Messages(MENU_5));
				if (button == 1)
					shutdown(TRUE);
				else
					if (button == 0)
						reset();
			}
			break;
	}

	return TRUE;
} /* MenuSelect */
Пример #3
0
int main (){
	creer_fichier();
	afficher_fichier();
}