コード例 #1
0
ファイル: cron.c プロジェクト: enukane/netbsd-src
static const char *
tick(const entry *e)
{
	static char result[1024];

	result[0] = '\0';
	printone(result, sizeof(result), bitprint(e->minute, MINUTE_COUNT));
	printone(result, sizeof(result), bitprint(e->hour, HOUR_COUNT));
	printone(result, sizeof(result), bitprint(e->dom, DOM_COUNT));
	printone(result, sizeof(result), bitprint(e->month, MONTH_COUNT));
	printone(result, sizeof(result), bitprint(e->dow, DOW_COUNT));
	strlcat(result, "flags=", sizeof(result));
	strlcat(result, flagsprint(e->flags), sizeof(result));
	return result;
}
コード例 #2
0
ファイル: main.cpp プロジェクト: duansy2002/Linux-C
int main()
{
	list *head=readfromfile();
	rebuild(head);//排序重建
	int num;
	printf("演示————\n\n输入查找的列:");
	fflush(stdin);
	scanf("%d",&num);
	printcol(head,num);

	printf("\n\n输入查找的行:");
	fflush(stdin);
	scanf("%d",&num);
	printrow(head,num);
	int x,y;
	printf("\n\n输入查找的坐标(x y):");
	fflush(stdin);
	scanf("%d%d",&x,&y);
	printone(head,x,y);
	char name[20]="";
	printf("\n\n输入查找的人名:");
	fflush(stdin);
	scanf("%s",name);
	printaperson(head,name);
	//查找就那么遍历链表就行了,没写。
	
	printsitchart(head);
	return 0;
}
コード例 #3
0
ファイル: 1-cw3b-pretty.cpp プロジェクト: oferoze/Automarking
/*Function to print out the derivative*/
void printderivative( int deri_ele,int maxderi,int deg_deri,int deri[])
{
	int plusd=0;
	int deri_zero=0;
	int zero;
	int deri_x;


	zero=deg_deri;
	for (deri_ele=0,deg_deri=deg_deri;deri_ele<maxderi,deg_deri>0;deri_ele++,deg_deri--)
	{
		/* To reduce the power of x by one after differentiation*/
		deri_x=deg_deri-1;

		/*Call the function to calculate the derivative*/
		derivative(deri[deri_ele],deg_deri);

		/*To make sure that the outputs number 0 is not printed out when 0  are the coefficients*/
		if(deri[deri_ele]!=0)
		{
			if((derivative(deri[deri_ele],deg_deri)==-1)&&(deri_x>0))
			{
				printone(derivative(deri[deri_ele],deg_deri),deri_x,plusd);
			}
			else 
			{
				printnumber(deri_ele,derivative(deri[deri_ele],deg_deri),plusd);
			}

			if(deg_deri>1)
			{
				printdegree(deri_x);
			}
			/*To indicate that there is element printed out so that the derivative is not zero*/
			deri_zero=1;
			/*To indicate that there is element printed out before so that the plus sign will be printed out when it is not at the starting of the polynomial*/
			plusd=1;
		}

		/*To ensure that if the elements of the coefficients before this is all zero the starting of the equation printed out will not have a plus sign in front.
		To ensure that after the last elements of the equation is printed out there will be no plus sign at the end.*/
		if((deri_ele!=maxderi-2)&&(plusd==1))
		{
		/*Call the function to print the plus sign*/
		printplus(deri[deri_ele+1]);
		}
		
	}

	/* To print out the derivative of the polynomial is 0 
	if the input degree is 0 or only the last coefficients of the polynomial is printed out.*/
	if((zero==0)||((deri_ele==maxderi-1)&&(deri_zero==0)))
	{
		printf("0");
	}
}
コード例 #4
0
ファイル: get_procstat.c プロジェクト: mfvalin/modeltools
main()
{
  int verbose = 0;
  int i;
  long scrap[10000000];
  long long int pid, ppid, utime, stime, vsize, rss, rsslim ;
  int tpr;

  for (i=0 ; i<10000000 ; i++) scrap[i]=i;
  tpr = get_my_procstat(&verbose, &pid, &ppid, &utime, &stime, &vsize, &rss, &rsslim);
  printstr("","------------------------------");
  printone("pid", pid);
  printone("ppid", ppid);
  printtime("utime", utime);
  printtime("stime", stime);
  printone("vsize", vsize);
  printone("rss", rss);
  printf("ticks per second: %d\n",tpr);
  printone("rsslim", rsslim);
  return 0;
}
コード例 #5
0
/*------------------------------------------------------------------------
 * arpprint - print the ARP table on descriptor fd
 *------------------------------------------------------------------------
 */
int
arpprint(int fd)
{
	int	i;

	write(fd, HDR1, strlen(HDR1));
	write(fd, HDR2, strlen(HDR2));
	for (i = 0; i<ARP_TSIZE; ++i)
		if (arptable[i].ae_state != AS_FREE)
			printone(fd, &arptable[i]);
	return OK;
}
コード例 #6
0
ファイル: 1-cw3b-pretty.cpp プロジェクト: oferoze/Automarking
/*Function to print out the polynomial*/
void printpolynomial( int element,int maxelement,int deg_poly,int poly[])
{
	/*Assign a variable to ensure that the plus sign is only printed out if the element of the coefficients after the elements of coefficients now is greater than one.
	Is is also to ensure that if the elements of the coefficients before this is all zero the starting of the equation printed out will not have a plus sign in front*/
	int plus=0;

	for (element=0;element<maxelement;element++)
	{
		/*To make sure that the outputs number 0 is not printed out when 0 are the coefficients*/
		if(poly[element] !=0)
		{
			if((poly[element]==1)||(poly[element]==-1))
			{
				/*Function to print the number one and negative one*/
				printone(poly[element],deg_poly,plus);
			}
			/*To print out the number(other than "1" and "-1") of the polynomial.*/
			else
			{
				printnumber(element,poly[element],plus);
			}



			/*call the function to print out the base x with the power*/
			printdegree(deg_poly);
			/*To indicate that there is element printed out before so that the plus sign will be printed out when it is not at the starting of the polynomial*/
			plus=1;
		}

		/*To ensure that if the elements of the coefficients before this is all zero the starting of the equation printed out will not have a plus sign in front.
		To ensure that after the last elements of the equation is printed out there will be no plus sign at the end.*/
		if((element!=maxelement-1)&&(plus==1))
		{
			printplus(poly[element+1]);
		}
		
		/*reduce the power by 1 so the polynomial will print out normally*/
		deg_poly--;
	}

	/*To print that the polynomial is 0 if all the coefficients are 0*/
	if((poly[maxelement-1]==0)&&(plus==0))
	{
		printf("0");
	}
}
コード例 #7
0
int
main(int argc, char **argv)
{
    unsigned arraysize = sizeof(_dwarf_errmsgs) / sizeof(char *);
    unsigned i = 0;
    const char *path = 0;

    if (argc != 3) {
        printf("Expected -f <filename> of DW_DLE lines from libdwarf.h");
        exit(1);
    }
    if (strcmp(argv[1],"-f")) {
        printf("Expected -f");
        exit(1);
    }
    path = argv[2];
    check_dle_list(path);


    if (arraysize != (DW_DLE_LAST + 1)) {
        printf("Missing or extra entry in dwarf error strings array"
            " %u expected DW_DLE_LAST+1 %d\n",arraysize, DW_DLE_LAST+1);
        printone(1);
        printone(100);
        printone(200);
        printone(250);
        printone(260);
        printone(262);
        printone(263);
        printone(264);
        printone(265);
        printone(273);
        printone(274);
        printone(275);
        printone(300);
        printone(328);
        exit(1);
    }
    for ( i = 0; i <= DW_DLE_LAST; ++i) {
        if(check_errnum_mismatches(i)) {
            printf("mismatch value %d is: %s\n",i,_dwarf_errmsgs[i]);
            exit(1);
        }
    }
    /* OK. */
    exit(0);
}