⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 purge

📁 一个C格式的脚本处理函数库源代码,可让你的C程序具有执行C格式的脚本文件
💻
字号:
#! /usr/bin/env slsh% -*- mode: slang -*-_debug_info = 1;static define purge_file (file, age, print_option){   variable st = stat_file (file);   if (st == NULL)     {	() = fprintf (stderr, "stat %s failed: %s\n", file, errno_string (errno));	return;     }      if (st.st_ctime >= age)     return;      if (print_option)     {	() = fprintf (stdout, "%s\n", file);	return;     }   if (-1 == remove (file))     () = fprintf (stderr, "remove %s failed: %s\n", file, errno_string (errno));}static define purge_usage (){   () = fprintf (stderr, "Usage: %s [-n] NUM-DAYS-OLD files...\n", __argv[0]);   () = fprintf (stderr, "  Files older than NUM-DAYS-OLD be deleted.\n");   () = fprintf (stderr, "  -n ==> Just print the files to be removed but do not remove them.\n");   exit (1);}static define main (argc, argv){   variable age, i, print_option, file;      if (argc < 3) purge_usage ();      i = 2;   print_option = 0;   if (argv[1] == "-n")     {	i++;	print_option = 1;	if (argc < 4)	  purge_usage ();     }   age = __argv[i-1];   if (String_Type == _slang_guess_type (age))     purge_usage ();   age = _time() - atof(age) * 24 * 3600;      foreach (argv[[i:]])     {	file = ();	purge_file (file, age, print_option);     }   exit (0);}main (__argc, __argv);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -